Skip to content

impr: Emit a suppressible warning when a schema that's not uniform-aligned is used in a uniform buffer #2448

@iwoplaza

Description

@iwoplaza
const Params = d.struct({
  start: d.vec2f,
  end: d.vec2f,
});

// ⚠️ [unaligned-uniforms] Type `Params` was used in a uniform buffer, but isn't aligned to 16 bytes. This may cause issues on some devices.
const paramsUniform = root.createUniform(Params);

How to suppress:

const root = await tgpu.init({
  suppress: {
    // false by default
    'unaligned-uniforms': true,
  },
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    stabilityTasks that focus on improving stability, that includes tests, refining edge-cases, refactoring.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions