Comments (7)
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?
If i use it for some other random calculation (for example uv *= amodel3.xz) then it stays.
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
from sokol.
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?
If i use it for some other random calculation (for example uv *= amodel3.xz) then it stays.
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:
from sokol.
Oh and my driver is
OpenGL vendor string: AMD
OpenGL renderer string: AMD Radeon RX 590 Series (polaris10, LLVM 16.0.6, DRM 3.54, 6.5.9-zen2-1-zen)
OpenGL core profile version string: 4.6 (Core Profile) Mesa 23.2.1-arch1.2
OpenGL core profile shading language version string: 4.60
from sokol.
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.
from sokol.
it seems like the problem is shdc ignores unused variables (uniform/in/out) so the information never get added into shader descriptor
from sokol.
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 glGetUniformLocation
.
from sokol.
it seems like the problem is shdc ignores unused variables (uniform/in/out) so the information never get added into shader descriptor
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.
from sokol.
Related Issues (20)
- macOS huge memory usage when window minimized HOT 1
- Questions regarding default GL version HOT 5
- App Window Size on Android HOT 3
- Default value _sg_gl_uniform_t::gl_loc when uniform_desc's name isn't given in sokol_gfx HOT 1
- sokol_gfx.h: wrong define in log related to SOKOL_TRACE_HOOKS HOT 1
- WebGPU TextureView validation error HOT 6
- sokol_fetch on Android
- partial updates to buffers/textures (e.g. offset and size args to glBufferSubData, glTexSubImage) HOT 1
- Right shift is recognized as "invalid key" on Windows. HOT 9
- SAPP_EVENT_CHAR for Space is fired when Ctrl+Space is pressed. HOT 2
- Key events on Linux always use the **first** keyboard layout in the system's keyboard layout list. HOT 1
- Continuous Bind Slots Restriction Unnecessary? HOT 3
- Feature request: Please drop the direct use of int, short, etc in favour of int_least32_t, int_least16_t HOT 9
- attributeless rendering support HOT 2
- WebGL Offscreen rending is broken in Chrome v127 on Mac M1 and MacOS 14.5. HOT 22
- Manage AltGr key combinations in windows backends HOT 2
- windows WM_TOUCH events? HOT 3
- WebGL context lost handling HOT 2
- sokol_gl.h: should not skip rendering completely if a 'FULL' error is encountered.
- Any plans on supporting writing WGSL for all gfx_backends? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sokol.