Permalink
Browse files

video: Debug fragment shader compile error in Nexus 6p

  • Loading branch information...
fzurita committed Mar 7, 2016
1 parent 305a0f9 commit 861b86bb2cba6435919cab9124d52b4dca65e951
@@ -391,7 +391,25 @@ ShaderCombiner::ShaderCombiner(Combiner & _color, Combiner & _alpha, const gDPCo
glShaderSource(fragmentShader, 1, &strShaderData, NULL);
glCompileShader(fragmentShader);
if (!checkShaderCompileStatus(fragmentShader))
LOG(LOG_ERROR, "Error in fragment shader:\n%s\n", strFragmentShader.data());
{
int pos = 0;
int max = 900;
LOG(LOG_ERROR, "Error in fragment shader");
while(pos < strFragmentShader.length() )
{
if(strFragmentShader.length() - pos < max)
{
LOG(LOG_ERROR, "%s", strFragmentShader.substr(pos).data());
}
else
{
LOG(LOG_ERROR, "%s", strFragmentShader.substr(pos, max).data());
}
pos += max;
}
}
m_program = glCreateProgram();
_locate_attributes();
@@ -8,11 +8,18 @@ bool checkShaderCompileStatus(GLuint obj)
{
GLint status;
glGetShaderiv(obj, GL_COMPILE_STATUS, &status);
if (status == GL_FALSE) {
if (status == GL_FALSE)
{
GLchar shader_log[nShaderLogSize];
for(int index = 0; index < nShaderLogSize; ++index)
{
shader_log[index] = '0';
}
GLsizei nLogSize = nShaderLogSize;
glGetShaderInfoLog(obj, nShaderLogSize, &nLogSize, shader_log);
shader_log[nLogSize] = 0;
shader_log[nShaderLogSize-1] = 0;
LOG(LOG_ERROR, "shader_compile error: %s\n", shader_log);
return false;
}
@@ -261,4 +268,4 @@ int compileCombiner(Combiner & _color, Combiner & _alpha, char * _strShader)
else
strcat(_strShader, " color2 = color1; \n");
return nInputs;
}
}

0 comments on commit 861b86b

Please sign in to comment.