[PATCH 1/4] wined3d: Move the primitive type to wined3d_state.

Henri Verbeet hverbeet at codeweavers.com
Tue Sep 21 14:20:53 CDT 2010


---
 dlls/wined3d/device.c          |   10 +++++-----
 dlls/wined3d/drawprim.c        |    4 ++--
 dlls/wined3d/stateblock.c      |    4 ++--
 dlls/wined3d/wined3d_private.h |    4 +---
 4 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index c37be12..c7dbe04 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4655,7 +4655,7 @@ static void WINAPI IWineD3DDeviceImpl_SetPrimitiveType(IWineD3DDevice *iface,
     TRACE("iface %p, primitive_type %s\n", iface, debug_d3dprimitivetype(primitive_type));
 
     This->updateStateBlock->changed.primitive_type = TRUE;
-    This->updateStateBlock->gl_primitive_type = gl_primitive_type_from_d3d(primitive_type);
+    This->updateStateBlock->state.gl_primitive_type = gl_primitive_type_from_d3d(primitive_type);
 }
 
 static void WINAPI IWineD3DDeviceImpl_GetPrimitiveType(IWineD3DDevice *iface,
@@ -4665,7 +4665,7 @@ static void WINAPI IWineD3DDeviceImpl_GetPrimitiveType(IWineD3DDevice *iface,
 
     TRACE("iface %p, primitive_type %p\n", iface, primitive_type);
 
-    *primitive_type = d3d_primitive_type_from_gl(This->stateBlock->gl_primitive_type);
+    *primitive_type = d3d_primitive_type_from_gl(This->stateBlock->state.gl_primitive_type);
 
     TRACE("Returning %s\n", debug_d3dprimitivetype(*primitive_type));
 }
@@ -5513,10 +5513,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_DrawRectPatch(IWineD3DDevice *iface, UI
     }
 
     This->currentPatch = patch;
-    old_primitive_type = This->stateBlock->gl_primitive_type;
-    This->stateBlock->gl_primitive_type = GL_TRIANGLES;
+    old_primitive_type = This->stateBlock->state.gl_primitive_type;
+    This->stateBlock->state.gl_primitive_type = GL_TRIANGLES;
     IWineD3DDevice_DrawPrimitiveStrided(iface, patch->numSegs[0] * patch->numSegs[1] * 2 * 3, &patch->strided);
-    This->stateBlock->gl_primitive_type = old_primitive_type;
+    This->stateBlock->state.gl_primitive_type = old_primitive_type;
     This->currentPatch = NULL;
 
     /* Destroy uncached patches */
diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c
index 80cbf30..6ff8b32 100644
--- a/dlls/wined3d/drawprim.c
+++ b/dlls/wined3d/drawprim.c
@@ -651,7 +651,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
             || (!glPointParameteri && !context->gl_info->supported[NV_POINT_SPRITE]))
             && context->render_offscreen
             && This->stateBlock->state.render_states[WINED3DRS_POINTSPRITEENABLE]
-            && This->stateBlock->gl_primitive_type == GL_POINTS)
+            && This->stateBlock->state.gl_primitive_type == GL_POINTS)
     {
         FIXME("Point sprite coordinate origin switching not supported.\n");
     }
@@ -659,7 +659,7 @@ void drawPrimitive(IWineD3DDevice *iface, UINT index_count, UINT StartIdx, UINT
     /* Ok, we will be updating the screen from here onwards so grab the lock */
     ENTER_GL();
     {
-        GLenum glPrimType = This->stateBlock->gl_primitive_type;
+        GLenum glPrimType = This->stateBlock->state.gl_primitive_type;
         BOOL emulation = FALSE;
         const struct wined3d_stream_info *stream_info = &This->strided_streams;
         struct wined3d_stream_info stridedlcl;
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 900836d..82e6081 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -718,7 +718,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
         This->state.transforms[transform] = targetStateBlock->state.transforms[transform];
     }
 
-    if (This->changed.primitive_type) This->gl_primitive_type = targetStateBlock->gl_primitive_type;
+    if (This->changed.primitive_type) This->state.gl_primitive_type = targetStateBlock->state.gl_primitive_type;
 
     if (This->changed.indices
             && ((This->state.index_buffer != targetStateBlock->state.index_buffer)
@@ -995,7 +995,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
     if (This->changed.primitive_type)
     {
         This->device->updateStateBlock->changed.primitive_type = TRUE;
-        This->device->updateStateBlock->gl_primitive_type = This->gl_primitive_type;
+        This->device->updateStateBlock->state.gl_primitive_type = This->state.gl_primitive_type;
     }
 
     if (This->changed.indices)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index ee3573d..bc6a1a9 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2356,6 +2356,7 @@ struct wined3d_state
     enum wined3d_format_id index_format;
     INT base_vertex_index;
     INT load_base_vertex_index; /* Non-indexed drawing needs 0 here, indexed needs base_vertex_index. */
+    GLenum gl_primitive_type;
 
     struct IWineD3DVertexShaderImpl *vertex_shader;
     BOOL vs_consts_b[MAX_CONST_B];
@@ -2394,9 +2395,6 @@ struct IWineD3DStateBlockImpl
     SAVEDSTATES               changed;
     struct wined3d_state state;
 
-    /* primitive type */
-    GLenum gl_primitive_type;
-
     /* Light hashmap . Collisions are handled using standard wine double linked lists */
 #define LIGHTMAP_SIZE 43 /* Use of a prime number recommended. Set to 1 for a linked list! */
 #define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE) /* Primitive and simple function */
-- 
1.7.2.2




More information about the wine-patches mailing list