Mesa (master): linker: Remove erroneous multiply by 4 in uniform usage calculation
Ian Romanick
idr at kemper.freedesktop.org
Tue Nov 22 19:50:55 UTC 2011
Module: Mesa
Branch: master
Commit: 151867b422d07b9e5845e95c2ebc30567809edc5
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=151867b422d07b9e5845e95c2ebc30567809edc5
Author: Ian Romanick <ian.d.romanick at intel.com>
Date: Mon Nov 21 11:42:37 2011 -0800
linker: Remove erroneous multiply by 4 in uniform usage calculation
The old count_uniform_size::num_shader_uniforms was actually
calculating the number of components used. Multiplying by 4 when
setting gl_shader::num_uniform_components caused us to count 4x as
many uniform components as were actually used.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42930
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42966
Acked-by: Marek Olšák <maraeo at gmail.com>
Tested-by: Vinson Lee <vlee at vmware.com>
Tested-by: Pavel Ondračka <pavel.ondracka at email.cz>
Reviewed-and-tested-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/glsl/link_uniforms.cpp | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index ca5da30..c7de480 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -114,7 +114,7 @@ class count_uniform_size : public uniform_field_visitor {
public:
count_uniform_size(struct string_to_uint_map *map)
: num_active_uniforms(0), num_values(0), num_shader_samplers(0),
- num_shader_uniforms(0), map(map)
+ num_shader_uniform_components(0), map(map)
{
/* empty */
}
@@ -122,7 +122,7 @@ public:
void start_shader()
{
this->num_shader_samplers = 0;
- this->num_shader_uniforms = 0;
+ this->num_shader_uniform_components = 0;
}
/**
@@ -143,7 +143,7 @@ public:
/**
* Number of uniforms used in the current shader
*/
- unsigned num_shader_uniforms;
+ unsigned num_shader_uniform_components;
private:
virtual void visit_field(const glsl_type *type, const char *name)
@@ -165,7 +165,7 @@ private:
* Note that samplers do not count against this limit because they
* don't use any storage on current hardware.
*/
- this->num_shader_uniforms += values;
+ this->num_shader_uniform_components += values;
}
/* If the uniform is already in the map, there's nothing more to do.
@@ -321,7 +321,7 @@ link_assign_uniform_locations(struct gl_shader_program *prog)
prog->_LinkedShaders[i]->num_samplers = uniform_size.num_shader_samplers;
prog->_LinkedShaders[i]->num_uniform_components =
- uniform_size.num_shader_uniforms * 4;
+ uniform_size.num_shader_uniform_components;
}
const unsigned num_user_uniforms = uniform_size.num_active_uniforms;
More information about the mesa-commit
mailing list