gsdx ogl:

* fix shader compilation on Nvidia (broken on r5682)
* fix various memory leak thanks to Valgrind

Cmake: fix a minor typo


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5688 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gregory.hainaut 2013-06-30 11:18:46 +00:00
parent 58cacc3b1c
commit d81254469a
6 changed files with 25 additions and 5 deletions

View File

@ -122,6 +122,15 @@ GSDeviceOGL::~GSDeviceOGL()
delete m_date.dss;
delete m_date.bs;
// Clean shadeboost
delete m_shadeboost.cb;
if (GLLoader::found_GL_ARB_separate_shader_objects) {
gl_DeleteProgram(m_shadeboost.ps);
} else {
gl_DeleteShader(m_shadeboost.ps);
}
// Clean various opengl allocation
if (GLLoader::found_GL_ARB_separate_shader_objects)
gl_DeleteProgramPipelines(1, &m_pipeline);
@ -134,6 +143,7 @@ GSDeviceOGL::~GSDeviceOGL()
gl_DeleteSamplers(1, &m_palette_ss);
delete m_vb;
if (GLLoader::found_GL_ARB_separate_shader_objects) {
for (uint32 key = 0; key < VSSelector::size(); key++) gl_DeleteProgram(m_vs[key]);
for (uint32 key = 0; key < GSSelector::size(); key++) gl_DeleteProgram(m_gs[key]);
@ -146,11 +156,13 @@ GSDeviceOGL::~GSDeviceOGL()
for (auto it = m_single_prog.begin(); it != m_single_prog.end() ; it++) gl_DeleteProgram(it->second);
m_single_prog.clear();
}
m_ps.clear();
gl_DeleteSamplers(PSSamplerSelector::size(), m_ps_ss);
for (uint32 key = 0; key < OMDepthStencilSelector::size(); key++) delete m_om_dss[key];
m_ps.clear();
for (auto it = m_om_bs.begin(); it != m_om_bs.end(); it++) delete it->second;
m_om_bs.clear();
}
@ -1417,6 +1429,8 @@ void GSDeviceOGL::CheckDebugLog()
pos += lengths[i];
}
}
delete[] messageLog;
}
void GSDeviceOGL::DebugOutputToFile(unsigned int source, unsigned int type, unsigned int id, unsigned int severity, const char* message)

View File

@ -136,6 +136,10 @@ void GSWndEGL::Detach()
// Actually the destructor is not called when there is only a GSclose/GSshutdown
// The window still need to be closed
DetachContext();
eglDestroyContext(m_eglDisplay, m_eglContext);
m_eglContext = NULL;
eglDestroySurface(m_eglDisplay, m_eglSurface);
m_eglSurface = NULL;
CloseEGLDisplay();
if (m_NativeDisplay) {

View File

@ -63,6 +63,8 @@ void GSWndOGL::CreateContext(int major, int minor)
if (!fbc || fbcount < 1) {
throw GSDXRecoverableError();
}
XFree(fbc);
GLXFBConfig fbc_cp = fbc[0];
PFNGLXCREATECONTEXTATTRIBSARBPROC glX_CreateContextAttribsARB = (PFNGLXCREATECONTEXTATTRIBSARBPROC)glXGetProcAddress((const GLubyte*) "glXCreateContextAttribsARB");
if (!glX_CreateContextAttribsARB) {
@ -86,7 +88,7 @@ void GSWndOGL::CreateContext(int major, int minor)
None
};
m_context = glX_CreateContextAttribsARB(m_NativeDisplay, fbc[0], 0, true, context_attribs);
m_context = glX_CreateContextAttribsARB(m_NativeDisplay, fbc_cp, 0, true, context_attribs);
// Don't forget to reinstall the older Handler
XSetErrorHandler(oldHandler);

View File

@ -100,7 +100,7 @@ layout(std140, binding = 20) uniform cb20
vec2 TextureScale;
};
const float exp_min32 = exp2(-32);
const float exp_min32 = exp2(-32.0f);
void vs_main()
{

View File

@ -128,7 +128,7 @@ static const char* tfx_glsl =
" vec2 TextureScale;\n"
"};\n"
"\n"
"const float exp_min32 = exp2(-32);\n"
"const float exp_min32 = exp2(-32.0f);\n"
"\n"
"void vs_main()\n"
"{\n"

View File

@ -110,7 +110,7 @@ add_library(${Output} SHARED
# link target with project internal libraries
target_link_libraries(${Output} Utilities Utilities)
target_link_libraries(${Output} Utilities)
# link target with ALSA
target_link_libraries(${Output} ${ALSA_LIBRARIES})