1
0
mirror of https://github.com/EduApps-CDG/OpenDX synced 2024-12-30 09:45:37 +01:00

[d3d11] Implement depth-stencil uploads in UpdateSubresource1

This commit is contained in:
Philip Rebohle 2019-03-26 18:10:22 +01:00
parent eec1cde1b3
commit fc3515c16f
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99

@ -1123,9 +1123,13 @@ namespace dxvk {
} else { } else {
const D3D11CommonTexture* textureInfo = GetCommonTexture(pDstResource); const D3D11CommonTexture* textureInfo = GetCommonTexture(pDstResource);
const VkImageSubresource subresource = VkFormat packedFormat = m_parent->LookupPackedFormat(
textureInfo->GetSubresourceFromIndex( textureInfo->Desc()->Format,
VK_IMAGE_ASPECT_COLOR_BIT, DstSubresource); textureInfo->GetFormatMode()).Format;
auto formatInfo = imageFormatInfo(packedFormat);
auto subresource = textureInfo->GetSubresourceFromIndex(
formatInfo->aspectMask, DstSubresource);
VkExtent3D mipExtent = textureInfo->GetImage()->mipLevelExtent(subresource.mipLevel); VkExtent3D mipExtent = textureInfo->GetImage()->mipLevelExtent(subresource.mipLevel);
@ -1152,9 +1156,6 @@ namespace dxvk {
subresource.mipLevel, subresource.mipLevel,
subresource.arrayLayer, 1 }; subresource.arrayLayer, 1 };
auto formatInfo = imageFormatInfo(
textureInfo->GetImage()->info().format);
if (!util::isBlockAligned(offset, formatInfo->blockSize) if (!util::isBlockAligned(offset, formatInfo->blockSize)
|| !util::isBlockAligned(offset, extent, formatInfo->blockSize, mipExtent)) || !util::isBlockAligned(offset, extent, formatInfo->blockSize, mipExtent))
return; return;
@ -1180,11 +1181,20 @@ namespace dxvk {
cDstExtent = extent, cDstExtent = extent,
cSrcData = std::move(imageDataBuffer), cSrcData = std::move(imageDataBuffer),
cSrcBytesPerRow = bytesPerRow, cSrcBytesPerRow = bytesPerRow,
cSrcBytesPerLayer = bytesPerLayer cSrcBytesPerLayer = bytesPerLayer,
cPackedFormat = packedFormat
] (DxvkContext* ctx) { ] (DxvkContext* ctx) {
ctx->updateImage(cDstImage, cDstLayers, if (cDstLayers.aspectMask != (VK_IMAGE_ASPECT_DEPTH_BIT | VK_IMAGE_ASPECT_STENCIL_BIT)) {
cDstOffset, cDstExtent, cSrcData.ptr(), ctx->updateImage(cDstImage, cDstLayers,
cSrcBytesPerRow, cSrcBytesPerLayer); cDstOffset, cDstExtent, cSrcData.ptr(),
cSrcBytesPerRow, cSrcBytesPerLayer);
} else {
ctx->updateDepthStencilImage(cDstImage, cDstLayers,
VkOffset2D { cDstOffset.x, cDstOffset.y },
VkExtent2D { cDstExtent.width, cDstExtent.height },
cSrcData.ptr(), cSrcBytesPerRow, cSrcBytesPerLayer,
cPackedFormat);
}
}); });
} }
} }