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 <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:
Kenneth Graunke 2012-08-24 01:12:53 -07:00
parent 28fab4295e
commit 2faa592e7f
3 changed files with 15 additions and 14 deletions

View file

@ -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

View file

@ -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;

View file

@ -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;