Skip to content

[naga spv-out] Don't mark multisampled depth images as depth - #7

Open
matthargett wants to merge 1 commit into
review-base/trunk-60cef2be8from
fix/naga-spv-multisampled-depth-image-20261126
Open

matthargett wants to merge 1 commit into
review-base/trunk-60cef2be8from
fix/naga-spv-multisampled-depth-image-20261126

Conversation

@matthargett

@matthargett matthargett commented Nov 26, 2026 •

Copy link
Copy Markdown
Member

Connections

Found running the WebGPU CTS with cts_runner on a Mali-G52 MC2 (Arm proprietary Vulkan 1.1 driver r20p0, Android 10). Other fixes for the same device: #8, #9, #10.

Description

Naga sets the Depth operand of OpTypeImage to 1 for texture_depth_multisampled_2d. This driver then fails pipeline creation with VK_ERROR_INITIALIZATION_FAILED for any shader that declares one, whatever the shader does with it. Non-multisampled depth images and texture_multisampled_2d<f32> are fine.

Vulkan ignores the operand, and a multisampled image can't be used with a comparison sampler, so this leaves it at 0 for multisampled depth images. Other depth images are unchanged.

Testing

  • macOS: cargo fmt --check and clippy for naga are clean; all 423 naga tests pass, with four SPIR-V snapshots updated.
  • Mali-G52, cts_runner built from trunk 60cef2be8 and from this branch:

Pipeline creation for five depth and multisampled texture shapes, before and after

  • CTS textureNumSamples (execution) and the compute and render resource_compatibility selectors, 199 cases: on trunk four of nine processes abort and 139 cases report a result; all 199 pass with this branch.
  • With all four PRs applied, a full run of cts_runner/test.lst on the device (54,915 of 54,931 cases; 16 left out to protect the phone's memory): 45,478 pass, 86 fail, 9,351 skip. 85 of the failures are in selectors marked fails-if(vulkan).
  • Not tested on other Mali driver releases or on desktop Vulkan.

Squash or Rebase?

Single commit.

LLM Use?

Claude Code (Claude Mythos 5.2) found the failure on the device, reduced it to the probes in the image, wrote the change, ran the tests and drafted this description.

Naga set the `Depth` operand of `OpTypeImage` to 1 for every depth texture
type, including `texture_depth_multisampled_2d`. Arm's proprietary Mali driver
(seen with r20p0 on a Mali-G52 MC2) fails pipeline creation with
VK_ERROR_INITIALIZATION_FAILED for any shader that declares a multisampled
image with `Depth` set to 1, whatever the shader does with it. wgpu-hal treats
that error as unexpected and panics.

Vulkan ignores the operand, and a multisampled image cannot be used with a
comparison sampler, so leave it at 0 for multisampled depth images. They then
share the SPIR-V type of `texture_multisampled_2d<f32>`. Non-multisampled depth
images are unchanged.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-26T22:21:08.900980Z 14e37ba PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

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