Rust-GPU / Rust-GPU/rust-gpu

Fragment shader integer built-ins incorrectly require `flat`

Open
#503 1 comment 0 reactions 1 assignee View on GitHub

@Firestar99 is already working on this.

Since Jan 5, 2026.

bug
Dominant language
Rust
Stars
3.4k
Forks
125
PR merge metrics
No merged PRs in 30d

Description

Integer Built-ins in fragment shaders currently require the flat decoration, like in our compiletest:
https://github.com/Rust-GPU/rust-gpu/blob/a30bd43db45f2bfe260051f44141e5eaffcbb4b0/tests/compiletests/ui/spirv-attr/all-builtins.rs#L96-L100

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.