Skip to content
This repository was archived by the owner on Jun 18, 2021. It is now read-only.
This repository was archived by the owner on Jun 18, 2021. It is now read-only.

UBO array's will be misaligned if their size isn't a power of 2 #53

Closed
@ocboogie

Description

@ocboogie

I was using the example from lyon, here, and I came across are weird issue. If the Primitive type's size wasn't a power of 2 (e.g. 16, 32, 64), excluding 4 or 8, the array would be misaligned in the shader, making the first primitive render fine, but subsequent primitives wouldn't.
I created a repo, here, to isolate the problem, with two branches, one showing the problem with the size of 8 bytes, and one working with the size of 32 bytes. There's a comment, here, explaining how to make the 8 byte version work. Similarly, there's a comment, here explaining how to make the 32 byte version stop working.
I've tried Vulkan and DirectX 12, both seeming to be having this issue.
I'm not sure if this is a problem directly with wgpu-rs, or if it's a problem with wgpu, rendy, or gfx-hal, but I'll just post it here, because that's what I'm directly working with.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions