[Mesa-dev] [PATCH 05/23] i965: Stop storing sdc_offset in brw_stage_state.
Kenneth Graunke
kenneth at whitecape.org
Tue Jul 29 16:29:10 PDT 2014
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 <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_context.h | 3 ---
src/mesa/drivers/dri/i965/brw_sampler_state.c | 17 ++++++++---------
src/mesa/drivers/dri/i965/gen7_sampler_state.c | 11 +++++------
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 2943a20..f730cff 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 6343ceb..8933672 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 219a174..77a74e1 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]);
}
}
--
2.0.2
More information about the mesa-dev
mailing list