Hi,
I have a question about the padding in hlsl structs and the corresponding c# structs:
In "Using C# structures with HLSL constant buffers" you describe the importance of padding:
One conclusion: The members must not cross the 16-byte boundary but be padded correctly (either by using explicit memory layout or implicit by addtional members).
But in the sample code:
I am very confused now. Could you please explain, why your sample code works? (no offense just confused)
My guess is that the driver reads the memory as described (without special padding) and inserts padding on GPU-side. But the buffers are created with an exact size... so there must be a "better" explanation.
Thank you very much,
Gitii
(seemingly related to a question on stackoverflow which is essentialy the same)
Hi,
I have a question about the padding in hlsl structs and the corresponding c# structs:
In "Using C# structures with HLSL constant buffers" you describe the importance of padding:
One conclusion: The members must not cross the 16-byte boundary but be padded correctly (either by using explicit memory layout or implicit by addtional members).
But in the sample code:
I am very confused now. Could you please explain, why your sample code works? (no offense just confused)
My guess is that the driver reads the memory as described (without special padding) and inserts padding on GPU-side. But the buffers are created with an exact size... so there must be a "better" explanation.
Thank you very much,
Gitii
(seemingly related to a question on stackoverflow which is essentialy the same)