i965: Upload sampler state pointers on Ivybridge.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 9 Feb 2011 01:27:37 +0000 (17:27 -0800)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 18 May 2011 06:33:00 +0000 (23:33 -0700)
Since we currently only support sampling in the fragment shader, we only
bother to emit the PS variant.  In the future we'll need to emit others.

Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_defines.h
src/mesa/drivers/dri/i965/brw_state.h
src/mesa/drivers/dri/i965/brw_state_upload.c
src/mesa/drivers/dri/i965/gen7_wm_state.c

index ff8be24988a58ee2780e44fb871b07a6a085b48e..2a195d8862f832d34459ee518ca6d04e5d20b454 100644 (file)
 /* DW2: GS */
 /* DW3: PS */
 
+#define _3DSTATE_SAMPLER_STATE_POINTERS_VS     0x782B /* GEN7+ */
+#define _3DSTATE_SAMPLER_STATE_POINTERS_GS     0x782E /* GEN7+ */
+#define _3DSTATE_SAMPLER_STATE_POINTERS_PS     0x782F /* GEN7+ */
+
 #define CMD_VERTEX_BUFFER             0x7808
 # define BRW_VB0_INDEX_SHIFT           27
 # define GEN6_VB0_INDEX_SHIFT          26
index 115e8ce17a86ec60ee3f36c56f3c51943de2a581..bb2b496db984e13cc01da0f794caad64e1f6f895 100644 (file)
@@ -118,6 +118,7 @@ extern const struct brw_tracked_state gen7_clip_state;
 extern const struct brw_tracked_state gen7_depth_stencil_state_pointer;
 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_sampler_state;
 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_clip_viewport_state_pointer;
index 25b2803b0cc57fb6373dbf314b09703474a8e501..e444e2fc8d6fe27cac47e4b6b70b3e87bcbaccdb 100644 (file)
@@ -208,7 +208,6 @@ const struct brw_tracked_state *gen7_atoms[] =
    &brw_wm_binding_table,
 
    &brw_wm_samplers,
-   &gen6_sampler_state,
 
    &gen7_disable_stages,
    &gen7_vs_state,
index bae7f477a882178543d48b35c4bbccc04e706b89..993d5bd8465fdbcd5f341400ca24097450d62073 100644 (file)
@@ -160,6 +160,12 @@ upload_ps_state(struct brw_context *brw)
    OUT_BATCH(brw->wm.bind_bo_offset);
    ADVANCE_BATCH();
 
+   /* CACHE_NEW_SAMPLER */
+   BEGIN_BATCH(2);
+   OUT_BATCH(_3DSTATE_SAMPLER_STATE_POINTERS_PS << 16 | (2 - 2));
+   OUT_BATCH(brw->wm.sampler_offset);
+   ADVANCE_BATCH();
+
    /* CACHE_NEW_WM_PROG */
    if (brw->wm.prog_data->nr_params == 0) {
       /* Disable the push constant buffers. */