Skip to content

Commit

Permalink
[d3d9] Fix mismatching texture type mask updates
Browse files Browse the repository at this point in the history
  • Loading branch information
K0bin committed Feb 16, 2025
1 parent 6d9e0ba commit 6699750
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/d3d9/d3d9_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6380,15 +6380,16 @@ namespace dxvk {


void D3D9DeviceEx::UpdateTextureTypeMismatchesForShader(const D3D9CommonShader* shader, uint32_t shaderSamplerMask, uint32_t shaderSamplerOffset) {
const uint32_t stageCorrectedShaderSamplerMask = shaderSamplerMask << shaderSamplerOffset;
if (unlikely(shader->GetInfo().majorVersion() < 2 || m_d3d9Options.forceSamplerTypeSpecConstants)) {
// SM 1 shaders don't define the texture type in the shader.
// We always use spec constants for those.
m_dirtyTextures |= shaderSamplerMask & m_mismatchingTextureTypes;
m_mismatchingTextureTypes &= ~shaderSamplerMask;
m_dirtyTextures |= stageCorrectedShaderSamplerMask & m_mismatchingTextureTypes;
m_mismatchingTextureTypes &= ~stageCorrectedShaderSamplerMask;
return;
}

for (uint32_t i : bit::BitMask(shaderSamplerMask)) {
for (const uint32_t i : bit::BitMask(stageCorrectedShaderSamplerMask)) {
const D3D9CommonTexture* texture = GetCommonTexture(m_state.textures[i]);
if (unlikely(texture == nullptr)) {
// Unbound textures are not mismatching texture types
Expand Down Expand Up @@ -6436,7 +6437,7 @@ namespace dxvk {
bool shaderUsesTexture = shaderViewType != VkImageViewType(0);
if (unlikely(boundViewType != shaderViewType && shaderUsesTexture)) {
const uint32_t samplerBit = 1u << stateSampler;
m_mismatchingTextureTypes |= 1 << samplerBit;
m_mismatchingTextureTypes |= samplerBit;
}
}

Expand Down

0 comments on commit 6699750

Please sign in to comment.