Skip to content

webgpu: Cover immediate data in indirect commands - #4698

Open
shaoboyan091 wants to merge 1 commit into
gpuweb:mainfrom
shaoboyan091:immediate-indirect-execution-coverage
Open

shaoboyan091 wants to merge 1 commit into
gpuweb:mainfrom
shaoboyan091:immediate-indirect-execution-coverage

Conversation

@shaoboyan091

Copy link
Copy Markdown
Contributor

Summary

  • Reuse the immediate-data pipeline, command encoding, and readback helpers for indirect compute dispatch and indexed/non-indexed indirect draws in render passes and render bundles.
  • Check immediate values in compute, vertex, and fragment shaders across single/repeated indirect commands, direct-indirect-direct sequences, partial updates, and zero/nonzero indirect-buffer offsets.
  • Expand bundle mixing and isolation tests to direct/indirect and indexed/non-indexed draws in both render shader stages.
  • Add feature-gated multi-draw execution checks with distinct output pixels, optional count buffers, and counts below, equal to, and above the maximum draw count. Accept the existing experimental feature name and the unprefixed name exposed by Dawn Node.

The added indirect execution test has 9 cases with 8 subcases each. Multi-draw has 4 cases with 10 subcases each. Each of the two existing bundle tests expands to 8 cases.

Motivation

Immediate execution tests previously used only direct draws and dispatches. They could not detect immediate-data corruption caused by an implementation inserting internal work for an indirect command.

The compute regression reproduces the reported failure: an indirect dispatch reads {65535, 0, 1, 0} instead of the application's {25, 128, 240, 255}. With an indirect-buffer offset of 16 bytes, the second erroneous word becomes 4. The mixed sequence also verifies that the preceding direct dispatch is correct and that corruption can persist into the following direct dispatch. Assertions compare application values, not implementation-specific validation parameters.

Verification

  • npm test: passes all builds, type checking, lint, test validation, documentation generation, and all 1,031 framework unit tests.
  • Focused ESLint with --max-warnings=0, Prettier checking, and git diff --check: pass.
  • Immediate operation suite on Dawn Node (webgpu@0.6.0), D3D12, with enable-dawn-features=allow_unsafe_apis and normal validation enabled:
    • Core: 113 passed, 15 existing f16/Float16Array skips, 1 failed.
    • Compatibility: 113 passed, 15 existing f16/Float16Array skips, 1 failed.
    • The sole failing case in both modes is the new indirect compute regression described above; its 8 subcases expose the implementation defect.
    • All new indirect rendering, bundle, and multi-draw cases pass, including all 40 multi-draw subcases in both modes.
  • Vulkan execution was unavailable because the isolated runtime could not load its Vulkan loader. No Dawn source changes or failure expectations are included in this PR.

Author Checklist

  • Coverage described here is implemented without placeholders.
  • New helpers are documented; no new helper files require indexing.
  • Tested against a WebGPU implementation; the intentional regression failure is explained above.
  • Tested with compatibility validation enabled; results are explained above.

Reviewer Checklist

  • Tests are properly located and descriptions are accurate.
  • Coverage and parameterization are appropriate.

@github-actions

github-actions Bot commented Sep 8, 2026 •

Copy link
Copy Markdown

Results for build job (at befc2ba):

+webgpu:api,operation,command_buffer,programmable,immediate:indirect_execution:* - 9 cases, 72 subcases (~8/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)
+webgpu:api,operation,command_buffer,programmable,immediate:render_pass_and_bundle_mix:* - 8 cases, 8 subcases (~1/case)
+webgpu:api,operation,command_buffer,programmable,immediate:render_bundle_isolation:* - 8 cases, 8 subcases (~1/case)
-TOTAL: 290198 cases, 2381713 subcases
+TOTAL: 290221 cases, 2381799 subcases

@shaoboyan091
shaoboyan091 force-pushed the immediate-indirect-execution-coverage branch from db4d632 to 7323702 Compare October 20, 2026 02:56
@shaoboyan091
shaoboyan091 requested a balanced review from Copilot November 16, 2026 02:14

Copilot AI left a comment

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.

🟢 Approval recommended

There are no active review issues for the expanded immediate-data test coverage.

No open issues 🎉

What changed in this PR

Extends WebGPU immediate-data operation tests to detect corruption across indirect compute and rendering commands, reusing the existing pipeline, encoding, and readback helpers.

Changes:

  • Adds indirect dispatch and indexed/non-indexed draw coverage for repeated commands, mixed direct/indirect sequences, partial updates, and buffer offsets.
  • Expands bundle mixing and isolation tests across draw types and vertex/fragment stages.
  • Adds feature-gated multi-draw tests with distinct output pixels, optional count buffers, and draw-count limits.
File Description
src/​webgpu/​api/​operation/​command_buffer/​programmable/​immediate.spec.ts Extends shared helpers and adds indirect, multi-draw, and expanded bundle coverage for immediate-data preservation.

Review effort: Balanced

Exercise indirect compute dispatch and indexed/non-indexed rendering with immediate values in compute, vertex, and fragment shaders. Cover repeated commands, mixed direct/indirect commands, partial updates, and bundle isolation using the existing execution helpers.

Exclude Chromium-specific experimental multi-draw indirect coverage. Verified with type checking, lint and formatting checks, and 1031 framework unit tests.
@shaoboyan091
shaoboyan091 force-pushed the immediate-indirect-execution-coverage branch from 7323702 to befc2ba Compare November 16, 2026 03:05
@shaoboyan091

Copy link
Copy Markdown
Contributor Author

🟢 Approval recommended

There are no active review issues for the expanded immediate-data test coverage.

No open issues 🎉

What changed in this PR
Extends WebGPU immediate-data operation tests to detect corruption across indirect compute and rendering commands, reusing the existing pipeline, encoding, and readback helpers.

Changes:

  • Adds indirect dispatch and indexed/non-indexed draw coverage for repeated commands, mixed direct/indirect sequences, partial updates, and buffer offsets.
  • Expands bundle mixing and isolation tests across draw types and vertex/fragment stages.
  • Adds feature-gated multi-draw tests with distinct output pixels, optional count buffers, and draw-count limits.

File Description
src/​webgpu/​api/​operation/​command_buffer/​programmable/​immediate.spec.ts Extends shared helpers and adds indirect, multi-draw, and expanded bundle coverage for immediate-data preservation.
Review effort: Balanced

You don't caught a test cases that relies on chromium only flags in previous run :)

This branch has not been deployed

No deployments
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