Skip to content

Conversation

@cwfitzgerald
Copy link
Member

@cwfitzgerald cwfitzgerald commented Dec 13, 2025

Connections

#8556

Description

This brings the api in line with the spec. Notably we still do zeroing, which is not spec compliant. This will be fixed in a future change.

Diff is great.

Mac setup is a bit wasteful as we upload to all stages, even ones not part of the current pipeline, but we would have to refactor our handling of immediates quite a bit to get stage information in wgpu-hal as the set_immediate call would need to always happen after we know the pipeline we're referring to, and it's not clear to me that this is worth bothering with.

Testing

See Eye, Locally

Squash or Rebase?

COMMIT

TODO

  • Fix mac

@cwfitzgerald cwfitzgerald force-pushed the cw/immediates branch 2 times, most recently from ce1b27b to e20cf9b Compare December 13, 2025 06:14
@JMS55
Copy link
Collaborator

JMS55 commented Dec 13, 2025

Does this fix #5683 ?

@cwfitzgerald
Copy link
Member Author

@JMS55 no, but I'll add that to the tracking issue.

@cwfitzgerald cwfitzgerald force-pushed the cw/immediates branch 2 times, most recently from c52d0b8 to 7348c48 Compare December 14, 2025 08:15
@cwfitzgerald cwfitzgerald marked this pull request as ready for review December 14, 2025 08:15
@cwfitzgerald cwfitzgerald requested a review from Copilot December 14, 2025 08:16
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR brings the immediate data API (formerly known as push constants) in line with the WebGPU specification. The changes simplify the API by removing per-stage configuration in favor of a unified size, and eliminate the stages parameter from upload functions.

Key changes:

  • Replaced immediates_ranges: &[ImmediateRange] with immediate_size: u32 in PipelineLayoutDescriptor
  • Removed stages: ShaderStages parameter from all set_immediates() function calls
  • Renamed IMMEDIATES_ALIGNMENT to IMMEDIATE_DATA_ALIGNMENT throughout the codebase

Reviewed changes

Copilot reviewed 100 out of 100 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
wgpu/src/api/pipeline_layout.rs Updated descriptor to use single size field instead of ranges
wgpu/src/api/render_pass.rs Simplified set_immediates API, removed stage parameter
wgpu/src/api/render_bundle_encoder.rs Updated set_immediates signature
wgpu/src/util/encoder.rs Updated trait definition for set_immediates
wgpu/src/lib.rs Removed ImmediateRange export, renamed constant
wgpu-types/src/lib.rs Removed ImmediateRange struct, renamed constant
wgpu-core/src/binding_model.rs Simplified validation logic and error types
wgpu-core/src/device/resource.rs Updated pipeline layout creation and validation
wgpu-core/src/command/*.rs Updated command encoding to use new API
wgpu-hal/src/*/device.rs Updated backend implementations for new descriptor
wgpu-hal/src/*/command.rs Removed stages parameter from hal command encoders
tests/**/*.rs Updated all test code to use new API
examples/**/*.rs Updated all example code to use new API
CHANGELOG.md Added migration guide for the API change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 100 out of 100 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (1)

wgpu/src/backend/webgpu.rs:1

  • Corrected spelling of 'multi_draw_indexed_indirect' to 'set_immediates' in panic message.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

Nice! Much simpler 👀

@teoxoy teoxoy merged commit e52e833 into gfx-rs:trunk Dec 16, 2025
48 checks passed
@cwfitzgerald cwfitzgerald deleted the cw/immediates branch December 16, 2025 16: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.

3 participants