Add render target support, and ensure there is a front and back buffer
created during device creation.
This commit is contained in:
parent
202b340a51
commit
41427857b1
|
@ -643,6 +643,8 @@ struct IDirect3DSurface8Impl
|
|||
BOOL Dirty;
|
||||
BOOL inTexture;
|
||||
BOOL inPBuffer;
|
||||
|
||||
IWineD3DSurface *wineD3DSurface;
|
||||
};
|
||||
|
||||
/* IUnknown: */
|
||||
|
|
|
@ -538,6 +538,24 @@ static void IDirect3D8Impl_FillGLCaps(LPDIRECT3D8 iface, Display* display) {
|
|||
|
||||
}
|
||||
|
||||
/* Internal function called back during the CreateDevice to create a render target */
|
||||
HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Height,
|
||||
D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality, BOOL Lockable,
|
||||
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
|
||||
HRESULT res = D3D_OK;
|
||||
IDirect3DSurface8Impl *d3dSurface = NULL;
|
||||
|
||||
/* Note - Throw away MultisampleQuality and SharedHandle - only relevant for d3d9 */
|
||||
res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height,
|
||||
Format, MultiSample, Lockable,
|
||||
(IDirect3DSurface8 **)&d3dSurface);
|
||||
if (res == D3D_OK) {
|
||||
*ppSurface = d3dSurface->wineD3DSurface;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
|
||||
UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||
DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
|
||||
|
@ -583,7 +601,7 @@ HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface,
|
|||
localParameters.Flags = &pPresentationParameters->Flags;
|
||||
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
|
||||
localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval; /* Renamed in dx9 */
|
||||
IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object);
|
||||
IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D8CB_CreateRenderTarget);
|
||||
|
||||
/** use StateBlock Factory here, for creating the startup stateBlock */
|
||||
object->StateBlock = NULL;
|
||||
|
|
|
@ -479,7 +479,7 @@ IDirect3DSurface8Vtbl Direct3DSurface8_Vtbl =
|
|||
};
|
||||
|
||||
|
||||
HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, GLenum gl_target, GLenum gl_level) {
|
||||
HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, UINT gl_target, UINT gl_level) {
|
||||
IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface;
|
||||
|
||||
if (This->inTexture)
|
||||
|
|
|
@ -577,20 +577,8 @@ struct IDirect3DSurface9Impl
|
|||
DWORD ref;
|
||||
|
||||
/* IDirect3DResource9 fields */
|
||||
D3DRESOURCETYPE ResourceType;
|
||||
IWineD3DSurface *wineD3DSurface;
|
||||
|
||||
/* IDirect3DSurface9 fields */
|
||||
IUnknown *Container;
|
||||
D3DSURFACE_DESC myDesc;
|
||||
BYTE *allocatedMemory;
|
||||
UINT textureName;
|
||||
UINT bytesPerPixel;
|
||||
|
||||
BOOL lockable;
|
||||
BOOL locked;
|
||||
RECT lockedRect;
|
||||
RECT dirtyRect;
|
||||
BOOL Dirty;
|
||||
};
|
||||
|
||||
/* IUnknown: */
|
||||
|
|
|
@ -114,10 +114,11 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetCreationParameters(LPDIRECT3DDEVICE9 if
|
|||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetCursorProperties(LPDIRECT3DDEVICE9 iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) {
|
||||
IDirect3DSurface9Impl* pSur = (IDirect3DSurface9Impl*) pCursorBitmap;
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
TRACE("(%p) : Spot Pos(%u,%u)\n", This, XHotSpot, YHotSpot);
|
||||
|
||||
/* TODO:
|
||||
IDirect3DSurface9Impl* pSur = (IDirect3DSurface9Impl*) pCursorBitmap;
|
||||
if (D3DFMT_A8R8G8B8 != pSur->myDesc.Format) {
|
||||
ERR("(%p) : surface(%p) have a invalid format\n", This, pCursorBitmap);
|
||||
return D3DERR_INVALIDCALL;
|
||||
|
@ -126,6 +127,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetCursorProperties(LPDIRECT3DDEVICE9 ifac
|
|||
ERR("(%p) : surface(%p) have a invalid size\n", This, pCursorBitmap);
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
*/
|
||||
|
||||
This->xHotSpot = XHotSpot;
|
||||
This->yHotSpot = YHotSpot;
|
||||
|
@ -205,9 +207,21 @@ void WINAPI IDirect3DDevice9Impl_GetGammaRamp(LPDIRECT3DDEVICE9 iface, UINT iSwa
|
|||
return;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height,
|
||||
D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality, BOOL Lockable,
|
||||
IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) {
|
||||
IDirect3DSurface9Impl *object;
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
|
||||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface9Impl));
|
||||
object->lpVtbl = &Direct3DSurface9_Vtbl;
|
||||
object->ref = 1;
|
||||
IWineD3DDevice_CreateRenderTarget(This->WineD3DDevice, Width, Height, Format, MultiSample, MultisampleQuality,
|
||||
Lockable, &object->wineD3DSurface, pSharedHandle, (IUnknown *)This);
|
||||
*ppSurface = (LPDIRECT3DSURFACE9) object;
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -152,6 +152,23 @@ HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT Adapte
|
|||
return IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter);
|
||||
}
|
||||
|
||||
/* Internal function called back during the CreateDevice to create a render target */
|
||||
HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Height,
|
||||
D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality, BOOL Lockable,
|
||||
IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) {
|
||||
HRESULT res = D3D_OK;
|
||||
IDirect3DSurface9Impl *d3dSurface = NULL;
|
||||
|
||||
res = IDirect3DDevice9_CreateRenderTarget((IDirect3DDevice9 *)device, Width, Height,
|
||||
Format, MultiSample, MultisampleQuality, Lockable,
|
||||
(IDirect3DSurface9 **)&d3dSurface, pSharedHandle);
|
||||
if (res == D3D_OK) {
|
||||
*ppSurface = d3dSurface->wineD3DSurface;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||
DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters,
|
||||
IDirect3DDevice9** ppReturnedDeviceInterface) {
|
||||
|
@ -191,7 +208,7 @@ HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3
|
|||
localParameters.Flags = &pPresentationParameters->Flags;
|
||||
localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz;
|
||||
localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval;
|
||||
IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object);
|
||||
IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D9CB_CreateRenderTarget);
|
||||
|
||||
FIXME("(%p) : incomplete stub\n", This);
|
||||
return D3D_OK;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* IDirect3DSurface9 implementation
|
||||
*
|
||||
* Copyright 2002-2003 Jason Edmeades
|
||||
* Copyright 2002-2005 Jason Edmeades
|
||||
* Raphael Junqueira
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
|
@ -29,7 +29,7 @@ HRESULT WINAPI IDirect3DSurface9Impl_QueryInterface(LPDIRECT3DSURFACE9 iface, RE
|
|||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IDirect3DResource9)
|
||||
|| IsEqualGUID(riid, &IID_IDirect3DResource9)
|
||||
|| IsEqualGUID(riid, &IID_IDirect3DSurface9)) {
|
||||
IDirect3DSurface9Impl_AddRef(iface);
|
||||
*ppobj = This;
|
||||
|
@ -43,16 +43,16 @@ HRESULT WINAPI IDirect3DSurface9Impl_QueryInterface(LPDIRECT3DSURFACE9 iface, RE
|
|||
ULONG WINAPI IDirect3DSurface9Impl_AddRef(LPDIRECT3DSURFACE9 iface) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
TRACE("(%p) : AddRef from %ld\n", This, This->ref);
|
||||
return ++(This->ref);
|
||||
return InterlockedIncrement(&This->ref);
|
||||
}
|
||||
|
||||
ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
ULONG ref = --This->ref;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref);
|
||||
if (ref == 0) {
|
||||
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
IWineD3DBaseTexture_Release(This->wineD3DSurface);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
@ -65,89 +65,103 @@ HRESULT WINAPI IDirect3DSurface9Impl_GetDevice(LPDIRECT3DSURFACE9 iface, IDirect
|
|||
|
||||
HRESULT WINAPI IDirect3DSurface9Impl_SetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DSurface9Impl_GetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DSurface9Impl_FreePrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid);
|
||||
}
|
||||
|
||||
DWORD WINAPI IDirect3DSurface9Impl_SetPriority(LPDIRECT3DSURFACE9 iface, DWORD PriorityNew) {
|
||||
DWORD WINAPI IDirect3DSurface9Impl_SetPriority(LPDIRECT3DSURFACE9 iface, DWORD PriorityNew) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew);
|
||||
return IWineD3DSurface_SetPriority(This->wineD3DSurface, PriorityNew);
|
||||
}
|
||||
|
||||
DWORD WINAPI IDirect3DSurface9Impl_GetPriority(LPDIRECT3DSURFACE9 iface) {
|
||||
DWORD WINAPI IDirect3DSurface9Impl_GetPriority(LPDIRECT3DSURFACE9 iface) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This);
|
||||
return IWineD3DSurface_GetPriority(This->wineD3DSurface);
|
||||
}
|
||||
|
||||
void WINAPI IDirect3DSurface9Impl_PreLoad(LPDIRECT3DSURFACE9 iface) {
|
||||
void WINAPI IDirect3DSurface9Impl_PreLoad(LPDIRECT3DSURFACE9 iface) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
IWineD3DSurface_PreLoad(This->wineD3DSurface);
|
||||
return ;
|
||||
}
|
||||
|
||||
D3DRESOURCETYPE WINAPI IDirect3DSurface9Impl_GetType(LPDIRECT3DSURFACE9 iface) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This);
|
||||
return IWineD3DSurface_GetType(This->wineD3DSurface);
|
||||
}
|
||||
|
||||
/* IDirect3DSurface9 Interface follow: */
|
||||
HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 iface, REFIID riid, void** ppContainer) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
HRESULT res;
|
||||
res = IUnknown_QueryInterface(This->Container, riid, ppContainer);
|
||||
if (E_NOINTERFACE == res) {
|
||||
/**
|
||||
* If the surface is created using CreateImageSurface, CreateRenderTarget,
|
||||
* or CreateDepthStencilSurface, the surface is considered stand alone. In this case,
|
||||
* GetContainer will return the Direct3D device used to create the surface.
|
||||
*/
|
||||
res = IUnknown_QueryInterface(This->Container, &IID_IDirect3DDevice9, ppContainer);
|
||||
|
||||
/* The container returned from IWineD3DSurface_GetContainer is either a IWineD3DDevice or
|
||||
opne of the subclasses of resource */
|
||||
IUnknown *IWineContainer = NULL;
|
||||
res = IWineD3DSurface_GetContainer(This->wineD3DSurface, riid, (void **)&IWineContainer);
|
||||
|
||||
if (res == D3D_OK) {
|
||||
IWineD3DDevice *myDevice = NULL;
|
||||
IWineD3DResource_GetDevice((IWineD3DSurface *)This->wineD3DSurface, &myDevice);
|
||||
|
||||
if (IWineContainer == (IUnknown *)myDevice) {
|
||||
IWineD3DDevice_GetParent((IWineD3DDevice *)IWineContainer, (IUnknown **)ppContainer);
|
||||
IWineD3DDevice_Release((IWineD3DDevice *)IWineContainer);
|
||||
} else {
|
||||
IWineD3DResource_GetParent((IWineD3DResource *)IWineContainer, (IUnknown **)ppContainer);
|
||||
IWineD3DResource_Release((IWineD3DResource *)IWineContainer);
|
||||
}
|
||||
|
||||
IWineD3DDevice_Release(myDevice);
|
||||
}
|
||||
TRACE("(%p) : returning %p\n", This, *ppContainer);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
TRACE("(%p) : copying into %p\n", This, pDesc);
|
||||
memcpy(pDesc, &This->myDesc, sizeof(D3DSURFACE_DESC));
|
||||
return D3D_OK;
|
||||
WINED3DSURFACE_DESC wined3ddesc;
|
||||
|
||||
/* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */
|
||||
wined3ddesc.Format = &pDesc->Format;
|
||||
wined3ddesc.Type = &pDesc->Type;
|
||||
wined3ddesc.Usage = &pDesc->Usage;
|
||||
wined3ddesc.Pool = &pDesc->Pool;
|
||||
wined3ddesc.MultiSampleType = &pDesc->MultiSampleType;
|
||||
wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality;
|
||||
wined3ddesc.Width = &pDesc->Width;
|
||||
wined3ddesc.Height = &pDesc->Height;
|
||||
|
||||
return IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DSurface9Impl_LockRect(LPDIRECT3DSURFACE9 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DSurface_LockRect(This->wineD3DSurface, pLockedRect, pRect, Flags);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DSurface9Impl_UnlockRect(LPDIRECT3DSURFACE9 iface) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DSurface_UnlockRect(This->wineD3DSurface);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DSurface9Impl_GetDC(LPDIRECT3DSURFACE9 iface, HDC* phdc) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DSurface_GetDC(This->wineD3DSurface, phdc);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DSurface9Impl_ReleaseDC(LPDIRECT3DSURFACE9 iface, HDC hdc) {
|
||||
IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
return D3D_OK;
|
||||
return IWineD3DSurface_ReleaseDC(This->wineD3DSurface, hdc);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ C_SRCS = \
|
|||
indexbuffer.c \
|
||||
resource.c \
|
||||
stateblock.c \
|
||||
surface.c \
|
||||
utils.c \
|
||||
vertexbuffer.c \
|
||||
vertexshader.c \
|
||||
|
|
|
@ -48,7 +48,7 @@ ULONG WINAPI IWineD3DBaseTextureImpl_Release(IWineD3DBaseTexture *iface) {
|
|||
TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
|
||||
ref = InterlockedDecrement(&This->resource.ref);
|
||||
if (ref == 0) {
|
||||
IWineD3DDevice_Release(This->resource.wineD3DDevice);
|
||||
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
} else {
|
||||
IUnknown_Release(This->resource.parent); /* Released the reference to the d3dx object */
|
||||
|
@ -134,6 +134,15 @@ void WINAPI IWineD3DBaseTextureImpl_GenerateMipSubLevels(IWineD3DBaseTexture *if
|
|||
return ;
|
||||
}
|
||||
|
||||
/* Internal function, No d3d mapping */
|
||||
BOOL WINAPI IWineD3DBaseTextureImpl_SetDirty(IWineD3DBaseTexture *iface, BOOL dirty) {
|
||||
BOOL old;
|
||||
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
|
||||
old = This->baseTexture.dirty;
|
||||
This->baseTexture.dirty = dirty;
|
||||
return old;
|
||||
}
|
||||
|
||||
IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl =
|
||||
{
|
||||
IWineD3DBaseTextureImpl_QueryInterface,
|
||||
|
@ -153,5 +162,6 @@ IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl =
|
|||
IWineD3DBaseTextureImpl_GetLevelCount,
|
||||
IWineD3DBaseTextureImpl_SetAutoGenFilterType,
|
||||
IWineD3DBaseTextureImpl_GetAutoGenFilterType,
|
||||
IWineD3DBaseTextureImpl_GenerateMipSubLevels
|
||||
IWineD3DBaseTextureImpl_GenerateMipSubLevels,
|
||||
IWineD3DBaseTextureImpl_SetDirty
|
||||
};
|
||||
|
|
|
@ -217,8 +217,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexBuffer(IWineD3DDevice *iface, UINT
|
|||
|
||||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DVertexBufferImpl));
|
||||
if (NULL == object) {
|
||||
*ppVertexBuffer = NULL;
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
object->lpVtbl = &IWineD3DVertexBuffer_Vtbl;
|
||||
object->resource.wineD3DDevice= iface;
|
||||
object->resource.wineD3DDevice= This;
|
||||
IWineD3DDevice_AddRef(iface);
|
||||
object->resource.parent = parent;
|
||||
object->resource.resourceType = D3DRTYPE_VERTEXBUFFER;
|
||||
|
@ -243,11 +247,15 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface, UINT
|
|||
|
||||
/* Allocate the storage for the device */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DIndexBufferImpl));
|
||||
if (NULL == object) {
|
||||
*ppIndexBuffer = NULL;
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
object->lpVtbl = &IWineD3DIndexBuffer_Vtbl;
|
||||
object->resource.wineD3DDevice = iface;
|
||||
object->resource.wineD3DDevice = This;
|
||||
IWineD3DDevice_AddRef(iface);
|
||||
object->resource.resourceType = D3DRTYPE_INDEXBUFFER;
|
||||
object->resource.parent = parent;
|
||||
IWineD3DDevice_AddRef(iface);
|
||||
object->resource.ref = 1;
|
||||
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, Length);
|
||||
object->currentDesc.Usage = Usage;
|
||||
|
@ -269,8 +277,12 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTA
|
|||
|
||||
/* Allocate Storage for the state block */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DStateBlockImpl));
|
||||
if (NULL == object) {
|
||||
*ppStateBlock = NULL;
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
object->lpVtbl = &IWineD3DStateBlock_Vtbl;
|
||||
object->wineD3DDevice = iface;
|
||||
object->wineD3DDevice = This;
|
||||
IWineD3DDevice_AddRef(iface);
|
||||
object->parent = parent;
|
||||
object->ref = 1;
|
||||
|
@ -292,6 +304,49 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, D3DSTA
|
|||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DDeviceImpl_CreateRenderTarget(IWineD3DDevice *iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality, BOOL Lockable, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle,
|
||||
IUnknown *parent) {
|
||||
IWineD3DSurfaceImpl *object;
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DSurfaceImpl));
|
||||
if (NULL == object) {
|
||||
*ppSurface = NULL;
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
}
|
||||
object->lpVtbl = &IWineD3DSurface_Vtbl;
|
||||
object->resource.wineD3DDevice = This;
|
||||
IWineD3DDevice_AddRef(iface);
|
||||
object->resource.resourceType = D3DRTYPE_SURFACE;
|
||||
object->resource.parent = parent;
|
||||
object->resource.ref = 1;
|
||||
*ppSurface = (IWineD3DSurface *)object;
|
||||
object->container = (IUnknown*) This;
|
||||
|
||||
object->currentDesc.Width = Width;
|
||||
object->currentDesc.Height = Height;
|
||||
object->currentDesc.Format = Format;
|
||||
object->currentDesc.Type = D3DRTYPE_SURFACE;
|
||||
object->currentDesc.Usage = D3DUSAGE_RENDERTARGET;
|
||||
object->currentDesc.Pool = D3DPOOL_DEFAULT;
|
||||
object->currentDesc.MultiSampleType = MultiSample;
|
||||
object->bytesPerPixel = D3DFmtGetBpp(This, Format);
|
||||
if (Format == D3DFMT_DXT1) {
|
||||
object->currentDesc.Size = (Width * object->bytesPerPixel)/2 * Height; /* DXT1 is half byte per pixel */
|
||||
} else {
|
||||
object->currentDesc.Size = (Width * object->bytesPerPixel) * Height;
|
||||
}
|
||||
object->allocatedMemory = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, object->currentDesc.Size);
|
||||
object->lockable = Lockable;
|
||||
object->locked = FALSE;
|
||||
memset(&object->lockedRect, 0, sizeof(RECT));
|
||||
IWineD3DSurface_CleanDirtyRect(*ppSurface);
|
||||
|
||||
TRACE("(%p) : w(%d) h(%d) fmt(%d,%s) lockable(%d) surf@%p, surfmem@%p, %d bytes\n", This, Width, Height, Format, debug_d3dformat(Format), Lockable, *ppSurface, object->allocatedMemory, object->currentDesc.Size);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
/*****
|
||||
* Get / Set FVF
|
||||
*****/
|
||||
|
@ -1158,12 +1213,10 @@ HRESULT WINAPI IWineD3DDeviceImpl_SetViewport(IWineD3DDevice *iface, CONST WINED
|
|||
glDepthRange(pViewport->MinZ, pViewport->MaxZ);
|
||||
checkGLcall("glDepthRange");
|
||||
|
||||
#if 0 /* TODO */
|
||||
/* Note: GL requires lower left, DirectX supplies upper left */
|
||||
glViewport(pViewport->X, (This->renderTarget->myDesc.Height - (pViewport->Y + pViewport->Height)),
|
||||
glViewport(pViewport->X, (This->renderTarget->currentDesc.Height - (pViewport->Y + pViewport->Height)),
|
||||
pViewport->Width, pViewport->Height);
|
||||
checkGLcall("glViewport");
|
||||
#endif
|
||||
|
||||
LEAVE_GL();
|
||||
|
||||
|
@ -2610,25 +2663,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface) {
|
|||
glFlush();
|
||||
checkGLcall("glFlush");
|
||||
|
||||
#if 0 /* TODO: render targer support */
|
||||
if ((This->frontBuffer != This->renderTarget) && (This->backBuffer != This->renderTarget)) {
|
||||
|
||||
IWineD3DBaseTexture *cont = NULL;
|
||||
HRESULT hr;
|
||||
/* If we are rendering to a texture (surface) then flag it as dirty.
|
||||
A surfaces container is either the appropriate texture or the device itself
|
||||
depending on how the surface was created. */
|
||||
if (This->renderTarget != NULL && ((IWineD3DDeviceImpl *)This->renderTarget->container != This)) {
|
||||
|
||||
hr = IDirect3DSurface8_GetContainer((LPDIRECT3DSURFACE8) This->renderTarget, &IID_IDirect3DBaseTexture8, (void**) &cont);
|
||||
if (SUCCEEDED(hr) && NULL != cont) {
|
||||
/** always dirtify for now. we must find a better way to see that surface have been modified */
|
||||
This->renderTarget->inPBuffer = TRUE;
|
||||
This->renderTarget->inTexture = FALSE;
|
||||
IDirect3DBaseTexture8Impl_SetDirty(cont, TRUE);
|
||||
IDirect3DBaseTexture8_PreLoad(cont);
|
||||
This->renderTarget->inPBuffer = FALSE;
|
||||
IDirect3DBaseTexture8Impl_Release(cont);
|
||||
cont = NULL;
|
||||
}
|
||||
IWineD3DBaseTexture *cont = (IWineD3DBaseTexture *)This->renderTarget->container;
|
||||
/** always dirtify for now. we must find a better way to see that surface have been modified */
|
||||
This->renderTarget->inPBuffer = TRUE;
|
||||
This->renderTarget->inTexture = FALSE;
|
||||
IWineD3DBaseTexture_SetDirty(cont, TRUE);
|
||||
IWineD3DBaseTexture_PreLoad(cont);
|
||||
This->renderTarget->inPBuffer = FALSE;
|
||||
}
|
||||
}
|
||||
#endif /* TODO: render targer support */
|
||||
|
||||
LEAVE_GL();
|
||||
return D3D_OK;
|
||||
|
@ -2776,24 +2826,22 @@ HRESULT WINAPI IWineD3DDeviceImpl_Clear(IWineD3DDevice *iface, DWORD Count, CONS
|
|||
/* Now process each rect in turn */
|
||||
for (i = 0; i < Count || i == 0; i++) {
|
||||
|
||||
#if 0 /* TODO: renderTarget support */
|
||||
if (curRect) {
|
||||
/* Note gl uses lower left, width/height */
|
||||
TRACE("(%p) %p Rect=(%ld,%ld)->(%ld,%ld) glRect=(%ld,%ld), len=%ld, hei=%ld\n", This, curRect,
|
||||
curRect->x1, curRect->y1, curRect->x2, curRect->y2,
|
||||
curRect->x1, (This->renderTarget->myDesc.Height - curRect->y2),
|
||||
curRect->x1, (This->renderTarget->currentDesc.Height - curRect->y2),
|
||||
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
|
||||
glScissor(curRect->x1, (This->renderTarget->myDesc.Height - curRect->y2),
|
||||
glScissor(curRect->x1, (This->renderTarget->currentDesc.Height - curRect->y2),
|
||||
curRect->x2 - curRect->x1, curRect->y2 - curRect->y1);
|
||||
checkGLcall("glScissor");
|
||||
} else {
|
||||
glScissor(This->stateBlock->viewport.X,
|
||||
(This->renderTarget->myDesc.Height - (This->stateBlock->viewport.Y + This->stateBlock->viewport.Height)),
|
||||
(This->renderTarget->currentDesc.Height - (This->stateBlock->viewport.Y + This->stateBlock->viewport.Height)),
|
||||
This->stateBlock->viewport.Width,
|
||||
This->stateBlock->viewport.Height);
|
||||
checkGLcall("glScissor");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Clear the selected rectangle (or full screen) */
|
||||
glClear(glMask);
|
||||
|
@ -2980,6 +3028,7 @@ IWineD3DDeviceVtbl IWineD3DDevice_Vtbl =
|
|||
IWineD3DDeviceImpl_CreateVertexBuffer,
|
||||
IWineD3DDeviceImpl_CreateIndexBuffer,
|
||||
IWineD3DDeviceImpl_CreateStateBlock,
|
||||
IWineD3DDeviceImpl_CreateRenderTarget,
|
||||
|
||||
IWineD3DDeviceImpl_SetFVF,
|
||||
IWineD3DDeviceImpl_GetFVF,
|
||||
|
|
|
@ -1313,7 +1313,7 @@ HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, D3DDEVT
|
|||
and fields being inserted in the middle, a new structure is used in place */
|
||||
HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow,
|
||||
DWORD BehaviourFlags, WINED3DPRESENT_PARAMETERS* pPresentationParameters,
|
||||
IWineD3DDevice** ppReturnedDeviceInterface, IUnknown *parent) {
|
||||
IWineD3DDevice** ppReturnedDeviceInterface, IUnknown *parent, D3DCB_CREATERENDERTARGETFN D3DCB_CreateRenderTarget) {
|
||||
|
||||
HWND whichHWND;
|
||||
HDC hDc;
|
||||
|
@ -1479,23 +1479,32 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
|
|||
/* Setup surfaces for the backbuffer, frontbuffer and depthstencil buffer */
|
||||
TRACE("Creating initial device surfaces\n");
|
||||
|
||||
/* TODO:
|
||||
IWineD3DDevice_CreateRenderTarget((IWineD3DDevice *) object,
|
||||
*(pPresentationParameters->BackBufferWidth),
|
||||
*(pPresentationParameters->BackBufferHeight),
|
||||
*(pPresentationParameters->BackBufferFormat),
|
||||
*(pPresentationParameters->MultiSampleType),
|
||||
TRUE,
|
||||
(IWineD3DSurface *) &object->frontBuffer);
|
||||
/* We need to 'magic' either d3d8 or d3d9 surfaces for the front and backbuuffer
|
||||
but the respective CreateRenderTarget functions take a differing number of
|
||||
parms. Fix this by passing in a function to call which takes identical parms
|
||||
and handles the differences at the d3dx layer, and returns the IWineD3DSurface
|
||||
pointer rather than the created D3D8/9 one */
|
||||
D3DCB_CreateRenderTarget((IUnknown *) parent,
|
||||
*(pPresentationParameters->BackBufferWidth),
|
||||
*(pPresentationParameters->BackBufferHeight),
|
||||
*(pPresentationParameters->BackBufferFormat),
|
||||
*(pPresentationParameters->MultiSampleType),
|
||||
*(pPresentationParameters->MultiSampleQuality),
|
||||
TRUE,
|
||||
(IWineD3DSurface **) &object->frontBuffer,
|
||||
NULL);
|
||||
|
||||
IWineD3DDevice_CreateRenderTarget((IWineD3DDevice *) object,
|
||||
*(pPresentationParameters->BackBufferWidth),
|
||||
*(pPresentationParameters->BackBufferHeight),
|
||||
*(pPresentationParameters->BackBufferFormat),
|
||||
*(pPresentationParameters->MultiSampleType),
|
||||
TRUE,
|
||||
(IWineD3DSurface *) &object->backBuffer);
|
||||
D3DCB_CreateRenderTarget((IUnknown *) parent,
|
||||
*(pPresentationParameters->BackBufferWidth),
|
||||
*(pPresentationParameters->BackBufferHeight),
|
||||
*(pPresentationParameters->BackBufferFormat),
|
||||
*(pPresentationParameters->MultiSampleType),
|
||||
*(pPresentationParameters->MultiSampleQuality),
|
||||
TRUE,
|
||||
(IWineD3DSurface **) &object->backBuffer,
|
||||
NULL);
|
||||
|
||||
/* TODO:
|
||||
if (*(pPresentationParameters->EnableAutoDepthStencil)) {
|
||||
IWineD3DDevice_CreateDepthStencilSurface((IWineD3DDevice *) object,
|
||||
*(pPresentationParameters->BackBufferWidth),
|
||||
|
@ -1512,10 +1521,10 @@ HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, D3DDEV
|
|||
/* init the default renderTarget management */
|
||||
object->drawable = object->win;
|
||||
object->render_ctx = object->glCtx;
|
||||
/* TODO:
|
||||
object->renderTarget = object->backBuffer;
|
||||
|
||||
IWineD3DSurface_AddRef((IWineD3DSurface *) object->renderTarget);
|
||||
/* TODO: Depth Stencil support
|
||||
object->stencilBufferTarget = object->depthStencilBuffer;
|
||||
if (NULL != object->stencilBufferTarget) {
|
||||
IDirect3DSurface8Impl_AddRef((LPDIRECT3DSURFACE8) object->stencilBufferTarget);
|
||||
|
|
|
@ -50,7 +50,7 @@ ULONG WINAPI IWineD3DIndexBufferImpl_Release(IWineD3DIndexBuffer *iface) {
|
|||
ref = InterlockedDecrement(&This->resource.ref);
|
||||
if (ref == 0) {
|
||||
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
|
||||
IWineD3DDevice_Release(This->resource.wineD3DDevice);
|
||||
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
} else {
|
||||
IUnknown_Release(This->resource.parent); /* Released the reference to the d3dx object */
|
||||
|
|
|
@ -46,7 +46,7 @@ ULONG WINAPI IWineD3DResourceImpl_Release(IWineD3DResource *iface) {
|
|||
TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
|
||||
ref = InterlockedDecrement(&This->resource.ref);
|
||||
if (ref == 0) {
|
||||
IWineD3DDevice_Release(This->resource.wineD3DDevice);
|
||||
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return ref;
|
||||
|
|
|
@ -60,102 +60,102 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
|
|||
|
||||
/* Render states: */
|
||||
if (ThisDevice->presentParms.EnableAutoDepthStencil) {
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ZENABLE, D3DZB_TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ZENABLE, D3DZB_TRUE);
|
||||
} else {
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ZENABLE, D3DZB_FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ZENABLE, D3DZB_FALSE);
|
||||
}
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_FILLMODE, D3DFILL_SOLID);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_FILLMODE, D3DFILL_SOLID);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
|
||||
|
||||
lp.lp.wRepeatFactor = 0; lp.lp.wLinePattern = 0;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_LINEPATTERN, lp.d);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ZWRITEENABLE, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ALPHATESTENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_LASTPIXEL, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_SRCBLEND, D3DBLEND_ONE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_DESTBLEND, D3DBLEND_ZERO);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_CULLMODE, D3DCULL_CCW);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ALPHAFUNC, D3DCMP_ALWAYS);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ALPHAREF, 0xff); /*??*/
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_DITHERENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_FOGENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_SPECULARENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ZVISIBLE, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_FOGCOLOR, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_FOGTABLEMODE, D3DFOG_NONE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_LINEPATTERN, lp.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ZWRITEENABLE, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ALPHATESTENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_LASTPIXEL, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_SRCBLEND, D3DBLEND_ONE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_DESTBLEND, D3DBLEND_ZERO);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_CULLMODE, D3DCULL_CCW);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ZFUNC, D3DCMP_LESSEQUAL);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ALPHAFUNC, D3DCMP_ALWAYS);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ALPHAREF, 0xff); /*??*/
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_DITHERENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_FOGENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_SPECULARENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ZVISIBLE, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_FOGCOLOR, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_FOGTABLEMODE, D3DFOG_NONE);
|
||||
tmpfloat.f = 0.0f;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_FOGSTART, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_FOGSTART, tmpfloat.d);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_FOGEND, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_FOGEND, tmpfloat.d);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_FOGDENSITY, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_EDGEANTIALIAS, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_ZBIAS, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_RANGEFOGENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_STENCILENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_STENCILPASS, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_FOGDENSITY, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_EDGEANTIALIAS, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_ZBIAS, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_RANGEFOGENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_STENCILENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_STENCILFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_STENCILZFAIL, D3DSTENCILOP_KEEP);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_STENCILPASS, D3DSTENCILOP_KEEP);
|
||||
|
||||
/* Setting stencil func also uses values for stencil ref/mask, so manually set defaults
|
||||
* so only a single call performed (and ensure defaults initialized before making that call)
|
||||
*
|
||||
* IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_STENCILREF, 0);
|
||||
* IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_STENCILMASK, 0xFFFFFFFF);
|
||||
* IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_STENCILREF, 0);
|
||||
* IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_STENCILMASK, 0xFFFFFFFF);
|
||||
*/
|
||||
This->renderState[D3DRS_STENCILREF] = 0;
|
||||
This->renderState[D3DRS_STENCILMASK] = 0xFFFFFFFF;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_STENCILFUNC, D3DCMP_ALWAYS);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_STENCILWRITEMASK, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_TEXTUREFACTOR, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_WRAP0, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_WRAP1, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_WRAP2, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_WRAP3, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_WRAP4, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_WRAP5, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_WRAP6, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_WRAP7, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_CLIPPING, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_LIGHTING, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_AMBIENT, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_FOGVERTEXMODE, D3DFOG_NONE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_COLORVERTEX, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_LOCALVIEWER, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_NORMALIZENORMALS, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_SPECULARMATERIALSOURCE, D3DMCS_COLOR2);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_COLOR2);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_VERTEXBLEND, D3DVBF_DISABLE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_CLIPPLANEENABLE, 0);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_SOFTWAREVERTEXPROCESSING, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_STENCILFUNC, D3DCMP_ALWAYS);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_STENCILWRITEMASK, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_TEXTUREFACTOR, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_WRAP0, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_WRAP1, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_WRAP2, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_WRAP3, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_WRAP4, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_WRAP5, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_WRAP6, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_WRAP7, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_CLIPPING, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_LIGHTING, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_AMBIENT, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_FOGVERTEXMODE, D3DFOG_NONE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_COLORVERTEX, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_LOCALVIEWER, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_NORMALIZENORMALS, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_DIFFUSEMATERIALSOURCE, D3DMCS_COLOR1);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_SPECULARMATERIALSOURCE, D3DMCS_COLOR2);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_AMBIENTMATERIALSOURCE, D3DMCS_COLOR2);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_EMISSIVEMATERIALSOURCE, D3DMCS_MATERIAL);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_VERTEXBLEND, D3DVBF_DISABLE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_CLIPPLANEENABLE, 0);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_SOFTWAREVERTEXPROCESSING, FALSE);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_POINTSIZE, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_POINTSIZE, tmpfloat.d);
|
||||
tmpfloat.f = 0.0f;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_POINTSIZE_MIN, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_POINTSPRITEENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_POINTSCALEENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_POINTSCALE_A, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_POINTSCALE_B, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_POINTSCALE_C, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_MULTISAMPLEANTIALIAS, TRUE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_PATCHEDGESTYLE, D3DPATCHEDGE_DISCRETE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_POINTSIZE_MIN, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_POINTSPRITEENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_POINTSCALEENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_POINTSCALE_A, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_POINTSCALE_B, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_POINTSCALE_C, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_MULTISAMPLEANTIALIAS, TRUE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_MULTISAMPLEMASK, 0xFFFFFFFF);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_PATCHEDGESTYLE, D3DPATCHEDGE_DISCRETE);
|
||||
tmpfloat.f = 1.0f;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_PATCHSEGMENTS, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_DEBUGMONITORTOKEN, D3DDMT_DISABLE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_PATCHSEGMENTS, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_DEBUGMONITORTOKEN, D3DDMT_DISABLE);
|
||||
tmpfloat.f = 64.0f;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_POINTSIZE_MAX, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_COLORWRITEENABLE, 0x0000000F);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_POINTSIZE_MAX, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_INDEXEDVERTEXBLENDENABLE, FALSE);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_COLORWRITEENABLE, 0x0000000F);
|
||||
tmpfloat.f = 0.0f;
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_TWEENFACTOR, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_BLENDOP, D3DBLENDOP_ADD);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_POSITIONORDER, D3DORDER_CUBIC);
|
||||
IWineD3DDevice_SetRenderState(This->wineD3DDevice, D3DRS_NORMALORDER, D3DORDER_LINEAR);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_TWEENFACTOR, tmpfloat.d);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_BLENDOP, D3DBLENDOP_ADD);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_POSITIONORDER, D3DORDER_CUBIC);
|
||||
IWineD3DDevice_SetRenderState((IWineD3DDevice *)This->wineD3DDevice, D3DRS_NORMALORDER, D3DORDER_LINEAR);
|
||||
|
||||
/** clipping status */
|
||||
This->clip_status.ClipUnion = 0;
|
||||
|
@ -231,24 +231,22 @@ HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStateBlock*
|
|||
checkGLcall("glTexImage1D");
|
||||
|
||||
/* Reapply all the texture state information to this texture */
|
||||
IWineD3DDevice_SetupTextureStates(This->wineD3DDevice, i, REAPPLY_ALL);
|
||||
IWineD3DDevice_SetupTextureStates((IWineD3DDevice *)This->wineD3DDevice, i, REAPPLY_ALL);
|
||||
}
|
||||
|
||||
LEAVE_GL();
|
||||
|
||||
#if 0 /* TODO: Palette support */
|
||||
/* defaulting palettes */
|
||||
/* Defaulting palettes - Note these are device wide but reinitialized here for convenience*/
|
||||
for (i = 0; i < MAX_PALETTES; ++i) {
|
||||
int j;
|
||||
for (j = 0; j < 256; ++j) {
|
||||
This->palettes[i][j].peRed = 0xFF;
|
||||
This->palettes[i][j].peGreen = 0xFF;
|
||||
This->palettes[i][j].peBlue = 0xFF;
|
||||
This->palettes[i][j].peFlags = 0xFF;
|
||||
This->wineD3DDevice->palettes[i][j].peRed = 0xFF;
|
||||
This->wineD3DDevice->palettes[i][j].peGreen = 0xFF;
|
||||
This->wineD3DDevice->palettes[i][j].peBlue = 0xFF;
|
||||
This->wineD3DDevice->palettes[i][j].peFlags = 0xFF;
|
||||
}
|
||||
}
|
||||
This->currentPalette = 0;
|
||||
#endif /* TODO: Palette support */
|
||||
This->wineD3DDevice->currentPalette = 0;
|
||||
|
||||
TRACE("-----------------------> Device defaults now set up...\n");
|
||||
return D3D_OK;
|
||||
|
@ -274,7 +272,7 @@ ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
|||
TRACE("(%p) : Releasing from %ld\n", This, This->ref);
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (ref == 0) {
|
||||
IWineD3DDevice_Release(This->wineD3DDevice);
|
||||
IWineD3DDevice_Release((IWineD3DDevice *)This->wineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return ref;
|
||||
|
|
|
@ -0,0 +1,778 @@
|
|||
/*
|
||||
* IWineD3DSurface Implementation
|
||||
*
|
||||
* Copyright 2002-2005 Jason Edmeades
|
||||
* Copyright 2002-2003 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_surface);
|
||||
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info
|
||||
|
||||
/* *******************************************
|
||||
IWineD3DSurface IUnknown parts follow
|
||||
******************************************* */
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_QueryInterface(IWineD3DSurface *iface, REFIID riid, LPVOID *ppobj)
|
||||
{
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
WARN("(%p)->(%s,%p) should not be called\n",This,debugstr_guid(riid),ppobj);
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG WINAPI IWineD3DSurfaceImpl_AddRef(IWineD3DSurface *iface) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
TRACE("(%p) : AddRef increasing from %ld\n", This, This->resource.ref);
|
||||
IUnknown_AddRef(This->resource.parent);
|
||||
return InterlockedIncrement(&This->resource.ref);
|
||||
}
|
||||
|
||||
ULONG WINAPI IWineD3DSurfaceImpl_Release(IWineD3DSurface *iface) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
ULONG ref;
|
||||
TRACE("(%p) : Releasing from %ld\n", This, This->resource.ref);
|
||||
ref = InterlockedDecrement(&This->resource.ref);
|
||||
if (ref == 0) {
|
||||
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
|
||||
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
} else {
|
||||
IUnknown_Release(This->resource.parent); /* Released the reference to the d3dx object */
|
||||
}
|
||||
return ref;
|
||||
}
|
||||
|
||||
/* ****************************************************
|
||||
IWineD3DSurface IWineD3DResource parts follow
|
||||
**************************************************** */
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_GetDevice(IWineD3DSurface *iface, IWineD3DDevice** ppDevice) {
|
||||
return IWineD3DResource_GetDevice((IWineD3DResource *)iface, ppDevice);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_SetPrivateData(IWineD3DSurface *iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) {
|
||||
return IWineD3DResource_SetPrivateData((IWineD3DResource *)iface, refguid, pData, SizeOfData, Flags);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_GetPrivateData(IWineD3DSurface *iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) {
|
||||
return IWineD3DResource_GetPrivateData((IWineD3DResource *)iface, refguid, pData, pSizeOfData);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_FreePrivateData(IWineD3DSurface *iface, REFGUID refguid) {
|
||||
return IWineD3DResource_FreePrivateData((IWineD3DResource *)iface, refguid);
|
||||
}
|
||||
|
||||
DWORD WINAPI IWineD3DSurfaceImpl_SetPriority(IWineD3DSurface *iface, DWORD PriorityNew) {
|
||||
return IWineD3DResource_SetPriority((IWineD3DResource *)iface, PriorityNew);
|
||||
}
|
||||
|
||||
DWORD WINAPI IWineD3DSurfaceImpl_GetPriority(IWineD3DSurface *iface) {
|
||||
return IWineD3DResource_GetPriority((IWineD3DResource *)iface);
|
||||
}
|
||||
|
||||
void WINAPI IWineD3DSurfaceImpl_PreLoad(IWineD3DSurface *iface) {
|
||||
return IWineD3DResource_PreLoad((IWineD3DResource *)iface);
|
||||
}
|
||||
|
||||
D3DRESOURCETYPE WINAPI IWineD3DSurfaceImpl_GetType(IWineD3DSurface *iface) {
|
||||
return IWineD3DResource_GetType((IWineD3DResource *)iface);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_GetParent(IWineD3DSurface *iface, IUnknown **pParent) {
|
||||
return IWineD3DResource_GetParent((IWineD3DResource *)iface, pParent);
|
||||
}
|
||||
|
||||
/* ******************************************************
|
||||
IWineD3DSurface IWineD3DSurface parts follow
|
||||
****************************************************** */
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_GetContainer(IWineD3DSurface *iface, REFIID riid, void** ppContainer) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
|
||||
/** From MSDN:
|
||||
* If the surface is created using CreateImageSurface/CreateOffscreenPlainSurface, CreateRenderTarget,
|
||||
* or CreateDepthStencilSurface, the surface is considered stand alone. In this case,
|
||||
* GetContainer will return the Direct3D device used to create the surface.
|
||||
*/
|
||||
WARN("Query of container implementation currently ignores riid\n");
|
||||
*ppContainer = This->container;
|
||||
IUnknown_AddRef((IUnknown *)*ppContainer);
|
||||
TRACE("(%p) : returning %p\n", This, *ppContainer);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_GetDesc(IWineD3DSurface *iface, WINED3DSURFACE_DESC *pDesc) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
|
||||
TRACE("(%p) : copying into %p\n", This, pDesc);
|
||||
*(pDesc->Format) = This->currentDesc.Format;
|
||||
*(pDesc->Type) = This->currentDesc.Type;
|
||||
*(pDesc->Usage) = This->currentDesc.Usage;
|
||||
*(pDesc->Pool) = This->currentDesc.Pool;
|
||||
*(pDesc->MultiSampleType) = This->currentDesc.MultiSampleType;
|
||||
*(pDesc->MultiSampleQuality) = This->currentDesc.MultiSampleQuality;
|
||||
*(pDesc->Width) = This->currentDesc.Width;
|
||||
*(pDesc->Height) = This->currentDesc.Height;
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_LockRect(IWineD3DSurface *iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
|
||||
/* fixme: should we really lock as such? */
|
||||
if (This->inTexture && This->inPBuffer) {
|
||||
FIXME("Warning: Surface is in texture memory or pbuffer\n");
|
||||
This->inTexture = 0;
|
||||
This->inPBuffer = 0;
|
||||
}
|
||||
|
||||
if (FALSE == This->lockable) {
|
||||
/* Note: UpdateTextures calls CopyRects which calls this routine to populate the
|
||||
texture regions, and since the destination is an unlockable region we need
|
||||
to tolerate this */
|
||||
TRACE("Warning: trying to lock unlockable surf@%p\n", This);
|
||||
/*return D3DERR_INVALIDCALL; */
|
||||
}
|
||||
|
||||
if (This == This->resource.wineD3DDevice->backBuffer || This == This->resource.wineD3DDevice->renderTarget || This == This->resource.wineD3DDevice->frontBuffer || This->resource.wineD3DDevice->depthStencilBuffer) {
|
||||
if (This == This->resource.wineD3DDevice->backBuffer) {
|
||||
TRACE("(%p, backBuffer) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->allocatedMemory);
|
||||
} else if (This == This->resource.wineD3DDevice->frontBuffer) {
|
||||
TRACE("(%p, frontBuffer) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->allocatedMemory);
|
||||
} else if (This == This->resource.wineD3DDevice->renderTarget) {
|
||||
TRACE("(%p, renderTarget) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->allocatedMemory);
|
||||
} else if (This == This->resource.wineD3DDevice->depthStencilBuffer) {
|
||||
TRACE("(%p, stencilBuffer) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->allocatedMemory);
|
||||
}
|
||||
} else {
|
||||
TRACE("(%p) : rect@%p flags(%08lx), output lockedRect@%p, memory@%p\n", This, pRect, Flags, pLockedRect, This->allocatedMemory);
|
||||
}
|
||||
|
||||
/* DXTn formats don't have exact pitches as they are to the new row of blocks,
|
||||
where each block is 4x4 pixels, 8 bytes (dxt1) and 16 bytes (dxt3/5)
|
||||
ie pitch = (width/4) * bytes per block */
|
||||
if (This->currentDesc.Format == D3DFMT_DXT1) /* DXT1 is 8 bytes per block */
|
||||
pLockedRect->Pitch = (This->currentDesc.Width/4) * 8;
|
||||
else if (This->currentDesc.Format == D3DFMT_DXT3 || This->currentDesc.Format == D3DFMT_DXT5) /* DXT3/5 is 16 bytes per block */
|
||||
pLockedRect->Pitch = (This->currentDesc.Width/4) * 16;
|
||||
else
|
||||
pLockedRect->Pitch = This->bytesPerPixel * This->currentDesc.Width; /* Bytes / row */
|
||||
|
||||
if (NULL == pRect) {
|
||||
pLockedRect->pBits = This->allocatedMemory;
|
||||
This->lockedRect.left = 0;
|
||||
This->lockedRect.top = 0;
|
||||
This->lockedRect.right = This->currentDesc.Width;
|
||||
This->lockedRect.bottom = This->currentDesc.Height;
|
||||
TRACE("Locked Rect (%p) = l %ld, t %ld, r %ld, b %ld\n", &This->lockedRect, This->lockedRect.left, This->lockedRect.top, This->lockedRect.right, This->lockedRect.bottom);
|
||||
} else {
|
||||
TRACE("Lock Rect (%p) = l %ld, t %ld, r %ld, b %ld\n", pRect, pRect->left, pRect->top, pRect->right, pRect->bottom);
|
||||
|
||||
if (This->currentDesc.Format == D3DFMT_DXT1) { /* DXT1 is half byte per pixel */
|
||||
pLockedRect->pBits = This->allocatedMemory + (pLockedRect->Pitch * pRect->top) + ((pRect->left * This->bytesPerPixel/2));
|
||||
} else {
|
||||
pLockedRect->pBits = This->allocatedMemory + (pLockedRect->Pitch * pRect->top) + (pRect->left * This->bytesPerPixel);
|
||||
}
|
||||
This->lockedRect.left = pRect->left;
|
||||
This->lockedRect.top = pRect->top;
|
||||
This->lockedRect.right = pRect->right;
|
||||
This->lockedRect.bottom = pRect->bottom;
|
||||
}
|
||||
|
||||
|
||||
if (0 == This->currentDesc.Usage) { /* classic surface */
|
||||
|
||||
/* Nothing to do ;) */
|
||||
|
||||
} else if (D3DUSAGE_RENDERTARGET & This->currentDesc.Usage && !(Flags&D3DLOCK_DISCARD)) { /* render surfaces */
|
||||
|
||||
if (This == This->resource.wineD3DDevice->backBuffer || This == This->resource.wineD3DDevice->renderTarget || This == This->resource.wineD3DDevice->frontBuffer) {
|
||||
GLint prev_store;
|
||||
GLenum prev_read;
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
/**
|
||||
* for render->surface copy begin to begin of allocatedMemory
|
||||
* unlock can be more easy
|
||||
*/
|
||||
pLockedRect->pBits = This->allocatedMemory;
|
||||
|
||||
glFlush();
|
||||
vcheckGLcall("glFlush");
|
||||
glGetIntegerv(GL_READ_BUFFER, &prev_read);
|
||||
vcheckGLcall("glIntegerv");
|
||||
glGetIntegerv(GL_PACK_SWAP_BYTES, &prev_store);
|
||||
vcheckGLcall("glIntegerv");
|
||||
|
||||
if (This == This->resource.wineD3DDevice->backBuffer) {
|
||||
glReadBuffer(GL_BACK);
|
||||
} else if (This == This->resource.wineD3DDevice->frontBuffer || This == This->resource.wineD3DDevice->renderTarget) {
|
||||
glReadBuffer(GL_FRONT);
|
||||
} else if (This == This->resource.wineD3DDevice->depthStencilBuffer) {
|
||||
ERR("Stencil Buffer lock unsupported for now\n");
|
||||
}
|
||||
vcheckGLcall("glReadBuffer");
|
||||
|
||||
{
|
||||
long j;
|
||||
GLenum format = D3DFmt2GLFmt(This->resource.wineD3DDevice, This->currentDesc.Format);
|
||||
GLenum type = D3DFmt2GLType(This->resource.wineD3DDevice, This->currentDesc.Format);
|
||||
for (j = This->lockedRect.top; j < This->lockedRect.bottom - This->lockedRect.top; ++j) {
|
||||
glReadPixels(This->lockedRect.left,
|
||||
This->lockedRect.bottom - j - 1,
|
||||
This->lockedRect.right - This->lockedRect.left,
|
||||
1,
|
||||
format,
|
||||
type,
|
||||
(char *)pLockedRect->pBits + (pLockedRect->Pitch * (j-This->lockedRect.top)));
|
||||
vcheckGLcall("glReadPixels");
|
||||
}
|
||||
}
|
||||
|
||||
glReadBuffer(prev_read);
|
||||
vcheckGLcall("glReadBuffer");
|
||||
|
||||
LEAVE_GL();
|
||||
|
||||
} else {
|
||||
FIXME("unsupported locking to Rendering surface surf@%p usage(%lu)\n", This, This->currentDesc.Usage);
|
||||
}
|
||||
|
||||
} else if (D3DUSAGE_DEPTHSTENCIL & This->currentDesc.Usage) { /* stencil surfaces */
|
||||
|
||||
FIXME("TODO stencil depth surface locking surf@%p usage(%lu)\n", This, This->currentDesc.Usage);
|
||||
|
||||
} else {
|
||||
FIXME("unsupported locking to surface surf@%p usage(%lu)\n", This, This->currentDesc.Usage);
|
||||
}
|
||||
|
||||
if (Flags & (D3DLOCK_NO_DIRTY_UPDATE | D3DLOCK_READONLY)) {
|
||||
/* Don't dirtify */
|
||||
} else {
|
||||
/**
|
||||
* Dirtify on lock
|
||||
* as seen in msdn docs
|
||||
*/
|
||||
IWineD3DSurface_AddDirtyRect(iface, &This->lockedRect);
|
||||
|
||||
/** Dirtify Container if needed */
|
||||
if ((NULL != This->container) && ((IWineD3DDeviceImpl *)This->container != This->resource.wineD3DDevice)) {
|
||||
IWineD3DBaseTexture_SetDirty((IWineD3DBaseTexture *)This->container, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("returning memory@%p, pitch(%d) dirtyfied(%d)\n", pLockedRect->pBits, pLockedRect->Pitch, This->Dirty);
|
||||
|
||||
This->locked = TRUE;
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_UnlockRect(IWineD3DSurface *iface) {
|
||||
GLint skipBytes = 0;
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
|
||||
if (FALSE == This->locked) {
|
||||
ERR("trying to Unlock an unlocked surf@%p\n", This);
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if (This == This->resource.wineD3DDevice->backBuffer || This == This->resource.wineD3DDevice->frontBuffer || This->resource.wineD3DDevice->depthStencilBuffer || This == This->resource.wineD3DDevice->renderTarget) {
|
||||
if (This == This->resource.wineD3DDevice->backBuffer) {
|
||||
TRACE("(%p, backBuffer) : dirtyfied(%d)\n", This, This->Dirty);
|
||||
} else if (This == This->resource.wineD3DDevice->frontBuffer) {
|
||||
TRACE("(%p, frontBuffer) : dirtyfied(%d)\n", This, This->Dirty);
|
||||
} else if (This == This->resource.wineD3DDevice->depthStencilBuffer) {
|
||||
TRACE("(%p, stencilBuffer) : dirtyfied(%d)\n", This, This->Dirty);
|
||||
} else if (This == This->resource.wineD3DDevice->renderTarget) {
|
||||
TRACE("(%p, renderTarget) : dirtyfied(%d)\n", This, This->Dirty);
|
||||
}
|
||||
} else {
|
||||
TRACE("(%p) : dirtyfied(%d)\n", This, This->Dirty);
|
||||
}
|
||||
|
||||
if (FALSE == This->Dirty) {
|
||||
TRACE("(%p) : Not Dirtified so nothing to do, return now\n", This);
|
||||
goto unlock_end;
|
||||
}
|
||||
|
||||
if (0 == This->currentDesc.Usage) { /* classic surface */
|
||||
/**
|
||||
* nothing to do
|
||||
* waiting to reload the surface via IDirect3DDevice8::UpdateTexture
|
||||
*/
|
||||
} else if (D3DUSAGE_RENDERTARGET & This->currentDesc.Usage) { /* render surfaces */
|
||||
|
||||
if (This == This->resource.wineD3DDevice->backBuffer || This == This->resource.wineD3DDevice->frontBuffer || This == This->resource.wineD3DDevice->renderTarget) {
|
||||
GLint prev_store;
|
||||
GLenum prev_draw;
|
||||
GLint prev_rasterpos[4];
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
glFlush();
|
||||
vcheckGLcall("glFlush");
|
||||
glGetIntegerv(GL_DRAW_BUFFER, &prev_draw);
|
||||
vcheckGLcall("glIntegerv");
|
||||
glGetIntegerv(GL_PACK_SWAP_BYTES, &prev_store);
|
||||
vcheckGLcall("glIntegerv");
|
||||
glGetIntegerv(GL_CURRENT_RASTER_POSITION, &prev_rasterpos[0]);
|
||||
vcheckGLcall("glIntegerv");
|
||||
glPixelZoom(1.0, -1.0);
|
||||
vcheckGLcall("glPixelZoom");
|
||||
|
||||
/* glDrawPixels transforms the raster position as though it was a vertex -
|
||||
we want to draw at screen position 0,0 - Set up ortho (rhw) mode as
|
||||
per drawprim (and leave set - it will sort itself out due to last_was_rhw */
|
||||
if (!This->resource.wineD3DDevice->last_was_rhw) {
|
||||
|
||||
double X, Y, height, width, minZ, maxZ;
|
||||
This->resource.wineD3DDevice->last_was_rhw = TRUE;
|
||||
|
||||
/* Transformed already into viewport coordinates, so we do not need transform
|
||||
matrices. Reset all matrices to identity and leave the default matrix in world
|
||||
mode. */
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
checkGLcall("glMatrixMode");
|
||||
glLoadIdentity();
|
||||
checkGLcall("glLoadIdentity");
|
||||
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
checkGLcall("glMatrixMode");
|
||||
glLoadIdentity();
|
||||
checkGLcall("glLoadIdentity");
|
||||
|
||||
/* Set up the viewport to be full viewport */
|
||||
X = This->resource.wineD3DDevice->stateBlock->viewport.X;
|
||||
Y = This->resource.wineD3DDevice->stateBlock->viewport.Y;
|
||||
height = This->resource.wineD3DDevice->stateBlock->viewport.Height;
|
||||
width = This->resource.wineD3DDevice->stateBlock->viewport.Width;
|
||||
minZ = This->resource.wineD3DDevice->stateBlock->viewport.MinZ;
|
||||
maxZ = This->resource.wineD3DDevice->stateBlock->viewport.MaxZ;
|
||||
TRACE("Calling glOrtho with %f, %f, %f, %f\n", width, height, -minZ, -maxZ);
|
||||
glOrtho(X, X + width, Y + height, Y, -minZ, -maxZ);
|
||||
checkGLcall("glOrtho");
|
||||
|
||||
/* Window Coord 0 is the middle of the first pixel, so translate by half
|
||||
a pixel (See comment above glTranslate below) */
|
||||
glTranslatef(0.5, 0.5, 0);
|
||||
checkGLcall("glTranslatef(0.5, 0.5, 0)");
|
||||
}
|
||||
|
||||
if (This == This->resource.wineD3DDevice->backBuffer) {
|
||||
glDrawBuffer(GL_BACK);
|
||||
} else if (This == This->resource.wineD3DDevice->frontBuffer || This == This->resource.wineD3DDevice->renderTarget) {
|
||||
glDrawBuffer(GL_FRONT);
|
||||
}
|
||||
vcheckGLcall("glDrawBuffer");
|
||||
|
||||
/* If not fullscreen, we need to skip a number of bytes to find the next row of data */
|
||||
glGetIntegerv(GL_UNPACK_ROW_LENGTH, &skipBytes);
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, This->currentDesc.Width);
|
||||
|
||||
/* And back buffers are not blended */
|
||||
glDisable(GL_BLEND);
|
||||
|
||||
glRasterPos3i(This->lockedRect.left, This->lockedRect.top, 1);
|
||||
vcheckGLcall("glRasterPos2f");
|
||||
switch (This->currentDesc.Format) {
|
||||
case D3DFMT_R5G6B5:
|
||||
{
|
||||
glDrawPixels(This->lockedRect.right - This->lockedRect.left, (This->lockedRect.bottom - This->lockedRect.top)-1,
|
||||
GL_RGB, GL_UNSIGNED_SHORT_5_6_5, This->allocatedMemory);
|
||||
vcheckGLcall("glDrawPixels");
|
||||
}
|
||||
break;
|
||||
case D3DFMT_R8G8B8:
|
||||
{
|
||||
glDrawPixels(This->lockedRect.right - This->lockedRect.left, (This->lockedRect.bottom - This->lockedRect.top)-1,
|
||||
GL_RGB, GL_UNSIGNED_BYTE, This->allocatedMemory);
|
||||
vcheckGLcall("glDrawPixels");
|
||||
}
|
||||
break;
|
||||
case D3DFMT_A8R8G8B8:
|
||||
{
|
||||
glPixelStorei(GL_PACK_SWAP_BYTES, TRUE);
|
||||
vcheckGLcall("glPixelStorei");
|
||||
glDrawPixels(This->lockedRect.right - This->lockedRect.left, (This->lockedRect.bottom - This->lockedRect.top)-1,
|
||||
GL_BGRA, GL_UNSIGNED_BYTE, This->allocatedMemory);
|
||||
vcheckGLcall("glDrawPixels");
|
||||
glPixelStorei(GL_PACK_SWAP_BYTES, prev_store);
|
||||
vcheckGLcall("glPixelStorei");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FIXME("Unsupported Format %u in locking func\n", This->currentDesc.Format);
|
||||
}
|
||||
|
||||
glPixelZoom(1.0,1.0);
|
||||
vcheckGLcall("glPixelZoom");
|
||||
glDrawBuffer(prev_draw);
|
||||
vcheckGLcall("glDrawBuffer");
|
||||
glRasterPos3iv(&prev_rasterpos[0]);
|
||||
vcheckGLcall("glRasterPos3iv");
|
||||
|
||||
/* Reset to previous pack row length / blending state */
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, skipBytes);
|
||||
if (This->resource.wineD3DDevice->stateBlock->renderState[D3DRS_ALPHABLENDENABLE]) glEnable(GL_BLEND);
|
||||
|
||||
LEAVE_GL();
|
||||
|
||||
/** restore clean dirty state */
|
||||
IWineD3DSurface_CleanDirtyRect(iface);
|
||||
|
||||
} else {
|
||||
FIXME("unsupported unlocking to Rendering surface surf@%p usage(%lu)\n", This, This->currentDesc.Usage);
|
||||
}
|
||||
|
||||
} else if (D3DUSAGE_DEPTHSTENCIL & This->currentDesc.Usage) { /* stencil surfaces */
|
||||
|
||||
if (This == This->resource.wineD3DDevice->depthStencilBuffer) {
|
||||
FIXME("TODO stencil depth surface unlocking surf@%p usage(%lu)\n", This, This->currentDesc.Usage);
|
||||
} else {
|
||||
FIXME("unsupported unlocking to StencilDepth surface surf@%p usage(%lu)\n", This, This->currentDesc.Usage);
|
||||
}
|
||||
|
||||
} else {
|
||||
FIXME("unsupported unlocking to surface surf@%p usage(%lu)\n", This, This->currentDesc.Usage);
|
||||
}
|
||||
|
||||
unlock_end:
|
||||
This->locked = FALSE;
|
||||
memset(&This->lockedRect, 0, sizeof(RECT));
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
FIXME("No support for GetDC yet for surface %p\n", This);
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
FIXME("No support for ReleaseDC yet for surface %p\n", This);
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
/* ******************************************************
|
||||
IWineD3DSurface Internal (No mapping to directx api) parts follow
|
||||
****************************************************** */
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_LoadTexture(IWineD3DSurface *iface, GLenum gl_target, GLenum gl_level) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
|
||||
if (This->inTexture)
|
||||
return D3D_OK;
|
||||
|
||||
if (This->inPBuffer) {
|
||||
ENTER_GL();
|
||||
|
||||
if (gl_level != 0)
|
||||
FIXME("Surface in texture is only supported for level 0\n");
|
||||
else if (This->currentDesc.Format == D3DFMT_P8 || This->currentDesc.Format == D3DFMT_A8P8 ||
|
||||
This->currentDesc.Format == D3DFMT_DXT1 || This->currentDesc.Format == D3DFMT_DXT3 ||
|
||||
This->currentDesc.Format == D3DFMT_DXT5)
|
||||
FIXME("Format %d not supported\n", This->currentDesc.Format);
|
||||
else {
|
||||
glCopyTexImage2D(gl_target,
|
||||
0,
|
||||
D3DFmt2GLIntFmt(This->resource.wineD3DDevice,
|
||||
This->currentDesc.Format),
|
||||
0,
|
||||
0,
|
||||
This->currentDesc.Width,
|
||||
This->currentDesc.Height,
|
||||
0);
|
||||
TRACE("Updating target %d\n", gl_target);
|
||||
This->inTexture = TRUE;
|
||||
}
|
||||
LEAVE_GL();
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
if ((This->currentDesc.Format == D3DFMT_P8 || This->currentDesc.Format == D3DFMT_A8P8) &&
|
||||
!GL_SUPPORT(EXT_PALETTED_TEXTURE)) {
|
||||
/**
|
||||
* wanted a paletted texture and not really support it in HW
|
||||
* so software emulation code begin
|
||||
*/
|
||||
UINT i;
|
||||
PALETTEENTRY* pal = This->resource.wineD3DDevice->palettes[This->resource.wineD3DDevice->currentPalette];
|
||||
VOID* surface = (VOID*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->currentDesc.Width * This->currentDesc.Height * sizeof(DWORD));
|
||||
BYTE* dst = (BYTE*) surface;
|
||||
BYTE* src = (BYTE*) This->allocatedMemory;
|
||||
|
||||
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
|
||||
BYTE color = *src++;
|
||||
*dst++ = pal[color].peRed;
|
||||
*dst++ = pal[color].peGreen;
|
||||
*dst++ = pal[color].peBlue;
|
||||
if (This->currentDesc.Format == D3DFMT_A8P8)
|
||||
*dst++ = pal[color].peFlags;
|
||||
else
|
||||
*dst++ = 0xFF;
|
||||
}
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
TRACE("Calling glTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
||||
gl_target,
|
||||
gl_level,
|
||||
GL_RGBA,
|
||||
This->currentDesc.Width,
|
||||
This->currentDesc.Height,
|
||||
0,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
surface);
|
||||
glTexImage2D(gl_target,
|
||||
gl_level,
|
||||
GL_RGBA,
|
||||
This->currentDesc.Width,
|
||||
This->currentDesc.Height,
|
||||
0,
|
||||
GL_RGBA,
|
||||
GL_UNSIGNED_BYTE,
|
||||
surface);
|
||||
checkGLcall("glTexImage2D");
|
||||
HeapFree(GetProcessHeap(), 0, surface);
|
||||
|
||||
LEAVE_GL();
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
if (This->currentDesc.Format == D3DFMT_DXT1 ||
|
||||
This->currentDesc.Format == D3DFMT_DXT3 ||
|
||||
This->currentDesc.Format == D3DFMT_DXT5) {
|
||||
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||
TRACE("Calling glCompressedTexImage2D %x i=%d, intfmt=%x, w=%d, h=%d,0=%d, sz=%d, Mem=%p\n",
|
||||
gl_target,
|
||||
gl_level,
|
||||
D3DFmt2GLIntFmt(This->resource.wineD3DDevice, This->currentDesc.Format),
|
||||
This->currentDesc.Width,
|
||||
This->currentDesc.Height,
|
||||
0,
|
||||
This->currentDesc.Size,
|
||||
This->allocatedMemory);
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
GL_EXTCALL(glCompressedTexImage2DARB)(gl_target,
|
||||
gl_level,
|
||||
D3DFmt2GLIntFmt(This->resource.wineD3DDevice, This->currentDesc.Format),
|
||||
This->currentDesc.Width,
|
||||
This->currentDesc.Height,
|
||||
0,
|
||||
This->currentDesc.Size,
|
||||
This->allocatedMemory);
|
||||
checkGLcall("glCommpressedTexTexImage2D");
|
||||
|
||||
LEAVE_GL();
|
||||
} else {
|
||||
FIXME("Using DXT1/3/5 without advertized support\n");
|
||||
}
|
||||
} else {
|
||||
|
||||
TRACE("Calling glTexImage2D %x i=%d, d3dfmt=%s, intfmt=%x, w=%d, h=%d,0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
||||
gl_target,
|
||||
gl_level,
|
||||
debug_d3dformat(This->currentDesc.Format),
|
||||
D3DFmt2GLIntFmt(This->resource.wineD3DDevice, This->currentDesc.Format),
|
||||
This->currentDesc.Width,
|
||||
This->currentDesc.Height,
|
||||
0,
|
||||
D3DFmt2GLFmt(This->resource.wineD3DDevice, This->currentDesc.Format),
|
||||
D3DFmt2GLType(This->resource.wineD3DDevice, This->currentDesc.Format),
|
||||
This->allocatedMemory);
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
glTexImage2D(gl_target,
|
||||
gl_level,
|
||||
D3DFmt2GLIntFmt(This->resource.wineD3DDevice, This->currentDesc.Format),
|
||||
This->currentDesc.Width,
|
||||
This->currentDesc.Height,
|
||||
0,
|
||||
D3DFmt2GLFmt(This->resource.wineD3DDevice, This->currentDesc.Format),
|
||||
D3DFmt2GLType(This->resource.wineD3DDevice, This->currentDesc.Format),
|
||||
This->allocatedMemory);
|
||||
checkGLcall("glTexImage2D");
|
||||
|
||||
LEAVE_GL();
|
||||
|
||||
#if 0
|
||||
{
|
||||
static unsigned int gen = 0;
|
||||
char buffer[4096];
|
||||
++gen;
|
||||
if ((gen % 10) == 0) {
|
||||
snprintf(buffer, sizeof(buffer), "/tmp/surface%p_type%u_level%u_%u.ppm", This, gl_target, gl_level, gen);
|
||||
IWineD3DSurfaceImpl_SaveSnapshot((LPDIRECT3DSURFACE8) This, buffer);
|
||||
}
|
||||
/*
|
||||
* debugging crash code
|
||||
if (gen == 250) {
|
||||
void** test = NULL;
|
||||
*test = 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_SaveSnapshot(IWineD3DSurface *iface, const char* filename) {
|
||||
FILE* f = NULL;
|
||||
ULONG i;
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
|
||||
f = fopen(filename, "w+");
|
||||
if (NULL == f) {
|
||||
ERR("opening of %s failed with: %s\n", filename, strerror(errno));
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
TRACE("opened %s with format %s\n", filename, debug_d3dformat(This->currentDesc.Format));
|
||||
|
||||
fprintf(f, "P6\n%u %u\n255\n", This->currentDesc.Width, This->currentDesc.Height);
|
||||
switch (This->currentDesc.Format) {
|
||||
case D3DFMT_X8R8G8B8:
|
||||
case D3DFMT_A8R8G8B8:
|
||||
{
|
||||
DWORD color;
|
||||
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
|
||||
color = ((DWORD*) This->allocatedMemory)[i];
|
||||
fputc((color >> 16) & 0xFF, f);
|
||||
fputc((color >> 8) & 0xFF, f);
|
||||
fputc((color >> 0) & 0xFF, f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case D3DFMT_R8G8B8:
|
||||
{
|
||||
BYTE* color;
|
||||
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
|
||||
color = ((BYTE*) This->allocatedMemory) + (3 * i);
|
||||
fputc((color[0]) & 0xFF, f);
|
||||
fputc((color[1]) & 0xFF, f);
|
||||
fputc((color[2]) & 0xFF, f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case D3DFMT_A1R5G5B5:
|
||||
{
|
||||
WORD color;
|
||||
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
|
||||
color = ((WORD*) This->allocatedMemory)[i];
|
||||
fputc(((color >> 10) & 0x1F) * 255 / 31, f);
|
||||
fputc(((color >> 5) & 0x1F) * 255 / 31, f);
|
||||
fputc(((color >> 0) & 0x1F) * 255 / 31, f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case D3DFMT_A4R4G4B4:
|
||||
{
|
||||
WORD color;
|
||||
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
|
||||
color = ((WORD*) This->allocatedMemory)[i];
|
||||
fputc(((color >> 8) & 0x0F) * 255 / 15, f);
|
||||
fputc(((color >> 4) & 0x0F) * 255 / 15, f);
|
||||
fputc(((color >> 0) & 0x0F) * 255 / 15, f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case D3DFMT_R5G6B5:
|
||||
{
|
||||
WORD color;
|
||||
for (i = 0; i < This->currentDesc.Width * This->currentDesc.Height; i++) {
|
||||
color = ((WORD*) This->allocatedMemory)[i];
|
||||
fputc(((color >> 11) & 0x1F) * 255 / 31, f);
|
||||
fputc(((color >> 5) & 0x3F) * 255 / 63, f);
|
||||
fputc(((color >> 0) & 0x1F) * 255 / 31, f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FIXME("Unimplemented dump mode format(%u,%s)\n", This->currentDesc.Format, debug_d3dformat(This->currentDesc.Format));
|
||||
}
|
||||
fclose(f);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DSurfaceImpl_CleanDirtyRect(IWineD3DSurface *iface) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
This->Dirty = FALSE;
|
||||
This->dirtyRect.left = This->currentDesc.Width;
|
||||
This->dirtyRect.top = This->currentDesc.Height;
|
||||
This->dirtyRect.right = 0;
|
||||
This->dirtyRect.bottom = 0;
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Slightly inefficient way to handle multiple dirty rects but it works :)
|
||||
*/
|
||||
extern HRESULT WINAPI IWineD3DSurfaceImpl_AddDirtyRect(IWineD3DSurface *iface, CONST RECT* pDirtyRect) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
This->Dirty = TRUE;
|
||||
if (NULL != pDirtyRect) {
|
||||
This->dirtyRect.left = min(This->dirtyRect.left, pDirtyRect->left);
|
||||
This->dirtyRect.top = min(This->dirtyRect.top, pDirtyRect->top);
|
||||
This->dirtyRect.right = max(This->dirtyRect.right, pDirtyRect->right);
|
||||
This->dirtyRect.bottom = max(This->dirtyRect.bottom, pDirtyRect->bottom);
|
||||
} else {
|
||||
This->dirtyRect.left = 0;
|
||||
This->dirtyRect.top = 0;
|
||||
This->dirtyRect.right = This->currentDesc.Width;
|
||||
This->dirtyRect.bottom = This->currentDesc.Height;
|
||||
}
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl =
|
||||
{
|
||||
IWineD3DSurfaceImpl_QueryInterface,
|
||||
IWineD3DSurfaceImpl_AddRef,
|
||||
IWineD3DSurfaceImpl_Release,
|
||||
IWineD3DSurfaceImpl_GetParent,
|
||||
IWineD3DSurfaceImpl_GetDevice,
|
||||
IWineD3DSurfaceImpl_SetPrivateData,
|
||||
IWineD3DSurfaceImpl_GetPrivateData,
|
||||
IWineD3DSurfaceImpl_FreePrivateData,
|
||||
IWineD3DSurfaceImpl_SetPriority,
|
||||
IWineD3DSurfaceImpl_GetPriority,
|
||||
IWineD3DSurfaceImpl_PreLoad,
|
||||
IWineD3DSurfaceImpl_GetType,
|
||||
IWineD3DSurfaceImpl_GetContainer,
|
||||
IWineD3DSurfaceImpl_GetDesc,
|
||||
IWineD3DSurfaceImpl_LockRect,
|
||||
IWineD3DSurfaceImpl_UnlockRect,
|
||||
IWineD3DSurfaceImpl_GetDC,
|
||||
IWineD3DSurfaceImpl_ReleaseDC,
|
||||
/* Internal use: */
|
||||
IWineD3DSurfaceImpl_CleanDirtyRect,
|
||||
IWineD3DSurfaceImpl_AddDirtyRect,
|
||||
IWineD3DSurfaceImpl_LoadTexture,
|
||||
IWineD3DSurfaceImpl_SaveSnapshot
|
||||
};
|
|
@ -1519,3 +1519,210 @@ void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum*
|
|||
*source = GL_TEXTURE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define GLINFO_LOCATION ((IWineD3DImpl *)(This->wineD3D))->gl_info
|
||||
GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
|
||||
GLint retVal = 0;
|
||||
|
||||
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||
switch (fmt) {
|
||||
case D3DFMT_DXT1: retVal = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break;
|
||||
case D3DFMT_DXT3: retVal = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break;
|
||||
case D3DFMT_DXT5: retVal = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
||||
default:
|
||||
/* stupid compiler */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (retVal == 0) {
|
||||
switch (fmt) {
|
||||
/* Paletted */
|
||||
case D3DFMT_P8: retVal = GL_COLOR_INDEX8_EXT; break;
|
||||
case D3DFMT_A8P8: retVal = GL_COLOR_INDEX8_EXT; break;
|
||||
/* Luminance */
|
||||
case D3DFMT_L8: retVal = GL_LUMINANCE8; break;
|
||||
case D3DFMT_A8L8: retVal = GL_LUMINANCE8_ALPHA8; break;
|
||||
case D3DFMT_A4L4: retVal = GL_LUMINANCE4_ALPHA4; break;
|
||||
/* Bump */
|
||||
case D3DFMT_V8U8: retVal = GL_COLOR_INDEX8_EXT; break;
|
||||
case D3DFMT_V16U16: retVal = GL_COLOR_INDEX; break;
|
||||
case D3DFMT_L6V5U5: retVal = GL_COLOR_INDEX8_EXT; break;
|
||||
case D3DFMT_X8L8V8U8: retVal = GL_COLOR_INDEX; break;
|
||||
/* color buffer */
|
||||
case D3DFMT_R3G3B2: retVal = GL_R3_G3_B2; break;
|
||||
case D3DFMT_R5G6B5: retVal = GL_RGB5; break; /* fixme: internal format 6 for g? */
|
||||
case D3DFMT_R8G8B8: retVal = GL_RGB8; break;
|
||||
case D3DFMT_A1R5G5B5: retVal = GL_RGB5_A1; break;
|
||||
case D3DFMT_X1R5G5B5: retVal = GL_RGB5_A1; break;
|
||||
case D3DFMT_A4R4G4B4: retVal = GL_RGBA4; break;
|
||||
case D3DFMT_X4R4G4B4: retVal = GL_RGBA4; break;
|
||||
case D3DFMT_A8R8G8B8: retVal = GL_RGBA8; break;
|
||||
case D3DFMT_X8R8G8B8: retVal = GL_RGBA8; break;
|
||||
/* to see */
|
||||
case D3DFMT_A8: retVal = GL_ALPHA8; break;
|
||||
default:
|
||||
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
||||
retVal = GL_RGB8;
|
||||
}
|
||||
}
|
||||
TRACE("fmt2glintFmt for fmt(%u,%s) = %x\n", fmt, debug_d3dformat(fmt), retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
|
||||
GLenum retVal = 0;
|
||||
|
||||
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||
switch (fmt) {
|
||||
case D3DFMT_DXT1: retVal = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; break;
|
||||
case D3DFMT_DXT3: retVal = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; break;
|
||||
case D3DFMT_DXT5: retVal = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; break;
|
||||
default:
|
||||
/* stupid compiler */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (retVal == 0) {
|
||||
switch (fmt) {
|
||||
/* Paletted */
|
||||
case D3DFMT_P8: retVal = GL_COLOR_INDEX; break;
|
||||
case D3DFMT_A8P8: retVal = GL_COLOR_INDEX; break;
|
||||
/* Luminance */
|
||||
case D3DFMT_L8: retVal = GL_LUMINANCE; break;
|
||||
case D3DFMT_A8L8: retVal = GL_LUMINANCE_ALPHA; break;
|
||||
case D3DFMT_A4L4: retVal = GL_LUMINANCE_ALPHA; break;
|
||||
/* Bump */
|
||||
case D3DFMT_V8U8: retVal = GL_COLOR_INDEX; break;
|
||||
case D3DFMT_V16U16: retVal = GL_COLOR_INDEX; break;
|
||||
case D3DFMT_L6V5U5: retVal = GL_COLOR_INDEX; break;
|
||||
case D3DFMT_X8L8V8U8: retVal = GL_COLOR_INDEX; break;
|
||||
/* color buffer */
|
||||
case D3DFMT_R3G3B2: retVal = GL_BGR; break;
|
||||
case D3DFMT_R5G6B5: retVal = GL_RGB; break;
|
||||
case D3DFMT_R8G8B8: retVal = GL_RGB; break;
|
||||
case D3DFMT_A1R5G5B5: retVal = GL_BGRA; break;
|
||||
case D3DFMT_X1R5G5B5: retVal = GL_BGRA; break;
|
||||
case D3DFMT_A4R4G4B4: retVal = GL_BGRA; break;
|
||||
case D3DFMT_X4R4G4B4: retVal = GL_BGRA; break;
|
||||
case D3DFMT_A8R8G8B8: retVal = GL_BGRA; break;
|
||||
case D3DFMT_X8R8G8B8: retVal = GL_BGRA; break;
|
||||
/* to see */
|
||||
case D3DFMT_A8: retVal = GL_ALPHA; break;
|
||||
default:
|
||||
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
||||
retVal = GL_BGR;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("fmt2glFmt for fmt(%u,%s) = %x\n", fmt, debug_d3dformat(fmt), retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
GLenum D3DFmt2GLType(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
|
||||
GLenum retVal = 0;
|
||||
|
||||
if (GL_SUPPORT(EXT_TEXTURE_COMPRESSION_S3TC)) {
|
||||
switch (fmt) {
|
||||
case D3DFMT_DXT1: retVal = 0; break;
|
||||
case D3DFMT_DXT3: retVal = 0; break;
|
||||
case D3DFMT_DXT5: retVal = 0; break;
|
||||
default:
|
||||
/* stupid compiler */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (retVal == 0) {
|
||||
switch (fmt) {
|
||||
/* Paletted */
|
||||
case D3DFMT_P8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
case D3DFMT_A8P8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
/* Luminance */
|
||||
case D3DFMT_L8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
case D3DFMT_A8L8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
case D3DFMT_A4L4: retVal = GL_UNSIGNED_BYTE; break;
|
||||
/* Bump */
|
||||
case D3DFMT_V8U8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
case D3DFMT_V16U16: retVal = GL_UNSIGNED_SHORT; break;
|
||||
case D3DFMT_L6V5U5: retVal = GL_UNSIGNED_SHORT_5_5_5_1; break;
|
||||
case D3DFMT_X8L8V8U8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
/* Color buffer */
|
||||
case D3DFMT_R3G3B2: retVal = GL_UNSIGNED_BYTE_2_3_3_REV; break;
|
||||
case D3DFMT_R5G6B5: retVal = GL_UNSIGNED_SHORT_5_6_5; break;
|
||||
case D3DFMT_R8G8B8: retVal = GL_UNSIGNED_BYTE; break;
|
||||
case D3DFMT_A1R5G5B5: retVal = GL_UNSIGNED_SHORT_1_5_5_5_REV; break;
|
||||
case D3DFMT_X1R5G5B5: retVal = GL_UNSIGNED_SHORT_1_5_5_5_REV; break;
|
||||
case D3DFMT_A4R4G4B4: retVal = GL_UNSIGNED_SHORT_4_4_4_4_REV; break;
|
||||
case D3DFMT_X4R4G4B4: retVal = GL_UNSIGNED_SHORT_4_4_4_4_REV; break;
|
||||
case D3DFMT_A8R8G8B8: retVal = GL_UNSIGNED_INT_8_8_8_8_REV; break;
|
||||
case D3DFMT_X8R8G8B8: retVal = GL_UNSIGNED_INT_8_8_8_8_REV; break;
|
||||
/* to see */
|
||||
case D3DFMT_A8: retVal = GL_ALPHA; break;
|
||||
default:
|
||||
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
||||
retVal = GL_UNSIGNED_BYTE;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE("fmt2glType for fmt(%u,%s) = %x\n", fmt, debug_d3dformat(fmt), retVal);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt) {
|
||||
SHORT retVal;
|
||||
|
||||
switch (fmt) {
|
||||
/* color buffer */
|
||||
case D3DFMT_R3G3B2: retVal = 1; break;
|
||||
case D3DFMT_R5G6B5: retVal = 2; break;
|
||||
case D3DFMT_R8G8B8: retVal = 3; break;
|
||||
case D3DFMT_A1R5G5B5: retVal = 2; break;
|
||||
case D3DFMT_X1R5G5B5: retVal = 2; break;
|
||||
case D3DFMT_A4R4G4B4: retVal = 2; break;
|
||||
case D3DFMT_X4R4G4B4: retVal = 2; break;
|
||||
case D3DFMT_A8R8G8B8: retVal = 4; break;
|
||||
case D3DFMT_X8R8G8B8: retVal = 4; break;
|
||||
/* Paletted */
|
||||
case D3DFMT_P8: retVal = 1; break;
|
||||
case D3DFMT_A8P8: retVal = 2; break;
|
||||
/* depth/stencil buffer */
|
||||
case D3DFMT_D16_LOCKABLE: retVal = 2; break;
|
||||
case D3DFMT_D16: retVal = 2; break;
|
||||
case D3DFMT_D32: retVal = 4; break;
|
||||
case D3DFMT_D15S1: retVal = 2; break;
|
||||
case D3DFMT_D24X4S4: retVal = 4; break;
|
||||
case D3DFMT_D24S8: retVal = 4; break;
|
||||
case D3DFMT_D24X8: retVal = 4; break;
|
||||
/* Luminance */
|
||||
case D3DFMT_L8: retVal = 1; break;
|
||||
case D3DFMT_A4L4: retVal = 1; break;
|
||||
case D3DFMT_A8L8: retVal = 2; break;
|
||||
/* Bump */
|
||||
case D3DFMT_V8U8: retVal = 2; break;
|
||||
case D3DFMT_L6V5U5: retVal = 2; break;
|
||||
case D3DFMT_V16U16: retVal = 4; break;
|
||||
case D3DFMT_X8L8V8U8: retVal = 4; break;
|
||||
/* Compressed */
|
||||
case D3DFMT_DXT1: retVal = 1; break; /* Actually 8 bytes per 16 pixels - Special cased later */
|
||||
case D3DFMT_DXT3: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
|
||||
case D3DFMT_DXT5: retVal = 1; break; /* Actually 16 bytes per 16 pixels */
|
||||
/* to see */
|
||||
case D3DFMT_A8: retVal = 1; break;
|
||||
/* unknown */
|
||||
case D3DFMT_UNKNOWN:
|
||||
/* Guess at the highest value of the above */
|
||||
TRACE("D3DFMT_UNKNOWN - Guessing at 4 bytes/pixel %u\n", fmt);
|
||||
retVal = 4;
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled fmt(%u,%s)\n", fmt, debug_d3dformat(fmt));
|
||||
retVal = 4;
|
||||
}
|
||||
TRACE("bytes/Pxl for fmt(%u,%s) = %d\n", fmt, debug_d3dformat(fmt), retVal);
|
||||
return retVal;
|
||||
}
|
||||
#undef GLINFO_LOCATION
|
||||
|
|
|
@ -50,7 +50,7 @@ ULONG WINAPI IWineD3DVertexBufferImpl_Release(IWineD3DVertexBuffer *iface) {
|
|||
ref = InterlockedDecrement(&This->resource.ref);
|
||||
if (ref == 0) {
|
||||
HeapFree(GetProcessHeap(), 0, This->allocatedMemory);
|
||||
IWineD3DDevice_Release(This->resource.wineD3DDevice);
|
||||
IWineD3DDevice_Release((IWineD3DDevice *)This->resource.wineD3DDevice);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
} else {
|
||||
IUnknown_Release(This->resource.parent); /* Released the reference to the d3dx object */
|
||||
|
|
|
@ -128,6 +128,8 @@ extern int num_lock;
|
|||
/* Maximum number of constants provided to the shaders */
|
||||
#define MAX_CLIPPLANES D3DMAXUSERCLIPPLANES
|
||||
|
||||
#define MAX_PALETTES 256
|
||||
|
||||
/* Checking of API calls */
|
||||
/* --------------------- */
|
||||
#define checkGLcall(A) \
|
||||
|
@ -175,6 +177,7 @@ do {
|
|||
|
||||
/* Advance declaration of structures to satisfy compiler */
|
||||
typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
|
||||
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
|
||||
|
||||
/* Global variables */
|
||||
extern const float identity[16];
|
||||
|
@ -366,6 +369,18 @@ typedef struct IWineD3DDeviceImpl
|
|||
UINT adapterNo;
|
||||
D3DDEVTYPE devType;
|
||||
|
||||
/* Render Target Support */
|
||||
IWineD3DSurfaceImpl *frontBuffer;
|
||||
IWineD3DSurfaceImpl *backBuffer;
|
||||
IWineD3DSurfaceImpl *depthStencilBuffer;
|
||||
|
||||
IWineD3DSurfaceImpl *renderTarget;
|
||||
IWineD3DSurfaceImpl *stencilBufferTarget;
|
||||
|
||||
/* palettes texture management */
|
||||
PALETTEENTRY palettes[MAX_PALETTES][256];
|
||||
UINT currentPalette;
|
||||
|
||||
/* For rendering to a texture using glCopyTexImage */
|
||||
BOOL renderUpsideDown;
|
||||
|
||||
|
@ -387,7 +402,7 @@ typedef struct IWineD3DResourceClass
|
|||
/* WineD3DResource Information */
|
||||
IUnknown *parent;
|
||||
D3DRESOURCETYPE resourceType;
|
||||
IWineD3DDevice *wineD3DDevice;
|
||||
IWineD3DDeviceImpl *wineD3DDevice;
|
||||
|
||||
} IWineD3DResourceClass;
|
||||
|
||||
|
@ -440,6 +455,7 @@ extern IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl;
|
|||
typedef struct IWineD3DBaseTextureClass
|
||||
{
|
||||
UINT levels;
|
||||
BOOL dirty;
|
||||
|
||||
} IWineD3DBaseTextureClass;
|
||||
|
||||
|
@ -454,6 +470,34 @@ typedef struct IWineD3DBaseTextureImpl
|
|||
|
||||
extern IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl;
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DSurface implementation structure
|
||||
*/
|
||||
struct IWineD3DSurfaceImpl
|
||||
{
|
||||
/* IUnknown & IWineD3DResource Information */
|
||||
IWineD3DSurfaceVtbl *lpVtbl;
|
||||
IWineD3DResourceClass resource;
|
||||
|
||||
/* IWineD3DSurface fields */
|
||||
IUnknown *container;
|
||||
D3DSURFACE_DESC currentDesc;
|
||||
BYTE *allocatedMemory;
|
||||
|
||||
UINT textureName;
|
||||
UINT bytesPerPixel;
|
||||
|
||||
BOOL lockable;
|
||||
BOOL locked;
|
||||
RECT lockedRect;
|
||||
RECT dirtyRect;
|
||||
BOOL Dirty;
|
||||
BOOL inTexture;
|
||||
BOOL inPBuffer;
|
||||
};
|
||||
|
||||
extern IWineD3DSurfaceVtbl IWineD3DSurface_Vtbl;
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DStateBlock implementation structure
|
||||
*/
|
||||
|
@ -482,7 +526,7 @@ struct IWineD3DStateBlockImpl
|
|||
|
||||
/* IWineD3DStateBlock information */
|
||||
IUnknown *parent;
|
||||
IWineD3DDevice *wineD3DDevice;
|
||||
IWineD3DDeviceImpl *wineD3DDevice;
|
||||
D3DSTATEBLOCKTYPE blockType;
|
||||
|
||||
/* Array indicating whether things have been set or changed */
|
||||
|
@ -556,6 +600,12 @@ void set_tex_op(IWineD3DDevice *iface, BOOL isAlpha, int Stage, D3DTEXTUREOP o
|
|||
void set_texture_matrix(const float *smat, DWORD flags);
|
||||
void GetSrcAndOpFromValue(DWORD iValue, BOOL isAlphaArg, GLenum* source, GLenum* operand);
|
||||
|
||||
SHORT D3DFmtGetBpp(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
|
||||
GLenum D3DFmt2GLFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
|
||||
GLenum D3DFmt2GLType(IWineD3DDeviceImpl *This, D3DFORMAT fmt);
|
||||
GLint D3DFmt2GLIntFmt(IWineD3DDeviceImpl* This, D3DFORMAT fmt);
|
||||
|
||||
|
||||
#if 0 /* Needs fixing during rework */
|
||||
/*****************************************************************************
|
||||
* IDirect3DVertexShaderDeclaration implementation structure
|
||||
|
|
|
@ -1306,6 +1306,7 @@ typedef struct _D3DSURFACE_DESC {
|
|||
D3DPOOL Pool;
|
||||
UINT Size;
|
||||
D3DMULTISAMPLE_TYPE MultiSampleType;
|
||||
DWORD MultiSampleQuality;
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
} D3DSURFACE_DESC;
|
||||
|
|
|
@ -69,6 +69,19 @@ typedef struct _WINED3DPRESENT_PARAMETERS {
|
|||
UINT *PresentationInterval;
|
||||
} WINED3DPRESENT_PARAMETERS;
|
||||
|
||||
typedef struct _WINED3DSURFACE_DESC
|
||||
{
|
||||
D3DFORMAT *Format;
|
||||
D3DRESOURCETYPE *Type;
|
||||
DWORD *Usage;
|
||||
D3DPOOL *Pool;
|
||||
|
||||
D3DMULTISAMPLE_TYPE *MultiSampleType;
|
||||
DWORD *MultiSampleQuality;
|
||||
UINT *Width;
|
||||
UINT *Height;
|
||||
} WINED3DSURFACE_DESC;
|
||||
|
||||
/* The following have differing names, but actually are the same layout */
|
||||
#if defined( __WINE_D3D8_H )
|
||||
#define WINED3DLIGHT D3DLIGHT8
|
||||
|
@ -89,6 +102,20 @@ typedef struct IWineD3DVertexBuffer IWineD3DVertexBuffer;
|
|||
typedef struct IWineD3DIndexBuffer IWineD3DIndexBuffer;
|
||||
typedef struct IWineD3DBaseTexture IWineD3DBaseTexture;
|
||||
typedef struct IWineD3DStateBlock IWineD3DStateBlock;
|
||||
typedef struct IWineD3DSurface IWineD3DSurface;
|
||||
|
||||
/*****************************************************************************
|
||||
* Callback functions required for predefining surfaces / stencils
|
||||
*/
|
||||
typedef HRESULT WINAPI (*D3DCB_CREATERENDERTARGETFN) (IUnknown *pSurface,
|
||||
UINT Width,
|
||||
UINT Height,
|
||||
D3DFORMAT Format,
|
||||
D3DMULTISAMPLE_TYPE MultiSample,
|
||||
DWORD MultisampleQuality,
|
||||
BOOL Lockable,
|
||||
IWineD3DSurface **ppSurface,
|
||||
HANDLE * pSharedHandle);
|
||||
|
||||
/*****************************************************************************
|
||||
* WineD3D interface
|
||||
|
@ -116,7 +143,7 @@ DECLARE_INTERFACE_(IWineD3D,IUnknown)
|
|||
STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) PURE;
|
||||
STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) PURE;
|
||||
STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, void * pCaps) PURE;
|
||||
STDMETHOD(CreateDevice)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType,HWND hFocusWindow, DWORD BehaviorFlags, WINED3DPRESENT_PARAMETERS * pPresentationParameters, IWineD3DDevice ** ppReturnedDeviceInterface, IUnknown *parent) PURE;
|
||||
STDMETHOD(CreateDevice)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType,HWND hFocusWindow, DWORD BehaviorFlags, WINED3DPRESENT_PARAMETERS * pPresentationParameters, IWineD3DDevice ** ppReturnedDeviceInterface, IUnknown *parent, D3DCB_CREATERENDERTARGETFN pFn) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
|
@ -140,7 +167,7 @@ DECLARE_INTERFACE_(IWineD3D,IUnknown)
|
|||
#define IWineD3D_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f)
|
||||
#define IWineD3D_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d)
|
||||
#define IWineD3D_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c)
|
||||
#define IWineD3D_CreateDevice(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f,g)
|
||||
#define IWineD3D_CreateDevice(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f,g,h)
|
||||
#endif
|
||||
|
||||
/* Define the main WineD3D entrypoint */
|
||||
|
@ -161,6 +188,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
|
|||
STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IWineD3DVertexBuffer **ppVertexBuffer, HANDLE *sharedHandle, IUnknown *parent) PURE;
|
||||
STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IWineD3DIndexBuffer** ppIndexBuffer, HANDLE* pSharedHandle, IUnknown *parent) PURE;
|
||||
STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type, IWineD3DStateBlock **ppStateBlock, IUnknown *parent) PURE;
|
||||
STDMETHOD(CreateRenderTarget)(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IWineD3DSurface** ppSurface, HANDLE* pSharedHandle, IUnknown *parent) PURE;
|
||||
STDMETHOD(SetFVF)(THIS_ DWORD fvf) PURE;
|
||||
STDMETHOD(GetFVF)(THIS_ DWORD * pfvf) PURE;
|
||||
STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IWineD3DVertexBuffer * pStreamData,UINT Offset,UINT Stride) PURE;
|
||||
|
@ -211,6 +239,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IUnknown)
|
|||
#define IWineD3DDevice_CreateVertexBuffer(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f,g)
|
||||
#define IWineD3DDevice_CreateIndexBuffer(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f,g)
|
||||
#define IWineD3DDevice_CreateStateBlock(p,a,b,c) (p)->lpVtbl->CreateStateBlock(p,a,b,c)
|
||||
#define IWineD3DDevice_CreateRenderTarget(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h,i)
|
||||
#define IWineD3DDevice_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a)
|
||||
#define IWineD3DDevice_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a)
|
||||
#define IWineD3DDevice_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d)
|
||||
|
@ -412,6 +441,8 @@ DECLARE_INTERFACE_(IWineD3DBaseTexture,IWineD3DResource)
|
|||
STDMETHOD(SetAutoGenFilterType)(THIS_ D3DTEXTUREFILTERTYPE FilterType) PURE;
|
||||
STDMETHOD_(D3DTEXTUREFILTERTYPE, GetAutoGenFilterType)(THIS) PURE;
|
||||
STDMETHOD_(void, GenerateMipSubLevels)(THIS) PURE;
|
||||
STDMETHOD_(BOOL, SetDirty)(THIS_ BOOL) PURE;
|
||||
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
|
@ -437,6 +468,72 @@ DECLARE_INTERFACE_(IWineD3DBaseTexture,IWineD3DResource)
|
|||
#define IWineD3DBaseTexture_SetAutoGenFilterType(p,a) (p)->lpVtbl->SetAutoGenFilterType(p,a)
|
||||
#define IWineD3DBaseTexture_GetAutoGenFilterType(p) (p)->lpVtbl->GetAutoGenFilterType(p)
|
||||
#define IWineD3DBaseTexture_GenerateMipSubLevels(p) (p)->lpVtbl->GenerateMipSubLevels(p)
|
||||
#define IWineD3DBaseTexture_SetDirty(p,a) (p)->lpVtbl->SetDirty(p,a)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DSurface interface
|
||||
*/
|
||||
#define INTERFACE IWineD3DSurface
|
||||
DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
|
||||
{
|
||||
/*** IUnknown methods ***/
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IWineD3DResource methods ***/
|
||||
STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE;
|
||||
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice ** ppDevice) PURE;
|
||||
STDMETHOD(SetPrivateData)(THIS_ REFGUID refguid, CONST void * pData, DWORD SizeOfData, DWORD Flags) PURE;
|
||||
STDMETHOD(GetPrivateData)(THIS_ REFGUID refguid, void * pData, DWORD * pSizeOfData) PURE;
|
||||
STDMETHOD(FreePrivateData)(THIS_ REFGUID refguid) PURE;
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(D3DRESOURCETYPE,GetType)(THIS) PURE;
|
||||
/*** IWineD3DSurface methods ***/
|
||||
STDMETHOD(GetContainer)(THIS_ REFIID riid, void ** ppContainer) PURE;
|
||||
STDMETHOD(GetDesc)(THIS_ WINED3DSURFACE_DESC * pDesc) PURE;
|
||||
STDMETHOD(LockRect)(THIS_ D3DLOCKED_RECT * pLockedRect, CONST RECT * pRect,DWORD Flags) PURE;
|
||||
STDMETHOD(UnlockRect)(THIS) PURE;
|
||||
STDMETHOD(GetDC)(THIS_ HDC *pHdc) PURE;
|
||||
STDMETHOD(ReleaseDC)(THIS_ HDC hdc) PURE;
|
||||
/* Internally used methods */
|
||||
STDMETHOD(CleanDirtyRect)(THIS) PURE;
|
||||
STDMETHOD(AddDirtyRect)(THIS_ CONST RECT* pRect) PURE;
|
||||
STDMETHOD(LoadTexture)(THIS_ UINT gl_target, UINT gl_level) PURE;
|
||||
STDMETHOD(SaveSnapshot)(THIS_ const char *filename) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
#if !defined(__cplusplus) || defined(CINTERFACE)
|
||||
/*** IUnknown methods ***/
|
||||
#define IWineD3DSurface_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define IWineD3DSurface_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define IWineD3DSurface_Release(p) (p)->lpVtbl->Release(p)
|
||||
/*** IWineD3DResource methods ***/
|
||||
/*** IWineD3DResource methods ***/
|
||||
#define IWineD3DSurface_GetParent(p,a) (p)->lpVtbl->GetParent(p,a)
|
||||
#define IWineD3DSurface_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
|
||||
#define IWineD3DSurface_SetPrivateData(p,a,b,c,d) (p)->lpVtbl->SetPrivateData(p,a,b,c,d)
|
||||
#define IWineD3DSurface_GetPrivateData(p,a,b,c) (p)->lpVtbl->GetPrivateData(p,a,b,c)
|
||||
#define IWineD3DSurface_FreePrivateData(p,a) (p)->lpVtbl->FreePrivateData(p,a)
|
||||
#define IWineD3DSurface_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
|
||||
#define IWineD3DSurface_GetPriority(p) (p)->lpVtbl->GetPriority(p)
|
||||
#define IWineD3DSurface_PreLoad(p) (p)->lpVtbl->PreLoad(p)
|
||||
#define IWineD3DSurface_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
/*** IWineD3DSurface methods ***/
|
||||
#define IWineD3DSurface_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b)
|
||||
#define IWineD3DSurface_GetDesc(p,a) (p)->lpVtbl->GetDesc(p,a)
|
||||
#define IWineD3DSurface_LockRect(p,a,b,c) (p)->lpVtbl->LockRect(p,a,b,c)
|
||||
#define IWineD3DSurface_UnlockRect(p) (p)->lpVtbl->UnlockRect(p)
|
||||
#define IWineD3DSurface_GetDC(p,a) (p)->lpVtbl->GetDC(p,a)
|
||||
#define IWineD3DSurface_ReleaseDC(p,a) (p)->lpVtbl->ReleaseDC(p,a)
|
||||
/*** IWineD3DSurface (Internal, no d3d mapping) methods ***/
|
||||
#define IWineD3DSurface_CleanDirtyRect(p) (p)->lpVtbl->CleanDirtyRect(p)
|
||||
#define IWineD3DSurface_AddDirtyRect(p,a) (p)->lpVtbl->AddDirtyRect(p,a)
|
||||
#define IWineD3DSurface_LoadTexture(p,a,b) (p)->lpVtbl->LoadTexture(p,a,b)
|
||||
#define IWineD3DSurface_SaveSnapshot(p,a) (p)->lpVtbl->SaveSnapshot(p,a)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
|
|
Loading…
Reference in New Issue