summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2014-07-26 02:34:02 -0700
committerKenneth Graunke <[email protected]>2014-08-02 05:14:42 -0700
commita381592a8e5d17ea4448c7fecbcacd1d0e77b09d (patch)
treea480d201c8a6ffbbe6e9bd91f0457e918ba0d7e7 /src
parent9a1a8cb84d940313130e2ef4e7a94079fa4092b7 (diff)
i965: Stop storing sdc_offset in brw_stage_state.
sdc_offset is produced and consumed in the same function, so there's no need to store it in the context, nor pass pointers to it through various call chains. Saves 128 bytes per brw_stage_state structure, and makes the code clearer as well. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h3
-rw-r--r--src/mesa/drivers/dri/i965/brw_sampler_state.c17
-rw-r--r--src/mesa/drivers/dri/i965/gen7_sampler_state.c11
3 files changed, 13 insertions, 18 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 2943a204e06..f730cffe463 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -890,9 +890,6 @@ struct brw_stage_state
/** SAMPLER_STATE count and table offset */
uint32_t sampler_count;
uint32_t sampler_offset;
-
- /** Offsets in the batch to sampler default colors (texture border color) */
- uint32_t sdc_offset[BRW_MAX_TEX_UNIT];
};
diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c
index 6343ceb7d22..89336728adc 100644
--- a/src/mesa/drivers/dri/i965/brw_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c
@@ -211,8 +211,7 @@ 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,
- uint32_t *sdc_offset)
+ uint32_t sampler_state_table_offset)
{
struct gl_context *ctx = &brw->ctx;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -347,20 +346,21 @@ static void brw_update_sampler_state(struct brw_context *brw,
sampler->ss3.non_normalized_coord = 1;
}
- upload_default_color(brw, gl_sampler, unit, sdc_offset);
+ uint32_t sdc_offset;
+ upload_default_color(brw, gl_sampler, unit, &sdc_offset);
if (brw->gen >= 6) {
- sampler->ss2.default_color_pointer = *sdc_offset >> 5;
+ sampler->ss2.default_color_pointer = sdc_offset >> 5;
} else {
/* reloc */
- sampler->ss2.default_color_pointer = (brw->batch.bo->offset64 +
- *sdc_offset) >> 5;
+ sampler->ss2.default_color_pointer =
+ (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) +
offsetof(struct brw_sampler_state, ss2),
- brw->batch.bo, *sdc_offset,
+ brw->batch.bo, sdc_offset,
I915_GEM_DOMAIN_SAMPLER, 0);
}
@@ -399,8 +399,7 @@ brw_upload_sampler_state_table(struct brw_context *brw,
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,
- &stage_state->sdc_offset[s]);
+ stage_state->sampler_offset);
}
}
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index 219a1748d26..77a74e1dbaf 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -35,8 +35,7 @@
*/
static void
gen7_update_sampler_state(struct brw_context *brw, int unit, int ss_index,
- struct gen7_sampler_state *sampler,
- uint32_t *sdc_offset)
+ struct gen7_sampler_state *sampler)
{
struct gl_context *ctx = &brw->ctx;
struct gl_texture_unit *texUnit = &ctx->Texture.Unit[unit];
@@ -164,9 +163,10 @@ 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, sdc_offset);
+ uint32_t sdc_offset;
+ upload_default_color(brw, gl_sampler, unit, &sdc_offset);
- sampler->ss2.default_color_pointer = *sdc_offset >> 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 |
@@ -207,8 +207,7 @@ gen7_upload_sampler_state_table(struct brw_context *brw,
if (SamplersUsed & (1 << s)) {
const unsigned unit = prog->SamplerUnits[s];
if (ctx->Texture.Unit[unit]._Current)
- gen7_update_sampler_state(brw, unit, s, &samplers[s],
- &stage_state->sdc_offset[s]);
+ gen7_update_sampler_state(brw, unit, s, &samplers[s]);
}
}