diff --git a/plugins/GSdx/GLLoader.cpp b/plugins/GSdx/GLLoader.cpp index dd95b1ece2..ac5437897f 100644 --- a/plugins/GSdx/GLLoader.cpp +++ b/plugins/GSdx/GLLoader.cpp @@ -151,6 +151,7 @@ PFNGLCREATEPROGRAMPIPELINESPROC glCreateProgramPipelines = NUL PFNGLCLIPCONTROLPROC glClipControl = NULL; PFNGLTEXTUREBARRIERPROC glTextureBarrier = NULL; +PFNGLGETTEXTURESUBIMAGEPROC glGetTextureSubImage = NULL; namespace ReplaceGL { void APIENTRY BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeAlpha) @@ -186,6 +187,7 @@ namespace GLLoader { bool found_geometry_shader = true; // we require GL3.3 so geometry must be supported by default bool found_GL_EXT_texture_filter_anisotropic = false; bool found_GL_ARB_clear_texture = false; // Miss AMD Mesa (otherwise seems SW) + bool found_GL_ARB_get_texture_sub_image = false; // Not yet used // DX11 GPU bool found_GL_ARB_draw_buffers_blend = false; // Not supported on AMD R600 (80 nm class chip, HD2900). Nvidia requires FERMI. Intel SB bool found_GL_ARB_gpu_shader5 = false; // Require IvyBridge @@ -300,6 +302,7 @@ namespace GLLoader { if (ext.compare("GL_ARB_direct_state_access") == 0) found_GL_ARB_direct_state_access = true; if (ext.compare("GL_ARB_clip_control") == 0) found_GL_ARB_clip_control = true; if (ext.compare("GL_ARB_texture_barrier") == 0) found_GL_ARB_texture_barrier = true; + if (ext.compare("GL_ARB_get_texture_sub_image") == 0) found_GL_ARB_get_texture_sub_image = true; //fprintf(stderr, "DEBUG ext: %s\n", ext.c_str()); } @@ -329,6 +332,7 @@ namespace GLLoader { status &= status_and_override(found_GL_ARB_clip_control, "GL_ARB_clip_control", true); status &= status_and_override(found_GL_ARB_direct_state_access, "GL_ARB_direct_state_access", true); status &= status_and_override(found_GL_ARB_texture_barrier, "GL_ARB_texture_barrier", true); + status &= status_and_override(found_GL_ARB_get_texture_sub_image, "GL_ARB_get_texture_sub_image"); #ifdef _WIN32 if (status) { diff --git a/plugins/GSdx/GLLoader.h b/plugins/GSdx/GLLoader.h index f5eb9eec7a..dde71426e2 100644 --- a/plugins/GSdx/GLLoader.h +++ b/plugins/GSdx/GLLoader.h @@ -326,6 +326,7 @@ extern PFNGLCREATEPROGRAMPIPELINESPROC glCreateProgramPipelines; extern PFNGLCLIPCONTROLPROC glClipControl; extern PFNGLTEXTUREBARRIERPROC glTextureBarrier; +extern PFNGLGETTEXTURESUBIMAGEPROC glGetTextureSubImage; namespace GLLoader { bool check_gl_version(int major, int minor); diff --git a/plugins/GSdx/GSTextureOGL.cpp b/plugins/GSdx/GSTextureOGL.cpp index 341367a97d..1b287b6772 100644 --- a/plugins/GSdx/GSTextureOGL.cpp +++ b/plugins/GSdx/GSTextureOGL.cpp @@ -365,7 +365,7 @@ bool GSTextureOGL::Map(GSMap& m, const GSVector4i* _r) // Maybe it is as good as the code below. I don't know // With openGL 4.5 you can use glGetTextureSubImage - glGetTextureSubImage(m_texture_id, GL_TEX_LEVEL_0, r.x, r.y, 0, r.width(), r.height(), 0, m_int_format, m_int_type, m_size.x * m_size.y * 4, m_local_buffer); + glGetTextureSubImage(m_texture_id, GL_TEX_LEVEL_0, r.x, r.y, 0, r.width(), r.height(), 1, m_int_format, m_int_type, m_size.x * m_size.y * 4, m_local_buffer); #else // Bind the texture to the read framebuffer to avoid any disturbance diff --git a/plugins/GSdx/GSWnd.cpp b/plugins/GSdx/GSWnd.cpp index 324dbc9f73..521a0a9f08 100644 --- a/plugins/GSdx/GSWnd.cpp +++ b/plugins/GSdx/GSWnd.cpp @@ -160,4 +160,5 @@ void GSWndGL::PopulateGlFunction() GL_EXT_LOAD(glClipControl); GL_EXT_LOAD(glTextureBarrier); + GL_EXT_LOAD_OPT(glGetTextureSubImage); }