aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mesa/main/uniforms.h
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mesa/main/uniforms.h')
-rw-r--r--mesalib/src/mesa/main/uniforms.h14
1 files changed, 9 insertions, 5 deletions
diff --git a/mesalib/src/mesa/main/uniforms.h b/mesalib/src/mesa/main/uniforms.h
index 5ebd5e49a..14fe26d5f 100644
--- a/mesalib/src/mesa/main/uniforms.h
+++ b/mesalib/src/mesa/main/uniforms.h
@@ -269,20 +269,24 @@ struct gl_builtin_uniform_desc {
* Combine the uniform's base location and the offset
*/
static inline GLint
-_mesa_uniform_merge_location_offset(unsigned base_location, unsigned offset)
+_mesa_uniform_merge_location_offset(const struct gl_shader_program *prog,
+ unsigned base_location, unsigned offset)
{
- return (base_location << 16) | offset;
+ assert(prog->UniformLocationBaseScale >= 0);
+ assert(offset < prog->UniformLocationBaseScale);
+ return (base_location * prog->UniformLocationBaseScale) + offset;
}
/**
* Separate the uniform base location and parameter offset
*/
static inline void
-_mesa_uniform_split_location_offset(GLint location, unsigned *base_location,
+_mesa_uniform_split_location_offset(const struct gl_shader_program *prog,
+ GLint location, unsigned *base_location,
unsigned *offset)
{
- *offset = location & 0xffff;
- *base_location = location >> 16;
+ *offset = location % prog->UniformLocationBaseScale;
+ *base_location = location / prog->UniformLocationBaseScale;
}
/*@}*/