treeform / shady

Nim to GPU shader language compiler and supporting utilities.
MIT License
147 stars 10 forks source link

syntax error, unexpected '=', expecting ',' or ';' #4

Closed Nycto closed 2 years ago

Nycto commented 2 years ago

I've got the following test code:

proc vertexShade(position: Vec3, in_color: Vec4, color: var Vec4, gl_Position: var Vec3) =
    color = in_color
    gl_Position = position

const vertexShader = toGLSL(vertexShade, "300 es")

Trying to use the generated code results in the following error:

0:12(7): error: syntax error, unexpected '=', expecting ',' or ';'
#version 300 es
precision highp float;
// from vertexShade

in vec3 position;
in vec4 in_color;
out vec4 color;

void main() {
  vec4 = in_color;
  gl_Position = position;
}
 wasn't compiled.
0:12(7): error: syntax error, unexpected '=', expecting ',' or ';'

It looks like vec4 is being treated like a variable name instead of a type

treeform commented 2 years ago

I think color is a function to create colors, so it probably gets confused. Does it work if you use any other name?

treeform commented 2 years ago

I have added this as a test case. This issue appears to have been fix. Please use #head version of vmath for now.