You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the minifier glsl-min-stream does not work correctly when a shader contains both the variables x and the vector subscript myVec.x.
The reason is that glsl-parser seems to re-use the node of the AST for both occurences of 'x'. -> The minifier first gets the node with node.type == 'ident', node.token.type == 'ident' (for the variable x). Then, the minifier gets the same node (equal by reference) with node.type == 'literal', node.token.type == 'ident'.
The minifier will minify the occurence as a variable. As a side effect, the occurence as a vector subscript will also be minified! This breaks the shader.
I think that glsl-min-stream is correctly implemented, but glsl-parser should not re-use the same node for different types of AST nodes.
Example: Because of this parser bug, following code...
float w = abs(projPosition.w);
if (projPosition.z > -w && projPosition.z < w) { /*... */ }
Currently, the minifier glsl-min-stream does not work correctly when a shader contains both the variables x and the vector subscript myVec.x.
The reason is that glsl-parser seems to re-use the node of the AST for both occurences of 'x'. -> The minifier first gets the node with node.type == 'ident', node.token.type == 'ident' (for the variable x). Then, the minifier gets the same node (equal by reference) with node.type == 'literal', node.token.type == 'ident'.
The minifier will minify the occurence as a variable. As a side effect, the occurence as a vector subscript will also be minified! This breaks the shader.
I think that glsl-min-stream is correctly implemented, but glsl-parser should not re-use the same node for different types of AST nodes.
Example: Because of this parser bug, following code...
...is minified to:
The text was updated successfully, but these errors were encountered: