You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works but if you try to extend it by adding an additional field of type float, it goes wrong. There's no runtime error, but the shader ends up picking up data from the wrong offset within this structure.
This turns out to be because the code in ShanqQueryExecutor that works through all the fields in all the bindings only emits the offset of the field if the field is of a matrix type:
This seems to work. But if there's some reason only matrix types should be used here, then the query exector should probably have an else branch there throwing an exception to say that other types are not supported.
The text was updated successfully, but these errors were encountered:
The UniformBuffers example in the SharpVk-Samples repo defines this type to enable the application to pass arguments into the shaders:
This works but if you try to extend it by adding an additional field of type
float
, it goes wrong. There's no runtime error, but the shader ends up picking up data from the wrong offset within this structure.This turns out to be because the code in
ShanqQueryExecutor
that works through all the fields in all the bindings only emits the offset of the field if the field is of a matrix type:SharpVk/src/SharpVk.Shanq/ShanqQueryExecutor.cs
Lines 137 to 150 in 1167c3f
So if you add, say, a
float
field, the GPU ends up thinking it needs to look at offset 0.As a quick hack I just added this
else
to theif
in that loop:(or you could just move the relevant line out of the
if
I suppose, but I was trying to not to spread changes out across too much code).With that in place, you can now do something like this:
and then access this from, e.g. a vertex shader:
This seems to work. But if there's some reason only matrix types should be used here, then the query exector should probably have an
else
branch there throwing an exception to say that other types are not supported.The text was updated successfully, but these errors were encountered: