Skip to content

Fragment shader integer built-ins incorrectly require flat #503

Open

Description

@Firestar99

Integer Built-ins in fragment shaders currently require the flat decoration, like in our compiletest:

#[spirv(primitive_id, flat)] primitive_id: u32,
#[spirv(sample_id, flat)] sample_id: u32,
#[spirv(sample_mask, flat)] sample_mask: [u32; 1],
#[spirv(sample_position)] sample_position: Vec2,
#[spirv(viewport_index, flat)] viewport_index: u32,

otherwise compile will fail with:

error: `Fragment` entry-point `Input` parameter must be decorated with `#[spirv(flat)]`
    --> crates/restir-shader/src/visibility/raster.rs:40:39
     |
  40 |     #[spirv(primitive_id)] primitive_id: u32,
     |                                          ^^^

However, decorating them with flat makes no sense and may even be illegal, since they are builtins, and flat configures interpolation behaviour.

Activity

  1. Firestar99 commented on Jan 5, 2026

    @Firestar99
    MemberAuthor

    I'm willing to leave this one as a "won't fix" since we're discussing a whole entry point redesign anyway

  2. self-assigned this
    on Jan 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions