Add a utility method to determine if a gl enum type is a matrix type, and some supporting methods.

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@2145 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent e6ca6709
...@@ -176,10 +176,16 @@ int VariableRowCount(GLenum type) ...@@ -176,10 +176,16 @@ int VariableRowCount(GLenum type)
case GL_SAMPLER_CUBE: case GL_SAMPLER_CUBE:
return 1; return 1;
case GL_FLOAT_MAT2: case GL_FLOAT_MAT2:
case GL_FLOAT_MAT3x2:
case GL_FLOAT_MAT4x2:
return 2; return 2;
case GL_FLOAT_MAT3: case GL_FLOAT_MAT3:
case GL_FLOAT_MAT2x3:
case GL_FLOAT_MAT4x3:
return 3; return 3;
case GL_FLOAT_MAT4: case GL_FLOAT_MAT4:
case GL_FLOAT_MAT2x4:
case GL_FLOAT_MAT3x4:
return 4; return 4;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -204,16 +210,22 @@ int VariableColumnCount(GLenum type) ...@@ -204,16 +210,22 @@ int VariableColumnCount(GLenum type)
case GL_FLOAT_VEC2: case GL_FLOAT_VEC2:
case GL_INT_VEC2: case GL_INT_VEC2:
case GL_FLOAT_MAT2: case GL_FLOAT_MAT2:
case GL_FLOAT_MAT2x3:
case GL_FLOAT_MAT2x4:
return 2; return 2;
case GL_INT_VEC3: case GL_INT_VEC3:
case GL_FLOAT_VEC3: case GL_FLOAT_VEC3:
case GL_BOOL_VEC3: case GL_BOOL_VEC3:
case GL_FLOAT_MAT3: case GL_FLOAT_MAT3:
case GL_FLOAT_MAT3x2:
case GL_FLOAT_MAT3x4:
return 3; return 3;
case GL_BOOL_VEC4: case GL_BOOL_VEC4:
case GL_FLOAT_VEC4: case GL_FLOAT_VEC4:
case GL_INT_VEC4: case GL_INT_VEC4:
case GL_FLOAT_MAT4: case GL_FLOAT_MAT4:
case GL_FLOAT_MAT4x2:
case GL_FLOAT_MAT4x3:
return 4; return 4;
default: default:
UNREACHABLE(); UNREACHABLE();
...@@ -222,6 +234,11 @@ int VariableColumnCount(GLenum type) ...@@ -222,6 +234,11 @@ int VariableColumnCount(GLenum type)
return 0; return 0;
} }
bool IsMatrixType(GLenum type)
{
return VariableRowCount(type) > 1;
}
int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize) int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize)
{ {
ASSERT(allocationSize <= bitsSize); ASSERT(allocationSize <= bitsSize);
......
...@@ -29,6 +29,7 @@ size_t UniformExternalSize(GLenum type); ...@@ -29,6 +29,7 @@ size_t UniformExternalSize(GLenum type);
GLenum UniformBoolVectorType(GLenum type); GLenum UniformBoolVectorType(GLenum type);
int VariableRowCount(GLenum type); int VariableRowCount(GLenum type);
int VariableColumnCount(GLenum type); int VariableColumnCount(GLenum type);
bool IsMatrixType(GLenum type);
int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize); int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
......
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