[PATCH 2/5] wined3d: Pass an IWineD3DDeviceImpl pointer to shader_update_float_vertex_constants().

Henri Verbeet hverbeet at codeweavers.com
Tue Nov 30 11:39:37 CST 2010


---
 dlls/wined3d/arb_program_shader.c |    7 +++----
 dlls/wined3d/device.c             |    2 +-
 dlls/wined3d/glsl_shader.c        |    9 ++++-----
 dlls/wined3d/shader.c             |    2 +-
 dlls/wined3d/wined3d_private.h    |   15 +++++++--------
 5 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c
index 32dbaa3..502dfec 100644
--- a/dlls/wined3d/arb_program_shader.c
+++ b/dlls/wined3d/arb_program_shader.c
@@ -653,17 +653,16 @@ static void shader_arb_load_constants(const struct wined3d_context *context, cha
     }
 }
 
-static void shader_arb_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count)
+static void shader_arb_update_float_vertex_constants(IWineD3DDeviceImpl *device, UINT start, UINT count)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
     struct wined3d_context *context = context_get_current();
 
     /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active
      * context. On a context switch the old context will be fully dirtified */
-    if (!context || context->swapchain->device != This) return;
+    if (!context || context->swapchain->device != device) return;
 
     memset(context->vshader_const_dirty + start, 1, sizeof(*context->vshader_const_dirty) * count);
-    This->highest_dirty_vs_const = max(This->highest_dirty_vs_const, start + count);
+    device->highest_dirty_vs_const = max(device->highest_dirty_vs_const, start + count);
 }
 
 static void shader_arb_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 5e8c8cc..02c79da 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3460,7 +3460,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF(
 
     if (!This->isRecordingState)
     {
-        This->shader_backend->shader_update_float_vertex_constants(iface, start, count);
+        This->shader_backend->shader_update_float_vertex_constants(This, start, count);
         IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT);
     }
 
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 992b6bb..2d2df26 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -4,7 +4,7 @@
  * Copyright 2006 Jason Green
  * Copyright 2006-2007 Henri Verbeet
  * Copyright 2007-2008 Stefan Dösinger for CodeWeavers
- * Copyright 2009 Henri Verbeet for CodeWeavers
+ * Copyright 2009-2010 Henri Verbeet for CodeWeavers
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -863,16 +863,15 @@ static inline void update_heap_entry(struct constant_heap *heap, unsigned int id
     positions[idx] = heap_idx;
 }
 
-static void shader_glsl_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count)
+static void shader_glsl_update_float_vertex_constants(IWineD3DDeviceImpl *device, UINT start, UINT count)
 {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    struct shader_glsl_priv *priv = This->shader_priv;
+    struct shader_glsl_priv *priv = device->shader_priv;
     struct constant_heap *heap = &priv->vconst_heap;
     UINT i;
 
     for (i = start; i < count + start; ++i)
     {
-        if (!This->stateBlock->changed.vertexShaderConstantsF[i])
+        if (!device->stateBlock->changed.vertexShaderConstantsF[i])
             update_heap_entry(heap, i, heap->size++, priv->next_constant_version);
         else
             update_heap_entry(heap, i, heap->positions[i], priv->next_constant_version);
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index ed37fe1..0962eef 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1513,7 +1513,7 @@ static void shader_none_select(const struct wined3d_context *context, BOOL usePS
 static void shader_none_select_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info,
         enum tex_types tex_type, const SIZE *ds_mask_size) {}
 static void shader_none_deselect_depth_blt(void *shader_priv, const struct wined3d_gl_info *gl_info) {}
-static void shader_none_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) {}
+static void shader_none_update_float_vertex_constants(IWineD3DDeviceImpl *device, UINT start, UINT count) {}
 static void shader_none_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) {}
 static void shader_none_load_constants(const struct wined3d_context *context, char usePS, char useVS) {}
 static void shader_none_load_np2fixup_constants(void *shader_priv,
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 48dc21c..7cb6c78 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -52,6 +52,12 @@
 #define WINED3D_QUIRK_NV_CLIP_BROKEN            0x00000010
 #define WINED3D_QUIRK_FBO_TEX_UPDATE            0x00000020
 
+typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
+typedef struct IWineD3DSurfaceImpl    IWineD3DSurfaceImpl;
+typedef struct IWineD3DPaletteImpl    IWineD3DPaletteImpl;
+typedef struct IWineD3DDeviceImpl     IWineD3DDeviceImpl;
+typedef struct IWineD3DSwapChainImpl  IWineD3DSwapChainImpl;
+
 /* Texture format fixups */
 
 enum fixup_channel_source
@@ -747,7 +753,7 @@ typedef struct {
     void (*shader_select_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info,
             enum tex_types tex_type, const SIZE *ds_mask_size);
     void (*shader_deselect_depth_blt)(void *shader_priv, const struct wined3d_gl_info *gl_info);
-    void (*shader_update_float_vertex_constants)(IWineD3DDevice *iface, UINT start, UINT count);
+    void (*shader_update_float_vertex_constants)(IWineD3DDeviceImpl *device, UINT start, UINT count);
     void (*shader_update_float_pixel_constants)(IWineD3DDevice *iface, UINT start, UINT count);
     void (*shader_load_constants)(const struct wined3d_context *context, char usePS, char useVS);
     void (*shader_load_np2fixup_constants)(void *shader_priv, const struct wined3d_gl_info *gl_info,
@@ -848,13 +854,6 @@ do {
         si->elements[name].data, si->elements[name].stride, si->elements[name].format->id, \
         si->elements[name].buffer_object, si->elements[name].stream_idx); } while(0)
 
-/* Advance declaration of structures to satisfy compiler */
-typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
-typedef struct IWineD3DSurfaceImpl    IWineD3DSurfaceImpl;
-typedef struct IWineD3DPaletteImpl    IWineD3DPaletteImpl;
-typedef struct IWineD3DDeviceImpl     IWineD3DDeviceImpl;
-typedef struct IWineD3DSwapChainImpl  IWineD3DSwapChainImpl;
-
 /* Global variables */
 extern const float identity[16] DECLSPEC_HIDDEN;
 
-- 
1.7.2.2




More information about the wine-patches mailing list