godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.07k stars 20.19k forks source link

Shader compilation failure when opening editor #50546

Closed qarmin closed 3 years ago

qarmin commented 3 years ago

Godot version

4.0 de83ee5

This is caused by https://github.com/godotengine/godot/pull/50402

System information

Ubuntu 20.04

Issue description

Opening editor cause showing this error about failed fragment shader compilation

ERROR: Error compiling Fragment shader, variant #0 ().
   at: _compile_variant (servers/rendering/renderer_rd/shader_rd.cpp:269)
ERROR: Failed parse:
ERROR: 0:2358: 'light_compute' : no matching overloaded function found 
ERROR: 0:2358: '' : compilation terminated 
ERROR: 2 compilation errors.  No code generated.

   at: _compile_variant (servers/rendering/renderer_rd/shader_rd.cpp:270)
ERROR: code:
   1 | 
   2 | #version 450
   3 | 
   4 | 
   5 | 
   6 | #define MAX_ROUGHNESS_LOD 7.0
   7 | 
   8 | #define USE_RADIANCE_CUBEMAP_ARRAY 
   9 | 
  10 | #define MAX_DIRECTIONAL_LIGHT_DATA_STRUCTS 8
  11 | 
  12 | #define MAX_LIGHTMAP_TEXTURES 2
  13 | 
  14 | #define MAX_LIGHTMAPS 2
  15 | 
  16 | #define MATERIAL_UNIFORM_SET 3
  17 | 
  18 | #define VERTEX_CODE_USED
  19 | #define FRAGMENT_CODE_USED
  20 | 
  21 | /* Specialization Constants */
  22 | 
  23 | //unused but there for compatibility
  24 | layout(constant_id = 0) const bool sc_use_forward_gi = false;
  25 | layout(constant_id = 1) const bool sc_use_light_projector = false;
  26 | layout(constant_id = 2) const bool sc_use_light_soft_shadows = false;
  27 | 
  28 | /* Include our forward mobile UBOs definitions etc. */
  29 | #define M_PI 3.14159265359
  30 | #define MAX_VIEWS 2
  31 | 
  32 | #if defined(USE_MULTIVIEW) && defined(has_VK_KHR_multiview)
  33 | #extension GL_EXT_multiview : enable
  34 | #endif
  35 | 
  36 | 
  37 | struct DecalData {
  38 |  mat4 xform; //to decal transform
  39 |  vec3 inv_extents;
  40 |  float albedo_mix;
  41 |  vec4 albedo_rect;
  42 |  vec4 normal_rect;
  43 |  vec4 orm_rect;
  44 |  vec4 emission_rect;
  45 |  vec4 modulate;
  46 |  float emission_energy;
  47 |  uint mask;
  48 |  float upper_fade;
  49 |  float lower_fade;
  50 |  mat3x4 normal_xform;
  51 |  vec3 normal;
  52 |  float normal_fade;
  53 | };
  54 | 
  55 | #if !defined(MODE_RENDER_DEPTH) || defined(MODE_RENDER_MATERIAL) || defined(TANGENT_USED) || defined(NORMAL_MAP_USED)
  56 | #ifndef NORMAL_USED
  57 | #define NORMAL_USED
  58 | #endif
  59 | #endif
  60 | 
  61 | /* don't exceed 128 bytes!! */
  62 | /* put instance data into our push content, not a array */
  63 | layout(push_constant, binding = 0, std430) uniform DrawCall {
  64 |  mat4 transform; // 64 - 64
  65 |  uint flags; // 04 - 68
  66 |  uint instance_uniforms_ofs; //base offset in global buffer for instance variables   // 04 - 72
  67 |  uint gi_offset; //GI information when using lightmapping (VCT or lightmap index)    // 04 - 76
  68 |  uint layer_mask; // 04 - 80
  69 |  vec4 lightmap_uv_scale; // 16 - 96 doubles as uv_offset when needed
  70 | 
  71 |  uvec2 reflection_probes; // 08 - 104
  72 |  uvec2 omni_lights; // 08 - 112
  73 |  uvec2 spot_lights; // 08 - 120
  74 |  uvec2 decals; // 08 - 128
  75 | }

Look at the CI for example log - https://github.com/godotengine/godot/runs/3089620152 in step "Open and Close editor"

Steps to reproduce

Above

Minimal reproduction project

No response

qarmin commented 3 years ago

Fixed by https://github.com/godotengine/godot/pull/50501