gsdx-ogl: add texure clear function (GL4.4)

This commit is contained in:
Gregory Hainaut 2016-05-15 13:11:21 +02:00
parent d47d9e5017
commit caacb1dc9f
5 changed files with 24 additions and 3 deletions

View File

@ -115,6 +115,7 @@ PFNGLBINDIMAGETEXTUREPROC glBindImageTexture = NUL
PFNGLMEMORYBARRIERPROC glMemoryBarrier = NULL; PFNGLMEMORYBARRIERPROC glMemoryBarrier = NULL;
// GL4.4 // GL4.4
PFNGLCLEARTEXIMAGEPROC glClearTexImage = NULL; PFNGLCLEARTEXIMAGEPROC glClearTexImage = NULL;
PFNGLCLEARTEXSUBIMAGEPROC glClearTexSubImage = NULL;
PFNGLBUFFERSTORAGEPROC glBufferStorage = NULL; PFNGLBUFFERSTORAGEPROC glBufferStorage = NULL;
// GL4.5 // GL4.5

View File

@ -290,6 +290,7 @@ extern PFNGLDEBUGMESSAGEINSERTPROC glDebugMessageInsert;
extern PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl; extern PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl;
// GL4.4 // GL4.4
extern PFNGLCLEARTEXIMAGEPROC glClearTexImage; extern PFNGLCLEARTEXIMAGEPROC glClearTexImage;
extern PFNGLCLEARTEXSUBIMAGEPROC glClearTexSubImage;
extern PFNGLBUFFERSTORAGEPROC glBufferStorage; extern PFNGLBUFFERSTORAGEPROC glBufferStorage;
// GL4.5 // GL4.5

View File

@ -223,10 +223,15 @@ GSTextureOGL::GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read)
m_int_shift = 3; m_int_shift = 3;
break; break;
// Special // Depth buffer
case 0:
case GL_DEPTH32F_STENCIL8: case GL_DEPTH32F_STENCIL8:
// Backbuffer & dss aren't important m_int_format = GL_DEPTH_STENCIL;
m_int_type = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
m_int_shift = 0;
break;
// Backbuffer
case 0:
m_int_format = 0; m_int_format = 0;
m_int_type = 0; m_int_type = 0;
m_int_shift = 0; m_int_shift = 0;
@ -281,6 +286,16 @@ GSTextureOGL::~GSTextureOGL()
_aligned_free(m_local_buffer); _aligned_free(m_local_buffer);
} }
void GSTextureOGL::Clear(const void* data)
{
glClearTexImage(m_texture_id, GL_TEX_LEVEL_0, m_int_format, m_int_type, data);
}
void GSTextureOGL::Clear(const void* data, const GSVector4i& area)
{
glClearTexSubImage(m_texture_id, area.x, area.y, 0, area.width(), area.height(), 1, GL_TEX_LEVEL_0, m_int_format, m_int_type, data);
}
bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch) bool GSTextureOGL::Update(const GSVector4i& r, const void* data, int pitch)
{ {
ASSERT(m_type != GSTexture::DepthStencil && m_type != GSTexture::Offscreen); ASSERT(m_type != GSTexture::DepthStencil && m_type != GSTexture::Offscreen);

View File

@ -77,5 +77,8 @@ class GSTextureOGL final : public GSTexture
void WasAttached() { m_clean = false; } void WasAttached() { m_clean = false; }
void WasCleaned() { m_clean = true; } void WasCleaned() { m_clean = true; }
void Clear(const void* data);
void Clear(const void* data, const GSVector4i& area);
uint32 GetMemUsage(); uint32 GetMemUsage();
}; };

View File

@ -124,6 +124,7 @@ void GSWndGL::PopulateGlFunction()
GL_EXT_LOAD(glDebugMessageCallback); GL_EXT_LOAD(glDebugMessageCallback);
// GL4.4 // GL4.4
GL_EXT_LOAD_OPT(glClearTexImage); GL_EXT_LOAD_OPT(glClearTexImage);
GL_EXT_LOAD_OPT(glClearTexSubImage);
GL_EXT_LOAD(glBufferStorage); GL_EXT_LOAD(glBufferStorage);
// GL4.5 // GL4.5