Merge pull request #1400 from revel8n/shader_improvements

Shader improvements (Pixel Shader 2.0)
This commit is contained in:
Luke Usher 2018-08-30 21:39:47 +01:00 committed by GitHub
commit 9172cef216
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 2141 additions and 211 deletions

View File

@ -5811,6 +5811,9 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetTextureState_BumpEnv_8)
case 26: // X_D3DTSS_BUMPENVLSCALE
hRet = g_pD3DDevice->SetTextureStageState(Stage, D3DTSS_BUMPENVLSCALE, Value);
break;
case 27: // X_D3DTSS_BUMPENVLOFFSET
hRet = g_pD3DDevice->SetTextureStageState(Stage, D3DTSS_BUMPENVLOFFSET, Value);
break;
}
//DEBUG_D3DRESULT(hRet, "g_pD3DDevice->SetTextureStageState");
@ -5851,6 +5854,9 @@ VOID WINAPI XTL::EMUPATCH(D3DDevice_SetTextureState_BumpEnv)
case 26: // X_D3DTSS_BUMPENVLSCALE
hRet = g_pD3DDevice->SetTextureStageState(Stage, D3DTSS_BUMPENVLSCALE, Value);
break;
case 27: // X_D3DTSS_BUMPENVLOFFSET
hRet = g_pD3DDevice->SetTextureStageState(Stage, D3DTSS_BUMPENVLOFFSET, Value);
break;
}
DEBUG_D3DRESULT(hRet, "g_pD3DDevice->SetTextureStageState");
@ -7184,14 +7190,14 @@ void EmuUpdateActiveTextureStages()
void XTL::CxbxUpdateNativeD3DResources()
{
EmuUpdateActiveTextureStages();
EmuUpdateActiveTextureStages();
// If Pixel Shaders are not disabled, process them
if (!g_DisablePixelShaders) {
XTL::DxbxUpdateActivePixelShader();
}
XTL::EmuUpdateDeferredStates();
XTL::EmuUpdateDeferredStates();
/* TODO : Port these :
DxbxUpdateActiveVertexShader();
DxbxUpdateActiveTextures();

File diff suppressed because it is too large Load Diff

View File

@ -304,7 +304,7 @@ void XTL::EmuUpdateDeferredStates()
g_pD3DDevice->SetTextureStageState(v, D3DTSS_COLOROP, D3DTOP_LERP);
break;
case X_D3DTOP_BUMPENVMAP:
g_pD3DDevice->SetTextureStageState(v, D3DTSS_COLOROP, D3DTOP_MULTIPLYADD);
g_pD3DDevice->SetTextureStageState(v, D3DTSS_COLOROP, D3DTOP_BUMPENVMAP);
break;
case X_D3DTOP_BUMPENVMAPLUMINANCE:
g_pD3DDevice->SetTextureStageState(v, D3DTSS_COLOROP, D3DTOP_BUMPENVMAPLUMINANCE);

View File

@ -1161,9 +1161,6 @@ static boolean VshAddInstructionILU_R(VSH_SHADER_INSTRUCTION *pInstruction,
return FALSE;
}
// Dxbx note : Scalar instructions read from C, but use X instead of W, fix that :
DxbxFixupScalarParameter(pInstruction, pShader, &pInstruction->C);
pIntermediate = VshNewIntermediate(pShader);
pIntermediate->IsCombined = IsCombined;
@ -1231,6 +1228,9 @@ static void VshConvertToIntermediate(VSH_SHADER_INSTRUCTION *pInstruction,
// +ILU
boolean IsCombined = FALSE;
// Dxbx note : Scalar instructions read from C, but use X instead of W, fix that :
DxbxFixupScalarParameter(pInstruction, pShader, &pInstruction->C);
if(VshAddInstructionMAC_R(pInstruction, pShader, IsCombined))
{
if(HasMACO(pInstruction) ||