[PATCH 5/5] wined3d: Get rid of the WINED3DVERTEXELEMENT typedef.

Henri Verbeet hverbeet at codeweavers.com
Thu Nov 24 15:52:36 CST 2011


---
 dlls/d3d10core/inputlayout.c     |    6 +++---
 dlls/d3d8/vertexdeclaration.c    |    8 ++++----
 dlls/d3d9/vertexdeclaration.c    |    8 ++++----
 dlls/wined3d/vertexdeclaration.c |   19 ++++++++++---------
 include/wine/wined3d.h           |    6 +++---
 5 files changed, 24 insertions(+), 23 deletions(-)

diff --git a/dlls/d3d10core/inputlayout.c b/dlls/d3d10core/inputlayout.c
index 7bf67f6..dfc4ad7 100644
--- a/dlls/d3d10core/inputlayout.c
+++ b/dlls/d3d10core/inputlayout.c
@@ -42,7 +42,7 @@ static HRESULT isgn_handler(const char *data, DWORD data_size, DWORD tag, void *
 
 static HRESULT d3d10_input_layout_to_wined3d_declaration(const D3D10_INPUT_ELEMENT_DESC *element_descs,
         UINT element_count, const void *shader_byte_code, SIZE_T shader_byte_code_length,
-        WINED3DVERTEXELEMENT **wined3d_elements, UINT *wined3d_element_count)
+        struct wined3d_vertex_element **wined3d_elements, UINT *wined3d_element_count)
 {
     struct wined3d_shader_signature is;
     HRESULT hr;
@@ -73,7 +73,7 @@ static HRESULT d3d10_input_layout_to_wined3d_declaration(const D3D10_INPUT_ELEME
             if (!strcmp(element_descs[i].SemanticName, is.elements[j].semantic_name)
                     && element_descs[i].SemanticIndex == is.elements[j].semantic_idx)
             {
-                WINED3DVERTEXELEMENT *e = &(*wined3d_elements)[(*wined3d_element_count)++];
+                struct wined3d_vertex_element *e = &(*wined3d_elements)[(*wined3d_element_count)++];
                 const D3D10_INPUT_ELEMENT_DESC *f = &element_descs[i];
 
                 e->format = wined3dformat_from_dxgi_format(f->Format);
@@ -218,7 +218,7 @@ HRESULT d3d10_input_layout_init(struct d3d10_input_layout *layout, struct d3d10_
         const D3D10_INPUT_ELEMENT_DESC *element_descs, UINT element_count,
         const void *shader_byte_code, SIZE_T shader_byte_code_length)
 {
-    WINED3DVERTEXELEMENT *wined3d_elements;
+    struct wined3d_vertex_element *wined3d_elements;
     UINT wined3d_element_count;
     HRESULT hr;
 
diff --git a/dlls/d3d8/vertexdeclaration.c b/dlls/d3d8/vertexdeclaration.c
index b972a21..7ca8783 100644
--- a/dlls/d3d8/vertexdeclaration.c
+++ b/dlls/d3d8/vertexdeclaration.c
@@ -303,10 +303,10 @@ static const wined3d_usage_t wined3d_usage_lookup[] = {
 
 /* TODO: find out where rhw (or positionT) is for declaration8 */
 static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size,
-        WINED3DVERTEXELEMENT **wined3d_elements)
+        struct wined3d_vertex_element **wined3d_elements)
 {
+    struct wined3d_vertex_element *element;
     const DWORD *token = d3d8_elements;
-    WINED3DVERTEXELEMENT *element;
     D3DVSD_TOKENTYPE token_type;
     unsigned int element_count = 0;
     WORD stream = 0;
@@ -315,7 +315,7 @@ static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3
     TRACE("d3d8_elements %p, wined3d_elements %p\n", d3d8_elements, wined3d_elements);
 
     /* 128 should be enough for anyone... */
-    *wined3d_elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 128 * sizeof(WINED3DVERTEXELEMENT));
+    *wined3d_elements = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 128 * sizeof(**wined3d_elements));
     while (D3DVSD_END() != *token)
     {
         token_type = ((*token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT);
@@ -380,7 +380,7 @@ static const struct wined3d_parent_ops d3d8_vertexdeclaration_wined3d_parent_ops
 HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
         IDirect3DDevice8Impl *device, const DWORD *elements, DWORD shader_handle)
 {
-    WINED3DVERTEXELEMENT *wined3d_elements;
+    struct wined3d_vertex_element *wined3d_elements;
     UINT wined3d_element_count;
     HRESULT hr;
 
diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c
index 6224614..3b2198e 100644
--- a/dlls/d3d9/vertexdeclaration.c
+++ b/dlls/d3d9/vertexdeclaration.c
@@ -320,8 +320,8 @@ static const struct wined3d_parent_ops d3d9_vertexdeclaration_wined3d_parent_ops
     d3d9_vertexdeclaration_wined3d_object_destroyed,
 };
 
-static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9* d3d9_elements,
-        WINED3DVERTEXELEMENT **wined3d_elements, UINT *element_count)
+static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9 *d3d9_elements,
+        struct wined3d_vertex_element **wined3d_elements, UINT *element_count)
 {
     const D3DVERTEXELEMENT9* element;
     UINT count = 1;
@@ -337,7 +337,7 @@ static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9* d3d9_elem
     /* Skip the END element */
     --count;
 
-    *wined3d_elements = HeapAlloc(GetProcessHeap(), 0, count * sizeof(WINED3DVERTEXELEMENT));
+    *wined3d_elements = HeapAlloc(GetProcessHeap(), 0, count * sizeof(**wined3d_elements));
     if (!*wined3d_elements) {
         FIXME("Memory allocation failed\n");
         return D3DERR_OUTOFVIDEOMEMORY;
@@ -368,7 +368,7 @@ static HRESULT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9* d3d9_elem
 HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration9Impl *declaration,
         IDirect3DDevice9Impl *device, const D3DVERTEXELEMENT9 *elements)
 {
-    WINED3DVERTEXELEMENT *wined3d_elements;
+    struct wined3d_vertex_element *wined3d_elements;
     UINT wined3d_element_count;
     UINT element_count;
     HRESULT hr;
diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c
index d5eae16..576fe7c 100644
--- a/dlls/wined3d/vertexdeclaration.c
+++ b/dlls/wined3d/vertexdeclaration.c
@@ -27,7 +27,8 @@
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3d_decl);
 
-static void dump_wined3dvertexelement(const WINED3DVERTEXELEMENT *element) {
+static void dump_wined3d_vertex_element(const struct wined3d_vertex_element *element)
+{
     TRACE("     format: %s (%#x)\n", debug_d3dformat(element->format), element->format);
     TRACE(" input_slot: %u\n", element->input_slot);
     TRACE("     offset: %u\n", element->offset);
@@ -69,7 +70,7 @@ void * CDECL wined3d_vertex_declaration_get_parent(const struct wined3d_vertex_d
     return declaration->parent;
 }
 
-static BOOL declaration_element_valid_ffp(const WINED3DVERTEXELEMENT *element)
+static BOOL declaration_element_valid_ffp(const struct wined3d_vertex_element *element)
 {
     switch(element->usage)
     {
@@ -158,7 +159,7 @@ static BOOL declaration_element_valid_ffp(const WINED3DVERTEXELEMENT *element)
 }
 
 static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declaration,
-        struct wined3d_device *device, const WINED3DVERTEXELEMENT *elements, UINT element_count,
+        struct wined3d_device *device, const struct wined3d_vertex_element *elements, UINT element_count,
         void *parent, const struct wined3d_parent_ops *parent_ops)
 {
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -169,7 +170,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
     {
         for (i = 0; i < element_count; ++i)
         {
-            dump_wined3dvertexelement(elements + i);
+            dump_wined3d_vertex_element(elements + i);
         }
     }
 
@@ -238,7 +239,7 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
 }
 
 HRESULT CDECL wined3d_vertex_declaration_create(struct wined3d_device *device,
-        const WINED3DVERTEXELEMENT *elements, UINT element_count, void *parent,
+        const struct wined3d_vertex_element *elements, UINT element_count, void *parent,
         const struct wined3d_parent_ops *parent_ops, struct wined3d_vertex_declaration **declaration)
 {
     struct wined3d_vertex_declaration *object;
@@ -271,7 +272,7 @@ HRESULT CDECL wined3d_vertex_declaration_create(struct wined3d_device *device,
 struct wined3d_fvf_convert_state
 {
     const struct wined3d_gl_info *gl_info;
-    WINED3DVERTEXELEMENT *elements;
+    struct wined3d_vertex_element *elements;
     UINT offset;
     UINT idx;
 };
@@ -279,7 +280,7 @@ struct wined3d_fvf_convert_state
 static void append_decl_element(struct wined3d_fvf_convert_state *state,
         enum wined3d_format_id format_id, WINED3DDECLUSAGE usage, UINT usage_idx)
 {
-    WINED3DVERTEXELEMENT *elements = state->elements;
+    struct wined3d_vertex_element *elements = state->elements;
     const struct wined3d_format *format;
     UINT offset = state->offset;
     UINT idx = state->idx;
@@ -298,7 +299,7 @@ static void append_decl_element(struct wined3d_fvf_convert_state *state,
 }
 
 static unsigned int convert_fvf_to_declaration(const struct wined3d_gl_info *gl_info,
-        DWORD fvf, WINED3DVERTEXELEMENT **elements)
+        DWORD fvf, struct wined3d_vertex_element **elements)
 {
     BOOL has_pos = !!(fvf & WINED3DFVF_POSITION_MASK);
     BOOL has_blend = (fvf & WINED3DFVF_XYZB5) > WINED3DFVF_XYZRHW;
@@ -408,7 +409,7 @@ HRESULT CDECL wined3d_vertex_declaration_create_from_fvf(struct wined3d_device *
         DWORD fvf, void *parent, const struct wined3d_parent_ops *parent_ops,
         struct wined3d_vertex_declaration **declaration)
 {
-    WINED3DVERTEXELEMENT *elements;
+    struct wined3d_vertex_element *elements;
     unsigned int size;
     DWORD hr;
 
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index a68e0d3..420c2ca 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -1673,7 +1673,7 @@ struct wined3d_clip_status
    DWORD clip_intersection;
 };
 
-typedef struct _WINED3DVERTEXELEMENT
+struct wined3d_vertex_element
 {
     enum wined3d_format_id format;
     WORD input_slot;
@@ -1682,7 +1682,7 @@ typedef struct _WINED3DVERTEXELEMENT
     BYTE method;
     BYTE usage;
     BYTE usage_idx;
-} WINED3DVERTEXELEMENT;
+};
 
 typedef struct _WINED3DDEVICE_CREATION_PARAMETERS
 {
@@ -2502,7 +2502,7 @@ DWORD __cdecl wined3d_texture_set_lod(struct wined3d_texture *texture, DWORD lod
 DWORD __cdecl wined3d_texture_set_priority(struct wined3d_texture *texture, DWORD priority);
 
 HRESULT __cdecl wined3d_vertex_declaration_create(struct wined3d_device *device,
-        const WINED3DVERTEXELEMENT *elements, UINT element_count, void *parent,
+        const struct wined3d_vertex_element *elements, UINT element_count, void *parent,
         const struct wined3d_parent_ops *parent_ops, struct wined3d_vertex_declaration **declaration);
 HRESULT __cdecl wined3d_vertex_declaration_create_from_fvf(struct wined3d_device *device,
         DWORD fvf, void *parent, const struct wined3d_parent_ops *parent_ops,
-- 
1.7.3.4




More information about the wine-patches mailing list