Code cleanup (comments and variable renames)

This commit is contained in:
PatrickvL 2020-12-09 16:55:47 +01:00
parent 4af986f058
commit c6fdfc7101
2 changed files with 18 additions and 16 deletions

View File

@ -5012,15 +5012,15 @@ xbox::void_xt WINAPI xbox::EMUPATCH(D3DDevice_Clear)
// Scale the fill based on our scale factor and MSAA scale
float aaX, aaY;
GetMultiSampleScaleRaw(aaX, aaY);
aaX *= g_RenderUpscaleFactor;
aaY *= g_RenderUpscaleFactor;
float Xscale = aaX * g_RenderUpscaleFactor;
float Yscale = aaY * g_RenderUpscaleFactor;
std::vector<D3DRECT> rects(Count);
for (DWORD i = 0; i < Count; i++) {
rects[i].x1 = static_cast<LONG>(pRects[i].x1 * aaX);
rects[i].x2 = static_cast<LONG>(pRects[i].x2 * aaX);
rects[i].y1 = static_cast<LONG>(pRects[i].y1 * aaY);
rects[i].y2 = static_cast<LONG>(pRects[i].y2 * aaY);
rects[i].x1 = static_cast<LONG>(pRects[i].x1 * Xscale);
rects[i].x2 = static_cast<LONG>(pRects[i].x2 * Xscale);
rects[i].y1 = static_cast<LONG>(pRects[i].y1 * Yscale);
rects[i].y2 = static_cast<LONG>(pRects[i].y2 * Yscale);
}
hRet = g_pD3DDevice->Clear(Count, rects.data(), HostFlags, Color, Z, Stencil);
} else {
@ -7634,16 +7634,16 @@ void CxbxUpdateHostViewport() {
LOG_TEST_CASE("Could not get rendertarget dimensions while setting the viewport");
}
aaScaleX *= g_RenderUpscaleFactor;
aaScaleY *= g_RenderUpscaleFactor;
float Xscale = aaScaleX * g_RenderUpscaleFactor;
float Yscale = aaScaleY * g_RenderUpscaleFactor;
if (g_Xbox_VertexShaderMode == VertexShaderMode::FixedFunction) {
// Set viewport
D3DVIEWPORT hostViewport = g_Xbox_Viewport;
hostViewport.X *= aaScaleX;
hostViewport.Y *= aaScaleY;
hostViewport.Width *= aaScaleX;
hostViewport.Height *= aaScaleY;
hostViewport.X *= Xscale;
hostViewport.Y *= Yscale;
hostViewport.Width *= Xscale;
hostViewport.Height *= Yscale;
g_pD3DDevice->SetViewport(&hostViewport);
// Reset scissor rect
@ -7675,10 +7675,10 @@ void CxbxUpdateHostViewport() {
// Scissor to viewport
g_pD3DDevice->SetRenderState(D3DRS_SCISSORTESTENABLE, TRUE);
RECT viewportRect;
viewportRect.left = g_Xbox_Viewport.X * aaScaleX;
viewportRect.top = g_Xbox_Viewport.Y * aaScaleY;
viewportRect.right = viewportRect.left + g_Xbox_Viewport.Width * aaScaleX;
viewportRect.bottom = viewportRect.top + g_Xbox_Viewport.Height * aaScaleY;
viewportRect.left = g_Xbox_Viewport.X * Xscale;
viewportRect.top = g_Xbox_Viewport.Y * Yscale;
viewportRect.right = viewportRect.left + (g_Xbox_Viewport.Width * Xscale);
viewportRect.bottom = viewportRect.top + (g_Xbox_Viewport.Height * Yscale);
g_pD3DDevice->SetScissorRect(&viewportRect);
}
}

View File

@ -472,6 +472,8 @@ typedef struct s_CxbxPSDef {
RenderStateSpecularEnable = XboxRenderStates.GetXboxRenderState(xbox::X_D3DRS_SPECULARENABLE) > 0;
for (unsigned i = 0; i < xbox::X_D3DTS_STAGECOUNT; i++) {
// Test-cases : XDK sample nosortalphablend, Xbmc-fork (https://github.com/superpea/xbmc-fork/blob/bba40d57db52d11dea7bbf9509c298f7c2b05f4b/xbmc/cores/VideoRenderers/XBoxRenderer.cpp#L134)
// Star Wars: Jedi Academy (https://github.com/RetailGameSourceCode/StarWars_JediAcademy/blob/5b8f0040b3177d8855f7d575ef49b23ed52ff42a/codemp/win32/win_lighteffects.cpp#L299)
AlphaKill[i] = XboxTextureStates.Get(/*stage=*/i, xbox::X_D3DTSS_ALPHAKILL) & 4; // D3DTALPHAKILL_ENABLE
}
}