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

Disabling shader pre-processor displays editor-only error about unknown built-ins #78482

Closed
MenacingMecha opened this issue Jun 20, 2023 · 2 comments · Fixed by #79287
Closed

Comments

@MenacingMecha
Copy link

Godot version

4.0.3.stable

System information

Linux - Godot v4.0.3.stable - Vulkan (Forward+)

Issue description

Disabling the shader pre-processor with #pragma disable_preprocessor causes errors to be displayed about built-ins being unknown. However, the shader will correctly compile and function as normal - the error is only in the shader editor.

Example screenshot:
Screenshot from 2023-06-20 17-55-20

Steps to reproduce

  1. Open project
  2. Open error-example.gdshader in shader editor
  3. Observe error

Minimal reproduction project

godot-4-shader-preprocessor-editor-error-minimal-reproduction-project-main.zip

Can also be found at: https://github.com/MenacingMecha/godot-4-shader-preprocessor-editor-error-minimal-reproduction-project

@akien-mga
Copy link
Member

CC @bitsawer @Chaosus

@clayjohn
Copy link
Member

This issue comes from putting the disable_preprocessor line before the shader_type definition. Re-ordering to:

shader_type canvas_item;
#pragma disable_preprocessor

void fragment() {
	COLOR = texture(TEXTURE, UV);
}

removes the error.

We should do two things as a result:

  1. Clarify in the processor docs that #pragma disable_preprocessor has to be below the shader_type definition; and
  2. Add an error to the engine if something is above the shader_type definition

@clayjohn clayjohn added this to the 4.x milestone Jun 20, 2023
@YuriSizov YuriSizov modified the milestones: 4.x, 4.2 Jul 10, 2023
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.

4 participants