AcademySoftwareFoundation / AcademySoftwareFoundation/MaterialX
GLSL code generation does not detect reserved name nor integer constant usage
Open
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 2.3k
- Forks
- 464
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 12
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the GLSL code generator and reproduce the failure with the XML example in a desktop viewer or node editor. Trace how node names are validated or patched, then verify that names containing '__' and names beginning with digits no longer produce the reported shader compilation errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100