[Mesa-dev] [PATCH 1/2] glsl: move max_index calc to assign_attribute_or_color_locations
Ilia Mirkin
imirkin at alum.mit.edu
Sun Jul 5 17:17:41 PDT 2015
On Fri, Jul 3, 2015 at 4:54 AM, Tapani Pälli <tapani.palli at intel.com> wrote:
> Change function to get all gl_constants for inspection, this is used
> by follow-up patch.
>
> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
> ---
> src/glsl/linker.cpp | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
> index 71a45e8..aae0c0d 100644
> --- a/src/glsl/linker.cpp
> +++ b/src/glsl/linker.cpp
> @@ -1953,9 +1953,17 @@ find_available_slots(unsigned used_mask, unsigned needed_count)
> */
> bool
> assign_attribute_or_color_locations(gl_shader_program *prog,
> - unsigned target_index,
> - unsigned max_index)
> + struct gl_constants *constants,
> + unsigned target_index)
> {
> + /* FINISHME: The value of the max_attribute_index parameter is
> + * FINISHME: implementation dependent based on the value of
> + * FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be
> + * FINISHME: at least 16, so hardcode 16 for now.
> + */
> + unsigned max_index = (target_index == MESA_SHADER_VERTEX) ? 16 :
> + MAX2(constants->MaxDrawBuffers, constants->MaxDualSourceDrawBuffers);
Shouldn't that just be constants->Program[MESA_SHADER_VERTEX].MaxAttribs ?
> +
> /* Mark invalid locations as being used.
> */
> unsigned used_locations = (max_index >= 32)
> @@ -3061,11 +3069,11 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog)
> * FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be
> * FINISHME: at least 16, so hardcode 16 for now.
> */
> - if (!assign_attribute_or_color_locations(prog, MESA_SHADER_VERTEX, 16)) {
> + if (!assign_attribute_or_color_locations(prog, &ctx->Const, MESA_SHADER_VERTEX)) {
> goto done;
> }
>
> - if (!assign_attribute_or_color_locations(prog, MESA_SHADER_FRAGMENT, MAX2(ctx->Const.MaxDrawBuffers, ctx->Const.MaxDualSourceDrawBuffers))) {
> + if (!assign_attribute_or_color_locations(prog, &ctx->Const, MESA_SHADER_FRAGMENT)) {
> goto done;
> }
>
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list