[Mesa-dev] [PATCH 41/84] st/nine: Back swvp in nine_context

Axel Davy axel.davy at ens.fr
Wed Dec 7 22:55:14 UTC 2016


Part of the refactor to move all gallium calls to
nine_state.c, and have all internal states required
for those calls in nine_context.

Signed-off-by: Axel Davy <axel.davy at ens.fr>
---
 src/gallium/state_trackers/nine/device9.c       |  3 ++-
 src/gallium/state_trackers/nine/nine_state.c    | 14 ++++++++++++--
 src/gallium/state_trackers/nine/nine_state.h    |  7 +++++++
 src/gallium/state_trackers/nine/vertexshader9.c |  2 +-
 src/gallium/state_trackers/nine/vertexshader9.h |  2 +-
 5 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index c5b6e57..884fe29 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -173,6 +173,7 @@ NineDevice9_ctor( struct NineDevice9 *This,
         DBG("Application asked mixed Software Vertex Processing.\n");
         This->may_swvp = true;
     }
+    This->context.swvp = This->swvp;
     /* TODO: check if swvp is resetted by device Resets */
 
     if (This->may_swvp &&
@@ -2681,7 +2682,7 @@ NineDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This,
 {
     if (This->params.BehaviorFlags & D3DCREATE_MIXED_VERTEXPROCESSING) {
         This->swvp = bSoftware;
-        This->context.changed.group |= NINE_STATE_SWVP;
+        nine_context_set_swvp(This, bSoftware);
         return D3D_OK;
     } else
         return D3DERR_INVALIDCALL; /* msdn. TODO: check in practice */
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index 177eb77..8c8d4f0 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -212,7 +212,7 @@ prepare_vs_constants_userbuf(struct NineDevice9 *device)
     cb.buffer_size = context->vs->const_used_size;
     cb.user_buffer = context->vs_const_f;
 
-    if (device->swvp) {
+    if (context->swvp) {
         prepare_vs_constants_userbuf_swvp(device);
         return;
     }
@@ -848,7 +848,7 @@ commit_vs_constants(struct NineDevice9 *device)
     if (unlikely(!context->programmable_vs))
         pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, &context->pipe_data.cb_vs_ff);
     else {
-        if (device->swvp) {
+        if (context->swvp) {
             pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 0, &context->pipe_data.cb0_swvp);
             pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 1, &context->pipe_data.cb1_swvp);
             pipe->set_constant_buffer(pipe, PIPE_SHADER_VERTEX, 2, &context->pipe_data.cb2_swvp);
@@ -1683,6 +1683,16 @@ nine_context_set_clip_plane(struct NineDevice9 *device,
     context->changed.ucp = TRUE;
 }
 
+void
+nine_context_set_swvp(struct NineDevice9 *device,
+                      boolean swvp)
+{
+    struct nine_context *context = &device->context;
+
+    context->swvp = swvp;
+    context->changed.group |= NINE_STATE_SWVP;
+}
+
 #if 0
 
 void
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index 42d45d9..d5cbbd4 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -299,6 +299,9 @@ struct nine_context {
 
     struct nine_ff_state ff;
 
+    /* software vertex processing */
+    boolean swvp;
+
     uint32_t commit;
     struct {
         struct pipe_framebuffer_state fb;
@@ -459,6 +462,10 @@ nine_context_set_clip_plane(struct NineDevice9 *device,
                             const float *pPlane);
 
 void
+nine_context_set_swvp(struct NineDevice9 *device,
+                      boolean swvp);
+
+void
 nine_context_apply_stateblock(struct NineDevice9 *device,
                               const struct nine_state *src);
 
diff --git a/src/gallium/state_trackers/nine/vertexshader9.c b/src/gallium/state_trackers/nine/vertexshader9.c
index 947831d..71a56f4 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.c
+++ b/src/gallium/state_trackers/nine/vertexshader9.c
@@ -194,7 +194,7 @@ NineVertexShader9_GetVariant( struct NineVertexShader9 *This )
         info.fog_enable = device->context.rs[D3DRS_FOGENABLE];
         info.point_size_min = asfloat(device->context.rs[D3DRS_POINTSIZE_MIN]);
         info.point_size_max = asfloat(device->context.rs[D3DRS_POINTSIZE_MAX]);
-        info.swvp_on = device->swvp;
+        info.swvp_on = device->context.swvp;
         info.process_vertices = false;
 
         hr = nine_translate_shader(This->base.device, &info, pipe);
diff --git a/src/gallium/state_trackers/nine/vertexshader9.h b/src/gallium/state_trackers/nine/vertexshader9.h
index a912d46..888f1de 100644
--- a/src/gallium/state_trackers/nine/vertexshader9.h
+++ b/src/gallium/state_trackers/nine/vertexshader9.h
@@ -91,7 +91,7 @@ NineVertexShader9_UpdateKey( struct NineVertexShader9 *vs,
 
     if (vs->byte_code.version < 0x30)
         key |= (uint32_t) ((!!context->rs[D3DRS_FOGENABLE]) << 8);
-    key |= (uint32_t) (device->swvp << 9);
+    key |= (uint32_t) (context->swvp << 9);
 
     /* We want to use a 64 bits key for performance.
      * Use compressed float16 values for the pointsize min/max in the key.
-- 
2.10.2



More information about the mesa-dev mailing list