mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
Fix state saving and loading in linux. Apparently that is why the OpenGL_MakeCurent was in the video plugin DoState.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5265 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
a744391aac
commit
f6c8fd691a
@ -184,6 +184,8 @@ void CreateXWindow (void)
|
|||||||
wmProtocols[2] = XInternAtom(GLWin.dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
wmProtocols[2] = XInternAtom(GLWin.dpy, "_NET_WM_STATE_FULLSCREEN", False);
|
||||||
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 3);
|
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 3);
|
||||||
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
||||||
|
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||||
|
StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask );
|
||||||
XMapRaised(GLWin.dpy, GLWin.win);
|
XMapRaised(GLWin.dpy, GLWin.win);
|
||||||
XSync(GLWin.dpy, True);
|
XSync(GLWin.dpy, True);
|
||||||
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
#if defined(HAVE_GTK2) && HAVE_GTK2 && defined(wxGTK)
|
||||||
@ -674,24 +676,15 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenGL_MakeCurrent()
|
bool OpenGL_Initialize()
|
||||||
{
|
{
|
||||||
#if defined(USE_WX) && USE_WX
|
bool success = OpenGL_MakeCurrent();
|
||||||
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
if (!success)
|
||||||
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
{
|
||||||
cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
|
PanicAlert("Can't Activate The GL Rendering Context.");
|
||||||
#elif defined(_WIN32)
|
|
||||||
if (!wglMakeCurrent(hDC,hRC)) {
|
|
||||||
PanicAlert("(5) Can't Activate The GL Rendering Context.");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
Window winDummy;
|
|
||||||
unsigned int borderDummy;
|
|
||||||
// connect the glx-context to the window
|
|
||||||
glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
|
||||||
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
|
|
||||||
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
|
||||||
NOTICE_LOG(VIDEO, "GLWin Depth %d", GLWin.depth)
|
NOTICE_LOG(VIDEO, "GLWin Depth %d", GLWin.depth)
|
||||||
if (glXIsDirect(GLWin.dpy, GLWin.ctx)) {
|
if (glXIsDirect(GLWin.dpy, GLWin.ctx)) {
|
||||||
NOTICE_LOG(VIDEO, "detected direct rendering");
|
NOTICE_LOG(VIDEO, "detected direct rendering");
|
||||||
@ -715,15 +708,26 @@ bool OpenGL_MakeCurrent()
|
|||||||
// Hide the cursor now
|
// Hide the cursor now
|
||||||
if (g_Config.bHideCursor)
|
if (g_Config.bHideCursor)
|
||||||
XDefineCursor (GLWin.dpy, GLWin.win, GLWin.blankCursor);
|
XDefineCursor (GLWin.dpy, GLWin.win, GLWin.blankCursor);
|
||||||
|
#endif
|
||||||
|
return success;
|
||||||
|
|
||||||
// better for pad plugin key input (thc)
|
}
|
||||||
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
|
||||||
StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask );
|
bool OpenGL_MakeCurrent()
|
||||||
|
{
|
||||||
|
// connect the glx-context to the window
|
||||||
|
#if defined(USE_WX) && USE_WX
|
||||||
|
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
||||||
|
#elif defined(HAVE_COCOA) && HAVE_COCOA
|
||||||
|
cocoaGLMakeCurrent(GLWin.cocoaCtx,GLWin.cocoaWin);
|
||||||
|
#elif defined(_WIN32)
|
||||||
|
return wglMakeCurrent(hDC,hRC)
|
||||||
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
|
return glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Update window width, size and etc. Called from Render.cpp
|
// Update window width, size and etc. Called from Render.cpp
|
||||||
void OpenGL_Update()
|
void OpenGL_Update()
|
||||||
{
|
{
|
||||||
|
@ -135,6 +135,7 @@ extern GLWindow GLWin;
|
|||||||
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _width, int _height);
|
||||||
void OpenGL_Shutdown();
|
void OpenGL_Shutdown();
|
||||||
void OpenGL_Update();
|
void OpenGL_Update();
|
||||||
|
bool OpenGL_Initialize();
|
||||||
bool OpenGL_MakeCurrent();
|
bool OpenGL_MakeCurrent();
|
||||||
void OpenGL_SwapBuffers();
|
void OpenGL_SwapBuffers();
|
||||||
|
|
||||||
|
@ -355,6 +355,9 @@ void Initialize(void *init)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void DoState(unsigned char **ptr, int mode) {
|
void DoState(unsigned char **ptr, int mode) {
|
||||||
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
|
OpenGL_MakeCurrent();
|
||||||
|
#endif
|
||||||
// Clear all caches that touch RAM
|
// Clear all caches that touch RAM
|
||||||
TextureMngr::Invalidate(false);
|
TextureMngr::Invalidate(false);
|
||||||
VertexLoaderManager::MarkAllDirty();
|
VertexLoaderManager::MarkAllDirty();
|
||||||
@ -378,7 +381,7 @@ void EmuStateChange(PLUGIN_EMUSTATE newState)
|
|||||||
// This is called after Video_Initialize() from the Core
|
// This is called after Video_Initialize() from the Core
|
||||||
void Video_Prepare(void)
|
void Video_Prepare(void)
|
||||||
{
|
{
|
||||||
OpenGL_MakeCurrent();
|
OpenGL_Initialize();
|
||||||
if (!Renderer::Init()) {
|
if (!Renderer::Init()) {
|
||||||
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
g_VideoInitialize.pLog("Renderer::Create failed\n", TRUE);
|
||||||
PanicAlert("Can't create opengl renderer. You might be missing some required opengl extensions, check the logs for more info");
|
PanicAlert("Can't create opengl renderer. You might be missing some required opengl extensions, check the logs for more info");
|
||||||
|
Loading…
Reference in New Issue
Block a user