Submit viewport scale and offset in one batch

This commit is contained in:
Silent 2020-10-24 22:36:56 +02:00
parent 724a1ca684
commit 9b2c1ba2ce
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
1 changed files with 4 additions and 6 deletions

View File

@ -4032,11 +4032,10 @@ void GetViewPortOffsetAndScale(float (&vOffset)[4], float(&vScale)[4])
void UpdateViewPortOffsetAndScaleConstants()
{
float vOffset[4], vScale[4];
GetViewPortOffsetAndScale(vOffset, vScale);
float vScaleOffset[2][4]; // 0 - scale 1 - offset
GetViewPortOffsetAndScale(vScaleOffset[1], vScaleOffset[0]);
g_pD3DDevice->SetVertexShaderConstantF(CXBX_D3DVS_VIEWPORT_SCALE_MIRROR, vScale, 1);
g_pD3DDevice->SetVertexShaderConstantF(CXBX_D3DVS_VIEWPORT_OFFSET_MIRROR, vOffset, 1);
g_pD3DDevice->SetVertexShaderConstantF(CXBX_D3DVS_VIEWPORT_SCALE_MIRROR, reinterpret_cast<float*>(vScaleOffset), 2);
// Store viewport offset and scale in constant registers 58 (c-38) and
// 59 (c-37) used for screen space transformation.
@ -4044,8 +4043,7 @@ void UpdateViewPortOffsetAndScaleConstants()
// Treat this as a flag
// Test Case: GTA III, Soldier of Fortune II
if (!(g_Xbox_VertexShaderConstantMode & X_D3DSCM_NORESERVEDCONSTANTS)) {
g_pD3DDevice->SetVertexShaderConstantF(X_D3DSCM_RESERVED_CONSTANT_SCALE + X_D3DSCM_CORRECTION, vScale, 1);
g_pD3DDevice->SetVertexShaderConstantF(X_D3DSCM_RESERVED_CONSTANT_OFFSET + X_D3DSCM_CORRECTION, vOffset, 1);
g_pD3DDevice->SetVertexShaderConstantF(X_D3DSCM_RESERVED_CONSTANT_SCALE + X_D3DSCM_CORRECTION, reinterpret_cast<float*>(vScaleOffset), 2);
}
}