Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spv-in: Don't apply interpolation to fragment shaders outputs #2239

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

JCapucho
Copy link
Collaborator

@JCapucho JCapucho commented Feb 2, 2023

SPIR-V doesn't allow the Flat, NoPerspective, Sample or Centroid decorations on fragment shaders outputs (VUID-StandaloneSpirv-Flat-06201), but the spirv frontend was applying default interpolation to all outputs unconditionally.

This wasn't an issue for most shaders since they output floats and the default values for them don't interfere with SPIR-V semantics, but if the shader returned a uint or int the interpolation would be set to Flat which as stated above is disallowed.

This commit fixes the issue by only running the default interpolation code when constructing the entry point and if the stage/IO allow it.

SPIR-V doesn't allow the `Flat`, `NoPerspective`, `Sample` or
`Centroid` decorations on fragment shaders outputs, but the spirv
frontend was applying default interpolation to all outputs
unconditionally.

This wasn't an issue for most shaders since they output floats and the
default values for them don't interfere with SPIR-V semantics, but if
the shader returned a uint or int the interpolation would be set to
`Flat` which as stated above is disallowed.

This commit fixes the issue by only running the default interpolation
code when constructing the entry point and if the stage/IO allow it.
@JCapucho JCapucho force-pushed the spv-interpolation-fix branch from ac48325 to 596ab17 Compare February 2, 2023 21:40
Copy link
Member

@teoxoy teoxoy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, we already do it properly for frag inputs.

@teoxoy teoxoy merged commit fc81a20 into gfx-rs:master Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants