GPU:
- If a GPU engine is disabled or has master brightness at full intensity, fill the output framebuffer on line 191 instead of on line 0. - Replace global variable Render3DFramesPerSecond with accessor method GPUSubsystem::GetFPSRender3D().
This commit is contained in:
parent
c5cae26246
commit
44b227d0b8
|
@ -48,7 +48,6 @@
|
|||
#include "matrix.h"
|
||||
#include "emufile.h"
|
||||
|
||||
u32 Render3DFramesPerSecond;
|
||||
|
||||
//instantiate static instance
|
||||
u16 GPUEngineBase::_brightnessUpTable555[17][0x8000];
|
||||
|
@ -6760,6 +6759,8 @@ GPUSubsystem::GPUSubsystem()
|
|||
_displayTouch = new NDSDisplay(NDSDisplayID_Touch);
|
||||
_displayTouch->SetEngine(_engineSub);
|
||||
|
||||
_videoFrameCount = 0;
|
||||
_render3DFrameCount = 0;
|
||||
_frameNeedsFinish = false;
|
||||
_willAutoResolveToCustomBuffer = true;
|
||||
|
||||
|
@ -6853,6 +6854,9 @@ void GPUSubsystem::Reset()
|
|||
this->SetCustomFramebufferSize(this->_displayInfo.customWidth, this->_displayInfo.customHeight);
|
||||
}
|
||||
|
||||
this->_videoFrameCount = 0;
|
||||
this->_render3DFrameCount = 0;
|
||||
|
||||
this->ClearWithColor(0xFFFF);
|
||||
|
||||
this->_displayInfo.didPerformCustomRender[NDSDisplayID_Main] = false;
|
||||
|
@ -6990,6 +6994,11 @@ const NDSDisplayInfo& GPUSubsystem::GetDisplayInfo()
|
|||
return this->_displayInfo;
|
||||
}
|
||||
|
||||
u32 GPUSubsystem::GetFPSRender3D() const
|
||||
{
|
||||
return this->_render3DFrameCount;
|
||||
}
|
||||
|
||||
void GPUSubsystem::SetDisplayDidCustomRender(NDSDisplayID displayID, bool theState)
|
||||
{
|
||||
this->_displayInfo.didPerformCustomRender[displayID] = theState;
|
||||
|
@ -7325,30 +7334,6 @@ void GPUSubsystem::RenderLine(const u16 l, bool isFrameSkipRequested)
|
|||
if (!isFrameSkipRequested)
|
||||
{
|
||||
this->UpdateRenderProperties();
|
||||
|
||||
if (!isFramebufferRenderNeeded[GPUEngineID_Main])
|
||||
{
|
||||
if (!CommonSettings.showGpu.main)
|
||||
{
|
||||
memset(this->_engineMain->renderedBuffer, 0, this->_engineMain->renderedWidth * this->_engineMain->renderedHeight * this->_displayInfo.pixelBytes);
|
||||
}
|
||||
else if (this->_engineMain->GetIsMasterBrightFullIntensity())
|
||||
{
|
||||
this->_engineMain->ApplyMasterBrightness<OUTPUTFORMAT, true>();
|
||||
}
|
||||
}
|
||||
|
||||
if (!isFramebufferRenderNeeded[GPUEngineID_Sub])
|
||||
{
|
||||
if (!CommonSettings.showGpu.sub)
|
||||
{
|
||||
memset(this->_engineSub->renderedBuffer, 0, this->_engineSub->renderedWidth * this->_engineSub->renderedHeight * this->_displayInfo.pixelBytes);
|
||||
}
|
||||
else if (this->_engineSub->GetIsMasterBrightFullIntensity())
|
||||
{
|
||||
this->_engineSub->ApplyMasterBrightness<OUTPUTFORMAT, true>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7399,6 +7384,14 @@ void GPUSubsystem::RenderLine(const u16 l, bool isFrameSkipRequested)
|
|||
this->_engineMain->FramebufferPostprocess();
|
||||
this->_engineSub->FramebufferPostprocess();
|
||||
|
||||
this->_videoFrameCount++;
|
||||
if (this->_videoFrameCount == 60)
|
||||
{
|
||||
this->_render3DFrameCount = gfx3d.render3DFrameCount;
|
||||
gfx3d.render3DFrameCount = 0;
|
||||
this->_videoFrameCount = 0;
|
||||
}
|
||||
|
||||
if (!isFrameSkipRequested)
|
||||
{
|
||||
if (this->_displayInfo.isCustomSizeRequested)
|
||||
|
@ -7421,11 +7414,33 @@ void GPUSubsystem::RenderLine(const u16 l, bool isFrameSkipRequested)
|
|||
{
|
||||
this->_engineMain->ApplyMasterBrightness<OUTPUTFORMAT, false>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CommonSettings.showGpu.main)
|
||||
{
|
||||
memset(this->_engineMain->renderedBuffer, 0, this->_engineMain->renderedWidth * this->_engineMain->renderedHeight * this->_displayInfo.pixelBytes);
|
||||
}
|
||||
else if (this->_engineMain->GetIsMasterBrightFullIntensity())
|
||||
{
|
||||
this->_engineMain->ApplyMasterBrightness<OUTPUTFORMAT, true>();
|
||||
}
|
||||
}
|
||||
|
||||
if (isFramebufferRenderNeeded[GPUEngineID_Sub])
|
||||
{
|
||||
this->_engineSub->ApplyMasterBrightness<OUTPUTFORMAT, false>();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!CommonSettings.showGpu.sub)
|
||||
{
|
||||
memset(this->_engineSub->renderedBuffer, 0, this->_engineSub->renderedWidth * this->_engineSub->renderedHeight * this->_displayInfo.pixelBytes);
|
||||
}
|
||||
else if (this->_engineSub->GetIsMasterBrightFullIntensity())
|
||||
{
|
||||
this->_engineSub->ApplyMasterBrightness<OUTPUTFORMAT, true>();
|
||||
}
|
||||
}
|
||||
|
||||
if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev)
|
||||
{
|
||||
|
@ -7440,14 +7455,6 @@ void GPUSubsystem::RenderLine(const u16 l, bool isFrameSkipRequested)
|
|||
}
|
||||
}
|
||||
|
||||
gfx3d._videoFrameCount++;
|
||||
if (gfx3d._videoFrameCount == 60)
|
||||
{
|
||||
Render3DFramesPerSecond = gfx3d.render3DFrameCount;
|
||||
gfx3d.render3DFrameCount = 0;
|
||||
gfx3d._videoFrameCount = 0;
|
||||
}
|
||||
|
||||
if (this->_frameNeedsFinish)
|
||||
{
|
||||
this->_frameNeedsFinish = false;
|
||||
|
|
|
@ -1608,6 +1608,8 @@ private:
|
|||
NDSDisplay *_displayMain;
|
||||
NDSDisplay *_displayTouch;
|
||||
|
||||
u32 _videoFrameCount; // Internal variable that increments when a video frame is completed. Resets every 60 video frames.
|
||||
u32 _render3DFrameCount; // The current 3D rendering frame count, saved to this variable once every 60 video frames.
|
||||
bool _frameNeedsFinish;
|
||||
bool _willAutoResolveToCustomBuffer;
|
||||
u16 *_customVRAM;
|
||||
|
@ -1632,6 +1634,8 @@ public:
|
|||
void ForceFrameStop();
|
||||
|
||||
const NDSDisplayInfo& GetDisplayInfo(); // Frontends need to call this whenever they need to read the video buffers from the emulator core
|
||||
u32 GetFPSRender3D() const;
|
||||
|
||||
void SetDisplayDidCustomRender(NDSDisplayID displayID, bool theState);
|
||||
|
||||
GPUEngineA* GetEngineMain();
|
||||
|
|
|
@ -869,7 +869,7 @@
|
|||
[super handleEmuFrameProcessed];
|
||||
|
||||
NDSFrameInfo frameInfo;
|
||||
frameInfo.render3DFPS = Render3DFramesPerSecond;
|
||||
frameInfo.render3DFPS = GPU->GetFPSRender3D();
|
||||
frameInfo.frameIndex = currFrameCounter;
|
||||
frameInfo.lagFrameCount = TotalLagFrames;
|
||||
|
||||
|
|
|
@ -504,9 +504,7 @@ void gfx3d_init()
|
|||
gfx3d.state.fogDensityTable = MMU.ARM9_REG+0x0360;
|
||||
gfx3d.state.edgeMarkColorTable = (u16 *)(MMU.ARM9_REG+0x0330);
|
||||
|
||||
gfx3d._videoFrameCount = 0;
|
||||
gfx3d.render3DFrameCount = 0;
|
||||
Render3DFramesPerSecond = 0;
|
||||
|
||||
makeTables();
|
||||
Render3D_Init();
|
||||
|
@ -607,9 +605,7 @@ void gfx3d_reset()
|
|||
GFX_PIPEclear();
|
||||
GFX_FIFOclear();
|
||||
|
||||
gfx3d._videoFrameCount = 0;
|
||||
gfx3d.render3DFrameCount = 0;
|
||||
Render3DFramesPerSecond = 0;
|
||||
|
||||
CurrentRenderer->Reset();
|
||||
}
|
||||
|
|
|
@ -667,7 +667,6 @@ struct GFX3D
|
|||
GFX3D()
|
||||
: polylist(0)
|
||||
, vertlist(0)
|
||||
, _videoFrameCount(0)
|
||||
, render3DFrameCount(0) {
|
||||
}
|
||||
|
||||
|
@ -681,11 +680,9 @@ struct GFX3D
|
|||
VERTLIST* vertlist;
|
||||
INDEXLIST indexlist;
|
||||
|
||||
u32 _videoFrameCount; // Internal variable that increments when a video frame is completed. Resets every 60 video frames.
|
||||
u32 render3DFrameCount; // Increments when gfx3d_doFlush() is called. Resets every 60 video frames.
|
||||
};
|
||||
extern GFX3D gfx3d;
|
||||
extern u32 Render3DFramesPerSecond; // save the current 3D rendering frame count to here every 60 video frames
|
||||
|
||||
//---------------------
|
||||
|
||||
|
|
|
@ -2413,7 +2413,7 @@ gboolean EmuLoop(gpointer data)
|
|||
|
||||
// HUD display things (copied from Windows main.cpp)
|
||||
#ifdef HAVE_LIBAGG
|
||||
Hud.fps3d = Render3DFramesPerSecond;
|
||||
Hud.fps3d = GPU->GetFPSRender3D();
|
||||
|
||||
if(nds.idleFrameCounter==0 || oneSecond)
|
||||
{
|
||||
|
@ -2446,7 +2446,7 @@ gboolean EmuLoop(gpointer data)
|
|||
for (i = 0; i < Frameskip; i++) {
|
||||
NDS_SkipNextFrame();
|
||||
#ifdef HAVE_LIBAGG
|
||||
Hud.fps3d = Render3DFramesPerSecond;
|
||||
Hud.fps3d = GPU->GetFPSRender3D();
|
||||
#endif
|
||||
desmume_cycle();
|
||||
skipped_frames++;
|
||||
|
@ -2459,7 +2459,7 @@ gboolean EmuLoop(gpointer data)
|
|||
for (i = 0; i < Frameskip; i++) {
|
||||
NDS_SkipNextFrame();
|
||||
#ifdef HAVE_LIBAGG
|
||||
Hud.fps3d = Render3DFramesPerSecond;
|
||||
Hud.fps3d = GPU->GetFPSRender3D();
|
||||
#endif
|
||||
desmume_cycle();
|
||||
skipped_frames++;
|
||||
|
@ -2481,7 +2481,7 @@ gboolean EmuLoop(gpointer data)
|
|||
// Aggressively skip frames to avoid delay
|
||||
NDS_SkipNextFrame();
|
||||
#ifdef HAVE_LIBAGG
|
||||
Hud.fps3d = Render3DFramesPerSecond;
|
||||
Hud.fps3d = GPU->GetFPSRender3D();
|
||||
#endif
|
||||
desmume_cycle();
|
||||
skipped_frames++;
|
||||
|
|
|
@ -2185,7 +2185,7 @@ static void StepRunLoop_User()
|
|||
const int kFramesPerToolUpdate = 1;
|
||||
|
||||
Hud.fps = mainLoopData.fps;
|
||||
Hud.fps3d = Render3DFramesPerSecond;
|
||||
Hud.fps3d = GPU->GetFPSRender3D();
|
||||
|
||||
Display();
|
||||
|
||||
|
|
Loading…
Reference in New Issue