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

[d3d11] Prevent mapping of depth-stencil textures

We currently don't support this, and copying data back and forth
with the wrong image aspect set crashes the RADV driver.
This commit is contained in:
Philip Rebohle 2018-04-21 20:34:41 +02:00
parent dcb5b2a20c
commit f71f527b4d
No known key found for this signature in database
GPG Key ID: C8CC613427A31C99
2 changed files with 16 additions and 10 deletions

View File

@ -177,11 +177,16 @@ namespace dxvk {
return E_INVALIDARG;
}
const DxvkFormatInfo* formatInfo = imageFormatInfo(image->info().format);
auto formatInfo = imageFormatInfo(image->info().format);
if (formatInfo->aspectMask != VK_IMAGE_ASPECT_COLOR_BIT) {
Logger::err("D3D11: Cannot map a depth-stencil texture");
return E_INVALIDARG;
}
VkImageSubresource subresource =
pTexture->GetSubresourceFromIndex(
VK_IMAGE_ASPECT_COLOR_BIT, Subresource);
formatInfo->aspectMask, Subresource);
VkExtent3D levelExtent = image->mipLevelExtent(subresource.mipLevel);
VkExtent3D blockCount = util::computeBlockCount(

View File

@ -224,10 +224,16 @@ namespace dxvk {
return E_INVALIDARG;
}
// Parameter validation was successful
auto formatInfo = imageFormatInfo(mappedImage->info().format);
if (formatInfo->aspectMask != VK_IMAGE_ASPECT_COLOR_BIT) {
Logger::err("D3D11: Cannot map a depth-stencil texture");
return E_INVALIDARG;
}
VkImageSubresource subresource =
pResource->GetSubresourceFromIndex(
VK_IMAGE_ASPECT_COLOR_BIT, Subresource);
formatInfo->aspectMask, Subresource);
pResource->SetMappedSubresource(subresource);
@ -246,13 +252,8 @@ namespace dxvk {
pMappedResource->DepthPitch = imageType >= VK_IMAGE_TYPE_3D ? layout.depthPitch : layout.size;
return S_OK;
} else {
// Query format info which we need to compute
// the row pitch and layer pitch properly.
const DxvkFormatInfo* formatInfo = imageFormatInfo(mappedImage->info().format);
const VkExtent3D levelExtent = mappedImage->mipLevelExtent(subresource.mipLevel);
const VkExtent3D blockCount = util::computeBlockCount(
levelExtent, formatInfo->blockSize);
const VkExtent3D blockCount = util::computeBlockCount(levelExtent, formatInfo->blockSize);
DxvkPhysicalBufferSlice physicalSlice;