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 1.3 support #16

Open
yuri-karadzhov opened this issue Jul 27, 2017 · 3 comments
Open

GLSL 1.3 support #16

yuri-karadzhov opened this issue Jul 27, 2017 · 3 comments

Comments

@yuri-karadzhov
Copy link

I'm trying to use glsl-man to parse webgl2 shaders, but got this error:

Module build failed: SyntaxError: Expected "(" or whitespace but "v" found.

My shaders are valid shaders and look like this
vshader

#version 300 es

in vec4 a_position;

void main() {
  gl_Position = a_position;
}

fshader

#version 300 es

precision mediump float;

out vec4 outColor;

void main() {
  outColor = vec4(0, 1, 0, 1);
}

Is this tool supposed to work with webgl2 shaders? Are there any plans to add such support if not?

@DiThi
Copy link

DiThi commented Jul 27, 2017

Judging by today's changes I'd say it's planned. In the mean time I do something like this:

vsource = vsource.replace(/^in\s/gm, 'attribute ').replace(/^out\s/gm, 'varying ')
fsource = fsource.replace(/^in\s/gm, 'varying ')
fsource = fsource.replace(/^out\s+(\w+)\s+(\w+)\s*;/gm, '#define $2 gl_FragColor')

@yuri-karadzhov
Copy link
Author

Thanks! There is a 100to300 transpiler that do pretty much the same, but I really wanna use new API so it won't be enough.

@lammas
Copy link
Owner

lammas commented Jul 27, 2017

300 syntax is planned [read: desired], but progress towards this has been slow due to time constraints.
Now that I know there are others out there that need this, I will try to get more work done in that direction. :)
And of course any contributions are welcome.

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

No branches or pull requests

3 participants