[Piglit] [PATCH] arb_shader_objects: Test glGetUniformLocation on an array of struct of array

Eric Anholt eric at anholt.net
Wed Sep 7 12:46:21 PDT 2011


On Wed,  7 Sep 2011 11:53:24 -0700, "Ian Romanick" <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
> 
> Currently Mesa fails to get the location of array elements embedded in
> a structure.

How does it do on other drivers?

> +	snprintf(name, sizeof(name), "s", i);

Looks like the "i" argument shouldn't be there.

> +	loc = piglit_GetUniformLocation(prog, name);
> +	printf("%s location = %d (should be -1)\n", name, loc);
> +
> +	pass = (loc == -1);
> +
> +	for (i = 0; i < 10; i++) {
> +		/* From page 80 of the OpenGL 2.1 spec:
> +		 *
> +		 *     "A valid name cannot be a structure, an array of
> +		 *     structures, or any portion of a single vector or a
> +		 *     matrix."
> +		 */
> +		snprintf(name, sizeof(name), "s[%d]", i);
> +		loc = piglit_GetUniformLocation(prog, name);
> +		printf("%s location = %d (should be -1)\n", name, loc);
> +
> +		pass = (loc == -1) && pass;
> +
> +
> +		snprintf(name, sizeof(name), "s[%d].m", i);
> +		loc = piglit_GetUniformLocation(prog, name);
> +		printf("%s location = %d (should not be -1)\n", name, loc);
> +
> +		pass = (loc != -1) && pass;
> +
> +		for (j = 0; j < 10; j++) {
> +			snprintf(name, sizeof(name), "s[%d].v[%d]", i, j);
> +			loc = piglit_GetUniformLocation(prog, name);
> +			printf("%s location = %d (should not be -1)\n",
> +			       name, loc);

Looks like a lot of spam in the success case.

> +
> +			pass = (loc != -1) && pass;
> +		}
> +	}
> +
> +	piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
> +}
-------------- 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/piglit/attachments/20110907/0bc8d7c8/attachment.pgp>


More information about the Piglit mailing list