From 56b1be4399d76c0fe5ddf099a7ac5b45ab58e8cf Mon Sep 17 00:00:00 2001 From: Tapani Pälli Date: Thu, 6 Mar 2014 11:00:17 +0200 Subject: mesa/glsl: introduce a remap table for uniform locations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch adds a remap table for uniforms that is used to provide a mapping from application specified uniform location to actual location in the UniformStorage. Existing UniformLocationBaseScale usage is removed as table can be used to set sequential values for array uniform elements. This mapping helps to implement GL_ARB_explicit_uniform_location so that uniforms locations can be reorganized and handled in a more easy manner. v2: small fixes + rename parameters for merge and split functions (Ian) improve documentation, remove old check for location bounds (Eric) Signed-off-by: Tapani Pälli Reviewed-by: Ian Romanick Reviewed-by: Eric Anholt --- src/mesa/main/uniform_query.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/mesa/main/uniform_query.cpp') diff --git a/src/mesa/main/uniform_query.cpp b/src/mesa/main/uniform_query.cpp index 8cc5da752ac..20ffbe8494c 100644 --- a/src/mesa/main/uniform_query.cpp +++ b/src/mesa/main/uniform_query.cpp @@ -246,14 +246,15 @@ validate_uniform_parameters(struct gl_context *ctx, return false; } - _mesa_uniform_split_location_offset(shProg, location, loc, array_index); - - if (*loc >= shProg->NumUserUniformStorage) { + /* Check that the given location is in bounds of uniform remap table. */ + if (location >= (GLint) shProg->NumUniformRemapTable) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(location=%d)", caller, location); return false; } + _mesa_uniform_split_location_offset(shProg, location, loc, array_index); + if (shProg->UniformStorage[*loc].array_elements == 0 && count > 1) { _mesa_error(ctx, GL_INVALID_OPERATION, "%s(count > 1 for non-array, location=%d)", -- cgit v1.2.3