mirror of https://github.com/PCSX2/pcsx2.git
gsdx-ogl: drop support of GL_ARB_clear_texture extension
Extension is a bit slower. We use it to clear the RT but we generally use it right away so we don't avoid the FB attachment.
This commit is contained in:
parent
89d5e5637c
commit
03e72781aa
|
@ -105,7 +105,6 @@ PFNGLBINDIMAGETEXTUREPROC gl_BindImageTexture = NU
|
||||||
PFNGLMEMORYBARRIERPROC gl_MemoryBarrier = NULL;
|
PFNGLMEMORYBARRIERPROC gl_MemoryBarrier = NULL;
|
||||||
PFNGLTEXSTORAGE2DPROC gl_TexStorage2D = NULL;
|
PFNGLTEXSTORAGE2DPROC gl_TexStorage2D = NULL;
|
||||||
// GL4.4
|
// GL4.4
|
||||||
PFNGLCLEARTEXIMAGEPROC gl_ClearTexImage = NULL;
|
|
||||||
PFNGLBUFFERSTORAGEPROC gl_BufferStorage = NULL;
|
PFNGLBUFFERSTORAGEPROC gl_BufferStorage = NULL;
|
||||||
// GL_ARB_bindless_texture (GL5?)
|
// GL_ARB_bindless_texture (GL5?)
|
||||||
PFNGLGETTEXTURESAMPLERHANDLEARBPROC gl_GetTextureSamplerHandleARB = NULL;
|
PFNGLGETTEXTURESAMPLERHANDLEARBPROC gl_GetTextureSamplerHandleARB = NULL;
|
||||||
|
@ -157,7 +156,6 @@ namespace GLLoader {
|
||||||
// Optional
|
// Optional
|
||||||
bool found_GL_ARB_separate_shader_objects = false; // Issue with Mesa and Catalyst...
|
bool found_GL_ARB_separate_shader_objects = false; // Issue with Mesa and Catalyst...
|
||||||
bool found_geometry_shader = true; // we require GL3.3 so geometry must be supported by default
|
bool found_geometry_shader = true; // we require GL3.3 so geometry must be supported by default
|
||||||
bool found_GL_ARB_clear_texture = false; // Don't know if GL3 GPU can support it
|
|
||||||
// Note: except Apple, all drivers support explicit uniform location
|
// Note: except Apple, all drivers support explicit uniform location
|
||||||
bool found_GL_ARB_explicit_uniform_location = false; // need by subroutine and bindless texture
|
bool found_GL_ARB_explicit_uniform_location = false; // need by subroutine and bindless texture
|
||||||
// GL4 hardware
|
// GL4 hardware
|
||||||
|
@ -297,7 +295,6 @@ namespace GLLoader {
|
||||||
if (ext.compare("GL_ARB_explicit_uniform_location") == 0) found_GL_ARB_explicit_uniform_location = true;
|
if (ext.compare("GL_ARB_explicit_uniform_location") == 0) found_GL_ARB_explicit_uniform_location = true;
|
||||||
// GL4.4
|
// GL4.4
|
||||||
if (ext.compare("GL_ARB_buffer_storage") == 0) found_GL_ARB_buffer_storage = true;
|
if (ext.compare("GL_ARB_buffer_storage") == 0) found_GL_ARB_buffer_storage = true;
|
||||||
if (ext.compare("GL_ARB_clear_texture") == 0) found_GL_ARB_clear_texture = true;
|
|
||||||
// FIXME: I have a crash when I hit pause (debug build)
|
// FIXME: I have a crash when I hit pause (debug build)
|
||||||
//if (ext.compare("GL_ARB_bindless_texture") == 0) found_GL_ARB_bindless_texture = true;
|
//if (ext.compare("GL_ARB_bindless_texture") == 0) found_GL_ARB_bindless_texture = true;
|
||||||
// GL4.5
|
// GL4.5
|
||||||
|
@ -330,7 +327,6 @@ namespace GLLoader {
|
||||||
// GL4.4
|
// GL4.4
|
||||||
status &= status_and_override(found_GL_ARB_buffer_storage,"GL_ARB_buffer_storage");
|
status &= status_and_override(found_GL_ARB_buffer_storage,"GL_ARB_buffer_storage");
|
||||||
status &= status_and_override(found_GL_ARB_bindless_texture,"GL_ARB_bindless_texture");
|
status &= status_and_override(found_GL_ARB_bindless_texture,"GL_ARB_bindless_texture");
|
||||||
status &= status_and_override(found_GL_ARB_clear_texture,"GL_ARB_clear_texture");
|
|
||||||
// GL4.5
|
// GL4.5
|
||||||
status &= status_and_override(found_GL_ARB_clip_control, "GL_ARB_clip_control");
|
status &= status_and_override(found_GL_ARB_clip_control, "GL_ARB_clip_control");
|
||||||
status &= status_and_override(found_GL_ARB_direct_state_access, "GL_ARB_direct_state_access");
|
status &= status_and_override(found_GL_ARB_direct_state_access, "GL_ARB_direct_state_access");
|
||||||
|
|
|
@ -293,7 +293,6 @@ extern PFNGLTEXSTORAGE2DPROC gl_TexStorage2D;
|
||||||
// GL4.3
|
// GL4.3
|
||||||
extern PFNGLCOPYIMAGESUBDATAPROC gl_CopyImageSubData;
|
extern PFNGLCOPYIMAGESUBDATAPROC gl_CopyImageSubData;
|
||||||
// GL4.4
|
// GL4.4
|
||||||
extern PFNGLCLEARTEXIMAGEPROC gl_ClearTexImage;
|
|
||||||
extern PFNGLBUFFERSTORAGEPROC gl_BufferStorage;
|
extern PFNGLBUFFERSTORAGEPROC gl_BufferStorage;
|
||||||
// GL_ARB_bindless_texture (GL5?)
|
// GL_ARB_bindless_texture (GL5?)
|
||||||
extern PFNGLGETTEXTURESAMPLERHANDLEARBPROC gl_GetTextureSamplerHandleARB;
|
extern PFNGLGETTEXTURESAMPLERHANDLEARBPROC gl_GetTextureSamplerHandleARB;
|
||||||
|
|
|
@ -463,18 +463,6 @@ void GSDeviceOGL::DrawIndexedPrimitive(int offset, int count)
|
||||||
|
|
||||||
void GSDeviceOGL::ClearRenderTarget(GSTexture* t, const GSVector4& c)
|
void GSDeviceOGL::ClearRenderTarget(GSTexture* t, const GSVector4& c)
|
||||||
{
|
{
|
||||||
if (GLLoader::found_GL_ARB_clear_texture) {
|
|
||||||
if (static_cast<GSTextureOGL*>(t)->IsBackbuffer()) {
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
|
||||||
OMSetFBO(0);
|
|
||||||
// glDrawBuffer(GL_BACK); // this is the default when there is no FB
|
|
||||||
// 0 will select the first drawbuffer ie GL_BACK
|
|
||||||
gl_ClearBufferfv(GL_COLOR, 0, c.v);
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
|
||||||
} else {
|
|
||||||
static_cast<GSTextureOGL*>(t)->Clear((const void*)&c);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
if (static_cast<GSTextureOGL*>(t)->IsBackbuffer()) {
|
if (static_cast<GSTextureOGL*>(t)->IsBackbuffer()) {
|
||||||
OMSetFBO(0);
|
OMSetFBO(0);
|
||||||
|
@ -489,7 +477,6 @@ void GSDeviceOGL::ClearRenderTarget(GSTexture* t, const GSVector4& c)
|
||||||
gl_ClearBufferfv(GL_COLOR, 0, c.v);
|
gl_ClearBufferfv(GL_COLOR, 0, c.v);
|
||||||
}
|
}
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::ClearRenderTarget(GSTexture* t, uint32 c)
|
void GSDeviceOGL::ClearRenderTarget(GSTexture* t, uint32 c)
|
||||||
|
@ -500,9 +487,6 @@ void GSDeviceOGL::ClearRenderTarget(GSTexture* t, uint32 c)
|
||||||
|
|
||||||
void GSDeviceOGL::ClearRenderTarget_ui(GSTexture* t, uint32 c)
|
void GSDeviceOGL::ClearRenderTarget_ui(GSTexture* t, uint32 c)
|
||||||
{
|
{
|
||||||
if (GLLoader::found_GL_ARB_clear_texture) {
|
|
||||||
static_cast<GSTextureOGL*>(t)->Clear((const void*)&c);
|
|
||||||
} else {
|
|
||||||
uint32 col[4] = {c, c, c, c};
|
uint32 col[4] = {c, c, c, c};
|
||||||
|
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
|
@ -513,19 +497,10 @@ void GSDeviceOGL::ClearRenderTarget_ui(GSTexture* t, uint32 c)
|
||||||
gl_ClearBufferuiv(GL_COLOR, 0, col);
|
gl_ClearBufferuiv(GL_COLOR, 0, col);
|
||||||
|
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
|
void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
|
||||||
{
|
{
|
||||||
// TODO is it possible with GL44 ClearTexture? no the API is garbage!
|
|
||||||
// It can't be used here because it will clear both depth and stencil
|
|
||||||
if (0 && GLLoader::found_GL_ARB_clear_texture) {
|
|
||||||
#ifndef ENABLE_GLES
|
|
||||||
ASSERT(c == 0.0f);
|
|
||||||
gl_ClearTexImage(static_cast<GSTextureOGL*>(t)->GetID(), GL_TEX_LEVEL_0, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, NULL);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
OMSetFBO(m_fbo);
|
OMSetFBO(m_fbo);
|
||||||
OMAttachDs(static_cast<GSTextureOGL*>(t)->GetID());
|
OMAttachDs(static_cast<GSTextureOGL*>(t)->GetID());
|
||||||
|
|
||||||
|
@ -538,19 +513,10 @@ void GSDeviceOGL::ClearDepth(GSTexture* t, float c)
|
||||||
glDepthMask(false);
|
glDepthMask(false);
|
||||||
}
|
}
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
|
void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
|
||||||
{
|
{
|
||||||
// TODO is it possible with GL44 ClearTexture? no the API is garbage!
|
|
||||||
// It can't be used here because it will clear both depth and stencil
|
|
||||||
if (0 && GLLoader::found_GL_ARB_clear_texture) {
|
|
||||||
#ifndef ENABLE_GLES
|
|
||||||
ASSERT(c == 0);
|
|
||||||
gl_ClearTexImage(static_cast<GSTextureOGL*>(t)->GetID(), GL_TEX_LEVEL_0, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, NULL);
|
|
||||||
#endif
|
|
||||||
} else {
|
|
||||||
OMSetFBO(m_fbo);
|
OMSetFBO(m_fbo);
|
||||||
OMAttachDs(static_cast<GSTextureOGL*>(t)->GetID());
|
OMAttachDs(static_cast<GSTextureOGL*>(t)->GetID());
|
||||||
GLint color = c;
|
GLint color = c;
|
||||||
|
@ -558,7 +524,6 @@ void GSDeviceOGL::ClearStencil(GSTexture* t, uint8 c)
|
||||||
glDisable(GL_SCISSOR_TEST);
|
glDisable(GL_SCISSOR_TEST);
|
||||||
gl_ClearBufferiv(GL_STENCIL, 0, &color);
|
gl_ClearBufferiv(GL_STENCIL, 0, &color);
|
||||||
glEnable(GL_SCISSOR_TEST);
|
glEnable(GL_SCISSOR_TEST);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GLuint GSDeviceOGL::CreateSampler(PSSamplerSelector sel)
|
GLuint GSDeviceOGL::CreateSampler(PSSamplerSelector sel)
|
||||||
|
|
|
@ -275,13 +275,6 @@ GSTextureOGL::~GSTextureOGL()
|
||||||
glDeleteTextures(1, &m_texture_id);
|
glDeleteTextures(1, &m_texture_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSTextureOGL::Clear(const void *data)
|
|
||||||
{
|
|
||||||
#ifndef ENABLE_GLES
|
|
||||||
gl_ClearTexImage(m_texture_id, 0, m_int_format, m_int_type, data);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -69,8 +69,6 @@ class GSTextureOGL : public GSTexture
|
||||||
void Save(const string& fn, const void* image, uint32 pitch);
|
void Save(const string& fn, const void* image, uint32 pitch);
|
||||||
void SaveRaw(const string& fn, const void* image, uint32 pitch);
|
void SaveRaw(const string& fn, const void* image, uint32 pitch);
|
||||||
|
|
||||||
void Clear(const void *data);
|
|
||||||
|
|
||||||
void EnableUnit();
|
void EnableUnit();
|
||||||
|
|
||||||
bool IsBackbuffer() { return (m_type == GSTexture::Backbuffer); }
|
bool IsBackbuffer() { return (m_type == GSTexture::Backbuffer); }
|
||||||
|
|
|
@ -108,7 +108,6 @@ void GSWndGL::PopulateGlFunction()
|
||||||
// GL4.3
|
// GL4.3
|
||||||
*(void**)&(gl_CopyImageSubData) = GetProcAddress("glCopyImageSubData", true);
|
*(void**)&(gl_CopyImageSubData) = GetProcAddress("glCopyImageSubData", true);
|
||||||
// GL4.4
|
// GL4.4
|
||||||
*(void**)&(gl_ClearTexImage) = GetProcAddress("glClearTexImage", true);
|
|
||||||
*(void**)&(gl_BufferStorage) = GetProcAddress("glBufferStorage", true);
|
*(void**)&(gl_BufferStorage) = GetProcAddress("glBufferStorage", true);
|
||||||
// GL_ARB_bindless_texture (GL5?)
|
// GL_ARB_bindless_texture (GL5?)
|
||||||
*(void**)&(gl_GetTextureSamplerHandleARB) = GetProcAddress("glGetTextureSamplerHandleARB", true);
|
*(void**)&(gl_GetTextureSamplerHandleARB) = GetProcAddress("glGetTextureSamplerHandleARB", true);
|
||||||
|
|
Loading…
Reference in New Issue