这是indexloc提供的服务,不要输入任何密码
Skip to content

Should depth-stencil render attachments require views to have aspect = "all" for combined depth-stencil formats? #2062

@austinEng

Description

@austinEng

The WebGPU API allows creating a texture view which selects a single aspect of a combined depth stencil texture using aspect "depth-only" or "stencil-only".
Such a view can be set as the depthStencilAttachment of GPURenderPassEncoder.

The expectation would be that the render pass would execute as-if there were depth attachment if the view were stencil-only, or as-if there were no stencil attachment if the view were depth-only.

This is not directly implementable on Vulkan and D3D12.

On Vulkan, an image view can be created of a VKImage with a particular aspectMask, but the aspectMask is ignored for depth-stencil attachments.
https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkImageSubresourceRange.html

When an image view of a depth/stencil image is used as a depth/stencil framebuffer attachment, the aspectMask is ignored and both depth and stencil image subresources are used.

On D3D12, D3D12_DEPTH_STENCIL_VIEW_DESC, does not contain any members to select just the depth or the stencil aspect.

The consequence of the limitation means that the depth/stencil data is still both readable and writable by the depth/stencil loadOp and storeOp, and by any depth/stencil test on Vulkan/D3D12.

I think there are at least two possible options:

  1. Disallow depth stencil attachments unless they select all of the texture aspects. This would be a validation error on beginRenderPass
  2. Have a single aspect depth-stencil view imply depthReadOnly/stencilReadOnly=true for the other unselected aspect, AND require the pipeline does not read or write the aspect (the depth/stencil test is disabled). This would be additional validation on setPipeline, similar to validation that we have for depthReadOnly/stencilReadOnly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions