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

gl_Position warning #34

Open
crystalthoughts opened this issue Aug 20, 2024 · 1 comment
Open

gl_Position warning #34

crystalthoughts opened this issue Aug 20, 2024 · 1 comment

Comments

@crystalthoughts
Copy link

crystalthoughts commented Aug 20, 2024

Hi - the following shader gives a warning:

#version 300 es
in vec4 aPosition;
out vec2 vUV;

void main() {
    vUV = aPosition.xy * 0.5 + 0.5;
    gl_Position = aPosition;
}

Encountered undefined variable: "gl_Position"

is there a way to prevent this? Thanks for your library, so useful :)

@AndrewRayCode
Copy link
Collaborator

AndrewRayCode commented Aug 27, 2024

This is a known problem, and there are two issues:

  1. The parser does not have a way to specify if the input source code is vertex or fragment code. Right now the parser accepts a superset of GLSL that includes both valid vertex and fragment code. This is also called out in the limitations section of the readme.
  2. The parser does not currently respect the "7.1 Built-In Language Variables" section of the Khronos grammar spec, which includes definitions for variables like gl_Position. Right now the parser does not auto-include global variables. I think I need to solve 1 before I can address 2.

One quick option you have for now is to parse with {quite: true} as a parser option. This will hide warnings for truly undefined variables, but it might work for your use case.

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

No branches or pull requests

2 participants