summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-07-26 11:20:02 -0700
committerKenneth Graunke <[email protected]>2014-08-02 05:14:42 -0700
commit378eea970824821ffb0d38c27e214af94ec0aca9 (patch)
tree156789246b6bff64e580f60c8154df9ce476864d
parent7efa183e8f5b66409f75a551c3fdfd652f7f205f (diff)
i965: Push computation for sampler state batch offsets up a level.
Other than this, brw_update_sampler_state only deals with a single SAMPLER_STATE structure, and doesn't need to know which position it is in the table. The caller takes care of dealing with multiple surface states. Pushing this up a level allows us to drop the ss_index parameter. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_sampler_state.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 89336728adc..587da1a3670 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -207,11 +207,11 @@ upload_default_color(struct brw_context *brw,
* Sets the sampler state for a single unit based off of the sampler key
* entry.
*/
-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)
+static void
+brw_update_sampler_state(struct brw_context *brw,
+ int unit,
+ struct brw_sampler_state *sampler,
+ uint32_t batch_offset_for_sampler_state)
{
struct gl_context *ctx = &brw->ctx;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -357,8 +357,7 @@ static void brw_update_sampler_state(struct brw_context *brw,
(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) +
+ batch_offset_for_sampler_state +
offsetof(struct brw_sampler_state, ss2),
brw->batch.bo, sdc_offset,
I915_GEM_DOMAIN_SAMPLER, 0);
@@ -397,9 +396,12 @@ brw_upload_sampler_state_table(struct brw_context *brw,
for (unsigned s = 0; s < sampler_count; s++) {
if (SamplersUsed & (1 << s)) {
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);
+ if (ctx->Texture.Unit[unit]._Current) {
+ uint32_t batch_offset_for_sampler_state =
+ stage_state->sampler_offset + s * sizeof(*samplers);
+ brw_update_sampler_state(brw, unit, &samplers[s],
+ batch_offset_for_sampler_state);
+ }
}
}