Mesa (master): i965: De-duplicate key_debug() function.

Kenneth Graunke kwg at kemper.freedesktop.org
Wed Dec 2 23:29:15 UTC 2015


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Tue Dec  1 21:09:40 2015 -0800

i965: De-duplicate key_debug() function.

This appeared in brw_vs.c and brw_wm.c, should have appeared in
brw_gs.c, and was soon going to have to be in brw_tcs.c and brw_tes.c as
well.

So, instead, move it to a central location (which has to know about both
struct brw_context and perf_debug()).

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>

---

 src/mesa/drivers/dri/i965/brw_context.h |   10 ++++++++++
 src/mesa/drivers/dri/i965/brw_vs.c      |   10 ----------
 src/mesa/drivers/dri/i965/brw_wm.c      |   11 -----------
 3 files changed, 10 insertions(+), 21 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index bfd202f..1506013 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1356,6 +1356,16 @@ void brw_validate_textures( struct brw_context *brw );
 /*======================================================================
  * brw_program.c
  */
+static inline bool
+key_debug(struct brw_context *brw, const char *name, int a, int b)
+{
+   if (a != b) {
+      perf_debug("  %s %d->%d\n", name, a, b);
+      return true;
+   }
+   return false;
+}
+
 void brwInitFragProgFuncs( struct dd_function_table *functions );
 
 /* Per-thread scratch space is a power-of-two multiple of 1KB. */
diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c
index d45347f..59b748f 100644
--- a/src/mesa/drivers/dri/i965/brw_vs.c
+++ b/src/mesa/drivers/dri/i965/brw_vs.c
@@ -220,16 +220,6 @@ brw_codegen_vs_prog(struct brw_context *brw,
    return true;
 }
 
-static bool
-key_debug(struct brw_context *brw, const char *name, int a, int b)
-{
-   if (a != b) {
-      perf_debug("  %s %d->%d\n", name, a, b);
-      return true;
-   }
-   return false;
-}
-
 void
 brw_vs_debug_recompile(struct brw_context *brw,
                        struct gl_shader_program *prog,
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 5d0fe82..39d644e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -180,17 +180,6 @@ brw_codegen_wm_prog(struct brw_context *brw,
    return true;
 }
 
-static bool
-key_debug(struct brw_context *brw, const char *name, int a, int b)
-{
-   if (a != b) {
-      perf_debug("  %s %d->%d\n", name, a, b);
-      return true;
-   } else {
-      return false;
-   }
-}
-
 bool
 brw_debug_recompile_sampler_key(struct brw_context *brw,
                                 const struct brw_sampler_prog_key_data *old_key,




More information about the mesa-commit mailing list