Skip to content

Operation tests for setImmediates#4558

Merged
Kangz merged 6 commits into
gpuweb:mainfrom
shaoboyan091:immediate-operation
Mar 16, 2026
Merged

Operation tests for setImmediates#4558
Kangz merged 6 commits into
gpuweb:mainfrom
shaoboyan091:immediate-operation

Conversation

@shaoboyan091
Copy link
Copy Markdown
Contributor

@shaoboyan091 shaoboyan091 commented Jan 12, 2026

Implement operation tests for setImmediates in ComputePassEncoder, RenderPassEncoder, and RenderBundleEncoder.

  • Add basic execution tests for scalar, vector, and struct types.
  • Add tests for partial updates and multiple updates (using range verification).
  • Add tests for pipeline switching (compatible and incompatible).
  • Add tests for large data (maxImmediateSize) with range verification.
  • Add tests for TypedArray arguments with offsets.
  • Add tests for mixing render pass and bundle execution.

Issue: #


Requirements for PR author:

  • All missing test coverage is tracked with "TODO" or .unimplemented().
  • New helpers are /** documented */ and new helper files are found in helper_index.txt.
  • Test behaves as expected in a WebGPU implementation. (If not passing, explain above.)
  • Test have be tested with compatibility mode validation enabled and behave as expected. (If not passing, explain above.)

Requirements for reviewer sign-off:

  • Tests are properly located.
  • Test descriptions are accurate and complete.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Tests avoid over-parameterization (see case count report).

When landing this PR, be sure to make any necessary issue status updates.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jan 12, 2026

Results for build job (at 6ffc1ce):

+webgpu:api,operation,command_buffer,programmable,immediate:basic_execution:* - 51 cases, 51 subcases (~1/case)
+webgpu:api,operation,command_buffer,programmable,immediate:update_data:* - 3 cases, 3 subcases (~1/case)
+webgpu:api,operation,command_buffer,programmable,immediate:pipeline_switch:* - 4 cases, 4 subcases (~1/case)
+webgpu:api,operation,command_buffer,programmable,immediate:use_max_immediate_size:* - 3 cases, 3 subcases (~1/case)
+webgpu:api,operation,command_buffer,programmable,immediate:typed_array_arguments:* - 36 cases, 216 subcases (~6/case)
+webgpu:api,operation,command_buffer,programmable,immediate:multiple_updates_before_draw_or_dispatch:* - 3 cases, 3 subcases (~1/case)
+webgpu:api,operation,command_buffer,programmable,immediate:render_pass_and_bundle_mix:* - 1 cases, 1 subcases (~1/case)
+webgpu:api,operation,command_buffer,programmable,immediate:render_bundle_isolation:* - 1 cases, 1 subcases (~1/case)
-TOTAL: 280650 cases, 2321809 subcases
+TOTAL: 280752 cases, 2322091 subcases

Copy link
Copy Markdown
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Copy link
Copy Markdown
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 1 out of 1 changed files in this pull request and generated 5 comments.


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

Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Copy link
Copy Markdown
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 1 out of 1 changed files in this pull request and generated 2 comments.


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

Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Copy link
Copy Markdown
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 1 out of 1 changed files in this pull request and generated 3 comments.


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

Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Implement operation tests for setImmediates in ComputePassEncoder,
RenderPassEncoder, and RenderBundleEncoder.

- Add basic execution tests for scalar, vector, and struct types.
- Add tests for partial updates and multiple updates (using range verification).
- Add tests for pipeline switching (no inheritance).
- Add tests for large data (maxImmediateSize) with range verification.
- Add tests for TypedArray arguments with offsets.
- Add tests for mixing render pass and bundle execution.
Copy link
Copy Markdown
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 1 out of 1 changed files in this pull request and generated no new comments.


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

@shaoboyan091
Copy link
Copy Markdown
Contributor Author

Softly ping for review.

Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
@Kangz
Copy link
Copy Markdown
Collaborator

Kangz commented Mar 6, 2026

The operation tests seem to have good coverage. They became much simpler when the group decided to add validation that all immediates are set instead of defaulting to 0.

@shaoboyan091 shaoboyan091 marked this pull request as draft March 9, 2026 08:45
Copy link
Copy Markdown
Collaborator

@Kangz Kangz left a comment

Choose a reason for hiding this comment

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

Wow Github's code review UI is really annoying to use.

Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Copy link
Copy Markdown
Collaborator

@Kangz Kangz left a comment

Choose a reason for hiding this comment

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

Almost there

Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
@shaoboyan091 shaoboyan091 marked this pull request as ready for review March 13, 2026 02:36
@shaoboyan091 shaoboyan091 requested a review from Kangz March 13, 2026 02:36
@shaoboyan091
Copy link
Copy Markdown
Contributor Author

I think I've resolved comments. PTAL, thanks !

Comment thread src/webgpu/api/operation/command_buffer/programmable/immediate.spec.ts Outdated
@Kangz Kangz merged commit 81bf5e9 into gpuweb:main Mar 16, 2026
1 check passed
if (!this.isCompatibility) {
return;
}
const needsStorageBuffersInFragmentStage =
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If I understand correctly, this test is skipped on devices that don't support storage buffers in fragment shaders. But, those device do support immediates meaning this test fails to test immediates in fragment shaders on those device.

Should the test be refactored not to use storage buffers in fragment shaders? Many other tests were refactored to do this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Fair point. I think we need to refactor this to cover more devices. Is there anyone working a uniform refactor for all test cases or we could do it seperately.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think I refactored all exsiting tests to not require storage buffers in fragment shaders (except for the tests that are specifically testing storage buffers in fragment shaders 😛) If there are any left I'm happy to fix them.

shaoboyan091 added a commit to shaoboyan091/cts that referenced this pull request Mar 30, 2026
…sInFragmentStage

greggman@ pointed out that the previous immediates operation tests relies
on StorageBuffersInFragmentStage, which will reduce the cover rate of the
devices. (gpuweb#4558 (comment))

Remove usage of StorageBuffersInFragmentStage and directly rendering result
out to do operation test
shaoboyan091 added a commit to shaoboyan091/cts that referenced this pull request Mar 30, 2026
…sInFragmentStage

greggman@ pointed out that the previous immediates operation tests relies
on StorageBuffersInFragmentStage, which will reduce the cover rate of the
devices. (gpuweb#4558 (comment))

Remove usage of StorageBuffersInFragmentStage and directly rendering result
out to do operation test
shaoboyan091 added a commit to shaoboyan091/cts that referenced this pull request Mar 30, 2026
…sInFragmentStage

greggman@ pointed out that the previous immediates operation tests relies
on StorageBuffersInFragmentStage, which will reduce the cover rate of the
devices. (gpuweb#4558 (comment))

Remove usage of StorageBuffersInFragmentStage and directly rendering result
out to do operation test
shaoboyan091 added a commit to shaoboyan091/cts that referenced this pull request Mar 30, 2026
…sInFragmentStage

greggman@ pointed out that the previous immediates operation tests relies
on StorageBuffersInFragmentStage, which will reduce the cover rate of the
devices. (gpuweb#4558 (comment))

Remove usage of StorageBuffersInFragmentStage and directly rendering result
out to do operation test
shaoboyan091 added a commit that referenced this pull request Mar 31, 2026
…sInFragmentStage (#4619)

greggman@ pointed out that the previous immediates operation tests relies
on StorageBuffersInFragmentStage, which will reduce the cover rate of the
devices. (#4558 (comment))

Remove usage of StorageBuffersInFragmentStage and directly rendering result
out to do operation test
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.

4 participants