Refactor getUniform for matrix types to use a single shared internal method.

TRAC #22845 Signed-off-by: Geoff Lang Signed-off-by: Shanon Woods Author: Jamie Madill git-svn-id: https://angleproject.googlecode.com/svn/branches/es3proto@2146 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 02e11f3a
......@@ -590,18 +590,13 @@ bool ProgramBinary::getUniformfv(GLint location, GLsizei *bufSize, GLfloat *para
}
}
switch (targetUniform->type)
if (IsMatrixType(targetUniform->type))
{
case GL_FLOAT_MAT2:
transposeMatrix<GLfloat>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8, 2, 2, 4, 2);
break;
case GL_FLOAT_MAT3:
transposeMatrix<GLfloat>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12, 3, 3, 4, 3);
break;
case GL_FLOAT_MAT4:
transposeMatrix<GLfloat>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 16, 4, 4, 4, 4);
break;
default:
const int rows = VariableRowCount(targetUniform->type);
const int cols = VariableColumnCount(targetUniform->type);
transposeMatrix(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4 * rows, cols, rows, 4, rows);
}
else
{
unsigned int size = UniformComponentCount(targetUniform->type);
......@@ -634,7 +629,6 @@ bool ProgramBinary::getUniformfv(GLint location, GLsizei *bufSize, GLfloat *para
default: UNREACHABLE();
}
}
}
return true;
}
......@@ -658,18 +652,13 @@ bool ProgramBinary::getUniformiv(GLint location, GLsizei *bufSize, GLint *params
}
}
switch (targetUniform->type)
if (IsMatrixType(targetUniform->type))
{
case GL_FLOAT_MAT2:
transposeMatrix<GLint>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 8, 2, 2, 4, 2);
break;
case GL_FLOAT_MAT3:
transposeMatrix<GLint>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 12, 3, 3, 4, 3);
break;
case GL_FLOAT_MAT4:
transposeMatrix<GLint>(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 16, 4, 4, 4, 4);
break;
default:
const int rows = VariableRowCount(targetUniform->type);
const int cols = VariableColumnCount(targetUniform->type);
transposeMatrix(params, (GLfloat*)targetUniform->data + mUniformIndex[location].element * 4 * rows, cols, rows, 4, rows);
}
else
{
unsigned int size = VariableColumnCount(targetUniform->type);
......@@ -702,7 +691,6 @@ bool ProgramBinary::getUniformiv(GLint location, GLsizei *bufSize, GLint *params
default: UNREACHABLE();
}
}
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment