i965: Stop storing sdc_offset in brw_stage_state.
authorKenneth Graunke <kenneth@whitecape.org>
Sat, 26 Jul 2014 09:34:02 +0000 (02:34 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Sat, 2 Aug 2014 12:14:42 +0000 (05:14 -0700)
sdc_offset is produced and consumed in the same function, so there's no
need to store it in the context, nor pass pointers to it through various
call chains.

Saves 128 bytes per brw_stage_state structure, and makes the code
clearer as well.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen@intel.com>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_sampler_state.c
src/mesa/drivers/dri/i965/gen7_sampler_state.c

index 2943a204e062a2c400515325b1b426a448bf6de0..f730cffe463247445d62d3b49519b88b367490d8 100644 (file)
@@ -890,9 +890,6 @@ struct brw_stage_state
    /** SAMPLER_STATE count and table offset */
    uint32_t sampler_count;
    uint32_t sampler_offset;
-
-   /** Offsets in the batch to sampler default colors (texture border color) */
-   uint32_t sdc_offset[BRW_MAX_TEX_UNIT];
 };
 
 
index 6343ceb7d228c959b5524bb568868643f96f35cd..89336728adccd9afd78b45b3e0f03a791d9e3a87 100644 (file)
@@ -211,8 +211,7 @@ static void brw_update_sampler_state(struct brw_context *brw,
                                     int unit,
                                      int ss_index,
                                      struct brw_sampler_state *sampler,
-                                     uint32_t sampler_state_table_offset,
-                                     uint32_t *sdc_offset)
+                                     uint32_t sampler_state_table_offset)
 {
    struct gl_context *ctx = &brw->ctx;
    struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -347,20 +346,21 @@ static void brw_update_sampler_state(struct brw_context *brw,
       sampler->ss3.non_normalized_coord = 1;
    }
 
-   upload_default_color(brw, gl_sampler, unit, sdc_offset);
+   uint32_t sdc_offset;
+   upload_default_color(brw, gl_sampler, unit, &sdc_offset);
 
    if (brw->gen >= 6) {
-      sampler->ss2.default_color_pointer = *sdc_offset >> 5;
+      sampler->ss2.default_color_pointer = sdc_offset >> 5;
    } else {
       /* reloc */
-      sampler->ss2.default_color_pointer = (brw->batch.bo->offset64 +
-                                           *sdc_offset) >> 5;
+      sampler->ss2.default_color_pointer =
+         (brw->batch.bo->offset64 + sdc_offset) >> 5;
 
       drm_intel_bo_emit_reloc(brw->batch.bo,
                              sampler_state_table_offset +
                              ss_index * sizeof(struct brw_sampler_state) +
                              offsetof(struct brw_sampler_state, ss2),
-                             brw->batch.bo, *sdc_offset,
+                             brw->batch.bo, sdc_offset,
                              I915_GEM_DOMAIN_SAMPLER, 0);
    }
 
@@ -399,8 +399,7 @@ brw_upload_sampler_state_table(struct brw_context *brw,
          const unsigned unit = prog->SamplerUnits[s];
          if (ctx->Texture.Unit[unit]._Current)
             brw_update_sampler_state(brw, unit, s, &samplers[s],
-                                     stage_state->sampler_offset,
-                                     &stage_state->sdc_offset[s]);
+                                     stage_state->sampler_offset);
       }
    }
 
index 219a1748d263da8e6969d40f659dbba7e384e79c..77a74e1dbaf3fbbc24e061d64059c5bf8848e1bb 100644 (file)
@@ -35,8 +35,7 @@
  */
 static void
 gen7_update_sampler_state(struct brw_context *brw, int unit, int ss_index,
-                         struct gen7_sampler_state *sampler,
-                          uint32_t *sdc_offset)
+                         struct gen7_sampler_state *sampler)
 {
    struct gl_context *ctx = &brw->ctx;
    struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -164,9 +163,10 @@ gen7_update_sampler_state(struct brw_context *brw, int unit, int ss_index,
       sampler->ss3.non_normalized_coord = 1;
    }
 
-   upload_default_color(brw, gl_sampler, unit, sdc_offset);
+   uint32_t sdc_offset;
+   upload_default_color(brw, gl_sampler, unit, &sdc_offset);
 
-   sampler->ss2.default_color_pointer = *sdc_offset >> 5;
+   sampler->ss2.default_color_pointer = sdc_offset >> 5;
 
    if (sampler->ss0.min_filter != BRW_MAPFILTER_NEAREST)
       sampler->ss3.address_round |= BRW_ADDRESS_ROUNDING_ENABLE_U_MIN |
@@ -207,8 +207,7 @@ gen7_upload_sampler_state_table(struct brw_context *brw,
       if (SamplersUsed & (1 << s)) {
          const unsigned unit = prog->SamplerUnits[s];
          if (ctx->Texture.Unit[unit]._Current)
-            gen7_update_sampler_state(brw, unit, s, &samplers[s],
-                                      &stage_state->sdc_offset[s]);
+            gen7_update_sampler_state(brw, unit, s, &samplers[s]);
       }
    }