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

[d3d11] Implement depth-stencil mapping on deferred contexts

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

View File

@ -208,15 +208,11 @@ namespace dxvk {
return E_INVALIDARG; return E_INVALIDARG;
} }
auto formatInfo = imageFormatInfo(image->info().format); VkFormat packedFormat = m_parent->LookupPackedFormat(
pTexture->Desc()->Format, pTexture->GetFormatMode()).Format;
if (formatInfo->aspectMask != VK_IMAGE_ASPECT_COLOR_BIT) { auto formatInfo = imageFormatInfo(packedFormat);
Logger::err("D3D11: Cannot map a depth-stencil texture"); auto subresource = pTexture->GetSubresourceFromIndex(
return E_INVALIDARG;
}
VkImageSubresource subresource =
pTexture->GetSubresourceFromIndex(
formatInfo->aspectMask, Subresource); formatInfo->aspectMask, Subresource);
VkExtent3D levelExtent = image->mipLevelExtent(subresource.mipLevel); VkExtent3D levelExtent = image->mipLevelExtent(subresource.mipLevel);
@ -278,7 +274,8 @@ namespace dxvk {
VK_IMAGE_ASPECT_COLOR_BIT, Subresource), VK_IMAGE_ASPECT_COLOR_BIT, Subresource),
cDataSlice = pMapEntry->DataSlice, cDataSlice = pMapEntry->DataSlice,
cDataPitchPerRow = pMapEntry->RowPitch, cDataPitchPerRow = pMapEntry->RowPitch,
cDataPitchPerLayer = pMapEntry->DepthPitch cDataPitchPerLayer = pMapEntry->DepthPitch,
cPackedFormat = GetPackedDepthStencilFormat(pTexture->Desc()->Format)
] (DxvkContext* ctx) { ] (DxvkContext* ctx) {
VkImageSubresourceLayers srLayers; VkImageSubresourceLayers srLayers;
srLayers.aspectMask = cSubresource.aspectMask; srLayers.aspectMask = cSubresource.aspectMask;
@ -286,12 +283,27 @@ namespace dxvk {
srLayers.baseArrayLayer = cSubresource.arrayLayer; srLayers.baseArrayLayer = cSubresource.arrayLayer;
srLayers.layerCount = 1; srLayers.layerCount = 1;
VkOffset3D mipLevelOffset = { 0, 0, 0 };
VkExtent3D mipLevelExtent = cImage->mipLevelExtent(srLayers.mipLevel);
if (cPackedFormat == VK_FORMAT_UNDEFINED) {
ctx->updateImage( ctx->updateImage(
cImage, srLayers, VkOffset3D { 0, 0, 0 }, cImage, srLayers,
cImage->mipLevelExtent(cSubresource.mipLevel), mipLevelOffset,
mipLevelExtent,
cDataSlice.ptr(), cDataSlice.ptr(),
cDataPitchPerRow, cDataPitchPerRow,
cDataPitchPerLayer); cDataPitchPerLayer);
} else {
ctx->updateDepthStencilImage(
cImage, srLayers,
VkOffset2D { mipLevelOffset.x, mipLevelOffset.y },
VkExtent2D { mipLevelExtent.width, mipLevelExtent.height },
cDataSlice.ptr(),
cDataPitchPerRow,
cDataPitchPerLayer,
cPackedFormat);
}
}); });
} }