[Mesa-dev] [PATCH 4/4] mesa: Implement glGetFragDataLocation
Eric Anholt
eric at anholt.net
Mon Nov 7 17:23:48 PST 2011
On Fri, 4 Nov 2011 16:41:00 -0700, "Ian Romanick" <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Fixes piglit's getfragdatalocation test.
>
> Signed-off-by: Ian Romanick <ian.d.romanick at 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 <eric at 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;
> + }
-------------- 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/20111107/700c978d/attachment.pgp>
More information about the mesa-dev
mailing list