| /* | |
| * IWineD3DDevice implementation | |
| * | |
| * Copyright 2002-2004 Jason Edmeades | |
| * Copyright 2003-2004 Raphael Junqueira | |
| * Copyright 2004 Christian Costa | |
| * | |
| * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| */ | |
| #include "config.h" | |
| #include "wined3d_private.h" | |
| WINE_DEFAULT_DEBUG_CHANNEL(d3d); | |
| WINE_DECLARE_DEBUG_CHANNEL(d3d_caps); | |
| /********************************************************** | |
| * Utility functions follow | |
| **********************************************************/ | |
| /********************************************************** | |
| * IWineD3DDevice implementation follows | |
| **********************************************************/ | |
| HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT Size, DWORD Usage, | |
| DWORD FVF, D3DPOOL Pool, IWineD3DVertexBuffer** ppVertexBuffer, HANDLE *sharedHandle) { | |
| IWineD3DVertexBufferImpl *object; | |
| IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; | |
| /* Allocate the storage for the device */ | |
| object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DVertexBufferImpl)); | |
| object->lpVtbl = &IWineD3DVertexBuffer_Vtbl; | |
| object->resource.wineD3DDevice= iface; | |
| object->resource.resourceType = D3DRTYPE_VERTEXBUFFER; | |
| object->resource.ref = 1; | |
| object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Size); | |
| object->currentDesc.Usage = Usage; | |
| object->currentDesc.Pool = Pool; | |
| object->currentDesc.FVF = FVF; | |
| object->currentDesc.Size = Size; | |
| TRACE("(%p) : Size=%d, Usage=%ld, FVF=%lx, Pool=%d - Memory@%p, Iface@%p\n", This, Size, Usage, FVF, Pool, object->allocatedMemory, object); | |
| *ppVertexBuffer = (IWineD3DVertexBuffer *)object; | |
| return D3D_OK; | |
| } | |
| /********************************************************** | |
| * IUnknown parts follows | |
| **********************************************************/ | |
| HRESULT WINAPI IWineD3DDeviceImpl_QueryInterface(IWineD3DDevice *iface,REFIID riid,LPVOID *ppobj) | |
| { | |
| return E_NOINTERFACE; | |
| } | |
| ULONG WINAPI IWineD3DDeviceImpl_AddRef(IWineD3DDevice *iface) { | |
| IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; | |
| TRACE("(%p) : AddRef increasing from %ld\n", This, This->ref); | |
| return InterlockedIncrement(&This->ref); | |
| } | |
| ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) { | |
| IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; | |
| ULONG ref; | |
| TRACE("(%p) : Releasing from %ld\n", This, This->ref); | |
| ref = InterlockedDecrement(&This->ref); | |
| if (ref == 0) { | |
| IWineD3D_Release(This->WineD3D); | |
| HeapFree(GetProcessHeap(), 0, This); | |
| } | |
| return ref; | |
| } | |
| /********************************************************** | |
| * IWineD3DDevice VTbl follows | |
| **********************************************************/ | |
| IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = | |
| { | |
| IWineD3DDeviceImpl_QueryInterface, | |
| IWineD3DDeviceImpl_AddRef, | |
| IWineD3DDeviceImpl_Release, | |
| IWineD3DDeviceImpl_CreateVertexBuffer | |
| }; |