Closed BarabasGitHub closed 4 weeks ago
I think the issue is that the custom struct with two floats is actually 16 bytes instead of the 8 bytes I expected it to be.
I cannot reproduce the problem (https://godbolt.org/z/G3YnYddza). Can you please provide a compiler explorer link that demonstrates the problem?
Yes, it needs a constant buffer instead of a structured buffer: https://godbolt.org/z/4PKheP3jG
@cassiebeckley Can you take a look at this?
I believe this is working as intended. cbuffer
s are lowered to Vulkan uniform buffers using vector-relaxed std140 layout, described in the Vulkan standard as extended alignment, which states that a structure type's alignment must be rounded up to a multiple of 16.
If you want to use C-like structure layout, you may use the flag -fvk-use-scalar-layout
: https://godbolt.org/z/rWadrKfnd.
Any time the compiler produces SPIR-V that fails validation we consider it a bug. If the offsets are invalid for the resource type/layout rules then we should fail earlier in compilation with a more descriptive error message.
I still have the bug that the decoration doesn't have any effect when I then try to feed the struct to BDA pointer making templates
Description Putting a custom struct at a particular offset with
vk::offset
generates invalid spir-v while putting a builtin vector with the same size there works fine.Steps to Reproduce
Actual Behavior Produces invalid spir-v:
Environment dxcompiler.dll: 1.7 - 1.7.2308.7 (69e54e290); dxil.dll: 1.7(101.7.2308.12) Windows 10 version 22H2 build 19045.3803