wined3d: Remove GetFVF() and SetFVF() from IWineD3DDevice.

Henri Verbeet hverbeet at codeweavers.com
Tue Dec 16 09:37:36 CST 2008


---
 dlls/d3d8/device.c                  |    3 +-
 dlls/d3d9/device.c                  |   16 +++++++++---
 dlls/d3d9/tests/vertexdeclaration.c |   46 ++++++++++++++++-------------------
 dlls/wined3d/device.c               |   34 -------------------------
 dlls/wined3d/stateblock.c           |   12 ---------
 dlls/wined3d/wined3d_private.h      |    3 --
 include/wine/wined3d.idl            |    6 ----
 7 files changed, 34 insertions(+), 86 deletions(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 41d8554..6484225 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1702,8 +1702,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa
     TRACE("(%p) : Relay\n", This);
     EnterCriticalSection(&d3d8_cs);
     if (VS_HIGHESTFIXEDFXF >= pShader) {
-        TRACE("Setting FVF, %d %d\n", VS_HIGHESTFIXEDFXF, pShader);
-        IWineD3DDevice_SetFVF(This->WineD3DDevice, pShader);
+        TRACE("Setting FVF, %#x\n", pShader);
         IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice,
                 IDirect3DDevice8Impl_FindDecl(This, pShader)->wined3d_vertex_declaration);
         IWineD3DDevice_SetVertexShader(This->WineD3DDevice, NULL);
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 3bdd8ae..693b82f 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -1314,7 +1314,6 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWO
              return hr;
          }
     }
-    hr = IWineD3DDevice_SetFVF(This->WineD3DDevice, FVF);
     LeaveCriticalSection(&d3d9_cs);
 
     return hr;
@@ -1322,12 +1321,21 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWO
 
 static HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9EX iface, DWORD* pFVF) {
     IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
+    IDirect3DVertexDeclaration9 *decl;
     HRESULT hr;
     TRACE("(%p) Relay\n" , This);
 
-    EnterCriticalSection(&d3d9_cs);
-    hr = IWineD3DDevice_GetFVF(This->WineD3DDevice, pFVF);
-    LeaveCriticalSection(&d3d9_cs);
+    hr = IDirect3DDevice9_GetVertexDeclaration(iface, &decl);
+    if (FAILED(hr))
+    {
+        WARN("Failed to get vertex declaration, %#x\n", hr);
+        *pFVF = 0;
+        return hr;
+    }
+
+    *pFVF = ((IDirect3DVertexDeclaration9Impl *)decl)->convFVF;
+    TRACE("Returning FVF %#x\n", *pFVF);
+
     return hr;
 }
 
diff --git a/dlls/d3d9/tests/vertexdeclaration.c b/dlls/d3d9/tests/vertexdeclaration.c
index e0b2820..36d22b4 100644
--- a/dlls/d3d9/tests/vertexdeclaration.c
+++ b/dlls/d3d9/tests/vertexdeclaration.c
@@ -279,11 +279,8 @@ static HRESULT test_fvf_to_decl(
     return E_FAIL;
 }
 
-static HRESULT test_decl_to_fvf(
-    IDirect3DDevice9* device,
-    DWORD default_fvf,
-    CONST D3DVERTEXELEMENT9 test_decl[],
-    DWORD test_fvf)
+static HRESULT test_decl_to_fvf(IDirect3DDevice9* device, DWORD default_fvf,
+        const D3DVERTEXELEMENT9 test_decl[], DWORD test_fvf, BOOL todo)
 {
 
     HRESULT hr;
@@ -310,9 +307,8 @@ static HRESULT test_decl_to_fvf(
     hr = IDirect3DDevice9_GetFVF( device, &result_fvf);
     ok(SUCCEEDED(hr), "GetFVF returned %#x, expected %#x\n", hr, D3D_OK);
     if (FAILED(hr)) goto fail;
-    todo_wine {
-       ok(test_fvf == result_fvf, "result FVF was: %#x, expected: %#x\n", result_fvf, test_fvf);
-    }
+    if (todo) todo_wine ok(test_fvf == result_fvf, "result FVF was: %#x, expected: %#x\n", result_fvf, test_fvf);
+    else ok(test_fvf == result_fvf, "result FVF was: %#x, expected: %#x\n", result_fvf, test_fvf);
     if (test_fvf != result_fvf) goto fail;
 
     IDirect3DDevice9_SetVertexDeclaration ( device, NULL );
@@ -348,64 +344,64 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice)
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZ));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZ, TRUE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_POSITIONT, 0 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZRHW));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZRHW, TRUE));
     }
     for (i = 0; i < 4; i++) {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT1+i, 0, D3DDECLUSAGE_BLENDWEIGHT, 0}, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] = 
             { { 0, 0, D3DDECLTYPE_UBYTE4, 0, D3DDECLUSAGE_BLENDINDICES, 0}, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_NORMAL, 0 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT1, 0, D3DDECLUSAGE_PSIZE, 0 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_D3DCOLOR, 0, D3DDECLUSAGE_COLOR, 0 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_D3DCOLOR, 0, D3DDECLUSAGE_COLOR, 1 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
 
     /* Make sure textures of different sizes work */
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT1, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
 
     /* Make sure the TEXCOORD index works correctly - try several textures */
@@ -415,25 +411,25 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice)
               { 0, 4, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_TEXCOORD, 1 },
               { 0, 16, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_TEXCOORD, 2 },
               { 0, 24, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_TEXCOORD, 3 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
 
     /* No FVF mapping available */
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 1 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] =
             { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_NORMAL, 1 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
 
     /* Try empty declaration */
     {
         CONST D3DVERTEXELEMENT9 test_buffer[] = { D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
 
     /* Now try a combination test */
@@ -445,7 +441,7 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice)
               { 0, 28, D3DDECLTYPE_D3DCOLOR, 0, D3DDECLUSAGE_COLOR, 1 },
               { 0, 32, D3DDECLTYPE_FLOAT1, 0, D3DDECLUSAGE_TEXCOORD, 0 },
               { 0, 44, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_TEXCOORD, 1 }, D3DDECL_END() };
-        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0));
+        VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE));
     }
 
     /* Test conversions from FVF to a vertex declaration 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6ded1a2..792426e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2538,36 +2538,6 @@ static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *ifa
     return (This->adapter->TextureRam - This->adapter->UsedTextureRam);
 }
 
-
-
-/*****
- * Get / Set FVF
- *****/
-static HRESULT WINAPI IWineD3DDeviceImpl_SetFVF(IWineD3DDevice *iface, DWORD fvf) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-
-    /* Update the current state block */
-    This->updateStateBlock->changed.fvf      = TRUE;
-
-    if(This->updateStateBlock->fvf == fvf) {
-        TRACE("Application is setting the old fvf over, nothing to do\n");
-        return WINED3D_OK;
-    }
-
-    This->updateStateBlock->fvf              = fvf;
-    TRACE("(%p) : FVF Shader FVF set to %x\n", This, fvf);
-    IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL);
-    return WINED3D_OK;
-}
-
-
-static HRESULT WINAPI IWineD3DDeviceImpl_GetFVF(IWineD3DDevice *iface, DWORD *pfvf) {
-    IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
-    TRACE("(%p) : GetFVF returning %x\n", This, This->stateBlock->fvf);
-    *pfvf = This->stateBlock->fvf;
-    return WINED3D_OK;
-}
-
 /*****
  * Get / Set Stream Source
  *****/
@@ -7542,8 +7512,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
     IWineD3DDeviceImpl_GetCurrentTexturePalette,
     IWineD3DDeviceImpl_SetDepthStencilSurface,
     IWineD3DDeviceImpl_GetDepthStencilSurface,
-    IWineD3DDeviceImpl_SetFVF,
-    IWineD3DDeviceImpl_GetFVF,
     IWineD3DDeviceImpl_SetGammaRamp,
     IWineD3DDeviceImpl_GetGammaRamp,
     IWineD3DDeviceImpl_SetIndices,
@@ -7687,8 +7655,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_DirtyConst_Vtbl =
     IWineD3DDeviceImpl_GetCurrentTexturePalette,
     IWineD3DDeviceImpl_SetDepthStencilSurface,
     IWineD3DDeviceImpl_GetDepthStencilSurface,
-    IWineD3DDeviceImpl_SetFVF,
-    IWineD3DDeviceImpl_GetFVF,
     IWineD3DDeviceImpl_SetGammaRamp,
     IWineD3DDeviceImpl_GetGammaRamp,
     IWineD3DDeviceImpl_SetIndices,
diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index d568de6..b0cb027 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -82,7 +82,6 @@ static void stateblock_savedstates_copy(IWineD3DStateBlock* iface, SAVEDSTATES *
     /* Single values */
     dest->indices = source->indices;
     dest->material = source->material;
-    dest->fvf = source->fvf;
     dest->viewport = source->viewport;
     dest->vertexDecl = source->vertexDecl;
     dest->pixelShader = source->pixelShader;
@@ -120,7 +119,6 @@ void stateblock_savedstates_set(
     /* Single values */
     states->indices = value;
     states->material = value;
-    states->fvf = value;
     states->viewport = value;
     states->vertexDecl = value;
     states->pixelShader = value;
@@ -167,7 +165,6 @@ void stateblock_copy(
     stateblock_savedstates_copy(source, &Dest->changed, &This->changed);
 
     /* Single items */
-    Dest->fvf = This->fvf;
     Dest->vertexDecl = This->vertexDecl;
     Dest->vertexShader = This->vertexShader;
     Dest->streamIsUP = This->streamIsUP;
@@ -504,10 +501,6 @@ static HRESULT  WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
             This->vertexDecl = targetStateBlock->vertexDecl;
         }
 
-        if(This->changed.fvf && This->fvf != targetStateBlock->fvf){
-            This->fvf = targetStateBlock->fvf;
-        }
-
         if (This->changed.material && memcmp(&targetStateBlock->material,
                                                     &This->material,
                                                     sizeof(WINED3DMATERIAL)) != 0) {
@@ -810,10 +803,6 @@ should really perform a delta so that only the changes get updated*/
             IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex);
         }
 
-        if (This->changed.fvf) {
-            IWineD3DDevice_SetFVF(pDevice, This->fvf);
-        }
-
         if (This->changed.vertexDecl) {
             IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl);
         }
@@ -986,7 +975,6 @@ should really perform a delta so that only the changes get updated*/
         }
         IWineD3DDevice_SetIndices(pDevice, This->pIndexData);
         IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex);
-        IWineD3DDevice_SetFVF(pDevice, This->fvf);
         IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl);
         IWineD3DDevice_SetMaterial(pDevice, &This->material);
         IWineD3DDevice_SetViewport(pDevice, &This->viewport);
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 92a25b0..e766372 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1737,7 +1737,6 @@ extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl;
 typedef struct SAVEDSTATES {
         BOOL                      indices;
         BOOL                      material;
-        BOOL                      fvf;
         BOOL                      streamSource[MAX_STREAMS];
         BOOL                      streamFreq[MAX_STREAMS];
         BOOL                      textures[MAX_COMBINED_SAMPLERS];
@@ -1786,8 +1785,6 @@ struct IWineD3DStateBlockImpl
     struct list               set_vconstantsF;
     struct list               set_pconstantsF;
 
-    /* Drawing - Vertex Shader or FVF related */
-    DWORD                     fvf;
     /* Vertex Shader Declaration */
     IWineD3DVertexDeclaration *vertexDecl;
 
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 39ba598..ae64888 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -3070,12 +3070,6 @@ interface IWineD3DDevice : IWineD3DBase
     HRESULT GetDepthStencilSurface(
         [out] IWineD3DSurface **depth_stencil
     );
-    HRESULT SetFVF(
-        [in] DWORD fvf
-    );
-    HRESULT GetFVF(
-        [out] DWORD *fvf
-    );
     void SetGammaRamp(
         [in] UINT swapchain_idx,
         [in] DWORD flags,
-- 
1.5.6.4



--------------040805030807090003090401--



More information about the wine-patches mailing list