[PATCH 2/7] wined3d: Fix stateblock viewports memcmp() size.

Matteo Bruni mbruni at codeweavers.com
Tue Apr 17 18:32:15 CDT 2018


Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
It shouldn't make any real difference in practice, since
viewport_count should never be more than 1 in the stateblock anyway.
Actually, I'm adding an assert to enforce the invariant.

 dlls/wined3d/stateblock.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 23a615fc08d..4ad0331f94b 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -810,9 +810,12 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
         stateblock->state.material = src_state->material;
     }
 
+    assert(src_state->viewport_count <= 1);
+
     if (stateblock->changed.viewport
             && (src_state->viewport_count != stateblock->state.viewport_count
-            || memcmp(src_state->viewports, stateblock->state.viewports, src_state->viewport_count * sizeof(stateblock->state.viewports))))
+            || memcmp(src_state->viewports, stateblock->state.viewports,
+            src_state->viewport_count * sizeof(*stateblock->state.viewports))))
     {
         TRACE("Updating viewports.\n");
 
-- 
2.13.6




More information about the wine-devel mailing list