Skip to content

ImmediateContext->CopyTexture failed to copy stencil bits in D3D12 #679

Closed
@hzqst

Description

@hzqst

RenderDoc .rdc -> https://hzqst.oss-cn-hangzhou.aliyuncs.com/rdc.7z

d3d12 (stencil=0 after copy):

Image

vk (stencil=0x41 after copy):

Image

d3d11 (stencil=0x41 after copy):

Image

gl (stencil=0x41 after copy):

Image

Given the information from https://learn.microsoft.com/en-us/windows/win32/direct3d12/subresources#plane-slice

The subresource index should be filled with correct value to copy stencil bits, instead of 0 here.

I will perfer a bool CopyDepthBits; and a bool CopyStencilBits; in the Diligent::CopyTextureAttribs to have full control over copytexture behavior.

btw:

https://learn.microsoft.com/en-us/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copytextureregion

Note that for a depth-stencil buffer, the depth and stencil planes are [separate subresources](https://learn.microsoft.com/en-us/windows/win32/direct3d12/subresources#plane-slice) within the buffer.

To copy an entire resource, rather than just a region of a subresource, we recommend to use [CopyResource](https://learn.microsoft.com/en-us/windows/desktop/api/d3d12/nf-d3d12-id3d12graphicscommandlist-copyresource) instead.

CopyResource in D3D12

and

CopyResource in D3D11

is recommended in this scenario, however I found no wrapper around this in DiligentEngine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions