Skip to content

Padding and input layout (question) #7

Description

@Gitii

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions