mirror of https://github.com/PCSX2/pcsx2.git
gsdx ogl: add GL_ARB_get_texture_sub_image extension support
could help to read back a portion of a texture
This commit is contained in:
parent
e02753df46
commit
fa921215d9
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -160,4 +160,5 @@ void GSWndGL::PopulateGlFunction()
|
|||
|
||||
GL_EXT_LOAD(glClipControl);
|
||||
GL_EXT_LOAD(glTextureBarrier);
|
||||
GL_EXT_LOAD_OPT(glGetTextureSubImage);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue