[PATCH 3/5] wined3d: Store the material in the wined3d_stateblock_state structure.

Zebediah Figura z.figura12 at gmail.com
Tue Feb 5 22:04:54 CST 2019


Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
---
 dlls/wined3d/device.c          | 11 +++++++----
 dlls/wined3d/stateblock.c      | 10 +++++++---
 dlls/wined3d/wined3d_private.h |  1 +
 3 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d7b5bbc000..6472697d08 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -1831,12 +1831,15 @@ void CDECL wined3d_device_set_material(struct wined3d_device *device, const stru
 {
     TRACE("device %p, material %p.\n", device, material);
 
-    device->update_state->material = *material;
-
+    device->update_stateblock_state->material = *material;
     if (device->recording)
+    {
         device->recording->changed.material = TRUE;
-    else
-        wined3d_cs_emit_set_material(device->cs, material);
+        return;
+    }
+
+    device->state.material = *material;
+    wined3d_cs_emit_set_material(device->cs, material);
 }
 
 void CDECL wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material)
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 55cf0e64a2..75f2883197 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -822,11 +822,12 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
     }
 
     if (stateblock->changed.material
-            && memcmp(&src_state->material, &stateblock->state.material, sizeof(stateblock->state.material)))
+            && memcmp(&state->material, &stateblock->stateblock_state.material,
+            sizeof(stateblock->stateblock_state.material)))
     {
         TRACE("Updating material.\n");
 
-        stateblock->state.material = src_state->material;
+        stateblock->stateblock_state.material = state->material;
     }
 
     assert(src_state->viewport_count <= 1);
@@ -1127,7 +1128,10 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
         wined3d_device_set_vertex_declaration(device, stateblock->state.vertex_declaration);
 
     if (stateblock->changed.material)
-        wined3d_device_set_material(device, &stateblock->state.material);
+    {
+        state->material = stateblock->stateblock_state.material;
+        wined3d_device_set_material(device, &stateblock->stateblock_state.material);
+    }
 
     if (stateblock->changed.viewport)
         wined3d_device_set_viewports(device, stateblock->state.viewport_count, stateblock->state.viewports);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 647ef90e19..d4cbeaa194 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2988,6 +2988,7 @@ struct wined3d_stateblock_state
 
     struct wined3d_matrix transforms[HIGHEST_TRANSFORMSTATE + 1];
     struct wined3d_vec4 clip_planes[MAX_CLIP_DISTANCES];
+    struct wined3d_material material;
 };
 
 struct wined3d_device
-- 
2.20.1




More information about the wine-devel mailing list