Zebediah Figura : wined3d: Store the material in the wined3d_stateblock_state structure.

Alexandre Julliard julliard at winehq.org
Wed Feb 6 15:32:29 CST 2019


Module: wine
Branch: master
Commit: 88d017aa7df3b175ca30af607328a0acdab897e6
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=88d017aa7df3b175ca30af607328a0acdab897e6

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue Feb  5 23:01:06 2019 -0600

wined3d: Store the material in the wined3d_stateblock_state structure.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 e912154..d06ac9c 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 d330821..cf4f7d1 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 d9237e6..6091d21 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




More information about the wine-cvs mailing list