diff options
author | Kenneth Graunke <[email protected]> | 2014-07-26 11:48:50 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2014-08-02 05:14:42 -0700 |
commit | 6afe21da6236f74acfb4daa6fbc4d6d1de700790 (patch) | |
tree | 17228f1ac4d578e4eae920d1c8d8b236d033c062 | |
parent | c2f231e18104e3300d9fab86600e7e0f6c77d1fb (diff) |
i965: Delete gen7_upload_sampler_state_table and vtable mechanism.
brw_upload_sampler_state_table now handles all generations, so we don't
need the vtable mechanism either.
There's still a lot of code duplication; the next patches will address
that.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Topi Pohjolainen <[email protected]>
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.c | 3 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_context.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_sampler_state.c | 13 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_state.h | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i965/gen7_sampler_state.c | 50 |
5 files changed, 3 insertions, 70 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index c47ad36c5b6..89f5df5b5c6 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -639,15 +639,12 @@ brwCreateContext(gl_api api, brw->wm.base.stage = MESA_SHADER_FRAGMENT; if (brw->gen >= 8) { gen8_init_vtable_surface_functions(brw); - gen7_init_vtable_sampler_functions(brw); brw->vtbl.emit_depth_stencil_hiz = gen8_emit_depth_stencil_hiz; } else if (brw->gen >= 7) { gen7_init_vtable_surface_functions(brw); - gen7_init_vtable_sampler_functions(brw); brw->vtbl.emit_depth_stencil_hiz = gen7_emit_depth_stencil_hiz; } else { gen4_init_vtable_surface_functions(brw); - gen4_init_vtable_sampler_functions(brw); brw->vtbl.emit_depth_stencil_hiz = brw_emit_depth_stencil_hiz; } diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index f730cffe463..1bbcf469757 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -929,11 +929,6 @@ struct brw_context unsigned mocs, bool rw); - /** Upload a SAMPLER_STATE table. */ - void (*upload_sampler_state_table)(struct brw_context *brw, - struct gl_program *prog, - struct brw_stage_state *stage_state); - /** * Send the appropriate state packets to configure depth, stencil, and * HiZ buffers (i965+ only) diff --git a/src/mesa/drivers/dri/i965/brw_sampler_state.c b/src/mesa/drivers/dri/i965/brw_sampler_state.c index 7ccf14640f8..a4091a1ec21 100644 --- a/src/mesa/drivers/dri/i965/brw_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_sampler_state.c @@ -461,7 +461,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); + brw_upload_sampler_state_table(brw, fs, &brw->wm.base); } const struct brw_tracked_state brw_fs_samplers = { @@ -479,7 +479,7 @@ brw_upload_vs_samplers(struct brw_context *brw) { /* BRW_NEW_VERTEX_PROGRAM */ struct gl_program *vs = (struct gl_program *) brw->vertex_program; - brw->vtbl.upload_sampler_state_table(brw, vs, &brw->vs.base); + brw_upload_sampler_state_table(brw, vs, &brw->vs.base); } @@ -502,7 +502,7 @@ brw_upload_gs_samplers(struct brw_context *brw) if (!gs) return; - brw->vtbl.upload_sampler_state_table(brw, gs, &brw->gs.base); + brw_upload_sampler_state_table(brw, gs, &brw->gs.base); } @@ -515,10 +515,3 @@ const struct brw_tracked_state brw_gs_samplers = { }, .emit = brw_upload_gs_samplers, }; - - -void -gen4_init_vtable_sampler_functions(struct brw_context *brw) -{ - brw->vtbl.upload_sampler_state_table = brw_upload_sampler_state_table; -} diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index 64652cbbeb6..0fda360e3c1 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -249,13 +249,11 @@ void upload_default_color(struct brw_context *brw, struct gl_sampler_object *sampler, int unit, uint32_t *sdc_offset); -void gen4_init_vtable_sampler_functions(struct brw_context *brw); /* gen7_sampler_state.c */ void gen7_update_sampler_state(struct brw_context *brw, int unit, struct gen7_sampler_state *sampler_state); -void gen7_init_vtable_sampler_functions(struct brw_context *brw); /* gen6_sf_state.c */ void diff --git a/src/mesa/drivers/dri/i965/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c index 66af26a63e4..276c2b991da 100644 --- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c @@ -177,53 +177,3 @@ gen7_update_sampler_state(struct brw_context *brw, int unit, BRW_ADDRESS_ROUNDING_ENABLE_V_MAG | BRW_ADDRESS_ROUNDING_ENABLE_R_MAG; } - - -static void -gen7_upload_sampler_state_table(struct brw_context *brw, - struct gl_program *prog, - 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; - static const uint16_t packet_headers[] = { - [MESA_SHADER_VERTEX] = _3DSTATE_SAMPLER_STATE_POINTERS_VS, - [MESA_SHADER_GEOMETRY] = _3DSTATE_SAMPLER_STATE_POINTERS_GS, - [MESA_SHADER_FRAGMENT] = _3DSTATE_SAMPLER_STATE_POINTERS_PS, - }; - - GLbitfield SamplersUsed = prog->SamplersUsed; - - if (sampler_count == 0) - return; - - samplers = brw_state_batch(brw, AUB_TRACE_SAMPLER_STATE, - sampler_count * sizeof(*samplers), - 32, &stage_state->sampler_offset); - memset(samplers, 0, sampler_count * sizeof(*samplers)); - - for (unsigned s = 0; s < sampler_count; s++) { - if (SamplersUsed & (1 << s)) { - const unsigned unit = prog->SamplerUnits[s]; - if (ctx->Texture.Unit[unit]._Current) - gen7_update_sampler_state(brw, unit, &samplers[s]); - } - } - - if (brw->gen == 7 && !brw->is_haswell && !brw->is_baytrail && - stage_state->stage == MESA_SHADER_VERTEX) { - gen7_emit_vs_workaround_flush(brw); - } - - BEGIN_BATCH(2); - OUT_BATCH(packet_headers[stage_state->stage] << 16 | (2 - 2)); - OUT_BATCH(stage_state->sampler_offset); - ADVANCE_BATCH(); -} - -void -gen7_init_vtable_sampler_functions(struct brw_context *brw) -{ - brw->vtbl.upload_sampler_state_table = gen7_upload_sampler_state_table; -} |