Skip to content

metal uniform buffer size issue #185

Description

@m4b

so i'm seeing this issue on metal iOS:

SIZEOF UNIFORM: 204
validateFunctionArguments:3478: failed assertion `Vertex Function(main0): argument uniforms[0] from buffer(0) with offset(0) and length(204) has space for 204 bytes, but argument has a length(208).'

when i print my uniform std::mem::size_of above, it's 204, but metal refuses to run with this assertion error, so something is adding 4 bytes to the uniform buffer argument? if i add 4 to the size here it proceeds without error (presumably because it has enough space for the 208 byte argument now):

        let uniform_buf = device.create_buffer(
            &wgpu::BufferDescriptor {
                size: uniform_size + 4,
                usage: wgpu::BufferUsage::UNIFORM | wgpu::BufferUsage::TRANSFER_DST,
            }
        );

this doesn't seem to happen on macOS only iOS; i'm guessing something is attempting to add padding so its mod sizeof(ptr) ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions