mirror of
https://github.com/doitsujin/dxvk.git
synced 2025-03-14 22:29:15 +01:00
[d3d11] Validate subresource index in copy operations
Rocket League tries to copy five subresources of a texture that only has one single array layer and one single mip map, which causes GPU hangs on Nvidia drivers.
This commit is contained in:
parent
f12ddfa4d3
commit
4aa6800e95
@ -409,6 +409,10 @@ namespace dxvk {
|
|||||||
const VkImageSubresource dstSubresource = dstTextureInfo->GetSubresourceFromIndex(dstFormatInfo->aspectMask, DstSubresource);
|
const VkImageSubresource dstSubresource = dstTextureInfo->GetSubresourceFromIndex(dstFormatInfo->aspectMask, DstSubresource);
|
||||||
const VkImageSubresource srcSubresource = srcTextureInfo->GetSubresourceFromIndex(srcFormatInfo->aspectMask, SrcSubresource);
|
const VkImageSubresource srcSubresource = srcTextureInfo->GetSubresourceFromIndex(srcFormatInfo->aspectMask, SrcSubresource);
|
||||||
|
|
||||||
|
if (DstSubresource >= dstTextureInfo->CountSubresources()
|
||||||
|
|| SrcSubresource >= srcTextureInfo->CountSubresources())
|
||||||
|
return;
|
||||||
|
|
||||||
// Copies are only supported on size-compatible formats
|
// Copies are only supported on size-compatible formats
|
||||||
if (dstFormatInfo->elementSize != srcFormatInfo->elementSize) {
|
if (dstFormatInfo->elementSize != srcFormatInfo->elementSize) {
|
||||||
Logger::err(str::format(
|
Logger::err(str::format(
|
||||||
@ -468,7 +472,7 @@ namespace dxvk {
|
|||||||
srcSubresource.aspectMask,
|
srcSubresource.aspectMask,
|
||||||
srcSubresource.mipLevel,
|
srcSubresource.mipLevel,
|
||||||
srcSubresource.arrayLayer, 1 };
|
srcSubresource.arrayLayer, 1 };
|
||||||
|
|
||||||
// Copying multiple slices does not
|
// Copying multiple slices does not
|
||||||
// seem to be supported in D3D11
|
// seem to be supported in D3D11
|
||||||
if (copy2Dto3D || copy3Dto2D) {
|
if (copy2Dto3D || copy3Dto2D) {
|
||||||
@ -1190,6 +1194,9 @@ namespace dxvk {
|
|||||||
} else {
|
} else {
|
||||||
const D3D11CommonTexture* textureInfo = GetCommonTexture(pDstResource);
|
const D3D11CommonTexture* textureInfo = GetCommonTexture(pDstResource);
|
||||||
|
|
||||||
|
if (DstSubresource >= textureInfo->CountSubresources())
|
||||||
|
return;
|
||||||
|
|
||||||
VkFormat packedFormat = m_parent->LookupPackedFormat(
|
VkFormat packedFormat = m_parent->LookupPackedFormat(
|
||||||
textureInfo->Desc()->Format,
|
textureInfo->Desc()->Format,
|
||||||
textureInfo->GetFormatMode()).Format;
|
textureInfo->GetFormatMode()).Format;
|
||||||
@ -1376,6 +1383,10 @@ namespace dxvk {
|
|||||||
auto dstVulkanFormatInfo = imageFormatInfo(dstFormatInfo.Format);
|
auto dstVulkanFormatInfo = imageFormatInfo(dstFormatInfo.Format);
|
||||||
auto srcVulkanFormatInfo = imageFormatInfo(srcFormatInfo.Format);
|
auto srcVulkanFormatInfo = imageFormatInfo(srcFormatInfo.Format);
|
||||||
|
|
||||||
|
if (DstSubresource >= dstTextureInfo->CountSubresources()
|
||||||
|
|| SrcSubresource >= srcTextureInfo->CountSubresources())
|
||||||
|
return;
|
||||||
|
|
||||||
const VkImageSubresource dstSubresource =
|
const VkImageSubresource dstSubresource =
|
||||||
dstTextureInfo->GetSubresourceFromIndex(
|
dstTextureInfo->GetSubresourceFromIndex(
|
||||||
dstVulkanFormatInfo->aspectMask, DstSubresource);
|
dstVulkanFormatInfo->aspectMask, DstSubresource);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user