fix mode 4: stagger right MFD BeginScene to step 1 to match flip timing
Root cause of the broken MFD2 display: CMFD_Device::BeginScene() cleared the right device back buffer at old sh_step==0, but with the stagger the right device flip also fired in that same frame (new sh_step==1 = old sh_step==0 after increment). The flip presented a just-cleared buffer with only the grid, no channel data. Fix: split BeginScene for mode 4 - left device (step 0) vs right device (step 1). Add BeginSceneRight() called from WinMain at old sh_step==1. The right device flip at new sh_step==1 (= old sh_step==0) now shows channels 3-4 rendered at steps 5-6 of the previous cycle - correct. Cycle for mode 4 with stagger: old sh_step 0: radar+left BeginScene, no flip new sh_step 1: flip right MFD (shows prev cycle channels 3-4) old sh_step 1: right BeginScene (clear+grid) old sh_step 2-4: channels 0-2 -> left device old sh_step 5-6: channels 3-4 -> right device new sh_step 0: flip radar+left MFD (shows prev cycle channels 0-2)
This commit is contained in:
@@ -941,10 +941,15 @@ void gos_UpdateDisplay( bool Everything )
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
// Same 7-step cadence as mode 1: clear both MFD devices at step 0.
|
||||
// Step 0: clear + grid for radar and LEFT MFD.
|
||||
// Step 1: clear + grid for RIGHT MFD (staggered so the right
|
||||
// flip at new sh_step==1 shows channels 3-4 from the previous
|
||||
// cycle, not a freshly-cleared buffer).
|
||||
if(sh_step==0){
|
||||
radar_device.BeginScene();
|
||||
mfd_device.BeginScene(); // also clears mfd_device_right internally
|
||||
mfd_device.BeginScene(); // left device only
|
||||
} else if(sh_step==1) {
|
||||
mfd_device.BeginSceneRight(); // right device clear + grid
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1620,23 +1620,15 @@ bool CMFD_Device::BeginScene()
|
||||
//pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET ,0,1.0f,0);
|
||||
}break;
|
||||
case 4:
|
||||
// Clear and draw background grid on the LEFT device.
|
||||
// Clear and draw background grid on the LEFT device only.
|
||||
// The right device is cleared/gridded in BeginSceneRight(),
|
||||
// called from WinMain at old sh_step==1 (one frame after the
|
||||
// right MFD flip) so its back buffer has fresh content when flipped.
|
||||
SetRenderTargetBackbuffer();
|
||||
pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET,0,1.0f,0);
|
||||
pD3DDevice->BeginScene();
|
||||
if(sh_game_started) DrawMFDBackGrid();
|
||||
pD3DDevice->EndScene();
|
||||
// Clear and draw background grid on the RIGHT device.
|
||||
if (m_pRightDevice) {
|
||||
m_pRightDevice->SetRenderTargetBackbuffer();
|
||||
m_pRightDevice->pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET,0,1.0f,0);
|
||||
m_pRightDevice->pD3DDevice->BeginScene();
|
||||
if(sh_game_started) {
|
||||
m_pRightDevice->pD3DDevice->SetTexture(0,0);
|
||||
m_pRightDevice->DrawQuadList(8,rcs640_solo,0xFFFFFFFF);
|
||||
}
|
||||
m_pRightDevice->pD3DDevice->EndScene();
|
||||
}
|
||||
return true; // skip the common BeginScene/DrawGrid/EndScene below
|
||||
}
|
||||
pD3DDevice->BeginScene();
|
||||
@@ -1655,6 +1647,25 @@ bool CMFD_Device::EndScene()
|
||||
return true;
|
||||
}
|
||||
|
||||
// Mode 4: clear and draw the background grid on the right device.
|
||||
// Called from WinMain at old sh_step==1, one frame after the right MFD
|
||||
// flip, so channels 3-4 can render into a fresh back buffer before the
|
||||
// next flip at new sh_step==1 (= old sh_step==0).
|
||||
bool CMFD_Device::BeginSceneRight()
|
||||
{
|
||||
if (g_nTypeOfMFDs != 4 || !m_pRightDevice)
|
||||
return false;
|
||||
m_pRightDevice->SetRenderTargetBackbuffer();
|
||||
m_pRightDevice->pD3DDevice->Clear(0,NULL,D3DCLEAR_TARGET,0,1.0f,0);
|
||||
m_pRightDevice->pD3DDevice->BeginScene();
|
||||
if(sh_game_started) {
|
||||
m_pRightDevice->pD3DDevice->SetTexture(0,0);
|
||||
m_pRightDevice->DrawQuadList(8,rcs640_solo,0xFFFFFFFF);
|
||||
}
|
||||
m_pRightDevice->pD3DDevice->EndScene();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool CMFD_Device::Release()
|
||||
{
|
||||
|
||||
@@ -178,6 +178,7 @@ public:
|
||||
bool BeginChannel(DWORD channel);// 0~4번의 채널을 정할 수 있게된다.
|
||||
bool EndChannel();
|
||||
virtual bool BeginScene(); //normal한 beginscene/endscene를 한다.
|
||||
bool BeginSceneRight(); // mode 4: clear+grid on right device at sh_step==1
|
||||
virtual bool EndScene(); //flip을 한다.
|
||||
virtual bool Release();
|
||||
bool LoadDamageTexture(const char *mechtexturename);
|
||||
|
||||
Reference in New Issue
Block a user