Skip to content

Comments

Validation fixes for dual-source blending, depth bias, and frag_depth#8856

Merged
andyleiserson merged 3 commits intogfx-rs:trunkfrom
andyleiserson:jj-push-pkor
Jan 30, 2026
Merged

Validation fixes for dual-source blending, depth bias, and frag_depth#8856
andyleiserson merged 3 commits intogfx-rs:trunkfrom
andyleiserson:jj-push-pkor

Conversation

@andyleiserson
Copy link
Contributor

@andyleiserson andyleiserson commented Jan 9, 2026

Several validation fixes. The only reason the dual-source blending fix is related is that both it and the frag_depth fix add fields to ShaderStageForValidation::Fragment that @ErichDonGubler added recently.

This change will conflict with #8840, which needs more discussion, so I expect #8840 will be rebased on this one. Whichever lands second should enable the entire depth_stencil_state suite.

Testing
Enables relevant CTS tests.

Squash or Rebase? Rebase

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • Add CHANGELOG.md entries.

@dhardy
Copy link
Contributor

dhardy commented Jan 12, 2026

This doesn't solve my issue (should have been an issue not a discussion): #8798

wgpu error: Validation Error

Caused by:
  In Device::create_render_pipeline, label = 'text subpixel mask pipe'
    Error matching ShaderStages(FRAGMENT) shader requirements against the pipeline
      Pipeline uses dual-source blending, but the shader does not support it

This is using a GLSL shader which works correctly if I hack wgpu to disable this validation completely.

@andyleiserson
Copy link
Contributor Author

This doesn't solve my issue (should have been an issue not a discussion): #8798

It's not related to this change, but I filed #8864 from your discussion, and opened #8865 and kas-gui/kas#635.

@Wumpf Wumpf self-assigned this Jan 14, 2026
@Wumpf Wumpf self-requested a review January 28, 2026 08:20
Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

very nice, thanks for the logical commit split

Comment on lines 1654 to 1655
.iter()
.any(|varying| matches!(varying, Varying::BuiltIn(naga::BuiltIn::FragDepth)))
Copy link
Member

Choose a reason for hiding this comment

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

would be nice if those types would be Eq so we could just do a contains, any reason why not?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see why not. Depending on how tightly the enums get packed, the Varying::Local { location: u32, iv: InterfaceVar } variant could be one or two words, or could be a handful more than that, but it's not so much that it seems inappropriate to implement Eq.

@andyleiserson andyleiserson force-pushed the jj-push-pkor branch 2 times, most recently from c20c23a to bc4b44e Compare January 30, 2026 01:49
* Depth bias is only supported with triangle topologies (fixes gfx-rs#6071)
* If the shader outputs `frag_depth`, the pipeline must have a depth
  attachment
@andyleiserson
Copy link
Contributor Author

andyleiserson commented Jan 30, 2026

The push of c20c23a is a rebase plus a new commit to implement (and use) Eq for Varying.

The push of bc4b44e was an incorrect (partial) attempt to squash the new commit, and the push of 75180c3 actually squashes the commit.

Sorry for the noise.

@andyleiserson andyleiserson merged commit 735e8d2 into gfx-rs:trunk Jan 30, 2026
54 checks passed
@andyleiserson andyleiserson deleted the jj-push-pkor branch January 30, 2026 17:36
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.

dual source blending is forced if enabled (wgpu being overly strict?) Point and line primitives must not have depth bias

3 participants