aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/GPU.cpp5
-rw-r--r--src/GPU.h1
-rw-r--r--src/GPU2D_Soft.cpp28
-rw-r--r--src/GPU3D.cpp5
-rw-r--r--src/GPU3D.h2
-rw-r--r--src/GPU3D_Soft.cpp4
-rw-r--r--src/GPU_OpenGL.cpp6
-rw-r--r--src/NDS.cpp5
8 files changed, 40 insertions, 16 deletions
diff --git a/src/GPU.cpp b/src/GPU.cpp
index e2ece10..40334de 100644
--- a/src/GPU.cpp
+++ b/src/GPU.cpp
@@ -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)
diff --git a/src/GPU.h b/src/GPU.h
index cf2fe7d..3a254df 100644
--- a/src/GPU.h
+++ b/src/GPU.h
@@ -561,6 +561,7 @@ void Reset();
void SetRenderSettings(RenderSettings& settings);
+void Stop();
void RenderFrame();
void BindOutputTexture();
diff --git a/src/GPU2D_Soft.cpp b/src/GPU2D_Soft.cpp
index f9c2768..53e7b73 100644
--- a/src/GPU2D_Soft.cpp
+++ b/src/GPU2D_Soft.cpp
@@ -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);
diff --git a/src/GPU3D.cpp b/src/GPU3D.cpp
index e199d9a..9b41830 100644
--- a/src/GPU3D.cpp
+++ b/src/GPU3D.cpp
@@ -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)
{
diff --git a/src/GPU3D.h b/src/GPU3D.h
index 62fe92c..e4629b0 100644
--- a/src/GPU3D.h
+++ b/src/GPU3D.h
@@ -117,6 +117,8 @@ void VCount144();
void VBlank();
void VCount215();
+void RestartFrame();
+
void SetRenderXPos(u16 xpos);
u32* GetLine(int line);
diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp
index 7fcafb1..3d6ace6 100644
--- a/src/GPU3D_Soft.cpp
+++ b/src/GPU3D_Soft.cpp
@@ -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);
diff --git a/src/GPU_OpenGL.cpp b/src/GPU_OpenGL.cpp
index fb04ca0..dd28bcd 100644
--- a/src/GPU_OpenGL.cpp
+++ b/src/GPU_OpenGL.cpp
@@ -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);
diff --git a/src/NDS.cpp b/src/NDS.cpp
index d0346a5..7c0ecea 100644
--- a/src/NDS.cpp
+++ b/src/NDS.cpp
@@ -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();
}
}