From f7d56886c53cb1eff36b929dbc568e7da1cb5074 Mon Sep 17 00:00:00 2001 From: Robin Kertels Date: Fri, 21 Feb 2025 12:09:03 +0100 Subject: [PATCH] [d3d9] Fix sampler slot correction not respecting dmap texture --- src/d3d9/d3d9_device.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index f43f3d74a..a984cee00 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -6415,12 +6415,15 @@ namespace dxvk { void D3D9DeviceEx::UpdateTextureTypeMismatchesForTexture(uint32_t stateSampler) { uint32_t shaderTextureIndex; const D3D9CommonShader* shader; - if (unlikely(stateSampler > caps::MaxTexturesPS + 1)) { + if (likely(stateSampler <= caps::MaxTexturesPS)) { + shader = GetCommonShader(m_state.pixelShader); + shaderTextureIndex = stateSampler; + } else if (unlikely(stateSampler >= caps::MaxTexturesPS + 1)) { shader = GetCommonShader(m_state.vertexShader); shaderTextureIndex = stateSampler - caps::MaxTexturesPS - 1; } else { - shader = GetCommonShader(m_state.pixelShader); - shaderTextureIndex = stateSampler; + // Do not type check the fixed function displacement map texture. + return; } if (unlikely(shader == nullptr || shader->GetInfo().majorVersion() < 2 || m_d3d9Options.forceSamplerTypeSpecConstants)) {