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.
oldstable
Henri Verbeet 2009-05-28 08:44:21 +02:00 committed by Alexandre Julliard
parent 71382b5cbb
commit 13a05caa97
6 changed files with 5 additions and 45 deletions

View File

@ -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))

View File

@ -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))
{

View File

@ -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);

View File

@ -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))
{

View File

@ -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
};

View File

@ -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,