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>
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)
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;
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
&brw_vs_binding_table,
&brw_wm_binding_table,
- &gen7_samplers,
+ &brw_samplers,
&gen6_multisample_state,
&gen7_disable_stages,
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;
}
}
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 = {
.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;
+}
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,
-};