Skip to content
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

Fix struct padded size if offset are out-of-order #263

Merged
merged 1 commit into from
Apr 24, 2024

Conversation

spencer-lunarg
Copy link
Contributor

closes #262

layout(offset = 16) float d;
} ubo;

layout(binding = 0, std430) uniform UniformBufferObject2 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before this shader was

struct UniformBufferObject {
    float a; // abs offset =  0, rel offset =  0, size = 4, padded size =  4 UNUSED
    float b; // abs offset =  4, rel offset =  4, size = 4, padded size =  4 UNUSED
    float c; // abs offset =  8, rel offset =  8, size = 4, padded size =  8 UNUSED
    float d; // abs offset = 16, rel offset = 16, size = 4, padded size = 16 UNUSED
} ubo;      

struct UniformBufferObject2 {
    float b; // abs offset =  4, rel offset =  4, size = 4, padded size = 4294967292 UNUSED
    float a; // abs offset =  0, rel offset =  0, size = 4, padded size =         16 UNUSED
    float c; // abs offset = 16, rel offset = 16, size = 4, padded size = 4294967288 UNUSED
    float d; // abs offset =  8, rel offset =  8, size = 4, padded size =          8 UNUSED
} ubo2;     

but now the bottom one looks like

struct UniformBufferObject2 {
    float b; // abs offset =  4, rel offset =  4, size = 4, padded size =  4 UNUSED
    float a; // abs offset =  0, rel offset =  0, size = 4, padded size =  4 UNUSED
    float c; // abs offset = 16, rel offset = 16, size = 4, padded size = 16 UNUSED
    float d; // abs offset =  8, rel offset =  8, size = 4, padded size =  8 UNUSED
} ubo2;     

@spencer-lunarg spencer-lunarg merged commit 8cac559 into KhronosGroup:main Apr 24, 2024
5 checks passed
@spencer-lunarg spencer-lunarg deleted the spencer-lunarg-so branch April 24, 2024 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Out of order offsets compute incorrect padding sizes
2 participants