armory3d / armory

3D Engine with Blender Integration
https://armory3d.org
zlib License
3.05k stars 317 forks source link

Build failing due to shader compile error "Unhandled promise rejection." #2194

Open ItsCubeTime opened 3 years ago

ItsCubeTime commented 3 years ago
Armory v2021.5 ($Id: 99497c80048d5b0614144ab4b87fb2303e416be2 $)
WARNING: Logic node tree and generated trait names differ! Node tree: "movement", trait: "Movement"
Armory: Using CPU for environment render (might be slow). Enable CUDA if possible.
Saved: 'C:\Users\Oliver\Desktop\Armory test 3.0.0\build_untitled\compiled\Assets\envmaps\env_orangecorridor.jpg'
 Time: 00:00.21 (Saving: 00:00.02)

Exporting Scene
Scene exported in 0.012s

ERROR: C:\Users\Oliver\Desktop\Armory test 3.0.0\build_untitled\compiled\Shaders\std/light.glsl:151: 'LWVPSpot' : undeclared identifier
ERROR: C:\Users\Oliver\Desktop\Armory test 3.0.0\build_untitled\compiled\Shaders\std/light.glsl:151: 'LWVPSpot' :  left of '[' is not of type array, matrix, or vector
ERROR: C:\Users\Oliver\Desktop\Armory test 3.0.0\build_untitled\compiled\Shaders\std/light.glsl:151: '=' :  cannot convert from ' const float' to ' temp 4-component vector of float'
ERROR: C:\Users\Oliver\Desktop\Armory test 3.0.0\build_untitled\compiled\Shaders\deferred_light.frag.glsl:182: '' : compilation terminated
ERROR: 4 compilation errors.  No code generated.

ERROR: Linking fragment stage: Missing entry point: Each stage requires one entry point

SPIR-V is not generated for failed compile or link

Compiling shader 8 of 23 (deferred_light.frag.glsl) failed:
Shader compiler error.
(node:16072) UnhandledPromiseRejectionWarning: Shader compiler error.
(node:16072) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:16072) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Finished in 2.119s
WARNING: 1 warning occurred during compilation
ERROR: Build failed, check console

Ive played around quite a bit with the lights in the scene, seems there are some incompatability issues.

The blend file: untitled (2).zip

onelsonic commented 3 years ago

I'm on windows > my blender 2.83.X and 2.9X won't open your file and crash blender everytime. Can you try and delete all unnecessary assets then purge your file and re save.

what is your blender version and platform?

MoritzBrueckner commented 3 years ago

Just a guess: this could be caused by optimizations of the shader compiler which might transform uniform mat4 LWVPSpot[1] from an array to a single matrix (uniform mat4 LWVPSpot) because the array only consists of one element. This would then lead to the error complaining that LWVPSpot is not an array. It would be a bit dumb but sounds like a plausible explanation to me.

N8n5h commented 3 years ago

I think this error occurs because you have or had both spot and area lights in your project and the exporter is picking them and adds both _LTC and _Spot flags for the shader parser when exporting. It then results in a situation where no uniform LWVPSpot is defined because there is no case where both type of lights exists at the same time in the conditionals, since it seems they share variable names for some reason.

https://github.com/armory3d/armory/blob/3b72fff76d98710b25dbd8aa044dd4c4fd2de20a/Shaders/std/light.glsl#L26-L33 https://github.com/armory3d/armory/blob/3b72fff76d98710b25dbd8aa044dd4c4fd2de20a/Shaders/std/light.glsl#L60-L79