i965: Un-hardcode border color table from update_sampler_state().
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 22 Aug 2012 06:40:02 +0000 (23:40 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 19 Aug 2013 20:16:59 +0000 (13:16 -0700)
Like the previous patch, this simply pushes direct access to brw->wm up
one level in the call chain.  Rather than passing the whole array, we
just pass a pointer to the correct spot in the array, similar to what we
do for the actual sampler state structure.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
src/mesa/drivers/dri/i965/gen7_sampler_state.c

index 5984e459f45a95ad25959365e4be8f0617b96692..ad788644a0107514349736777232816eb5df2716 100644 (file)
@@ -194,7 +194,8 @@ upload_default_color(struct brw_context *brw,
 static void brw_update_sampler_state(struct brw_context *brw,
                                     int unit,
                                      int ss_index,
-                                    struct brw_sampler_state *sampler)
+                                     struct brw_sampler_state *sampler,
+                                     uint32_t *sdc_offset)
 {
    struct gl_context *ctx = &brw->ctx;
    struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -336,20 +337,20 @@ static void brw_update_sampler_state(struct brw_context *brw,
       sampler->ss3.non_normalized_coord = 1;
    }
 
-   upload_default_color(brw, gl_sampler, unit, &brw->wm.sdc_offset[ss_index]);
+   upload_default_color(brw, gl_sampler, unit, sdc_offset);
 
    if (brw->gen >= 6) {
-      sampler->ss2.default_color_pointer = brw->wm.sdc_offset[ss_index] >> 5;
+      sampler->ss2.default_color_pointer = *sdc_offset >> 5;
    } else {
       /* reloc */
       sampler->ss2.default_color_pointer = (brw->batch.bo->offset +
-                                           brw->wm.sdc_offset[ss_index]) >> 5;
+                                           *sdc_offset) >> 5;
 
       drm_intel_bo_emit_reloc(brw->batch.bo,
                              brw->sampler.offset +
                              ss_index * sizeof(struct brw_sampler_state) +
                              offsetof(struct brw_sampler_state, ss2),
-                             brw->batch.bo, brw->wm.sdc_offset[ss_index],
+                             brw->batch.bo, *sdc_offset,
                              I915_GEM_DOMAIN_SAMPLER, 0);
    }
 
@@ -396,7 +397,8 @@ brw_upload_samplers(struct brw_context *brw)
          const unsigned unit = (fs->SamplersUsed & (1 << s)) ?
             fs->SamplerUnits[s] : vs->SamplerUnits[s];
          if (ctx->Texture.Unit[unit]._ReallyEnabled)
-            brw_update_sampler_state(brw, unit, s, &samplers[s]);
+            brw_update_sampler_state(brw, unit, s, &samplers[s],
+                                     &brw->wm.sdc_offset[s]);
       }
    }
 
index 4200f8dff7057ea65a67a308ffe80780d1fe32fa..dd2493c2e546c38d5be7e0d463c39df274d83b45 100644 (file)
@@ -34,7 +34,8 @@
  */
 static void
 gen7_update_sampler_state(struct brw_context *brw, int unit, int ss_index,
-                         struct gen7_sampler_state *sampler)
+                         struct gen7_sampler_state *sampler,
+                          uint32_t *sdc_offset)
 {
    struct gl_context *ctx = &brw->ctx;
    struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -168,9 +169,9 @@ 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, &brw->wm.sdc_offset[ss_index]);
+   upload_default_color(brw, gl_sampler, unit, sdc_offset);
 
-   sampler->ss2.default_color_pointer = brw->wm.sdc_offset[ss_index] >> 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 |
@@ -212,7 +213,8 @@ gen7_upload_samplers(struct brw_context *brw)
          const unsigned unit = (fs->SamplersUsed & (1 << s)) ?
             fs->SamplerUnits[s] : vs->SamplerUnits[s];
          if (ctx->Texture.Unit[unit]._ReallyEnabled)
-            gen7_update_sampler_state(brw, unit, s, &samplers[s]);
+            gen7_update_sampler_state(brw, unit, s, &samplers[s],
+                                      &brw->wm.sdc_offset[s]);
       }
    }