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

GLSL code generation does not detect reserved name nor integer constant usage #2045

Open
kwokcb opened this issue Oct 1, 2024 · 0 comments

Comments

@kwokcb
Copy link
Contributor

kwokcb commented Oct 1, 2024

Issue

The GLSL code generator will not recognize that

  • '__' anywhere in the node name, or
  • node names which start with numbers
    are invalid.

Each generator is supposed to patch invalid names but these are currently not detected.

Example

<?xml version="1.0"?>
<materialx version="1.39">
  <add name="12" type="color3" xpos="10.173913" ypos="-3.275862" />
  <surfacematerial name="surfacematerial" type="material" xpos="17.710144" ypos="-1.258621">
    <input name="surfaceshader" type="surfaceshader" nodename="standard_surface_surfaceshader" />
  </surfacematerial>
  <standard_surface name="standard_surface_surfaceshader" type="surfaceshader" xpos="13.050725" ypos="-7.758621">
    <input name="base_color" type="color3" nodename="12" />
    <input name="specular_color" type="color3" nodename="a__" />
  </standard_surface>
  <add name="a__" type="color3" xpos="10.376812" ypos="-6.172414" />
</materialx>

Errors (can load into desktop viewer or node editor:

Error in compiling fragment shader:
0(27) : error C0000: syntax error, unexpected integer constant, expecting ';' at token "<int-const>"
0(28) : error C0000: syntax error, unexpected integer constant, expecting ';' at token "<int-const>"
0(29) : error C7528: OpenGL reserves names containing '__'
0(30) : error C7528: OpenGL reserves names containing '__'
0(1902) : error C0000: syntax error, unexpected integer constant, expecting ';' or '(' at token "<int-const>"
0(1903) : error C7528: OpenGL reserves names containing '__'
0(1905) : error C0000: syntax error, unexpected identifier, expecting ')' at token "_out"

This was created by editing node names in the node editor.

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

1 participant