OpenGL: Fix GLES2 support, add bvec
Jeffrey Pfau jeffrey@endrift.com
Thu, 05 Nov 2015 21:01:32 -0800
2 files changed,
16 insertions(+),
36 deletions(-)
M
src/platform/opengl/gles2.c
→
src/platform/opengl/gles2.c
@@ -177,10 +177,13 @@ case GL_FLOAT:
glUniform1f(uniform->location, uniform->value.f); break; case GL_INT: - glUniform1f(uniform->location, uniform->value.i); + glUniform1i(uniform->location, uniform->value.i); break; case GL_UNSIGNED_INT: - glUniform1f(uniform->location, uniform->value.ui); + glUniform1ui(uniform->location, uniform->value.ui); + break; + case GL_BOOL: + glUniform1i(uniform->location, uniform->value.b); break; case GL_FLOAT_VEC2: glUniform2fv(uniform->location, 1, uniform->value.fvec2);@@ -200,41 +203,23 @@ break;
case GL_INT_VEC4: glUniform4iv(uniform->location, 1, uniform->value.ivec4); break; - case GL_UNSIGNED_INT_VEC2: - glUniform2uiv(uniform->location, 1, uniform->value.uivec2); + case GL_BOOL_VEC2: + glUniform2i(uniform->location, uniform->value.bvec2[0], uniform->value.bvec2[1]); break; - case GL_UNSIGNED_INT_VEC3: - glUniform3uiv(uniform->location, 1, uniform->value.uivec3); + case GL_BOOL_VEC3: + glUniform3i(uniform->location, uniform->value.bvec3[0], uniform->value.bvec3[1], uniform->value.bvec3[2]); break; - case GL_UNSIGNED_INT_VEC4: - glUniform4uiv(uniform->location, 1, uniform->value.uivec4); + case GL_BOOL_VEC4: + glUniform4i(uniform->location, uniform->value.bvec4[0], uniform->value.bvec4[1], uniform->value.bvec4[2], uniform->value.bvec4[3]); break; case GL_FLOAT_MAT2: glUniformMatrix2fv(uniform->location, 1, GL_FALSE, uniform->value.fmat2x2); break; - case GL_FLOAT_MAT2x3: - glUniformMatrix2x3fv(uniform->location, 1, GL_FALSE, uniform->value.fmat2x3); - break; - case GL_FLOAT_MAT2x4: - glUniformMatrix2x4fv(uniform->location, 1, GL_FALSE, uniform->value.fmat2x4); - break; - case GL_FLOAT_MAT3x2: - glUniformMatrix3x2fv(uniform->location, 1, GL_FALSE, uniform->value.fmat3x2); - break; case GL_FLOAT_MAT3: glUniformMatrix3fv(uniform->location, 1, GL_FALSE, uniform->value.fmat3x3); break; - case GL_FLOAT_MAT3x4: - glUniformMatrix3x4fv(uniform->location, 1, GL_FALSE, uniform->value.fmat3x4); - break; - case GL_FLOAT_MAT4x2: - glUniformMatrix2fv(uniform->location, 1, GL_FALSE, uniform->value.fmat4x2); - break; - case GL_FLOAT_MAT4x3: - glUniformMatrix2x3fv(uniform->location, 1, GL_FALSE, uniform->value.fmat4x3); - break; case GL_FLOAT_MAT4: - glUniformMatrix2x4fv(uniform->location, 1, GL_FALSE, uniform->value.fmat4x4); + glUniformMatrix4fv(uniform->location, 1, GL_FALSE, uniform->value.fmat4x4); break; } }
M
src/platform/opengl/gles2.h
→
src/platform/opengl/gles2.h
@@ -26,23 +26,18 @@ union GBAGLES2UniformValue {
GLfloat f; GLint i; GLuint ui; + GLboolean b; GLfloat fvec2[2]; GLfloat fvec3[3]; GLfloat fvec4[4]; GLint ivec2[2]; GLint ivec3[3]; GLint ivec4[4]; - GLuint uivec2[2]; - GLuint uivec3[3]; - GLuint uivec4[4]; + GLboolean bvec2[2]; + GLboolean bvec3[3]; + GLboolean bvec4[4]; GLfloat fmat2x2[4]; - GLfloat fmat2x3[6]; - GLfloat fmat2x4[8]; - GLfloat fmat3x2[6]; GLfloat fmat3x3[9]; - GLfloat fmat3x4[12]; - GLfloat fmat4x2[8]; - GLfloat fmat4x3[12]; GLfloat fmat4x4[16]; };