1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-02-23 19:54:16 +01:00

[d3d9] Fix mismatching texture type mask updates

This commit is contained in:
Robin Kertels 2025-02-16 14:49:07 +01:00 committed by Philip Rebohle
parent 0aebedae16
commit 3269f92138

View File

@ -6380,15 +6380,16 @@ namespace dxvk {
void D3D9DeviceEx::UpdateTextureTypeMismatchesForShader(const D3D9CommonShader* shader, uint32_t shaderSamplerMask, uint32_t shaderSamplerOffset) { 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)) { if (unlikely(shader->GetInfo().majorVersion() < 2 || m_d3d9Options.forceSamplerTypeSpecConstants)) {
// SM 1 shaders don't define the texture type in the shader. // SM 1 shaders don't define the texture type in the shader.
// We always use spec constants for those. // We always use spec constants for those.
m_dirtyTextures |= shaderSamplerMask & m_mismatchingTextureTypes; m_dirtyTextures |= stageCorrectedShaderSamplerMask & m_mismatchingTextureTypes;
m_mismatchingTextureTypes &= ~shaderSamplerMask; m_mismatchingTextureTypes &= ~stageCorrectedShaderSamplerMask;
return; return;
} }
for (uint32_t i : bit::BitMask(shaderSamplerMask)) { for (const uint32_t i : bit::BitMask(stageCorrectedShaderSamplerMask)) {
const D3D9CommonTexture* texture = GetCommonTexture(m_state.textures[i]); const D3D9CommonTexture* texture = GetCommonTexture(m_state.textures[i]);
if (unlikely(texture == nullptr)) { if (unlikely(texture == nullptr)) {
// Unbound textures are not mismatching texture types // Unbound textures are not mismatching texture types
@ -6436,7 +6437,7 @@ namespace dxvk {
bool shaderUsesTexture = shaderViewType != VkImageViewType(0); bool shaderUsesTexture = shaderViewType != VkImageViewType(0);
if (unlikely(boundViewType != shaderViewType && shaderUsesTexture)) { if (unlikely(boundViewType != shaderViewType && shaderUsesTexture)) {
const uint32_t samplerBit = 1u << stateSampler; const uint32_t samplerBit = 1u << stateSampler;
m_mismatchingTextureTypes |= 1 << samplerBit; m_mismatchingTextureTypes |= samplerBit;
} }
} }