This allows us to coalesce the brw_samplers and gen7_samplers atoms. Signed-off-by: Kenneth Graunke <kenn...@whitecape.org> --- src/mesa/drivers/dri/i965/brw_context.h | 6 ++++++ src/mesa/drivers/dri/i965/brw_state.h | 5 ++++- src/mesa/drivers/dri/i965/brw_state_upload.c | 2 +- src/mesa/drivers/dri/i965/brw_vtbl.c | 2 ++ src/mesa/drivers/dri/i965/brw_wm_sampler_state.c | 24 +++++++++++++---------- src/mesa/drivers/dri/i965/gen7_sampler_state.c | 25 +++--------------------- 6 files changed, 30 insertions(+), 34 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h index 18a43cb..cd4f9ed 100644 --- a/src/mesa/drivers/dri/i965/brw_context.h +++ b/src/mesa/drivers/dri/i965/brw_context.h @@ -814,6 +814,12 @@ struct brw_context uint32_t *out_offset, bool dword_pitch); + /** Upload a SAMPLER_STATE table. */ + void (*upload_sampler_state_table)(struct brw_context *brw, + uint32_t *sampler_count, + uint32_t *sst_offset, + uint32_t *sdc_offset); + /** * Send the appropriate state packets to configure depth, stencil, and * HiZ buffers (i965+ only) diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h index dde9f1f..6eaa4a6 100644 --- a/src/mesa/drivers/dri/i965/brw_state.h +++ b/src/mesa/drivers/dri/i965/brw_state.h @@ -111,7 +111,6 @@ extern const struct brw_tracked_state gen7_cc_viewport_state_pointer; extern const struct brw_tracked_state gen7_clip_state; extern const struct brw_tracked_state gen7_disable_stages; extern const struct brw_tracked_state gen7_ps_state; -extern const struct brw_tracked_state gen7_samplers; extern const struct brw_tracked_state gen7_sbe_state; extern const struct brw_tracked_state gen7_sf_clip_viewport; extern const struct brw_tracked_state gen7_sf_state; @@ -210,6 +209,10 @@ 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_init_vtable_sampler_functions(struct brw_context *brw); /* gen6_sf_state.c */ uint32_t diff --git a/src/mesa/drivers/dri/i965/brw_state_upload.c b/src/mesa/drivers/dri/i965/brw_state_upload.c index 06511ee..3f34d39 100644 --- a/src/mesa/drivers/dri/i965/brw_state_upload.c +++ b/src/mesa/drivers/dri/i965/brw_state_upload.c @@ -206,7 +206,7 @@ static const struct brw_tracked_state *gen7_atoms[] = &brw_vs_binding_table, &brw_wm_binding_table, - &gen7_samplers, + &brw_samplers, &gen6_multisample_state, &gen7_disable_stages, diff --git a/src/mesa/drivers/dri/i965/brw_vtbl.c b/src/mesa/drivers/dri/i965/brw_vtbl.c index 9cddbc2..aee88e0 100644 --- a/src/mesa/drivers/dri/i965/brw_vtbl.c +++ b/src/mesa/drivers/dri/i965/brw_vtbl.c @@ -161,9 +161,11 @@ void brwInitVtbl( struct brw_context *brw ) assert(brw->gen >= 4); 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 if (brw->gen >= 4) { 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_wm_sampler_state.c b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c index e2b4b8d..78366ca 100644 --- a/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c +++ b/src/mesa/drivers/dri/i965/brw_wm_sampler_state.c @@ -410,15 +410,15 @@ brw_upload_sampler_state_table(struct brw_context *brw, static void brw_upload_samplers(struct brw_context *brw) { - brw_upload_sampler_state_table(brw, - &brw->wm.sampler_count, - &brw->wm.sampler_offset, - brw->wm.sdc_offset); - - brw_upload_sampler_state_table(brw, - &brw->vs.sampler_count, - &brw->vs.sampler_offset, - brw->vs.sdc_offset); + brw->vtbl.upload_sampler_state_table(brw, + &brw->wm.sampler_count, + &brw->wm.sampler_offset, + brw->wm.sdc_offset); + + brw->vtbl.upload_sampler_state_table(brw, + &brw->vs.sampler_count, + &brw->vs.sampler_offset, + brw->vs.sdc_offset); } const struct brw_tracked_state brw_samplers = { @@ -432,4 +432,8 @@ const struct brw_tracked_state brw_samplers = { .emit = brw_upload_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/gen7_sampler_state.c b/src/mesa/drivers/dri/i965/gen7_sampler_state.c index 45bee78..c7b69d5 100644 --- a/src/mesa/drivers/dri/i965/gen7_sampler_state.c +++ b/src/mesa/drivers/dri/i965/gen7_sampler_state.c @@ -222,27 +222,8 @@ gen7_upload_sampler_state_table(struct brw_context *brw, brw->state.dirty.cache |= CACHE_NEW_SAMPLER; } -static void -gen7_upload_samplers(struct brw_context *brw) +void +gen7_init_vtable_sampler_functions(struct brw_context *brw) { - gen7_upload_sampler_state_table(brw, - &brw->wm.sampler_count, - &brw->wm.sampler_offset, - brw->wm.sdc_offset); - - gen7_upload_sampler_state_table(brw, - &brw->vs.sampler_count, - &brw->vs.sampler_offset, - brw->vs.sdc_offset); + brw->vtbl.upload_sampler_state_table = gen7_upload_sampler_state_table; } - -const struct brw_tracked_state gen7_samplers = { - .dirty = { - .mesa = _NEW_TEXTURE, - .brw = BRW_NEW_BATCH | - BRW_NEW_VERTEX_PROGRAM | - BRW_NEW_FRAGMENT_PROGRAM, - .cache = 0 - }, - .emit = gen7_upload_samplers, -}; -- 1.8.3.4 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev