Closed kavika13 closed 2 years ago
Same is true if trying to change it to an int
parameter it seems
This is using the version available in downloads , which I am starting to think is out of sync with sokol_gfx since several defines seem to have been renamed.
Edit: I compiled from source and the problem still persists.
Re strikeout text above - I thought I had updated sokol_gfx, but turns out I just updated the directory name but hadn't updated the source code. After updating the source code and updating my app, the generator seems to be working correctly, besides this bug.
Hi, yes, this is part oversight and part "known limitation".
The oversight is that this shouldn't silently fail, but instead output a proper error message.
The limitation is that sokol-gfx only supports floating point uniforms (float, vec2, vec3 and vec4). This limitation mainly has the reason that for OpenGL backends, uniforms are packed into arrays, so that updates happen with a single glUniform4fv() call. Such a packed uniform array cannot contains items of bool or integer type.
There are a number of related issues in the sokol repository (to allow more uniform types here:
...but this also requires a matching solution for the shader compiler (maybe pack uniforms into array by base type - bool, int and float), but I'm not sure SPIRVCross has support for this).
I'm going to close this issue because of the latest uniform-type changes in sokol-shdc and sokol_gfx.h.
The following new uniform types are allowed: int, ivec2, ivec3 and ivec4, but no bool types. Bools are out unfortunately because SPIRVCross generally wants to convert those to uint, which isn't supported by GLES2/WebGL. SPIRVCross basically errors out on the first bool it encounters when the target shader dialect is GLSL100... which is probably an oversight in SPIRVCross (I guess it could just as well have used int instead of uint as 'target type').
sokol-shdc now also has a check that only the expected "base types" (float and int) are used in uniform blocks.
Once the GLES2 and WebGL backends can be dropped from sokol_gfx.h this type of stuff won't be an issue anymore, because then sokol_gfx.h doesn't need to care about the uniform block interior anymore.
Uncomment the boolean parameter and its usage in the fragment shader, and the shader compiler will not output any error message, and will not output any .h file