[Mesa-dev] [PATCH 17/45] st/nine: Introduce STREAMFREQ state

Axel Davy axel.davy at ens.fr
Fri Jan 29 08:08:41 PST 2016


Previous vertex elements code update
was protected by
'if ((group & (NINE_STATE_VDECL | NINE_STATE_VS)) ||
state->changed.stream_freq & ~1)'
itself protected by
'if (group & (NINE_STATE_COMMON | NINE_STATE_VS))'

If no state is changed except the stream frequency,
no update would happen.

This patch solves the problem by adding a new
NINE_STATE_STREAMFREQ state.
Another way would be to add state->changed.stream_freq & ~1
check to the main test.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
Reviewed-by: Patrick Rudolph <siro at das-labor.org>
---
 src/gallium/state_trackers/nine/device9.c    |  4 +++-
 src/gallium/state_trackers/nine/nine_state.c |  6 ++---
 src/gallium/state_trackers/nine/nine_state.h | 35 ++++++++++++++--------------
 3 files changed, 24 insertions(+), 21 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 4495aa2..176db02 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -3564,7 +3564,9 @@ NineDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
     else
         state->stream_instancedata_mask &= ~(1 << StreamNumber);
 
-    state->changed.stream_freq |= 1 << StreamNumber;
+    state->changed.stream_freq |= 1 << StreamNumber; /* Used for stateblocks */
+    if (StreamNumber != 0)
+        state->changed.group |= NINE_STATE_STREAMFREQ;
     return D3D_OK;
 }
 
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 561a68e..2f932ba 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -913,7 +913,8 @@ commit_ps(struct NineDevice9 *device)
     NINE_STATE_DSA |      \
     NINE_STATE_VIEWPORT | \
     NINE_STATE_VDECL |    \
-    NINE_STATE_IDXBUF)
+    NINE_STATE_IDXBUF |   \
+    NINE_STATE_STREAMFREQ)
 
 #define NINE_STATE_RARE      \
    (NINE_STATE_SCISSOR |     \
@@ -984,8 +985,7 @@ nine_update_state(struct NineDevice9 *device)
             prepare_dsa(device);
         if (group & NINE_STATE_VIEWPORT)
             update_viewport(device);
-        if ((group & (NINE_STATE_VDECL | NINE_STATE_VS)) ||
-            state->changed.stream_freq & ~1)
+        if (group & (NINE_STATE_VDECL | NINE_STATE_VS | NINE_STATE_STREAMFREQ))
             update_vertex_elements(device);
         if (group & NINE_STATE_IDXBUF)
             commit_index_buffer(device);
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 88e5665..19bf02b 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -61,23 +61,24 @@
 #define NINE_STATE_SAMPLER     (1 << 11)
 #define NINE_STATE_VDECL       (1 << 12)
 #define NINE_STATE_IDXBUF      (1 << 13)
-#define NINE_STATE_PRIM        (1 << 14)
-#define NINE_STATE_MATERIAL    (1 << 15)
-#define NINE_STATE_BLEND_COLOR (1 << 16)
-#define NINE_STATE_STENCIL_REF (1 << 17)
-#define NINE_STATE_SAMPLE_MASK (1 << 18)
-#define NINE_STATE_FF          (0x1f << 19)
-#define NINE_STATE_FF_VS       (0x17 << 19)
-#define NINE_STATE_FF_PS       (0x18 << 19)
-#define NINE_STATE_FF_LIGHTING (1 << 19)
-#define NINE_STATE_FF_MATERIAL (1 << 20)
-#define NINE_STATE_FF_VSTRANSF (1 << 21)
-#define NINE_STATE_FF_PSSTAGES (1 << 22)
-#define NINE_STATE_FF_OTHER    (1 << 23)
-#define NINE_STATE_FOG_SHADER  (1 << 24)
-#define NINE_STATE_PS1X_SHADER (1 << 25)
-#define NINE_STATE_ALL          0x3ffffff
-#define NINE_STATE_UNHANDLED   (1 << 26)
+#define NINE_STATE_STREAMFREQ  (1 << 14)
+#define NINE_STATE_PRIM        (1 << 15)
+#define NINE_STATE_MATERIAL    (1 << 16)
+#define NINE_STATE_BLEND_COLOR (1 << 17)
+#define NINE_STATE_STENCIL_REF (1 << 18)
+#define NINE_STATE_SAMPLE_MASK (1 << 19)
+#define NINE_STATE_FF          (0x1f << 20)
+#define NINE_STATE_FF_VS       (0x17 << 20)
+#define NINE_STATE_FF_PS       (0x18 << 20)
+#define NINE_STATE_FF_LIGHTING (1 << 20)
+#define NINE_STATE_FF_MATERIAL (1 << 21)
+#define NINE_STATE_FF_VSTRANSF (1 << 22)
+#define NINE_STATE_FF_PSSTAGES (1 << 23)
+#define NINE_STATE_FF_OTHER    (1 << 24)
+#define NINE_STATE_FOG_SHADER  (1 << 25)
+#define NINE_STATE_PS1X_SHADER (1 << 26)
+#define NINE_STATE_ALL          0x7ffffff
+#define NINE_STATE_UNHANDLED   (1 << 27)
 
 #define NINE_STATE_COMMIT_DSA  (1 << 0)
 #define NINE_STATE_COMMIT_RASTERIZER (1 << 1)
-- 
2.7.0



More information about the mesa-dev mailing list