d3d8: Add a separate function for vertex declaration initialization from an FVF.
This commit is contained in:
parent
f394dfc0f8
commit
b6d422446b
|
@ -530,9 +530,6 @@ DECLARE_INTERFACE_(IDirect3DVertexDeclaration8, IUnknown)
|
|||
#define IDirect3DVertexDeclaration8_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define IDirect3DVertexDeclaration8_Release(p) (p)->lpVtbl->Release(p)
|
||||
|
||||
/*** Implementation ***/
|
||||
extern const IDirect3DVertexDeclaration8Vtbl Direct3DVertexDeclaration8_Vtbl DECLSPEC_HIDDEN;
|
||||
|
||||
typedef struct {
|
||||
const IDirect3DVertexDeclaration8Vtbl *lpVtbl;
|
||||
LONG ref_count;
|
||||
|
@ -546,6 +543,8 @@ typedef struct {
|
|||
|
||||
HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
|
||||
IDirect3DDevice8Impl *device, const DWORD *elements) DECLSPEC_HIDDEN;
|
||||
HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration,
|
||||
IDirect3DDevice8Impl *device, DWORD fvf) DECLSPEC_HIDDEN;
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3DVertexShader8 interface
|
||||
|
|
|
@ -1863,17 +1863,10 @@ static IDirect3DVertexDeclaration8Impl *IDirect3DDevice8Impl_FindDecl(IDirect3DD
|
|||
return NULL;
|
||||
}
|
||||
|
||||
d3d8_declaration->ref_count = 1;
|
||||
d3d8_declaration->lpVtbl = &Direct3DVertexDeclaration8_Vtbl;
|
||||
d3d8_declaration->elements = NULL;
|
||||
d3d8_declaration->elements_size = 0;
|
||||
d3d8_declaration->shader_handle = fvf;
|
||||
|
||||
hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->WineD3DDevice,
|
||||
&d3d8_declaration->wined3d_vertex_declaration, (IUnknown *)d3d8_declaration, fvf);
|
||||
hr = vertexdeclaration_init_fvf(d3d8_declaration, This, fvf);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
ERR("Failed to create wined3d vertex declaration.\n");
|
||||
WARN("Failed to initialize vertex declaration, hr %#x.\n", hr);
|
||||
HeapFree(GetProcessHeap(), 0, d3d8_declaration);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -352,7 +352,7 @@ UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elem
|
|||
return element_count;
|
||||
}
|
||||
|
||||
const IDirect3DVertexDeclaration8Vtbl Direct3DVertexDeclaration8_Vtbl =
|
||||
static const IDirect3DVertexDeclaration8Vtbl Direct3DVertexDeclaration8_Vtbl =
|
||||
{
|
||||
IDirect3DVertexDeclaration8Impl_QueryInterface,
|
||||
IDirect3DVertexDeclaration8Impl_AddRef,
|
||||
|
@ -394,3 +394,25 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
|
|||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration,
|
||||
IDirect3DDevice8Impl *device, DWORD fvf)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
declaration->ref_count = 1;
|
||||
declaration->lpVtbl = &Direct3DVertexDeclaration8_Vtbl;
|
||||
declaration->elements = NULL;
|
||||
declaration->elements_size = 0;
|
||||
declaration->shader_handle = fvf;
|
||||
|
||||
hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(device->WineD3DDevice,
|
||||
&declaration->wined3d_vertex_declaration, (IUnknown *)declaration, fvf);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
WARN("Failed to create wined3d vertex declaration, hr %#x.\n", hr);
|
||||
return hr;
|
||||
}
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue