summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2012-08-24 01:12:53 -0700
committerKenneth Graunke <[email protected]>2012-08-25 12:01:10 -0700
commit2faa592e7f54ef21b799b61ffa50c6bc8039ddc1 (patch)
treed66357d1449dff028632a831d1498e08ce4a7d1a /src/mesa
parent28fab4295e9631ca91c5ebdf26d1bee23011d57e (diff)
i965: Add a "sampler state index" parameter to update_sampler_state().
This represents the index into the sampler state table or sampler default color table (the two are identical). Right now, this is still the texture unit, but that will change shortly. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Paul Berry <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c19
-rw-r--r--src/mesa/drivers/dri/i965/gen7_sampler_state.c8
3 files changed, 15 insertions, 14 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index 2540cd574b2..4e78fae5e9b 100644
--- a/src/mesa/drivers/dri/i965/brw_state.h
+++ b/src/mesa/drivers/dri/i965/brw_state.h
@@ -225,7 +225,7 @@ void gen7_create_constant_surface(struct brw_context *brw,
uint32_t translate_wrap_mode(GLenum wrap, bool using_nearest);
void upload_default_color(struct brw_context *brw,
struct gl_sampler_object *sampler,
- int unit);
+ int unit, int ss_index);
/* gen6_sf_state.c */
uint32_t
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 27f0d706e6a..10deb1da0fb 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -80,7 +80,7 @@ translate_wrap_mode(GLenum wrap, bool using_nearest)
*/
void
upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler,
- int unit)
+ int unit, int ss_index)
{
struct intel_context *intel = &brw->intel;
struct gl_context *ctx = &intel->ctx;
@@ -109,7 +109,7 @@ upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler,
struct gen5_sampler_default_color *sdc;
sdc = brw_state_batch(brw, AUB_TRACE_SAMPLER_DEFAULT_COLOR,
- sizeof(*sdc), 32, &brw->wm.sdc_offset[unit]);
+ sizeof(*sdc), 32, &brw->wm.sdc_offset[ss_index]);
memset(sdc, 0, sizeof(*sdc));
@@ -146,7 +146,7 @@ upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler,
struct brw_sampler_default_color *sdc;
sdc = brw_state_batch(brw, AUB_TRACE_SAMPLER_DEFAULT_COLOR,
- sizeof(*sdc), 32, &brw->wm.sdc_offset[unit]);
+ sizeof(*sdc), 32, &brw->wm.sdc_offset[ss_index]);
COPY_4V(sdc->color, color);
}
@@ -158,6 +158,7 @@ upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler,
*/
static void brw_update_sampler_state(struct brw_context *brw,
int unit,
+ int ss_index,
struct brw_sampler_state *sampler)
{
struct intel_context *intel = &brw->intel;
@@ -300,20 +301,20 @@ static void brw_update_sampler_state(struct brw_context *brw,
sampler->ss3.non_normalized_coord = 1;
}
- upload_default_color(brw, gl_sampler, unit);
+ upload_default_color(brw, gl_sampler, unit, ss_index);
if (intel->gen >= 6) {
- sampler->ss2.default_color_pointer = brw->wm.sdc_offset[unit] >> 5;
+ sampler->ss2.default_color_pointer = brw->wm.sdc_offset[ss_index] >> 5;
} else {
/* reloc */
sampler->ss2.default_color_pointer = (intel->batch.bo->offset +
- brw->wm.sdc_offset[unit]) >> 5;
+ brw->wm.sdc_offset[ss_index]) >> 5;
drm_intel_bo_emit_reloc(intel->batch.bo,
brw->sampler.offset +
- unit * sizeof(struct brw_sampler_state) +
+ ss_index * sizeof(struct brw_sampler_state) +
offsetof(struct brw_sampler_state, ss2),
- intel->batch.bo, brw->wm.sdc_offset[unit],
+ intel->batch.bo, brw->wm.sdc_offset[ss_index],
I915_GEM_DOMAIN_SAMPLER, 0);
}
@@ -351,7 +352,7 @@ brw_upload_samplers(struct brw_context *brw)
for (i = 0; i < brw->sampler.count; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled)
- brw_update_sampler_state(brw, i, &samplers[i]);
+ brw_update_sampler_state(brw, i, i, &samplers[i]);
}
brw->state.dirty.cache |= CACHE_NEW_SAMPLER;
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index 3c8daf9a153..c3b67e85140 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -33,7 +33,7 @@
* Sets the sampler state for a single unit.
*/
static void
-gen7_update_sampler_state(struct brw_context *brw, int unit,
+gen7_update_sampler_state(struct brw_context *brw, int unit, int ss_index,
struct gen7_sampler_state *sampler)
{
struct intel_context *intel = &brw->intel;
@@ -168,9 +168,9 @@ gen7_update_sampler_state(struct brw_context *brw, int unit,
sampler->ss3.non_normalized_coord = 1;
}
- upload_default_color(brw, gl_sampler, unit);
+ upload_default_color(brw, gl_sampler, unit, ss_index);
- sampler->ss2.default_color_pointer = brw->wm.sdc_offset[unit] >> 5;
+ sampler->ss2.default_color_pointer = brw->wm.sdc_offset[ss_index] >> 5;
if (sampler->ss0.min_filter != BRW_MAPFILTER_NEAREST)
sampler->ss3.address_round |= BRW_ADDRESS_ROUNDING_ENABLE_U_MIN |
@@ -206,7 +206,7 @@ gen7_upload_samplers(struct brw_context *brw)
for (i = 0; i < brw->sampler.count; i++) {
if (ctx->Texture.Unit[i]._ReallyEnabled)
- gen7_update_sampler_state(brw, i, &samplers[i]);
+ gen7_update_sampler_state(brw, i, i, &samplers[i]);
}
brw->state.dirty.cache |= CACHE_NEW_SAMPLER;