It should be
last_index += D3DTS_WORLDMATRIX(0) - 10;

I drop this patch from the serie and patch 21/22 as they need more testing.

On 9/23/18 7:00 PM, Axel Davy wrote:
We avoid allocating space for never unused matrices.
However we must do as if we had captured them.
Thus when a D3DSBT_ALL stateblock apply has fewer matrices
than device state, allocate the default matrices for the stateblock
before applying.

Signed-off-by: Axel Davy <davyax...@gmail.com>
---
  src/gallium/state_trackers/nine/stateblock9.c | 10 ++++++++++
  1 file changed, 10 insertions(+)

diff --git a/src/gallium/state_trackers/nine/stateblock9.c 
b/src/gallium/state_trackers/nine/stateblock9.c
index ebfd622ff91..fd6f5d55677 100644
--- a/src/gallium/state_trackers/nine/stateblock9.c
+++ b/src/gallium/state_trackers/nine/stateblock9.c
@@ -494,6 +494,16 @@ nine_state_copy_common_all(struct NineDevice9 *device,
                  src->ff.num_transforms * sizeof(src->ff.transform[0]));
              dst->ff.num_transforms = src->ff.num_transforms;
          }
+        /* Alloc and init missing transforms */
+        if (dst->ff.num_transforms > src->ff.num_transforms) {
+            int last_index = dst->ff.num_transforms - 1;
+            /* There a hole in the indices we fill */
+            if (last_index >= 10)
+                last_index += D3DTS_WORLDMATRIX(0);
+            (void) nine_state_access_transform((struct nine_ff_state 
*)&src->ff,
+                                               last_index,
+                                               TRUE);
+        }
          memcpy(dst->ff.transform,
                 src->ff.transform, src->ff.num_transforms * sizeof(D3DMATRIX));
          if (apply) /* TODO: memset */


_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to