1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-02 10:24:12 +01:00

[d3d11] Implement 2D<->3D image copies in CopySubresourceRegion

This commit is contained in:
Philip Rebohle 2018-04-17 22:22:49 +02:00
parent 9a8263f465
commit fcdba67b88
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

View File

@ -298,7 +298,13 @@ namespace dxvk {
pDstResource->GetType(&dstResourceDim);
pSrcResource->GetType(&srcResourceDim);
if (dstResourceDim != srcResourceDim) {
// Copying 2D image slices to 3D images and vice versa is legal
const bool copy2Dto3D = dstResourceDim == D3D11_RESOURCE_DIMENSION_TEXTURE3D
&& srcResourceDim == D3D11_RESOURCE_DIMENSION_TEXTURE2D;
const bool copy3Dto2D = dstResourceDim == D3D11_RESOURCE_DIMENSION_TEXTURE2D
&& srcResourceDim == D3D11_RESOURCE_DIMENSION_TEXTURE3D;
if (dstResourceDim != srcResourceDim && !copy2Dto3D && !copy3Dto2D) {
Logger::err(str::format(
"D3D11: CopySubresourceRegion: Incompatible resources",
"\n Dst resource type: ", dstResourceDim,
@ -368,16 +374,24 @@ namespace dxvk {
extent.depth = pSrcBox->back - pSrcBox->front;
}
const VkImageSubresourceLayers dstLayers = {
VkImageSubresourceLayers dstLayers = {
dstSubresource.aspectMask,
dstSubresource.mipLevel,
dstSubresource.arrayLayer, 1 };
const VkImageSubresourceLayers srcLayers = {
VkImageSubresourceLayers srcLayers = {
srcSubresource.aspectMask,
srcSubresource.mipLevel,
srcSubresource.arrayLayer, 1 };
// Copying multiple slices does not
// seem to be supported in D3D11
if (copy2Dto3D || copy3Dto2D) {
extent.depth = 1;
dstLayers.layerCount = 1;
srcLayers.layerCount = 1;
}
EmitCs([
cDstImage = dstImage,
cSrcImage = srcImage,