1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2025-03-15 07:29:17 +01:00

[d3d9] Handle unbound textures in fixed function shaders

This commit is contained in:
Robin Kertels 2022-07-10 20:14:37 +02:00 committed by Joshie
parent 6c5f73ac26
commit 116feca6af
3 changed files with 12 additions and 2 deletions

View File

@ -6661,6 +6661,8 @@ namespace dxvk {
break; break;
} }
stage.TextureBound = m_state.textures[idx] != nullptr ? 1 : 0;
stage.ColorOp = data[DXVK_TSS_COLOROP]; stage.ColorOp = data[DXVK_TSS_COLOROP];
stage.AlphaOp = data[DXVK_TSS_ALPHAOP]; stage.AlphaOp = data[DXVK_TSS_ALPHAOP];

View File

@ -1548,6 +1548,8 @@ namespace dxvk {
uint32_t texture = m_module.constvec4f32(0.0f, 0.0f, 0.0f, 1.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++) { for (uint32_t i = 0; i < caps::TextureStageCount; i++) {
const auto& stage = m_fsKey.Stages[i].Contents; const auto& stage = m_fsKey.Stages[i].Contents;
@ -1706,7 +1708,11 @@ namespace dxvk {
reg = temp; reg = temp;
break; break;
case D3DTA_TEXTURE: case D3DTA_TEXTURE:
reg = GetTexture(); if (stage.TextureBound != 0) {
reg = GetTexture();
} else {
reg = unboundTextureConstId;
}
break; break;
case D3DTA_TFACTOR: case D3DTA_TFACTOR:
reg = m_ps.constants.textureFactor; reg = m_ps.constants.textureFactor;

View File

@ -150,6 +150,8 @@ namespace dxvk {
uint32_t ProjectedCount : 3; uint32_t ProjectedCount : 3;
uint32_t TextureBound : 1;
// Included in here, read from Stage 0 for packing reasons // Included in here, read from Stage 0 for packing reasons
// Affects all stages. // Affects all stages.
uint32_t GlobalSpecularEnable : 1; uint32_t GlobalSpecularEnable : 1;