1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-07 03:13:49 +00:00

Reduce some debug GL calls in production

Also only check extension support at init()
This commit is contained in:
Logan McNaughton 2018-02-26 21:01:45 -07:00 committed by Sergey Lipskiy
parent cb90bb95ed
commit d467327349
5 changed files with 14 additions and 4 deletions

View File

@ -29,6 +29,7 @@ static const GLsizei nShaderLogSize = 1024;
bool Utils::checkShaderCompileStatus(GLuint obj) bool Utils::checkShaderCompileStatus(GLuint obj)
{ {
#ifdef GL_DEBUG
GLint status; GLint status;
glGetShaderiv(obj, GL_COMPILE_STATUS, &status); glGetShaderiv(obj, GL_COMPILE_STATUS, &status);
if (status == GL_FALSE) { if (status == GL_FALSE) {
@ -39,11 +40,13 @@ bool Utils::checkShaderCompileStatus(GLuint obj)
LOG(LOG_ERROR, "shader_compile error: %s\n", shader_log); LOG(LOG_ERROR, "shader_compile error: %s\n", shader_log);
return false; return false;
} }
#endif
return true; return true;
} }
bool Utils::checkProgramLinkStatus(GLuint obj) bool Utils::checkProgramLinkStatus(GLuint obj)
{ {
#ifdef GL_DEBUG
GLint status; GLint status;
glGetProgramiv(obj, GL_LINK_STATUS, &status); glGetProgramiv(obj, GL_LINK_STATUS, &status);
if (status == GL_FALSE) { if (status == GL_FALSE) {
@ -53,6 +56,7 @@ bool Utils::checkProgramLinkStatus(GLuint obj)
LOG(LOG_ERROR, "shader_link error: %s\n", shader_log); LOG(LOG_ERROR, "shader_link error: %s\n", shader_log);
return false; return false;
} }
#endif
return true; return true;
} }

View File

@ -431,10 +431,7 @@ bool ContextImpl::isSupported(graphics::SpecialFeatures _feature) const
case graphics::SpecialFeatures::ShaderProgramBinary: case graphics::SpecialFeatures::ShaderProgramBinary:
return m_glInfo.shaderStorage; return m_glInfo.shaderStorage;
case graphics::SpecialFeatures::DepthFramebufferTextures: case graphics::SpecialFeatures::DepthFramebufferTextures:
if (!m_glInfo.isGLES2 || Utils::isExtensionSupported(m_glInfo, "GL_OES_depth_texture")) return m_glInfo.depthTexture;
return true;
else
return false;
} }
return false; return false;
} }

View File

@ -92,4 +92,6 @@ void GLInfo::init() {
LOG(LOG_WARNING, "LOD emulation not possible on this device\n"); LOG(LOG_WARNING, "LOD emulation not possible on this device\n");
} }
} }
depthTexture = !isGLES2 || Utils::isExtensionSupported(*this, "GL_OES_depth_texture");
} }

View File

@ -23,6 +23,7 @@ struct GLInfo {
bool texStorage = false; bool texStorage = false;
bool shaderStorage = false; bool shaderStorage = false;
bool msaa = false; bool msaa = false;
bool depthTexture = false;
Renderer renderer = Renderer::Other; Renderer renderer = Renderer::Other;
void init(); void init();

View File

@ -82,6 +82,7 @@ const char* GLErrorString(GLenum errorCode)
bool Utils::isGLError() bool Utils::isGLError()
{ {
#ifdef GL_DEBUG
GLenum errCode; GLenum errCode;
const char* errString; const char* errString;
@ -95,11 +96,13 @@ bool Utils::isGLError()
return true; return true;
} }
#endif
return false; return false;
} }
bool Utils::isFramebufferError() bool Utils::isFramebufferError()
{ {
#ifdef GL_DEBUG
GLenum e = glCheckFramebufferStatus(GL_FRAMEBUFFER); GLenum e = glCheckFramebufferStatus(GL_FRAMEBUFFER);
switch (e) { switch (e) {
// case GL_FRAMEBUFFER_UNDEFINED: // case GL_FRAMEBUFFER_UNDEFINED:
@ -131,4 +134,7 @@ bool Utils::isFramebufferError()
} }
return e != GL_FRAMEBUFFER_COMPLETE; return e != GL_FRAMEBUFFER_COMPLETE;
#else
return false;
#endif
} }