-
Notifications
You must be signed in to change notification settings - Fork 494
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
GL_VERTEX_ATTRIBUTE_NOT_FOUND_IN_SHADER: vertex attribute not found in shader (gl) #940
Comments
That's indeed weird. The info you posted looks good as far as I can see. Also, what GPU and driver version do you have?
This is also crazy... I had some problems in the past with glslangValidator and or SPIRVCross to strip unused attributes, but I haven't seen this sort of behaviour from GL drivers so far. If it turns out that GL drivers are allowed to remove "unused" attributes then I guess the sokol_gfx.h GL backend needs to be a bit more flexible (I'm not sure if it is already enough to just turn the error into a warning, theoretically the vertex attribute should then be disabled, and skipped in _sg_gl_apply_bindings(), might be worth a try though) Lines 8876 to 8923 in 5b6b743
|
I'll just add that despite this attribute being apparently optimised out my code still runs fine. If a whole line of a matrix was gone it would surely produce a bogus transformation matrix. RenderDoc's Mesh View shows the attribute is gone: |
Oh and my driver is
|
I just ran into this when compiling a Zig app that loads a mesh but only has a basic shader that does not use the normals or tangents passed in. When I remove those vertex attributes from the layout, the mesh loads and renders fine. |
it seems like the problem is shdc ignores unused variables (uniform/in/out) so the information never get added into shader descriptor |
Unfortunately this stripping of unused uniforms is something that's out of my control. It may happen in the first compile pass from GLSL to SPIRV, and I also had it happen as secondary effect of the SPIRV-Tools dead code elimination (although I disabled all optimizer passes I could find which involve DCE). Even at runtime, the GLSL compilers in GL drivers are free to remove unused uniforms so that they don't show up in |
The fact openGL strips unused uniforms or attributes is not strange. What is weird is that if you look at my original code the attributes that was "removed" is clearly used. And at the same time all rendering looks correct as if it was present. The attribute that was removed was part of a matrix, so if it was gone, undefined, filed with random data I would surely have corrupted transformations. |
I have this shader
which sokol-shdc turns into this
Clearly the attribute 'amodel3_lmao' is used. I create a pipeline for this shader like this:
Desprite that I get this error when this pipeline is created:
EDIT: After some looking around I guess this is not sokol specific issue, but an OpenGL issue. Still if you have any tips for this that would be appreciated. amodel3 is clearly used for creating the mat4 so how can it be optimised ? If i use it for some other random calculation (for example uv *= amodel3.xz) then it stays.
The text was updated successfully, but these errors were encountered: