r300/compiler: print stats based on the initial number of instructions
authorMarek Olšák <maraeo@gmail.com>
Fri, 28 Jan 2011 18:33:59 +0000 (19:33 +0100)
committerMarek Olšák <maraeo@gmail.com>
Fri, 28 Jan 2011 18:37:31 +0000 (19:37 +0100)
The same number of shaders is now printed regardless of optimizations being
enabled or not, so that we can compare shader stats side by side easily.

src/mesa/drivers/dri/r300/compiler/radeon_compiler.c
src/mesa/drivers/dri/r300/compiler/radeon_compiler.h

index 6554860..33b6a10 100644 (file)
@@ -402,11 +402,11 @@ static void print_stats(struct radeon_compiler * c)
 {
        struct rc_program_stats s;
 
 {
        struct rc_program_stats s;
 
-       rc_get_stats(c, &s);
-
-       if (s.num_insts < 4)
+       if (c->initial_num_insts <= 5)
                return;
 
                return;
 
+       rc_get_stats(c, &s);
+
        switch (c->type) {
        case RC_VERTEX_PROGRAM:
                fprintf(stderr,"~~~~~~~~~ VERTEX PROGRAM ~~~~~~~~\n"
        switch (c->type) {
        case RC_VERTEX_PROGRAM:
                fprintf(stderr,"~~~~~~~~~ VERTEX PROGRAM ~~~~~~~~\n"
@@ -461,6 +461,11 @@ void rc_run_compiler_passes(struct radeon_compiler *c, struct radeon_compiler_pa
 /* Executes a list of compiler passes given in the parameter 'list'. */
 void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list)
 {
 /* Executes a list of compiler passes given in the parameter 'list'. */
 void rc_run_compiler(struct radeon_compiler *c, struct radeon_compiler_pass *list)
 {
+       struct rc_program_stats s;
+
+       rc_get_stats(c, &s);
+       c->initial_num_insts = s.num_insts;
+
        if (c->Debug & RC_DBG_LOG) {
                fprintf(stderr, "%s: before compilation\n", shader_name[c->type]);
                rc_print_program(&c->Program);
        if (c->Debug & RC_DBG_LOG) {
                fprintf(stderr, "%s: before compilation\n", shader_name[c->type]);
                rc_print_program(&c->Program);
index 1e64af0..2d8e415 100644 (file)
@@ -72,6 +72,8 @@ struct radeon_compiler {
        /*@}*/
 
        struct emulate_loop_state loop_state;
        /*@}*/
 
        struct emulate_loop_state loop_state;
+
+       unsigned initial_num_insts; /* Number of instructions at start. */
 };
 
 void rc_init(struct radeon_compiler * c);
 };
 
 void rc_init(struct radeon_compiler * c);