]> git.cworth.org Git - apitrace-tests/commitdiff
Make glxsimple loop over all drawing methods multiple times
authorCarl Worth <cworth@cworth.org>
Mon, 13 Aug 2012 00:50:04 +0000 (17:50 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 1 Dec 2012 10:15:48 +0000 (10:15 +0000)
We now have 3 different drawing methods, each performed two times, and
in a total of 6 different colors. Looping over theese things twice
means that we can trim out a single frame of any one method and ensure
that "apitrace trim" has some non-trivial trimming to do both before
and after the frame of interest.

cli/src/glxsimple.c

index 0baf27f204955885569eaa8cb52ead2b83e37462..b29fa9e15bc2c995a36b0ee1b9833b553716341c 100644 (file)
@@ -147,6 +147,7 @@ paint_rgb_using_texture (double r, double g, double b)
 static void
 draw (Display *dpy, Window window, int width, int height)
 {
+       int i;
        GLenum glew_err;
 
         int visual_attr[] = {
@@ -179,17 +180,26 @@ draw (Display *dpy, Window window, int width, int height)
 
        set_2d_projection ();
 
-       /* Frame 1: Draw a solid (magenta) frame using glClear. */
-       paint_rgb_using_clear (1, 0, 1);
-        glXSwapBuffers (dpy, window);
-
-       /* Frame 2: Draw a solid (yellow) frame using GLSL. */
-       paint_rgb_using_glsl (1, 1, 0);
-        glXSwapBuffers (dpy, window);
-
-       /* Frame 3: Draw a solid (cyan) frame using a texture. */
-       paint_rgb_using_texture (0, 1, 1);
-       glXSwapBuffers (dpy, window);
+/* Simply count through some colors, frame by frame. */
+#define RGB(frame) (((frame+1)/4) % 2), (((frame+1)/2) % 2), ((frame+1) % 2)
+
+       int frame = 0;
+       for (i = 0; i < 2; i++) {
+               /* Frame: Draw a solid (magenta) frame using glClear. */
+               paint_rgb_using_clear (RGB(frame));
+               glXSwapBuffers (dpy, window);
+               frame++;
+
+               /* Frame: Draw a solid (yellow) frame using GLSL. */
+               paint_rgb_using_glsl (RGB(frame));
+               glXSwapBuffers (dpy, window);
+               frame++;
+
+               /* Frame: Draw a solid (cyan) frame using a texture. */
+               paint_rgb_using_texture (RGB(frame));
+               glXSwapBuffers (dpy, window);
+               frame++;
+       }
 
        /* Cleanup */
         glXDestroyContext (dpy, ctx);