Skip to content

Conversation

@shaoboyan091
Copy link
Contributor

@shaoboyan091 shaoboyan091 commented Dec 31, 2025

Adds pipeline_immediate.spec.ts to validate immediate data usage in RenderPassEncoder, ComputePassEncoder, and RenderBundleEncoder.

Tests cover:

  • Required immediate data slots are set.
  • Unused variables do not require slots.
  • Pipeline creation fails if shader immediate size exceeds layout limit.
  • RenderBundle execution invalidates pipeline and immediate data state.

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 in the test tree.
  • Test descriptions allow a reader to "read only the test plans and evaluate coverage completeness", and accurately reflect the test code.
  • Tests provide complete coverage (including validation control cases). Missing coverage MUST be covered by TODOs.
  • Helpers and types promote readability and maintainability.

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

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.

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

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


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

@github-actions
Copy link

github-actions bot commented Jan 7, 2026

Results for build job (at 17e7666):

+webgpu:api,validation,encoding,programmable,pipeline_immediate:required_slots_set:* - 161 cases, 161 subcases (~1/case)
+webgpu:api,validation,encoding,programmable,pipeline_immediate:unused_variable:* - 12 cases, 12 subcases (~1/case)
+webgpu:api,validation,encoding,programmable,pipeline_immediate:overprovisioned_immediate_data:* - 6 cases, 6 subcases (~1/case)
+webgpu:api,validation,encoding,programmable,pipeline_immediate:render_bundle_execution_state_invalidation:* - 1 cases, 2 subcases (~2/case)
-TOTAL: 285738 cases, 2344462 subcases
+TOTAL: 285918 cases, 2344643 subcases

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 2 out of 2 changed files in this pull request and generated 3 comments.


💡 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 2 out of 2 changed files in this pull request and generated 2 comments.


💡 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 2 out of 2 changed files in this pull request and generated 2 comments.


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

@kainino0x
Copy link
Collaborator

Sorry, bit swamped. Should be able to review tomorrow.

}
});

g.test('immediate_data_size')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we have the same test for the defaulted pipeline layouts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Seperate this to another PR)
But I don't think we could have a validation test for this easily. Because setImmediates allows overprovision, all we could do for default pipeline layouts is a control case.

How about cover this in operation test or you prefer a control case for it.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I meant, can we have a test that the default pipeline layout causes an error to be produced when compiling pipeline that use too many immediates?

`;
break;
case 'struct_padding':
kRequiredSize = 64;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
kRequiredSize = 64;
kRequiredSize = 40;

Copy link
Contributor Author

@shaoboyan091 shaoboyan091 Jan 16, 2026

Choose a reason for hiding this comment

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

Done. And it indeed caught a bug in implementation! Tint calculated whole immediate block struct size as the immediate block size. And it doesn't get rid of tail padding bytes so it triggers validation report wrong fail due to it. (report used more bytes than layout required)

Adds `pipeline_immediate.spec.ts` to validate immediate data usage in
RenderPassEncoder, ComputePassEncoder, and RenderBundleEncoder.

Tests cover:
- Required immediate data slots are set.
- Unused variables do not require slots.
- Pipeline creation fails if shader immediate size exceeds layout limit.
- RenderBundle execution invalidates pipeline and immediate data state.
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