summaryrefslogtreecommitdiff
path: root/es_2_0/Uniform.c
diff options
context:
space:
mode:
Diffstat (limited to 'es_2_0/Uniform.c')
-rwxr-xr-xes_2_0/Uniform.c918
1 files changed, 918 insertions, 0 deletions
diff --git a/es_2_0/Uniform.c b/es_2_0/Uniform.c
new file mode 100755
index 0000000..d488f04
--- /dev/null
+++ b/es_2_0/Uniform.c
@@ -0,0 +1,918 @@
+/*
+ * Copyright (C) 2010 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * DongKyun Yun <dk77.yun@samsung.com>
+ * SangJin Kim <sangjin3.kim@samsung.com>
+ * HyunGoo Kang <hyungoo1.kang@samsung.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of
+ * this software and associated documentation files (the "Software"), to deal in
+ * the Software without restriction, including without limitation the rights to
+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+ * of the Software, and to permit persons to whom the Software is furnished to do
+ * so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+#include "es2front.h"
+
+/* Disable the using of glGetActiveUniform(). The previous code is to use the location
+ * returned from glGetUniformLocation() as the index to call glGetActiveUniform(). However
+ * the index may not always corresponds to the value of the location. Especially on Intel
+ * graphic driver, it caused errors. Seems that the only valid usage of glGetActiveUniform()
+ * is to iterate every index from 0 to the number of uniforms. It does not match the usage
+ * here.
+ */
+#undef ENABLE_USING_GETACTIVEUNIFORM
+
+static GLint* ES2INTER(pValue) = NULL;
+
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+GLboolean GL_APIENTRY ES2INTER(GetUniformSizeType)(const char* funcname,
+ GLint location, GLint* size, GLenum* type) {
+ GLuint program;
+ GLint nActiveUniforms;
+ GLsizei nLength;
+ GLchar strName[256];
+ FNPTR(GetIntegerv)(GL_CURRENT_PROGRAM, &program);
+ if (program == 0) {
+ SET_ERROR(GL_INVALID_OPERATION, "%s: no current program object", funcname);
+ return GL_FALSE;
+ }
+ FNPTR(GetProgramiv)(program, GL_ACTIVE_UNIFORMS, &nActiveUniforms);
+ if (location < -1 || nActiveUniforms <= location) {
+ SET_ERROR(GL_INVALID_OPERATION, "%s: location=%d is out of range[%d,%d]",
+ funcname, location, -1, nActiveUniforms);
+ return GL_FALSE;
+ }
+ if (location == -1) {
+ return GL_FALSE;
+ }
+ FNPTR(GetActiveUniform)(program, location, sizeof(strName) / sizeof(strName[0]),
+ &nLength, size, type, strName);
+ return GL_TRUE;
+}
+#endif
+
+void GL_APIENTRY ES2ENTRY(GetUniformfv)(GLuint program, GLint location, GLfloat* params) {
+ GLint iLinkStatus;
+ GLint nActiveUniforms;
+ if ((GLint)(program) <= 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ } else if (FNPTR(IsProgram)(program) == GL_FALSE) {
+ ES2INTER(SetError)(GL_INVALID_OPERATION);
+ return;
+ }
+ FNPTR(GetProgramiv)(program, GL_LINK_STATUS, &iLinkStatus);
+ if (iLinkStatus == GL_FALSE) {
+ ES2INTER(SetError)(GL_INVALID_OPERATION);
+ return;
+ }
+/*
+ FNPTR(GetProgramiv)(program, GL_ACTIVE_UNIFORMS, &nActiveUniforms);
+ if (location < 0 || nActiveUniforms <= location) {
+ ES2INTER(SetError)(GL_INVALID_OPERATION);
+ return;
+ }
+*/
+ FNPTR(GetUniformfv)(program, location, params);
+}
+
+void GL_APIENTRY ES2ENTRY(GetUniformiv)(GLuint program, GLint location, GLint* params) {
+ GLint iLinkStatus;
+ GLint nActiveUniforms;
+ if ((GLint)(program) <= 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ } else if (FNPTR(IsProgram)(program) == GL_FALSE) {
+ ES2INTER(SetError)(GL_INVALID_OPERATION);
+ return;
+ }
+ FNPTR(GetProgramiv)(program, GL_LINK_STATUS, &iLinkStatus);
+ if (iLinkStatus == GL_FALSE) {
+ ES2INTER(SetError)(GL_INVALID_OPERATION);
+ return;
+ }
+/*
+ FNPTR(GetProgramiv)(program, GL_ACTIVE_UNIFORMS, &nActiveUniforms);
+ if (location < 0 || nActiveUniforms <= location) {
+ ES2INTER(SetError)(GL_INVALID_OPERATION);
+ return;
+ }
+*/
+ FNPTR(GetUniformiv)(program, location, params);
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform1f)(GLint location, GLfloat x) {
+#define FUNC_NAME "Uniform1f"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_BOOL:
+ FNPTR(Uniform1i)(location, (x != 0.0F));
+ break;
+ case GL_FLOAT:
+ FNPTR(Uniform1f)(location, x);
+ break;
+ }
+#else
+ FNPTR(Uniform1f)(location, x);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform2f)(GLint location, GLfloat x, GLfloat y) {
+#define FUNC_NAME "Uniform2f"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)("Uniform2f", location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_BOOL_VEC2:
+ FNPTR(Uniform2i)(location, (x != 0.0F), (y != 0.0F));
+ break;
+ case GL_FLOAT_VEC2:
+ FNPTR(Uniform2f)(location, x, y);
+ break;
+ }
+#else
+ FNPTR(Uniform2f)(location, x, y);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z) {
+#define FUNC_NAME "Uniform3f"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_BOOL_VEC3:
+ FNPTR(Uniform3i)(location, (x != 0.0F), (y != 0.0F), (z != 0.0F));
+ break;
+ case GL_FLOAT_VEC3:
+ FNPTR(Uniform3f)(location, x, y, z);
+ break;
+ }
+#else
+ FNPTR(Uniform3f)(location, x, y, z);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) {
+#define FUNC_NAME "Uniform4f"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_BOOL_VEC4:
+ FNPTR(Uniform4i)(location, (x != 0.0F), (y != 0.0F), (z != 0.0F), (w != 0.0F));
+ break;
+ case GL_FLOAT_VEC4:
+ FNPTR(Uniform4f)(location, x, y, z, w);
+ break;
+ }
+#else
+ FNPTR(Uniform4f)(location, x, y, z, w);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform1fv)(GLint location, GLsizei count, const GLfloat* v) {
+#define FUNC_NAME "Uniform1fv"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ register int i;
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ if (1 < count && iSize == 1) {
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": uniform of (size=%d,type=%s) is not an array.",
+ iSize, GET_NAME(eType));
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0); case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_BOOL:
+ ES2INTER(pValue) = (GLint*)realloc(ES2INTER(pValue), count * sizeof(GLint));
+ for (i = 0; i < count; i++) {
+ ES2INTER(pValue)[i] = (v[i] == 0.0F) ? GL_FALSE : GL_TRUE;
+ }
+ FNPTR(Uniform1iv)(location, count, ES2INTER(pValue));
+ break;
+ case GL_FLOAT:
+ FNPTR(Uniform1fv)(location, count, v);
+ break;
+ }
+#else
+ FNPTR(Uniform1fv)(location, count, v);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform2fv)(GLint location, GLsizei count, const GLfloat* v) {
+#define FUNC_NAME "Uniform2fv"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ register int i;
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ if (1 < count && iSize == 1) {
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": uniform of (size=%d,type=%s) is not an array.",
+ iSize, GET_NAME(eType));
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_BOOL_VEC2:
+ ES2INTER(pValue) = (GLint*)realloc(ES2INTER(pValue), 2 * count * sizeof(GLint));
+ for (i = 0; i < 2 * count; i++) {
+ ES2INTER(pValue)[i] = (v[i] == 0.0F) ? GL_FALSE : GL_TRUE;
+ }
+ FNPTR(Uniform2iv)(location, count, ES2INTER(pValue));
+ break;
+ case GL_FLOAT_VEC2:
+ FNPTR(Uniform2fv)(location, count, v);
+ break;
+ }
+#else
+ FNPTR(Uniform2fv)(location, count, v);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform3fv)(GLint location, GLsizei count, const GLfloat* v) {
+#define FUNC_NAME "Uniform3fv"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ register int i;
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ if (1 < count && iSize == 1) {
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": uniform of (size=%d,type=%s) is not an array.",
+ iSize, GET_NAME(eType));
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_BOOL_VEC3:
+ ES2INTER(pValue) = (GLint*)realloc(ES2INTER(pValue), 3 * count * sizeof(GLint));
+ for (i = 0; i < 3 * count; i++) {
+ ES2INTER(pValue)[i] = (v[i] == 0.0F) ? GL_FALSE : GL_TRUE;
+ }
+ FNPTR(Uniform3iv)(location, count, ES2INTER(pValue));
+ break;
+ case GL_FLOAT_VEC3:
+ FNPTR(Uniform3fv)(location, count, v);
+ break;
+ }
+#else
+ FNPTR(Uniform3fv)(location, count, v);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform4fv)(GLint location, GLsizei count, const GLfloat* v) {
+#define FUNC_NAME "Uniform4fv"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ register int i;
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ if (1 < count && iSize == 1) {
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": uniform of (size=%d,type=%s) is not an array.",
+ iSize, GET_NAME(eType));
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_BOOL_VEC4:
+ ES2INTER(pValue) = (GLint*)realloc(ES2INTER(pValue), 4 * count * sizeof(GLint));
+ for (i = 0; i < 4 * count; i++) {
+ ES2INTER(pValue)[i] = (v[i] == 0.0F) ? GL_FALSE : GL_TRUE;
+ }
+ FNPTR(Uniform4iv)(location, count, ES2INTER(pValue));
+ break;
+ case GL_FLOAT_VEC4:
+ FNPTR(Uniform4fv)(location, count, v);
+ break;
+ }
+#else
+ FNPTR(Uniform4fv)(location, count, v);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform1i)(GLint location, GLint x) {
+#define FUNC_NAME "Uniform1i"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_INT:
+ case GL_BOOL:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ FNPTR(Uniform1i)(location, x);
+ break;
+ }
+#else
+ FNPTR(Uniform1i)(location, x);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform2i)(GLint location, GLint x, GLint y) {
+#define FUNC_NAME "Uniform2i"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_INT_VEC2:
+ case GL_BOOL_VEC2:
+ FNPTR(Uniform2i)(location, x, y);
+ break;
+ }
+#else
+ FNPTR(Uniform2i)(location, x, y);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform3i)(GLint location, GLint x, GLint y, GLint z) {
+#define FUNC_NAME "Uniform3i"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_INT_VEC3:
+ case GL_BOOL_VEC3:
+ FNPTR(Uniform3i)(location, x, y, z);
+ break;
+ }
+#else
+ FNPTR(Uniform3i)(location, x, y, z);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w) {
+#define FUNC_NAME "Uniform4i"
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC4:
+ FNPTR(Uniform4i)(location, x, y, z, w);
+ break;
+ }
+#else
+ FNPTR(Uniform4i)(location, x, y, z, w);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform1iv)(GLint location, GLsizei count, const GLint* v) {
+#define FUNC_NAME "Uniform1iv"
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ if (1 < count && iSize == 1) {
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": uniform of (size=%d,type=%s) is not an array.",
+ iSize, GET_NAME(eType));
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_INT:
+ case GL_BOOL:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ FNPTR(Uniform1iv)(location, count, v);
+ break;
+ }
+#else
+ FNPTR(Uniform1iv)(location, count, v);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform2iv)(GLint location, GLsizei count, const GLint* v) {
+#define FUNC_NAME "Uniform2iv"
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ if (1 < count && iSize == 1) {
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": uniform of (size=%d,type=%s) is not an array.",
+ iSize, GET_NAME(eType));
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC3:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC3:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_INT_VEC2:
+ case GL_BOOL_VEC2:
+ FNPTR(Uniform2iv)(location, count, v);
+ break;
+ }
+#else
+ FNPTR(Uniform2iv)(location, count, v);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform3iv)(GLint location, GLsizei count, const GLint* v) {
+#define FUNC_NAME "Uniform3iv"
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ if (1 < count && iSize == 1) {
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": uniform of (size=%d,type=%s) is not an array.",
+ iSize, GET_NAME(eType));
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC4:
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC4:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_INT_VEC3:
+ case GL_BOOL_VEC3:
+ FNPTR(Uniform3iv)(location, count, v);
+ break;
+ }
+#else
+ FNPTR(Uniform3iv)(location, count, v);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(Uniform4iv)(GLint location, GLsizei count, const GLint* v) {
+#define FUNC_NAME "Uniform4iv"
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+#ifdef ENABLE_USING_GETACTIVEUNIFORM
+ GLint iSize;
+ GLenum eType;
+ if (ES2INTER(GetUniformSizeType)(FUNC_NAME, location, &iSize, &eType) == GL_FALSE) {
+ return;
+ }
+ if (1 < count && iSize == 1) {
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": uniform of (size=%d,type=%s) is not an array.",
+ iSize, GET_NAME(eType));
+ return;
+ }
+ switch (eType) {
+ default:
+ assert(0);
+ case GL_FLOAT:
+ case GL_FLOAT_VEC2:
+ case GL_FLOAT_VEC3:
+ case GL_FLOAT_VEC4:
+ case GL_INT:
+ case GL_INT_VEC2:
+ case GL_INT_VEC3:
+ case GL_BOOL:
+ case GL_BOOL_VEC2:
+ case GL_BOOL_VEC3:
+ case GL_FLOAT_MAT2:
+ case GL_FLOAT_MAT3:
+ case GL_FLOAT_MAT4:
+ case GL_SAMPLER_2D:
+ case GL_SAMPLER_CUBE:
+ SET_ERROR(GL_INVALID_OPERATION, FUNCNAME ": cannot handle uniform of (size=%d,type=%s).",
+ iSize, GET_NAME(eType));
+ return;
+ case GL_INT_VEC4:
+ case GL_BOOL_VEC4:
+ FNPTR(Uniform4iv)(location, count, v);
+ break;
+ }
+#else
+ FNPTR(Uniform4iv)(location, count, v);
+#endif
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(UniformMatrix2fv)(GLint location,
+ GLsizei count, GLboolean transpose, const GLfloat* value) {
+#define FUNC_NAME "UniformMatrix2fv"
+ GLint iSize;
+ GLenum eType;
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+ if (transpose != GL_FALSE) {
+ ES2INTER(SetError)(GL_INVALID_ENUM);
+ return;
+ }
+ FNPTR(UniformMatrix2fv)(location, count, transpose, value);
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(UniformMatrix3fv)(GLint location,
+ GLsizei count, GLboolean transpose, const GLfloat* value) {
+#define FUNC_NAME "UniformMatrix3fv"
+ GLint iSize;
+ GLenum eType;
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+ if (transpose != GL_FALSE) {
+ ES2INTER(SetError)(GL_INVALID_ENUM);
+ return;
+ }
+ FNPTR(UniformMatrix3fv)(location, count, transpose, value);
+#undef FUNC_NAME
+}
+
+void GL_APIENTRY ES2ENTRY(UniformMatrix4fv)(GLint location,
+ GLsizei count, GLboolean transpose, const GLfloat* value) {
+#define FUNC_NAME "UniformMatrix4fv"
+ GLint iSize;
+ GLenum eType;
+ if ((GLint)(count) < 0) {
+ ES2INTER(SetError)(GL_INVALID_VALUE);
+ return;
+ }
+ if (transpose != GL_FALSE) {
+ ES2INTER(SetError)(GL_INVALID_ENUM);
+ return;
+ }
+ FNPTR(UniformMatrix4fv)(location, count, transpose, value);
+#undef FUNC_NAME
+}