summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/uniforms.c
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2015-03-13 08:53:23 +0200
committerTapani Pälli <tapani.palli@intel.com>2015-04-16 07:55:57 +0300
commit7c154bbe6080ced9607bc3f3240d2f0866018aeb (patch)
tree4f9f9b39d0bcd9f60defafb6525376123d181b56 /src/mesa/main/uniforms.c
parent1b256eb0ec1f919f23641f8d47d4b2ce126dd1a4 (diff)
downloadexternal_mesa3d-7c154bbe6080ced9607bc3f3240d2f0866018aeb.zip
external_mesa3d-7c154bbe6080ced9607bc3f3240d2f0866018aeb.tar.gz
external_mesa3d-7c154bbe6080ced9607bc3f3240d2f0866018aeb.tar.bz2
mesa: refactor GetUniformBlockIndex
Use _mesa_program_resource_index to get index. 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/uniforms.c')
-rw-r--r--src/mesa/main/uniforms.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mesa/main/uniforms.c b/src/mesa/main/uniforms.c
index f4de1df..5548d1d 100644
--- a/src/mesa/main/uniforms.c
+++ b/src/mesa/main/uniforms.c
@@ -938,7 +938,6 @@ _mesa_GetUniformBlockIndex(GLuint program,
const GLchar *uniformBlockName)
{
GET_CURRENT_CONTEXT(ctx);
- GLuint i;
struct gl_shader_program *shProg;
if (!ctx->Extensions.ARB_uniform_buffer_object) {
@@ -951,12 +950,13 @@ _mesa_GetUniformBlockIndex(GLuint program,
if (!shProg)
return GL_INVALID_INDEX;
- for (i = 0; i < shProg->NumUniformBlocks; i++) {
- if (!strcmp(shProg->UniformBlocks[i].Name, uniformBlockName))
- return i;
- }
+ struct gl_program_resource *res =
+ _mesa_program_resource_find_name(shProg, GL_UNIFORM_BLOCK,
+ uniformBlockName);
+ if (!res)
+ return GL_INVALID_INDEX;
- return GL_INVALID_INDEX;
+ return _mesa_program_resource_index(shProg, res);
}
void GLAPIENTRY