Commit d13469c1 authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

d3d8: Moved the remaining code over to WineD3D (based on patches by

Oliver Stieber).
parent 4a8961ce
......@@ -14,19 +14,17 @@ C_SRCS = \
d3d8_main.c \
device.c \
directx.c \
drawprim.c \
indexbuffer.c \
pixelshader.c \
resource.c \
shader.c \
stateblock.c \
surface.c \
swapchain.c \
texture.c \
utils.c \
vertexbuffer.c \
vertexshader.c \
volume.c \
volumetexture.c \
vshaderdeclaration.c
volumetexture.c
RC_SRCS = version.rc
......
......@@ -161,17 +161,3 @@ const IDirect3DBaseTexture8Vtbl Direct3DBaseTexture8_Vtbl =
IDirect3DBaseTexture8Impl_GetLOD,
IDirect3DBaseTexture8Impl_GetLevelCount
};
BOOL WINAPI IDirect3DBaseTexture8Impl_IsDirty(LPDIRECT3DBASETEXTURE8 iface) {
IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
return ((IWineD3DBaseTextureImpl*)This->wineD3DBaseTexture)->baseTexture.dirty;
}
BOOL WINAPI IDirect3DBaseTexture8Impl_SetDirty(LPDIRECT3DBASETEXTURE8 iface, BOOL dirty) {
BOOL old;
IDirect3DBaseTexture8Impl *This = (IDirect3DBaseTexture8Impl *)iface;
old = ((IWineD3DBaseTextureImpl*)This->wineD3DBaseTexture)->baseTexture.dirty;
((IWineD3DBaseTextureImpl*)This->wineD3DBaseTexture)->baseTexture.dirty = dirty;
return old;
}
/* Direct3D 8
/*
* Direct3D 8
*
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -18,100 +21,74 @@
#include "config.h"
#include "initguid.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/debug.h"
#include "d3d8.h"
#include "d3d8_private.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
int num_lock = 0;
void (*wine_tsx11_lock_ptr)(void) = NULL;
void (*wine_tsx11_unlock_ptr)(void) = NULL;
int vs_mode = VS_HW; /* Hardware by default */
int ps_mode = PS_NONE; /* Disabled by default */
HRESULT WINAPI D3D8GetSWInfo(void)
{
HRESULT WINAPI D3D8GetSWInfo(void) {
FIXME("(void): stub\n");
return 0;
}
void WINAPI DebugSetMute(void)
{
void WINAPI DebugSetMute(void) {
/* nothing to do */
}
IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion)
{
IDirect3D8Impl *object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion) {
IDirect3D8Impl* object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3D8Impl));
object->lpVtbl = &Direct3D8_Vtbl;
object->direct3d8 = object;
object->ref = 1;
object->WineD3D = WineDirect3DCreate(SDKVersion, 8, (IUnknown *)object);
TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
return (IDirect3D8 *)object;
return (IDirect3D8*) object;
}
/* At process attach */
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
{
TRACE("D3D8 DLLMain Reason=%ld\n", fdwReason);
if (fdwReason == DLL_PROCESS_ATTACH)
{
HMODULE mod;
char buffer[32];
DWORD size = sizeof(buffer);
HKEY hkey = 0;
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) {
TRACE("fdwReason=%ld\n", fdwReason);
if (fdwReason == DLL_PROCESS_ATTACH) {
HMODULE mod;
DisableThreadLibraryCalls(hInstDLL);
DisableThreadLibraryCalls(hInstDLL);
mod = GetModuleHandleA( "winex11.drv" );
if (mod)
{
wine_tsx11_lock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_lock" );
wine_tsx11_unlock_ptr = (void *)GetProcAddress( mod, "wine_tsx11_unlock" );
}
/* @@ Wine registry key: HKCU\Software\Wine\Direct3D */
if ( !RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\Direct3D", &hkey) )
{
if ( !RegQueryValueExA( hkey, "VertexShaderMode", 0, NULL, (LPBYTE) buffer, &size) )
{
if (!strcmp(buffer,"none"))
{
TRACE("Disable vertex shaders\n");
vs_mode = VS_NONE;
}
else if (!strcmp(buffer,"emulation"))
{
TRACE("Force SW vertex shaders\n");
vs_mode = VS_SW;
}
}
if ( !RegQueryValueExA( hkey, "PixelShaderMode", 0, NULL, (LPBYTE) buffer, &size) )
{
if (!strcmp(buffer,"enabled"))
{
TRACE("Allow pixel shaders\n");
ps_mode = PS_HW;
}
}
}
if (vs_mode == VS_HW)
TRACE("Allow HW vertex shaders\n");
if (ps_mode == PS_NONE)
TRACE("Disable pixel shaders\n");
mod = GetModuleHandleA( "winex11.drv" );
if (mod)
{
wine_tsx11_lock_ptr = (void*) GetProcAddress(mod, "wine_tsx11_lock");
wine_tsx11_unlock_ptr = (void*) GetProcAddress(mod, "wine_tsx11_unlock");
}
}
return TRUE;
}
/***********************************************************************
* ValidateVertexShader (D3D8.@)
*
* PARAMS
* toto result?
*/
BOOL WINAPI ValidateVertexShader(LPVOID pFunction, int foo, int bar, void *fee, int rab)
{
FIXME("(void): stub: %p %d %d %p %d\n", pFunction, foo, bar, fee, rab);
return TRUE;
}
/***********************************************************************
* ValidatePixelShader (D3D8.@)
*
* PARAMS
* toto result?
*/
BOOL WINAPI ValidatePixelShader(LPVOID pFunction, int foo, int bar, void *fee, int rab)
{
FIXME("(void): stub: %p %d %d %p %d\n", pFunction, foo, bar, fee, rab);
return TRUE;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* IDirect3DIndexBuffer8 implementation
*
* Copyright 2002 Jason Edmeades
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,33 +19,23 @@
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
/* IDirect3DIndexBuffer8 IUnknown parts follow: */
HRESULT WINAPI IDirect3DIndexBuffer8Impl_QueryInterface(LPDIRECT3DINDEXBUFFER8 iface,REFIID riid,LPVOID *ppobj)
{
HRESULT WINAPI IDirect3DIndexBuffer8Impl_QueryInterface(LPDIRECT3DINDEXBUFFER8 iface, REFIID riid, LPVOID *ppobj) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DResource8)
|| IsEqualGUID(riid, &IID_IDirect3DIndexBuffer8)) {
IDirect3DIndexBuffer8Impl_AddRef(iface);
IUnknown_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
......@@ -64,106 +54,89 @@ ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 iface) {
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0 && 0 == This->refInt) {
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
if (ref == 0) {
IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer);
HeapFree(GetProcessHeap(), 0, This);
} else if (0 == ref) {
WARN("(%p) : The application failed to set indicies NULL before releasing the index buffer, leak\n", This);
}
return ref;
}
ULONG WINAPI IDirect3DIndexBuffer8Impl_AddRefInt(LPDIRECT3DINDEXBUFFER8 iface) {
/* IDirect3DIndexBuffer8 IDirect3DResource8 Interface follow: */
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
ULONG refInt = InterlockedIncrement(&This->refInt);
TRACE("(%p) : AddRefInt from %ld\n", This, refInt - 1);
return refInt;
TRACE("(%p) Relay\n", This);
return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
}
ULONG WINAPI IDirect3DIndexBuffer8Impl_ReleaseInt(LPDIRECT3DINDEXBUFFER8 iface) {
HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
ULONG refInt = InterlockedDecrement(&This->refInt);
TRACE("(%p) : ReleaseRefInt to %ld\n", This, refInt);
if (0 == This->ref && 0 == refInt) {
WARN("(%p) : Cleaning up after the calling application failed to release the indicies properly\n", This);
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
HeapFree(GetProcessHeap(), 0, This);
}
return refInt;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags);
}
/* IDirect3DResource Interface follow: */
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8** ppDevice) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
TRACE("(%p) : returning %p\n", This, This->Device);
*ppDevice = (LPDIRECT3DDEVICE8) This->Device;
IDirect3DDevice8Impl_AddRef(*ppDevice);
return D3D_OK;
}
HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData);
}
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
}
HRESULT WINAPI IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid) {
HRESULT WINAPI IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid);
}
DWORD WINAPI IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8 iface, DWORD PriorityNew) {
DWORD WINAPI IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8 iface, DWORD PriorityNew) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew);
}
DWORD WINAPI IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8 iface) {
DWORD WINAPI IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8 iface) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer);
}
void WINAPI IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 iface) {
void WINAPI IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 iface) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This);
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_PreLoad(This->wineD3DIndexBuffer);
}
D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer8Impl_GetType(LPDIRECT3DINDEXBUFFER8 iface) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
TRACE("(%p) : returning %d\n", This, This->ResourceType);
return This->ResourceType;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_GetType(This->wineD3DIndexBuffer);
}
/* IDirect3DIndexBuffer8 */
HRESULT WINAPI IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags) {
/* IDirect3DIndexBuffer8 Interface follow: */
HRESULT WINAPI IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE **ppbData, DWORD Flags) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
TRACE("(%p) : no locking yet, offset %d, size %d, Flags=%lx\n", This, OffsetToLock, SizeToLock, Flags);
*ppbData = (BYTE *)This->allocatedMemory + OffsetToLock;
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_Lock(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
}
HRESULT WINAPI IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 iface) {
HRESULT WINAPI IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 iface) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_Unlock(This->wineD3DIndexBuffer);
}
HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 iface, D3DINDEXBUFFER_DESC *pDesc) {
IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface;
TRACE("(%p) : copying into %p\n", This, pDesc);
memcpy(pDesc, &This->currentDesc, sizeof(D3DINDEXBUFFER_DESC));
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, pDesc);
}
const IDirect3DIndexBuffer8Vtbl Direct3DIndexBuffer8_Vtbl =
{
/* IUnknown */
IDirect3DIndexBuffer8Impl_QueryInterface,
IDirect3DIndexBuffer8Impl_AddRef,
IDirect3DIndexBuffer8Impl_Release,
/* IDirect3DResource8 */
IDirect3DIndexBuffer8Impl_GetDevice,
IDirect3DIndexBuffer8Impl_SetPrivateData,
IDirect3DIndexBuffer8Impl_GetPrivateData,
......@@ -172,6 +145,7 @@ const IDirect3DIndexBuffer8Vtbl Direct3DIndexBuffer8_Vtbl =
IDirect3DIndexBuffer8Impl_GetPriority,
IDirect3DIndexBuffer8Impl_PreLoad,
IDirect3DIndexBuffer8Impl_GetType,
/* IDirect3DIndexBuffer8 */
IDirect3DIndexBuffer8Impl_Lock,
IDirect3DIndexBuffer8Impl_Unlock,
IDirect3DIndexBuffer8Impl_GetDesc
......
/*
* IDirect3DPixelShader8 implementation
*
* Copyright 2002-2003 Jason Edmeades
* Raphael Junqueira
*
* 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 "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
/* IDirect3DPixelShader8 IUnknown parts follow: */
HRESULT WINAPI IDirect3DPixelShader8Impl_QueryInterface(IDirect3DPixelShader8 *iface, REFIID riid, LPVOID *ppobj) {
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DPixelShader8)) {
IUnknown_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
ULONG WINAPI IDirect3DPixelShader8Impl_AddRef(IDirect3DPixelShader8 *iface) {
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
return ref;
}
ULONG WINAPI IDirect3DPixelShader8Impl_Release(IDirect3DPixelShader8 * iface) {
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
IWineD3DPixelShader_Release(This->wineD3DPixelShader);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/* IDirect3DPixelShader8 Interface follow: */
HRESULT WINAPI IDirect3DPixelShader8Impl_GetDevice(IDirect3DPixelShader8 *iface, IDirect3DDevice8 **ppDevice) {
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
IWineD3DDevice *myDevice = NULL;
TRACE("(%p) : Relay\n", This);
IWineD3DPixelShader_GetDevice(This->wineD3DPixelShader, &myDevice);
IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
IWineD3DDevice_Release(myDevice);
TRACE("(%p) returing (%p)", This, *ppDevice);
return D3D_OK;
}
HRESULT WINAPI IDirect3DPixelShader8Impl_GetFunction(IDirect3DPixelShader8 *iface, VOID *pData, UINT *pSizeOfData) {
IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface;
TRACE("(%p) Relay\n", This);
return IWineD3DPixelShader_GetFunction(This->wineD3DPixelShader, pData, pSizeOfData);
}
const IDirect3DPixelShader8Vtbl Direct3DPixelShader8_Vtbl =
{
/* IUnknown */
IDirect3DPixelShader8Impl_QueryInterface,
IDirect3DPixelShader8Impl_AddRef,
IDirect3DPixelShader8Impl_Release,
/* IDirect3DPixelShader8 */
IDirect3DPixelShader8Impl_GetDevice,
IDirect3DPixelShader8Impl_GetFunction
};
/*
* IDirect3DResource8 implementation
*
* Copyright 2002 Jason Edmeades
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,32 +19,22 @@
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
/* IDirect3DResource IUnknown parts follow: */
HRESULT WINAPI IDirect3DResource8Impl_QueryInterface(LPDIRECT3DRESOURCE8 iface,REFIID riid,LPVOID *ppobj)
{
/* IDirect3DResource8 IUnknown parts follow: */
HRESULT WINAPI IDirect3DResource8Impl_QueryInterface(LPDIRECT3DRESOURCE8 iface, REFIID riid, LPVOID* ppobj) {
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DResource8)) {
IDirect3DResource8Impl_AddRef(iface);
IUnknown_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
......@@ -63,49 +53,67 @@ ULONG WINAPI IDirect3DResource8Impl_Release(LPDIRECT3DRESOURCE8 iface) {
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0)
if (ref == 0) {
IWineD3DResource_Release(This->wineD3DResource);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/* IDirect3DResource Interface follow: */
HRESULT WINAPI IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface, IDirect3DDevice8** ppDevice) {
/* IDirect3DResource8 Interface follow: */
HRESULT WINAPI IDirect3DResource8Impl_GetDevice(LPDIRECT3DRESOURCE8 iface, IDirect3DDevice8** ppDevice) {
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
TRACE("(%p) : returning %p\n", This, This->Device);
*ppDevice = (LPDIRECT3DDEVICE8) This->Device;
IDirect3DDevice8Impl_AddRef(*ppDevice);
IWineD3DDevice *myDevice = NULL;
TRACE("(%p) Relay\n", This);
IWineD3DResource_GetDevice(This->wineD3DResource, &myDevice);
IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
IWineD3DDevice_Release(myDevice);
return D3D_OK;
}
HRESULT WINAPI IDirect3DResource8Impl_SetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
HRESULT WINAPI IDirect3DResource8Impl_SetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_SetPrivateData(This->wineD3DResource, refguid, pData, SizeOfData, Flags);
}
HRESULT WINAPI IDirect3DResource8Impl_GetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
HRESULT WINAPI IDirect3DResource8Impl_GetPrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_GetPrivateData(This->wineD3DResource, refguid, pData, pSizeOfData);
}
HRESULT WINAPI IDirect3DResource8Impl_FreePrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid) {
HRESULT WINAPI IDirect3DResource8Impl_FreePrivateData(LPDIRECT3DRESOURCE8 iface, REFGUID refguid) {
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_FreePrivateData(This->wineD3DResource, refguid);
}
DWORD WINAPI IDirect3DResource8Impl_SetPriority(LPDIRECT3DRESOURCE8 iface, DWORD PriorityNew) {
DWORD WINAPI IDirect3DResource8Impl_SetPriority(LPDIRECT3DRESOURCE8 iface, DWORD PriorityNew) {
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
FIXME("(%p) : stub\n", This);
return 0;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_SetPriority(This->wineD3DResource, PriorityNew);
}
DWORD WINAPI IDirect3DResource8Impl_GetPriority(LPDIRECT3DRESOURCE8 iface) {
DWORD WINAPI IDirect3DResource8Impl_GetPriority(LPDIRECT3DRESOURCE8 iface) {
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
FIXME("(%p) : stub\n", This);
return 0;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_GetPriority(This->wineD3DResource);
}
void WINAPI IDirect3DResource8Impl_PreLoad(LPDIRECT3DRESOURCE8 iface) {
void WINAPI IDirect3DResource8Impl_PreLoad(LPDIRECT3DRESOURCE8 iface) {
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
FIXME("(%p) : stub\n", This);
TRACE("(%p) Relay\n", This);
IWineD3DResource_PreLoad(This->wineD3DResource);
return;
}
D3DRESOURCETYPE WINAPI IDirect3DResource8Impl_GetType(LPDIRECT3DRESOURCE8 iface) {
IDirect3DResource8Impl *This = (IDirect3DResource8Impl *)iface;
TRACE("(%p) : returning %d\n", This, This->ResourceType);
return This->ResourceType;
TRACE("(%p) Relay\n", This);
return IWineD3DResource_GetType(This->wineD3DResource);
}
const IDirect3DResource8Vtbl Direct3DResource8_Vtbl =
......
/*
* IDirect3DSwapChain8 implementation
*
* Copyright 2002 Jason Edmeades
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,32 +19,23 @@
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
/* IDirect3DSwapChain IUnknown parts follow: */
HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface,REFIID riid,LPVOID *ppobj)
HRESULT WINAPI IDirect3DSwapChain8Impl_QueryInterface(LPDIRECT3DSWAPCHAIN8 iface, REFIID riid, LPVOID* ppobj)
{
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DSwapChain8)) {
IDirect3DSwapChain8Impl_AddRef(iface);
IUnknown_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
......@@ -64,31 +55,32 @@ ULONG WINAPI IDirect3DSwapChain8Impl_Release(LPDIRECT3DSWAPCHAIN8 iface) {
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
IWineD3DSwapChain_Release(This->wineD3DSwapChain);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/* IDirect3DSwapChain parts follow: */
HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface, CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) {
/* IDirect3DSwapChain8 parts follow: */
HRESULT WINAPI IDirect3DSwapChain8Impl_Present(LPDIRECT3DSWAPCHAIN8 iface, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion) {
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
FIXME("(%p) : stub\n", This);
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DSwapChain_Present(This->wineD3DSwapChain, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion, 0);
}
HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) {
HRESULT WINAPI IDirect3DSwapChain8Impl_GetBackBuffer(LPDIRECT3DSWAPCHAIN8 iface, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface8** ppBackBuffer) {
IDirect3DSwapChain8Impl *This = (IDirect3DSwapChain8Impl *)iface;
*ppBackBuffer = (LPDIRECT3DSURFACE8) This->backBuffer;
TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, BackBuffer, Type, *ppBackBuffer);
HRESULT hrc = D3D_OK;
IWineD3DSurface *mySurface = NULL;
if (BackBuffer > This->PresentParms.BackBufferCount - 1) {
FIXME("Only one backBuffer currently supported\n");
return D3DERR_INVALIDCALL;
}
TRACE("(%p) Relay\n", This);
/* Note inc ref on returned surface */
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) *ppBackBuffer);
return D3D_OK;
hrc = IWineD3DSwapChain_GetBackBuffer(This->wineD3DSwapChain, iBackBuffer, Type, &mySurface);
if (hrc == D3D_OK && NULL != mySurface) {
IWineD3DSurface_GetParent(mySurface, (IUnknown **)ppBackBuffer);
IWineD3DSurface_Release(mySurface);
}
return hrc;
}
const IDirect3DSwapChain8Vtbl Direct3DSwapChain8_Vtbl =
......
......@@ -23,10 +23,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
#define D3D8_TEXTURE(a) ((IWineD3DTextureImpl*)(a->wineD3DTexture))
#define D3D8_TEXTURE_GET_SURFACE(a) ((IWineD3DSurfaceImpl*)(D3D8_TEXTURE(a)->surfaces[i]))
#define D3D8_BASETEXTURE(a) (((IWineD3DTextureImpl*)(a->wineD3DTexture))->baseTexture)
/* IDirect3DTexture8 IUnknown parts follow: */
HRESULT WINAPI IDirect3DTexture8Impl_QueryInterface(LPDIRECT3DTEXTURE8 iface, REFIID riid, LPVOID *ppobj) {
IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
......@@ -103,50 +99,10 @@ DWORD WINAPI IDirect3DTexture8Impl_GetPriority(LPDIRECT3DTEXTURE8 iface) {
return IWineD3DTexture_GetPriority(This->wineD3DTexture);
}
void WINAPI IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface) {
unsigned int i;
void WINAPI IDirect3DTexture8Impl_PreLoad(LPDIRECT3DTEXTURE8 iface) {
IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface;
TRACE("(%p) : About to load texture\n", This);
ENTER_GL();
for (i = 0; i < D3D8_BASETEXTURE(This).levels; i++) {
if (i == 0 && D3D8_TEXTURE_GET_SURFACE(This)->textureName != 0 && D3D8_BASETEXTURE(This).dirty == FALSE) {
glBindTexture(GL_TEXTURE_2D, D3D8_TEXTURE_GET_SURFACE(This)->textureName);
checkGLcall("glBindTexture");
TRACE("Texture %p (level %d) given name %d\n", D3D8_TEXTURE_GET_SURFACE(This), i, D3D8_TEXTURE_GET_SURFACE(This)->textureName);
/* No need to walk through all mip-map levels, since already all assigned */
i = D3D8_BASETEXTURE(This).levels;
} else {
if (i == 0) {
if (D3D8_TEXTURE_GET_SURFACE(This)->textureName == 0) {
glGenTextures(1, &(D3D8_TEXTURE_GET_SURFACE(This)->textureName));
checkGLcall("glGenTextures");
TRACE("Texture %p (level %d) given name %d\n", D3D8_TEXTURE_GET_SURFACE(This), i, D3D8_TEXTURE_GET_SURFACE(This)->textureName);
}
glBindTexture(GL_TEXTURE_2D, D3D8_TEXTURE_GET_SURFACE(This)->textureName);
checkGLcall("glBindTexture");
}
IWineD3DSurface_LoadTexture((IWineD3DSurface*)D3D8_TEXTURE_GET_SURFACE(This));
/* IDirect3DSurface8Impl_LoadTexture((LPDIRECT3DSURFACE8) D3D8_TEXTURE_GET_SURFACE(This), GL_TEXTURE_2D, i); */
}
}
/* No longer dirty */
D3D8_BASETEXTURE(This).dirty = FALSE;
/* Always need to reset the number of mipmap levels when rebinding as it is
a property of the active texture unit, and another texture may have set it
to a different value */
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", D3D8_BASETEXTURE(This).levels - 1);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, D3D8_BASETEXTURE(This).levels - 1);
checkGLcall("glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, This->levels)");
LEAVE_GL();
return ;
TRACE("(%p) Relay\n", This);
return IWineD3DTexture_PreLoad(This->wineD3DTexture);
}
D3DRESOURCETYPE WINAPI IDirect3DTexture8Impl_GetType(LPDIRECT3DTEXTURE8 iface) {
......
/*
* IDirect3DResource8 implementation
* IDirect3DVertexBuffer8 implementation
*
* Copyright 2002 Jason Edmeades
* Copyright 2005 Oliver Stieber
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,33 +19,24 @@
*/
#include "config.h"
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "wingdi.h"
#include "wine/debug.h"
#include "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
/* IDirect3DResource IUnknown parts follow: */
HRESULT WINAPI IDirect3DVertexBuffer8Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER8 iface, REFIID riid, LPVOID *ppobj)
{
/* IDirect3DVertexBuffer8 IUnknown parts follow: */
HRESULT WINAPI IDirect3DVertexBuffer8Impl_QueryInterface(LPDIRECT3DVERTEXBUFFER8 iface, REFIID riid, LPVOID *ppobj) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DResource8)
|| IsEqualGUID(riid, &IID_IDirect3DVertexBuffer8)) {
IDirect3DVertexBuffer8Impl_AddRef(iface);
IUnknown_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
WARN("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppobj);
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
......@@ -64,109 +55,101 @@ ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 iface) {
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0 && 0 == This->refInt) {
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
if (ref == 0) {
IWineD3DVertexBuffer_Release(This->wineD3DVertexBuffer);
HeapFree(GetProcessHeap(), 0, This);
} else if (0 == ref) {
WARN("(%p) : The application failed to set Stream source to NULL before releasing the vertex shader, leak\n", This);
}
return ref;
}
ULONG WINAPI IDirect3DVertexBuffer8Impl_AddRefInt(LPDIRECT3DVERTEXBUFFER8 iface) {
/* IDirect3DVertexBuffer8 IDirect3DResource8 Interface follow: */
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
ULONG refInt = InterlockedIncrement(&This->refInt);
TRACE("(%p) : AddRefInt from %ld\n", This, refInt - 1);
TRACE("(%p) Relay\n", This);
return refInt;
return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice);
}
ULONG WINAPI IDirect3DVertexBuffer8Impl_ReleaseInt(LPDIRECT3DVERTEXBUFFER8 iface) {
HRESULT WINAPI IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
ULONG refInt = InterlockedDecrement(&This->refInt);
TRACE("(%p) Relay\n", This);
TRACE("(%p) : ReleaseRefInt to %ld\n", This, refInt);
if (0 == This->ref && 0 == refInt) {
WARN("(%p) : Cleaning up after the calling application failed to release the stream source properly\n", This);
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
HeapFree(GetProcessHeap(), 0, This);
}
return refInt;
return IWineD3DVertexBuffer_SetPrivateData(This->wineD3DVertexBuffer, refguid, pData, SizeOfData, Flags);
}
/* IDirect3DResource Interface follow: */
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDevice(LPDIRECT3DVERTEXBUFFER8 iface, IDirect3DDevice8** ppDevice) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
TRACE("(%p) : returning %p\n", This, This->Device);
*ppDevice = (LPDIRECT3DDEVICE8) This->Device;
IDirect3DDevice8Impl_AddRef(*ppDevice);
return D3D_OK;
}
HRESULT WINAPI IDirect3DVertexBuffer8Impl_SetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
}
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetPrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DVertexBuffer_GetPrivateData(This->wineD3DVertexBuffer, refguid, pData, pSizeOfData);
}
HRESULT WINAPI IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid) {
HRESULT WINAPI IDirect3DVertexBuffer8Impl_FreePrivateData(LPDIRECT3DVERTEXBUFFER8 iface, REFGUID refguid) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DVertexBuffer_FreePrivateData(This->wineD3DVertexBuffer, refguid);
}
DWORD WINAPI IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFER8 iface, DWORD PriorityNew) {
DWORD WINAPI IDirect3DVertexBuffer8Impl_SetPriority(LPDIRECT3DVERTEXBUFFER8 iface, DWORD PriorityNew) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DVertexBuffer_SetPriority(This->wineD3DVertexBuffer, PriorityNew);
}
DWORD WINAPI IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFER8 iface) {
DWORD WINAPI IDirect3DVertexBuffer8Impl_GetPriority(LPDIRECT3DVERTEXBUFFER8 iface) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This); return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DVertexBuffer_GetPriority(This->wineD3DVertexBuffer);
}
void WINAPI IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 iface) {
void WINAPI IDirect3DVertexBuffer8Impl_PreLoad(LPDIRECT3DVERTEXBUFFER8 iface) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
FIXME("(%p) : stub\n", This);
TRACE("(%p) Relay\n", This);
IWineD3DVertexBuffer_PreLoad(This->wineD3DVertexBuffer);
return;
}
D3DRESOURCETYPE WINAPI IDirect3DVertexBuffer8Impl_GetType(LPDIRECT3DVERTEXBUFFER8 iface) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
TRACE("(%p) : returning %d\n", This, This->ResourceType);
return This->ResourceType;
TRACE("(%p) Relay\n", This);
return IWineD3DVertexBuffer_GetType(This->wineD3DVertexBuffer);
}
/* IDirect3DVertexBuffer8 */
HRESULT WINAPI IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE** ppbData, DWORD Flags) {
/* IDirect3DVertexBuffer8 Interface follow: */
HRESULT WINAPI IDirect3DVertexBuffer8Impl_Lock(LPDIRECT3DVERTEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE **ppbData, DWORD Flags) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
TRACE("(%p) : returning memory of %p (base:%p,offset:%u)\n", This, This->allocatedMemory + OffsetToLock, This->allocatedMemory, OffsetToLock);
/* TODO: check Flags compatibility with This->currentDesc.Usage (see MSDN) */
*ppbData = This->allocatedMemory + OffsetToLock;
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DVertexBuffer_Lock(This->wineD3DVertexBuffer, OffsetToLock, SizeToLock, ppbData, Flags);
}
HRESULT WINAPI IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8 iface) {
HRESULT WINAPI IDirect3DVertexBuffer8Impl_Unlock(LPDIRECT3DVERTEXBUFFER8 iface) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
TRACE("(%p) : stub\n", This);
return D3D_OK;
TRACE("(%p) Relay\n", This);
return IWineD3DVertexBuffer_Unlock(This->wineD3DVertexBuffer);
}
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8 iface, D3DVERTEXBUFFER_DESC *pDesc) {
HRESULT WINAPI IDirect3DVertexBuffer8Impl_GetDesc(LPDIRECT3DVERTEXBUFFER8 iface, D3DVERTEXBUFFER_DESC *pDesc) {
IDirect3DVertexBuffer8Impl *This = (IDirect3DVertexBuffer8Impl *)iface;
TRACE("(%p) Relay\n", This);
TRACE("(%p)\n", This);
pDesc->Format = This->currentDesc.Format;
pDesc->Type = This->currentDesc.Type;
pDesc->Usage = This->currentDesc.Usage;
pDesc->Pool = This->currentDesc.Pool;
pDesc->Size = This->currentDesc.Size;
pDesc->FVF = This->currentDesc.FVF;
return D3D_OK;
return IWineD3DVertexBuffer_GetDesc(This->wineD3DVertexBuffer, pDesc);
}
const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl =
{
/* IUnknown */
IDirect3DVertexBuffer8Impl_QueryInterface,
IDirect3DVertexBuffer8Impl_AddRef,
IDirect3DVertexBuffer8Impl_Release,
/* IDirect3DResource8 */
IDirect3DVertexBuffer8Impl_GetDevice,
IDirect3DVertexBuffer8Impl_SetPrivateData,
IDirect3DVertexBuffer8Impl_GetPrivateData,
......@@ -175,6 +158,7 @@ const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl =
IDirect3DVertexBuffer8Impl_GetPriority,
IDirect3DVertexBuffer8Impl_PreLoad,
IDirect3DVertexBuffer8Impl_GetType,
/* IDirect3DVertexBuffer8 */
IDirect3DVertexBuffer8Impl_Lock,
IDirect3DVertexBuffer8Impl_Unlock,
IDirect3DVertexBuffer8Impl_GetDesc
......
/*
* IDirect3DVertexShader8 implementation
*
* Copyright 2002-2003 Jason Edmeades
* Raphael Junqueira
*
* 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 "d3d8_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
/* IDirect3DVertexShader8 IUnknown parts follow: */
HRESULT WINAPI IDirect3DVertexShader8Impl_QueryInterface(IDirect3DVertexShader8 *iface, REFIID riid, LPVOID* ppobj) {
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
if (IsEqualGUID(riid, &IID_IUnknown)
|| IsEqualGUID(riid, &IID_IDirect3DVertexShader8)) {
IUnknown_AddRef(iface);
*ppobj = This;
return D3D_OK;
}
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE;
}
ULONG WINAPI IDirect3DVertexShader8Impl_AddRef(IDirect3DVertexShader8 *iface) {
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) : AddRef from %ld\n", This, ref - 1);
return ref;
}
ULONG WINAPI IDirect3DVertexShader8Impl_Release(IDirect3DVertexShader8 *iface) {
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) : ReleaseRef to %ld\n", This, ref);
if (ref == 0) {
IWineD3DVertexShader_Release(This->wineD3DVertexShader);
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
/* IDirect3DVertexShader8 Interface follow: */
HRESULT WINAPI IDirect3DVertexShader8Impl_GetDevice(IDirect3DVertexShader8 *iface, IDirect3DDevice8** ppDevice) {
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
IWineD3DDevice *myDevice = NULL;
HRESULT hr = D3D_OK;
TRACE("(%p) : Relay\n", This);
if (D3D_OK == (hr = IWineD3DVertexShader_GetDevice(This->wineD3DVertexShader, &myDevice) && myDevice != NULL)) {
hr = IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice);
IWineD3DDevice_Release(myDevice);
} else {
*ppDevice = NULL;
}
TRACE("(%p) returing (%p)", This, *ppDevice);
return hr;
}
HRESULT WINAPI IDirect3DVertexShader8Impl_GetFunction(IDirect3DVertexShader8 *iface, VOID* pData, UINT* pSizeOfData) {
IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface;
TRACE("(%p) : Relay\n", This);
return IWineD3DVertexShader_GetFunction(This->wineD3DVertexShader, pData, pSizeOfData);
}
const IDirect3DVertexShader8Vtbl Direct3DVertexShader8_Vtbl =
{
/* IUnknown */
IDirect3DVertexShader8Impl_QueryInterface,
IDirect3DVertexShader8Impl_AddRef,
IDirect3DVertexShader8Impl_Release,
/* IDirect3DVertexShader8 */
IDirect3DVertexShader8Impl_GetDevice,
IDirect3DVertexShader8Impl_GetFunction
};
......@@ -362,7 +362,7 @@ ULONG WINAPI IWineD3DDeviceImpl_Release(IWineD3DDevice *iface) {
if (!refCount) {
/* TODO: Clean up all the surfaces and textures! */
/* FIXME: Create targets and state blocks in d3d8 */
if (((IWineD3DImpl *)This->wineD3D)->dxVersion > 8) { /*We don't create a state block in d3d8 yet*/
if (((IWineD3DImpl *)This->wineD3D)->dxVersion >= 8) { /*We don't create state blocks for d3d7 yet*/
/* NOTE: You must release the parent if the object was created via a callback
** ***************************/
/* TODO: this is exactly the same as required by _Reset.., so at some point we need to move the code so that is can be called by reset add release... */
......
......@@ -1521,7 +1521,7 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
/* TODO: add support for NON-POW2 if avaialble
*/
if (This->dxVersion > 8) {
if (This->dxVersion >= 8) {
*pCaps->TextureCaps |= D3DPTEXTURECAPS_NONPOW2CONDITIONAL;
} else { /* NONPOW2 isn't accessible by d3d8 yet */
......@@ -1782,19 +1782,9 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
object->adapterNo = Adapter;
object->devType = DeviceType;
/* Let D3D8 use WineD3D's capability detection code. We can't use the block of code after this call yet
/ as D3D8 doesn't use WineD3D stateblocks / swapchains.
*/
if(This->dxVersion == 8) {
/* Setup some defaults for creating the implicit swapchain */
ENTER_GL();
IWineD3DImpl_FillGLCaps(&This->gl_info, IWineD3DImpl_GetAdapterDisplay(iface, Adapter));
LEAVE_GL();
}
/* FIXME: Use for dx8 code eventually too! */
/* FIXME: Use for dx7 code eventually too! */
/* Deliberately no indentation here, as this if will be removed when dx8 support merged in */
if (This->dxVersion > 8) {
if (This->dxVersion >= 8) {
TRACE("(%p) : Creating stateblock\n", This);
/* Creating the startup stateBlock - Note Special Case: 0 => Don't fill in yet! */
if (D3D_OK != IWineD3DDevice_CreateStateBlock((IWineD3DDevice *)object,
......
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