mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 04:48:08 +02:00
i965: Simplify sampler setup by passing the stage state.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
This commit is contained in:
parent
9e363f0262
commit
57ad5a3103
3 changed files with 13 additions and 29 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue