aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorKenneth Graunke <[email protected]>2013-06-25 22:29:19 -0700
committerKenneth Graunke <[email protected]>2013-08-19 13:16:59 -0700
commit2b7f876a6ad62ad9a93c0df15cb4be1fcc61d380 (patch)
tree3b2657d74435d24704b4a1584d4ef34421ab349e /src/mesa/drivers/dri/i965
parentdecc708c7c3ab53922cf3ac94cd74231196fd0cb (diff)
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 <[email protected]> Reviewed-by: Paul Berry <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h6
-rw-r--r--src/mesa/drivers/dri/i965/brw_state.h5
-rw-r--r--src/mesa/drivers/dri/i965/brw_state_upload.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_vtbl.c2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_sampler_state.c24
-rw-r--r--src/mesa/drivers/dri/i965/gen7_sampler_state.c25
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 1715c56aa72..5280b8831fe 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -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)
diff --git a/src/mesa/drivers/dri/i965/brw_state.h b/src/mesa/drivers/dri/i965/brw_state.h
index dde9f1f4423..6eaa4a64d1e 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 06511ee765f..3f34d39268d 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 9cddbc28fb6..aee88e0ea4f 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 e2b4b8dad36..78366ca19f4 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 45bee7850c2..c7b69d5d6c6 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,
-};