1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +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)
{
#ifdef GL_DEBUG
GLint status;
glGetShaderiv(obj, GL_COMPILE_STATUS, &status);
if (status == GL_FALSE) {
@ -39,11 +40,13 @@ bool Utils::checkShaderCompileStatus(GLuint obj)
LOG(LOG_ERROR, "shader_compile error: %s\n", shader_log);
return false;
}
#endif
return true;
}
bool Utils::checkProgramLinkStatus(GLuint obj)
{
#ifdef GL_DEBUG
GLint status;
glGetProgramiv(obj, GL_LINK_STATUS, &status);
if (status == GL_FALSE) {
@ -53,6 +56,7 @@ bool Utils::checkProgramLinkStatus(GLuint obj)
LOG(LOG_ERROR, "shader_link error: %s\n", shader_log);
return false;
}
#endif
return true;
}

View File

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

View File

@ -92,4 +92,6 @@ void GLInfo::init() {
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 shaderStorage = false;
bool msaa = false;
bool depthTexture = false;
Renderer renderer = Renderer::Other;
void init();

View File

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