From aa02612b9e5c5eb0e69ced0f3b71b5fb6da9037c Mon Sep 17 00:00:00 2001 From: Philip Rebohle Date: Fri, 19 Jan 2018 09:09:38 +0100 Subject: [PATCH] [dxbc] Do not set ImageOperandsLodMask for multisample loads This should fix invalid SPIR-V being generated in The Witness. --- src/dxbc/dxbc_compiler.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/dxbc/dxbc_compiler.cpp b/src/dxbc/dxbc_compiler.cpp index 8d2cd8137..e2cd6f864 100644 --- a/src/dxbc/dxbc_compiler.cpp +++ b/src/dxbc/dxbc_compiler.cpp @@ -2327,8 +2327,9 @@ namespace dxvk { imageLayerDim, offsetIds.data()); } - // The LOD is not present when reading from a buffer - if (imageType.dim != spv::DimBuffer) { + // The LOD is not present when reading from + // a buffer or from a multisample texture. + if (imageType.dim != spv::DimBuffer && imageType.ms == 0) { DxbcRegisterValue imageLod = emitRegisterExtract( address, DxbcRegMask(false, false, false, true)); @@ -2336,8 +2337,8 @@ namespace dxvk { imageOperands.sLod = imageLod.id; } - // The ld2ms instruction also has a sample index, but - // we are only allowed to set it for multisample views + // The ld2ms instruction has a sample index, but we + // are only allowed to set it for multisample views if (ins.op == DxbcOpcode::LdMs && imageType.ms == 1) { DxbcRegisterValue sampleId = emitRegisterLoad( ins.src[2], DxbcRegMask(true, false, false, false));