summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2012-08-21 23:40:02 -0700
committerKenneth Graunke <[email protected]>2013-08-19 13:16:59 -0700
commit9525bcf5f799ffdf6db4cfa41da0daee142e6d3a (patch)
tree1230845b906d2f35398e9645b3fdd7e6840ab0a9 /src/mesa
parented4459b10bda151de0d147936c848939c5da045a (diff)
i965: Un-hardcode border color table from update_sampler_state().
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 <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c14
-rw-r--r--src/mesa/drivers/dri/i965/gen7_sampler_state.c10
2 files changed, 14 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
index 5984e459f45..ad788644a01 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -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]);
}
}
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index 4200f8dff70..dd2493c2e54 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -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]);
}
}