[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] WebGL vs Khronos GLSL compiler: illegal chars in inactive #if / #endif blocks



Hi,

I just noticed that the WebGL compilers at least in Firefox, Chrome
and Safari on OSX reject shader source code when #if/#endif blocks
that are not taken contain illegal characters (in my case a '$'),
while the Khronos reference compiler doesn't complain about this. Now
I know that WebGL might do additional shader validation that the
Khronos compiler doesn't know/care about, but when looking for similar
bugs in the FF and Chrome bug trackers I found that a similar problem
existed a few years ago with illegal characters in comments.

My question is whether shader source in inactive #if/#endif blocks
should be treated like a comment and not be included in the validation
(for instance the code in inactive #if/#endif blocks could be meant
for other platforms, if the shader source was generated and contains
conditionally compiled code for multiple platforms). Basically,
whether the current behaviour is an implementation bug (which I'm
happy to write tickets for), or whether it 'works as intended'?

The WebGL spec is not very clear, and only mentions comments, and
non-ASCII characters (but a '$' is clearly a valid ASCII character):

https://www.khronos.org/registry/webgl/specs/1.0/#6.19

Also, the error reporting could be better. Chrome and Safari just say
"WebGL: INVALID_VALUE: shaderSource: string not ASCII" in the JS
console, Firefox at least tells me the ASCII code of the character I
should look for: "Error: WebGL: shaderSource: String contains the
illegal character '36'", but both don't tell me the location in the
shader source code where the problems occurs.

Cheers,
-Floh.

-----------------------------------------------------------
You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------