mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl: add texure clear function (GL4.4)
This commit is contained in:
parent
d47d9e5017
commit
caacb1dc9f
|
@ -115,6 +115,7 @@ PFNGLBINDIMAGETEXTUREPROC glBindImageTexture = NUL
|
|||
PFNGLMEMORYBARRIERPROC glMemoryBarrier = NULL;
|
||||
// GL4.4
|
||||
PFNGLCLEARTEXIMAGEPROC glClearTexImage = NULL;
|
||||
PFNGLCLEARTEXSUBIMAGEPROC glClearTexSubImage = NULL;
|
||||
PFNGLBUFFERSTORAGEPROC glBufferStorage = NULL;
|
||||
|
||||
// GL4.5
|
||||
|
|
|
@ -290,6 +290,7 @@ extern PFNGLDEBUGMESSAGEINSERTPROC glDebugMessageInsert;
|
|||
extern PFNGLDEBUGMESSAGECONTROLPROC glDebugMessageControl;
|
||||
// GL4.4
|
||||
extern PFNGLCLEARTEXIMAGEPROC glClearTexImage;
|
||||
extern PFNGLCLEARTEXSUBIMAGEPROC glClearTexSubImage;
|
||||
extern PFNGLBUFFERSTORAGEPROC glBufferStorage;
|
||||
|
||||
// GL4.5
|
||||
|
|
|
@ -223,10 +223,15 @@ GSTextureOGL::GSTextureOGL(int type, int w, int h, int format, GLuint fbo_read)
|
|||
m_int_shift = 3;
|
||||
break;
|
||||
|
||||
// Special
|
||||
case 0:
|
||||
// Depth buffer
|
||||
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_type = 0;
|
||||
m_int_shift = 0;
|
||||
|
@ -281,6 +286,16 @@ GSTextureOGL::~GSTextureOGL()
|
|||
_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)
|
||||
{
|
||||
ASSERT(m_type != GSTexture::DepthStencil && m_type != GSTexture::Offscreen);
|
||||
|
|
|
@ -77,5 +77,8 @@ class GSTextureOGL final : public GSTexture
|
|||
void WasAttached() { m_clean = false; }
|
||||
void WasCleaned() { m_clean = true; }
|
||||
|
||||
void Clear(const void* data);
|
||||
void Clear(const void* data, const GSVector4i& area);
|
||||
|
||||
uint32 GetMemUsage();
|
||||
};
|
||||
|
|
|
@ -124,6 +124,7 @@ void GSWndGL::PopulateGlFunction()
|
|||
GL_EXT_LOAD(glDebugMessageCallback);
|
||||
// GL4.4
|
||||
GL_EXT_LOAD_OPT(glClearTexImage);
|
||||
GL_EXT_LOAD_OPT(glClearTexSubImage);
|
||||
GL_EXT_LOAD(glBufferStorage);
|
||||
|
||||
// GL4.5
|
||||
|
|
Loading…
Reference in New Issue