Commit a0b41772 authored by H. Verbeet's avatar H. Verbeet Committed by Alexandre Julliard

d3d8: Add an IDirect3DVertexDeclaration8 class to hold the wined3d vertex declaration.

parent 8f088406
......@@ -21,6 +21,7 @@ C_SRCS = \
swapchain.c \
texture.c \
vertexbuffer.c \
vertexdeclaration.c \
vertexshader.c \
volume.c \
volumetexture.c
......
......@@ -437,6 +437,9 @@ struct IDirect3DVolumeTexture8Impl
DEFINE_GUID(IID_IDirect3DStateBlock8,
0x83b073ce, 0x6f30, 0x11d9, 0xc6, 0x87, 0x0, 0x4, 0x61, 0x42, 0xc1, 0x4f);
DEFINE_GUID(IID_IDirect3DVertexDeclaration8,
0x5dd7478d, 0xcbf3, 0x41a6, 0x8c, 0xfd, 0xfd, 0x19, 0x2b, 0x11, 0xc7, 0x90);
DEFINE_GUID(IID_IDirect3DVertexShader8,
0xefc5557e, 0x6265, 0x4613, 0x8a, 0x94, 0x43, 0x85, 0x78, 0x89, 0xeb, 0x36);
......@@ -488,6 +491,35 @@ typedef struct IDirect3DStateBlock8Impl {
} IDirect3DStateBlock8Impl;
/*****************************************************************************
* 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)
/*** Implementation ***/
extern const IDirect3DVertexDeclaration8Vtbl Direct3DVertexDeclaration8_Vtbl;
typedef struct {
const IDirect3DVertexDeclaration8Vtbl *lpVtbl;
LONG ref_count;
IWineD3DVertexDeclaration *wined3d_vertex_declaration;
} IDirect3DVertexDeclaration8Impl;
/*****************************************************************************
* IDirect3DVertexShader9 interface
*/
#define INTERFACE IDirect3DVertexShader8
......
/*
* IDirect3DVertexDeclaration8 implementation
*
* Copyright 2007 Henri Verbeet
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* IDirect3DVertexDeclaration8 is internal to our implementation.
* It's not visible in the API. */
#include "config.h"
#include "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
/* IUnknown */
static HRESULT WINAPI IDirect3DVertexDeclaration8Impl_QueryInterface(IDirect3DVertexDeclaration8 *iface, REFIID riid, void **obj_ptr)
{
TRACE("(%p)->(%s, %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) : AddRef increasing to %d\n", This, ref_count);
return ref_count;
}
static ULONG WINAPI IDirect3DVertexDeclaration8Impl_Release(IDirect3DVertexDeclaration8 *iface)
{
IDirect3DVertexDeclaration8Impl *This = (IDirect3DVertexDeclaration8Impl *)iface;
ULONG ref_count = InterlockedDecrement(&This->ref_count);
TRACE("(%p) : Releasing to %d\n", This, ref_count);
if (!ref_count) {
IWineD3DVertexDeclaration_Release(This->wined3d_vertex_declaration);
HeapFree(GetProcessHeap(), 0, This);
}
return ref_count;
}
const IDirect3DVertexDeclaration8Vtbl Direct3DVertexDeclaration8_Vtbl =
{
IDirect3DVertexDeclaration8Impl_QueryInterface,
IDirect3DVertexDeclaration8Impl_AddRef,
IDirect3DVertexDeclaration8Impl_Release
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment