On Fri,  4 Nov 2011 16:41:00 -0700, "Ian Romanick" <i...@freedesktop.org> wrote:
> From: Ian Romanick <ian.d.roman...@intel.com>
> 
> Fixes piglit's getfragdatalocation test.
> 
> Signed-off-by: Ian Romanick <ian.d.roman...@intel.com>

I think patch 2/4 and 3/4 should be squashed -- if
you're looking at an issue in either one, you would want to be reading
the two of them together.

Other than that, 1 little comment below and then

Reviewed-by: Eric Anholt <e...@anholt.net>

> ---
>  src/mesa/main/shader_query.cpp |   56 
> ++++++++++++++++++++++++++++++++++++++++
>  src/mesa/main/shaderapi.c      |   20 --------------
>  2 files changed, 56 insertions(+), 20 deletions(-)
> 
> diff --git a/src/mesa/main/shader_query.cpp b/src/mesa/main/shader_query.cpp
> index 23667a1..644916c 100644
> --- a/src/mesa/main/shader_query.cpp
> +++ b/src/mesa/main/shader_query.cpp
> @@ -274,3 +274,59 @@ _mesa_BindFragDataLocation(GLuint program, GLuint 
> colorNumber,
>      * glLinkProgram is called again.
>      */
>  }
> +
> +GLint GLAPIENTRY
> +_mesa_GetFragDataLocation(GLuint program, const GLchar *name)
> +{

[...]

> +   exec_list *ir = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT]->ir;
> +   foreach_list(node, ir) {
> +      const ir_variable *const var = ((ir_instruction *) 
> node)->as_variable();
> +
> +      /* The extra check against VERT_ATTRIB_GENERIC0 is because
> +       * glGetFragDataLocation cannot be used on "conventional" attributes.

FRAG_RESULT_DATA0?

> +       *
> +       * From page 95 of the OpenGL 3.0 spec:
> +       *
> +       *     "If name is not an active attribute, if name is a conventional
> +       *     attribute, or if an error occurs, -1 will be returned."
> +       */
> +      if (var == NULL
> +       || var->mode != ir_var_out
> +       || var->location == -1
> +       || var->location < FRAG_RESULT_DATA0)
> +      continue;
> +
> +      if (strcmp(var->name, name) == 0)
> +      return var->location - FRAG_RESULT_DATA0;
> +   }

Attachment: pgpsOmkZeRwck.pgp
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to