Open borisbat opened 3 years ago
When are you calling bgfx_create_uniform
? Try calling that before bgfx_create_shader_program
When are you calling
bgfx_create_uniform
? Try calling that beforebgfx_create_shader_program
I've added bgfx_create_uniform before the program creation, like this:
bgfx_create_uniform("c_offset", bgfx_uniform_type BGFX_UNIFORM_TYPE_VEC4, 1u)
var compute_program = bgfx_create_compute_shader_program(COMPUTE_SRC, render_type)
and that made it work. Is that the intended use? I.e. do I have to create all uniforms before creating the programs?
In the original code uniform was created after the creation of the program, but set before program was used.
Hey Boris! Long time no see! :)
Is that the intended use? I.e. do I have to create all uniforms before creating the programs?
This is actually not intended use, rather shortcoming/bug of how shaderc process GLSL compute shaders. glsl-optimizer doesn't do compute shaders, shaders get just preprocessed and output as raw shader without compilation/optimization step, and there is no reflection.
Hey Boris! Long time no see! :)
:)
output as raw shader without compilation/optimization step, and there is no reflection.
I'm doing daScript integration ( daScript.org ). So I have all the information necessary and then some. I can create all uniforms before hand, or I can provide all that extra info to the shader compiler - if there is a way to do so.
I can create all uniforms before hand, or I can provide all that extra info to the shader compiler - if there is a way to do so.
Yes, the best is to create all uniforms before creating shaders. Once I fix shaderc this requirement will be gone, but no ETA yet.
Yes, the best is to create all uniforms before creating shaders.
Found a case where it crashes DX12 renderer (and DX12 only, DX11 and OpenGL work fine). I'll keep the workaround as OpenGL only thing for now.
Uniforms are not found and not set with OpenGL renderer in the compute program. Works fine with DX11 and DX12. I'm using C99 bindings.
Not sure how easy it would be to provide simple C repro, since this is using bindings for another programming language. I'm willing to participate in remote debugging session of any kind.
Log:
Direct3D11 log for comparison
Shader itself:
Program body (just in case)