A shader compilation error occurs when writing to FOG in a custom shader that uses render_mode fog_disabled. This can be reproduced with all rendering methods.
I suggest ignoring the writes to FOG in this case (likely better for shaders that can have their render mode adjusting for a script). We could also forbid writing to FOG with an error message with this case, but it may be more intrusive.
Forward+
at: _compile_variant (servers/rendering/renderer_rd/shader_rd.cpp:297)
ERROR: Error compiling Fragment shader, variant #9 ().
at: _compile_variant (servers/rendering/renderer_rd/shader_rd.cpp:293)
ERROR: Failed parse:
WARNING: 0:74: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
"precision mediump int; precision highp float;"
ERROR: 0:2242: 'fog' : undeclared identifier
ERROR: 0:2242: 'a' : vector swizzle selection out of range
ERROR: 0:2242: '' : compilation terminated
ERROR: 3 compilation errors. No code generated.
at: _compile_variant (servers/rendering/renderer_rd/shader_rd.cpp:294)
ERROR: code:
[... Shader code printed here ...]
at: _compile_variant (servers/rendering/renderer_rd/shader_rd.cpp:297)
ERROR: Parameter "p_version->variants" is null.
at: _allocate_placeholders (servers/rendering/renderer_rd/shader_rd.cpp:487)
ERROR: Parameter "p_version->variants" is null.
at: _allocate_placeholders (servers/rendering/renderer_rd/shader_rd.cpp:487)
ERROR: Parameter "p_version->variants" is null.
at: _allocate_placeholders (servers/rendering/renderer_rd/shader_rd.cpp:487)
ERROR: Condition "!shader_singleton->shader.version_is_valid(version)" is true.
at: set_code (servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp:182)
Mobile
ERROR: Error compiling Fragment shader, variant #0 ().
at: _compile_variant (servers/rendering/renderer_rd/shader_rd.cpp:293)
ERROR: Failed parse:
WARNING: 0:69: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
"precision mediump int; precision highp float;"
ERROR: 0:1788: 'fog' : undeclared identifier
ERROR: 0:1788: 'a' : vector swizzle selection out of range
ERROR: 0:1788: '' : compilation terminated
ERROR: 3 compilation errors. No code generated.
at: _compile_variant (servers/rendering/renderer_rd/shader_rd.cpp:294)
[... Shader code printed here ...]
at: _compile_variant (servers/rendering/renderer_rd/shader_rd.cpp:297)
ERROR: Condition "!shader_singleton->shader.version_is_valid(version)" is true.
at: set_code (servers/rendering/renderer_rd/forward_mobile/scene_shader_forward_mobile.cpp:193)
Tested versions
System information
Godot v4.3.beta (da4f6e439) - Fedora Linux 40 (KDE Plasma) - X11 - GLES3 (Compatibility) - NVIDIA GeForce RTX 4090 (nvidia; 555.58.02) - 13th Gen Intel(R) Core(TM) i9-13900K (32 Threads)
Issue description
A shader compilation error occurs when writing to
FOG
in a custom shader that usesrender_mode fog_disabled
. This can be reproduced with all rendering methods.I suggest ignoring the writes to
FOG
in this case (likely better for shaders that can have their render mode adjusting for a script). We could also forbid writing toFOG
with an error message with this case, but it may be more intrusive.Forward+
Mobile
Compatibility
Steps to reproduce
FOG
in a custom shader that hasrender_mode fog_disabled;
at its top.Minimal reproduction project (MRP)
Fog.Shader.Compatibility.Issue.MRP2.zip
One of the boxes in the MRP uses a built-in shader with
render_mode fog_disabled;
.