[Piglit] [PATCH] Porting basic GL rendering paths test to piglit

Brian Paul brianp at vmware.com
Fri Aug 28 07:40:24 PDT 2015


On 08/28/2015 02:43 AM, Juliet Fru wrote:
> Hello Brian,
>
>
>     The subject line should probably be something like "port Glean paths
>     test to piglit".
>
>
> I will add the subject line to the next patch.
>
>
>         +       SCISSOR,
>         +       STENCIL,
>         +       STIPPLE,
>         +       TEXTURE,
>         +       ZZZ  /* end-of-list token */
>         +};
>         +
>
>         +
>         +enum piglit_result
>         +piglit_display(void)
>         +{
>         +       bool pass = true;
>         +       enum path p, paths[10];
>         +       int i, num_paths = 0;
>         +
>         +       /* draw 10x10 pixel quads */
>         +       glViewport(0, 0, 10, 10);
>         +
>         +       glDisable(GL_DITHER);
>         +
>         +       /* Build the list of paths to exercise */
>         +       for (p = ALPHA; p != ZZZ; p = (enum path) (p + 1)) {
>         +               paths[num_paths++] = p;
>         +       }
>         +
>         +       /* test always-pass paths */
>         +       for (i = 0; i < num_paths; i++) {
>         +               glClear(GL_COLOR_BUFFER_BIT);
>         +
>         +               set_path_state(paths[i], ALWAYS_PASS);
>         +
>         +               /* draw polygon */
>         +               piglit_draw_rect(-1,-1,1,1);
>
>
>     I think you want width=2, height=2 to fill the viewport.  Also, we
>     usually put a space after commas.
>
>
> Could you please give me the sample piglit_draw_rect() call here.

piglit_draw_rect(-1, -1, 2, 2);



>         +
>         +               set_path_state(paths[i], DISABLE);
>         +
>         +               /* test buffer */
>         +               GLfloat pixel[3];
>         +                glReadPixels(4, 4, 1, 1, GL_RGB, GL_FLOAT, pixel);
>         +                if (pixel[0] != 1.0 || pixel[1] != 1.0 ||
>         pixel[2] != 1.0) {
>
>
>     You could use piglit_probe_rect_rgb() here.
>
>
> I was a bit confused with the piglit_probe_rect_rgb() use here. It seems
> like I have to create an array to place the expected values to be probed
> when I pass the argument arguments for the piglit_draw_rect(). I will
> appreciate a simple float array I could pass as the last argument for
> piglit_probe_rect_rgb.

At the top of the function declare:

static const float white[3] = {1.0, 1.0, 1.0};

Then,

if (!piglit_probe_pixel_rgb(4, 4, white)) {

The original code only read one pixel (I misread it as 4x4 pixels 
earlier) so piglit_probe_pixel_rgb() is the appropriate replacement.



>
>
>     Looks like you still have some space indentation, rather than tabs.
>
> I initially used piglit_probe_rect_rgb, but was a bit confused. So I
> reverted to the original, it might have introduced the whitespaces.
> Thanks,
> Juliet

You could probably run your code through 'indent' to clean it up. 
Though, I don't know the proper indent arguments off-hand.

-Brian



More information about the Piglit mailing list