fixes to the threadedness of the sw rasteriser
also fix #639 and fix #880
This commit is contained in:
parent
ab222ab135
commit
b78bc4cb66
|
@ -289,6 +289,11 @@ void Stop()
|
|||
memset(Framebuffer[0][1], 0, fbsize*4);
|
||||
memset(Framebuffer[1][0], 0, fbsize*4);
|
||||
memset(Framebuffer[1][1], 0, fbsize*4);
|
||||
|
||||
#ifdef OGLRENDERER_ENABLED
|
||||
if (Accelerated)
|
||||
GLCompositor::Stop();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DoSavestate(Savestate* file)
|
||||
|
|
|
@ -561,6 +561,7 @@ void Reset();
|
|||
|
||||
void SetRenderSettings(RenderSettings& settings);
|
||||
|
||||
void Stop();
|
||||
void RenderFrame();
|
||||
void BindOutputTexture();
|
||||
|
||||
|
|
|
@ -187,6 +187,20 @@ void GPU2D_Soft::DrawScanline(u32 line)
|
|||
// oddly that's not the case for GPU A
|
||||
if (Num && !Enabled) forceblank = true;
|
||||
|
||||
if (line == 0 && CaptureCnt & (1 << 31) && !forceblank)
|
||||
CaptureLatch = true;
|
||||
|
||||
if (Num == 0)
|
||||
{
|
||||
if (!Accelerated)
|
||||
_3DLine = GPU3D::GetLine(n3dline);
|
||||
else if (CaptureLatch && (((CaptureCnt >> 29) & 0x3) != 1))
|
||||
{
|
||||
_3DLine = GPU3D::GetLine(n3dline);
|
||||
//GPU3D::GLRenderer::PrepareCaptureFrame();
|
||||
}
|
||||
}
|
||||
|
||||
if (forceblank)
|
||||
{
|
||||
for (int i = 0; i < 256; i++)
|
||||
|
@ -202,20 +216,6 @@ void GPU2D_Soft::DrawScanline(u32 line)
|
|||
u32 dispmode = DispCnt >> 16;
|
||||
dispmode &= (Num ? 0x1 : 0x3);
|
||||
|
||||
if (Num == 0)
|
||||
{
|
||||
if (!Accelerated)
|
||||
_3DLine = GPU3D::GetLine(n3dline);
|
||||
else if ((CaptureCnt & (1<<31)) && (((CaptureCnt >> 29) & 0x3) != 1))
|
||||
{
|
||||
_3DLine = GPU3D::GetLine(n3dline);
|
||||
//GPU3D::GLRenderer::PrepareCaptureFrame();
|
||||
}
|
||||
}
|
||||
|
||||
if (line == 0 && CaptureCnt & (1 << 31))
|
||||
CaptureLatch = true;
|
||||
|
||||
// always render regular graphics
|
||||
DrawScanline_BGOBJ(line);
|
||||
UpdateMosaicCounters(line);
|
||||
|
|
|
@ -2500,6 +2500,11 @@ void VCount144()
|
|||
if (GPU::Renderer == 0) SoftRenderer::VCount144();
|
||||
}
|
||||
|
||||
void RestartFrame()
|
||||
{
|
||||
if (GPU::Renderer == 0) SoftRenderer::SetupRenderThread();
|
||||
}
|
||||
|
||||
|
||||
bool YSort(Polygon* a, Polygon* b)
|
||||
{
|
||||
|
|
|
@ -117,6 +117,8 @@ void VCount144();
|
|||
void VBlank();
|
||||
void VCount215();
|
||||
|
||||
void RestartFrame();
|
||||
|
||||
void SetRenderXPos(u16 xpos);
|
||||
u32* GetLine(int line);
|
||||
|
||||
|
|
|
@ -94,9 +94,13 @@ void SetupRenderThread()
|
|||
RenderThread = Platform::Thread_Create(RenderThreadFunc);
|
||||
}
|
||||
|
||||
// otherwise more than one frame can be queued up at once
|
||||
Platform::Semaphore_Reset(Sema_RenderStart);
|
||||
|
||||
if (RenderThreadRendering)
|
||||
Platform::Semaphore_Wait(Sema_RenderDone);
|
||||
|
||||
Platform::Semaphore_Reset(Sema_RenderDone);
|
||||
Platform::Semaphore_Reset(Sema_RenderStart);
|
||||
Platform::Semaphore_Reset(Sema_ScanlineCount);
|
||||
|
||||
|
|
|
@ -182,6 +182,10 @@ void SetRenderSettings(RenderSettings& settings)
|
|||
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||
}
|
||||
|
||||
void Stop()
|
||||
{
|
||||
RenderFrame();
|
||||
}
|
||||
|
||||
void RenderFrame()
|
||||
{
|
||||
|
@ -195,6 +199,8 @@ void RenderFrame()
|
|||
|
||||
glViewport(0, 0, ScreenW, ScreenH);
|
||||
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
|
||||
// TODO: select more shaders (filtering, etc)
|
||||
OpenGL::UseShaderProgram(CompShader[0]);
|
||||
glUniform1ui(CompScaleLoc[0], Scale);
|
||||
|
|
|
@ -1018,8 +1018,8 @@ u32 RunFrame()
|
|||
if (CPUStop & 0x40000000)
|
||||
{
|
||||
// checkme: when is sleep mode effective?
|
||||
//CancelEvent(Event_LCD);
|
||||
//GPU::TotalScanlines = 263;
|
||||
CancelEvent(Event_LCD);
|
||||
GPU::TotalScanlines = 263;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1163,6 +1163,7 @@ void SetLidClosed(bool closed)
|
|||
KeyInput &= ~(1<<23);
|
||||
SetIRQ(1, IRQ_LidOpen);
|
||||
CPUStop &= ~0x40000000;
|
||||
GPU3D::RestartFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue