-
Notifications
You must be signed in to change notification settings - Fork 512
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
Q: gfx: Quad rendering on Metal but not OpenGL #1117
Comments
Can you try building/running with One thing that looks wrong is that the shader-desc struct is missing uniform descriptions like this: ..specifically for this uniform block: layout (std140, binding=0) uniform matrices
{
mat4 projection;
mat4 view;
mat4 model;
}; For the non-GL APIs you need to provide at least the size of the uniform block (e.g. in this case 3 * 64 bytes), and for the GL backend you'll need to describe the interior of the uniform block (e.g. that it consists of 3 mat4's). With the sokol-gfx validation layer enabled, you should at least get errors in the Also, since you are recompiling the shader anyway, also check out the sokol-shdc tool, this is specifically tailored to sokol-gfx: https://github.com/floooh/sokol-tools/blob/master/docs/sokol-shdc.md PS: also those defer calls in the get_shader_desc function look suspicious, any data referenced by the ShaderDesc struct needs to survive until the make_shader call returns. |
Scratch that, I was just being dumb... I forgot to rebuild the C libraries so that they match the updated Odin bindings... |
I have changed the pipeline creation to this:
Where it passes that Shader_Uniform_Block_Desc to the vertex shader ( |
...wait no, that's actually fine because the attr position is defined by layout(location)... Hmm... did you try running the code in RenderDoc to check what actually arrives down in OpenGL? |
PPS: how do you initialize the OpenGL context, e.g. do you actually create a version 4.5 context? Since you pass through the GL shader code as is, I would expect that the Is your project public somewhere so that I could have a look, that would simplify the 'remote debugging' a lot. ...also the various |
@floooh I have sent you an email with the link to the full project source code. The defers are fine they just store paths to the shaders. |
Btw, one thing I just noticed while working on the sokol-shdc tool, since your uniforms are inside a uniform block, they need to be referred as follows in the shader desc: uniforms = {
0 = {name = "matrices.projection", type = .MAT4, array_count = 1},
1 = {name = "matrices.view", type = .MAT4, array_count = 1},
2 = {name = "matrices.model", type = .MAT4, array_count = 1},
}, You can also keep the Little details like this are also taken care of by the sokol-shdc tool. This would also not produce an error message, since uniform names which couldn't be looked up are ignored ( Lines 9398 to 9400 in 38e4c9a
|
Tried with that but still no shot |
Hello, I have the following shaders:
and
For MSL, I use glslcc to re-compile. The way I get a shader descriptor:
This is how I make my pipeline and buffers:
For some reason, on Metal, this works perfectly fine, for OpenGL, I just passthrough the original GLSL code. Why does it render on one but not the other?
Those two are the same program running, with only shaders deferring. What causes this discrepancy?
The text was updated successfully, but these errors were encountered: