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 ff8be24..2a195d8 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 115e8ce..bb2b496 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 25b2803..e444e2f 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 bae7f47..993d5bd 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. */