Skip to content

Fix struct variable size with out-of-order offsets#264

Merged
spencer-lunarg merged 2 commits intoKhronosGroup:mainfrom
spencer-lunarg:spencer-lunarg-so2
Apr 27, 2024
Merged

Fix struct variable size with out-of-order offsets#264
spencer-lunarg merged 2 commits intoKhronosGroup:mainfrom
spencer-lunarg:spencer-lunarg-so2

Conversation

@spencer-lunarg
Copy link
Copy Markdown
Contributor

This is follow-up for #263

I realize the struct size itself is still wrong

name     : ubo (UniformBufferObject)
    // size = 16, padded size = 16
    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 = 12 UNUSED
    } ubo;      

name     : ubo2 (UniformBufferObject2)
    // size = 4, padded size = 4
    struct UniformBufferObject2 {
        float b; // abs offset = 4, rel offset = 4, size = 4, padded size = 12 UNUSED
        float a; // abs offset = 0, rel offset = 0, size = 4, padded size =  4 UNUSED
    } ubo2;     

The size of ubo2 is not // size = 4, padded size = 4 and should be 16

Comment thread spirv_reflect.c
}
}

if (p_var->member_count > 0) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

first commit is just removing this line, ParseDescriptorBlockVariableSizes starts with a check for this

@spencer-lunarg spencer-lunarg merged commit ee5b57f into KhronosGroup:main Apr 27, 2024
@spencer-lunarg spencer-lunarg deleted the spencer-lunarg-so2 branch April 27, 2024 10:12
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.

2 participants