mirror of
https://github.com/doitsujin/dxvk.git
synced 2024-12-11 10:24:10 +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:
parent
dcb5b2a20c
commit
f71f527b4d
@ -177,11 +177,16 @@ namespace dxvk {
|
|||||||
return E_INVALIDARG;
|
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 =
|
VkImageSubresource subresource =
|
||||||
pTexture->GetSubresourceFromIndex(
|
pTexture->GetSubresourceFromIndex(
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT, Subresource);
|
formatInfo->aspectMask, Subresource);
|
||||||
|
|
||||||
VkExtent3D levelExtent = image->mipLevelExtent(subresource.mipLevel);
|
VkExtent3D levelExtent = image->mipLevelExtent(subresource.mipLevel);
|
||||||
VkExtent3D blockCount = util::computeBlockCount(
|
VkExtent3D blockCount = util::computeBlockCount(
|
||||||
|
@ -224,10 +224,16 @@ namespace dxvk {
|
|||||||
return E_INVALIDARG;
|
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 =
|
VkImageSubresource subresource =
|
||||||
pResource->GetSubresourceFromIndex(
|
pResource->GetSubresourceFromIndex(
|
||||||
VK_IMAGE_ASPECT_COLOR_BIT, Subresource);
|
formatInfo->aspectMask, Subresource);
|
||||||
|
|
||||||
pResource->SetMappedSubresource(subresource);
|
pResource->SetMappedSubresource(subresource);
|
||||||
|
|
||||||
@ -246,13 +252,8 @@ namespace dxvk {
|
|||||||
pMappedResource->DepthPitch = imageType >= VK_IMAGE_TYPE_3D ? layout.depthPitch : layout.size;
|
pMappedResource->DepthPitch = imageType >= VK_IMAGE_TYPE_3D ? layout.depthPitch : layout.size;
|
||||||
return S_OK;
|
return S_OK;
|
||||||
} else {
|
} 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 levelExtent = mappedImage->mipLevelExtent(subresource.mipLevel);
|
||||||
const VkExtent3D blockCount = util::computeBlockCount(
|
const VkExtent3D blockCount = util::computeBlockCount(levelExtent, formatInfo->blockSize);
|
||||||
levelExtent, formatInfo->blockSize);
|
|
||||||
|
|
||||||
DxvkPhysicalBufferSlice physicalSlice;
|
DxvkPhysicalBufferSlice physicalSlice;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user