summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-04-28 09:23:57 -0700
committerEric Anholt <[email protected]>2014-05-02 17:01:40 -0700
commit57ad5a31031feecdc64a81750df996740e3e9954 (patch)
tree3fc74e99f67ead2119fd72235b1020d97d84b1fb
parent9e363f026208d91793b7176b56252a3b88fb70cc (diff)
i965: Simplify sampler setup by passing the stage state.
Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h4
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c29
-rw-r--r--src/mesa/drivers/dri/i965/gen7_sampler_state.c9
3 files changed, 13 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index f30d42c552e..379af38cba0 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -994,9 +994,7 @@ struct brw_context
/** Upload a SAMPLER_STATE table. */
void (*upload_sampler_state_table)(struct brw_context *brw,
struct gl_program *prog,
- uint32_t sampler_count,
- uint32_t *sst_offset,
- uint32_t *sdc_offset);
+ struct brw_stage_state *stage_state);
/**
* Send the appropriate state packets to configure depth, stencil, and
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 afe952a01ad..bbfd9e053d8 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c
@@ -375,12 +375,11 @@ static void brw_update_sampler_state(struct brw_context *brw,
static void
brw_upload_sampler_state_table(struct brw_context *brw,
struct gl_program *prog,
- uint32_t sampler_count,
- uint32_t *sst_offset,
- uint32_t *sdc_offset)
+ struct brw_stage_state *stage_state)
{
struct gl_context *ctx = &brw->ctx;
struct brw_sampler_state *samplers;
+ uint32_t sampler_count = stage_state->sampler_count;
GLbitfield SamplersUsed = prog->SamplersUsed;
@@ -389,7 +388,7 @@ brw_upload_sampler_state_table(struct brw_context *brw,
samplers = brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE,
sampler_count * sizeof(*samplers),
- 32, sst_offset);
+ 32, &stage_state->sampler_offset);
memset(samplers, 0, sampler_count * sizeof(*samplers));
for (unsigned s = 0; s < sampler_count; s++) {
@@ -397,7 +396,8 @@ 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],
- *sst_offset, &sdc_offset[s]);
+ stage_state->sampler_offset,
+ &stage_state->sdc_offset[s]);
}
}
@@ -409,10 +409,7 @@ brw_upload_fs_samplers(struct brw_context *brw)
{
/* BRW_NEW_FRAGMENT_PROGRAM */
struct gl_program *fs = (struct gl_program *) brw->fragment_program;
- brw->vtbl.upload_sampler_state_table(brw, fs,
- brw->wm.base.sampler_count,
- &brw->wm.base.sampler_offset,
- brw->wm.base.sdc_offset);
+ brw->vtbl.upload_sampler_state_table(brw, fs, &brw->wm.base);
}
const struct brw_tracked_state brw_fs_samplers = {
@@ -428,14 +425,9 @@ const struct brw_tracked_state brw_fs_samplers = {
static void
brw_upload_vs_samplers(struct brw_context *brw)
{
- struct brw_stage_state *stage_state = &brw->vs.base;
-
/* BRW_NEW_VERTEX_PROGRAM */
struct gl_program *vs = (struct gl_program *) brw->vertex_program;
- brw->vtbl.upload_sampler_state_table(brw, vs,
- stage_state->sampler_count,
- &stage_state->sampler_offset,
- stage_state->sdc_offset);
+ brw->vtbl.upload_sampler_state_table(brw, vs, &brw->vs.base);
}
@@ -453,17 +445,12 @@ const struct brw_tracked_state brw_vs_samplers = {
static void
brw_upload_gs_samplers(struct brw_context *brw)
{
- struct brw_stage_state *stage_state = &brw->gs.base;
-
/* BRW_NEW_GEOMETRY_PROGRAM */
struct gl_program *gs = (struct gl_program *) brw->geometry_program;
if (!gs)
return;
- brw->vtbl.upload_sampler_state_table(brw, gs,
- stage_state->sampler_count,
- &stage_state->sampler_offset,
- stage_state->sdc_offset);
+ brw->vtbl.upload_sampler_state_table(brw, gs, &brw->gs.base);
}
diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
index 94091d8cecf..8eb337d5492 100644
--- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c
+++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c
@@ -182,12 +182,11 @@ gen7_update_sampler_state(struct brw_context *brw, int unit, int ss_index,
static void
gen7_upload_sampler_state_table(struct brw_context *brw,
struct gl_program *prog,
- uint32_t sampler_count,
- uint32_t *sst_offset,
- uint32_t *sdc_offset)
+ struct brw_stage_state *stage_state)
{
struct gl_context *ctx = &brw->ctx;
struct gen7_sampler_state *samplers;
+ uint32_t sampler_count = stage_state->sampler_count;
GLbitfield SamplersUsed = prog->SamplersUsed;
@@ -196,7 +195,7 @@ gen7_upload_sampler_state_table(struct brw_context *brw,
samplers = brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE,
sampler_count * sizeof(*samplers),
- 32, sst_offset);
+ 32, &stage_state->sampler_offset);
memset(samplers, 0, sampler_count * sizeof(*samplers));
for (unsigned s = 0; s < sampler_count; s++) {
@@ -204,7 +203,7 @@ gen7_upload_sampler_state_table(struct brw_context *brw,
const unsigned unit = prog->SamplerUnits[s];
if (ctx->Texture.Unit[unit]._Current)
gen7_update_sampler_state(brw, unit, s, &samplers[s],
- &sdc_offset[s]);
+ &stage_state->sdc_offset[s]);
}
}