d3d8: Remove COM from the vertex declaration implementation.
This commit is contained in:
parent
d0347f51ed
commit
f056fe7bb5
|
@ -168,7 +168,7 @@ struct d3d8_handle_table
|
||||||
struct FvfToDecl
|
struct FvfToDecl
|
||||||
{
|
{
|
||||||
DWORD fvf;
|
DWORD fvf;
|
||||||
struct IDirect3DVertexDeclaration8 *decl;
|
struct d3d8_vertex_declaration *declaration;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IDirect3DDevice8Impl
|
struct IDirect3DDevice8Impl
|
||||||
|
@ -366,47 +366,24 @@ struct IDirect3DVolumeTexture8Impl
|
||||||
HRESULT volumetexture_init(IDirect3DVolumeTexture8Impl *texture, IDirect3DDevice8Impl *device,
|
HRESULT volumetexture_init(IDirect3DVolumeTexture8Impl *texture, IDirect3DDevice8Impl *device,
|
||||||
UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
|
UINT width, UINT height, UINT depth, UINT levels, DWORD usage, D3DFORMAT format, D3DPOOL pool) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
DEFINE_GUID(IID_IDirect3DVertexDeclaration8,
|
|
||||||
0x5dd7478d, 0xcbf3, 0x41a6, 0x8c, 0xfd, 0xfd, 0x19, 0x2b, 0x11, 0xc7, 0x90);
|
|
||||||
|
|
||||||
DEFINE_GUID(IID_IDirect3DVertexShader8,
|
DEFINE_GUID(IID_IDirect3DVertexShader8,
|
||||||
0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36);
|
0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36);
|
||||||
|
|
||||||
DEFINE_GUID(IID_IDirect3DPixelShader8,
|
DEFINE_GUID(IID_IDirect3DPixelShader8,
|
||||||
0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89);
|
0x6d3bdbdc, 0x5b02, 0x4415, 0xb8, 0x52, 0xce, 0x5e, 0x8b, 0xcc, 0xb2, 0x89);
|
||||||
|
|
||||||
/*****************************************************************************
|
struct d3d8_vertex_declaration
|
||||||
* IDirect3DVertexDeclaration8 interface
|
|
||||||
*/
|
|
||||||
#define INTERFACE IDirect3DVertexDeclaration8
|
|
||||||
DECLARE_INTERFACE_(IDirect3DVertexDeclaration8, IUnknown)
|
|
||||||
{
|
{
|
||||||
/*** IUnknown methods ***/
|
|
||||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** obj_ptr) PURE;
|
|
||||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
|
||||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
|
||||||
};
|
|
||||||
#undef INTERFACE
|
|
||||||
|
|
||||||
/*** IUnknown methods ***/
|
|
||||||
#define IDirect3DVertexDeclaration8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
|
||||||
#define IDirect3DVertexDeclaration8_AddRef(p) (p)->lpVtbl->AddRef(p)
|
|
||||||
#define IDirect3DVertexDeclaration8_Release(p) (p)->lpVtbl->Release(p)
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
const IDirect3DVertexDeclaration8Vtbl *lpVtbl;
|
|
||||||
LONG ref_count;
|
|
||||||
|
|
||||||
DWORD *elements;
|
DWORD *elements;
|
||||||
DWORD elements_size; /* Size of elements, in bytes */
|
DWORD elements_size; /* Size of elements, in bytes */
|
||||||
|
|
||||||
struct wined3d_vertex_declaration *wined3d_vertex_declaration;
|
struct wined3d_vertex_declaration *wined3d_vertex_declaration;
|
||||||
DWORD shader_handle;
|
DWORD shader_handle;
|
||||||
} IDirect3DVertexDeclaration8Impl;
|
};
|
||||||
|
|
||||||
HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
|
void d3d8_vertex_declaration_destroy(struct d3d8_vertex_declaration *declaration) DECLSPEC_HIDDEN;
|
||||||
|
HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration,
|
||||||
IDirect3DDevice8Impl *device, const DWORD *elements, DWORD shader_handle) DECLSPEC_HIDDEN;
|
IDirect3DDevice8Impl *device, const DWORD *elements, DWORD shader_handle) DECLSPEC_HIDDEN;
|
||||||
HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration,
|
HRESULT d3d8_vertex_declaration_init_fvf(struct d3d8_vertex_declaration *declaration,
|
||||||
IDirect3DDevice8Impl *device, DWORD fvf) DECLSPEC_HIDDEN;
|
IDirect3DDevice8Impl *device, DWORD fvf) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
|
@ -456,7 +433,7 @@ DECLARE_INTERFACE_(IDirect3DPixelShader8,IUnknown)
|
||||||
struct IDirect3DVertexShader8Impl {
|
struct IDirect3DVertexShader8Impl {
|
||||||
IDirect3DVertexShader8 IDirect3DVertexShader8_iface;
|
IDirect3DVertexShader8 IDirect3DVertexShader8_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
IDirect3DVertexDeclaration8 *vertex_declaration;
|
struct d3d8_vertex_declaration *vertex_declaration;
|
||||||
struct wined3d_shader *wined3d_shader;
|
struct wined3d_shader *wined3d_shader;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -309,8 +309,9 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(IDirect3DDevice8 *iface)
|
||||||
|
|
||||||
This->inDestruction = TRUE;
|
This->inDestruction = TRUE;
|
||||||
|
|
||||||
for(i = 0; i < This->numConvertedDecls; i++) {
|
for (i = 0; i < This->numConvertedDecls; ++i)
|
||||||
IDirect3DVertexDeclaration8_Release(This->decls[i].decl);
|
{
|
||||||
|
d3d8_vertex_declaration_destroy(This->decls[i].declaration);
|
||||||
}
|
}
|
||||||
HeapFree(GetProcessHeap(), 0, This->decls);
|
HeapFree(GetProcessHeap(), 0, This->decls);
|
||||||
|
|
||||||
|
@ -2033,9 +2034,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(IDirect3DDevice8 *
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static IDirect3DVertexDeclaration8Impl *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8Impl *This, DWORD fvf)
|
static struct d3d8_vertex_declaration *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8Impl *This, DWORD fvf)
|
||||||
{
|
{
|
||||||
IDirect3DVertexDeclaration8Impl *d3d8_declaration;
|
struct d3d8_vertex_declaration *d3d8_declaration;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
int p, low, high; /* deliberately signed */
|
int p, low, high; /* deliberately signed */
|
||||||
struct FvfToDecl *convertedDecls = This->decls;
|
struct FvfToDecl *convertedDecls = This->decls;
|
||||||
|
@ -2047,10 +2048,13 @@ static IDirect3DVertexDeclaration8Impl *IDirect3DDevice8Impl_FindDecl(IDirect3DD
|
||||||
while(low <= high) {
|
while(low <= high) {
|
||||||
p = (low + high) >> 1;
|
p = (low + high) >> 1;
|
||||||
TRACE("%d ", p);
|
TRACE("%d ", p);
|
||||||
if(convertedDecls[p].fvf == fvf) {
|
if (convertedDecls[p].fvf == fvf)
|
||||||
TRACE("found %p\n", convertedDecls[p].decl);
|
{
|
||||||
return (IDirect3DVertexDeclaration8Impl *)convertedDecls[p].decl;
|
TRACE("found %p\n", convertedDecls[p].declaration);
|
||||||
} else if(convertedDecls[p].fvf < fvf) {
|
return convertedDecls[p].declaration;
|
||||||
|
}
|
||||||
|
else if (convertedDecls[p].fvf < fvf)
|
||||||
|
{
|
||||||
low = p + 1;
|
low = p + 1;
|
||||||
} else {
|
} else {
|
||||||
high = p - 1;
|
high = p - 1;
|
||||||
|
@ -2065,7 +2069,7 @@ static IDirect3DVertexDeclaration8Impl *IDirect3DDevice8Impl_FindDecl(IDirect3DD
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = vertexdeclaration_init_fvf(d3d8_declaration, This, fvf);
|
hr = d3d8_vertex_declaration_init_fvf(d3d8_declaration, This, fvf);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize vertex declaration, hr %#x.\n", hr);
|
WARN("Failed to initialize vertex declaration, hr %#x.\n", hr);
|
||||||
|
@ -2076,10 +2080,10 @@ static IDirect3DVertexDeclaration8Impl *IDirect3DDevice8Impl_FindDecl(IDirect3DD
|
||||||
if(This->declArraySize == This->numConvertedDecls) {
|
if(This->declArraySize == This->numConvertedDecls) {
|
||||||
int grow = This->declArraySize / 2;
|
int grow = This->declArraySize / 2;
|
||||||
convertedDecls = HeapReAlloc(GetProcessHeap(), 0, convertedDecls,
|
convertedDecls = HeapReAlloc(GetProcessHeap(), 0, convertedDecls,
|
||||||
sizeof(convertedDecls[0]) * (This->numConvertedDecls + grow));
|
sizeof(convertedDecls[0]) * (This->numConvertedDecls + grow));
|
||||||
if(!convertedDecls) {
|
if (!convertedDecls)
|
||||||
/* This will destroy it */
|
{
|
||||||
IDirect3DVertexDeclaration8_Release((IDirect3DVertexDeclaration8 *)d3d8_declaration);
|
d3d8_vertex_declaration_destroy(d3d8_declaration);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
This->decls = convertedDecls;
|
This->decls = convertedDecls;
|
||||||
|
@ -2087,7 +2091,7 @@ static IDirect3DVertexDeclaration8Impl *IDirect3DDevice8Impl_FindDecl(IDirect3DD
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(convertedDecls + low + 1, convertedDecls + low, sizeof(convertedDecls[0]) * (This->numConvertedDecls - low));
|
memmove(convertedDecls + low + 1, convertedDecls + low, sizeof(convertedDecls[0]) * (This->numConvertedDecls - low));
|
||||||
convertedDecls[low].decl = (IDirect3DVertexDeclaration8 *)d3d8_declaration;
|
convertedDecls[low].declaration = d3d8_declaration;
|
||||||
convertedDecls[low].fvf = fvf;
|
convertedDecls[low].fvf = fvf;
|
||||||
This->numConvertedDecls++;
|
This->numConvertedDecls++;
|
||||||
|
|
||||||
|
@ -2128,7 +2132,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(IDirect3DDevice8 *ifa
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = wined3d_device_set_vertex_declaration(This->wined3d_device,
|
hr = wined3d_device_set_vertex_declaration(This->wined3d_device,
|
||||||
((IDirect3DVertexDeclaration8Impl *)shader->vertex_declaration)->wined3d_vertex_declaration);
|
shader->vertex_declaration->wined3d_vertex_declaration);
|
||||||
if (SUCCEEDED(hr))
|
if (SUCCEEDED(hr))
|
||||||
hr = wined3d_device_set_vertex_shader(This->wined3d_device, shader->wined3d_shader);
|
hr = wined3d_device_set_vertex_shader(This->wined3d_device, shader->wined3d_shader);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
|
@ -2142,7 +2146,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *ifa
|
||||||
{
|
{
|
||||||
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
||||||
struct wined3d_vertex_declaration *wined3d_declaration;
|
struct wined3d_vertex_declaration *wined3d_declaration;
|
||||||
IDirect3DVertexDeclaration8 *d3d8_declaration;
|
struct d3d8_vertex_declaration *d3d8_declaration;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("iface %p, shader %p.\n", iface, ppShader);
|
TRACE("iface %p, shader %p.\n", iface, ppShader);
|
||||||
|
@ -2167,7 +2171,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(IDirect3DDevice8 *ifa
|
||||||
d3d8_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration);
|
d3d8_declaration = wined3d_vertex_declaration_get_parent(wined3d_declaration);
|
||||||
wined3d_vertex_declaration_decref(wined3d_declaration);
|
wined3d_vertex_declaration_decref(wined3d_declaration);
|
||||||
wined3d_mutex_unlock();
|
wined3d_mutex_unlock();
|
||||||
*ppShader = ((IDirect3DVertexDeclaration8Impl *)d3d8_declaration)->shader_handle;
|
*ppShader = d3d8_declaration->shader_handle;
|
||||||
|
|
||||||
TRACE("(%p) : returning %#x\n", This, *ppShader);
|
TRACE("(%p) : returning %#x\n", This, *ppShader);
|
||||||
|
|
||||||
|
@ -2258,7 +2262,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderDeclaration(IDirect3DD
|
||||||
DWORD pVertexShader, void *pData, DWORD *pSizeOfData)
|
DWORD pVertexShader, void *pData, DWORD *pSizeOfData)
|
||||||
{
|
{
|
||||||
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
||||||
IDirect3DVertexDeclaration8Impl *declaration;
|
struct d3d8_vertex_declaration *declaration;
|
||||||
IDirect3DVertexShader8Impl *shader;
|
IDirect3DVertexShader8Impl *shader;
|
||||||
|
|
||||||
TRACE("iface %p, shader %#x, data %p, data_size %p.\n",
|
TRACE("iface %p, shader %#x, data %p, data_size %p.\n",
|
||||||
|
@ -2273,7 +2277,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderDeclaration(IDirect3DD
|
||||||
WARN("Invalid handle (%#x) passed.\n", pVertexShader);
|
WARN("Invalid handle (%#x) passed.\n", pVertexShader);
|
||||||
return D3DERR_INVALIDCALL;
|
return D3DERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
declaration = (IDirect3DVertexDeclaration8Impl *)shader->vertex_declaration;
|
declaration = shader->vertex_declaration;
|
||||||
|
|
||||||
/* If pData is NULL, we just return the required size of the buffer. */
|
/* If pData is NULL, we just return the required size of the buffer. */
|
||||||
if (!pData) {
|
if (!pData) {
|
||||||
|
|
|
@ -65,7 +65,7 @@ static ULONG WINAPI d3d8_vertexshader_AddRef(IDirect3DVertexShader8 *iface)
|
||||||
static void STDMETHODCALLTYPE d3d8_vertexshader_wined3d_object_destroyed(void *parent)
|
static void STDMETHODCALLTYPE d3d8_vertexshader_wined3d_object_destroyed(void *parent)
|
||||||
{
|
{
|
||||||
IDirect3DVertexShader8Impl *shader = parent;
|
IDirect3DVertexShader8Impl *shader = parent;
|
||||||
IDirect3DVertexDeclaration8_Release(shader->vertex_declaration);
|
d3d8_vertex_declaration_destroy(shader->vertex_declaration);
|
||||||
HeapFree(GetProcessHeap(), 0, shader);
|
HeapFree(GetProcessHeap(), 0, shader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,9 +107,9 @@ static const struct wined3d_parent_ops d3d8_vertexshader_wined3d_parent_ops =
|
||||||
};
|
};
|
||||||
|
|
||||||
static HRESULT d3d8_vertexshader_create_vertexdeclaration(IDirect3DDevice8Impl *device,
|
static HRESULT d3d8_vertexshader_create_vertexdeclaration(IDirect3DDevice8Impl *device,
|
||||||
const DWORD *declaration, DWORD shader_handle, IDirect3DVertexDeclaration8 **decl_ptr)
|
const DWORD *declaration, DWORD shader_handle, struct d3d8_vertex_declaration **decl_ptr)
|
||||||
{
|
{
|
||||||
IDirect3DVertexDeclaration8Impl *object;
|
struct d3d8_vertex_declaration *object;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("device %p, declaration %p, shader_handle %#x, decl_ptr %p.\n",
|
TRACE("device %p, declaration %p, shader_handle %#x, decl_ptr %p.\n",
|
||||||
|
@ -122,7 +122,7 @@ static HRESULT d3d8_vertexshader_create_vertexdeclaration(IDirect3DDevice8Impl *
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
hr = vertexdeclaration_init(object, device, declaration, shader_handle);
|
hr = d3d8_vertex_declaration_init(object, device, declaration, shader_handle);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to initialize vertex declaration, hr %#x.\n", hr);
|
WARN("Failed to initialize vertex declaration, hr %#x.\n", hr);
|
||||||
|
@ -131,7 +131,7 @@ static HRESULT d3d8_vertexshader_create_vertexdeclaration(IDirect3DDevice8Impl *
|
||||||
}
|
}
|
||||||
|
|
||||||
TRACE("Created vertex declaration %p.\n", object);
|
TRACE("Created vertex declaration %p.\n", object);
|
||||||
*decl_ptr = (IDirect3DVertexDeclaration8 *)object;
|
*decl_ptr = object;
|
||||||
|
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
@ -182,7 +182,7 @@ HRESULT vertexshader_init(IDirect3DVertexShader8Impl *shader, IDirect3DDevice8Im
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr);
|
WARN("Failed to create wined3d vertex shader, hr %#x.\n", hr);
|
||||||
IDirect3DVertexDeclaration8_Release(shader->vertex_declaration);
|
d3d8_vertex_declaration_destroy(shader->vertex_declaration);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,56 +26,6 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||||
|
|
||||||
/* IUnknown */
|
|
||||||
static HRESULT WINAPI IDirect3DVertexDeclaration8Impl_QueryInterface(IDirect3DVertexDeclaration8 *iface, REFIID riid, void **obj_ptr)
|
|
||||||
{
|
|
||||||
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), obj_ptr);
|
|
||||||
|
|
||||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
|
||||||
|| IsEqualGUID(riid, &IID_IDirect3DVertexDeclaration8))
|
|
||||||
{
|
|
||||||
IUnknown_AddRef(iface);
|
|
||||||
*obj_ptr = iface;
|
|
||||||
return S_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
*obj_ptr = NULL;
|
|
||||||
return E_NOINTERFACE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI IDirect3DVertexDeclaration8Impl_AddRef(IDirect3DVertexDeclaration8 *iface)
|
|
||||||
{
|
|
||||||
IDirect3DVertexDeclaration8Impl *This = (IDirect3DVertexDeclaration8Impl *)iface;
|
|
||||||
ULONG ref_count = InterlockedIncrement(&This->ref_count);
|
|
||||||
|
|
||||||
TRACE("%p increasing refcount to %u.\n", iface, ref_count);
|
|
||||||
|
|
||||||
if (ref_count == 1)
|
|
||||||
{
|
|
||||||
wined3d_mutex_lock();
|
|
||||||
wined3d_vertex_declaration_incref(This->wined3d_vertex_declaration);
|
|
||||||
wined3d_mutex_unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ref_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ULONG WINAPI IDirect3DVertexDeclaration8Impl_Release(IDirect3DVertexDeclaration8 *iface)
|
|
||||||
{
|
|
||||||
IDirect3DVertexDeclaration8Impl *This = (IDirect3DVertexDeclaration8Impl *)iface;
|
|
||||||
ULONG ref_count = InterlockedDecrement(&This->ref_count);
|
|
||||||
|
|
||||||
TRACE("%p decreasing refcount to %u.\n", iface, ref_count);
|
|
||||||
|
|
||||||
if (!ref_count) {
|
|
||||||
wined3d_mutex_lock();
|
|
||||||
wined3d_vertex_declaration_decref(This->wined3d_vertex_declaration);
|
|
||||||
wined3d_mutex_unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
return ref_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *debug_d3dvsdt_type(D3DVSDT_TYPE d3dvsdt_type)
|
static const char *debug_d3dvsdt_type(D3DVSDT_TYPE d3dvsdt_type)
|
||||||
{
|
{
|
||||||
switch (d3dvsdt_type)
|
switch (d3dvsdt_type)
|
||||||
|
@ -359,34 +309,34 @@ static UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3
|
||||||
return element_count;
|
return element_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const IDirect3DVertexDeclaration8Vtbl Direct3DVertexDeclaration8_Vtbl =
|
|
||||||
{
|
|
||||||
IDirect3DVertexDeclaration8Impl_QueryInterface,
|
|
||||||
IDirect3DVertexDeclaration8Impl_AddRef,
|
|
||||||
IDirect3DVertexDeclaration8Impl_Release
|
|
||||||
};
|
|
||||||
|
|
||||||
static void STDMETHODCALLTYPE d3d8_vertexdeclaration_wined3d_object_destroyed(void *parent)
|
static void STDMETHODCALLTYPE d3d8_vertexdeclaration_wined3d_object_destroyed(void *parent)
|
||||||
{
|
{
|
||||||
IDirect3DVertexDeclaration8Impl *declaration = parent;
|
struct d3d8_vertex_declaration *declaration = parent;
|
||||||
HeapFree(GetProcessHeap(), 0, declaration->elements);
|
HeapFree(GetProcessHeap(), 0, declaration->elements);
|
||||||
HeapFree(GetProcessHeap(), 0, declaration);
|
HeapFree(GetProcessHeap(), 0, declaration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void d3d8_vertex_declaration_destroy(struct d3d8_vertex_declaration *declaration)
|
||||||
|
{
|
||||||
|
TRACE("declaration %p.\n", declaration);
|
||||||
|
|
||||||
|
wined3d_mutex_lock();
|
||||||
|
wined3d_vertex_declaration_decref(declaration->wined3d_vertex_declaration);
|
||||||
|
wined3d_mutex_unlock();
|
||||||
|
}
|
||||||
|
|
||||||
static const struct wined3d_parent_ops d3d8_vertexdeclaration_wined3d_parent_ops =
|
static const struct wined3d_parent_ops d3d8_vertexdeclaration_wined3d_parent_ops =
|
||||||
{
|
{
|
||||||
d3d8_vertexdeclaration_wined3d_object_destroyed,
|
d3d8_vertexdeclaration_wined3d_object_destroyed,
|
||||||
};
|
};
|
||||||
|
|
||||||
HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
|
HRESULT d3d8_vertex_declaration_init(struct d3d8_vertex_declaration *declaration,
|
||||||
IDirect3DDevice8Impl *device, const DWORD *elements, DWORD shader_handle)
|
IDirect3DDevice8Impl *device, const DWORD *elements, DWORD shader_handle)
|
||||||
{
|
{
|
||||||
struct wined3d_vertex_element *wined3d_elements;
|
struct wined3d_vertex_element *wined3d_elements;
|
||||||
UINT wined3d_element_count;
|
UINT wined3d_element_count;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
declaration->lpVtbl = &Direct3DVertexDeclaration8_Vtbl;
|
|
||||||
declaration->ref_count = 1;
|
|
||||||
declaration->shader_handle = shader_handle;
|
declaration->shader_handle = shader_handle;
|
||||||
|
|
||||||
wined3d_element_count = convert_to_wined3d_declaration(elements, &declaration->elements_size, &wined3d_elements);
|
wined3d_element_count = convert_to_wined3d_declaration(elements, &declaration->elements_size, &wined3d_elements);
|
||||||
|
@ -415,13 +365,11 @@ HRESULT vertexdeclaration_init(IDirect3DVertexDeclaration8Impl *declaration,
|
||||||
return D3D_OK;
|
return D3D_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT vertexdeclaration_init_fvf(IDirect3DVertexDeclaration8Impl *declaration,
|
HRESULT d3d8_vertex_declaration_init_fvf(struct d3d8_vertex_declaration *declaration,
|
||||||
IDirect3DDevice8Impl *device, DWORD fvf)
|
IDirect3DDevice8Impl *device, DWORD fvf)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
declaration->ref_count = 1;
|
|
||||||
declaration->lpVtbl = &Direct3DVertexDeclaration8_Vtbl;
|
|
||||||
declaration->elements = NULL;
|
declaration->elements = NULL;
|
||||||
declaration->elements_size = 0;
|
declaration->elements_size = 0;
|
||||||
declaration->shader_handle = fvf;
|
declaration->shader_handle = fvf;
|
||||||
|
|
Loading…
Reference in New Issue