Henri Verbeet : wined3d: Remove the "declaration" parameter to IWineD3DDeviceImpl_CreateVertexShader().

Alexandre Julliard julliard at winehq.org
Thu May 28 09:39:42 CDT 2009


Module: wine
Branch: master
Commit: 13a05caa9744673d618bc00426f3bf21e72aa0b8
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=13a05caa9744673d618bc00426f3bf21e72aa0b8

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu May 28 08:44:21 2009 +0200

wined3d: Remove the "declaration" parameter to IWineD3DDeviceImpl_CreateVertexShader().

Once upon a time this was used for creating fake vertex shader
attribute semantics for d3d8 shaders. We don't need this anymore since
device_stream_info_from_declaration() will use the vertex
declaration's output slot to load the data, if present. That also
avoids the potentially expensive matching of attribute semantics
between vertex shader and declaration for d3d8.

---

 dlls/d3d10core/device.c     |    2 +-
 dlls/d3d8/device.c          |    7 ++-----
 dlls/d3d9/vertexshader.c    |    2 +-
 dlls/wined3d/device.c       |    7 +------
 dlls/wined3d/vertexshader.c |   28 ----------------------------
 include/wine/wined3d.idl    |    4 ----
 6 files changed, 5 insertions(+), 45 deletions(-)

diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index de07db7..20e7c46 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -1003,7 +1003,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateVertexShader(ID3D10Device *i
         return hr;
     }
 
-    hr = IWineD3DDevice_CreateVertexShader(This->wined3d_device, NULL,
+    hr = IWineD3DDevice_CreateVertexShader(This->wined3d_device,
             shader_info.shader_code, &object->output_signature,
             &object->wined3d_shader, (IUnknown *)object);
     if (FAILED(hr))
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 4b24ac8..6af8d1e 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -1726,7 +1726,6 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8
     IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
     HRESULT hrc = D3D_OK;
     IDirect3DVertexShader8Impl *object;
-    IWineD3DVertexDeclaration *wined3d_vertex_declaration;
     const DWORD *token = pDeclaration;
     DWORD handle;
 
@@ -1783,13 +1782,11 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8
         *ppShader = ((IDirect3DVertexDeclaration8Impl *)object->vertex_declaration)->shader_handle = shader_handle;
     }
 
-    wined3d_vertex_declaration = ((IDirect3DVertexDeclaration8Impl *)object->vertex_declaration)->wined3d_vertex_declaration;
-
     if (pFunction)
     {
         /* Usage is missing ... Use SetRenderState to set the sw vp render state in SetVertexShader */
-        hrc = IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, wined3d_vertex_declaration,
-                pFunction, NULL /* output signature */, &object->wineD3DVertexShader, (IUnknown *)object);
+        hrc = IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, pFunction,
+                NULL /* output signature */, &object->wineD3DVertexShader, (IUnknown *)object);
 
         if (FAILED(hrc))
         {
diff --git a/dlls/d3d9/vertexshader.c b/dlls/d3d9/vertexshader.c
index c138690..d7b680e 100644
--- a/dlls/d3d9/vertexshader.c
+++ b/dlls/d3d9/vertexshader.c
@@ -126,7 +126,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9EX iface
     object->ref = 1;
     object->lpVtbl = &Direct3DVertexShader9_Vtbl;
     EnterCriticalSection(&d3d9_cs);
-    hrc= IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, NULL /* declaration */, pFunction,
+    hrc= IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, pFunction,
             NULL /* output signature */, &object->wineD3DVertexShader, (IUnknown *)object);
     LeaveCriticalSection(&d3d9_cs);
 
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 91a0266..b022755 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2329,8 +2329,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF(IWineD3D
 }
 
 static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *iface,
-        IWineD3DVertexDeclaration *vertex_declaration, const DWORD *pFunction,
-        const struct wined3d_shader_signature *output_signature,
+        const DWORD *pFunction, const struct wined3d_shader_signature *output_signature,
         IWineD3DVertexShader **ppVertexShader, IUnknown *parent)
 {
     IWineD3DDeviceImpl       *This = (IWineD3DDeviceImpl *)iface;
@@ -2355,10 +2354,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac
 
     TRACE("(%p) : Created vertex shader %p\n", This, *ppVertexShader);
 
-    if (vertex_declaration) {
-        IWineD3DVertexShader_FakeSemantics(*ppVertexShader, vertex_declaration);
-    }
-
     hr = IWineD3DVertexShader_SetFunction(*ppVertexShader, pFunction, output_signature);
     if (FAILED(hr))
     {
diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c
index b8c56cc..99108a8 100644
--- a/dlls/wined3d/vertexshader.c
+++ b/dlls/wined3d/vertexshader.c
@@ -105,20 +105,6 @@ static void vshader_set_limits(IWineD3DVertexShaderImpl *This)
     }
 }
 
-/* This is an internal function,
- * used to create fake semantics for shaders
- * that don't have them - d3d8 shaders where the declaration
- * stores the register for each input
- */
-static void vshader_set_input(
-    IWineD3DVertexShaderImpl* This,
-    unsigned int regnum,
-    BYTE usage, BYTE usage_idx) {
-
-    This->attributes[regnum].usage = usage;
-    This->attributes[regnum].usage_idx = usage_idx;
-}
-
 static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_idx2) {
     if (usage_idx1 != usage_idx2) return FALSE;
     if (usage1 == usage2) return TRUE;
@@ -320,19 +306,6 @@ static HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader
     return WINED3D_OK;
 }
 
-/* Preload semantics for d3d8 shaders */
-static void WINAPI IWineD3DVertexShaderImpl_FakeSemantics(IWineD3DVertexShader *iface, IWineD3DVertexDeclaration *vertex_declaration) {
-    IWineD3DVertexShaderImpl *This =(IWineD3DVertexShaderImpl *)iface;
-    IWineD3DVertexDeclarationImpl* vdecl = (IWineD3DVertexDeclarationImpl*)vertex_declaration;
-
-    unsigned int i;
-    for (i = 0; i < vdecl->element_count; ++i)
-    {
-        const struct wined3d_vertex_declaration_element *e = &vdecl->elements[i];
-        vshader_set_input(This, e->output_slot, e->usage, e->usage_idx);
-    }
-}
-
 /* Set local constants for d3d8 shaders */
 static HRESULT WINAPI IWIneD3DVertexShaderImpl_SetLocalConstantsF(IWineD3DVertexShader *iface,
         UINT start_idx, const float *src_data, UINT count) {
@@ -389,7 +362,6 @@ const IWineD3DVertexShaderVtbl IWineD3DVertexShader_Vtbl =
     /*** IWineD3DVertexShader methods ***/
     IWineD3DVertexShaderImpl_GetDevice,
     IWineD3DVertexShaderImpl_GetFunction,
-    IWineD3DVertexShaderImpl_FakeSemantics,
     IWIneD3DVertexShaderImpl_SetLocalConstantsF
 };
 
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index 7c875e4..48938cb 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -2868,9 +2868,6 @@ interface IWineD3DVertexShader : IWineD3DBaseShader
         [out] void *data,
         [in, out] UINT *data_size
     );
-    void FakeSemantics(
-        [in] IWineD3DVertexDeclaration *vertex_declaration
-    );
     HRESULT SetLocalConstantsF(
         [in] UINT start_idx,
         [in] const float *src_data,
@@ -3011,7 +3008,6 @@ interface IWineD3DDevice : IWineD3DBase
         [in] DWORD fvf
     );
     HRESULT CreateVertexShader(
-        [in] IWineD3DVertexDeclaration *declaration,
         [in] const DWORD *function,
         [in] const struct wined3d_shader_signature *output_signature,
         [out] IWineD3DVertexShader **shader,




More information about the wine-cvs mailing list