-
-
Notifications
You must be signed in to change notification settings - Fork 168
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 runtime error if using gl_PrimitiveID
#1302
Comments
The GLSL code gets compiled to an earlier GLSL version - HTML5 can not support version 450, Linux can support it sometimes. There's an option to change the target GLSL version for Linux somewhere. For HTML5 we would have to add support for compiling to WebGL 1 and 2 shaders and choose the best one at runtime. |
--shaderversion is the option to try for Linux, --shaderversion 300 might be an ok-ish value for most systems. |
Oh and for html5 we already do that multi-shader-compilation. Does webgl2 work in your browser? |
Building with that option gives me different errors:
With |
No, 300 was just wrong, it's not a thing. 330 would have been correct. |
Yes, with
Yes — this is what https://webglreport.com/?v=2 says about it:
|
Describe the bug
Runtime error if trying to use
gl_PrimitiveID
.To Reproduce
Steps to reproduce the behavior:
Take for example https://github.com/Kha-Samples/Shader and use
gl_PrimitiveID
in the fragment shader — as a silly example I've simply changed the fragment shader byExpected behavior
No runtime error messages.
Execution Environment:
Host system (where you compile your code): Linux Mint 19.2 (Linux 4.15.0-132-generic x86_64)
Target system (where you run your code): Linux Mint 19.2 (Linux 4.15.0-132-generic x86_64)
IDE used (if any): Compiled with
node ./Kha/make linux-native --debug --compile
Kha revision: 76061fe
Kha build output (Using Kha...): Using Kha (76061fe) from /home/valentin/Escritorio/Work/tests/Kha-Samples/Shader/Kha
Application output (Linux):
Additional context
I'm not sure if this is really a bug or not, I'm very new to graphics programming. But it looks like it to me, since at runtime the application complains about requiring #version 150 at least, but the example uses #version 450, and that global variable looks like it should be available in GLSL since #version 150 ( https://www.khronos.org/registry/OpenGL-Refpages/gl4/html/gl_PrimitiveID.xhtml )... but, clearly this is Kha, not OpenGL/WebGL directly, so if it isn't intended to have this kind of variables available, sorry for the noise.
Maybe related?
Tested also with Kha master — same errors both in Linux and HTML5.
The text was updated successfully, but these errors were encountered: