[PATCH v2 1/2] wined3d: Return 1 for stream frequency if the value was not set.

Paul Gofman gofmanp at gmail.com
Fri Feb 8 10:34:13 CST 2019


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=39080
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
---
v2:
    - initialize streams' frequencies to 1 instead of handling uninitialized case.

 dlls/wined3d/context.c    | 2 +-
 dlls/wined3d/stateblock.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index c7eb7849fc..ae94daba2e 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -5390,7 +5390,7 @@ static void context_load_numbered_arrays(struct wined3d_context *context,
         stream = &state->streams[element->stream_idx];
 
         if ((stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA) && !context->instance_count)
-            context->instance_count = state->streams[0].frequency ? state->streams[0].frequency : 1;
+            context->instance_count = state->streams[0].frequency;
 
         if (gl_info->supported[ARB_INSTANCED_ARRAYS])
         {
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index b694414382..9da99d7302 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -1448,6 +1448,9 @@ static void state_init_default(struct wined3d_state *state, const struct wined3d
     state->blend_factor.g = 1.0f;
     state->blend_factor.b = 1.0f;
     state->blend_factor.a = 1.0f;
+
+    for (i = 0; i < MAX_STREAMS; ++i)
+        state->streams[i].frequency = 1;
 }
 
 void state_init(struct wined3d_state *state, struct wined3d_fb_state *fb,
@@ -1496,6 +1499,9 @@ static void stateblock_state_init_default(struct wined3d_stateblock_state *state
     state->blend_factor.g = 1.0f;
     state->blend_factor.b = 1.0f;
     state->blend_factor.a = 1.0f;
+
+    for (i = 0; i < MAX_STREAMS; ++i)
+        state->streams[i].frequency = 1;
 }
 
 void wined3d_stateblock_state_init(struct wined3d_stateblock_state *state,
-- 
2.20.1




More information about the wine-devel mailing list