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

webgpu: Cover immediate data in indirect commands#4698
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.

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, bundle isolation, and multi-draw count buffers using the existing execution helpers.

Presubmit passes, including 1031 framework unit tests. D3D12 runs in core and compatibility modes pass the new rendering cases and reproduce immediate-data corruption in indirect compute dispatch.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown

Results for build job (at db4d632):

+webgpu:api,operation,command_buffer,programmable,immediate:indirect_execution:* - 9 cases, 72 subcases (~8/case)
+webgpu:api,operation,command_buffer,programmable,immediate:multi_draw_indirect:* - 4 cases, 40 subcases (~10/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: 285364 cases, 2347068 subcases
+TOTAL: 285391 cases, 2347194 subcases

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.

1 participant