From f4ce6d6fce12bf4da4d5fdb48b23fda1a3846349 Mon Sep 17 00:00:00 2001 From: "gregory.hainaut" Date: Sun, 16 Jun 2013 16:33:08 +0000 Subject: [PATCH] gsdx: * don't delete the wnd in GSclose. It can still be used later * Properly detect the GL_ARB_gpu_shader5 extension for Fxaa * A couple of fix in Create (GSopen1) of GSWndEGL/GSWndOGL git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5674 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/GSdx/GLLoader.cpp | 11 ++++++++--- plugins/GSdx/GLLoader.h | 1 + plugins/GSdx/GS.cpp | 6 ++---- plugins/GSdx/GSDeviceOGL.cpp | 2 +- plugins/GSdx/GSRenderer.cpp | 5 +++++ plugins/GSdx/GSWndEGL.cpp | 4 +++- plugins/GSdx/GSWndOGL.cpp | 2 +- 7 files changed, 21 insertions(+), 10 deletions(-) diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index 5e191e3daf..2894a2c638 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -105,6 +105,7 @@ namespace GLLoader { bool found_GL_NV_copy_image = false; bool found_GL_ARB_copy_image = false; bool found_only_gl30 = false; + bool found_GL_ARB_gpu_shader5 = false; bool check_gl_version(uint32 major, uint32 minor) { @@ -165,19 +166,23 @@ namespace GLLoader { if (ext.compare("GL_NV_copy_image") == 0) found_GL_NV_copy_image = true; // Replace previous extensions (when driver will be updated) if (ext.compare("GL_ARB_copy_image") == 0) found_GL_ARB_copy_image = true; + if (ext.compare("GL_ARB_gpu_shader5") == 0) found_GL_ARB_gpu_shader5 = true; } } if (!found_GL_ARB_separate_shader_objects) { - fprintf(stderr, "GL_ARB_separate_shader_objects is not supported\n"); + fprintf(stderr, "INFO: GL_ARB_separate_shader_objects is not supported\n"); } if (!found_GL_ARB_shading_language_420pack) { - fprintf(stderr, "GL_ARB_shading_language_420pack is not supported\n"); + fprintf(stderr, "INFO: GL_ARB_shading_language_420pack is not supported\n"); } if (!found_GL_ARB_texture_storage) { - fprintf(stderr, "GL_ARB_texture_storage is not supported\n"); + fprintf(stderr, "FATAL: GL_ARB_texture_storage is not supported\n"); return false; } + if (!found_GL_ARB_gpu_shader5) { + fprintf(stderr, "INFO: GL_ARB_gpu_shader5 is not supported\n"); + } if (theApp.GetConfig("override_GL_ARB_shading_language_420pack", -1) != -1) { diff --git a/plugins/GSdx/GLLoader.h b/plugins/GSdx/GLLoader.h index 2db78ec60d..2c3b958e72 100644 --- a/plugins/GSdx/GLLoader.h +++ b/plugins/GSdx/GLLoader.h @@ -107,4 +107,5 @@ namespace GLLoader { extern bool found_geometry_shader; extern bool fglrx_buggy_driver; extern bool found_only_gl30; + extern bool found_GL_ARB_gpu_shader5; } diff --git a/plugins/GSdx/GS.cpp b/plugins/GSdx/GS.cpp index 65411a69c7..6a55621883 100644 --- a/plugins/GSdx/GS.cpp +++ b/plugins/GSdx/GS.cpp @@ -182,10 +182,6 @@ EXPORT_C GSclose() if (s_gs->m_wnd) { s_gs->m_wnd->Detach(); - - delete s_gs->m_wnd; - - s_gs->m_wnd = NULL; } } @@ -333,6 +329,7 @@ static int _GSopen(void** dsp, char* title, int renderer, int threads = -1) } catch (GSDXRecoverableError) { + wnd[i]->Detach(); delete wnd[i]; } } @@ -1441,6 +1438,7 @@ EXPORT_C GSReplay(char* lpszCmdLine, int renderer) void* hWnd = NULL; _GSopen((void**)&hWnd, "", renderer); + if (s_gs->m_wnd == NULL) return; uint32 crc; fread(&crc, 4, 1, fp); diff --git a/plugins/GSdx/GSDeviceOGL.cpp b/plugins/GSdx/GSDeviceOGL.cpp index b0b1b15071..2f86ea6ed6 100644 --- a/plugins/GSdx/GSDeviceOGL.cpp +++ b/plugins/GSdx/GSDeviceOGL.cpp @@ -318,7 +318,7 @@ bool GSDeviceOGL::Create(GSWnd* wnd) // FIXME need to manually set the index... // FIXME need dofxaa interface too std::string fxaa_macro = "#define FXAA_GLSL_130 1\n"; - if (!GLLoader::found_only_gl30) { + if (GLLoader::found_GL_ARB_gpu_shader5) { // This extension become core on openGL4 fxaa_macro += "#extension GL_ARB_gpu_shader5 : enable\n"; fxaa_macro += "#define FXAA_GATHER4_ALPHA 1\n"; diff --git a/plugins/GSdx/GSRenderer.cpp b/plugins/GSdx/GSRenderer.cpp index ce3e850333..8471592e4a 100644 --- a/plugins/GSdx/GSRenderer.cpp +++ b/plugins/GSdx/GSRenderer.cpp @@ -52,6 +52,11 @@ GSRenderer::~GSRenderer() }*/ delete m_dev; + + if (m_wnd) + { + delete m_wnd; + } } bool GSRenderer::CreateWnd(const string& title, int w, int h) diff --git a/plugins/GSdx/GSWndEGL.cpp b/plugins/GSdx/GSWndEGL.cpp index d4e7b6d2ec..9f3fa5fdfc 100644 --- a/plugins/GSdx/GSWndEGL.cpp +++ b/plugins/GSdx/GSWndEGL.cpp @@ -169,7 +169,9 @@ bool GSWndEGL::Create(const string& title, int w, int h) CheckContext(); - if (m_NativeWindow != 0) + PopulateGlFunction(); + + if (m_NativeWindow == 0) throw GSDXRecoverableError(); return true; diff --git a/plugins/GSdx/GSWndOGL.cpp b/plugins/GSdx/GSWndOGL.cpp index 20c7befd1e..19d124d5b1 100644 --- a/plugins/GSdx/GSWndOGL.cpp +++ b/plugins/GSdx/GSWndOGL.cpp @@ -190,7 +190,7 @@ bool GSWndOGL::Create(const string& title, int w, int h) PopulateGlFunction(); - if (m_NativeWindow != 0) + if (m_NativeWindow == 0) throw GSDXRecoverableError(); return true;