Reuse colorOp variable

And additional comments
This commit is contained in:
Anthony 2021-04-19 20:45:01 +12:00 committed by PatrickvL
parent ce7a5f6e40
commit 6bf2a1f44f
1 changed files with 8 additions and 3 deletions

View File

@ -768,7 +768,12 @@ IDirect3DPixelShader9* GetFixedFunctionShader()
bool previousStageDisabled = false;
for (int i = 0; i < 4; i++) {
// Determine the COLOROP
// Determine COLOROP
// This controls both the texture operation for the colour of the stage
// and when to stop processing
// Under certain circumstances we force it to be DISABLE
auto colorOp = XboxTextureStates.Get(i, xbox::X_D3DTSS_COLOROP);
// Usually we execute stages up to the first disabled stage
// However, if point sprites are enabled, we just execute stage 3
bool forceDisable =
@ -784,12 +789,12 @@ IDirect3DPixelShader9* GetFixedFunctionShader()
// Test case: Crash Nitro Kart (engine speed UI)
if (!g_pXbox_SetTexture[i]
&& XboxTextureStates.Get(i, xbox::X_D3DTSS_COLORARG1) == X_D3DTA_TEXTURE
&& XboxTextureStates.Get(i, xbox::X_D3DTSS_COLOROP) != xbox::X_D3DTOP_SELECTARG2)
&& colorOp != xbox::X_D3DTOP_SELECTARG2)
{
forceDisable = true;
}
auto colorOp = XboxTextureStates.Get(i, xbox::X_D3DTSS_COLOROP);
// Set the final COLOROP value
states[i].COLOROP = forceDisable ? X_D3DTOP_DISABLE : colorOp;
// If the stage is disabled we don't want its configuration to affect the key