GPU:
- Use more consistent behavior when forcing the 3D rendering to finish. - Guarantee that 3D rendering will always be finished at the end of V-blank.
This commit is contained in:
parent
d8735a803b
commit
8c60f5fdf3
|
@ -6879,6 +6879,22 @@ void GPUSubsystem::Reset()
|
||||||
osd->clear();
|
osd->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GPUSubsystem::ForceRender3DFinishAndFlush(bool willFlush)
|
||||||
|
{
|
||||||
|
if (CurrentRenderer->GetRenderNeedsFinish())
|
||||||
|
{
|
||||||
|
bool need3DDisplayFramebuffer;
|
||||||
|
bool need3DCaptureFramebuffer;
|
||||||
|
CurrentRenderer->GetFramebufferFlushStates(need3DDisplayFramebuffer, need3DCaptureFramebuffer);
|
||||||
|
|
||||||
|
CurrentRenderer->SetFramebufferFlushStates(willFlush, willFlush);
|
||||||
|
CurrentRenderer->RenderFinish();
|
||||||
|
CurrentRenderer->SetFramebufferFlushStates(need3DDisplayFramebuffer, need3DCaptureFramebuffer);
|
||||||
|
CurrentRenderer->SetRenderNeedsFinish(false);
|
||||||
|
this->_event->DidRender3DEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GPUSubsystem::UpdateRenderProperties()
|
void GPUSubsystem::UpdateRenderProperties()
|
||||||
{
|
{
|
||||||
this->_engineMain->vramBlockOBJIndex = VRAM_NO_3D_USAGE;
|
this->_engineMain->vramBlockOBJIndex = VRAM_NO_3D_USAGE;
|
||||||
|
@ -7004,7 +7020,7 @@ void GPUSubsystem::SetCustomFramebufferSize(size_t w, size_t h, void *clientNati
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CurrentRenderer->RenderFinish();
|
GPU->ForceRender3DFinishAndFlush(false);
|
||||||
|
|
||||||
const float customWidthScale = (float)w / (float)GPU_FRAMEBUFFER_NATIVE_WIDTH;
|
const float customWidthScale = (float)w / (float)GPU_FRAMEBUFFER_NATIVE_WIDTH;
|
||||||
const float customHeightScale = (float)h / (float)GPU_FRAMEBUFFER_NATIVE_HEIGHT;
|
const float customHeightScale = (float)h / (float)GPU_FRAMEBUFFER_NATIVE_HEIGHT;
|
||||||
|
@ -7146,7 +7162,7 @@ void GPUSubsystem::SetCustomFramebufferSize(size_t w, size_t h)
|
||||||
|
|
||||||
void GPUSubsystem::SetColorFormat(const NDSColorFormat outputFormat, void *clientNativeBuffer, void *clientCustomBuffer)
|
void GPUSubsystem::SetColorFormat(const NDSColorFormat outputFormat, void *clientNativeBuffer, void *clientCustomBuffer)
|
||||||
{
|
{
|
||||||
CurrentRenderer->RenderFinish();
|
GPU->ForceRender3DFinishAndFlush(false);
|
||||||
|
|
||||||
this->_displayInfo.colorFormat = outputFormat;
|
this->_displayInfo.colorFormat = outputFormat;
|
||||||
this->_displayInfo.pixelBytes = (outputFormat == NDSColorFormat_BGR555_Rev) ? sizeof(u16) : sizeof(FragmentColor);
|
this->_displayInfo.pixelBytes = (outputFormat == NDSColorFormat_BGR555_Rev) ? sizeof(u16) : sizeof(FragmentColor);
|
||||||
|
|
|
@ -1627,6 +1627,7 @@ public:
|
||||||
GPUEventHandler* GetEventHandler();
|
GPUEventHandler* GetEventHandler();
|
||||||
|
|
||||||
void Reset();
|
void Reset();
|
||||||
|
void ForceRender3DFinishAndFlush(bool willFlush);
|
||||||
const NDSDisplayInfo& GetDisplayInfo(); // Frontends need to call this whenever they need to read the video buffers from the emulator core
|
const NDSDisplayInfo& GetDisplayInfo(); // Frontends need to call this whenever they need to read the video buffers from the emulator core
|
||||||
void SetDisplayDidCustomRender(NDSDisplayID displayID, bool theState);
|
void SetDisplayDidCustomRender(NDSDisplayID displayID, bool theState);
|
||||||
|
|
||||||
|
|
|
@ -527,7 +527,7 @@ void gfx3d_deinit()
|
||||||
|
|
||||||
void gfx3d_reset()
|
void gfx3d_reset()
|
||||||
{
|
{
|
||||||
CurrentRenderer->RenderFinish();
|
GPU->ForceRender3DFinishAndFlush(false);
|
||||||
|
|
||||||
#ifdef _SHOW_VTX_COUNTERS
|
#ifdef _SHOW_VTX_COUNTERS
|
||||||
max_polys = max_verts = 0;
|
max_polys = max_verts = 0;
|
||||||
|
@ -2300,24 +2300,13 @@ void gfx3d_VBlankSignal()
|
||||||
|
|
||||||
void gfx3d_VBlankEndSignal(bool skipFrame)
|
void gfx3d_VBlankEndSignal(bool skipFrame)
|
||||||
{
|
{
|
||||||
|
GPU->ForceRender3DFinishAndFlush(false);
|
||||||
|
|
||||||
if (!drawPending) return;
|
if (!drawPending) return;
|
||||||
if (skipFrame) return;
|
if (skipFrame) return;
|
||||||
|
|
||||||
drawPending = FALSE;
|
drawPending = FALSE;
|
||||||
|
|
||||||
if (CurrentRenderer->GetRenderNeedsFinish())
|
|
||||||
{
|
|
||||||
bool need3DDisplayFramebuffer;
|
|
||||||
bool need3DCaptureFramebuffer;
|
|
||||||
CurrentRenderer->GetFramebufferFlushStates(need3DDisplayFramebuffer, need3DCaptureFramebuffer);
|
|
||||||
|
|
||||||
CurrentRenderer->SetFramebufferFlushStates(false, false);
|
|
||||||
CurrentRenderer->RenderFinish();
|
|
||||||
CurrentRenderer->SetFramebufferFlushStates(need3DDisplayFramebuffer, need3DCaptureFramebuffer);
|
|
||||||
CurrentRenderer->SetRenderNeedsFinish(false);
|
|
||||||
GPU->GetEventHandler()->DidRender3DEnd();
|
|
||||||
}
|
|
||||||
|
|
||||||
GPU->GetEventHandler()->DidRender3DBegin();
|
GPU->GetEventHandler()->DidRender3DBegin();
|
||||||
|
|
||||||
if (CommonSettings.showGpu.main)
|
if (CommonSettings.showGpu.main)
|
||||||
|
@ -2534,7 +2523,7 @@ void gfx3d_Update3DFramebuffers(FragmentColor *framebufferRGBA6665, u16 *framebu
|
||||||
//-------------savestate
|
//-------------savestate
|
||||||
void gfx3d_savestate(EMUFILE* os)
|
void gfx3d_savestate(EMUFILE* os)
|
||||||
{
|
{
|
||||||
CurrentRenderer->RenderFinish();
|
GPU->ForceRender3DFinishAndFlush(true);
|
||||||
|
|
||||||
//version
|
//version
|
||||||
write32le(4,os);
|
write32le(4,os);
|
||||||
|
|
Loading…
Reference in New Issue