-
Notifications
You must be signed in to change notification settings - Fork 335
Description
Hi WebGPU CG,
We have found more issues about the copy commands within same buffer and texture when implementing the related validation rules inside Project Dawn.
- D3D12 debug layer will report the following error when the source and destination are the same buffer in
CopyBufferRegion
command although we cannot find such statements in D3D12 document.
D3D12 ERROR: ID3D12CommandList::CopyBufferRegion: Source and Destination resource cannot be the same when doing a CopyBufferRegion.Copying within the same buffer should be done using an intermediate buffer [ RESOURCE_MANIPULATION ERROR #998: COPY_ON_SAME_SUBRESOURCE]
- On D3D12 and Metal we can only copy one subresource per copy commands.
- D3D12 function CopyTextureRegion() can only support copying between two subresources, not a range of subresources. In its parameter
pSrcBox
, the "front
" and "back
" refer to the z-position of the box, which is only valid when the texture is a 3D texture. When we copy with a 2D texture and makeback
> 1, D3D12 debug layer will report the error message like the following does:
D3D12 ERROR: ID3D12CommandList::CopyTextureRegion: The destination region extends past, at least, one of the edges of the destination subresource. When the destination format is R8G8B8A8_TYPELESS, the source format is R8G8B8A8_TYPELESS, DstX is 0, DstY is 0, DstZ is 0 and the effective SrcBox width is 16, height is 16, and depth is 2, the operation requires the destination subresource to have 16 width, 16 height, and 2 depth. But the destination subresource only has 16 width, 16 height, and 1 depth. [ RESOURCE_MANIPULATION ERROR #858: COPYTEXTUREREGION_DSTREGIONOUTOFBOUNDS]
- Metal only supports copying into one layer of a 2d texture. According to the related Metal document, "when you copy to a 2D texture, depth must be 1."
So I have two questions here:
- Shall we forbid copy within same buffer in WebGPU as D3D12 does not allow it?
- Shall we only allow copying with one texture subresource in one copy command as D3D12 and Metal do?