summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/uniform_query.cpp
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2015-03-12 12:55:18 +0200
committerTapani Pälli <tapani.palli@intel.com>2015-04-16 07:55:57 +0300
commit17dc939f756cfed23574ad84764f5e2a5a9b6751 (patch)
treef533269e7fa867988fc8a28779de2c9497e7104e /src/mesa/main/uniform_query.cpp
parentdc39d843d21898752ce5d79804ff9f638595d3a9 (diff)
downloadexternal_mesa3d-17dc939f756cfed23574ad84764f5e2a5a9b6751.zip
external_mesa3d-17dc939f756cfed23574ad84764f5e2a5a9b6751.tar.gz
external_mesa3d-17dc939f756cfed23574ad84764f5e2a5a9b6751.tar.bz2
mesa: refactor GetActiveUniform
Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Reviewed-by: Martin Peres <martin.peres@linux.intel.com>
Diffstat (limited to 'src/mesa/main/uniform_query.cpp')
-rw-r--r--src/mesa/main/uniform_query.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp
index 9611667..4e77b32 100644
--- a/src/mesa/main/uniform_query.cpp
+++ b/src/mesa/main/uniform_query.cpp
@@ -46,6 +46,7 @@ _mesa_GetActiveUniform(GLuint program, GLuint index,
{
GET_CURRENT_CONTEXT(ctx);
struct gl_shader_program *shProg;
+ struct gl_program_resource *res;
if (maxLength < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(maxLength < 0)");
@@ -56,27 +57,25 @@ _mesa_GetActiveUniform(GLuint program, GLuint index,
if (!shProg)
return;
- if (index >= shProg->NumUserUniformStorage) {
+ res = _mesa_program_resource_find_index((struct gl_shader_program *) shProg,
+ GL_UNIFORM, index);
+
+ if (!res) {
_mesa_error(ctx, GL_INVALID_VALUE, "glGetActiveUniform(index)");
return;
}
- const struct gl_uniform_storage *const uni = &shProg->UniformStorage[index];
-
- if (nameOut) {
- _mesa_get_uniform_name(uni, maxLength, length, nameOut);
- }
-
- if (size) {
- /* array_elements is zero for non-arrays, but the API requires that 1 be
- * returned.
- */
- *size = MAX2(1, uni->array_elements);
- }
-
- if (type) {
- *type = uni->type->gl_type;
- }
+ if (nameOut)
+ _mesa_get_program_resource_name(shProg, GL_UNIFORM, index, maxLength,
+ length, nameOut, "glGetActiveUniform");
+ if (type)
+ _mesa_program_resource_prop((struct gl_shader_program *) shProg,
+ res, index, GL_TYPE, (GLint*) type,
+ "glGetActiveUniform");
+ if (size)
+ _mesa_program_resource_prop((struct gl_shader_program *) shProg,
+ res, index, GL_ARRAY_SIZE, (GLint*) size,
+ "glGetActiveUniform");
}
static GLenum