Fix sp shader debug handling

This commit is contained in:
Benau 2018-04-20 16:25:12 +08:00
parent 91e1bd3fd1
commit 611def3c04

View File

@ -227,22 +227,27 @@ void SPShader::addAllUniforms(RenderPass rp)
GLenum type;
char name[100] = {};
glGetActiveUniform(m_program[rp], i, 99, NULL, &size, &type, name);
if (size != 1 && m_sp_shader_debug)
if (size != 1)
{
Log::debug("SPShader", "Array of uniforms is not supported in"
" shader %s for %s.", m_name.c_str(), name);
if (m_sp_shader_debug)
{
Log::debug("SPShader", "Array of uniforms is not supported in"
" shader %s for %s.", m_name.c_str(), name);
}
continue;
}
auto ret = supported_types.find(type);
if (ret == supported_types.end() && m_sp_shader_debug)
if (ret == supported_types.end())
{
Log::debug("SPShader", "%d type not supported", (unsigned)type);
if (m_sp_shader_debug)
Log::debug("SPShader", "%d type not supported", (unsigned)type);
continue;
}
GLuint location = glGetUniformLocation(m_program[rp], name);
if (location == GL_INVALID_INDEX && m_sp_shader_debug)
if (location == GL_INVALID_INDEX)
{
Log::debug("SPShader", "%s uniform not found", name);
if (m_sp_shader_debug)
Log::debug("SPShader", "%s uniform not found", name);
continue;
}
m_uniforms[rp][name] = new SPUniformAssigner(ret->second, location);