diff --git a/src/d3d9/d3d9_device.cpp b/src/d3d9/d3d9_device.cpp index 86cc93904..83bbf3a7b 100644 --- a/src/d3d9/d3d9_device.cpp +++ b/src/d3d9/d3d9_device.cpp @@ -6661,6 +6661,8 @@ namespace dxvk { break; } + stage.TextureBound = m_state.textures[idx] != nullptr ? 1 : 0; + stage.ColorOp = data[DXVK_TSS_COLOROP]; stage.AlphaOp = data[DXVK_TSS_ALPHAOP]; diff --git a/src/d3d9/d3d9_fixed_function.cpp b/src/d3d9/d3d9_fixed_function.cpp index 8c7aeb2a1..6ac190b3b 100644 --- a/src/d3d9/d3d9_fixed_function.cpp +++ b/src/d3d9/d3d9_fixed_function.cpp @@ -1545,9 +1545,11 @@ namespace dxvk { uint32_t current = diffuse; // Temp starts off as equal to vec4(0) uint32_t temp = m_module.constvec4f32(0.0f, 0.0f, 0.0f, 0.0f); - + uint32_t texture = m_module.constvec4f32(0.0f, 0.0f, 0.0f, 1.0f); + uint32_t unboundTextureConstId = m_module.constvec4f32(0.0f, 0.0f, 0.0f, 1.0f); + for (uint32_t i = 0; i < caps::TextureStageCount; i++) { const auto& stage = m_fsKey.Stages[i].Contents; @@ -1706,7 +1708,11 @@ namespace dxvk { reg = temp; break; case D3DTA_TEXTURE: - reg = GetTexture(); + if (stage.TextureBound != 0) { + reg = GetTexture(); + } else { + reg = unboundTextureConstId; + } break; case D3DTA_TFACTOR: reg = m_ps.constants.textureFactor; diff --git a/src/d3d9/d3d9_fixed_function.h b/src/d3d9/d3d9_fixed_function.h index 3c0158c75..e91de84a5 100644 --- a/src/d3d9/d3d9_fixed_function.h +++ b/src/d3d9/d3d9_fixed_function.h @@ -150,6 +150,8 @@ namespace dxvk { uint32_t ProjectedCount : 3; + uint32_t TextureBound : 1; + // Included in here, read from Stage 0 for packing reasons // Affects all stages. uint32_t GlobalSpecularEnable : 1;