From f4a92a685f8b2f135dc6fe493ea9ce726aa79a52 Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Sat, 5 May 2018 15:53:00 +0200 Subject: [PATCH] [d3d11] Normalize render target and depth-stencil view types Fixes a regression in Kingdom Come: Deliverance that was introduced in a55bee95548e0c0b2237bb54f6f98ed08f98c112. --- src/d3d11/d3d11_device.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp index 843d7b71f..fa5df8fb3 100644 --- a/src/d3d11/d3d11_device.cpp +++ b/src/d3d11/d3d11_device.cpp @@ -787,6 +787,13 @@ namespace dxvk { return E_INVALIDARG; } + // Normalize view type so that we won't accidentally + // bind 2D array views and 2D views at the same time + if (viewInfo.numLayers == 1) { + if (viewInfo.type == VK_IMAGE_VIEW_TYPE_1D_ARRAY) viewInfo.type = VK_IMAGE_VIEW_TYPE_1D; + if (viewInfo.type == VK_IMAGE_VIEW_TYPE_2D_ARRAY) viewInfo.type = VK_IMAGE_VIEW_TYPE_2D; + } + // Create the actual image view if requested if (ppRTView == nullptr) return S_FALSE; @@ -905,6 +912,13 @@ namespace dxvk { return E_INVALIDARG; } + // Normalize view type so that we won't accidentally + // bind 2D array views and 2D views at the same time + if (viewInfo.numLayers == 1) { + if (viewInfo.type == VK_IMAGE_VIEW_TYPE_1D_ARRAY) viewInfo.type = VK_IMAGE_VIEW_TYPE_1D; + if (viewInfo.type == VK_IMAGE_VIEW_TYPE_2D_ARRAY) viewInfo.type = VK_IMAGE_VIEW_TYPE_2D; + } + // Create the actual image view if requested if (ppDepthStencilView == nullptr) return S_FALSE;