Zebediah Figura : wined3d: Store pixel shader floating point constants in the wined3d_stateblock_state structure.

Alexandre Julliard julliard at winehq.org
Tue Jan 29 15:18:16 CST 2019


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Mon Jan 28 23:09:11 2019 -0600

wined3d: Store pixel shader floating point constants 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          | 16 ++++++++++------
 dlls/wined3d/stateblock.c      |  7 ++++---
 dlls/wined3d/wined3d_private.h |  1 +
 3 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 28e113a..18c775a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2708,18 +2708,22 @@ HRESULT CDECL wined3d_device_set_ps_consts_f(struct wined3d_device *device,
             || count > d3d_info->limits.ps_uniform_count - start_idx)
         return WINED3DERR_INVALIDCALL;
 
-    memcpy(&device->update_state->ps_consts_f[start_idx], constants, count * sizeof(*constants));
+    memcpy(&device->update_stateblock_state->ps_consts_f[start_idx], constants, count * sizeof(*constants));
+    if (device->recording)
+    {
+        memset(&device->recording->changed.ps_consts_f[start_idx], 1,
+                count * sizeof(*device->recording->changed.ps_consts_f));
+        return WINED3D_OK;
+    }
+
+    memcpy(&device->state.ps_consts_f[start_idx], constants, count * sizeof(*constants));
     if (TRACE_ON(d3d))
     {
         for (i = 0; i < count; ++i)
             TRACE("Set vec4 constant %u to %s.\n", start_idx + i, debug_vec4(&constants[i]));
     }
 
-    if (device->recording)
-        memset(&device->recording->changed.ps_consts_f[start_idx], 1,
-                count * sizeof(*device->recording->changed.ps_consts_f));
-    else
-        wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_F, start_idx, count, constants);
+    wined3d_cs_push_constants(device->cs, WINED3D_PUSH_CONSTANTS_PS_F, start_idx, count, constants);
 
     return WINED3D_OK;
 }
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 2b916a9..05d213b 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -743,9 +743,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
     {
         unsigned int idx = stateblock->contained_ps_consts_f[i];
 
-        TRACE("Setting ps_consts_f[%u] to %s.\n", idx, debug_vec4(&src_state->ps_consts_f[idx]));
+        TRACE("Setting ps_consts_f[%u] to %s.\n", idx, debug_vec4(&state->ps_consts_f[idx]));
 
-        stateblock->state.ps_consts_f[idx] = src_state->ps_consts_f[idx];
+        stateblock->stateblock_state.ps_consts_f[idx] = state->ps_consts_f[idx];
     }
 
     /* Pixel shader integer constants. */
@@ -1045,8 +1045,9 @@ void CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
     /* Pixel Shader Constants. */
     for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i)
     {
+        state->ps_consts_f[i] = stateblock->stateblock_state.ps_consts_f[i];
         wined3d_device_set_ps_consts_f(device, stateblock->contained_ps_consts_f[i],
-                1, &stateblock->state.ps_consts_f[stateblock->contained_ps_consts_f[i]]);
+                1, &stateblock->stateblock_state.ps_consts_f[stateblock->contained_ps_consts_f[i]]);
     }
     for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i)
     {
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index b638d87..6822874 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2976,6 +2976,7 @@ struct wined3d_stateblock_state
     BOOL vs_consts_b[WINED3D_MAX_CONSTS_B];
 
     struct wined3d_shader *ps;
+    struct wined3d_vec4 ps_consts_f[WINED3D_MAX_PS_CONSTS_F];
 };
 
 struct wined3d_device




More information about the wine-cvs mailing list