[PATCH 5/5] wined3d: Store the instance count in the context structure

Stefan Dösinger stefan at codeweavers.com
Fri Sep 13 05:40:36 CDT 2013


---
 dlls/wined3d/drawprim.c        |  4 ++--
 dlls/wined3d/state.c           | 12 +++++-------
 dlls/wined3d/wined3d_private.h |  4 ++--
 3 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 81d2aba..3c9a780 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -676,8 +676,8 @@ void draw_primitive(struct wined3d_device *device, UINT start_idx, UINT index_co
     }
 
     stream_info = &context->stream_info;
-    if (device->instance_count)
-        instance_count = device->instance_count;
+    if (context->instance_count)
+        instance_count = context->instance_count;
 
     if (indexed)
     {
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
index 59c03a2..8ffd3e2 100644
--- a/dlls/wined3d/state.c
+++ b/dlls/wined3d/state.c
@@ -4060,13 +4060,12 @@ static void unload_numbered_arrays(struct wined3d_context *context)
 static void load_numbered_arrays(struct wined3d_context *context,
         const struct wined3d_stream_info *stream_info, const struct wined3d_state *state)
 {
-    struct wined3d_device *device = context->swapchain->device;
     const struct wined3d_gl_info *gl_info = context->gl_info;
     GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
     int i;
 
     /* Default to no instancing */
-    device->instance_count = 0;
+    context->instance_count = 0;
 
     for (i = 0; i < MAX_ATTRIBS; i++)
     {
@@ -4085,8 +4084,8 @@ static void load_numbered_arrays(struct wined3d_context *context,
 
         if (stream->flags & WINED3DSTREAMSOURCE_INSTANCEDATA)
         {
-            if (!device->instance_count)
-                device->instance_count = state->streams[0].frequency ? state->streams[0].frequency : 1;
+            if (!context->instance_count)
+                context->instance_count = state->streams[0].frequency ? state->streams[0].frequency : 1;
 
             if (!gl_info->supported[ARB_INSTANCED_ARRAYS])
             {
@@ -4232,10 +4231,9 @@ static void load_numbered_arrays(struct wined3d_context *context,
     checkGLcall("Loading numbered arrays");
 }
 
-static void load_vertex_data(const struct wined3d_context *context,
+static void load_vertex_data(struct wined3d_context *context,
         const struct wined3d_stream_info *si, const struct wined3d_state *state)
 {
-    struct wined3d_device *device = context->swapchain->device;
     const struct wined3d_gl_info *gl_info = context->gl_info;
     GLuint curVBO = gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] ? ~0U : 0;
     const struct wined3d_stream_info_element *e;
@@ -4243,7 +4241,7 @@ static void load_vertex_data(const struct wined3d_context *context,
     TRACE("Using fast vertex array code\n");
 
     /* This is fixed function pipeline only, and the fixed function pipeline doesn't do instancing */
-    device->instance_count = 0;
+    context->instance_count = 0;
 
     /* Blend Data ---------------------------------------------- */
     if ((si->use_map & (1 << WINED3D_FFP_BLENDWEIGHT))
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2b3e5dd..273a194 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1098,6 +1098,8 @@ struct wined3d_context
     DWORD active_texture;
     DWORD texture_type[MAX_COMBINED_SAMPLERS];
 
+    UINT instance_count;
+
     /* The actual opengl context */
     UINT level;
     HGLRC restore_ctx;
@@ -1885,8 +1887,6 @@ struct wined3d_device
     APPLYSTATEFUNC *multistate_funcs[STATE_HIGHEST + 1];
     const struct blit_shader *blitter;
 
-    UINT instance_count;
-
     BYTE vertexBlendUsed : 1;           /* To avoid needless setting of the blend matrices */
     BYTE bCursorVisible : 1;
     BYTE d3d_initialized : 1;
-- 
1.8.1.5




More information about the wine-patches mailing list