i965: Optimize VUE map comparisons.
authorKenneth Graunke <kenneth@whitecape.org>
Fri, 15 May 2015 17:08:19 +0000 (10:08 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 4 Sep 2015 05:31:04 +0000 (22:31 -0700)
The entire VUE map is computed based on the slots_valid bitfield;
calling brw_compute_vue_map on the same bitfield will return the
same result.  So we can simply compare those.

struct brw_vue_map is 136 bytes; doing a single 8-byte comparison is
much cheaper and should work just as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Chris Forbes <chrisf@ijw.co.nz>
src/mesa/drivers/dri/i965/brw_gs.c
src/mesa/drivers/dri/i965/brw_vs.c

index 04d9f3f25d988d3ec721d399b55556c27412e572..16ea68462858968e072ebdce0828351b4af3a937 100644 (file)
@@ -356,8 +356,8 @@ brw_upload_gs_prog(struct brw_context *brw)
    }
    brw->gs.base.prog_data = &brw->gs.prog_data->base.base;
 
-   if (memcmp(&brw->gs.prog_data->base.vue_map, &brw->vue_map_geom_out,
-              sizeof(brw->vue_map_geom_out)) != 0) {
+   if (brw->gs.prog_data->base.vue_map.slots_valid !=
+       brw->vue_map_geom_out.slots_valid) {
       brw->vue_map_geom_out = brw->gs.prog_data->base.vue_map;
       brw->ctx.NewDriverState |= BRW_NEW_VUE_MAP_GEOM_OUT;
    }
index 05457d4a3fe291bfa02d93e6c460fbebd9755559..4e0d34f6c6f4ff52c49ab655e918f3c8fdc7f490 100644 (file)
@@ -368,8 +368,8 @@ brw_upload_vs_prog(struct brw_context *brw)
    }
    brw->vs.base.prog_data = &brw->vs.prog_data->base.base;
 
-   if (memcmp(&brw->vs.prog_data->base.vue_map, &brw->vue_map_geom_out,
-              sizeof(brw->vue_map_geom_out)) != 0) {
+   if (brw->vs.prog_data->base.vue_map.slots_valid !=
+       brw->vue_map_geom_out.slots_valid) {
       brw->vue_map_vs = brw->vs.prog_data->base.vue_map;
       brw->ctx.NewDriverState |= BRW_NEW_VUE_MAP_VS;
       if (brw->gen < 6) {