[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;
}
stage.TextureBound = m_state.textures[idx] != nullptr ? 1 : 0;
stage.ColorOp = data[DXVK_TSS_COLOROP];
stage.AlphaOp = data[DXVK_TSS_ALPHAOP];

View File

@ -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;

View File

@ -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;