[PATCH 10/10] wined3d: Get rid of the WINED3DSTATEBLOCKTYPE typedef.

Henri Verbeet hverbeet at codeweavers.com
Tue Jan 17 14:13:39 CST 2012


---
 dlls/d3d8/device.c             |    2 +-
 dlls/d3d9/stateblock.c         |    2 +-
 dlls/ddraw/ddraw.c             |    2 +-
 dlls/wined3d/device.c          |    6 +++---
 dlls/wined3d/stateblock.c      |   20 ++++++++++----------
 dlls/wined3d/wined3d_private.h |    2 +-
 include/wine/wined3d.h         |   17 ++++++++---------
 7 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index e631cec..91942e1 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1622,7 +1622,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *if
     }
 
     wined3d_mutex_lock();
-    hr = wined3d_stateblock_create(This->wined3d_device, (WINED3DSTATEBLOCKTYPE)Type, &stateblock);
+    hr = wined3d_stateblock_create(This->wined3d_device, (enum wined3d_stateblock_type)Type, &stateblock);
     if (FAILED(hr))
     {
         wined3d_mutex_unlock();
diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c
index 06f8aed..6ecf596 100644
--- a/dlls/d3d9/stateblock.c
+++ b/dlls/d3d9/stateblock.c
@@ -150,7 +150,7 @@ HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Im
     {
         wined3d_mutex_lock();
         hr = wined3d_stateblock_create(device->wined3d_device,
-                (WINED3DSTATEBLOCKTYPE)type, &stateblock->wined3d_stateblock);
+                (enum wined3d_stateblock_type)type, &stateblock->wined3d_stateblock);
         wined3d_mutex_unlock();
         if (FAILED(hr))
         {
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index afe6c32..5099114 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -922,7 +922,7 @@ static HRESULT WINAPI ddraw7_SetCooperativeLevel(IDirectDraw7 *iface, HWND hwnd,
         {
             restore_state = TRUE;
 
-            if (FAILED(hr = wined3d_stateblock_create(This->wined3d_device, WINED3DSBT_ALL, &stateblock)))
+            if (FAILED(hr = wined3d_stateblock_create(This->wined3d_device, WINED3D_SBT_ALL, &stateblock)))
             {
                 ERR("Failed to create stateblock, hr %#x.\n", hr);
                 wined3d_mutex_unlock();
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 075b0bf5..6595422 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3915,7 +3915,7 @@ HRESULT CDECL wined3d_device_begin_stateblock(struct wined3d_device *device)
     if (device->isRecordingState)
         return WINED3DERR_INVALIDCALL;
 
-    hr = wined3d_stateblock_create(device, WINED3DSBT_RECORDED, &stateblock);
+    hr = wined3d_stateblock_create(device, WINED3D_SBT_RECORDED, &stateblock);
     if (FAILED(hr))
         return hr;
 
@@ -5609,7 +5609,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
     }
 
     /* Note: No parent needed for initial internal stateblock */
-    hr = wined3d_stateblock_create(device, WINED3DSBT_INIT, &device->stateBlock);
+    hr = wined3d_stateblock_create(device, WINED3D_SBT_INIT, &device->stateBlock);
     if (FAILED(hr))
         ERR("Resetting the stateblock failed with error %#x.\n", hr);
     else
@@ -5902,7 +5902,7 @@ HRESULT device_init(struct wined3d_device *device, struct wined3d *wined3d,
     }
     device->blitter = adapter->blitter;
 
-    hr = wined3d_stateblock_create(device, WINED3DSBT_INIT, &device->stateBlock);
+    hr = wined3d_stateblock_create(device, WINED3D_SBT_INIT, &device->stateBlock);
     if (FAILED(hr))
     {
         WARN("Failed to create stateblock.\n");
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index 59bb841..b00fb84 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -924,8 +924,8 @@ HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblo
     unsigned int i;
     DWORD map;
 
-    TRACE("Applying stateblock %p to device %p.\n", stateblock, device);
-    TRACE("Blocktype: %#x.\n", stateblock->blockType);
+    TRACE("Applying stateblock %p of type %#x to device %p.\n",
+            stateblock, stateblock->blockType, device);
 
     if (stateblock->changed.vertexShader)
         wined3d_device_set_vertex_shader(device, stateblock->state.vertex_shader);
@@ -1105,7 +1105,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
 
     TRACE("stateblock %p.\n", stateblock);
 
-    stateblock->blockType = WINED3DSBT_INIT;
+    stateblock->blockType = WINED3D_SBT_INIT;
 
     memset(stateblock->changed.pixelShaderConstantsF, 0, device->d3d_pshader_constantF * sizeof(BOOL));
     memset(stateblock->changed.vertexShaderConstantsF, 0, device->d3d_vshader_constantF * sizeof(BOOL));
@@ -1337,7 +1337,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
 }
 
 static HRESULT stateblock_init(struct wined3d_stateblock *stateblock,
-        struct wined3d_device *device, WINED3DSTATEBLOCKTYPE type)
+        struct wined3d_device *device, enum wined3d_stateblock_type type)
 {
     unsigned int i;
     HRESULT hr;
@@ -1354,26 +1354,26 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock,
     hr = stateblock_allocate_shader_constants(stateblock);
     if (FAILED(hr)) return hr;
 
-    /* The WINED3DSBT_INIT stateblock type is used during initialization to
+    /* The WINED3D_SBT_INIT stateblock type is used during initialization to
      * produce a placeholder stateblock so other functions called can update a
      * state block. */
-    if (type == WINED3DSBT_INIT || type == WINED3DSBT_RECORDED) return WINED3D_OK;
+    if (type == WINED3D_SBT_INIT || type == WINED3D_SBT_RECORDED) return WINED3D_OK;
 
     TRACE("Updating changed flags appropriate for type %#x.\n", type);
 
     switch (type)
     {
-        case WINED3DSBT_ALL:
+        case WINED3D_SBT_ALL:
             stateblock_init_lights(stateblock, device->stateBlock->state.light_map);
             stateblock_savedstates_set_all(&stateblock->changed, device->d3d_vshader_constantF,
                                            device->d3d_pshader_constantF);
             break;
 
-        case WINED3DSBT_PIXELSTATE:
+        case WINED3D_SBT_PIXEL_STATE:
             stateblock_savedstates_set_pixel(&stateblock->changed, device->d3d_pshader_constantF);
             break;
 
-        case WINED3DSBT_VERTEXSTATE:
+        case WINED3D_SBT_VERTEX_STATE:
             stateblock_init_lights(stateblock, device->stateBlock->state.light_map);
             stateblock_savedstates_set_vertex(&stateblock->changed, device->d3d_vshader_constantF);
             break;
@@ -1390,7 +1390,7 @@ static HRESULT stateblock_init(struct wined3d_stateblock *stateblock,
 }
 
 HRESULT CDECL wined3d_stateblock_create(struct wined3d_device *device,
-        WINED3DSTATEBLOCKTYPE type, struct wined3d_stateblock **stateblock)
+        enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock)
 {
     struct wined3d_stateblock *object;
     HRESULT hr;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 08a1bac..c9d1208 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2310,7 +2310,7 @@ struct wined3d_stateblock
 {
     LONG                      ref;     /* Note: Ref counting not required */
     struct wined3d_device *device;
-    WINED3DSTATEBLOCKTYPE     blockType;
+    enum wined3d_stateblock_type blockType;
 
     /* Array indicating whether things have been set or changed */
     struct wined3d_saved_states changed;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 10a91e5..f1e389d 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -710,15 +710,14 @@ enum wined3d_query_type
 #define WINED3DISSUE_END                                        (1 << 0)
 #define WINED3DGETDATA_FLUSH                                    (1 << 0)
 
-typedef enum _WINED3DSTATEBLOCKTYPE
+enum wined3d_stateblock_type
 {
-    WINED3DSBT_INIT                         = 0,
-    WINED3DSBT_ALL                          = 1,
-    WINED3DSBT_PIXELSTATE                   = 2,
-    WINED3DSBT_VERTEXSTATE                  = 3,
-    WINED3DSBT_RECORDED                     = 4, /* WineD3D private */
-    WINED3DSBT_FORCE_DWORD                  = 0xffffffff
-} WINED3DSTATEBLOCKTYPE;
+    WINED3D_SBT_INIT                        = 0,
+    WINED3D_SBT_ALL                         = 1,
+    WINED3D_SBT_PIXEL_STATE                 = 2,
+    WINED3D_SBT_VERTEX_STATE                = 3,
+    WINED3D_SBT_RECORDED                    = 4, /* WineD3D private */
+};
 
 typedef enum _WINED3DDECLMETHOD
 {
@@ -2292,7 +2291,7 @@ HRESULT __cdecl wined3d_shader_set_local_constants_float(struct wined3d_shader *
 HRESULT __cdecl wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock);
 HRESULT __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock);
 HRESULT __cdecl wined3d_stateblock_create(struct wined3d_device *device,
-        WINED3DSTATEBLOCKTYPE type, struct wined3d_stateblock **stateblock);
+        enum wined3d_stateblock_type type, struct wined3d_stateblock **stateblock);
 ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock);
 ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
 
-- 
1.7.3.4




More information about the wine-patches mailing list