Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shader compilation error when calling textureSize on the normal roughness texture #87202

Closed
danbolt opened this issue Jan 15, 2024 · 0 comments · Fixed by #87207
Closed

Shader compilation error when calling textureSize on the normal roughness texture #87202

danbolt opened this issue Jan 15, 2024 · 0 comments · Fixed by #87207

Comments

@danbolt
Copy link

danbolt commented Jan 15, 2024

Tested versions

  • Reproduced with Godot v4.3.dev2.official [3524346]
  • Cannot reproduce with v4.2.1.stable.official [b09f793]

System information

Godot v4.3.dev2 - Pop!_OS 22.04 LTS - X11 - Vulkan (Forward+) - integrated Intel(R) UHD Graphics 620 (KBL GT2) () - Intel(R) Core(TM) i5-8350U CPU @ 1.70GHz (4 Threads)

Issue description

When creating a shader of type spatial, calling textureSize on the normal roughness texture will cause a shader error.

An example might be:

shader_type spatial;

uniform sampler2D normal_roughness_buffer: hint_normal_roughness_texture;

void fragment() {
	ivec2 normal_roughness_size = textureSize(normal_roughness_buffer, 0);
	ALBEDO = vec3(1.0, 0.0, 0.0);
}

image

The error output is quite long (>10000 lines) but, the initial text indicates:

servers/rendering/renderer_rd/shader_rd.cpp:470 - Condition "f.is_null()" is true.
  (3) servers/rendering/renderer_rd/shader_rd.cpp:483 - Parameter "p_version->variants" is null.
  servers/rendering/renderer_rd/forward_clustered/scene_shader_forward_clustered.cpp:181 - Condition "!shader_singleton->shader.version_is_valid(version)" is true.
  servers/rendering/renderer_rd/shader_rd.cpp:293 - Error compiling Fragment shader, variant #0 (
  #define MODE_RENDER_DEPTH
  ).
  servers/rendering/renderer_rd/shader_rd.cpp:294 - Failed parse:
  WARNING: 0:73: '' : all default precisions are highp; use precision statements to quiet warning, e.g.:
           "precision mediump int; precision highp float;" 
  ERROR: 0:2210: 'normal_roughness_compatibility' : no matching overloaded function found 
  ERROR: 0:2210: '=' :  cannot convert from ' const float' to ' temp highp 2-component vector of int'
  ERROR: 0:2210: '' : compilation terminated 
  ERROR: 3 compilation errors.  No code generated.

Steps to reproduce

  1. Create an empty 3D scene
  2. Create a MeshInstance with a ShaderMaterial
  3. In the mesh's material's shader, call textureSize on the normal roughness texture
  4. Note the errors compiling shaders

Minimal reproduction project (MRP)

normal_roughness.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants