added parameter -copytest-loop
authorEleni Maria Stea <estea@igalia.com>
Wed, 17 Oct 2018 15:30:12 +0000 (18:30 +0300)
committerEleni Maria Stea <estea@igalia.com>
Sun, 11 Nov 2018 07:44:08 +0000 (09:44 +0200)
this is to run the copytest but with multiple drawings (it calls
glutPostRedisplay). I use it to check the CopyImageSubData on Intel gen < 8

main.c

diff --git a/main.c b/main.c
index 0ab34fe..dc9ca52 100644 (file)
--- a/main.c
+++ b/main.c
@@ -20,6 +20,7 @@ int texcomp(unsigned char *compix, unsigned int tofmt, unsigned char *pixels,
 void disp(void);
 void reshape(int x, int y);
 void keyb(unsigned char key, int x, int y);
+void idle();
 void gen_image(unsigned char *pixels, int xsz, int ysz);
 unsigned char *load_compressed_image(const char *fname, int *cszptr, int *xszptr, int *yszptr);
 int dump_compressed_image(const char *fname, unsigned char *data, int size, int w, int h);
@@ -27,7 +28,7 @@ void print_compressed_formats(void);
 
 unsigned int tex, tex2, comp_tex;
 const char *texfile;
-int subtest, copytest;
+int subtest, copytest, loop;
 
 int main(int argc, char **argv)
 {
@@ -43,6 +44,9 @@ int main(int argc, char **argv)
                                subtest = 1;
                        } else if(strcmp(argv[i], "-copytest") == 0) {
                                copytest = 1;
+                       } else if(strcmp(argv[i], "-copytest-loop") == 0) {
+                               copytest = 1;
+                               loop = 1;
                        } else {
                                fprintf(stderr, "invalid option: %s\n", argv[i]);
                                return 1;
@@ -65,6 +69,9 @@ int main(int argc, char **argv)
        glutReshapeFunc(reshape);
        glutKeyboardFunc(keyb);
 
+       if (loop)
+               glutIdleFunc(idle);
+
        glewInit();
 
        if(init() == -1) {
@@ -232,6 +239,11 @@ void keyb(unsigned char key, int x, int y)
        }
 }
 
+void idle()
+{
+       glutPostRedisplay();
+}
+
 void gen_image(unsigned char *pixels, int xsz, int ysz)
 {
        int i, j;