Mesa (master): i965: Optimize VUE map comparisons.

Kenneth Graunke kwg at kemper.freedesktop.org
Fri Sep 4 05:36:29 UTC 2015


Module: Mesa
Branch: master
Commit: 0e23c246c0eb84bd46dfdfe6babe3762e49c58d2
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0e23c246c0eb84bd46dfdfe6babe3762e49c58d2

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Fri May 15 10:08:19 2015 -0700

i965: Optimize VUE map comparisons.

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 at whitecape.org>
Reviewed-by: Chris Forbes <chrisf at ijw.co.nz>

---

 src/mesa/drivers/dri/i965/brw_gs.c |    4 ++--
 src/mesa/drivers/dri/i965/brw_vs.c |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_gs.c b/src/mesa/drivers/dri/i965/brw_gs.c
index 04d9f3f..16ea684 100644
--- a/src/mesa/drivers/dri/i965/brw_gs.c
+++ b/src/mesa/drivers/dri/i965/brw_gs.c
@@ -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;
    }
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index 05457d4..4e0d34f 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -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) {




More information about the mesa-commit mailing list