i965: Make upload_sampler_state_table a virtual function.

This allows us to coalesce the brw_samplers and gen7_samplers atoms.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Paul Berry <stereotype441@gmail.com>
This commit is contained in:
Kenneth Graunke
2013-06-25 22:29:19 -07:00
parent decc708c7c
commit 2b7f876a6a
6 changed files with 29 additions and 33 deletions
+6
View File
@@ -815,6 +815,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)
+4 -1
View File
@@ -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
+1 -1
View File
@@ -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,
+2
View File
@@ -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;
}
}
@@ -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->vtbl.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->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;
}
+3 -22
View File
@@ -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,
};