[Mesa-dev] [PATCH 12/20] linker: Track uniform locations to new tracking structures
Eric Anholt
eric at anholt.net
Fri Oct 28 13:52:43 PDT 2011
On Fri, 28 Oct 2011 10:42:39 -0700, "Ian Romanick" <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> This is just the infrastructure and the code. It's not used yet.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
> src/glsl/link_uniforms.cpp | 95 ++++++++++++++++++++++++++++++++++++++++++++
> src/glsl/linker.h | 3 +
> 2 files changed, 98 insertions(+), 0 deletions(-)
>
> diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
> index 54af326..a87e69f 100644
> --- a/src/glsl/link_uniforms.cpp
> +++ b/src/glsl/link_uniforms.cpp
> + /* First pass: Count the uniform resources used by the user-defined
> + * uniforms. While this happens, each active uniform will have an index
> + * assined to it.
"assigned"
> + * Note: this is *NOT* the index that is returned to the application by
> + * glGetUnfiormLocation.
"Uniform"
> + */
> + count_uniform_usage usage(prog->UniformHash);
> + for (unsigned i = 0; i < MESA_SHADER_TYPES; i++) {
> + if (prog->_LinkedShaders[i] == NULL)
> + continue;
> +
> + foreach_list(node, prog->_LinkedShaders[i]->ir) {
> + ir_variable *const var = ((ir_instruction *) node)->as_variable();
> +
> + if ((var == NULL) || (var->mode != ir_var_uniform))
> + continue;
> +
> + /* FINISHME: Update code to process built-in uniforms!
> + */
> + if (strncmp("gl_", var->name, 3) == 0)
> + continue;
> +
> + usage.process(var);
> + }
> + }
> +
> + const unsigned num_user_uniforms = usage.num_active_uniforms;
> + const unsigned num_data_slots = usage.num_values;
> +
> + /* On the outside chance that there were no uniforms, bail out.
> + */
> + if (num_user_uniforms == 0)
> + return;
No need to set NumUserUniformStorage?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20111028/c0342965/attachment.pgp>
More information about the mesa-dev
mailing list