[Piglit] [PATCH] arb_shader_objects: Test some edge cases of glGetAttachedObjectARB

Ian Romanick idr at freedesktop.org
Fri Jan 22 12:01:34 PST 2016


On 01/22/2016 11:56 AM, Ian Romanick wrote:
> +static bool
> +verify_glGetAttachedShaders(GLenum target)
> +{
> +	GLuint prog;
> +	GLuint shader;
> +	const GLchar *const source = (target == GL_VERTEX_SHADER)
> +		? vertex_shader_text : fragment_shader_text;
> +	static const GLuint expected_handles[8] = {
> +		0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF,
> +		0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF, 0xDEADBEEF
> +	};
> +	GLuint handles[ARRAY_SIZE(expected_handles)];
> +	GLsizei count = 0xBADC0DE;
> +	bool pass = true;
> +
> +	printf("Testing glGetAttachedShaders...\n");
> +
> +	prog = glCreateProgram();
> +	if (prog == 0) {
> +		printf("    Could not create program object.\n");
> +		return false;
> +	}
> +
> +	shader = glCreateShaderObjectARB(target);
> +	if (shader == 0) {
> +		printf("    Could not create shader object.\n");
> +		return false;
> +	}
> +
> +	glShaderSource(shader, 1, &source, NULL);
> +	glCompileShader(shader);
> +	glAttachShader(prog, shader);
> +
> +	/*  The GL_ARB_shader_objects says:
> +	 *
> +	 *     "If an error occurred, the return parameters <count> and <obj>
> +	 *     will be unmodified."
> +	 *
> +	 * The GL_ARB_shader_objects spec makes no mention of maxCount==0
> +	 * being an error.  It's also somewhat unclear whether or not it
> +	 * should set *count to zero.
> +	 */

I'll update all the references in this function to refer to the OpenGL
2.0 spec before pushing.



More information about the Piglit mailing list