-
Notifications
You must be signed in to change notification settings - Fork 200
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
Incorrect uniform layout with mat2 #308
Comments
Using target |
Digging deeper. Here's {
"stage": "vs",
"uniform_blocks": [{
"type": "params",
"name": "_15",
"slot": 0,
"size": 96,
"members": [{
"name": "viewProj",
"type": "mat4",
"num": 1,
"offset": 0,
"matrix_stride": 16
}, {
"name": "model",
"type": "mat2",
"num": 1,
"offset": 64,
"matrix_stride": 16
}]
}],
"textures": [],
"inputs": [{
"name": "position",
"type": "vec4",
"slot": 0
}, {
"name": "texcoord0",
"type": "vec2",
"slot": 2
}],
"outputs": [{
"name": "uv",
"type": "vec2"
}]
} |
I tried putting the
It's using |
Thanks for the detailed bug report :) This might be a bug in one of those places:
I guess I need to update the shader toolchain to the latest version SPIRVCross first so that I can drop my own fork. This will be quite a bit of work, and I probably won't get around to this in the next few weeks. Can you workaround the problem for now? |
It turned out that I needed a I tried
I don't remember where I read it but I know that So I used a No worries and thanks for the libraries! I'm really enjoying using Oryol and its ecosystem. |
Summary
I added a
mat2
uniform to my vertex shader. I assigned it an identity matrix so I was surprised when my mesh stopped displaying. I replaced the uniform by the literal identitymat2(vec2(1, 0), vec2(0, 1))
and the mesh displayed correctly.So I checked with Nvidia Nsight and I found the issue.
My uniform declaration:
My uniform data looks like this (
params[0]
on the GPU):The generated vertex shader tries to initialize the
mat2
like this:mat2(params[4].xy, params[5].xy)
According to the data it should be:
mat2(params[4].xy, params[4].zw)
Test case
https://github.com/Ohmnivore/battle/tree/5c88e270fef19618425dbfa82b6217bc87c7dafc
Overview (the project only has two source files):
code/shaders.glsl
code/BattleApp.cc
(BattleApp::OnRunning):Generated files
The text was updated successfully, but these errors were encountered: