[Piglit] [PATCH] Add functions to probe int, uint rgba buffer data
Brian Paul
brianp at vmware.com
Mon Dec 19 16:37:39 PST 2011
On 12/19/2011 02:59 PM, Anuj Phogat wrote:
> Added functions are: piglit_probe_rect_color_rgba_int() and
> piglit_probe_rect_color_rgba_uint()
>
> Signed-off-by: Anuj Phogat<anuj.phogat at gmail.com>
> ---
> Thanks for the comments Brian. Here is the updated patch.
>
> tests/spec/gl-3.0/api/clearbuffer-common.c | 29 +++++++++++++
> tests/spec/gl-3.0/api/clearbuffer-common.h | 4 ++
> tests/util/piglit-util-gl.c | 64 ++++++++++++++++++++++++++++
> tests/util/piglit-util.h | 2 +
> 4 files changed, 99 insertions(+), 0 deletions(-)
>
> diff --git a/tests/spec/gl-3.0/api/clearbuffer-common.c b/tests/spec/gl-3.0/api/clearbuffer-common.c
> index 0c1fc06..285417e 100644
> --- a/tests/spec/gl-3.0/api/clearbuffer-common.c
> +++ b/tests/spec/gl-3.0/api/clearbuffer-common.c
> @@ -173,6 +173,35 @@ simple_probe(bool color, const float *color_value,
> return pass;
> }
>
> +/* Read pixel color values from float, integer or unsigned integer color
> + * buffer types
> + */
> +bool
> +probe_rect_color(int x, int y, int w, int h, GLenum type, const GLvoid *refcolor)
> +{
> + assert( type == GL_INT || type == GL_UNSIGNED_INT || type == GL_FLOAT);
> +
> + if (type == GL_FLOAT) {
> + if (!piglit_probe_rect_rgba(x, y,
> + w, h,
> + (GLfloat*)refcolor))
> + return false;
I think you could just do:
return piglit_probe_rect_rgba(x, y, ... );
> + }
> + else if (type == GL_UNSIGNED_INT) {
> + if (!piglit_probe_rect_rgba_uint(x, y,
> + w, h,
> + (GLuint*)refcolor))
> + return false;
> + }
> + else if (type == GL_INT) {
> + if (!piglit_probe_rect_rgba_int(x, y,
> + w, h,
> + (GLint*)refcolor))
> + return false;
> + }
I think a final else clause/assert to catch unexpected types would be
good.
The rest looks OK to me.
-Brian
More information about the Piglit
mailing list