On Tue, Jun 10, 2014 at 09:57:20PM -0700, Matt Turner wrote:
> From: Kenneth Graunke <[email protected]>
>
> This allows GCC (at least with LTO) to eliminate more unused code, such
> as brw_clip* on Gen6+.
If we compile with STATIC_GEN, then the if-else ladder in brw_init_state()
turns into just the one case that matters. All other atom arrays are
unreferenced and eliminated (at least if you're not compiling with -O0), so
this patch isn't necessary.
Kristian
> ---
> 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
>
> _______________________________________________
> mesa-dev mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev