summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp3
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/Render.cpp17
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/main.cpp14
-rw-r--r--Source/Plugins/Plugin_VideoDX9/Src/main.h1
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp9
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/Render.cpp7
-rw-r--r--Source/Plugins/Plugin_VideoOGL/Src/main.cpp16
7 files changed, 32 insertions, 35 deletions
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp
index 9e1ae5ebc9..6d926cba9d 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/FramebufferManager.cpp
@@ -208,7 +208,8 @@ void FramebufferManager::Destroy()
for (VirtualXFBListType::iterator it = m_virtualXFBList.begin(); it != m_virtualXFBList.end(); ++it)
{
- it->xfbSource.texture->Release();
+ if(it->xfbSource.texture)
+ it->xfbSource.texture->Release();
}
m_virtualXFBList.clear();
if(m_realXFBSource.texture)
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
index f6cd4e947f..9f7ed73d95 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/Render.cpp
@@ -86,7 +86,6 @@ static bool s_bScreenshot = false;
static Common::CriticalSection s_criticalScreenshot;
static char s_sScreenshotName[1024];
static LPDIRECT3DSURFACE9 ScreenShootMEMSurface = NULL;
-extern volatile u32 s_swapRequested;
// State translation lookup tables
@@ -1013,13 +1012,14 @@ void Renderer::SetBlendMode(bool forceUpdate)
void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
{
- if(!fbWidth || !fbHeight)
+ if (g_bSkipCurrentFrame || !XFBWrited || !fbWidth || !fbHeight)
+ {
+ g_VideoInitialize.pCopiedToXFB(false);
return;
+ }
// this function is called after the XFB field is changed, not after
// EFB is copied to XFB. In this way, flickering is reduced in games
- // and seems to also give more FPS in ZTP
- if(!XFBWrited)
- return;
+ // and seems to also give more FPS in ZTP
if (field == FIELD_LOWER)
xfbAddr -= fbWidth * 2;
@@ -1027,14 +1027,11 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
const XFBSource** xfbSourceList = FBManager.GetXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount);
if (!xfbSourceList || xfbCount == 0)
{
+ g_VideoInitialize.pCopiedToXFB(false);
return;
}
- if (g_bSkipCurrentFrame)
- {
- g_VideoInitialize.pCopiedToXFB(false);
- return;
- }
+
Renderer::ResetAPIState();
// Set the backbuffer as the rendering target
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
index 171bb6676a..9db267fe85 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoDX9/Src/main.cpp
@@ -359,6 +359,12 @@ void Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
if (s_PluginInitialized && g_ActiveConfig.bUseXFB)
{
// Make sure previous swap request has made it to the screen
+ s_beginFieldArgs.xfbAddr = xfbAddr;
+ s_beginFieldArgs.field = field;
+ s_beginFieldArgs.fbWidth = fbWidth;
+ s_beginFieldArgs.fbHeight = fbHeight;
+
+ Common::AtomicStoreRelease(s_swapRequested, TRUE);
if (g_VideoInitialize.bOnThread)
{
while (Common::AtomicLoadAcquire(s_swapRequested) && !s_FifoShuttingDown)
@@ -367,13 +373,7 @@ void Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
}
else
VideoFifo_CheckSwapRequest();
-
- s_beginFieldArgs.xfbAddr = xfbAddr;
- s_beginFieldArgs.field = field;
- s_beginFieldArgs.fbWidth = fbWidth;
- s_beginFieldArgs.fbHeight = fbHeight;
-
- Common::AtomicStoreRelease(s_swapRequested, TRUE);
+
}
}
diff --git a/Source/Plugins/Plugin_VideoDX9/Src/main.h b/Source/Plugins/Plugin_VideoDX9/Src/main.h
index f76403b2f4..fb3775ab7e 100644
--- a/Source/Plugins/Plugin_VideoDX9/Src/main.h
+++ b/Source/Plugins/Plugin_VideoDX9/Src/main.h
@@ -22,5 +22,6 @@
#include "Render.h"
extern SVideoInitialize g_VideoInitialize;
+extern volatile u32 s_swapRequested;
#endif
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
index 53e35c690a..1cf70b4dc9 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp
@@ -761,11 +761,12 @@ void OpenGL_Update()
int height = rcWindow.bottom - rcWindow.top;
// If we are rendering to a child window
- if (EmuWindow::GetParentWnd() != 0)
+ if (EmuWindow::GetParentWnd() != 0 && (s_backbuffer_width != width || s_backbuffer_height != height) && width >= 4 && height >= 4)
+ {
::MoveWindow(EmuWindow::GetWnd(), 0, 0, width, height, FALSE);
-
- s_backbuffer_width = width;
- s_backbuffer_height = height;
+ s_backbuffer_width = width;
+ s_backbuffer_height = height;
+ }
#elif defined(HAVE_X11) && HAVE_X11
#endif
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
index f3e23037fc..8aae9d64e4 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/Render.cpp
@@ -801,13 +801,11 @@ void Renderer::RenderToXFB(u32 xfbAddr, u32 fbWidth, u32 fbHeight, const EFBRect
// This function has the final picture. We adjust the aspect ratio here.
void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
{
- if (s_skipSwap)
+ if (g_bSkipCurrentFrame || !XFBWrited || !fbWidth || !fbHeight)
{
g_VideoInitialize.pCopiedToXFB(false);
return;
- }
- if(!XFBWrited)
- return;
+ }
if (field == FIELD_LOWER)
xfbAddr -= fbWidth * 2;
@@ -815,6 +813,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
const XFBSource** xfbSourceList = g_framebufferManager.GetXFBSource(xfbAddr, fbWidth, fbHeight, xfbCount);
if (!xfbSourceList)
{
+ g_VideoInitialize.pCopiedToXFB(false);
WARN_LOG(VIDEO, "Failed to get video for this frame");
return;
}
diff --git a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
index 947e98194e..245d146841 100644
--- a/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
+++ b/Source/Plugins/Plugin_VideoOGL/Src/main.cpp
@@ -518,7 +518,12 @@ void Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
{
if (s_PluginInitialized && g_ActiveConfig.bUseXFB)
{
- // Make sure previous swap request has made it to the screen
+ s_beginFieldArgs.xfbAddr = xfbAddr;
+ s_beginFieldArgs.field = field;
+ s_beginFieldArgs.fbWidth = fbWidth;
+ s_beginFieldArgs.fbHeight = fbHeight;
+
+ Common::AtomicStoreRelease(s_swapRequested, TRUE);
if (g_VideoInitialize.bOnThread)
{
while (Common::AtomicLoadAcquire(s_swapRequested) && !s_FifoShuttingDown)
@@ -526,14 +531,7 @@ void Video_BeginField(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight)
Common::YieldCPU();
}
else
- VideoFifo_CheckSwapRequest();
-
- s_beginFieldArgs.xfbAddr = xfbAddr;
- s_beginFieldArgs.field = field;
- s_beginFieldArgs.fbWidth = fbWidth;
- s_beginFieldArgs.fbHeight = fbHeight;
-
- Common::AtomicStoreRelease(s_swapRequested, TRUE);
+ VideoFifo_CheckSwapRequest();
}
}