From a567f6a5a51c3478f7ba9b0ed39f22a83be1f6cc Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 2 Feb 2018 21:42:04 +0100 Subject: [PATCH] [dxbc] Do not emit depth type for non-sampled resources Fixes a crash in the Nvidia driver. These type declarations were never used in the first place. --- src/dxbc/dxbc_compiler.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index 694623ab..63cfa77c 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -757,11 +757,18 @@ namespace dxvk { res.sampledTypeId = sampledTypeId; res.imageTypeId = imageTypeId; res.colorTypeId = imageTypeId; - res.depthTypeId = m_module.defImageType(sampledTypeId, - typeInfo.dim, 1, typeInfo.array, typeInfo.ms, typeInfo.sampled, - spv::ImageFormatUnknown); - m_textures.at(registerId) = res; + res.depthTypeId = 0; res.structStride = 0; + + if (resourceType != DxbcResourceDim::Buffer + && resourceType != DxbcResourceDim::Texture2DMs + && resourceType != DxbcResourceDim::Texture2DMsArr) { + res.depthTypeId = m_module.defImageType(sampledTypeId, + typeInfo.dim, 1, typeInfo.array, typeInfo.ms, typeInfo.sampled, + spv::ImageFormatUnknown); + } + + m_textures.at(registerId) = res; } // Store descriptor info for the shader interface @@ -866,7 +873,7 @@ namespace dxvk { res.sampledTypeId = sampledTypeId; res.imageTypeId = resTypeId; res.colorTypeId = resTypeId; - res.depthTypeId = resTypeId; + res.depthTypeId = 0; res.structStride = resStride; m_textures.at(registerId) = res; }