[Mesa-dev] [PATCH 4/7] i965: Compile out gen[467]_atoms lists based on STATIC_GEN.

Matt Turner mattst88 at gmail.com
Tue Jun 10 21:57:20 PDT 2014


From: Kenneth Graunke <kenneth at whitecape.org>

This allows GCC (at least with LTO) to eliminate more unused code, such
as brw_clip* on Gen6+.
---
 src/mesa/drivers/dri/i965/brw_state_upload.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c
index 3a452c3..2ef97f4 100644
--- a/src/mesa/drivers/dri/i965/brw_state_upload.c
+++ b/src/mesa/drivers/dri/i965/brw_state_upload.c
@@ -39,6 +39,7 @@
 
 static const struct brw_tracked_state *gen4_atoms[] =
 {
+#if defined(STATIC_GEN) && STATIC_GEN < 6
    &brw_vs_prog, /* must do before GS prog, state base address. */
    &brw_ff_gs_prog, /* must do before state base address */
 
@@ -103,10 +104,12 @@ static const struct brw_tracked_state *gen4_atoms[] =
    &brw_vertices,
 
    &brw_constant_buffer
+#endif
 };
 
 static const struct brw_tracked_state *gen6_atoms[] =
 {
+#if defined(STATIC_GEN) && STATIC_GEN == 6
    &brw_vs_prog, /* must do before state base address */
    &brw_ff_gs_prog, /* must do before state base address */
    &brw_wm_prog, /* must do before state base address */
@@ -172,10 +175,12 @@ static const struct brw_tracked_state *gen6_atoms[] =
    &brw_indices,
    &brw_index_buffer,
    &brw_vertices,
+#endif
 };
 
 static const struct brw_tracked_state *gen7_atoms[] =
 {
+#if defined(STATIC_GEN) && STATIC_GEN == 7
    &brw_vs_prog,
    &brw_gs_prog,
    &brw_wm_prog,
@@ -249,6 +254,7 @@ static const struct brw_tracked_state *gen7_atoms[] =
    &brw_vertices,
 
    &haswell_cut_index,
+#endif
 };
 
 static const struct brw_tracked_state *gen8_atoms[] =
-- 
1.8.3.2



More information about the mesa-dev mailing list