wgpu icon indicating copy to clipboard operation
wgpu copied to clipboard

SPIRV backend loop bounding seems to not work sometimes

Open kokosha opened this issue 7 months ago • 0 comments

Description In WGPU 25, a feature was introduced to ensure that loops generated by the SPIR-V backend are always bounded (see PR #7080). However, this change appears to produce invalid code for the BC7 compute shader located here. The issue is further documented in this pull request.

Reproduction Steps

  1. Clone the repository:
git clone https://github.com/hasenbanck/block_compression.git
cd block_compression
git checkout 3a303119529f7fa61d8ab16ac981e0e70459a8d3
  1. Run the PSNR BC7 alpha ultra-fast test:
cargo test bc7_alpha_ultra_fast --features=bc7 -- --nocapture

Any of the other tests related with BC7 in tests/metrics.rs will reproduce the same failure.

Expected vs. Observed Behavior

  • Expected: The BC7 compute shader should compile, execute, and produce valid compressed output without crashing.
  • Observed: Creating and dispatching the BC7 shader returns an access violation (exit code 0xC0000005). The test binary crashes with:
Caused by:
process didn't exit successfully: 
`C:\Users\Jiang\Documents\vulcan\block_compression\target\debug\deps\metrics-d5139ebfdcb87eb4.exe psnr_bc7_alpha_ultra_fast`
(exit code: 0xC0000005, STATUS_ACCESS_VIOLATION)
note: test exited abnormally; to see the full output pass --nocapture to the harness.

The root cause is unclear, as it is not obvious how the WGSL code has been translated by the SPIR-V backend.


Platform

  • Operating System: Windows 11
  • Graphics API: Vulkan (using WGPU 25.0.2)
  • Processor: AMD Ryzen 5 5600G with Radeon Graphics - Integrated GPU - Adrenaline 24.9.1

kokosha avatar Jun 01 '25 12:06 kokosha