From 45da7d6678e5410549415559b755650f7f0ce29b Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Mon, 9 Dec 2024 17:43:02 +0100 Subject: [PATCH] [d3d11] Fix rectangle check in ClearView It is legal to pass a potentially invalid pointer if NumRects is 0. Fixes validation errors in TopSpin 2k25. --- src/d3d11/d3d11_context.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/d3d11/d3d11_context.cpp b/src/d3d11/d3d11_context.cpp index 82e7d0faf..90195f840 100644 --- a/src/d3d11/d3d11_context.cpp +++ b/src/d3d11/d3d11_context.cpp @@ -730,9 +730,9 @@ namespace dxvk { // Clear all the rectangles that are specified for (uint32_t i = 0; i < NumRects || i < 1; i++) { - if (pRect) { + if (NumRects) { if (pRect[i].left >= pRect[i].right - || pRect[i].top >= pRect[i].bottom) + || pRect[i].top >= pRect[i].bottom) continue; } @@ -740,7 +740,7 @@ namespace dxvk { VkDeviceSize offset = 0; VkDeviceSize length = bufView->info().size / formatInfo->elementSize; - if (pRect) { + if (NumRects) { offset = pRect[i].left; length = pRect[i].right - pRect[i].left; } @@ -763,7 +763,7 @@ namespace dxvk { VkOffset3D offset = { 0, 0, 0 }; VkExtent3D extent = imgView->mipLevelExtent(0); - if (pRect) { + if (NumRects) { offset = { pRect[i].left, pRect[i].top, 0 }; extent = { uint32_t(pRect[i].right - pRect[i].left),