[Mesa-dev] [PATCH 04/84] st/nine: Track changed.texture only for stateblocks

Axel Davy axel.davy at ens.fr
Wed Dec 7 22:54:37 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/basetexture9.c | 4 +---
 src/gallium/state_trackers/nine/device9.c      | 3 ++-
 src/gallium/state_trackers/nine/nine_state.c   | 4 ----
 src/gallium/state_trackers/nine/nine_state.h   | 2 +-
 src/gallium/state_trackers/nine/stateblock9.c  | 1 -
 5 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/gallium/state_trackers/nine/basetexture9.c b/src/gallium/state_trackers/nine/basetexture9.c
index 829a7c6..e7b049c 100644
--- a/src/gallium/state_trackers/nine/basetexture9.c
+++ b/src/gallium/state_trackers/nine/basetexture9.c
@@ -210,9 +210,7 @@ NineBaseTexture9_UploadSelf( struct NineBaseTexture9 *This )
             unsigned s;
             for (s = 0; s < NINE_MAX_SAMPLERS; ++s)
                 if (state->texture[s] == This)
-                    state->changed.texture |= 1 << s;
-            if (state->changed.texture)
-                state->changed.group |= NINE_STATE_TEXTURE;
+                    state->changed.group |= NINE_STATE_TEXTURE;
         }
 
         /* Allocate a new resource */
diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c
index 68eef8f..94650eb 100644
--- a/src/gallium/state_trackers/nine/device9.c
+++ b/src/gallium/state_trackers/nine/device9.c
@@ -2482,7 +2482,8 @@ NineDevice9_SetTexture( struct NineDevice9 *This,
     }
     nine_bind(&state->texture[Stage], pTexture);
 
-    state->changed.texture |= 1 << Stage;
+    if (This->is_recording)
+        state->changed.texture |= 1 << Stage;
     state->changed.group |= NINE_STATE_TEXTURE;
 
     return D3D_OK;
diff --git a/src/gallium/state_trackers/nine/nine_state.c b/src/gallium/state_trackers/nine/nine_state.c
index b99be2c..1a1c295 100644
--- a/src/gallium/state_trackers/nine/nine_state.c
+++ b/src/gallium/state_trackers/nine/nine_state.c
@@ -859,8 +859,6 @@ update_textures_and_samplers(struct NineDevice9 *device)
 
     if (commit_samplers)
         cso_single_sampler_done(device->cso, PIPE_SHADER_VERTEX);
-
-    state->changed.texture = 0;
 }
 
 /* State commit only */
@@ -1675,7 +1673,6 @@ void nine_state_restore_non_cso(struct NineDevice9 *device)
     state->changed.group = NINE_STATE_ALL;
     state->changed.vtxbuf = (1ULL << device->caps.MaxStreams) - 1;
     state->changed.ucp = (1 << PIPE_MAX_CLIP_PLANES) - 1;
-    state->changed.texture = NINE_PS_SAMPLERS_MASK | NINE_VS_SAMPLERS_MASK;
     context->commit |= NINE_STATE_COMMIT_CONST_VS | NINE_STATE_COMMIT_CONST_PS;
 }
 
@@ -1723,7 +1720,6 @@ nine_state_set_defaults(struct NineDevice9 *device, const D3DCAPS9 *caps,
     state->changed.group = NINE_STATE_ALL;
     state->changed.vtxbuf = (1ULL << device->caps.MaxStreams) - 1;
     state->changed.ucp = (1 << PIPE_MAX_CLIP_PLANES) - 1;
-    state->changed.texture = NINE_PS_SAMPLERS_MASK | NINE_VS_SAMPLERS_MASK;
 
     state->ff.changed.transform[0] = ~0;
     state->ff.changed.transform[D3DTS_WORLD / 32] |= 1 << (D3DTS_WORLD % 32);
diff --git a/src/gallium/state_trackers/nine/nine_state.h b/src/gallium/state_trackers/nine/nine_state.h
index b5f4976..99b0a38 100644
--- a/src/gallium/state_trackers/nine/nine_state.h
+++ b/src/gallium/state_trackers/nine/nine_state.h
@@ -138,7 +138,7 @@ struct nine_state
         uint32_t rs[(NINED3DRS_COUNT + 31) / 32]; /* stateblocks only */
         uint32_t vtxbuf;
         uint32_t stream_freq;
-        uint32_t texture;
+        uint32_t texture; /* stateblocks only */
         uint16_t sampler[NINE_MAX_SAMPLERS];
         struct nine_range *vs_const_f;
         struct nine_range *ps_const_f;
diff --git a/src/gallium/state_trackers/nine/stateblock9.c b/src/gallium/state_trackers/nine/stateblock9.c
index 0a5641f..d04ac8f 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -581,7 +581,6 @@ NineStateBlock9_Apply( struct NineStateBlock9 *This )
     /* Textures */
     if (src->changed.texture) {
         uint32_t m = src->changed.texture;
-        dst->changed.texture |= m;
 
         dst->samplers_shadow &= ~m;
 
-- 
2.10.2



More information about the mesa-dev mailing list