mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
Sync Wined3d to Wine 1.1.5 (great work done by: Kamil Hornicek)
svn path=/trunk/; revision=36600
This commit is contained in:
@@ -58,6 +58,11 @@ IDirect3D8* WINAPI Direct3DCreate8(UINT SDKVersion) {
|
||||
TRACE("Created Direct3D object @ %p, WineObj @ %p\n", object, object->WineD3D);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
|
||||
if (!object->WineD3D)
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, object );
|
||||
object = NULL;
|
||||
}
|
||||
return (IDirect3D8*) object;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,60 +45,60 @@
|
||||
Macros
|
||||
=========================================================================== */
|
||||
/* Not nice, but it lets wined3d support different versions of directx */
|
||||
#define D3D8CAPSTOWINECAPS(_pD3D8Caps, _pWineCaps) \
|
||||
_pWineCaps->DeviceType = (WINED3DDEVTYPE *) &_pD3D8Caps->DeviceType; \
|
||||
_pWineCaps->AdapterOrdinal = &_pD3D8Caps->AdapterOrdinal; \
|
||||
_pWineCaps->Caps = &_pD3D8Caps->Caps; \
|
||||
_pWineCaps->Caps2 = &_pD3D8Caps->Caps2; \
|
||||
_pWineCaps->Caps3 = &_pD3D8Caps->Caps3; \
|
||||
_pWineCaps->PresentationIntervals = &_pD3D8Caps->PresentationIntervals; \
|
||||
_pWineCaps->CursorCaps = &_pD3D8Caps->CursorCaps; \
|
||||
_pWineCaps->DevCaps = &_pD3D8Caps->DevCaps; \
|
||||
_pWineCaps->PrimitiveMiscCaps = &_pD3D8Caps->PrimitiveMiscCaps; \
|
||||
_pWineCaps->RasterCaps = &_pD3D8Caps->RasterCaps; \
|
||||
_pWineCaps->ZCmpCaps = &_pD3D8Caps->ZCmpCaps; \
|
||||
_pWineCaps->SrcBlendCaps = &_pD3D8Caps->SrcBlendCaps; \
|
||||
_pWineCaps->DestBlendCaps = &_pD3D8Caps->DestBlendCaps; \
|
||||
_pWineCaps->AlphaCmpCaps = &_pD3D8Caps->AlphaCmpCaps; \
|
||||
_pWineCaps->ShadeCaps = &_pD3D8Caps->ShadeCaps; \
|
||||
_pWineCaps->TextureCaps = &_pD3D8Caps->TextureCaps; \
|
||||
_pWineCaps->TextureFilterCaps = &_pD3D8Caps->TextureFilterCaps; \
|
||||
_pWineCaps->CubeTextureFilterCaps = &_pD3D8Caps->CubeTextureFilterCaps; \
|
||||
_pWineCaps->VolumeTextureFilterCaps = &_pD3D8Caps->VolumeTextureFilterCaps; \
|
||||
_pWineCaps->TextureAddressCaps = &_pD3D8Caps->TextureAddressCaps; \
|
||||
_pWineCaps->VolumeTextureAddressCaps = &_pD3D8Caps->VolumeTextureAddressCaps; \
|
||||
_pWineCaps->LineCaps = &_pD3D8Caps->LineCaps; \
|
||||
_pWineCaps->MaxTextureWidth = &_pD3D8Caps->MaxTextureWidth; \
|
||||
_pWineCaps->MaxTextureHeight = &_pD3D8Caps->MaxTextureHeight; \
|
||||
_pWineCaps->MaxVolumeExtent = &_pD3D8Caps->MaxVolumeExtent; \
|
||||
_pWineCaps->MaxTextureRepeat = &_pD3D8Caps->MaxTextureRepeat; \
|
||||
_pWineCaps->MaxTextureAspectRatio = &_pD3D8Caps->MaxTextureAspectRatio; \
|
||||
_pWineCaps->MaxAnisotropy = &_pD3D8Caps->MaxAnisotropy; \
|
||||
_pWineCaps->MaxVertexW = &_pD3D8Caps->MaxVertexW; \
|
||||
_pWineCaps->GuardBandLeft = &_pD3D8Caps->GuardBandLeft; \
|
||||
_pWineCaps->GuardBandTop = &_pD3D8Caps->GuardBandTop; \
|
||||
_pWineCaps->GuardBandRight = &_pD3D8Caps->GuardBandRight; \
|
||||
_pWineCaps->GuardBandBottom = &_pD3D8Caps->GuardBandBottom; \
|
||||
_pWineCaps->ExtentsAdjust = &_pD3D8Caps->ExtentsAdjust; \
|
||||
_pWineCaps->StencilCaps = &_pD3D8Caps->StencilCaps; \
|
||||
_pWineCaps->FVFCaps = &_pD3D8Caps->FVFCaps; \
|
||||
_pWineCaps->TextureOpCaps = &_pD3D8Caps->TextureOpCaps; \
|
||||
_pWineCaps->MaxTextureBlendStages = &_pD3D8Caps->MaxTextureBlendStages; \
|
||||
_pWineCaps->MaxSimultaneousTextures = &_pD3D8Caps->MaxSimultaneousTextures; \
|
||||
_pWineCaps->VertexProcessingCaps = &_pD3D8Caps->VertexProcessingCaps; \
|
||||
_pWineCaps->MaxActiveLights = &_pD3D8Caps->MaxActiveLights; \
|
||||
_pWineCaps->MaxUserClipPlanes = &_pD3D8Caps->MaxUserClipPlanes; \
|
||||
_pWineCaps->MaxVertexBlendMatrices = &_pD3D8Caps->MaxVertexBlendMatrices; \
|
||||
_pWineCaps->MaxVertexBlendMatrixIndex = &_pD3D8Caps->MaxVertexBlendMatrixIndex; \
|
||||
_pWineCaps->MaxPointSize = &_pD3D8Caps->MaxPointSize; \
|
||||
_pWineCaps->MaxPrimitiveCount = &_pD3D8Caps->MaxPrimitiveCount; \
|
||||
_pWineCaps->MaxVertexIndex = &_pD3D8Caps->MaxVertexIndex; \
|
||||
_pWineCaps->MaxStreams = &_pD3D8Caps->MaxStreams; \
|
||||
_pWineCaps->MaxStreamStride = &_pD3D8Caps->MaxStreamStride; \
|
||||
_pWineCaps->VertexShaderVersion = &_pD3D8Caps->VertexShaderVersion; \
|
||||
_pWineCaps->MaxVertexShaderConst = &_pD3D8Caps->MaxVertexShaderConst; \
|
||||
_pWineCaps->PixelShaderVersion = &_pD3D8Caps->PixelShaderVersion; \
|
||||
_pWineCaps->PixelShader1xMaxValue = &_pD3D8Caps->MaxPixelShaderValue;
|
||||
#define WINECAPSTOD3D8CAPS(_pD3D8Caps, _pWineCaps) \
|
||||
_pD3D8Caps->DeviceType = (D3DDEVTYPE) _pWineCaps->DeviceType; \
|
||||
_pD3D8Caps->AdapterOrdinal = _pWineCaps->AdapterOrdinal; \
|
||||
_pD3D8Caps->Caps = _pWineCaps->Caps; \
|
||||
_pD3D8Caps->Caps2 = _pWineCaps->Caps2; \
|
||||
_pD3D8Caps->Caps3 = _pWineCaps->Caps3; \
|
||||
_pD3D8Caps->PresentationIntervals = _pWineCaps->PresentationIntervals; \
|
||||
_pD3D8Caps->CursorCaps = _pWineCaps->CursorCaps; \
|
||||
_pD3D8Caps->DevCaps = _pWineCaps->DevCaps; \
|
||||
_pD3D8Caps->PrimitiveMiscCaps = _pWineCaps->PrimitiveMiscCaps; \
|
||||
_pD3D8Caps->RasterCaps = _pWineCaps->RasterCaps; \
|
||||
_pD3D8Caps->ZCmpCaps = _pWineCaps->ZCmpCaps; \
|
||||
_pD3D8Caps->SrcBlendCaps = _pWineCaps->SrcBlendCaps; \
|
||||
_pD3D8Caps->DestBlendCaps = _pWineCaps->DestBlendCaps; \
|
||||
_pD3D8Caps->AlphaCmpCaps = _pWineCaps->AlphaCmpCaps; \
|
||||
_pD3D8Caps->ShadeCaps = _pWineCaps->ShadeCaps; \
|
||||
_pD3D8Caps->TextureCaps = _pWineCaps->TextureCaps; \
|
||||
_pD3D8Caps->TextureFilterCaps = _pWineCaps->TextureFilterCaps; \
|
||||
_pD3D8Caps->CubeTextureFilterCaps = _pWineCaps->CubeTextureFilterCaps; \
|
||||
_pD3D8Caps->VolumeTextureFilterCaps = _pWineCaps->VolumeTextureFilterCaps; \
|
||||
_pD3D8Caps->TextureAddressCaps = _pWineCaps->TextureAddressCaps; \
|
||||
_pD3D8Caps->VolumeTextureAddressCaps = _pWineCaps->VolumeTextureAddressCaps; \
|
||||
_pD3D8Caps->LineCaps = _pWineCaps->LineCaps; \
|
||||
_pD3D8Caps->MaxTextureWidth = _pWineCaps->MaxTextureWidth; \
|
||||
_pD3D8Caps->MaxTextureHeight = _pWineCaps->MaxTextureHeight; \
|
||||
_pD3D8Caps->MaxVolumeExtent = _pWineCaps->MaxVolumeExtent; \
|
||||
_pD3D8Caps->MaxTextureRepeat = _pWineCaps->MaxTextureRepeat; \
|
||||
_pD3D8Caps->MaxTextureAspectRatio = _pWineCaps->MaxTextureAspectRatio; \
|
||||
_pD3D8Caps->MaxAnisotropy = _pWineCaps->MaxAnisotropy; \
|
||||
_pD3D8Caps->MaxVertexW = _pWineCaps->MaxVertexW; \
|
||||
_pD3D8Caps->GuardBandLeft = _pWineCaps->GuardBandLeft; \
|
||||
_pD3D8Caps->GuardBandTop = _pWineCaps->GuardBandTop; \
|
||||
_pD3D8Caps->GuardBandRight = _pWineCaps->GuardBandRight; \
|
||||
_pD3D8Caps->GuardBandBottom = _pWineCaps->GuardBandBottom; \
|
||||
_pD3D8Caps->ExtentsAdjust = _pWineCaps->ExtentsAdjust; \
|
||||
_pD3D8Caps->StencilCaps = _pWineCaps->StencilCaps; \
|
||||
_pD3D8Caps->FVFCaps = _pWineCaps->FVFCaps; \
|
||||
_pD3D8Caps->TextureOpCaps = _pWineCaps->TextureOpCaps; \
|
||||
_pD3D8Caps->MaxTextureBlendStages = _pWineCaps->MaxTextureBlendStages; \
|
||||
_pD3D8Caps->MaxSimultaneousTextures = _pWineCaps->MaxSimultaneousTextures; \
|
||||
_pD3D8Caps->VertexProcessingCaps = _pWineCaps->VertexProcessingCaps; \
|
||||
_pD3D8Caps->MaxActiveLights = _pWineCaps->MaxActiveLights; \
|
||||
_pD3D8Caps->MaxUserClipPlanes = _pWineCaps->MaxUserClipPlanes; \
|
||||
_pD3D8Caps->MaxVertexBlendMatrices = _pWineCaps->MaxVertexBlendMatrices; \
|
||||
_pD3D8Caps->MaxVertexBlendMatrixIndex = _pWineCaps->MaxVertexBlendMatrixIndex; \
|
||||
_pD3D8Caps->MaxPointSize = _pWineCaps->MaxPointSize; \
|
||||
_pD3D8Caps->MaxPrimitiveCount = _pWineCaps->MaxPrimitiveCount; \
|
||||
_pD3D8Caps->MaxVertexIndex = _pWineCaps->MaxVertexIndex; \
|
||||
_pD3D8Caps->MaxStreams = _pWineCaps->MaxStreams; \
|
||||
_pD3D8Caps->MaxStreamStride = _pWineCaps->MaxStreamStride; \
|
||||
_pD3D8Caps->VertexShaderVersion = _pWineCaps->VertexShaderVersion; \
|
||||
_pD3D8Caps->MaxVertexShaderConst = _pWineCaps->MaxVertexShaderConst; \
|
||||
_pD3D8Caps->PixelShaderVersion = _pWineCaps->PixelShaderVersion; \
|
||||
_pD3D8Caps->MaxPixelShaderValue = _pWineCaps->PixelShader1xMaxValue;
|
||||
|
||||
/* Direct3D8 Interfaces: */
|
||||
typedef struct IDirect3DBaseTexture8Impl IDirect3DBaseTexture8Impl;
|
||||
@@ -127,7 +127,7 @@ typedef struct IDirect3DVertexShader8Impl IDirect3DVertexShader8Impl;
|
||||
extern CRITICAL_SECTION d3d8_cs;
|
||||
|
||||
/* ===========================================================================
|
||||
The interfactes themselves
|
||||
The interfaces themselves
|
||||
=========================================================================== */
|
||||
|
||||
/* ---------- */
|
||||
@@ -600,7 +600,7 @@ struct IDirect3DVertexShader8Impl {
|
||||
const IDirect3DVertexShader8Vtbl *lpVtbl;
|
||||
LONG ref;
|
||||
|
||||
shader_handle *handle;
|
||||
DWORD handle;
|
||||
IDirect3DVertexDeclaration8 *vertex_declaration;
|
||||
IWineD3DVertexShader *wineD3DVertexShader;
|
||||
};
|
||||
@@ -623,7 +623,7 @@ typedef struct IDirect3DPixelShader8Impl {
|
||||
const IDirect3DPixelShader8Vtbl *lpVtbl;
|
||||
LONG ref;
|
||||
|
||||
shader_handle *handle;
|
||||
DWORD handle;
|
||||
/* The device, to be replaced by an IDirect3DDeviceImpl */
|
||||
IWineD3DPixelShader *wineD3DPixelShader;
|
||||
} IDirect3DPixelShader8Impl;
|
||||
@@ -634,7 +634,8 @@ typedef struct IDirect3DPixelShader8Impl {
|
||||
* to see how not defined it here
|
||||
*/
|
||||
void load_local_constants(const DWORD *d3d8_elements, IWineD3DVertexShader *wined3d_vertex_shader);
|
||||
size_t convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, WINED3DVERTEXELEMENT **wined3d_elements);
|
||||
UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, WINED3DVERTEXELEMENT **wined3d_elements);
|
||||
size_t parse_token(const DWORD* pToken);
|
||||
|
||||
/* Callbacks */
|
||||
extern HRESULT WINAPI D3D8CB_CreateSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height,
|
||||
|
||||
@@ -97,7 +97,7 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) {
|
||||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
int i;
|
||||
unsigned i;
|
||||
|
||||
TRACE("Releasing wined3d device %p\n", This->WineD3DDevice);
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
@@ -192,10 +192,10 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDeviceCaps(LPDIRECT3DDEVICE8 iface
|
||||
return D3DERR_INVALIDCALL; /* well this is what MSDN says to return */
|
||||
}
|
||||
|
||||
D3D8CAPSTOWINECAPS(pCaps, pWineCaps)
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hrc = IWineD3DDevice_GetDeviceCaps(This->WineD3DDevice, pWineCaps);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
WINECAPSTOD3D8CAPS(pCaps, pWineCaps)
|
||||
HeapFree(GetProcessHeap(), 0, pWineCaps);
|
||||
|
||||
/* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
|
||||
@@ -243,7 +243,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetCursorProperties(LPDIRECT3DDEVICE8
|
||||
}
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice,XHotSpot,YHotSpot,(IWineD3DSurface*)pSurface->wineD3DSurface);
|
||||
hr = IWineD3DDevice_SetCursorProperties(This->WineD3DDevice,XHotSpot,YHotSpot,pSurface->wineD3DSurface);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
return hr;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateAdditionalSwapChain(LPDIRECT3DD
|
||||
localParameters.PresentationInterval = pPresentationParameters->FullScreen_PresentationInterval;
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hrc = IWineD3DDevice_CreateAdditionalSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D8CB_CreateRenderTarget, D3D8CB_CreateDepthStencilSurface);
|
||||
hrc = IWineD3DDevice_CreateAdditionalSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D8CB_CreateRenderTarget, D3D8CB_CreateDepthStencilSurface, SURFACE_OPENGL);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
|
||||
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
|
||||
@@ -399,7 +399,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetBackBuffer(LPDIRECT3DDEVICE8 iface
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, (IWineD3DSurface **)&retSurface);
|
||||
rc = IWineD3DDevice_GetBackBuffer(This->WineD3DDevice, 0, BackBuffer, (WINED3DBACKBUFFER_TYPE) Type, &retSurface);
|
||||
if (rc == D3D_OK && NULL != retSurface && NULL != ppBackBuffer) {
|
||||
IWineD3DSurface_GetParent(retSurface, (IUnknown **)ppBackBuffer);
|
||||
IWineD3DSurface_Release(retSurface);
|
||||
@@ -472,9 +472,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateTexture(LPDIRECT3DDEVICE8 iface
|
||||
IUnknown_AddRef(iface);
|
||||
object->parentDevice = iface;
|
||||
*ppTexture = (LPDIRECT3DTEXTURE8) object;
|
||||
TRACE("(%p) Created Texture %p, %p\n",This,object,object->wineD3DTexture);
|
||||
}
|
||||
|
||||
TRACE("(%p) Created Texture %p, %p\n",This,object,object->wineD3DTexture);
|
||||
return hrc;
|
||||
}
|
||||
|
||||
@@ -635,11 +635,6 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateSurface(LPDIRECT3DDEVICE8 iface
|
||||
IDirect3DSurface8Impl *object;
|
||||
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
if(MultisampleQuality < 0) {
|
||||
FIXME("MultisampleQuality out of range %d, substituting 0\n", MultisampleQuality);
|
||||
/*FIXME: Find out what windows does with a MultisampleQuality < 0 */
|
||||
MultisampleQuality=0;
|
||||
}
|
||||
|
||||
if(MultisampleQuality > 0){
|
||||
FIXME("MultisampleQuality set to %d, substituting 0\n" , MultisampleQuality);
|
||||
@@ -702,12 +697,14 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateDepthStencilSurface(LPDIRECT3DD
|
||||
return hr;
|
||||
}
|
||||
|
||||
/* IDirect3DDevice8Impl::CreateImageSurface returns surface with pool type SYSTEMMEM */
|
||||
static HRESULT WINAPI IDirect3DDevice8Impl_CreateImageSurface(LPDIRECT3DDEVICE8 iface, UINT Width, UINT Height, D3DFORMAT Format, IDirect3DSurface8** ppSurface) {
|
||||
HRESULT hr;
|
||||
TRACE("Relay\n");
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Loackable */ , FALSE /*Discard*/ , 0 /* Level */ , ppSurface, D3DRTYPE_SURFACE, 0 /* Usage (undefined/none) */ , D3DPOOL_SCRATCH, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
||||
hr = IDirect3DDevice8Impl_CreateSurface(iface, Width, Height, Format, TRUE /* Loackable */ , FALSE /*Discard*/ , 0 /* Level */ , ppSurface,
|
||||
D3DRTYPE_SURFACE, 0 /* Usage (undefined/none) */ , D3DPOOL_SYSTEMMEM, D3DMULTISAMPLE_NONE, 0 /* MultisampleQuality */);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
return hr;
|
||||
}
|
||||
@@ -808,13 +805,22 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetRenderTarget(LPDIRECT3DDEVICE8 ifa
|
||||
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
|
||||
IDirect3DSurface8Impl *pSurface = (IDirect3DSurface8Impl *)pRenderTarget;
|
||||
IDirect3DSurface8Impl *pZSurface = (IDirect3DSurface8Impl *)pNewZStencil;
|
||||
IWineD3DSurface *original_ds = NULL;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n" , This);
|
||||
|
||||
IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, NULL == pZSurface ? NULL : (IWineD3DSurface *)pZSurface->wineD3DSurface);
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface ? (IWineD3DSurface *)pSurface->wineD3DSurface : NULL);
|
||||
|
||||
hr = IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice, &original_ds);
|
||||
if (hr == WINED3D_OK || hr == WINED3DERR_NOTFOUND)
|
||||
{
|
||||
hr = IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, pZSurface ? pZSurface->wineD3DSurface : NULL);
|
||||
if (SUCCEEDED(hr) && pSurface)
|
||||
hr = IWineD3DDevice_SetRenderTarget(This->WineD3DDevice, 0, pSurface->wineD3DSurface);
|
||||
if (FAILED(hr)) IWineD3DDevice_SetDepthStencilSurface(This->WineD3DDevice, original_ds);
|
||||
}
|
||||
if (original_ds) IWineD3DSurface_Release(original_ds);
|
||||
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
return hr;
|
||||
}
|
||||
@@ -856,16 +862,17 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetDepthStencilSurface(LPDIRECT3DDE
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hr=IWineD3DDevice_GetDepthStencilSurface(This->WineD3DDevice,&pZStencilSurface);
|
||||
if(hr == D3D_OK && pZStencilSurface != NULL){
|
||||
if (hr == WINED3D_OK) {
|
||||
IWineD3DSurface_GetParent(pZStencilSurface,(IUnknown**)ppZStencilSurface);
|
||||
IWineD3DSurface_Release(pZStencilSurface);
|
||||
}else{
|
||||
FIXME("Call to IWineD3DDevice_GetDepthStencilSurface failed\n");
|
||||
if (hr != WINED3DERR_NOTFOUND)
|
||||
FIXME("Call to IWineD3DDevice_GetDepthStencilSurface failed with 0x%08x\n", hr);
|
||||
*ppZStencilSurface = NULL;
|
||||
}
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
|
||||
return D3D_OK;
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3DDevice8Impl_BeginScene(LPDIRECT3DDEVICE8 iface) {
|
||||
@@ -1095,7 +1102,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(LPDIRECT3DDEVICE8 iface
|
||||
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
/* Tell wineD3D to endstatablock before anything else (in case we run out
|
||||
/* Tell wineD3D to endstateblock before anything else (in case we run out
|
||||
* of memory later and cause locking problems)
|
||||
*/
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
@@ -1189,8 +1196,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(LPDIRECT3DDEVICE8 if
|
||||
*pToken = 0;
|
||||
} else {
|
||||
*pToken = (DWORD)object;
|
||||
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object);
|
||||
}
|
||||
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object);
|
||||
|
||||
return hrc;
|
||||
}
|
||||
@@ -1229,7 +1236,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetTexture(LPDIRECT3DDEVICE8 iface, D
|
||||
}
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
rc = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, (IWineD3DBaseTexture **)&retTexture);
|
||||
rc = IWineD3DDevice_GetTexture(This->WineD3DDevice, Stage, &retTexture);
|
||||
if (rc == D3D_OK && NULL != retTexture) {
|
||||
IWineD3DBaseTexture_GetParent(retTexture, (IUnknown **)ppTexture);
|
||||
IWineD3DBaseTexture_Release(retTexture);
|
||||
@@ -1477,7 +1484,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexDeclaration(IDirect3DDevi
|
||||
IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface;
|
||||
IDirect3DVertexDeclaration8Impl *object;
|
||||
WINED3DVERTEXELEMENT *wined3d_elements;
|
||||
size_t wined3d_element_count;
|
||||
UINT wined3d_element_count;
|
||||
HRESULT hr = D3D_OK;
|
||||
|
||||
TRACE("(%p) : declaration %p\n", This, declaration);
|
||||
@@ -1527,6 +1534,23 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8
|
||||
HRESULT hrc = D3D_OK;
|
||||
IDirect3DVertexShader8Impl *object;
|
||||
IWineD3DVertexDeclaration *wined3d_vertex_declaration;
|
||||
const DWORD *token = pDeclaration;
|
||||
|
||||
/* Test if the vertex declaration is valid */
|
||||
while (D3DVSD_END() != *token) {
|
||||
D3DVSD_TOKENTYPE token_type = ((*token & D3DVSD_TOKENTYPEMASK) >> D3DVSD_TOKENTYPESHIFT);
|
||||
|
||||
if (token_type == D3DVSD_TOKEN_STREAMDATA && !(token_type & 0x10000000)) {
|
||||
DWORD type = ((*token & D3DVSD_DATATYPEMASK) >> D3DVSD_DATATYPESHIFT);
|
||||
DWORD reg = ((*token & D3DVSD_VERTEXREGMASK) >> D3DVSD_VERTEXREGSHIFT);
|
||||
|
||||
if(reg == D3DVSDE_NORMAL && type != D3DVSDT_FLOAT3 && !pFunction) {
|
||||
WARN("Attempt to use a non-FLOAT3 normal with the fixed function function\n");
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
}
|
||||
token += parse_token(token);
|
||||
}
|
||||
|
||||
/* Setup a stub object for now */
|
||||
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
|
||||
@@ -1560,22 +1584,22 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppShader = 0;
|
||||
} else {
|
||||
/* TODO: Store the VS declarations locally so that they can be derefferenced with a value higher than VS_HIGHESTFIXEDFXF */
|
||||
/* TODO: Store the VS declarations locally so that they can be dereferenced with a value higher than VS_HIGHESTFIXEDFXF */
|
||||
shader_handle *handle = alloc_shader_handle(This);
|
||||
if (!handle) {
|
||||
ERR("Failed to allocate shader handle\n");
|
||||
IDirect3DVertexShader8_Release((IUnknown *)object);
|
||||
hrc = E_OUTOFMEMORY;
|
||||
} else {
|
||||
object->handle = handle;
|
||||
*handle = object;
|
||||
*ppShader = (handle - This->shader_handles) + VS_HIGHESTFIXEDFXF + 1;
|
||||
object->handle = (handle - This->shader_handles) + VS_HIGHESTFIXEDFXF + 1;
|
||||
*ppShader = object->handle;
|
||||
|
||||
load_local_constants(pDeclaration, object->wineD3DVertexShader);
|
||||
TRACE("(%p) : returning %p (handle %#x)\n", This, object, *ppShader);
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
TRACE("(%p) : returning %p (handle %#x)\n", This, object, *ppShader);
|
||||
|
||||
return hrc;
|
||||
}
|
||||
@@ -1675,7 +1699,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(LPDIRECT3DDEVICE8 ifa
|
||||
IDirect3DVertexShader8Impl *d3d8_shader;
|
||||
hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)&d3d8_shader);
|
||||
IWineD3DVertexShader_Release(pShader);
|
||||
*ppShader = (d3d8_shader->handle - This->shader_handles) + (VS_HIGHESTFIXEDFXF + 1);
|
||||
*ppShader = d3d8_shader->handle;
|
||||
} else {
|
||||
*ppShader = 0;
|
||||
hrc = D3D_OK;
|
||||
@@ -1793,7 +1817,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderFunction(LPDIRECT3DDEV
|
||||
}
|
||||
|
||||
shader = This->shader_handles[pVertexShader - (VS_HIGHESTFIXEDFXF + 1)];
|
||||
hr = IWineD3DVertexShader_GetFunction(shader->wineD3DVertexShader, pData, (UINT *)pSizeOfData);
|
||||
hr = IWineD3DVertexShader_GetFunction(shader->wineD3DVertexShader, pData, pSizeOfData);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
return hr;
|
||||
}
|
||||
@@ -1875,15 +1899,15 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreatePixelShader(LPDIRECT3DDEVICE8 i
|
||||
IDirect3DVertexShader8_Release((IUnknown *)object);
|
||||
hrc = E_OUTOFMEMORY;
|
||||
} else {
|
||||
object->handle = handle;
|
||||
*handle = object;
|
||||
*ppShader = (handle - This->shader_handles) + VS_HIGHESTFIXEDFXF + 1;
|
||||
object->handle = (handle - This->shader_handles) + VS_HIGHESTFIXEDFXF + 1;
|
||||
*ppShader = object->handle;
|
||||
TRACE("(%p) : returning %p (handle %#x)\n", This, object, *ppShader);
|
||||
}
|
||||
}
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
}
|
||||
|
||||
TRACE("(%p) : returning %p (handle %#x)\n", This, object, *ppShader);
|
||||
return hrc;
|
||||
}
|
||||
|
||||
@@ -1924,7 +1948,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShader(LPDIRECT3DDEVICE8 ifac
|
||||
IDirect3DPixelShader8Impl *d3d8_shader;
|
||||
hrc = IWineD3DPixelShader_GetParent(object, (IUnknown **)&d3d8_shader);
|
||||
IWineD3DPixelShader_Release(object);
|
||||
*ppShader = (d3d8_shader->handle - This->shader_handles) + (VS_HIGHESTFIXEDFXF + 1);
|
||||
*ppShader = d3d8_shader->handle;
|
||||
} else {
|
||||
*ppShader = (DWORD)NULL;
|
||||
}
|
||||
@@ -2000,7 +2024,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetPixelShaderFunction(LPDIRECT3DDEVI
|
||||
}
|
||||
|
||||
shader = This->shader_handles[pPixelShader - (VS_HIGHESTFIXEDFXF + 1)];
|
||||
hr = IWineD3DPixelShader_GetFunction(shader->wineD3DPixelShader, pData, (UINT *)pSizeOfData);
|
||||
hr = IWineD3DPixelShader_GetFunction(shader->wineD3DPixelShader, pData, pSizeOfData);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
return hr;
|
||||
}
|
||||
@@ -2063,7 +2087,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetStreamSource(LPDIRECT3DDEVICE8 ifa
|
||||
}
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, (IWineD3DVertexBuffer **)&retStream, 0 /* Offset in bytes */, pStride);
|
||||
rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, &retStream, 0 /* Offset in bytes */, pStride);
|
||||
if (rc == D3D_OK && NULL != retStream) {
|
||||
IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream);
|
||||
IWineD3DVertexBuffer_Release(retStream);
|
||||
|
||||
@@ -184,7 +184,7 @@ static HRESULT WINAPI IDirect3D8Impl_CheckDeviceFormat (LPDIRECT3D8 i
|
||||
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, AdapterFormat,
|
||||
Usage, RType, CheckFormat);
|
||||
Usage, RType, CheckFormat, SURFACE_OPENGL);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
return hr;
|
||||
}
|
||||
@@ -231,10 +231,10 @@ static HRESULT WINAPI IDirect3D8Impl_GetDeviceCaps(LPDIRECT3D8 iface, UINT Ada
|
||||
if(pWineCaps == NULL){
|
||||
return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/
|
||||
}
|
||||
D3D8CAPSTOWINECAPS(pCaps, pWineCaps)
|
||||
EnterCriticalSection(&d3d8_cs);
|
||||
hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps);
|
||||
LeaveCriticalSection(&d3d8_cs);
|
||||
WINECAPSTOD3D8CAPS(pCaps, pWineCaps)
|
||||
HeapFree(GetProcessHeap(), 0, pWineCaps);
|
||||
|
||||
/* D3D8 doesn't support SM 2.0 or higher, so clamp to 1.x */
|
||||
@@ -295,7 +295,7 @@ ULONG WINAPI D3D8CB_DestroyRenderTarget(IWineD3DSurface *pSurface) {
|
||||
return IDirect3DSurface8_Release((IDirect3DSurface8*) surfaceParent);
|
||||
}
|
||||
|
||||
/* Callback for creating the inplicite swapchain when the device is created */
|
||||
/* Callback for creating the implicit swapchain when the device is created */
|
||||
static HRESULT WINAPI D3D8CB_CreateAdditionalSwapChain(IUnknown *device,
|
||||
WINED3DPRESENT_PARAMETERS* pPresentationParameters,
|
||||
IWineD3DSwapChain ** ppSwapChain){
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d8);
|
||||
|
||||
/* NOTE: DirectX8 doesn't export a IDirect3DStateBlock8, the interface is used internally to keep d3d8 and d3d9 as simila as possible */
|
||||
/* NOTE: DirectX8 doesn't export an IDirect3DStateBlock8, the interface is used internally to keep d3d8 and d3d9 as similar as possible */
|
||||
/* IDirect3DStateBlock8 IUnknown parts follow: */
|
||||
static HRESULT WINAPI IDirect3DStateBlock8Impl_QueryInterface(IDirect3DStateBlock8 *iface, REFIID riid, LPVOID *ppobj) {
|
||||
IDirect3DStateBlock8Impl *This = (IDirect3DStateBlock8Impl *)iface;
|
||||
|
||||
@@ -118,7 +118,7 @@ static const char *debug_d3dvsde_register(D3DVSDE_REGISTER d3dvsde_register)
|
||||
}
|
||||
}
|
||||
|
||||
static size_t parse_token(const DWORD* pToken)
|
||||
size_t parse_token(const DWORD* pToken)
|
||||
{
|
||||
const DWORD token = *pToken;
|
||||
size_t tokenlen = 1;
|
||||
@@ -272,7 +272,7 @@ static const wined3d_usage_t wined3d_usage_lookup[] = {
|
||||
};
|
||||
|
||||
/* TODO: find out where rhw (or positionT) is for declaration8 */
|
||||
size_t convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, WINED3DVERTEXELEMENT **wined3d_elements)
|
||||
UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elements_size, WINED3DVERTEXELEMENT **wined3d_elements)
|
||||
{
|
||||
const DWORD *token = d3d8_elements;
|
||||
WINED3DVERTEXELEMENT *element;
|
||||
|
||||
@@ -237,7 +237,7 @@ HRESULT WINAPI D3D8CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppVolume = NULL;
|
||||
} else {
|
||||
*ppVolume = (IWineD3DVolume *)object->wineD3DVolume;
|
||||
*ppVolume = object->wineD3DVolume;
|
||||
object->container = pSuperior;
|
||||
object->forwardReference = pSuperior;
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ TOPOBJDIR = ../..
|
||||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
MODULE = d3d9.dll
|
||||
IMPORTLIB = libd3d9.$(IMPLIBEXT)
|
||||
IMPORTS = wined3d user32 gdi32 kernel32
|
||||
EXTRALIBS = -ldxguid -luuid
|
||||
IMPORTLIB = d3d9
|
||||
IMPORTS = dxguid uuid wined3d kernel32
|
||||
|
||||
C_SRCS = \
|
||||
basetexture.c \
|
||||
|
||||
@@ -333,7 +333,7 @@ static const IDirect3DCubeTexture9Vtbl Direct3DCubeTexture9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DCubeTexture9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface,
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9EX iface,
|
||||
UINT EdgeLength, UINT Levels, DWORD Usage,
|
||||
D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) {
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
@ stdcall D3D9GetSWInfo()
|
||||
@ stdcall DebugSetMute()
|
||||
@ stdcall Direct3DCreate9(long)
|
||||
@ stdcall Direct3DShaderValidatorCreate9()
|
||||
@ stub PSGPError
|
||||
@ stub PSGPSampleTexture
|
||||
@ stdcall D3DPERF_BeginEvent(long wstr)
|
||||
@ stdcall D3DPERF_EndEvent()
|
||||
@ stdcall D3DPERF_GetStatus()
|
||||
@ stdcall D3DPERF_SetOptions(long)
|
||||
@ stdcall D3DPERF_QueryRepeatFrame()
|
||||
@ stdcall D3DPERF_SetMarker(long wstr)
|
||||
@ stdcall D3DPERF_SetOptions(long)
|
||||
@ stdcall D3DPERF_SetRegion(long wstr)
|
||||
@ stub DebugSetLevel
|
||||
@ stdcall DebugSetMute()
|
||||
@ stdcall Direct3DCreate9(long)
|
||||
@ stdcall Direct3DCreate9Ex(long ptr)
|
||||
|
||||
@@ -38,11 +38,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
|
||||
|
||||
static int D3DPERF_event_level = 0;
|
||||
|
||||
HRESULT WINAPI D3D9GetSWInfo(void) {
|
||||
FIXME("(void): stub\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WINAPI DebugSetMute(void) {
|
||||
/* nothing to do */
|
||||
}
|
||||
@@ -58,12 +53,49 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) {
|
||||
|
||||
TRACE("SDKVersion = %x, Created Direct3D object @ %p, WineObj @ %p\n", SDKVersion, object, object->WineD3D);
|
||||
|
||||
if (!object->WineD3D)
|
||||
{
|
||||
HeapFree( GetProcessHeap(), 0, object );
|
||||
object = NULL;
|
||||
}
|
||||
return (IDirect3D9*) object;
|
||||
}
|
||||
|
||||
/* At process attach */
|
||||
HRESULT WINAPI Direct3DCreate9Ex(UINT SDKVersion, IDirect3D9Ex **direct3d9ex) {
|
||||
IDirect3D9 *ret;
|
||||
IDirect3D9Impl* object;
|
||||
|
||||
TRACE("Calling Direct3DCreate9\n");
|
||||
ret = Direct3DCreate9(SDKVersion);
|
||||
if(!ret) {
|
||||
*direct3d9ex = NULL;
|
||||
return D3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
object = (IDirect3D9Impl *) ret;
|
||||
object->extended = TRUE; /* Enables QI for extended interfaces */
|
||||
*direct3d9ex = (IDirect3D9Ex *) object;
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* Direct3DShaderValidatorCreate9 (D3D9.@)
|
||||
*
|
||||
* No documentation available for this function.
|
||||
* SDK only says it is internal and shouldn't be used.
|
||||
*/
|
||||
void* WINAPI Direct3DShaderValidatorCreate9(void)
|
||||
{
|
||||
FIXME("stub\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* DllMain
|
||||
*/
|
||||
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
||||
{
|
||||
/* At process attach */
|
||||
TRACE("fdwReason=%d\n", fdwReason);
|
||||
if (fdwReason == DLL_PROCESS_ATTACH)
|
||||
DisableThreadLibraryCalls(hInstDLL);
|
||||
|
||||
@@ -50,86 +50,86 @@ extern CRITICAL_SECTION d3d9_cs;
|
||||
Macros
|
||||
=========================================================================== */
|
||||
/* Not nice, but it lets wined3d support different versions of directx */
|
||||
#define D3D9CAPSTOWINECAPS(_pD3D9Caps, _pWineCaps) \
|
||||
_pWineCaps->DeviceType = (WINED3DDEVTYPE *) &_pD3D9Caps->DeviceType; \
|
||||
_pWineCaps->AdapterOrdinal = &_pD3D9Caps->AdapterOrdinal; \
|
||||
_pWineCaps->Caps = &_pD3D9Caps->Caps; \
|
||||
_pWineCaps->Caps2 = &_pD3D9Caps->Caps2; \
|
||||
_pWineCaps->Caps3 = &_pD3D9Caps->Caps3; \
|
||||
_pWineCaps->PresentationIntervals = &_pD3D9Caps->PresentationIntervals; \
|
||||
_pWineCaps->CursorCaps = &_pD3D9Caps->CursorCaps; \
|
||||
_pWineCaps->DevCaps = &_pD3D9Caps->DevCaps; \
|
||||
_pWineCaps->PrimitiveMiscCaps = &_pD3D9Caps->PrimitiveMiscCaps; \
|
||||
_pWineCaps->RasterCaps = &_pD3D9Caps->RasterCaps; \
|
||||
_pWineCaps->ZCmpCaps = &_pD3D9Caps->ZCmpCaps; \
|
||||
_pWineCaps->SrcBlendCaps = &_pD3D9Caps->SrcBlendCaps; \
|
||||
_pWineCaps->DestBlendCaps = &_pD3D9Caps->DestBlendCaps; \
|
||||
_pWineCaps->AlphaCmpCaps = &_pD3D9Caps->AlphaCmpCaps; \
|
||||
_pWineCaps->ShadeCaps = &_pD3D9Caps->ShadeCaps; \
|
||||
_pWineCaps->TextureCaps = &_pD3D9Caps->TextureCaps; \
|
||||
_pWineCaps->TextureFilterCaps = &_pD3D9Caps->TextureFilterCaps; \
|
||||
_pWineCaps->CubeTextureFilterCaps = &_pD3D9Caps->CubeTextureFilterCaps; \
|
||||
_pWineCaps->VolumeTextureFilterCaps = &_pD3D9Caps->VolumeTextureFilterCaps; \
|
||||
_pWineCaps->TextureAddressCaps = &_pD3D9Caps->TextureAddressCaps; \
|
||||
_pWineCaps->VolumeTextureAddressCaps = &_pD3D9Caps->VolumeTextureAddressCaps; \
|
||||
_pWineCaps->LineCaps = &_pD3D9Caps->LineCaps; \
|
||||
_pWineCaps->MaxTextureWidth = &_pD3D9Caps->MaxTextureWidth; \
|
||||
_pWineCaps->MaxTextureHeight = &_pD3D9Caps->MaxTextureHeight; \
|
||||
_pWineCaps->MaxVolumeExtent = &_pD3D9Caps->MaxVolumeExtent; \
|
||||
_pWineCaps->MaxTextureRepeat = &_pD3D9Caps->MaxTextureRepeat; \
|
||||
_pWineCaps->MaxTextureAspectRatio = &_pD3D9Caps->MaxTextureAspectRatio; \
|
||||
_pWineCaps->MaxAnisotropy = &_pD3D9Caps->MaxAnisotropy; \
|
||||
_pWineCaps->MaxVertexW = &_pD3D9Caps->MaxVertexW; \
|
||||
_pWineCaps->GuardBandLeft = &_pD3D9Caps->GuardBandLeft; \
|
||||
_pWineCaps->GuardBandTop = &_pD3D9Caps->GuardBandTop; \
|
||||
_pWineCaps->GuardBandRight = &_pD3D9Caps->GuardBandRight; \
|
||||
_pWineCaps->GuardBandBottom = &_pD3D9Caps->GuardBandBottom; \
|
||||
_pWineCaps->ExtentsAdjust = &_pD3D9Caps->ExtentsAdjust; \
|
||||
_pWineCaps->StencilCaps = &_pD3D9Caps->StencilCaps; \
|
||||
_pWineCaps->FVFCaps = &_pD3D9Caps->FVFCaps; \
|
||||
_pWineCaps->TextureOpCaps = &_pD3D9Caps->TextureOpCaps; \
|
||||
_pWineCaps->MaxTextureBlendStages = &_pD3D9Caps->MaxTextureBlendStages; \
|
||||
_pWineCaps->MaxSimultaneousTextures = &_pD3D9Caps->MaxSimultaneousTextures; \
|
||||
_pWineCaps->VertexProcessingCaps = &_pD3D9Caps->VertexProcessingCaps; \
|
||||
_pWineCaps->MaxActiveLights = &_pD3D9Caps->MaxActiveLights; \
|
||||
_pWineCaps->MaxUserClipPlanes = &_pD3D9Caps->MaxUserClipPlanes; \
|
||||
_pWineCaps->MaxVertexBlendMatrices = &_pD3D9Caps->MaxVertexBlendMatrices; \
|
||||
_pWineCaps->MaxVertexBlendMatrixIndex = &_pD3D9Caps->MaxVertexBlendMatrixIndex; \
|
||||
_pWineCaps->MaxPointSize = &_pD3D9Caps->MaxPointSize; \
|
||||
_pWineCaps->MaxPrimitiveCount = &_pD3D9Caps->MaxPrimitiveCount; \
|
||||
_pWineCaps->MaxVertexIndex = &_pD3D9Caps->MaxVertexIndex; \
|
||||
_pWineCaps->MaxStreams = &_pD3D9Caps->MaxStreams; \
|
||||
_pWineCaps->MaxStreamStride = &_pD3D9Caps->MaxStreamStride; \
|
||||
_pWineCaps->VertexShaderVersion = &_pD3D9Caps->VertexShaderVersion; \
|
||||
_pWineCaps->MaxVertexShaderConst = &_pD3D9Caps->MaxVertexShaderConst; \
|
||||
_pWineCaps->PixelShaderVersion = &_pD3D9Caps->PixelShaderVersion; \
|
||||
_pWineCaps->PixelShader1xMaxValue = &_pD3D9Caps->PixelShader1xMaxValue; \
|
||||
_pWineCaps->DevCaps2 = &_pD3D9Caps->DevCaps2; \
|
||||
_pWineCaps->MaxNpatchTessellationLevel = &_pD3D9Caps->MaxNpatchTessellationLevel; \
|
||||
_pWineCaps->MasterAdapterOrdinal = &_pD3D9Caps->MasterAdapterOrdinal; \
|
||||
_pWineCaps->AdapterOrdinalInGroup = &_pD3D9Caps->AdapterOrdinalInGroup; \
|
||||
_pWineCaps->NumberOfAdaptersInGroup = &_pD3D9Caps->NumberOfAdaptersInGroup; \
|
||||
_pWineCaps->DeclTypes = &_pD3D9Caps->DeclTypes; \
|
||||
_pWineCaps->NumSimultaneousRTs = &_pD3D9Caps->NumSimultaneousRTs; \
|
||||
_pWineCaps->StretchRectFilterCaps = &_pD3D9Caps->StretchRectFilterCaps; \
|
||||
_pWineCaps->VS20Caps.Caps = &_pD3D9Caps->VS20Caps.Caps; \
|
||||
_pWineCaps->VS20Caps.DynamicFlowControlDepth = &_pD3D9Caps->VS20Caps.DynamicFlowControlDepth; \
|
||||
_pWineCaps->VS20Caps.NumTemps = &_pD3D9Caps->VS20Caps.NumTemps; \
|
||||
_pWineCaps->VS20Caps.NumTemps = &_pD3D9Caps->VS20Caps.NumTemps; \
|
||||
_pWineCaps->VS20Caps.StaticFlowControlDepth = &_pD3D9Caps->VS20Caps.StaticFlowControlDepth; \
|
||||
_pWineCaps->PS20Caps.Caps = &_pD3D9Caps->PS20Caps.Caps; \
|
||||
_pWineCaps->PS20Caps.DynamicFlowControlDepth = &_pD3D9Caps->PS20Caps.DynamicFlowControlDepth; \
|
||||
_pWineCaps->PS20Caps.NumTemps = &_pD3D9Caps->PS20Caps.NumTemps; \
|
||||
_pWineCaps->PS20Caps.StaticFlowControlDepth = &_pD3D9Caps->PS20Caps.StaticFlowControlDepth; \
|
||||
_pWineCaps->PS20Caps.NumInstructionSlots = &_pD3D9Caps->PS20Caps.NumInstructionSlots; \
|
||||
_pWineCaps->VertexTextureFilterCaps = &_pD3D9Caps->VertexTextureFilterCaps; \
|
||||
_pWineCaps->MaxVShaderInstructionsExecuted = &_pD3D9Caps->MaxVShaderInstructionsExecuted; \
|
||||
_pWineCaps->MaxPShaderInstructionsExecuted = &_pD3D9Caps->MaxPShaderInstructionsExecuted; \
|
||||
_pWineCaps->MaxVertexShader30InstructionSlots = &_pD3D9Caps->MaxVertexShader30InstructionSlots; \
|
||||
_pWineCaps->MaxPixelShader30InstructionSlots = &_pD3D9Caps->MaxPixelShader30InstructionSlots;
|
||||
#define WINECAPSTOD3D9CAPS(_pD3D9Caps, _pWineCaps) \
|
||||
_pD3D9Caps->DeviceType = (D3DDEVTYPE) _pWineCaps->DeviceType; \
|
||||
_pD3D9Caps->AdapterOrdinal = _pWineCaps->AdapterOrdinal; \
|
||||
_pD3D9Caps->Caps = _pWineCaps->Caps; \
|
||||
_pD3D9Caps->Caps2 = _pWineCaps->Caps2; \
|
||||
_pD3D9Caps->Caps3 = _pWineCaps->Caps3; \
|
||||
_pD3D9Caps->PresentationIntervals = _pWineCaps->PresentationIntervals; \
|
||||
_pD3D9Caps->CursorCaps = _pWineCaps->CursorCaps; \
|
||||
_pD3D9Caps->DevCaps = _pWineCaps->DevCaps; \
|
||||
_pD3D9Caps->PrimitiveMiscCaps = _pWineCaps->PrimitiveMiscCaps; \
|
||||
_pD3D9Caps->RasterCaps = _pWineCaps->RasterCaps; \
|
||||
_pD3D9Caps->ZCmpCaps = _pWineCaps->ZCmpCaps; \
|
||||
_pD3D9Caps->SrcBlendCaps = _pWineCaps->SrcBlendCaps; \
|
||||
_pD3D9Caps->DestBlendCaps = _pWineCaps->DestBlendCaps; \
|
||||
_pD3D9Caps->AlphaCmpCaps = _pWineCaps->AlphaCmpCaps; \
|
||||
_pD3D9Caps->ShadeCaps = _pWineCaps->ShadeCaps; \
|
||||
_pD3D9Caps->TextureCaps = _pWineCaps->TextureCaps; \
|
||||
_pD3D9Caps->TextureFilterCaps = _pWineCaps->TextureFilterCaps; \
|
||||
_pD3D9Caps->CubeTextureFilterCaps = _pWineCaps->CubeTextureFilterCaps; \
|
||||
_pD3D9Caps->VolumeTextureFilterCaps = _pWineCaps->VolumeTextureFilterCaps; \
|
||||
_pD3D9Caps->TextureAddressCaps = _pWineCaps->TextureAddressCaps; \
|
||||
_pD3D9Caps->VolumeTextureAddressCaps = _pWineCaps->VolumeTextureAddressCaps; \
|
||||
_pD3D9Caps->LineCaps = _pWineCaps->LineCaps; \
|
||||
_pD3D9Caps->MaxTextureWidth = _pWineCaps->MaxTextureWidth; \
|
||||
_pD3D9Caps->MaxTextureHeight = _pWineCaps->MaxTextureHeight; \
|
||||
_pD3D9Caps->MaxVolumeExtent = _pWineCaps->MaxVolumeExtent; \
|
||||
_pD3D9Caps->MaxTextureRepeat = _pWineCaps->MaxTextureRepeat; \
|
||||
_pD3D9Caps->MaxTextureAspectRatio = _pWineCaps->MaxTextureAspectRatio; \
|
||||
_pD3D9Caps->MaxAnisotropy = _pWineCaps->MaxAnisotropy; \
|
||||
_pD3D9Caps->MaxVertexW = _pWineCaps->MaxVertexW; \
|
||||
_pD3D9Caps->GuardBandLeft = _pWineCaps->GuardBandLeft; \
|
||||
_pD3D9Caps->GuardBandTop = _pWineCaps->GuardBandTop; \
|
||||
_pD3D9Caps->GuardBandRight = _pWineCaps->GuardBandRight; \
|
||||
_pD3D9Caps->GuardBandBottom = _pWineCaps->GuardBandBottom; \
|
||||
_pD3D9Caps->ExtentsAdjust = _pWineCaps->ExtentsAdjust; \
|
||||
_pD3D9Caps->StencilCaps = _pWineCaps->StencilCaps; \
|
||||
_pD3D9Caps->FVFCaps = _pWineCaps->FVFCaps; \
|
||||
_pD3D9Caps->TextureOpCaps = _pWineCaps->TextureOpCaps; \
|
||||
_pD3D9Caps->MaxTextureBlendStages = _pWineCaps->MaxTextureBlendStages; \
|
||||
_pD3D9Caps->MaxSimultaneousTextures = _pWineCaps->MaxSimultaneousTextures; \
|
||||
_pD3D9Caps->VertexProcessingCaps = _pWineCaps->VertexProcessingCaps; \
|
||||
_pD3D9Caps->MaxActiveLights = _pWineCaps->MaxActiveLights; \
|
||||
_pD3D9Caps->MaxUserClipPlanes = _pWineCaps->MaxUserClipPlanes; \
|
||||
_pD3D9Caps->MaxVertexBlendMatrices = _pWineCaps->MaxVertexBlendMatrices; \
|
||||
_pD3D9Caps->MaxVertexBlendMatrixIndex = _pWineCaps->MaxVertexBlendMatrixIndex; \
|
||||
_pD3D9Caps->MaxPointSize = _pWineCaps->MaxPointSize; \
|
||||
_pD3D9Caps->MaxPrimitiveCount = _pWineCaps->MaxPrimitiveCount; \
|
||||
_pD3D9Caps->MaxVertexIndex = _pWineCaps->MaxVertexIndex; \
|
||||
_pD3D9Caps->MaxStreams = _pWineCaps->MaxStreams; \
|
||||
_pD3D9Caps->MaxStreamStride = _pWineCaps->MaxStreamStride; \
|
||||
_pD3D9Caps->VertexShaderVersion = _pWineCaps->VertexShaderVersion; \
|
||||
_pD3D9Caps->MaxVertexShaderConst = _pWineCaps->MaxVertexShaderConst; \
|
||||
_pD3D9Caps->PixelShaderVersion = _pWineCaps->PixelShaderVersion; \
|
||||
_pD3D9Caps->PixelShader1xMaxValue = _pWineCaps->PixelShader1xMaxValue; \
|
||||
_pD3D9Caps->DevCaps2 = _pWineCaps->DevCaps2; \
|
||||
_pD3D9Caps->MaxNpatchTessellationLevel = _pWineCaps->MaxNpatchTessellationLevel; \
|
||||
_pD3D9Caps->MasterAdapterOrdinal = _pWineCaps->MasterAdapterOrdinal; \
|
||||
_pD3D9Caps->AdapterOrdinalInGroup = _pWineCaps->AdapterOrdinalInGroup; \
|
||||
_pD3D9Caps->NumberOfAdaptersInGroup = _pWineCaps->NumberOfAdaptersInGroup; \
|
||||
_pD3D9Caps->DeclTypes = _pWineCaps->DeclTypes; \
|
||||
_pD3D9Caps->NumSimultaneousRTs = _pWineCaps->NumSimultaneousRTs; \
|
||||
_pD3D9Caps->StretchRectFilterCaps = _pWineCaps->StretchRectFilterCaps; \
|
||||
_pD3D9Caps->VS20Caps.Caps = _pWineCaps->VS20Caps.Caps; \
|
||||
_pD3D9Caps->VS20Caps.DynamicFlowControlDepth = _pWineCaps->VS20Caps.DynamicFlowControlDepth; \
|
||||
_pD3D9Caps->VS20Caps.NumTemps = _pWineCaps->VS20Caps.NumTemps; \
|
||||
_pD3D9Caps->VS20Caps.NumTemps = _pWineCaps->VS20Caps.NumTemps; \
|
||||
_pD3D9Caps->VS20Caps.StaticFlowControlDepth = _pWineCaps->VS20Caps.StaticFlowControlDepth; \
|
||||
_pD3D9Caps->PS20Caps.Caps = _pWineCaps->PS20Caps.Caps; \
|
||||
_pD3D9Caps->PS20Caps.DynamicFlowControlDepth = _pWineCaps->PS20Caps.DynamicFlowControlDepth; \
|
||||
_pD3D9Caps->PS20Caps.NumTemps = _pWineCaps->PS20Caps.NumTemps; \
|
||||
_pD3D9Caps->PS20Caps.StaticFlowControlDepth = _pWineCaps->PS20Caps.StaticFlowControlDepth; \
|
||||
_pD3D9Caps->PS20Caps.NumInstructionSlots = _pWineCaps->PS20Caps.NumInstructionSlots; \
|
||||
_pD3D9Caps->VertexTextureFilterCaps = _pWineCaps->VertexTextureFilterCaps; \
|
||||
_pD3D9Caps->MaxVShaderInstructionsExecuted = _pWineCaps->MaxVShaderInstructionsExecuted; \
|
||||
_pD3D9Caps->MaxPShaderInstructionsExecuted = _pWineCaps->MaxPShaderInstructionsExecuted; \
|
||||
_pD3D9Caps->MaxVertexShader30InstructionSlots = _pWineCaps->MaxVertexShader30InstructionSlots; \
|
||||
_pD3D9Caps->MaxPixelShader30InstructionSlots = _pWineCaps->MaxPixelShader30InstructionSlots;
|
||||
|
||||
/* ===========================================================================
|
||||
D3D9 interfactes
|
||||
D3D9 interfaces
|
||||
=========================================================================== */
|
||||
|
||||
/* ---------- */
|
||||
@@ -139,7 +139,7 @@ extern CRITICAL_SECTION d3d9_cs;
|
||||
/*****************************************************************************
|
||||
* Predeclare the interface implementation structures
|
||||
*/
|
||||
extern const IDirect3D9Vtbl Direct3D9_Vtbl;
|
||||
extern const IDirect3D9ExVtbl Direct3D9_Vtbl;
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3D implementation structure
|
||||
@@ -147,12 +147,14 @@ extern const IDirect3D9Vtbl Direct3D9_Vtbl;
|
||||
typedef struct IDirect3D9Impl
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IDirect3D9Vtbl *lpVtbl;
|
||||
const IDirect3D9ExVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
|
||||
/* The WineD3D device */
|
||||
IWineD3D *WineD3D;
|
||||
|
||||
/* Created via Direct3DCreate9Ex? Can QI extended interfaces */
|
||||
BOOL extended;
|
||||
} IDirect3D9Impl;
|
||||
|
||||
void filter_caps(D3DCAPS9* pCaps);
|
||||
@@ -164,7 +166,7 @@ void filter_caps(D3DCAPS9* pCaps);
|
||||
/*****************************************************************************
|
||||
* Predeclare the interface implementation structures
|
||||
*/
|
||||
extern const IDirect3DDevice9Vtbl Direct3DDevice9_Vtbl;
|
||||
extern const IDirect3DDevice9ExVtbl Direct3DDevice9_Vtbl;
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3DDevice9 implementation structure
|
||||
@@ -172,7 +174,7 @@ extern const IDirect3DDevice9Vtbl Direct3DDevice9_Vtbl;
|
||||
typedef struct IDirect3DDevice9Impl
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IDirect3DDevice9Vtbl *lpVtbl;
|
||||
const IDirect3DDevice9ExVtbl *lpVtbl;
|
||||
LONG ref;
|
||||
|
||||
/* IDirect3DDevice9 fields */
|
||||
@@ -184,48 +186,49 @@ typedef struct IDirect3DDevice9Impl
|
||||
IDirect3DVertexDeclaration9 **convertedDecls;
|
||||
unsigned int numConvertedDecls, declArraySize;
|
||||
|
||||
BOOL notreset;
|
||||
} IDirect3DDevice9Impl;
|
||||
|
||||
|
||||
/* IDirect3DDevice9: */
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9 iface, IDirect3D9** ppD3D9);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain);
|
||||
extern UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9 iface);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9 iface, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface, UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9 iface, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9 iface);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9 iface, IDirect3DStateBlock9** ppSB);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9 iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9 iface, IDirect3DVertexDeclaration9* pDecl);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9 iface, IDirect3DVertexDeclaration9** ppDecl);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9 iface, DWORD FVF);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9 iface, DWORD* pFVF);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9 iface, CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9 iface, IDirect3DVertexShader9* pShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9 iface, IDirect3DVertexShader9** ppShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9 iface, UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* OffsetInBytes, UINT* pStride);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9 iface, CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9 iface, IDirect3DPixelShader9* pShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9 iface, IDirect3DPixelShader9** ppShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetDirect3D(LPDIRECT3DDEVICE9EX iface, IDirect3D9** ppD3D9);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9EX iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain);
|
||||
extern UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateCubeTexture(LPDIRECT3DDEVICE9EX iface, UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9EX iface, UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9EX iface, UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9EX iface, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9EX iface);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9EX iface, IDirect3DStateBlock9** ppSB);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9EX iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9* pDecl);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9** ppDecl);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWORD FVF);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9EX iface, DWORD* pFVF);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9* pShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9** ppShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetStreamSource(LPDIRECT3DDEVICE9EX iface, UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* OffsetInBytes, UINT* pStride);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9* pShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9** ppShader);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, float* pConstantData, UINT Vector4fCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, int* pConstantData, UINT Vector4iCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT StartRegister, BOOL* pConstantData, UINT BoolCount);
|
||||
extern HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9EX iface, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery);
|
||||
|
||||
|
||||
/* ---------------- */
|
||||
@@ -268,7 +271,7 @@ typedef struct IDirect3DSwapChain9Impl
|
||||
IWineD3DSwapChain *wineD3DSwapChain;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
|
||||
/* Flags an implicit swap chain */
|
||||
BOOL isImplicit;
|
||||
@@ -316,7 +319,7 @@ typedef struct IDirect3DSurface9Impl
|
||||
IWineD3DSurface *wineD3DSurface;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
|
||||
/* The surface container */
|
||||
IUnknown *container;
|
||||
@@ -345,7 +348,7 @@ typedef struct IDirect3DVertexBuffer9Impl
|
||||
IWineD3DVertexBuffer *wineD3DVertexBuffer;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DVertexBuffer9Impl;
|
||||
|
||||
/* --------------------- */
|
||||
@@ -365,7 +368,7 @@ typedef struct IDirect3DIndexBuffer9Impl
|
||||
IWineD3DIndexBuffer *wineD3DIndexBuffer;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DIndexBuffer9Impl;
|
||||
|
||||
/* --------------------- */
|
||||
@@ -405,7 +408,7 @@ typedef struct IDirect3DCubeTexture9Impl
|
||||
IWineD3DCubeTexture *wineD3DCubeTexture;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DCubeTexture9Impl;
|
||||
|
||||
|
||||
@@ -426,7 +429,7 @@ typedef struct IDirect3DTexture9Impl
|
||||
IWineD3DTexture *wineD3DTexture;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DTexture9Impl;
|
||||
|
||||
/* ----------------------- */
|
||||
@@ -446,7 +449,7 @@ typedef struct IDirect3DVolumeTexture9Impl
|
||||
IWineD3DVolumeTexture *wineD3DVolumeTexture;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DVolumeTexture9Impl;
|
||||
|
||||
/* ----------------------- */
|
||||
@@ -465,7 +468,7 @@ typedef struct IDirect3DStateBlock9Impl {
|
||||
IWineD3DStateBlock *wineD3DStateBlock;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DStateBlock9Impl;
|
||||
|
||||
|
||||
@@ -482,14 +485,14 @@ typedef struct IDirect3DVertexDeclaration9Impl {
|
||||
LONG ref;
|
||||
|
||||
D3DVERTEXELEMENT9 *elements;
|
||||
size_t element_count;
|
||||
UINT element_count;
|
||||
|
||||
/* IDirect3DVertexDeclaration9 fields */
|
||||
IWineD3DVertexDeclaration *wineD3DVertexDeclaration;
|
||||
DWORD convFVF;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DVertexDeclaration9Impl;
|
||||
|
||||
void IDirect3DVertexDeclaration9Impl_Destroy(LPDIRECT3DVERTEXDECLARATION9 iface);
|
||||
@@ -510,7 +513,7 @@ typedef struct IDirect3DVertexShader9Impl {
|
||||
IWineD3DVertexShader *wineD3DVertexShader;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DVertexShader9Impl;
|
||||
|
||||
/* --------------------- */
|
||||
@@ -529,7 +532,7 @@ typedef struct IDirect3DPixelShader9Impl {
|
||||
IWineD3DPixelShader *wineD3DPixelShader;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DPixelShader9Impl;
|
||||
|
||||
/* --------------- */
|
||||
@@ -548,7 +551,7 @@ typedef struct IDirect3DQuery9Impl {
|
||||
IWineD3DQuery *wineD3DQuery;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9 parentDevice;
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DQuery9Impl;
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,7 +25,7 @@
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d9);
|
||||
|
||||
/* IDirect3D9 IUnknown parts follow: */
|
||||
static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID riid, LPVOID* ppobj)
|
||||
static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9EX iface, REFIID riid, LPVOID* ppobj)
|
||||
{
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
|
||||
@@ -33,7 +33,19 @@ static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID ri
|
||||
|| IsEqualGUID(riid, &IID_IDirect3D9)) {
|
||||
IUnknown_AddRef(iface);
|
||||
*ppobj = This;
|
||||
TRACE("Returning IDirect3D9 interface at %p\n", *ppobj);
|
||||
return S_OK;
|
||||
} else if(IsEqualGUID(riid, &IID_IDirect3D9Ex)) {
|
||||
if(This->extended) {
|
||||
*ppobj = (IDirect3D9Ex *) This;
|
||||
TRACE("Returning IDirect3D9Ex interface at %p\n", *ppobj);
|
||||
IDirect3D9Ex_AddRef((IDirect3D9Ex *)*ppobj);
|
||||
} else {
|
||||
WARN("Application asks for IDirect3D9Ex, but this instance wasn't created with Direct3DCreate9Ex\n");
|
||||
WARN("Returning E_NOINTERFACE\n");
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
}
|
||||
|
||||
WARN("(%p)->(%s,%p),not found\n", This, debugstr_guid(riid), ppobj);
|
||||
@@ -41,7 +53,7 @@ static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID ri
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9 iface) {
|
||||
static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9EX iface) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
ULONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
@@ -50,7 +62,7 @@ static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9 iface) {
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9 iface) {
|
||||
static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9EX iface) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
ULONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
@@ -67,7 +79,7 @@ static ULONG WINAPI IDirect3D9Impl_Release(LPDIRECT3D9 iface) {
|
||||
}
|
||||
|
||||
/* IDirect3D9 Interface follow: */
|
||||
static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9 iface, void* pInitializeFunction) {
|
||||
static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9EX iface, void* pInitializeFunction) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p)->(%p)\n", This, pInitializeFunction);
|
||||
@@ -78,7 +90,7 @@ static HRESULT WINAPI IDirect3D9Impl_RegisterSoftwareDevice(LPDIRECT3D9 iface,
|
||||
return hr;
|
||||
}
|
||||
|
||||
static UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9 iface) {
|
||||
static UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9EX iface) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("%p\n", This);
|
||||
@@ -89,7 +101,7 @@ static UINT WINAPI IDirect3D9Impl_GetAdapterCount(LPDIRECT3D9 iface) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9 iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) {
|
||||
static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9EX iface, UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
WINED3DADAPTER_IDENTIFIER adapter_id;
|
||||
HRESULT hr;
|
||||
@@ -114,7 +126,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetAdapterIdentifier(LPDIRECT3D9 iface, UIN
|
||||
return hr;
|
||||
}
|
||||
|
||||
static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format) {
|
||||
static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9EX iface, UINT Adapter, D3DFORMAT Format) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p)->(%d, %d\n", This, Adapter, Format);
|
||||
@@ -130,7 +142,7 @@ static UINT WINAPI IDirect3D9Impl_GetAdapterModeCount(LPDIRECT3D9 iface, UINT Ad
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9 iface, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) {
|
||||
static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9EX iface, UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p)->(%d, %d, %d, %p)\n", This, Adapter, Format, Mode, pMode);
|
||||
@@ -145,12 +157,12 @@ static HRESULT WINAPI IDirect3D9Impl_EnumAdapterModes(LPDIRECT3D9 iface, UINT Ad
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9 iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
|
||||
static HRESULT WINAPI IDirect3D9Impl_GetAdapterDisplayMode(LPDIRECT3D9EX iface, UINT Adapter, D3DDISPLAYMODE* pMode) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
return IWineD3D_GetAdapterDisplayMode(This->WineD3D, Adapter, (WINED3DDISPLAYMODE *) pMode);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9 iface,
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9EX iface,
|
||||
UINT Adapter, D3DDEVTYPE CheckType, D3DFORMAT DisplayFormat,
|
||||
D3DFORMAT BackBufferFormat, BOOL Windowed) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
@@ -165,7 +177,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceType(LPDIRECT3D9 iface,
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9 iface,
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9EX iface,
|
||||
UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
|
||||
DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
@@ -174,12 +186,12 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormat(LPDIRECT3D9 iface,
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hr = IWineD3D_CheckDeviceFormat(This->WineD3D, Adapter, DeviceType, AdapterFormat,
|
||||
Usage, RType, CheckFormat);
|
||||
Usage, RType, CheckFormat, SURFACE_OPENGL);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9 iface,
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9EX iface,
|
||||
UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat,
|
||||
BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
@@ -193,7 +205,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDeviceMultiSampleType(LPDIRECT3D9 ifac
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9 iface,
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9EX iface,
|
||||
UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat,
|
||||
D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
@@ -207,7 +219,7 @@ static HRESULT WINAPI IDirect3D9Impl_CheckDepthStencilMatch(LPDIRECT3D9 iface,
|
||||
return hr;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) {
|
||||
static HRESULT WINAPI IDirect3D9Impl_CheckDeviceFormatConversion(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("%p\n", This);
|
||||
@@ -276,7 +288,7 @@ void filter_caps(D3DCAPS9* pCaps)
|
||||
D3DPTEXTURECAPS_CUBEMAP_POW2 | D3DPTEXTURECAPS_VOLUMEMAP_POW2| D3DPTEXTURECAPS_NOPROJECTEDBUMPENV;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) {
|
||||
static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
HRESULT hrc = D3D_OK;
|
||||
WINED3DCAPS *pWineCaps;
|
||||
@@ -291,10 +303,10 @@ static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapt
|
||||
return D3DERR_INVALIDCALL; /*well this is what MSDN says to return*/
|
||||
}
|
||||
memset(pCaps, 0, sizeof(*pCaps));
|
||||
D3D9CAPSTOWINECAPS(pCaps, pWineCaps)
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hrc = IWineD3D_GetDeviceCaps(This->WineD3D, Adapter, DeviceType, pWineCaps);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
WINECAPSTOD3D9CAPS(pCaps, pWineCaps)
|
||||
HeapFree(GetProcessHeap(), 0, pWineCaps);
|
||||
|
||||
/* Some functionality is implemented in d3d9.dll, not wined3d.dll. Add the needed caps */
|
||||
@@ -306,7 +318,7 @@ static HRESULT WINAPI IDirect3D9Impl_GetDeviceCaps(LPDIRECT3D9 iface, UINT Adapt
|
||||
return hrc;
|
||||
}
|
||||
|
||||
static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT Adapter) {
|
||||
static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9EX iface, UINT Adapter) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
HMONITOR ret;
|
||||
TRACE("%p\n", This);
|
||||
@@ -447,7 +459,7 @@ ULONG WINAPI D3D9CB_DestroyDepthStencilSurface(IWineD3DSurface *pSurface) {
|
||||
return IDirect3DSurface9_Release((IDirect3DSurface9*) surfaceParent);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9EX iface, UINT Adapter, D3DDEVTYPE DeviceType,
|
||||
HWND hFocusWindow, DWORD BehaviourFlags,
|
||||
D3DPRESENT_PARAMETERS* pPresentationParameters,
|
||||
IDirect3DDevice9** ppReturnedDeviceInterface) {
|
||||
@@ -540,9 +552,39 @@ static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapte
|
||||
return hr;
|
||||
}
|
||||
|
||||
static UINT WINAPI IDirect3D9ExImpl_GetAdapterModeCountEx(IDirect3D9Ex *iface, UINT Adapter, CONST D3DDISPLAYMODEFILTER *pFilter) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
FIXME("(%p)->(%d, %p): Stub!\n", This, Adapter, pFilter);
|
||||
return D3DERR_DRIVERINTERNALERROR;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9ExImpl_EnumAdapterModesEx(IDirect3D9Ex *iface, UINT Adapter, CONST D3DDISPLAYMODEFILTER *pFilter, UINT Mode, D3DDISPLAYMODEEX* pMode) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
FIXME("(%p)->(%d, %p, %p): Stub!\n", This, Adapter, pFilter, pMode);
|
||||
return D3DERR_DRIVERINTERNALERROR;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterDisplayModeEx(IDirect3D9Ex *iface, UINT Adapter, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
FIXME("(%p)->(%d, %p, %p): Stub!\n", This, Adapter, pMode, pRotation);
|
||||
return D3DERR_DRIVERINTERNALERROR;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9ExImpl_CreateDeviceEx(IDirect3D9Ex *iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode, struct IDirect3DDevice9Ex **ppReturnedDeviceInterface) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
FIXME("(%p)->(%d, %d, %p, 0x%08x, %p, %p, %p): Stub!\n", This, Adapter, DeviceType, hFocusWindow, BehaviorFlags, pPresentationParameters, pFullscreenDisplayMode, ppReturnedDeviceInterface);
|
||||
*ppReturnedDeviceInterface = NULL;
|
||||
return D3DERR_DRIVERINTERNALERROR;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IDirect3D9ExImpl_GetAdapterLUID(IDirect3D9Ex *iface, UINT Adapter, LUID *pLUID) {
|
||||
IDirect3D9Impl *This = (IDirect3D9Impl *)iface;
|
||||
FIXME("(%p)->(%d, %p)\n", This, Adapter, pLUID);
|
||||
return D3DERR_DRIVERINTERNALERROR;
|
||||
}
|
||||
|
||||
|
||||
const IDirect3D9Vtbl Direct3D9_Vtbl =
|
||||
const IDirect3D9ExVtbl Direct3D9_Vtbl =
|
||||
{
|
||||
/* IUnknown */
|
||||
IDirect3D9Impl_QueryInterface,
|
||||
@@ -562,5 +604,12 @@ const IDirect3D9Vtbl Direct3D9_Vtbl =
|
||||
IDirect3D9Impl_CheckDeviceFormatConversion,
|
||||
IDirect3D9Impl_GetDeviceCaps,
|
||||
IDirect3D9Impl_GetAdapterMonitor,
|
||||
IDirect3D9Impl_CreateDevice
|
||||
IDirect3D9Impl_CreateDevice,
|
||||
/* IDirect3D9Ex */
|
||||
IDirect3D9ExImpl_GetAdapterModeCountEx,
|
||||
IDirect3D9ExImpl_EnumAdapterModesEx,
|
||||
IDirect3D9ExImpl_GetAdapterDisplayModeEx,
|
||||
IDirect3D9ExImpl_CreateDeviceEx,
|
||||
IDirect3D9ExImpl_GetAdapterLUID
|
||||
|
||||
};
|
||||
|
||||
@@ -211,7 +211,7 @@ static const IDirect3DIndexBuffer9Vtbl Direct3DIndexBuffer9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DIndexBuffer9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9 iface,
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateIndexBuffer(LPDIRECT3DDEVICE9EX iface,
|
||||
UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) {
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ static const IDirect3DPixelShader9Vtbl Direct3DPixelShader9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DPixelShader9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9 iface, CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IDirect3DPixelShader9Impl *object;
|
||||
HRESULT hrc = D3D_OK;
|
||||
@@ -146,7 +146,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreatePixelShader(LPDIRECT3DDEVICE9 iface, C
|
||||
return hrc;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9 iface, IDirect3DPixelShader9* pShader) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9* pShader) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IDirect3DPixelShader9Impl *shader = (IDirect3DPixelShader9Impl *)pShader;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
@@ -157,7 +157,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShader(LPDIRECT3DDEVICE9 iface, IDir
|
||||
return D3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9 iface, IDirect3DPixelShader9** ppShader) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9EX iface, IDirect3DPixelShader9** ppShader) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IWineD3DPixelShader *object;
|
||||
|
||||
@@ -182,7 +182,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShader(LPDIRECT3DDEVICE9 iface, IDir
|
||||
return hrc;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
@@ -193,13 +193,13 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantF(LPDIRECT3DDEVICE9 if
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, float* pConstantData, UINT Vector4fCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, float* pConstantData, UINT Vector4fCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
return IWineD3DDevice_GetPixelShaderConstantF(This->WineD3DDevice, Register, pConstantData, Vector4fCount);
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
@@ -210,7 +210,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantI(LPDIRECT3DDEVICE9 if
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, int* pConstantData, UINT Vector4iCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT Register, int* pConstantData, UINT Vector4iCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
@@ -221,7 +221,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantI(LPDIRECT3DDEVICE9 if
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
@@ -232,7 +232,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetPixelShaderConstantB(LPDIRECT3DDEVICE9 if
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, BOOL* pConstantData, UINT BoolCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetPixelShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT Register, BOOL* pConstantData, UINT BoolCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
@@ -145,7 +145,7 @@ static const IDirect3DQuery9Vtbl Direct3DQuery9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DQuery9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9 iface, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateQuery(LPDIRECT3DDEVICE9EX iface, D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IDirect3DQuery9Impl *object = NULL;
|
||||
HRESULT hr = D3D_OK;
|
||||
|
||||
@@ -115,7 +115,7 @@ static const IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DStateBlock9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9 iface, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppStateBlock) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9EX iface, D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppStateBlock) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IDirect3DStateBlock9Impl* object;
|
||||
HRESULT hrc = D3D_OK;
|
||||
@@ -149,7 +149,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateStateBlock(LPDIRECT3DDEVICE9 iface, D3
|
||||
return hrc;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9 iface) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9EX iface) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
@@ -160,7 +160,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(LPDIRECT3DDEVICE9 iface) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9 iface, IDirect3DStateBlock9** ppSB) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9EX iface, IDirect3DStateBlock9** ppSB) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
IWineD3DStateBlock* wineD3DStateBlock;
|
||||
@@ -168,7 +168,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9 iface, IDi
|
||||
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
/* Tell wineD3D to endstatablock before anything else (in case we run out
|
||||
/* Tell wineD3D to endstateblock before anything else (in case we run out
|
||||
* of memory later and cause locking problems)
|
||||
*/
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
|
||||
@@ -191,7 +191,7 @@ static const IDirect3DSwapChain9Vtbl Direct3DSwapChain9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DSwapChain9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9 iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE9EX iface, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IDirect3DSwapChain9Impl* object;
|
||||
HRESULT hrc = D3D_OK;
|
||||
@@ -229,7 +229,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
|
||||
localParameters.PresentationInterval = pPresentationParameters->PresentationInterval;
|
||||
|
||||
EnterCriticalSection(&d3d9_cs);
|
||||
hrc = IWineD3DDevice_CreateAdditionalSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D9CB_CreateRenderTarget, D3D9CB_CreateDepthStencilSurface);
|
||||
hrc = IWineD3DDevice_CreateAdditionalSwapChain(This->WineD3DDevice, &localParameters, &object->wineD3DSwapChain, (IUnknown*)object, D3D9CB_CreateRenderTarget, D3D9CB_CreateDepthStencilSurface, SURFACE_OPENGL);
|
||||
LeaveCriticalSection(&d3d9_cs);
|
||||
|
||||
pPresentationParameters->BackBufferWidth = localParameters.BackBufferWidth;
|
||||
@@ -260,7 +260,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateAdditionalSwapChain(LPDIRECT3DDEVICE
|
||||
return hrc;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9EX iface, UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hrc = D3D_OK;
|
||||
IWineD3DSwapChain *swapchain = NULL;
|
||||
@@ -279,7 +279,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetSwapChain(LPDIRECT3DDEVICE9 iface, UINT
|
||||
return hrc;
|
||||
}
|
||||
|
||||
UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9 iface) {
|
||||
UINT WINAPI IDirect3DDevice9Impl_GetNumberOfSwapChains(LPDIRECT3DDEVICE9EX iface) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
UINT ret;
|
||||
TRACE("(%p) Relay\n", This);
|
||||
|
||||
@@ -327,7 +327,7 @@ static const IDirect3DTexture9Vtbl Direct3DTexture9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DTexture9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, UINT Levels, DWORD Usage,
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateTexture(LPDIRECT3DDEVICE9EX iface, UINT Width, UINT Height, UINT Levels, DWORD Usage,
|
||||
D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) {
|
||||
IDirect3DTexture9Impl *object;
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
|
||||
@@ -207,7 +207,7 @@ static const IDirect3DVertexBuffer9Vtbl Direct3DVertexBuffer9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DVertexBuffer9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9 iface,
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexBuffer(LPDIRECT3DDEVICE9EX iface,
|
||||
UINT Size, DWORD Usage, DWORD FVF, D3DPOOL Pool,
|
||||
IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) {
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ HRESULT vdecl_convert_fvf(
|
||||
BOOL has_specular = (fvf & D3DFVF_SPECULAR) !=0;
|
||||
|
||||
DWORD num_textures = (fvf & D3DFVF_TEXCOUNT_MASK) >> D3DFVF_TEXCOUNT_SHIFT;
|
||||
DWORD texcoords = (fvf & 0x00FF0000) >> 16;
|
||||
DWORD texcoords = (fvf & 0xFFFF0000) >> 16;
|
||||
|
||||
D3DVERTEXELEMENT9 end_element = D3DDECL_END();
|
||||
D3DVERTEXELEMENT9 *elements = NULL;
|
||||
@@ -89,7 +89,7 @@ HRESULT vdecl_convert_fvf(
|
||||
if (!elements)
|
||||
return D3DERR_OUTOFVIDEOMEMORY;
|
||||
|
||||
memcpy(&elements[size-1], &end_element, sizeof(D3DVERTEXELEMENT9));
|
||||
elements[size-1] = end_element;
|
||||
idx = 0;
|
||||
if (has_pos) {
|
||||
if (!has_blend && (fvf & D3DFVF_XYZRHW)) {
|
||||
@@ -231,7 +231,7 @@ static ULONG WINAPI IDirect3DVertexDeclaration9Impl_Release(LPDIRECT3DVERTEXDECL
|
||||
TRACE("(%p) : ReleaseRef to %d\n", This, ref);
|
||||
|
||||
if (ref == 0) {
|
||||
IDirect3DDevice9 *parentDevice = This->parentDevice;
|
||||
IDirect3DDevice9Ex *parentDevice = This->parentDevice;
|
||||
|
||||
if(!This->convFVF) {
|
||||
IDirect3DVertexDeclaration9Impl_Release(iface);
|
||||
@@ -289,10 +289,10 @@ static const IDirect3DVertexDeclaration9Vtbl Direct3DVertexDeclaration9_Vtbl =
|
||||
IDirect3DVertexDeclaration9Impl_GetDeclaration
|
||||
};
|
||||
|
||||
static size_t convert_to_wined3d_declaration(const D3DVERTEXELEMENT9* d3d9_elements, WINED3DVERTEXELEMENT **wined3d_elements) {
|
||||
static UINT convert_to_wined3d_declaration(const D3DVERTEXELEMENT9* d3d9_elements, WINED3DVERTEXELEMENT **wined3d_elements) {
|
||||
const D3DVERTEXELEMENT9* element;
|
||||
size_t element_count = 1;
|
||||
size_t i;
|
||||
UINT element_count = 1;
|
||||
UINT i;
|
||||
|
||||
TRACE("d3d9_elements %p, wined3d_elements %p\n", d3d9_elements, wined3d_elements);
|
||||
|
||||
@@ -318,12 +318,12 @@ static size_t convert_to_wined3d_declaration(const D3DVERTEXELEMENT9* d3d9_eleme
|
||||
}
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DVertexDeclaration9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9 iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9EX iface, CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) {
|
||||
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IDirect3DVertexDeclaration9Impl *object = NULL;
|
||||
WINED3DVERTEXELEMENT* wined3d_elements;
|
||||
size_t element_count;
|
||||
UINT element_count;
|
||||
HRESULT hr = D3D_OK;
|
||||
|
||||
TRACE("(%p) : Relay\n", iface);
|
||||
@@ -368,7 +368,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9
|
||||
if (FAILED(hr)) {
|
||||
|
||||
/* free up object */
|
||||
FIXME("(%p) call to IWineD3DDevice_CreateVertexDeclaration failed\n", This);
|
||||
WARN("(%p) call to IWineD3DDevice_CreateVertexDeclaration failed\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, object->elements);
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
} else {
|
||||
@@ -380,7 +380,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexDeclaration(LPDIRECT3DDEVICE9
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9 iface, IDirect3DVertexDeclaration9* pDecl) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9* pDecl) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IDirect3DVertexDeclaration9Impl *pDeclImpl = (IDirect3DVertexDeclaration9Impl *)pDecl;
|
||||
HRESULT hr = D3D_OK;
|
||||
@@ -393,7 +393,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexDeclaration(LPDIRECT3DDEVICE9 ifa
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9 iface, IDirect3DVertexDeclaration9** ppDecl) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexDeclaration(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexDeclaration9** ppDecl) {
|
||||
IDirect3DDevice9Impl* This = (IDirect3DDevice9Impl*) iface;
|
||||
IWineD3DVertexDeclaration* pTest = NULL;
|
||||
HRESULT hr = D3D_OK;
|
||||
|
||||
@@ -109,7 +109,7 @@ static const IDirect3DVertexShader9Vtbl Direct3DVertexShader9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DVertexShader9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9 iface, CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9EX iface, CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hrc = D3D_OK;
|
||||
IDirect3DVertexShader9Impl *object;
|
||||
@@ -144,7 +144,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_CreateVertexShader(LPDIRECT3DDEVICE9 iface,
|
||||
return hrc;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9 iface, IDirect3DVertexShader9* pShader) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9* pShader) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hrc = D3D_OK;
|
||||
|
||||
@@ -157,7 +157,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShader(LPDIRECT3DDEVICE9 iface, IDi
|
||||
return hrc;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9 iface, IDirect3DVertexShader9** ppShader) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9EX iface, IDirect3DVertexShader9** ppShader) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IWineD3DVertexShader *pShader;
|
||||
HRESULT hrc = D3D_OK;
|
||||
@@ -176,7 +176,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShader(LPDIRECT3DDEVICE9 iface, IDi
|
||||
return hrc;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST float* pConstantData, UINT Vector4fCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) : Relay\n", This);
|
||||
@@ -187,7 +187,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantF(LPDIRECT3DDEVICE9 i
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9 iface, UINT Register, float* pConstantData, UINT Vector4fCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9EX iface, UINT Register, float* pConstantData, UINT Vector4fCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
|
||||
@@ -198,7 +198,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantF(LPDIRECT3DDEVICE9 i
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST int* pConstantData, UINT Vector4iCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) : Relay\n", This);
|
||||
@@ -209,7 +209,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantI(LPDIRECT3DDEVICE9 i
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9 iface, UINT Register, int* pConstantData, UINT Vector4iCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9EX iface, UINT Register, int* pConstantData, UINT Vector4iCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) : Relay\n", This);
|
||||
@@ -220,7 +220,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantI(LPDIRECT3DDEVICE9 i
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT Register, CONST BOOL* pConstantData, UINT BoolCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) : Relay\n", This);
|
||||
@@ -231,7 +231,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetVertexShaderConstantB(LPDIRECT3DDEVICE9 i
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(LPDIRECT3DDEVICE9 iface, UINT Register, BOOL* pConstantData, UINT BoolCount) {
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_GetVertexShaderConstantB(LPDIRECT3DDEVICE9EX iface, UINT Register, BOOL* pConstantData, UINT BoolCount) {
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
HRESULT hr;
|
||||
TRACE("(%p) : Relay\n", This);
|
||||
|
||||
@@ -205,7 +205,7 @@ HRESULT WINAPI D3D9CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
*ppVolume = NULL;
|
||||
} else {
|
||||
*ppVolume = (IWineD3DVolume *)object->wineD3DVolume;
|
||||
*ppVolume = object->wineD3DVolume;
|
||||
object->container = pSuperior;
|
||||
object->forwardReference = pSuperior;
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ static const IDirect3DVolumeTexture9Vtbl Direct3DVolumeTexture9_Vtbl =
|
||||
|
||||
|
||||
/* IDirect3DDevice9 IDirect3DVolumeTexture9 Methods follow: */
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9 iface,
|
||||
HRESULT WINAPI IDirect3DDevice9Impl_CreateVolumeTexture(LPDIRECT3DDEVICE9EX iface,
|
||||
UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage,
|
||||
D3DFORMAT Format, D3DPOOL Pool,
|
||||
IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -6,6 +6,7 @@
|
||||
* Copyright 2004 Christian Costa
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2006 Ivan Gyurdiev
|
||||
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -125,7 +126,7 @@ static inline int shader_skip_opcode(
|
||||
DWORD opcode_token) {
|
||||
|
||||
/* Shaders >= 2.0 may contain address tokens, but fortunately they
|
||||
* have a useful legnth mask - use it here. Shaders 1.0 contain no such tokens */
|
||||
* have a useful length mask - use it here. Shaders 1.0 contain no such tokens */
|
||||
|
||||
return (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2)?
|
||||
((opcode_token & WINED3DSI_INSTLENGTH_MASK) >> WINED3DSI_INSTLENGTH_SHIFT):
|
||||
@@ -153,8 +154,8 @@ int shader_skip_unrecognized(
|
||||
tokens_read += shader_get_param(iface, pToken, ¶m, &addr_token);
|
||||
pToken += tokens_read;
|
||||
|
||||
FIXME("Unrecognized opcode param: token=%08x "
|
||||
"addr_token=%08x name=", param, addr_token);
|
||||
FIXME("Unrecognized opcode param: token=0x%08x "
|
||||
"addr_token=0x%08x name=", param, addr_token);
|
||||
shader_dump_param(iface, param, addr_token, i);
|
||||
FIXME("\n");
|
||||
++i;
|
||||
@@ -181,6 +182,20 @@ unsigned int shader_get_float_offset(const DWORD reg) {
|
||||
}
|
||||
}
|
||||
|
||||
static void shader_delete_constant_list(struct list* clist) {
|
||||
|
||||
struct list *ptr;
|
||||
struct local_constant* constant;
|
||||
|
||||
ptr = list_head(clist);
|
||||
while (ptr) {
|
||||
constant = LIST_ENTRY(ptr, struct local_constant, entry);
|
||||
ptr = list_next(clist, ptr);
|
||||
HeapFree(GetProcessHeap(), 0, constant);
|
||||
}
|
||||
list_init(clist);
|
||||
}
|
||||
|
||||
/* Note that this does not count the loop register
|
||||
* as an address register. */
|
||||
|
||||
@@ -198,12 +213,19 @@ HRESULT shader_get_registers_used(
|
||||
/* There are some minor differences between pixel and vertex shaders */
|
||||
char pshader = shader_is_pshader_version(This->baseShader.hex_version);
|
||||
|
||||
reg_maps->bumpmat = -1;
|
||||
reg_maps->luminanceparams = -1;
|
||||
memset(reg_maps->bumpmat, 0, sizeof(reg_maps->bumpmat));
|
||||
memset(reg_maps->luminanceparams, 0, sizeof(reg_maps->luminanceparams));
|
||||
|
||||
if (pToken == NULL)
|
||||
return WINED3D_OK;
|
||||
|
||||
/* get_registers_used is called on every compile on some 1.x shaders, which can result
|
||||
* in stacking up a collection of local constants. Delete the old constants if existing
|
||||
*/
|
||||
shader_delete_constant_list(&This->baseShader.constantsF);
|
||||
shader_delete_constant_list(&This->baseShader.constantsB);
|
||||
shader_delete_constant_list(&This->baseShader.constantsI);
|
||||
|
||||
while (WINED3DVS_END() != *pToken) {
|
||||
CONST SHADER_OPCODE* curOpcode;
|
||||
DWORD opcode_token;
|
||||
@@ -267,7 +289,7 @@ HRESULT shader_get_registers_used(
|
||||
local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
||||
if (!lconst) return E_OUTOFMEMORY;
|
||||
lconst->idx = *pToken & WINED3DSP_REGNUM_MASK;
|
||||
memcpy(&lconst->value, pToken + 1, 4 * sizeof(DWORD));
|
||||
memcpy(lconst->value, pToken + 1, 4 * sizeof(DWORD));
|
||||
|
||||
/* In pixel shader 1.X shaders, the constants are clamped between [-1;1] */
|
||||
if(WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 && pshader) {
|
||||
@@ -290,7 +312,7 @@ HRESULT shader_get_registers_used(
|
||||
local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
||||
if (!lconst) return E_OUTOFMEMORY;
|
||||
lconst->idx = *pToken & WINED3DSP_REGNUM_MASK;
|
||||
memcpy(&lconst->value, pToken + 1, 4 * sizeof(DWORD));
|
||||
memcpy(lconst->value, pToken + 1, 4 * sizeof(DWORD));
|
||||
list_add_head(&This->baseShader.constantsI, &lconst->entry);
|
||||
pToken += curOpcode->num_params;
|
||||
|
||||
@@ -299,7 +321,7 @@ HRESULT shader_get_registers_used(
|
||||
local_constant* lconst = HeapAlloc(GetProcessHeap(), 0, sizeof(local_constant));
|
||||
if (!lconst) return E_OUTOFMEMORY;
|
||||
lconst->idx = *pToken & WINED3DSP_REGNUM_MASK;
|
||||
memcpy(&lconst->value, pToken + 1, 1 * sizeof(DWORD));
|
||||
memcpy(lconst->value, pToken + 1, 1 * sizeof(DWORD));
|
||||
list_add_head(&This->baseShader.constantsB, &lconst->entry);
|
||||
pToken += curOpcode->num_params;
|
||||
|
||||
@@ -327,7 +349,8 @@ HRESULT shader_get_registers_used(
|
||||
int i, limit;
|
||||
|
||||
/* Declare 1.X samplers implicitly, based on the destination reg. number */
|
||||
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
|
||||
if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 &&
|
||||
pshader /* Filter different instructions with the same enum values in VS */ &&
|
||||
(WINED3DSIO_TEX == curOpcode->opcode ||
|
||||
WINED3DSIO_TEXBEM == curOpcode->opcode ||
|
||||
WINED3DSIO_TEXBEML == curOpcode->opcode ||
|
||||
@@ -349,6 +372,10 @@ HRESULT shader_get_registers_used(
|
||||
} else {
|
||||
int texType = IWineD3DBaseTexture_GetTextureDimensions(stateBlock->textures[sampler_code]);
|
||||
switch(texType) {
|
||||
/* We have to select between texture rectangles and 2D textures later because 2.0 and
|
||||
* 3.0 shaders only have WINED3DSTT_2D as well
|
||||
*/
|
||||
case GL_TEXTURE_RECTANGLE_ARB:
|
||||
case GL_TEXTURE_2D:
|
||||
reg_maps->samplers[sampler_code] = (0x1 << 31) | WINED3DSTT_2D;
|
||||
break;
|
||||
@@ -370,25 +397,17 @@ HRESULT shader_get_registers_used(
|
||||
/* texbem is only valid with < 1.4 pixel shaders */
|
||||
if(WINED3DSIO_TEXBEM == curOpcode->opcode ||
|
||||
WINED3DSIO_TEXBEML == curOpcode->opcode) {
|
||||
if(reg_maps->bumpmat != -1 && reg_maps->bumpmat != sampler_code) {
|
||||
FIXME("Pixel shader uses texbem instruction on more than 1 sampler\n");
|
||||
} else {
|
||||
reg_maps->bumpmat = sampler_code;
|
||||
if(WINED3DSIO_TEXBEML == curOpcode->opcode) {
|
||||
reg_maps->luminanceparams = sampler_code;
|
||||
}
|
||||
reg_maps->bumpmat[sampler_code] = TRUE;
|
||||
if(WINED3DSIO_TEXBEML == curOpcode->opcode) {
|
||||
reg_maps->luminanceparams[sampler_code] = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(WINED3DSIO_NRM == curOpcode->opcode) {
|
||||
reg_maps->usesnrm = 1;
|
||||
} else if(WINED3DSIO_BEM == curOpcode->opcode) {
|
||||
} else if(WINED3DSIO_BEM == curOpcode->opcode && pshader) {
|
||||
DWORD regnum = *pToken & WINED3DSP_REGNUM_MASK;
|
||||
if(reg_maps->bumpmat != -1 && reg_maps->bumpmat != regnum) {
|
||||
FIXME("Pixel shader uses bem or texbem instruction on more than 1 sampler\n");
|
||||
} else {
|
||||
reg_maps->bumpmat = regnum;
|
||||
}
|
||||
reg_maps->bumpmat[regnum] = TRUE;
|
||||
} else if(WINED3DSIO_DSY == curOpcode->opcode) {
|
||||
reg_maps->usesdsy = 1;
|
||||
}
|
||||
@@ -459,6 +478,15 @@ HRESULT shader_get_registers_used(
|
||||
reg_maps->usesrelconstF = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* WINED3DSPR_TEXCRDOUT is the same as WINED3DSPR_OUTPUT. _OUTPUT can be > MAX_REG_TEXCRD and is used
|
||||
* in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel shaders because TECRDOUT
|
||||
* isn't used in them, but future register types might cause issues
|
||||
*/
|
||||
else if(WINED3DSPR_TEXCRDOUT == regtype && i == 0 /* Only look at writes */ &&
|
||||
!pshader && WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) < 3) {
|
||||
reg_maps->texcoord_mask[reg] |= shader_get_writemask(param);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -483,7 +511,7 @@ static void shader_dump_decl_usage(
|
||||
case WINED3DSTT_2D: TRACE("_2d"); break;
|
||||
case WINED3DSTT_CUBE: TRACE("_cube"); break;
|
||||
case WINED3DSTT_VOLUME: TRACE("_volume"); break;
|
||||
default: TRACE("_unknown_ttype(%08x)", ttype);
|
||||
default: TRACE("_unknown_ttype(0x%08x)", ttype);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -546,7 +574,7 @@ static void shader_dump_decl_usage(
|
||||
TRACE("sample");
|
||||
break;
|
||||
default:
|
||||
FIXME("unknown_semantics(%08x)", usage);
|
||||
FIXME("unknown_semantics(0x%08x)", usage);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -753,8 +781,7 @@ void shader_dump_param(
|
||||
/** Shared code in order to generate the bulk of the shader string.
|
||||
Use the shader_header_fct & shader_footer_fct to add strings
|
||||
that are specific to pixel or vertex functions
|
||||
NOTE: A description of how to parse tokens can be found at:
|
||||
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/graphics/hh/graphics/usermodedisplaydriver_shader_cc8e4e05-f5c3-4ec0-8853-8ce07c1551b2.xml.asp */
|
||||
NOTE: A description of how to parse tokens can be found on msdn */
|
||||
void shader_generate_main(
|
||||
IWineD3DBaseShader *iface,
|
||||
SHADER_BUFFER* buffer,
|
||||
@@ -808,7 +835,7 @@ void shader_generate_main(
|
||||
|
||||
/* Unknown opcode and its parameters */
|
||||
if (NULL == curOpcode) {
|
||||
FIXME("Unrecognized opcode: token=%08x\n", hw_arg.opcode_token);
|
||||
FIXME("Unrecognized opcode: token=0x%08x\n", hw_arg.opcode_token);
|
||||
pToken += shader_skip_unrecognized(iface, pToken);
|
||||
|
||||
/* Nothing to do */
|
||||
@@ -936,7 +963,7 @@ void shader_trace_init(
|
||||
|
||||
if (NULL == curOpcode) {
|
||||
int tokens_read;
|
||||
FIXME("Unrecognized opcode: token=%08x\n", opcode_token);
|
||||
FIXME("Unrecognized opcode: token=0x%08x\n", opcode_token);
|
||||
tokens_read = shader_skip_unrecognized(iface, pToken);
|
||||
pToken += tokens_read;
|
||||
len += tokens_read;
|
||||
@@ -1062,34 +1089,63 @@ void shader_trace_init(
|
||||
}
|
||||
}
|
||||
|
||||
static void shader_delete_constant_list(
|
||||
struct list* clist) {
|
||||
|
||||
struct list *ptr;
|
||||
struct local_constant* constant;
|
||||
|
||||
ptr = list_head(clist);
|
||||
while (ptr) {
|
||||
constant = LIST_ENTRY(ptr, struct local_constant, entry);
|
||||
ptr = list_next(clist, ptr);
|
||||
HeapFree(GetProcessHeap(), 0, constant);
|
||||
}
|
||||
}
|
||||
|
||||
static void shader_none_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {}
|
||||
static void shader_none_select_depth_blt(IWineD3DDevice *iface) {}
|
||||
static void shader_none_deselect_depth_blt(IWineD3DDevice *iface) {}
|
||||
static void shader_none_load_constants(IWineD3DDevice *iface, char usePS, char useVS) {}
|
||||
static void shader_none_cleanup(IWineD3DDevice *iface) {}
|
||||
static void shader_none_color_correction(SHADER_OPCODE_ARG* arg) {}
|
||||
static void shader_none_destroy(IWineD3DBaseShader *iface) {}
|
||||
static HRESULT shader_none_alloc(IWineD3DDevice *iface) {return WINED3D_OK;}
|
||||
static void shader_none_free(IWineD3DDevice *iface) {}
|
||||
static BOOL shader_none_dirty_const(IWineD3DDevice *iface) {return FALSE;}
|
||||
static void shader_none_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) {
|
||||
FIXME("NONE shader backend asked to generate a pixel shader\n");
|
||||
}
|
||||
static void shader_none_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer) {
|
||||
FIXME("NONE shader backend asked to generate a vertex shader\n");
|
||||
}
|
||||
|
||||
#define GLINFO_LOCATION (*gl_info)
|
||||
static void shader_none_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct shader_caps *pCaps) {
|
||||
/* Set the shader caps to 0 for the none shader backend */
|
||||
pCaps->VertexShaderVersion = 0;
|
||||
pCaps->PixelShaderVersion = 0;
|
||||
pCaps->PixelShader1xMaxValue = 0.0;
|
||||
}
|
||||
#undef GLINFO_LOCATION
|
||||
static BOOL shader_none_conv_supported(WINED3DFORMAT fmt) {
|
||||
TRACE("Checking shader format support for format %s", debug_d3dformat(fmt));
|
||||
switch(fmt) {
|
||||
/* Faked to make some apps happy. */
|
||||
case WINED3DFMT_V8U8:
|
||||
case WINED3DFMT_V16U16:
|
||||
case WINED3DFMT_L6V5U5:
|
||||
case WINED3DFMT_X8L8V8U8:
|
||||
case WINED3DFMT_Q8W8V8U8:
|
||||
TRACE("[OK]\n");
|
||||
return TRUE;
|
||||
default:
|
||||
TRACE("[FAILED]\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
const shader_backend_t none_shader_backend = {
|
||||
&shader_none_select,
|
||||
&shader_none_select_depth_blt,
|
||||
&shader_none_load_constants,
|
||||
&shader_none_cleanup,
|
||||
&shader_none_color_correction,
|
||||
&shader_none_destroy
|
||||
shader_none_select,
|
||||
shader_none_select_depth_blt,
|
||||
shader_none_deselect_depth_blt,
|
||||
shader_none_load_constants,
|
||||
shader_none_cleanup,
|
||||
shader_none_color_correction,
|
||||
shader_none_destroy,
|
||||
shader_none_alloc,
|
||||
shader_none_free,
|
||||
shader_none_dirty_const,
|
||||
shader_none_generate_pshader,
|
||||
shader_none_generate_vshader,
|
||||
shader_none_get_caps,
|
||||
shader_none_conv_supported
|
||||
};
|
||||
|
||||
/* *******************************************
|
||||
@@ -1129,6 +1185,7 @@ ULONG WINAPI IWineD3DBaseShaderImpl_Release(IWineD3DBaseShader *iface) {
|
||||
shader_delete_constant_list(&This->baseShader.constantsF);
|
||||
shader_delete_constant_list(&This->baseShader.constantsB);
|
||||
shader_delete_constant_list(&This->baseShader.constantsI);
|
||||
list_remove(&This->baseShader.shader_list_entry);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
return ref;
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright 2002-2004 Jason Edmeades
|
||||
* Copyright 2002-2004 Raphael Junqueira
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -111,6 +112,20 @@ void WINAPI IWineD3DBaseTextureImpl_PreLoad(IWineD3DBaseTexture *ifac
|
||||
IWineD3DResourceImpl_PreLoad((IWineD3DResource *)iface);
|
||||
}
|
||||
|
||||
void WINAPI IWineD3DBaseTextureImpl_UnLoad(IWineD3DBaseTexture *iface) {
|
||||
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
|
||||
if(This->baseTexture.textureName) {
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
ENTER_GL();
|
||||
glDeleteTextures(1, &This->baseTexture.textureName);
|
||||
This->baseTexture.textureName = 0;
|
||||
LEAVE_GL();
|
||||
}
|
||||
This->baseTexture.dirty = TRUE;
|
||||
}
|
||||
|
||||
WINED3DRESOURCETYPE WINAPI IWineD3DBaseTextureImpl_GetType(IWineD3DBaseTexture *iface) {
|
||||
return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
|
||||
}
|
||||
@@ -123,7 +138,7 @@ HRESULT WINAPI IWineD3DBaseTextureImpl_GetParent(IWineD3DBaseTexture *iface, IUn
|
||||
IWineD3DBaseTexture IWineD3DBaseTexture parts follow
|
||||
****************************************************** */
|
||||
|
||||
/* There is no OpenGL equivilent of setLOD, getLOD, all they do it priortise testure loading
|
||||
/* There is no OpenGL equivalent of setLOD, getLOD. All they do anyway is prioritize texture loading
|
||||
* so just pretend that they work unless something really needs a failure. */
|
||||
DWORD WINAPI IWineD3DBaseTextureImpl_SetLOD(IWineD3DBaseTexture *iface, DWORD LODNew) {
|
||||
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
|
||||
@@ -183,10 +198,12 @@ HRESULT WINAPI IWineD3DBaseTextureImpl_SetAutoGenFilterType(IWineD3DBaseTexture
|
||||
glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST);
|
||||
checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_FASTEST)");
|
||||
|
||||
break;
|
||||
case WINED3DTEXF_LINEAR:
|
||||
glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);
|
||||
checkGLcall("glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST)");
|
||||
|
||||
break;
|
||||
default:
|
||||
WARN("Unexpected filter type %d, setting to GL_NICEST\n", FilterType);
|
||||
glTexParameteri(textureDimensions, GL_GENERATE_MIPMAP_HINT_SGIS, GL_NICEST);
|
||||
@@ -285,13 +302,19 @@ HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface) {
|
||||
checkGLcall("glBindTexture");
|
||||
if (isNewTexture) {
|
||||
/* For a new texture we have to set the textures levels after binding the texture.
|
||||
* In theory this is all we should ever have to do, but because ATI's drivers are broken, we
|
||||
* also need to set the texture dimensions before the texture is set */
|
||||
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->baseTexture.levels - 1);
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels - 1);
|
||||
checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels)");
|
||||
* In theory this is all we should ever have to do, but because ATI's drivers are broken, we
|
||||
* also need to set the texture dimensions before the texture is set
|
||||
* Beware that texture rectangles do not support mipmapping, but set the maxmiplevel if we're
|
||||
* relying on the partial GL_ARB_texture_non_power_of_two emulation with texture rectangles
|
||||
* (ie, do not care for cond_np2 here, just look for GL_TEXTURE_RECTANGLE_ARB)
|
||||
*/
|
||||
if(textureDimensions != GL_TEXTURE_RECTANGLE_ARB) {
|
||||
TRACE("Setting GL_TEXTURE_MAX_LEVEL to %d\n", This->baseTexture.levels - 1);
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels - 1);
|
||||
checkGLcall("glTexParameteri(textureDimensions, GL_TEXTURE_MAX_LEVEL, This->baseTexture.levels)");
|
||||
}
|
||||
if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) {
|
||||
/* Cubemaps are always set to clamp, regardeless of the sampler state. */
|
||||
/* Cubemaps are always set to clamp, regardless of the sampler state. */
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
|
||||
@@ -307,32 +330,18 @@ HRESULT WINAPI IWineD3DBaseTextureImpl_BindTexture(IWineD3DBaseTexture *iface) {
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseTextureImpl_UnBindTexture(IWineD3DBaseTexture *iface) {
|
||||
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
|
||||
UINT textureDimensions;
|
||||
|
||||
TRACE("(%p) : About to bind texture\n", This);
|
||||
textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
|
||||
|
||||
ENTER_GL();
|
||||
|
||||
glBindTexture(textureDimensions, 0);
|
||||
#if 0 /* TODO: context manager support */
|
||||
IWineD3DContextManager_PopState(This->contextManager, textureDimensions, ENABLED, NOW /* make sure the state is applied now */);
|
||||
#else
|
||||
glDisable(textureDimensions);
|
||||
#endif
|
||||
|
||||
LEAVE_GL();
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
UINT WINAPI IWineD3DBaseTextureImpl_GetTextureDimensions(IWineD3DBaseTexture *iface){
|
||||
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
|
||||
FIXME("(%p) : This shouldn't be called\n", This);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
BOOL WINAPI IWineD3DBaseTextureImpl_IsCondNP2(IWineD3DBaseTexture *iface){
|
||||
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
|
||||
FIXME("(%p) : This shouldn't be called\n", This);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static inline GLenum warpLookupType(WINED3DSAMPLERSTATETYPE Type) {
|
||||
switch(Type) {
|
||||
case WINED3DSAMP_ADDRESSU:
|
||||
@@ -347,15 +356,22 @@ static inline GLenum warpLookupType(WINED3DSAMPLERSTATETYPE Type) {
|
||||
}
|
||||
}
|
||||
|
||||
static inline void apply_wrap(const GLint textureDimensions, const DWORD state, const GLint type) {
|
||||
static inline void apply_wrap(const GLint textureDimensions, const DWORD state, const GLint type,
|
||||
BOOL cond_np2) {
|
||||
GLint wrapParm;
|
||||
|
||||
if (state < minLookup[WINELOOKUP_WARPPARAM] || state > maxLookup[WINELOOKUP_WARPPARAM]) {
|
||||
FIXME("Unrecognized or unsupported WINED3DTADDRESS_U value %d\n", state);
|
||||
} else {
|
||||
if(textureDimensions==GL_TEXTURE_CUBE_MAP_ARB) {
|
||||
/* Cubemaps are always set to clamp, regardeless of the sampler state. */
|
||||
/* Cubemaps are always set to clamp, regardless of the sampler state. */
|
||||
wrapParm = GL_CLAMP_TO_EDGE;
|
||||
} else if(cond_np2) {
|
||||
if(state == WINED3DTADDRESS_WRAP) {
|
||||
wrapParm = GL_CLAMP_TO_EDGE;
|
||||
} else {
|
||||
wrapParm = stateLookup[WINELOOKUP_WARPPARAM][state - minLookup[WINELOOKUP_WARPPARAM]];
|
||||
}
|
||||
} else {
|
||||
wrapParm = stateLookup[WINELOOKUP_WARPPARAM][state - minLookup[WINELOOKUP_WARPPARAM]];
|
||||
}
|
||||
@@ -371,24 +387,25 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
|
||||
IWineD3DBaseTextureImpl *This = (IWineD3DBaseTextureImpl *)iface;
|
||||
DWORD state;
|
||||
GLint textureDimensions = IWineD3DBaseTexture_GetTextureDimensions(iface);
|
||||
BOOL cond_np2 = IWineD3DBaseTexture_IsCondNP2(iface);
|
||||
|
||||
IWineD3DBaseTexture_PreLoad(iface);
|
||||
/* ApplyStateChanges relies on the correct texture being bound and loaded. */
|
||||
|
||||
if(samplerStates[WINED3DSAMP_ADDRESSU] != This->baseTexture.states[WINED3DTEXSTA_ADDRESSU]) {
|
||||
state = samplerStates[WINED3DSAMP_ADDRESSU];
|
||||
apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_S);
|
||||
apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_S, cond_np2);
|
||||
This->baseTexture.states[WINED3DTEXSTA_ADDRESSU] = state;
|
||||
}
|
||||
|
||||
if(samplerStates[WINED3DSAMP_ADDRESSV] != This->baseTexture.states[WINED3DTEXSTA_ADDRESSV]) {
|
||||
state = samplerStates[WINED3DSAMP_ADDRESSV];
|
||||
apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_T);
|
||||
apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_T, cond_np2);
|
||||
This->baseTexture.states[WINED3DTEXSTA_ADDRESSV] = state;
|
||||
}
|
||||
|
||||
if(samplerStates[WINED3DSAMP_ADDRESSW] != This->baseTexture.states[WINED3DTEXSTA_ADDRESSW]) {
|
||||
state = samplerStates[WINED3DSAMP_ADDRESSW];
|
||||
apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_R);
|
||||
apply_wrap(textureDimensions, state, GL_TEXTURE_WRAP_R, cond_np2);
|
||||
This->baseTexture.states[WINED3DTEXSTA_ADDRESSW] = state;
|
||||
}
|
||||
|
||||
@@ -406,31 +423,31 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
|
||||
if(samplerStates[WINED3DSAMP_MAGFILTER] != This->baseTexture.states[WINED3DTEXSTA_MAGFILTER]) {
|
||||
GLint glValue;
|
||||
state = samplerStates[WINED3DSAMP_MAGFILTER];
|
||||
if (state < minLookup[WINELOOKUP_MAGFILTER] || state > maxLookup[WINELOOKUP_MAGFILTER]) {
|
||||
if (state > WINED3DTEXF_ANISOTROPIC) {
|
||||
FIXME("Unrecognized or unsupported MAGFILTER* value %d\n", state);
|
||||
} else {
|
||||
glValue = (*This->baseTexture.magLookup)[state - WINED3DTEXF_NONE];
|
||||
TRACE("ValueMAG=%d setting MAGFILTER to %x\n", state, glValue);
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAG_FILTER, glValue);
|
||||
/* We need to reset the Anisotropic filtering state when we change the mag filter to WINED3DTEXF_ANISOTROPIC (this seems a bit weird, check the documentation to see how it should be switched off. */
|
||||
if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC) && WINED3DTEXF_ANISOTROPIC == state &&
|
||||
!cond_np2) {
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerStates[WINED3DSAMP_MAXANISOTROPY]);
|
||||
}
|
||||
This->baseTexture.states[WINED3DTEXSTA_MAGFILTER] = state;
|
||||
}
|
||||
glValue = stateLookup[WINELOOKUP_MAGFILTER][state - minLookup[WINELOOKUP_MAGFILTER]];
|
||||
TRACE("ValueMAG=%d setting MAGFILTER to %x\n", state, glValue);
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAG_FILTER, glValue);
|
||||
/* We need to reset the Aniotropic filtering state when we change the mag filter to WINED3DTEXF_ANISOTROPIC (this seems a bit weird, check the documentataion to see how it should be switched off. */
|
||||
if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC) && WINED3DTEXF_ANISOTROPIC == state) {
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerStates[WINED3DSAMP_MAXANISOTROPY]);
|
||||
}
|
||||
This->baseTexture.states[WINED3DTEXSTA_MAGFILTER] = state;
|
||||
}
|
||||
|
||||
if(samplerStates[WINED3DSAMP_MINFILTER] != This->baseTexture.states[WINED3DTEXSTA_MINFILTER] ||
|
||||
samplerStates[WINED3DSAMP_MIPFILTER] != This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] ||
|
||||
samplerStates[WINED3DSAMP_MAXMIPLEVEL] != This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL]) {
|
||||
if((samplerStates[WINED3DSAMP_MINFILTER] != This->baseTexture.states[WINED3DTEXSTA_MINFILTER] ||
|
||||
samplerStates[WINED3DSAMP_MIPFILTER] != This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] ||
|
||||
samplerStates[WINED3DSAMP_MAXMIPLEVEL] != This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL])) {
|
||||
GLint glValue;
|
||||
|
||||
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] = samplerStates[WINED3DSAMP_MIPFILTER];
|
||||
This->baseTexture.states[WINED3DTEXSTA_MINFILTER] = samplerStates[WINED3DSAMP_MINFILTER];
|
||||
This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL] = samplerStates[WINED3DSAMP_MAXMIPLEVEL];
|
||||
|
||||
if (This->baseTexture.states[WINED3DTEXSTA_MINFILTER] < WINED3DTEXF_NONE ||
|
||||
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] < WINED3DTEXF_NONE ||
|
||||
This->baseTexture.states[WINED3DTEXSTA_MINFILTER] > WINED3DTEXF_ANISOTROPIC ||
|
||||
if (This->baseTexture.states[WINED3DTEXSTA_MINFILTER] > WINED3DTEXF_ANISOTROPIC ||
|
||||
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] > WINED3DTEXF_LINEAR)
|
||||
{
|
||||
|
||||
@@ -438,7 +455,8 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
|
||||
This->baseTexture.states[WINED3DTEXSTA_MINFILTER],
|
||||
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER]);
|
||||
}
|
||||
glValue = minMipLookup[min(max(samplerStates[WINED3DSAMP_MINFILTER],WINED3DTEXF_NONE), WINED3DTEXF_ANISOTROPIC)]
|
||||
glValue = (*This->baseTexture.minMipLookup)
|
||||
[min(max(samplerStates[WINED3DSAMP_MINFILTER],WINED3DTEXF_NONE), WINED3DTEXF_ANISOTROPIC)]
|
||||
[min(max(samplerStates[WINED3DSAMP_MIPFILTER],WINED3DTEXF_NONE), WINED3DTEXF_LINEAR)];
|
||||
|
||||
TRACE("ValueMIN=%d, ValueMIP=%d, setting MINFILTER to %x\n",
|
||||
@@ -447,18 +465,20 @@ void WINAPI IWineD3DBaseTextureImpl_ApplyStateChanges(IWineD3DBaseTexture *iface
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MIN_FILTER, glValue);
|
||||
checkGLcall("glTexParameter GL_TEXTURE_MIN_FILTER, ...");
|
||||
|
||||
if(This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] == WINED3DTEXF_NONE) {
|
||||
glValue = 0;
|
||||
} else if(This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL] >= This->baseTexture.levels) {
|
||||
glValue = This->baseTexture.levels - 1;
|
||||
} else {
|
||||
glValue = This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL];
|
||||
if(!cond_np2) {
|
||||
if(This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] == WINED3DTEXF_NONE) {
|
||||
glValue = 0;
|
||||
} else if(This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL] >= This->baseTexture.levels) {
|
||||
glValue = This->baseTexture.levels - 1;
|
||||
} else {
|
||||
glValue = This->baseTexture.states[WINED3DTEXSTA_MAXMIPLEVEL];
|
||||
}
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_BASE_LEVEL, glValue);
|
||||
}
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_BASE_LEVEL, glValue);
|
||||
}
|
||||
|
||||
if(samplerStates[WINED3DSAMP_MAXANISOTROPY] != This->baseTexture.states[WINED3DTEXSTA_MAXANISOTROPY]) {
|
||||
if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC)) {
|
||||
if (GL_SUPPORT(EXT_TEXTURE_FILTER_ANISOTROPIC) && !cond_np2) {
|
||||
glTexParameteri(textureDimensions, GL_TEXTURE_MAX_ANISOTROPY_EXT, samplerStates[WINED3DSAMP_MAXANISOTROPY]);
|
||||
checkGLcall("glTexParameteri GL_TEXTURE_MAX_ANISOTROPY_EXT ...");
|
||||
} else {
|
||||
@@ -484,6 +504,7 @@ static const IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl =
|
||||
IWineD3DBaseTextureImpl_SetPriority,
|
||||
IWineD3DBaseTextureImpl_GetPriority,
|
||||
IWineD3DBaseTextureImpl_PreLoad,
|
||||
IWineD3DBaseTextureImpl_UnLoad,
|
||||
IWineD3DBaseTextureImpl_GetType,
|
||||
/*IWineD3DBaseTexture*/
|
||||
IWineD3DBaseTextureImpl_SetLOD,
|
||||
@@ -496,8 +517,8 @@ static const IWineD3DBaseTextureVtbl IWineD3DBaseTexture_Vtbl =
|
||||
IWineD3DBaseTextureImpl_GetDirty,
|
||||
/* internal */
|
||||
IWineD3DBaseTextureImpl_BindTexture,
|
||||
IWineD3DBaseTextureImpl_UnBindTexture,
|
||||
IWineD3DBaseTextureImpl_GetTextureDimensions,
|
||||
IWineD3DBaseTextureImpl_IsCondNP2,
|
||||
IWineD3DBaseTextureImpl_ApplyStateChanges
|
||||
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@
|
||||
* Copyright 2002-2005 Jason Edmeades
|
||||
* Copyright 2002-2005 Raphael Junqueira
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -23,7 +24,7 @@
|
||||
#include "config.h"
|
||||
#include "wined3d_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
||||
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
|
||||
|
||||
static const GLenum cube_targets[6] = {
|
||||
@@ -46,7 +47,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_QueryInterface(IWineD3DCubeTexture
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DResource)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBaseTexture)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DTexture)) {
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DCubeTexture)) {
|
||||
IUnknown_AddRef(iface);
|
||||
*ppobj = This;
|
||||
return S_OK;
|
||||
@@ -102,7 +103,6 @@ static DWORD WINAPI IWineD3DCubeTextureImpl_GetPriority(IWineD3DCubeTexture *ifa
|
||||
static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) {
|
||||
/* Override the IWineD3DResource Preload method */
|
||||
unsigned int i,j;
|
||||
BOOL setGlTextureDesc = FALSE;
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
BOOL srgb_mode = This->baseTexture.is_srgb;
|
||||
@@ -110,8 +110,6 @@ static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) {
|
||||
|
||||
TRACE("(%p) : About to load texture: dirtified(%d)\n", This, This->baseTexture.dirty);
|
||||
|
||||
if (This->baseTexture.textureName == 0) setGlTextureDesc = TRUE;
|
||||
|
||||
/* We only have to activate a context for gl when we're not drawing. In most cases PreLoad will be called during draw
|
||||
* and a context was activated at the beginning of drawPrimitive
|
||||
*/
|
||||
@@ -125,15 +123,24 @@ static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) {
|
||||
srgb_was_toggled = (This->baseTexture.is_srgb != srgb_mode);
|
||||
This->baseTexture.is_srgb = srgb_mode;
|
||||
}
|
||||
IWineD3DCubeTexture_BindTexture(iface);
|
||||
|
||||
ENTER_GL();
|
||||
if (This->resource.format == WINED3DFMT_P8 || This->resource.format == WINED3DFMT_A8P8) {
|
||||
for (i = 0; i < This->baseTexture.levels; i++) {
|
||||
for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z ; j++) {
|
||||
if(palette9_changed((IWineD3DSurfaceImpl *)This->surfaces[j][i])) {
|
||||
TRACE("Reloading surface because the d3d8/9 palette was changed\n");
|
||||
/* TODO: This is not necessarily needed with hw palettized texture support */
|
||||
IWineD3DSurface_LoadLocation(This->surfaces[j][i], SFLAG_INSYSMEM, NULL);
|
||||
/* Make sure the texture is reloaded because of the palette change, this kills performance though :( */
|
||||
IWineD3DSurface_ModifyLocation(This->surfaces[j][i], SFLAG_INTEXTURE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/* If the texture is marked dirty or the srgb sampler setting has changed since the last load then reload the surfaces */
|
||||
if (This->baseTexture.dirty) {
|
||||
for (i = 0; i < This->baseTexture.levels; i++) {
|
||||
for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z ; j++) {
|
||||
if(setGlTextureDesc)
|
||||
IWineD3DSurface_SetGlTextureDesc(This->surfaces[j][i], This->baseTexture.textureName, cube_targets[j]);
|
||||
IWineD3DSurface_LoadTexture(This->surfaces[j][i], srgb_mode);
|
||||
}
|
||||
}
|
||||
@@ -156,13 +163,31 @@ static void WINAPI IWineD3DCubeTextureImpl_PreLoad(IWineD3DCubeTexture *iface) {
|
||||
} else {
|
||||
TRACE("(%p) Texture not dirty, nothing to do\n" , iface);
|
||||
}
|
||||
LEAVE_GL();
|
||||
|
||||
/* No longer dirty */
|
||||
This->baseTexture.dirty = FALSE;
|
||||
return ;
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DCubeTextureImpl_UnLoad(IWineD3DCubeTexture *iface) {
|
||||
unsigned int i, j;
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
/* Unload all the surfaces and reset the texture name. If UnLoad was called on the
|
||||
* surface before, this one will be a NOP and vice versa. Unloading an unloaded
|
||||
* surface is fine
|
||||
*/
|
||||
for (i = 0; i < This->baseTexture.levels; i++) {
|
||||
for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z ; j++) {
|
||||
IWineD3DSurface_UnLoad(This->surfaces[j][i]);
|
||||
IWineD3DSurface_SetGlTextureDesc(This->surfaces[j][i], 0, IWineD3DTexture_GetTextureDimensions(iface));
|
||||
}
|
||||
}
|
||||
|
||||
IWineD3DBaseTextureImpl_UnLoad((IWineD3DBaseTexture *) iface);
|
||||
}
|
||||
|
||||
static WINED3DRESOURCETYPE WINAPI IWineD3DCubeTextureImpl_GetType(IWineD3DCubeTexture *iface) {
|
||||
return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
|
||||
}
|
||||
@@ -210,14 +235,22 @@ static BOOL WINAPI IWineD3DCubeTextureImpl_GetDirty(IWineD3DCubeTexture *iface)
|
||||
|
||||
static HRESULT WINAPI IWineD3DCubeTextureImpl_BindTexture(IWineD3DCubeTexture *iface) {
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
TRACE("(%p) : relay to BaseTexture\n", This);
|
||||
return IWineD3DBaseTextureImpl_BindTexture((IWineD3DBaseTexture *)iface);
|
||||
}
|
||||
BOOL set_gl_texture_desc = This->baseTexture.textureName == 0;
|
||||
HRESULT hr;
|
||||
|
||||
static HRESULT WINAPI IWineD3DCubeTextureImpl_UnBindTexture(IWineD3DCubeTexture *iface) {
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
TRACE("(%p) : relay to BaseTexture\n", This);
|
||||
return IWineD3DBaseTextureImpl_UnBindTexture((IWineD3DBaseTexture *)iface);
|
||||
|
||||
hr = IWineD3DBaseTextureImpl_BindTexture((IWineD3DBaseTexture *)iface);
|
||||
if (set_gl_texture_desc && SUCCEEDED(hr)) {
|
||||
UINT i, j;
|
||||
for (i = 0; i < This->baseTexture.levels; ++i) {
|
||||
for (j = WINED3DCUBEMAP_FACE_POSITIVE_X; j <= WINED3DCUBEMAP_FACE_NEGATIVE_Z; ++j) {
|
||||
IWineD3DSurface_SetGlTextureDesc(This->surfaces[j][i], This->baseTexture.textureName, cube_targets[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static UINT WINAPI IWineD3DCubeTextureImpl_GetTextureDimensions(IWineD3DCubeTexture *iface){
|
||||
@@ -227,6 +260,13 @@ static UINT WINAPI IWineD3DCubeTextureImpl_GetTextureDimensions(IWineD3DCubeText
|
||||
return GL_TEXTURE_CUBE_MAP_ARB;
|
||||
}
|
||||
|
||||
static BOOL WINAPI IWineD3DCubeTextureImpl_IsCondNP2(IWineD3DCubeTexture *iface) {
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DCubeTextureImpl_ApplyStateChanges(IWineD3DCubeTexture *iface,
|
||||
const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1],
|
||||
const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) {
|
||||
@@ -273,7 +313,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_GetCubeMapSurface(IWineD3DCubeText
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
HRESULT hr = WINED3DERR_INVALIDCALL;
|
||||
|
||||
if (Level < This->baseTexture.levels && FaceType >= WINED3DCUBEMAP_FACE_POSITIVE_X && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
||||
if (Level < This->baseTexture.levels && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
||||
*ppCubeMapSurface = This->surfaces[FaceType][Level];
|
||||
IWineD3DSurface_AddRef(*ppCubeMapSurface);
|
||||
|
||||
@@ -292,7 +332,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_LockRect(IWineD3DCubeTexture *ifac
|
||||
HRESULT hr = WINED3DERR_INVALIDCALL;
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
|
||||
if (Level < This->baseTexture.levels && FaceType >= WINED3DCUBEMAP_FACE_POSITIVE_X && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
||||
if (Level < This->baseTexture.levels && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
||||
hr = IWineD3DSurface_LockRect(This->surfaces[FaceType][Level], pLockedRect, pRect, Flags);
|
||||
}
|
||||
|
||||
@@ -309,7 +349,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_UnlockRect(IWineD3DCubeTexture *if
|
||||
HRESULT hr = WINED3DERR_INVALIDCALL;
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
|
||||
if (Level < This->baseTexture.levels && FaceType >= WINED3DCUBEMAP_FACE_POSITIVE_X && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
||||
if (Level < This->baseTexture.levels && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
||||
hr = IWineD3DSurface_UnlockRect(This->surfaces[FaceType][Level]);
|
||||
}
|
||||
|
||||
@@ -326,7 +366,7 @@ static HRESULT WINAPI IWineD3DCubeTextureImpl_AddDirtyRect(IWineD3DCubeTexture
|
||||
IWineD3DCubeTextureImpl *This = (IWineD3DCubeTextureImpl *)iface;
|
||||
This->baseTexture.dirty = TRUE;
|
||||
TRACE("(%p) : dirtyfication of faceType(%d) Level (0)\n", This, FaceType);
|
||||
if (FaceType >= WINED3DCUBEMAP_FACE_POSITIVE_X && FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
||||
if (FaceType <= WINED3DCUBEMAP_FACE_NEGATIVE_Z) {
|
||||
hr = IWineD3DSurface_AddDirtyRect(This->surfaces[FaceType][0], pDirtyRect);
|
||||
} else {
|
||||
WARN("(%p) overflow FaceType(%d)\n", This, FaceType);
|
||||
@@ -350,6 +390,7 @@ const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
|
||||
IWineD3DCubeTextureImpl_SetPriority,
|
||||
IWineD3DCubeTextureImpl_GetPriority,
|
||||
IWineD3DCubeTextureImpl_PreLoad,
|
||||
IWineD3DCubeTextureImpl_UnLoad,
|
||||
IWineD3DCubeTextureImpl_GetType,
|
||||
/* IWineD3DBaseTexture */
|
||||
IWineD3DCubeTextureImpl_SetLOD,
|
||||
@@ -361,8 +402,8 @@ const IWineD3DCubeTextureVtbl IWineD3DCubeTexture_Vtbl =
|
||||
IWineD3DCubeTextureImpl_SetDirty,
|
||||
IWineD3DCubeTextureImpl_GetDirty,
|
||||
IWineD3DCubeTextureImpl_BindTexture,
|
||||
IWineD3DCubeTextureImpl_UnBindTexture,
|
||||
IWineD3DCubeTextureImpl_GetTextureDimensions,
|
||||
IWineD3DCubeTextureImpl_IsCondNP2,
|
||||
IWineD3DCubeTextureImpl_ApplyStateChanges,
|
||||
/* IWineD3DCubeTexture */
|
||||
IWineD3DCubeTextureImpl_Destroy,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -5,8 +5,8 @@
|
||||
* Copyright 2002-2004 Raphael Junqueira
|
||||
* Copyright 2004 Christian Costa
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2006 Henri Verbeet
|
||||
* Copyright 2007 Stefan Dösinger for CodeWeavers
|
||||
* Copyright 2006, 2008 Henri Verbeet
|
||||
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -30,14 +30,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_draw);
|
||||
#define GLINFO_LOCATION This->adapter->gl_info
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#if 0 /* TODO */
|
||||
extern IWineD3DVertexShaderImpl* VertexShaders[64];
|
||||
extern IWineD3DVertexDeclarationImpl* VertexShaderDeclarations[64];
|
||||
extern IWineD3DPixelShaderImpl* PixelShaders[64];
|
||||
|
||||
#undef GL_VERSION_1_4 /* To be fixed, caused by mesa headers */
|
||||
#endif
|
||||
#include <math.h>
|
||||
|
||||
/* Issues the glBegin call for gl given the primitive type and count */
|
||||
static DWORD primitiveToGl(WINED3DPRIMITIVETYPE PrimitiveType,
|
||||
@@ -133,7 +126,7 @@ static BOOL fixed_get_input(
|
||||
else if (usage == WINED3DDECLUSAGE_SAMPLE && usage_idx == 0)
|
||||
*regnum = 14 + WINED3DDP_MAXTEXCOORD;
|
||||
|
||||
if (*regnum < 0) {
|
||||
if (*regnum == -1) {
|
||||
FIXME("Unsupported input stream [usage=%s, usage_idx=%u]\n",
|
||||
debug_d3ddeclusage(usage), usage_idx);
|
||||
return FALSE;
|
||||
@@ -155,7 +148,6 @@ void primitiveDeclarationConvertToStridedData(
|
||||
int i;
|
||||
WINED3DVERTEXELEMENT *element;
|
||||
DWORD stride;
|
||||
int reg;
|
||||
DWORD numPreloadStreams = This->stateBlock->streamIsUP ? 0 : vertexDeclaration->num_streams;
|
||||
DWORD *streams = vertexDeclaration->streams;
|
||||
|
||||
@@ -197,7 +189,7 @@ void primitiveDeclarationConvertToStridedData(
|
||||
WARN("loadBaseVertexIndex is < 0 (%d), not using vbos\n", This->stateBlock->loadBaseVertexIndex);
|
||||
streamVBO = 0;
|
||||
data = ((IWineD3DVertexBufferImpl *) This->stateBlock->streamSource[element->Stream])->resource.allocatedMemory;
|
||||
if(data + This->stateBlock->loadBaseVertexIndex * stride < 0) {
|
||||
if((UINT_PTR)data < -This->stateBlock->loadBaseVertexIndex * stride) {
|
||||
FIXME("System memory vertex data load offset is negative!\n");
|
||||
}
|
||||
}
|
||||
@@ -207,13 +199,16 @@ void primitiveDeclarationConvertToStridedData(
|
||||
else if(*fixup && !useVertexShaderFunction &&
|
||||
(element->Usage == WINED3DDECLUSAGE_COLOR ||
|
||||
element->Usage == WINED3DDECLUSAGE_POSITIONT)) {
|
||||
/* This may be bad with the fixed function pipeline */
|
||||
FIXME("Missing vbo streams with unfixed colors or transformed position, expect problems\n");
|
||||
static BOOL warned = FALSE;
|
||||
if(!warned) {
|
||||
/* This may be bad with the fixed function pipeline */
|
||||
FIXME("Missing vbo streams with unfixed colors or transformed position, expect problems\n");
|
||||
warned = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
data += element->Offset;
|
||||
reg = element->Reg;
|
||||
|
||||
TRACE("Offset %d Stream %d UsageIndex %d\n", element->Offset, element->Stream, element->UsageIndex);
|
||||
|
||||
@@ -273,12 +268,9 @@ static void drawStridedFast(IWineD3DDevice *iface,UINT numberOfVertices, GLenum
|
||||
#endif
|
||||
|
||||
} else {
|
||||
|
||||
/* Note first is now zero as we shuffled along earlier */
|
||||
TRACE("(%p) : glDrawArrays(%x, 0, %d)\n", This, glPrimitiveType, numberOfVertices);
|
||||
TRACE("(%p) : glDrawArrays(%#x, %d, %d)\n", This, glPrimitiveType, startVertex, numberOfVertices);
|
||||
glDrawArrays(glPrimitiveType, startVertex, numberOfVertices);
|
||||
checkGLcall("glDrawArrays");
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -297,8 +289,6 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
||||
const WORD *pIdxBufS = NULL;
|
||||
const DWORD *pIdxBufL = NULL;
|
||||
LONG vx_index;
|
||||
float x = 0.0f, y = 0.0f, z = 0.0f; /* x,y,z coordinates */
|
||||
float rhw = 0.0f; /* rhw */
|
||||
DWORD diffuseColor = 0xFFFFFFFF; /* Diffuse Color */
|
||||
DWORD specularColor = 0; /* Specular Color */
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
@@ -348,6 +338,32 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
||||
position = sd->u.s.position.lpData + streamOffset[sd->u.s.position.streamNo];
|
||||
}
|
||||
|
||||
/* The texture coordinate types are not so easy to map into a common function signature - we're
|
||||
* not using the vector functions here
|
||||
*/
|
||||
if(FIXME_ON(d3d_draw)) {
|
||||
for (textureNo = 0; textureNo < GL_LIMITS(textures); ++textureNo) {
|
||||
DWORD type = sd->u.s.texCoords[textureNo].dwType;
|
||||
if (sd->u.s.texCoords[textureNo].lpData &&
|
||||
type != WINED3DDECLTYPE_FLOAT1 &&
|
||||
type != WINED3DDECLTYPE_FLOAT2 &&
|
||||
type != WINED3DDECLTYPE_FLOAT3 &&
|
||||
type != WINED3DDECLTYPE_FLOAT4) {
|
||||
FIXME("Implement fixed function texture coordinates from %s\n", debug_d3ddecltype(type));
|
||||
}
|
||||
}
|
||||
if(specular && This->stateBlock->renderState[WINED3DRS_FOGENABLE] &&
|
||||
(This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE || sd->u.s.position_transformed )&&
|
||||
This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE) {
|
||||
if(GL_SUPPORT(EXT_FOG_COORD) && sd->u.s.specular.dwType != WINED3DDECLTYPE_D3DCOLOR) {
|
||||
FIXME("Implement fog coordinates from %s\n", debug_d3ddecltype(sd->u.s.specular.dwType));
|
||||
}
|
||||
}
|
||||
if(This->activeContext->num_untracked_materials && sd->u.s.diffuse.dwType != WINED3DDECLTYPE_D3DCOLOR) {
|
||||
FIXME("Implement diffuse color tracking from %s\n", debug_d3ddecltype(sd->u.s.diffuse.dwType));
|
||||
}
|
||||
}
|
||||
|
||||
/* Start drawing in GL */
|
||||
VTRACE(("glBegin(%x)\n", glPrimType));
|
||||
glBegin(glPrimType);
|
||||
@@ -481,22 +497,13 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
||||
/* Diffuse -------------------------------- */
|
||||
if (diffuse) {
|
||||
DWORD *ptrToCoords = (DWORD *)(diffuse + (SkipnStrides * sd->u.s.diffuse.dwStride));
|
||||
diffuseColor = ptrToCoords[0];
|
||||
VTRACE(("diffuseColor=%lx\n", diffuseColor));
|
||||
|
||||
glColor4ub(D3DCOLOR_B_R(diffuseColor),
|
||||
D3DCOLOR_B_G(diffuseColor),
|
||||
D3DCOLOR_B_B(diffuseColor),
|
||||
D3DCOLOR_B_A(diffuseColor));
|
||||
VTRACE(("glColor4ub: r,g,b,a=%lu,%lu,%lu,%lu\n",
|
||||
D3DCOLOR_B_R(diffuseColor),
|
||||
D3DCOLOR_B_G(diffuseColor),
|
||||
D3DCOLOR_B_B(diffuseColor),
|
||||
D3DCOLOR_B_A(diffuseColor)));
|
||||
|
||||
diffuse_funcs[sd->u.s.diffuse.dwType]((void *) ptrToCoords);
|
||||
if(This->activeContext->num_untracked_materials) {
|
||||
unsigned char i;
|
||||
float color[4];
|
||||
|
||||
diffuseColor = ptrToCoords[0];
|
||||
color[0] = D3DCOLOR_B_R(diffuseColor) / 255.0;
|
||||
color[1] = D3DCOLOR_B_G(diffuseColor) / 255.0;
|
||||
color[2] = D3DCOLOR_B_B(diffuseColor) / 255.0;
|
||||
@@ -511,14 +518,13 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
||||
/* Specular ------------------------------- */
|
||||
if (specular) {
|
||||
DWORD *ptrToCoords = (DWORD *)(specular + (SkipnStrides * sd->u.s.specular.dwStride));
|
||||
specularColor = ptrToCoords[0];
|
||||
VTRACE(("specularColor=%lx\n", specularColor));
|
||||
|
||||
/* special case where the fog density is stored in the specular alpha channel */
|
||||
if(This->stateBlock->renderState[WINED3DRS_FOGENABLE] &&
|
||||
(This->stateBlock->renderState[WINED3DRS_FOGVERTEXMODE] == WINED3DFOG_NONE || sd->u.s.position.dwType == WINED3DDECLTYPE_FLOAT4 )&&
|
||||
This->stateBlock->renderState[WINED3DRS_FOGTABLEMODE] == WINED3DFOG_NONE) {
|
||||
if(GL_SUPPORT(EXT_FOG_COORD)) {
|
||||
specularColor = ptrToCoords[0];
|
||||
GL_EXTCALL(glFogCoordfEXT(specularColor >> 24));
|
||||
} else {
|
||||
static BOOL warned = FALSE;
|
||||
@@ -530,52 +536,19 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
||||
}
|
||||
}
|
||||
|
||||
VTRACE(("glSecondaryColor4ub: r,g,b=%lu,%lu,%lu\n",
|
||||
D3DCOLOR_B_R(specularColor),
|
||||
D3DCOLOR_B_G(specularColor),
|
||||
D3DCOLOR_B_B(specularColor)));
|
||||
if (GL_SUPPORT(EXT_SECONDARY_COLOR)) {
|
||||
GL_EXTCALL(glSecondaryColor3ubEXT)(
|
||||
D3DCOLOR_B_R(specularColor),
|
||||
D3DCOLOR_B_G(specularColor),
|
||||
D3DCOLOR_B_B(specularColor));
|
||||
} else {
|
||||
/* Do not worry if specular colour missing and disable request */
|
||||
VTRACE(("Specular color extensions not supplied\n"));
|
||||
}
|
||||
specular_funcs[sd->u.s.specular.dwType]((void *) ptrToCoords);
|
||||
}
|
||||
|
||||
/* Normal -------------------------------- */
|
||||
if (normal != NULL) {
|
||||
float *ptrToCoords = (float *)(normal + (SkipnStrides * sd->u.s.normal.dwStride));
|
||||
|
||||
VTRACE(("glNormal:nx,ny,nz=%f,%f,%f\n", ptrToCoords[0], ptrToCoords[1], ptrToCoords[2]));
|
||||
glNormal3f(ptrToCoords[0], ptrToCoords[1], ptrToCoords[2]);
|
||||
normal_funcs[sd->u.s.normal.dwType](ptrToCoords);
|
||||
}
|
||||
|
||||
/* Position -------------------------------- */
|
||||
if (position) {
|
||||
float *ptrToCoords = (float *)(position + (SkipnStrides * sd->u.s.position.dwStride));
|
||||
x = ptrToCoords[0];
|
||||
y = ptrToCoords[1];
|
||||
z = ptrToCoords[2];
|
||||
rhw = 1.0;
|
||||
VTRACE(("x,y,z=%f,%f,%f\n", x,y,z));
|
||||
|
||||
/* RHW follows, only if transformed, ie 4 floats were provided */
|
||||
if (sd->u.s.position_transformed) {
|
||||
rhw = ptrToCoords[3];
|
||||
VTRACE(("rhw=%f\n", rhw));
|
||||
}
|
||||
|
||||
if (1.0f == rhw || ((rhw < eps) && (rhw > -eps))) {
|
||||
VTRACE(("Vertex: glVertex:x,y,z=%f,%f,%f\n", x,y,z));
|
||||
glVertex3f(x, y, z);
|
||||
} else {
|
||||
GLfloat w = 1.0 / rhw;
|
||||
VTRACE(("Vertex: glVertex:x,y,z=%f,%f,%f / rhw=%f\n", x,y,z,rhw));
|
||||
glVertex4f(x*w, y*w, z*w, w);
|
||||
}
|
||||
position_funcs[sd->u.s.position.dwType](ptrToCoords);
|
||||
}
|
||||
|
||||
/* For non indexed mode, step onto next parts */
|
||||
@@ -588,11 +561,158 @@ static void drawStridedSlow(IWineD3DDevice *iface, WineDirect3DVertexStridedData
|
||||
checkGLcall("glEnd and previous calls");
|
||||
}
|
||||
|
||||
static void depth_blt(IWineD3DDevice *iface, GLuint texture) {
|
||||
static inline void send_attribute(IWineD3DDeviceImpl *This, const DWORD type, const UINT index, const void *ptr) {
|
||||
switch(type) {
|
||||
case WINED3DDECLTYPE_FLOAT1:
|
||||
GL_EXTCALL(glVertexAttrib1fvARB(index, (float *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_FLOAT2:
|
||||
GL_EXTCALL(glVertexAttrib2fvARB(index, (float *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_FLOAT3:
|
||||
GL_EXTCALL(glVertexAttrib3fvARB(index, (float *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_FLOAT4:
|
||||
GL_EXTCALL(glVertexAttrib4fvARB(index, (float *) ptr));
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_UBYTE4:
|
||||
GL_EXTCALL(glVertexAttrib4ubvARB(index, ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_UBYTE4N:
|
||||
case WINED3DDECLTYPE_D3DCOLOR:
|
||||
GL_EXTCALL(glVertexAttrib4NubvARB(index, ptr));
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_SHORT2:
|
||||
GL_EXTCALL(glVertexAttrib4svARB(index, (GLshort *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_SHORT4:
|
||||
GL_EXTCALL(glVertexAttrib4svARB(index, (GLshort *) ptr));
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_SHORT2N:
|
||||
{
|
||||
GLshort s[4] = {((short *) ptr)[0], ((short *) ptr)[1], 0, 1};
|
||||
GL_EXTCALL(glVertexAttrib4NsvARB(index, s));
|
||||
break;
|
||||
}
|
||||
case WINED3DDECLTYPE_USHORT2N:
|
||||
{
|
||||
GLushort s[4] = {((unsigned short *) ptr)[0], ((unsigned short *) ptr)[1], 0, 1};
|
||||
GL_EXTCALL(glVertexAttrib4NusvARB(index, s));
|
||||
break;
|
||||
}
|
||||
case WINED3DDECLTYPE_SHORT4N:
|
||||
GL_EXTCALL(glVertexAttrib4NsvARB(index, (GLshort *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_USHORT4N:
|
||||
GL_EXTCALL(glVertexAttrib4NusvARB(index, (GLushort *) ptr));
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_UDEC3:
|
||||
FIXME("Unsure about WINED3DDECLTYPE_UDEC3\n");
|
||||
/*glVertexAttrib3usvARB(instancedData[j], (GLushort *) ptr); Does not exist */
|
||||
break;
|
||||
case WINED3DDECLTYPE_DEC3N:
|
||||
FIXME("Unsure about WINED3DDECLTYPE_DEC3N\n");
|
||||
/*glVertexAttrib3NusvARB(instancedData[j], (GLushort *) ptr); Does not exist */
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_FLOAT16_2:
|
||||
/* Are those 16 bit floats. C doesn't have a 16 bit float type. I could read the single bits and calculate a 4
|
||||
* byte float according to the IEEE standard
|
||||
*/
|
||||
if (GL_SUPPORT(NV_HALF_FLOAT)) {
|
||||
GL_EXTCALL(glVertexAttrib2hvNV(index, (GLhalfNV *)ptr));
|
||||
} else {
|
||||
float x = float_16_to_32(((unsigned short *) ptr) + 0);
|
||||
float y = float_16_to_32(((unsigned short *) ptr) + 1);
|
||||
GL_EXTCALL(glVertexAttrib2fARB(index, x, y));
|
||||
}
|
||||
break;
|
||||
case WINED3DDECLTYPE_FLOAT16_4:
|
||||
if (GL_SUPPORT(NV_HALF_FLOAT)) {
|
||||
GL_EXTCALL(glVertexAttrib4hvNV(index, (GLhalfNV *)ptr));
|
||||
} else {
|
||||
float x = float_16_to_32(((unsigned short *) ptr) + 0);
|
||||
float y = float_16_to_32(((unsigned short *) ptr) + 1);
|
||||
float z = float_16_to_32(((unsigned short *) ptr) + 2);
|
||||
float w = float_16_to_32(((unsigned short *) ptr) + 3);
|
||||
GL_EXTCALL(glVertexAttrib4fARB(index, x, y, z, w));
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_UNUSED:
|
||||
default:
|
||||
ERR("Unexpected attribute declaration: %d\n", type);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static void drawStridedSlowVs(IWineD3DDevice *iface, WineDirect3DVertexStridedData *sd, UINT numberOfVertices,
|
||||
GLenum glPrimitiveType, const void *idxData, short idxSize, ULONG minIndex, ULONG startIdx,
|
||||
ULONG startVertex) {
|
||||
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface;
|
||||
long SkipnStrides = startVertex + This->stateBlock->loadBaseVertexIndex;
|
||||
const WORD *pIdxBufS = NULL;
|
||||
const DWORD *pIdxBufL = NULL;
|
||||
LONG vx_index;
|
||||
int i;
|
||||
IWineD3DStateBlockImpl *stateblock = This->stateBlock;
|
||||
BYTE *ptr;
|
||||
|
||||
if (idxSize != 0) {
|
||||
/* Immediate mode drawing can't make use of indices in a vbo - get the data from the index buffer.
|
||||
* If the index buffer has no vbo(not supported or other reason), or with user pointer drawing
|
||||
* idxData will be != NULL
|
||||
*/
|
||||
if(idxData == NULL) {
|
||||
idxData = ((IWineD3DIndexBufferImpl *) stateblock->pIndexData)->resource.allocatedMemory;
|
||||
}
|
||||
|
||||
if (idxSize == 2) pIdxBufS = (const WORD *) idxData;
|
||||
else pIdxBufL = (const DWORD *) idxData;
|
||||
}
|
||||
|
||||
/* Start drawing in GL */
|
||||
VTRACE(("glBegin(%x)\n", glPrimitiveType));
|
||||
glBegin(glPrimitiveType);
|
||||
|
||||
for (vx_index = 0; vx_index < numberOfVertices; ++vx_index) {
|
||||
if (idxData != NULL) {
|
||||
|
||||
/* Indexed so work out the number of strides to skip */
|
||||
if (idxSize == 2) {
|
||||
VTRACE(("Idx for vertex %d = %d\n", vx_index, pIdxBufS[startIdx+vx_index]));
|
||||
SkipnStrides = pIdxBufS[startIdx + vx_index] + stateblock->loadBaseVertexIndex;
|
||||
} else {
|
||||
VTRACE(("Idx for vertex %d = %d\n", vx_index, pIdxBufL[startIdx+vx_index]));
|
||||
SkipnStrides = pIdxBufL[startIdx + vx_index] + stateblock->loadBaseVertexIndex;
|
||||
}
|
||||
}
|
||||
|
||||
for(i = MAX_ATTRIBS - 1; i >= 0; i--) {
|
||||
if(!sd->u.input[i].lpData) continue;
|
||||
|
||||
ptr = sd->u.input[i].lpData +
|
||||
sd->u.input[i].dwStride * SkipnStrides +
|
||||
stateblock->streamOffset[sd->u.input[i].streamNo];
|
||||
|
||||
send_attribute(This, sd->u.input[i].dwType, i, ptr);
|
||||
}
|
||||
SkipnStrides++;
|
||||
}
|
||||
|
||||
glEnd();
|
||||
}
|
||||
|
||||
void depth_blt(IWineD3DDevice *iface, GLuint texture, GLsizei w, GLsizei h) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
GLint old_binding = 0;
|
||||
|
||||
glPushAttrib(GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
|
||||
glPushAttrib(GL_ENABLE_BIT | GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT | GL_VIEWPORT_BIT);
|
||||
|
||||
glDisable(GL_CULL_FACE);
|
||||
glEnable(GL_BLEND);
|
||||
@@ -601,7 +721,9 @@ static void depth_blt(IWineD3DDevice *iface, GLuint texture) {
|
||||
glDisable(GL_STENCIL_TEST);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
glDepthFunc(GL_ALWAYS);
|
||||
glDepthMask(GL_TRUE);
|
||||
glBlendFunc(GL_ZERO, GL_ONE);
|
||||
glViewport(0, 0, w, h);
|
||||
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB));
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &old_binding);
|
||||
@@ -621,68 +743,7 @@ static void depth_blt(IWineD3DDevice *iface, GLuint texture) {
|
||||
|
||||
glPopAttrib();
|
||||
|
||||
/* Reselect the old shaders. There doesn't seem to be any glPushAttrib bit for arb shaders,
|
||||
* and this seems easier and more efficient than providing the shader backend with a private
|
||||
* storage to read and restore the old shader settings
|
||||
*/
|
||||
This->shader_backend->shader_select(iface, use_ps(This), use_vs(This));
|
||||
}
|
||||
|
||||
static void depth_copy(IWineD3DDevice *iface) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
IWineD3DSurfaceImpl *depth_stencil = (IWineD3DSurfaceImpl *)This->auto_depth_stencil_buffer;
|
||||
|
||||
/* Only copy the depth buffer if there is one. */
|
||||
if (!depth_stencil) return;
|
||||
|
||||
/* TODO: Make this work for modes other than FBO */
|
||||
if (wined3d_settings.offscreen_rendering_mode != ORM_FBO) return;
|
||||
|
||||
if (depth_stencil->current_renderbuffer) {
|
||||
FIXME("Not supported with fixed up depth stencil\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (This->render_offscreen) {
|
||||
static GLuint tmp_texture = 0;
|
||||
GLint old_binding = 0;
|
||||
|
||||
TRACE("Copying onscreen depth buffer to offscreen surface\n");
|
||||
|
||||
if (!tmp_texture) {
|
||||
glGenTextures(1, &tmp_texture);
|
||||
}
|
||||
|
||||
/* Note that we use depth_blt here as well, rather than glCopyTexImage2D
|
||||
* directly on the FBO texture. That's because we need to flip. */
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
glGetIntegerv(GL_TEXTURE_BINDING_2D, &old_binding);
|
||||
glBindTexture(GL_TEXTURE_2D, tmp_texture);
|
||||
glCopyTexImage2D(depth_stencil->glDescription.target,
|
||||
depth_stencil->glDescription.level,
|
||||
depth_stencil->glDescription.glFormatInternal,
|
||||
0,
|
||||
0,
|
||||
depth_stencil->currentDesc.Width,
|
||||
depth_stencil->currentDesc.Height,
|
||||
0);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_DEPTH_TEXTURE_MODE_ARB, GL_LUMINANCE);
|
||||
glBindTexture(GL_TEXTURE_2D, old_binding);
|
||||
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, This->fbo));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
depth_blt(iface, tmp_texture);
|
||||
checkGLcall("depth_blt");
|
||||
} else {
|
||||
TRACE("Copying offscreen surface to onscreen depth buffer\n");
|
||||
|
||||
GL_EXTCALL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0));
|
||||
checkGLcall("glBindFramebuffer()");
|
||||
depth_blt(iface, depth_stencil->glDescription.textureName);
|
||||
checkGLcall("depth_blt");
|
||||
}
|
||||
This->shader_backend->shader_deselect_depth_blt(iface);
|
||||
}
|
||||
|
||||
static inline void drawStridedInstanced(IWineD3DDevice *iface, WineDirect3DVertexStridedData *sd, UINT numberOfVertices,
|
||||
@@ -710,15 +771,15 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, WineDirect3DVerte
|
||||
|
||||
/* First, figure out how many instances we have to draw */
|
||||
for(i = 0; i < MAX_STREAMS; i++) {
|
||||
/* Look at all non-instanced streams */
|
||||
if(!(stateblock->streamFlags[i] & WINED3DSTREAMSOURCE_INSTANCEDATA) &&
|
||||
stateblock->streamSource[i]) {
|
||||
int inst = stateblock->streamFreq[i];
|
||||
|
||||
if(numInstances && inst != numInstances) {
|
||||
ERR("Two streams specify a different number of instances. Got %d, new is %d\n", numInstances, inst);
|
||||
/* Look at the streams and take the first one which matches */
|
||||
if(((stateblock->streamFlags[i] & WINED3DSTREAMSOURCE_INSTANCEDATA) || (stateblock->streamFlags[i] & WINED3DSTREAMSOURCE_INDEXEDDATA)) && stateblock->streamSource[i]) {
|
||||
/* D3D9 could set streamFreq 0 with (INSTANCEDATA or INDEXEDDATA) and then it is handled as 1. See d3d9/tests/visual.c-> stream_test() */
|
||||
if(stateblock->streamFreq[i] == 0){
|
||||
numInstances = 1;
|
||||
} else {
|
||||
numInstances = stateblock->streamFreq[i]; /* use the specified number of instances from the first matched stream. See d3d9/tests/visual.c-> stream_test() */
|
||||
}
|
||||
numInstances = inst;
|
||||
break; /* break, because only the first suitable value is interesting */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -741,86 +802,7 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, WineDirect3DVerte
|
||||
ptr += (long) vb->resource.allocatedMemory;
|
||||
}
|
||||
|
||||
switch(sd->u.input[instancedData[j]].dwType) {
|
||||
case WINED3DDECLTYPE_FLOAT1:
|
||||
GL_EXTCALL(glVertexAttrib1fvARB(instancedData[j], (float *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_FLOAT2:
|
||||
GL_EXTCALL(glVertexAttrib2fvARB(instancedData[j], (float *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_FLOAT3:
|
||||
GL_EXTCALL(glVertexAttrib3fvARB(instancedData[j], (float *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_FLOAT4:
|
||||
GL_EXTCALL(glVertexAttrib4fvARB(instancedData[j], (float *) ptr));
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_UBYTE4:
|
||||
GL_EXTCALL(glVertexAttrib4ubvARB(instancedData[j], ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_UBYTE4N:
|
||||
case WINED3DDECLTYPE_D3DCOLOR:
|
||||
GL_EXTCALL(glVertexAttrib4NubvARB(instancedData[j], ptr));
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_SHORT2:
|
||||
GL_EXTCALL(glVertexAttrib4svARB(instancedData[j], (GLshort *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_SHORT4:
|
||||
GL_EXTCALL(glVertexAttrib4svARB(instancedData[j], (GLshort *) ptr));
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_SHORT2N:
|
||||
{
|
||||
GLshort s[4] = {((short *) ptr)[0], ((short *) ptr)[1], 0, 1};
|
||||
GL_EXTCALL(glVertexAttrib4NsvARB(instancedData[j], s));
|
||||
break;
|
||||
}
|
||||
case WINED3DDECLTYPE_USHORT2N:
|
||||
{
|
||||
GLushort s[4] = {((unsigned short *) ptr)[0], ((unsigned short *) ptr)[1], 0, 1};
|
||||
GL_EXTCALL(glVertexAttrib4NusvARB(instancedData[j], s));
|
||||
break;
|
||||
}
|
||||
case WINED3DDECLTYPE_SHORT4N:
|
||||
GL_EXTCALL(glVertexAttrib4NsvARB(instancedData[j], (GLshort *) ptr));
|
||||
break;
|
||||
case WINED3DDECLTYPE_USHORT4N:
|
||||
GL_EXTCALL(glVertexAttrib4NusvARB(instancedData[j], (GLushort *) ptr));
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_UDEC3:
|
||||
FIXME("Unsure about WINED3DDECLTYPE_UDEC3\n");
|
||||
/*glVertexAttrib3usvARB(instancedData[j], (GLushort *) ptr); Does not exist */
|
||||
break;
|
||||
case WINED3DDECLTYPE_DEC3N:
|
||||
FIXME("Unsure about WINED3DDECLTYPE_DEC3N\n");
|
||||
/*glVertexAttrib3NusvARB(instancedData[j], (GLushort *) ptr); Does not exist */
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_FLOAT16_2:
|
||||
/* Are those 16 bit floats. C doesn't have a 16 bit float type. I could read the single bits and calculate a 4
|
||||
* byte float according to the IEEE standard
|
||||
*/
|
||||
if (GL_SUPPORT(NV_HALF_FLOAT)) {
|
||||
GL_EXTCALL(glVertexAttrib2hvNV(instancedData[j], (GLhalfNV *)ptr));
|
||||
} else {
|
||||
FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_2\n");
|
||||
}
|
||||
break;
|
||||
case WINED3DDECLTYPE_FLOAT16_4:
|
||||
if (GL_SUPPORT(NV_HALF_FLOAT)) {
|
||||
GL_EXTCALL(glVertexAttrib4hvNV(instancedData[j], (GLhalfNV *)ptr));
|
||||
} else {
|
||||
FIXME("Unsupported WINED3DDECLTYPE_FLOAT16_4\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DDECLTYPE_UNUSED:
|
||||
default:
|
||||
ERR("Unexpected declaration in instanced attributes\n");
|
||||
break;
|
||||
}
|
||||
send_attribute(This, sd->u.input[instancedData[j]].dwType, instancedData[j], ptr);
|
||||
}
|
||||
|
||||
glDrawElements(glPrimitiveType, numberOfVertices, idxSize == 2 ? GL_UNSIGNED_SHORT : GL_UNSIGNED_INT,
|
||||
@@ -930,73 +912,35 @@ void drawPrimitive(IWineD3DDevice *iface,
|
||||
int minIndex) {
|
||||
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface;
|
||||
IWineD3DSwapChain *swapchain;
|
||||
IWineD3DBaseTexture *texture = NULL;
|
||||
IWineD3DSurfaceImpl *target;
|
||||
int i;
|
||||
|
||||
/* Signals other modules that a drawing is in progress and the stateblock finalized */
|
||||
This->isInDraw = TRUE;
|
||||
if (NumPrimitives == 0) return;
|
||||
|
||||
/* Invalidate the back buffer memory so LockRect will read it the next time */
|
||||
for(i = 0; i < GL_LIMITS(buffers); i++) {
|
||||
target = (IWineD3DSurfaceImpl *) This->render_targets[i];
|
||||
|
||||
/* TODO: Only do all that if we're going to change anything
|
||||
* Texture container dirtification does not work quite right yet
|
||||
*/
|
||||
if(target /*&& target->Flags & (SFLAG_INTEXTURE | SFLAG_INSYSMEM)*/) {
|
||||
swapchain = NULL;
|
||||
texture = NULL;
|
||||
|
||||
if(i == 0) {
|
||||
IWineD3DSurface_GetContainer((IWineD3DSurface *) target, &IID_IWineD3DSwapChain, (void **)&swapchain);
|
||||
|
||||
/* Need the surface in the drawable! */
|
||||
IWineD3DSurface_LoadLocation((IWineD3DSurface *) target, SFLAG_INDRAWABLE, NULL);
|
||||
|
||||
/* TODO: Move fbo logic to ModifyLocation */
|
||||
IWineD3DSurface_ModifyLocation((IWineD3DSurface *) target, SFLAG_INDRAWABLE, TRUE);
|
||||
if(swapchain) {
|
||||
/* Onscreen target. Invalidate system memory copy and texture copy */
|
||||
IWineD3DSwapChain_Release(swapchain);
|
||||
} else if(wined3d_settings.offscreen_rendering_mode != ORM_FBO) {
|
||||
/* Non-FBO target: Invalidate system copy, texture copy and dirtify the container */
|
||||
/* TODO: Move container dirtification to ModifyLocation */
|
||||
IWineD3DSurface_GetContainer((IWineD3DSurface *) target, &IID_IWineD3DBaseTexture, (void **)&texture);
|
||||
|
||||
if(texture) {
|
||||
IWineD3DBaseTexture_SetDirty(texture, TRUE);
|
||||
IWineD3DTexture_Release(texture);
|
||||
}
|
||||
} else {
|
||||
/* FBO offscreen target. Texture == Drawable */
|
||||
target->Flags |= SFLAG_INTEXTURE;
|
||||
}
|
||||
} else {
|
||||
/* Must be an fbo render target */
|
||||
IWineD3DSurface_ModifyLocation((IWineD3DSurface *) target, SFLAG_INDRAWABLE, TRUE);
|
||||
target->Flags |= SFLAG_INTEXTURE;
|
||||
}
|
||||
if (target) {
|
||||
IWineD3DSurface_LoadLocation((IWineD3DSurface *) target, SFLAG_INDRAWABLE, NULL);
|
||||
IWineD3DSurface_ModifyLocation((IWineD3DSurface *) target, SFLAG_INDRAWABLE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* Ok, we will be updating the screen from here onwards so grab the lock */
|
||||
|
||||
if (wined3d_settings.offscreen_rendering_mode == ORM_FBO) {
|
||||
ENTER_GL();
|
||||
apply_fbo_state(iface);
|
||||
LEAVE_GL();
|
||||
}
|
||||
/* Signals other modules that a drawing is in progress and the stateblock finalized */
|
||||
This->isInDraw = TRUE;
|
||||
|
||||
ActivateContext(This, This->render_targets[0], CTXUSAGE_DRAWPRIM);
|
||||
ENTER_GL();
|
||||
|
||||
if (This->depth_copy_state == WINED3D_DCS_COPY) {
|
||||
depth_copy(iface);
|
||||
if (This->stencilBufferTarget) {
|
||||
/* Note that this depends on the ActivateContext call above to set
|
||||
* This->render_offscreen properly */
|
||||
DWORD location = This->render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN;
|
||||
surface_load_ds_location(This->stencilBufferTarget, location);
|
||||
surface_modify_ds_location(This->stencilBufferTarget, location);
|
||||
}
|
||||
This->depth_copy_state = WINED3D_DCS_INITIAL;
|
||||
|
||||
/* Ok, we will be updating the screen from here onwards so grab the lock */
|
||||
ENTER_GL();
|
||||
{
|
||||
GLenum glPrimType;
|
||||
BOOL emulation = FALSE;
|
||||
@@ -1011,14 +955,26 @@ void drawPrimitive(IWineD3DDevice *iface,
|
||||
if(!use_vs(This)) {
|
||||
if(!This->strided_streams.u.s.position_transformed && This->activeContext->num_untracked_materials &&
|
||||
This->stateBlock->renderState[WINED3DRS_LIGHTING]) {
|
||||
FIXME("Using software emulation because not all material properties could be tracked\n");
|
||||
static BOOL first = TRUE;
|
||||
if(first) {
|
||||
FIXME("Using software emulation because not all material properties could be tracked\n");
|
||||
first = FALSE;
|
||||
} else {
|
||||
TRACE("Using software emulation because not all material properties could be tracked\n");
|
||||
}
|
||||
emulation = TRUE;
|
||||
}
|
||||
else if(This->activeContext->fog_coord && This->stateBlock->renderState[WINED3DRS_FOGENABLE]) {
|
||||
/* Either write a pipeline replacement shader or convert the specular alpha from unsigned byte
|
||||
* to a float in the vertex buffer
|
||||
*/
|
||||
FIXME("Using software emulation because manual fog coordinates are provided\n");
|
||||
static BOOL first = TRUE;
|
||||
if(first) {
|
||||
FIXME("Using software emulation because manual fog coordinates are provided\n");
|
||||
first = FALSE;
|
||||
} else {
|
||||
TRACE("Using software emulation because manual fog coordinates are provided\n");
|
||||
}
|
||||
emulation = TRUE;
|
||||
}
|
||||
|
||||
@@ -1031,20 +987,31 @@ void drawPrimitive(IWineD3DDevice *iface,
|
||||
|
||||
if (This->useDrawStridedSlow || emulation) {
|
||||
/* Immediate mode drawing */
|
||||
drawStridedSlow(iface, strided, calculatedNumberOfindices,
|
||||
glPrimType, idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
|
||||
if(use_vs(This)) {
|
||||
static BOOL first = TRUE;
|
||||
if(first) {
|
||||
FIXME("Using immediate mode with vertex shaders for half float emulation\n");
|
||||
first = FALSE;
|
||||
} else {
|
||||
TRACE("Using immediate mode with vertex shaders for half float emulation\n");
|
||||
}
|
||||
drawStridedSlowVs(iface, strided, calculatedNumberOfindices, glPrimType,
|
||||
idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
|
||||
} else {
|
||||
drawStridedSlow(iface, strided, calculatedNumberOfindices,
|
||||
glPrimType, idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
|
||||
}
|
||||
} else if(This->instancedDraw) {
|
||||
/* Instancing emulation with mixing immediate mode and arrays */
|
||||
drawStridedInstanced(iface, &This->strided_streams, calculatedNumberOfindices, glPrimType,
|
||||
idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
|
||||
} else {
|
||||
/* Simple array draw call */
|
||||
drawStridedFast(iface, calculatedNumberOfindices, glPrimType,
|
||||
idxData, idxSize, minIndex, StartIdx, StartVertexIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/* Finshed updating the screen, restore lock */
|
||||
/* Finished updating the screen, restore lock */
|
||||
LEAVE_GL();
|
||||
TRACE("Done all gl drawing\n");
|
||||
|
||||
@@ -1057,11 +1024,11 @@ void drawPrimitive(IWineD3DDevice *iface,
|
||||
if (primCounter >= 0) {
|
||||
WINED3DLOCKED_RECT r;
|
||||
char buffer[80];
|
||||
IWineD3DSurface_LockRect(This->renderTarget, &r, NULL, WINED3DLOCK_READONLY);
|
||||
sprintf(buffer, "/tmp/backbuffer_%d.tga", primCounter);
|
||||
IWineD3DSurface_LockRect(This->render_targets[0], &r, NULL, WINED3DLOCK_READONLY);
|
||||
sprintf(buffer, "/tmp/backbuffer_%ld.tga", primCounter);
|
||||
TRACE("Saving screenshot %s\n", buffer);
|
||||
IWineD3DSurface_SaveSnapshot(This->renderTarget, buffer);
|
||||
IWineD3DSurface_UnlockRect(This->renderTarget);
|
||||
IWineD3DSurface_SaveSnapshot(This->render_targets[0], buffer);
|
||||
IWineD3DSurface_UnlockRect(This->render_targets[0]);
|
||||
|
||||
#ifdef SHOW_TEXTURE_MAKEUP
|
||||
{
|
||||
@@ -1069,7 +1036,7 @@ void drawPrimitive(IWineD3DDevice *iface,
|
||||
int textureNo;
|
||||
for (textureNo = 0; textureNo < MAX_COMBINED_SAMPLERS; ++textureNo) {
|
||||
if (This->stateBlock->textures[textureNo] != NULL) {
|
||||
sprintf(buffer, "/tmp/texture_%p_%d_%d.tga", This->stateBlock->textures[textureNo], primCounter, textureNo);
|
||||
sprintf(buffer, "/tmp/texture_%p_%ld_%d.tga", This->stateBlock->textures[textureNo], primCounter, textureNo);
|
||||
TRACE("Saving texture %s\n", buffer);
|
||||
if (IWineD3DBaseTexture_GetType(This->stateBlock->textures[textureNo]) == WINED3DRTYPE_TEXTURE) {
|
||||
IWineD3DTexture_GetSurfaceLevel((IWineD3DTexture *)This->stateBlock->textures[textureNo], 0, &pSur);
|
||||
@@ -1083,7 +1050,7 @@ void drawPrimitive(IWineD3DDevice *iface,
|
||||
}
|
||||
#endif
|
||||
}
|
||||
TRACE("drawprim #%d\n", primCounter);
|
||||
TRACE("drawprim #%ld\n", primCounter);
|
||||
++primCounter;
|
||||
}
|
||||
#endif
|
||||
@@ -1105,11 +1072,11 @@ static void normalize_normal(float *n) {
|
||||
*
|
||||
* The problem is that OpenGL does not offer a direct way to return the tesselated primitives,
|
||||
* and they can't be sent off for rendering directly either. Tesselating is slow, so we want
|
||||
* to chache the patches in a vertex buffer. But more importantly, gl can't bind generated
|
||||
* to cache the patches in a vertex buffer. But more importantly, gl can't bind generated
|
||||
* attributes to numbered shader attributes, so we have to store them and rebind them as needed
|
||||
* in drawprim.
|
||||
*
|
||||
* To read back, the opengl feedback mode is used. This creates a proplem because we want
|
||||
* To read back, the opengl feedback mode is used. This creates a problem because we want
|
||||
* untransformed, unlit vertices, but feedback runs everything through transform and lighting.
|
||||
* Thus disable lighting and set identity matrices to get unmodified colors and positions.
|
||||
* To overcome clipping find the biggest x, y and z values of the vertices in the patch and scale
|
||||
@@ -1316,11 +1283,13 @@ HRESULT tesselate_rectpatch(IWineD3DDeviceImpl *This,
|
||||
|
||||
i = glRenderMode(GL_RENDER);
|
||||
if(i == -1) {
|
||||
LEAVE_GL();
|
||||
ERR("Feedback failed. Expected %d elements back\n", buffer_size);
|
||||
Sleep(10000);
|
||||
HeapFree(GetProcessHeap(), 0, feedbuffer);
|
||||
return WINED3DERR_DRIVERINTERNALERROR;
|
||||
} else if(i != buffer_size) {
|
||||
LEAVE_GL();
|
||||
ERR("Unexpected amount of elements returned. Expected %d, got %d\n", buffer_size, i);
|
||||
Sleep(10000);
|
||||
HeapFree(GetProcessHeap(), 0, feedbuffer);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,6 +5,7 @@
|
||||
* Copyright 2003-2004 Raphael Junqueira
|
||||
* Copyright 2004 Christian Costa
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2007 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -110,6 +111,27 @@ static void WINAPI IWineD3DIndexBufferImpl_PreLoad(IWineD3DIndexBuffer *iface) {
|
||||
IWineD3DResourceImpl_PreLoad((IWineD3DResource *)iface);
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DIndexBufferImpl_UnLoad(IWineD3DIndexBuffer *iface) {
|
||||
IWineD3DIndexBufferImpl *This = (IWineD3DIndexBufferImpl *) iface;
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
/* This is easy: The whole content is shadowed in This->resource.allocatedMemory,
|
||||
* so we only have to destroy the vbo. Only do it if we have a vbo, which implies
|
||||
* that vbos are supported.
|
||||
* (TODO: Make a IWineD3DBuffer base class for index and vertex buffers and share
|
||||
* this code. Also needed for D3D10)
|
||||
*/
|
||||
if(This->vbo) {
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glDeleteBuffersARB(1, &This->vbo));
|
||||
checkGLcall("glDeleteBuffersARB");
|
||||
LEAVE_GL();
|
||||
This->vbo = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static WINED3DRESOURCETYPE WINAPI IWineD3DIndexBufferImpl_GetType(IWineD3DIndexBuffer *iface) {
|
||||
return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
|
||||
}
|
||||
@@ -126,7 +148,7 @@ static HRESULT WINAPI IWineD3DIndexBufferImpl_Lock(IWineD3DIndexBuffer *iface, U
|
||||
TRACE("(%p) : offset %d, size %d, Flags=%x\n", This, OffsetToLock, SizeToLock, Flags);
|
||||
|
||||
InterlockedIncrement(&This->lockcount);
|
||||
*ppbData = (BYTE *)This->resource.allocatedMemory + OffsetToLock;
|
||||
*ppbData = This->resource.allocatedMemory + OffsetToLock;
|
||||
|
||||
if(Flags & (WINED3DLOCK_READONLY | WINED3DLOCK_NO_DIRTY_UPDATE) || This->vbo == 0) {
|
||||
return WINED3D_OK;
|
||||
@@ -158,9 +180,7 @@ static HRESULT WINAPI IWineD3DIndexBufferImpl_Unlock(IWineD3DIndexBuffer *iface)
|
||||
if(locks == 0 && This->vbo && (This->dirtyend - This->dirtystart) > 0) {
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
|
||||
if(device->createParms.BehaviorFlags & WINED3DCREATE_MULTITHREADED) {
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
}
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, This->vbo));
|
||||
@@ -203,6 +223,7 @@ const IWineD3DIndexBufferVtbl IWineD3DIndexBuffer_Vtbl =
|
||||
IWineD3DIndexBufferImpl_SetPriority,
|
||||
IWineD3DIndexBufferImpl_GetPriority,
|
||||
IWineD3DIndexBufferImpl_PreLoad,
|
||||
IWineD3DIndexBufferImpl_UnLoad,
|
||||
IWineD3DIndexBufferImpl_GetType,
|
||||
/* IWineD3DIndexBuffer */
|
||||
IWineD3DIndexBufferImpl_Lock,
|
||||
|
||||
@@ -0,0 +1,825 @@
|
||||
/*
|
||||
* Fixed function pipeline replacement using GL_NV_register_combiners
|
||||
* and GL_NV_texture_shader
|
||||
*
|
||||
* Copyright 2006 Henri Verbeet
|
||||
* Copyright 2008 Stefan Dösinger(for CodeWeavers)
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
#include "config.h"
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "wined3d_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
|
||||
#define GLINFO_LOCATION stateblock->wineD3DDevice->adapter->gl_info
|
||||
void nvts_activate_dimensions(DWORD stage, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
BOOL bumpmap = FALSE;
|
||||
|
||||
if(stage > 0 && (stateblock->textureState[stage - 1][WINED3DTSS_COLOROP] == WINED3DTOP_BUMPENVMAPLUMINANCE ||
|
||||
stateblock->textureState[stage - 1][WINED3DTSS_COLOROP] == WINED3DTOP_BUMPENVMAP)) {
|
||||
bumpmap = TRUE;
|
||||
context->texShaderBumpMap |= (1 << stage);
|
||||
} else {
|
||||
context->texShaderBumpMap &= ~(1 << stage);
|
||||
}
|
||||
|
||||
if(stateblock->textures[stage]) {
|
||||
switch(stateblock->textureDimensions[stage]) {
|
||||
case GL_TEXTURE_2D:
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_2D);
|
||||
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
|
||||
break;
|
||||
case GL_TEXTURE_RECTANGLE_ARB:
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, bumpmap ? GL_OFFSET_TEXTURE_2D_NV : GL_TEXTURE_RECTANGLE_ARB);
|
||||
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, ...)");
|
||||
break;
|
||||
case GL_TEXTURE_3D:
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D);
|
||||
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_3D)");
|
||||
break;
|
||||
case GL_TEXTURE_CUBE_MAP_ARB:
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB);
|
||||
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_TEXTURE_CUBE_MAP_ARB)");
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
|
||||
checkGLcall("glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE)");
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
GLenum input[3];
|
||||
GLenum mapping[3];
|
||||
GLenum component_usage[3];
|
||||
} tex_op_args;
|
||||
|
||||
static GLenum d3dta_to_combiner_input(DWORD d3dta, DWORD stage, INT texture_idx) {
|
||||
switch (d3dta) {
|
||||
case WINED3DTA_DIFFUSE:
|
||||
return GL_PRIMARY_COLOR_NV;
|
||||
|
||||
case WINED3DTA_CURRENT:
|
||||
if (stage) return GL_SPARE0_NV;
|
||||
else return GL_PRIMARY_COLOR_NV;
|
||||
|
||||
case WINED3DTA_TEXTURE:
|
||||
if (texture_idx > -1) return GL_TEXTURE0_ARB + texture_idx;
|
||||
else return GL_PRIMARY_COLOR_NV;
|
||||
|
||||
case WINED3DTA_TFACTOR:
|
||||
return GL_CONSTANT_COLOR0_NV;
|
||||
|
||||
case WINED3DTA_SPECULAR:
|
||||
return GL_SECONDARY_COLOR_NV;
|
||||
|
||||
case WINED3DTA_TEMP:
|
||||
return GL_SPARE1_NV;
|
||||
|
||||
case WINED3DTA_CONSTANT:
|
||||
/* TODO: Support per stage constants (WINED3DTSS_CONSTANT, NV_register_combiners2) */
|
||||
FIXME("WINED3DTA_CONSTANT, not properly supported.\n");
|
||||
return GL_CONSTANT_COLOR1_NV;
|
||||
|
||||
default:
|
||||
FIXME("Unrecognized texture arg %#x\n", d3dta);
|
||||
return GL_TEXTURE;
|
||||
}
|
||||
}
|
||||
|
||||
static GLenum invert_mapping(GLenum mapping) {
|
||||
if (mapping == GL_UNSIGNED_INVERT_NV) return GL_UNSIGNED_IDENTITY_NV;
|
||||
else if (mapping == GL_UNSIGNED_IDENTITY_NV) return GL_UNSIGNED_INVERT_NV;
|
||||
|
||||
FIXME("Unhandled mapping %#x\n", mapping);
|
||||
return mapping;
|
||||
}
|
||||
|
||||
static void get_src_and_opr_nvrc(DWORD stage, DWORD arg, BOOL is_alpha, GLenum* input, GLenum* mapping, GLenum *component_usage, INT texture_idx) {
|
||||
/* The WINED3DTA_COMPLEMENT flag specifies the complement of the input should
|
||||
* be used. */
|
||||
if (arg & WINED3DTA_COMPLEMENT) *mapping = GL_UNSIGNED_INVERT_NV;
|
||||
else *mapping = GL_UNSIGNED_IDENTITY_NV; /* Clamp all values to positive ranges */
|
||||
|
||||
/* The WINED3DTA_ALPHAREPLICATE flag specifies the alpha component of the input
|
||||
* should be used for all input components. */
|
||||
if (is_alpha || arg & WINED3DTA_ALPHAREPLICATE) *component_usage = GL_ALPHA;
|
||||
else *component_usage = GL_RGB;
|
||||
|
||||
*input = d3dta_to_combiner_input(arg & WINED3DTA_SELECTMASK, stage, texture_idx);
|
||||
}
|
||||
|
||||
void set_tex_op_nvrc(IWineD3DDevice *iface, BOOL is_alpha, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3, INT texture_idx, DWORD dst) {
|
||||
IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl*)iface;
|
||||
tex_op_args tex_op_args = {{0}, {0}, {0}};
|
||||
GLenum portion = is_alpha ? GL_ALPHA : GL_RGB;
|
||||
GLenum target = GL_COMBINER0_NV + stage;
|
||||
GLenum output;
|
||||
IWineD3DStateBlockImpl *stateblock = This->stateBlock; /* For GLINFO_LOCATION */
|
||||
|
||||
TRACE("stage %d, is_alpha %d, op %s, arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d\n",
|
||||
stage, is_alpha, debug_d3dtop(op), arg1, arg2, arg3, texture_idx);
|
||||
|
||||
/* If a texture stage references an invalid texture unit the stage just
|
||||
* passes through the result from the previous stage */
|
||||
if (is_invalid_op(This, stage, op, arg1, arg2, arg3)) {
|
||||
arg1 = WINED3DTA_CURRENT;
|
||||
op = WINED3DTOP_SELECTARG1;
|
||||
}
|
||||
|
||||
get_src_and_opr_nvrc(stage, arg1, is_alpha, &tex_op_args.input[0],
|
||||
&tex_op_args.mapping[0], &tex_op_args.component_usage[0], texture_idx);
|
||||
get_src_and_opr_nvrc(stage, arg2, is_alpha, &tex_op_args.input[1],
|
||||
&tex_op_args.mapping[1], &tex_op_args.component_usage[1], texture_idx);
|
||||
get_src_and_opr_nvrc(stage, arg3, is_alpha, &tex_op_args.input[2],
|
||||
&tex_op_args.mapping[2], &tex_op_args.component_usage[2], texture_idx);
|
||||
|
||||
|
||||
if(dst == WINED3DTA_TEMP) {
|
||||
output = GL_SPARE1_NV;
|
||||
} else {
|
||||
output = GL_SPARE0_NV;
|
||||
}
|
||||
|
||||
/* This is called by a state handler which has the gl lock held and a context for the thread */
|
||||
switch(op)
|
||||
{
|
||||
case WINED3DTOP_DISABLE:
|
||||
/* Only for alpha */
|
||||
if (!is_alpha) ERR("Shouldn't be called for WINED3DTSS_COLOROP (WINED3DTOP_DISABLE)\n");
|
||||
/* Input, prev_alpha*1 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
GL_SPARE0_NV, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_SELECTARG1:
|
||||
case WINED3DTOP_SELECTARG2:
|
||||
/* Input, arg*1 */
|
||||
if (op == WINED3DTOP_SELECTARG1) {
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
} else {
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
}
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MODULATE:
|
||||
case WINED3DTOP_MODULATE2X:
|
||||
case WINED3DTOP_MODULATE4X:
|
||||
/* Input, arg1*arg2 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
if (op == WINED3DTOP_MODULATE) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
} else if (op == WINED3DTOP_MODULATE2X) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_SCALE_BY_TWO_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
} else if (op == WINED3DTOP_MODULATE4X) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_SCALE_BY_FOUR_NV, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DTOP_ADD:
|
||||
case WINED3DTOP_ADDSIGNED:
|
||||
case WINED3DTOP_ADDSIGNED2X:
|
||||
/* Input, arg1*1+arg2*1 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
if (op == WINED3DTOP_ADD) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
} else if (op == WINED3DTOP_ADDSIGNED) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
} else if (op == WINED3DTOP_ADDSIGNED2X) {
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_SCALE_BY_TWO_NV, GL_BIAS_BY_NEGATIVE_ONE_HALF_NV, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DTOP_SUBTRACT:
|
||||
/* Input, arg1*1+-arg2*1 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[1], GL_SIGNED_NEGATE_NV, tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_ADDSMOOTH:
|
||||
/* Input, arg1*1+(1-arg1)*arg2 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_BLENDDIFFUSEALPHA:
|
||||
case WINED3DTOP_BLENDTEXTUREALPHA:
|
||||
case WINED3DTOP_BLENDFACTORALPHA:
|
||||
case WINED3DTOP_BLENDTEXTUREALPHAPM:
|
||||
case WINED3DTOP_BLENDCURRENTALPHA:
|
||||
{
|
||||
GLenum alpha_src = GL_PRIMARY_COLOR_NV;
|
||||
if (op == WINED3DTOP_BLENDDIFFUSEALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_DIFFUSE, stage, texture_idx);
|
||||
else if (op == WINED3DTOP_BLENDTEXTUREALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
|
||||
else if (op == WINED3DTOP_BLENDFACTORALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_TFACTOR, stage, texture_idx);
|
||||
else if (op == WINED3DTOP_BLENDTEXTUREALPHAPM) alpha_src = d3dta_to_combiner_input(WINED3DTA_TEXTURE, stage, texture_idx);
|
||||
else if (op == WINED3DTOP_BLENDCURRENTALPHA) alpha_src = d3dta_to_combiner_input(WINED3DTA_CURRENT, stage, texture_idx);
|
||||
else FIXME("Unhandled WINED3DTOP %s, shouldn't happen\n", debug_d3dtop(op));
|
||||
|
||||
/* Input, arg1*alpha_src+arg2*(1-alpha_src) */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
if (op == WINED3DTOP_BLENDTEXTUREALPHAPM)
|
||||
{
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
} else {
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
alpha_src, GL_UNSIGNED_IDENTITY_NV, GL_ALPHA));
|
||||
}
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
alpha_src, GL_UNSIGNED_INVERT_NV, GL_ALPHA));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
}
|
||||
|
||||
case WINED3DTOP_MODULATEALPHA_ADDCOLOR:
|
||||
/* Input, arg1_alpha*arg2_rgb+arg1_rgb*1 */
|
||||
if (is_alpha) ERR("Only supported for WINED3DTSS_COLOROP (WINED3DTOP_MODULATEALPHA_ADDCOLOR)\n");
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MODULATECOLOR_ADDALPHA:
|
||||
/* Input, arg1_rgb*arg2_rgb+arg1_alpha*1 */
|
||||
if (is_alpha) ERR("Only supported for WINED3DTSS_COLOROP (WINED3DTOP_MODULATECOLOR_ADDALPHA)\n");
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MODULATEINVALPHA_ADDCOLOR:
|
||||
/* Input, (1-arg1_alpha)*arg2_rgb+arg1_rgb*1 */
|
||||
if (is_alpha) ERR("Only supported for WINED3DTSS_COLOROP (WINED3DTOP_MODULATEINVALPHA_ADDCOLOR)\n");
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MODULATEINVCOLOR_ADDALPHA:
|
||||
/* Input, (1-arg1_rgb)*arg2_rgb+arg1_alpha*1 */
|
||||
if (is_alpha) ERR("Only supported for WINED3DTSS_COLOROP (WINED3DTOP_MODULATEINVCOLOR_ADDALPHA)\n");
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], invert_mapping(tex_op_args.mapping[0]), tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], GL_ALPHA));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_DOTPRODUCT3:
|
||||
/* Input, arg1 . arg2 */
|
||||
/* FIXME: DX7 uses a different calculation? */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[0], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[1], GL_EXPAND_NORMAL_NV, tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, output, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_TRUE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_MULTIPLYADD:
|
||||
/* Input, arg3*1+arg1*arg2 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_LERP:
|
||||
/* Input, arg3*arg1+(1-arg3)*arg2 */
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[2], tex_op_args.mapping[2], tex_op_args.component_usage[2]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
tex_op_args.input[0], tex_op_args.mapping[0], tex_op_args.component_usage[0]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_C_NV,
|
||||
tex_op_args.input[2], invert_mapping(tex_op_args.mapping[2]), tex_op_args.component_usage[2]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_D_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
|
||||
/* Output */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_DISCARD_NV, GL_DISCARD_NV,
|
||||
output, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
|
||||
case WINED3DTOP_BUMPENVMAPLUMINANCE:
|
||||
case WINED3DTOP_BUMPENVMAP:
|
||||
if(GL_SUPPORT(NV_TEXTURE_SHADER)) {
|
||||
/* The bump map stage itself isn't exciting, just read the texture. But tell the next stage to
|
||||
* perform bump mapping and source from the current stage. Pretty much a SELECTARG2.
|
||||
* ARG2 is passed through unmodified(apps will most likely use D3DTA_CURRENT for arg2, arg1
|
||||
* (which will most likely be D3DTA_TEXTURE) is available as a texture shader input for the next stage
|
||||
*/
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_A_NV,
|
||||
tex_op_args.input[1], tex_op_args.mapping[1], tex_op_args.component_usage[1]));
|
||||
GL_EXTCALL(glCombinerInputNV(target, portion, GL_VARIABLE_B_NV,
|
||||
GL_ZERO, GL_UNSIGNED_INVERT_NV, portion));
|
||||
/* Always pass through to CURRENT, ignore temp arg */
|
||||
GL_EXTCALL(glCombinerOutputNV(target, portion, GL_SPARE0_NV, GL_DISCARD_NV,
|
||||
GL_DISCARD_NV, GL_NONE, GL_NONE, GL_FALSE, GL_FALSE, GL_FALSE));
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
FIXME("Unhandled WINED3DTOP: stage %d, is_alpha %d, op %s (%#x), arg1 %#x, arg2 %#x, arg3 %#x, texture_idx %d\n",
|
||||
stage, is_alpha, debug_d3dtop(op), op, arg1, arg2, arg3, texture_idx);
|
||||
}
|
||||
|
||||
checkGLcall("set_tex_op_nvrc()\n");
|
||||
|
||||
}
|
||||
|
||||
|
||||
static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage];
|
||||
BOOL tex_used = stateblock->wineD3DDevice->fixed_function_usage_map[stage];
|
||||
|
||||
TRACE("Setting color op for stage %d\n", stage);
|
||||
|
||||
if (stateblock->pixelShader && stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE &&
|
||||
((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function) {
|
||||
/* Using a pixel shader? Don't care for anything here, the shader applying does it */
|
||||
return;
|
||||
}
|
||||
|
||||
if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage);
|
||||
|
||||
if (mapped_stage != -1) {
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
if (tex_used && mapped_stage >= GL_LIMITS(textures)) {
|
||||
FIXME("Attempt to enable unsupported stage!\n");
|
||||
return;
|
||||
}
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
||||
checkGLcall("glActiveTextureARB");
|
||||
} else if (stage > 0) {
|
||||
WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(stateblock->lowest_disabled_stage > 0) {
|
||||
glEnable(GL_REGISTER_COMBINERS_NV);
|
||||
GL_EXTCALL(glCombinerParameteriNV(GL_NUM_GENERAL_COMBINERS_NV, stateblock->lowest_disabled_stage));
|
||||
} else {
|
||||
glDisable(GL_REGISTER_COMBINERS_NV);
|
||||
}
|
||||
if(stage >= stateblock->lowest_disabled_stage) {
|
||||
TRACE("Stage disabled\n");
|
||||
if (mapped_stage != -1) {
|
||||
/* Disable everything here */
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
checkGLcall("glDisable(GL_TEXTURE_2D)");
|
||||
glDisable(GL_TEXTURE_3D);
|
||||
checkGLcall("glDisable(GL_TEXTURE_3D)");
|
||||
if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) {
|
||||
glDisable(GL_TEXTURE_CUBE_MAP_ARB);
|
||||
checkGLcall("glDisable(GL_TEXTURE_CUBE_MAP_ARB)");
|
||||
}
|
||||
if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) {
|
||||
glDisable(GL_TEXTURE_RECTANGLE_ARB);
|
||||
checkGLcall("glDisable(GL_TEXTURE_RECTANGLE_ARB)");
|
||||
}
|
||||
if(GL_SUPPORT(NV_TEXTURE_SHADER2) && mapped_stage < GL_LIMITS(textures)) {
|
||||
glTexEnvi(GL_TEXTURE_SHADER_NV, GL_SHADER_OPERATION_NV, GL_NONE);
|
||||
}
|
||||
}
|
||||
/* All done */
|
||||
return;
|
||||
}
|
||||
|
||||
/* The sampler will also activate the correct texture dimensions, so no need to do it here
|
||||
* if the sampler for this stage is dirty
|
||||
*/
|
||||
if(!isStateDirty(context, STATE_SAMPLER(stage))) {
|
||||
if (tex_used) {
|
||||
if(GL_SUPPORT(NV_TEXTURE_SHADER2)) {
|
||||
nvts_activate_dimensions(stage, stateblock, context);
|
||||
} else {
|
||||
texture_activate_dimensions(stage, stateblock, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the texture combiners */
|
||||
set_tex_op_nvrc((IWineD3DDevice *)stateblock->wineD3DDevice, FALSE, stage,
|
||||
stateblock->textureState[stage][WINED3DTSS_COLOROP],
|
||||
stateblock->textureState[stage][WINED3DTSS_COLORARG1],
|
||||
stateblock->textureState[stage][WINED3DTSS_COLORARG2],
|
||||
stateblock->textureState[stage][WINED3DTSS_COLORARG0],
|
||||
mapped_stage,
|
||||
stateblock->textureState[stage][WINED3DTSS_RESULTARG]);
|
||||
|
||||
/* In register combiners bump mapping is done in the stage AFTER the one that has the bump map operation set,
|
||||
* thus the texture shader may have to be updated
|
||||
*/
|
||||
if(GL_SUPPORT(NV_TEXTURE_SHADER2)) {
|
||||
BOOL usesBump = (stateblock->textureState[stage][WINED3DTSS_COLOROP] == WINED3DTOP_BUMPENVMAPLUMINANCE ||
|
||||
stateblock->textureState[stage][WINED3DTSS_COLOROP] == WINED3DTOP_BUMPENVMAP) ? TRUE : FALSE;
|
||||
BOOL usedBump = (context->texShaderBumpMap & 1 << (stage + 1)) ? TRUE : FALSE;
|
||||
if(usesBump != usedBump) {
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage + 1));
|
||||
checkGLcall("glActiveTextureARB");
|
||||
nvts_activate_dimensions(stage + 1, stateblock, context);
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
||||
checkGLcall("glActiveTextureARB");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void nvts_texdim(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD sampler = state - STATE_SAMPLER(0);
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[sampler];
|
||||
|
||||
/* No need to enable / disable anything here for unused samplers. The tex_colorop
|
||||
* handler takes care. Also no action is needed with pixel shaders, or if tex_colorop
|
||||
* will take care of this business
|
||||
*/
|
||||
if(mapped_stage == -1 || mapped_stage >= GL_LIMITS(textures)) return;
|
||||
if(sampler >= stateblock->lowest_disabled_stage) return;
|
||||
if(isStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP))) return;
|
||||
|
||||
nvts_activate_dimensions(sampler, stateblock, context);
|
||||
}
|
||||
|
||||
static void nvts_bumpenvmat(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
DWORD stage = (state - STATE_TEXTURESTAGE(0, 0)) / WINED3D_HIGHEST_TEXTURE_STATE;
|
||||
DWORD mapped_stage = stateblock->wineD3DDevice->texUnitMap[stage + 1];
|
||||
float mat[2][2];
|
||||
|
||||
/* Direct3D sets the matrix in the stage reading the perturbation map. The result is used to
|
||||
* offset the destination stage(always stage + 1 in d3d). In GL_NV_texture_shader, the bump
|
||||
* map offsetting is done in the stage reading the bump mapped texture, and the perturbation
|
||||
* map is read from a specified source stage(always stage - 1 for d3d). Thus set the matrix
|
||||
* for stage + 1. Keep the nvrc tex unit mapping in mind too
|
||||
*/
|
||||
if(mapped_stage < GL_LIMITS(textures)) {
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage));
|
||||
checkGLcall("GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage))");
|
||||
|
||||
/* We can't just pass a pointer to the stateblock to GL due to the different matrix
|
||||
* format(column major vs row major)
|
||||
*/
|
||||
mat[0][0] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT00]);
|
||||
mat[1][0] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT01]);
|
||||
mat[0][1] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT10]);
|
||||
mat[1][1] = *((float *) &stateblock->textureState[stage][WINED3DTSS_BUMPENVMAT11]);
|
||||
glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, (float *) mat);
|
||||
checkGLcall("glTexEnvfv(GL_TEXTURE_SHADER_NV, GL_OFFSET_TEXTURE_MATRIX_NV, mat)");
|
||||
}
|
||||
}
|
||||
|
||||
static void nvrc_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) {
|
||||
float col[4];
|
||||
D3DCOLORTOGLFLOAT4(stateblock->renderState[WINED3DRS_TEXTUREFACTOR], col);
|
||||
GL_EXTCALL(glCombinerParameterfvNV(GL_CONSTANT_COLOR0_NV, &col[0]));
|
||||
}
|
||||
#undef GLINFO_LOCATION
|
||||
|
||||
#define GLINFO_LOCATION (*gl_info)
|
||||
static void nvrc_enable(IWineD3DDevice *iface, BOOL enable) { }
|
||||
|
||||
static void nvts_enable(IWineD3DDevice *iface, BOOL enable) {
|
||||
if(enable) {
|
||||
glEnable(GL_TEXTURE_SHADER_NV);
|
||||
checkGLcall("glEnable(GL_TEXTURE_SHADER_NV)");
|
||||
} else {
|
||||
glDisable(GL_TEXTURE_SHADER_NV);
|
||||
checkGLcall("glDisable(GL_TEXTURE_SHADER_NV)");
|
||||
}
|
||||
}
|
||||
|
||||
static void nvrc_fragment_get_caps(WINED3DDEVTYPE devtype, WineD3D_GL_Info *gl_info, struct fragment_caps *pCaps) {
|
||||
pCaps->TextureOpCaps = WINED3DTEXOPCAPS_ADD |
|
||||
WINED3DTEXOPCAPS_ADDSIGNED |
|
||||
WINED3DTEXOPCAPS_ADDSIGNED2X |
|
||||
WINED3DTEXOPCAPS_MODULATE |
|
||||
WINED3DTEXOPCAPS_MODULATE2X |
|
||||
WINED3DTEXOPCAPS_MODULATE4X |
|
||||
WINED3DTEXOPCAPS_SELECTARG1 |
|
||||
WINED3DTEXOPCAPS_SELECTARG2 |
|
||||
WINED3DTEXOPCAPS_DISABLE |
|
||||
WINED3DTEXOPCAPS_BLENDDIFFUSEALPHA |
|
||||
WINED3DTEXOPCAPS_BLENDTEXTUREALPHA |
|
||||
WINED3DTEXOPCAPS_BLENDFACTORALPHA |
|
||||
WINED3DTEXOPCAPS_BLENDCURRENTALPHA |
|
||||
WINED3DTEXOPCAPS_LERP |
|
||||
WINED3DTEXOPCAPS_SUBTRACT |
|
||||
WINED3DTEXOPCAPS_ADDSMOOTH |
|
||||
WINED3DTEXOPCAPS_MULTIPLYADD |
|
||||
WINED3DTEXOPCAPS_MODULATEALPHA_ADDCOLOR |
|
||||
WINED3DTEXOPCAPS_MODULATECOLOR_ADDALPHA |
|
||||
WINED3DTEXOPCAPS_BLENDTEXTUREALPHAPM |
|
||||
WINED3DTEXOPCAPS_DOTPRODUCT3 |
|
||||
WINED3DTEXOPCAPS_MODULATEINVALPHA_ADDCOLOR |
|
||||
WINED3DTEXOPCAPS_MODULATEINVCOLOR_ADDALPHA;
|
||||
|
||||
if(GL_SUPPORT(NV_TEXTURE_SHADER2)) {
|
||||
/* Bump mapping is supported already in NV_TEXTURE_SHADER, but that extension does
|
||||
* not support 3D textures. This asks for trouble if an app uses both bump mapping
|
||||
* and 3D textures. It also allows us to keep the code simpler by having texture
|
||||
* shaders constantly enabled.
|
||||
*/
|
||||
pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAP;
|
||||
/* TODO: Luminance bump map? */
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* FIXME: Add
|
||||
pCaps->TextureOpCaps |= WINED3DTEXOPCAPS_BUMPENVMAPLUMINANCE
|
||||
WINED3DTEXOPCAPS_PREMODULATE */
|
||||
#endif
|
||||
|
||||
pCaps->MaxTextureBlendStages = GL_LIMITS(texture_stages);
|
||||
pCaps->MaxSimultaneousTextures = GL_LIMITS(textures);
|
||||
|
||||
pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_TSSARGTEMP;
|
||||
|
||||
/* The caps below can be supported but aren't handled yet in utils.c 'd3dta_to_combiner_input', disable them until support is fixed */
|
||||
#if 0
|
||||
if (GL_SUPPORT(NV_REGISTER_COMBINERS2))
|
||||
pCaps->PrimitiveMiscCaps |= WINED3DPMISCCAPS_PERSTAGECONSTANT;
|
||||
#endif
|
||||
}
|
||||
|
||||
static HRESULT nvrc_fragment_alloc(IWineD3DDevice *iface) { return WINED3D_OK; }
|
||||
static void nvrc_fragment_free(IWineD3DDevice *iface) {}
|
||||
|
||||
/* Two fixed function pipeline implementations using GL_NV_register_combiners and
|
||||
* GL_NV_texture_shader. The nvts_fragment_pipeline assumes that both extensions
|
||||
* are available(geforce 3 and newer), while nvrc_fragment_pipeline uses only the
|
||||
* register combiners extension(Pre-GF3).
|
||||
*/
|
||||
|
||||
static BOOL nvts_conv_supported(WINED3DFORMAT fmt) {
|
||||
TRACE("Checking shader format support for format %s: [FAILED]\n", debug_d3dformat(fmt));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const struct StateEntryTemplate nvrc_fragmentstate_template[] = {
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(0, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(0, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(0, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(0, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(1, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(1, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(1, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(1, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(2, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(2, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(2, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(2, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(3, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(3, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(3, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(3, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(4, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(4, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(4, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(4, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(5, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(5, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(5, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(5, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(6, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(6, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(6, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(6, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_COLORARG1), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_COLORARG2), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAARG1), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAARG2), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT01), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT10), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT11), { STATE_TEXTURESTAGE(7, WINED3DTSS_BUMPENVMAT00), nvts_bumpenvmat }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_COLORARG0), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAARG0), { STATE_TEXTURESTAGE(7, WINED3DTSS_ALPHAOP), tex_alphaop }, 0 },
|
||||
{ STATE_TEXTURESTAGE(7, WINED3DTSS_RESULTARG), { STATE_TEXTURESTAGE(7, WINED3DTSS_COLOROP), nvrc_colorop }, 0 },
|
||||
{ STATE_PIXELSHADER, { STATE_PIXELSHADER, apply_pixelshader }, 0 },
|
||||
{ STATE_RENDER(WINED3DRS_SRGBWRITEENABLE), { STATE_PIXELSHADER, apply_pixelshader }, 0 },
|
||||
{ STATE_RENDER(WINED3DRS_TEXTUREFACTOR), { STATE_RENDER(WINED3DRS_TEXTUREFACTOR), nvrc_texfactor }, 0 },
|
||||
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), nvts_texdim }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_SAMPLER(0), { STATE_SAMPLER(0), sampler_texdim }, 0 },
|
||||
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), nvts_texdim }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_SAMPLER(1), { STATE_SAMPLER(1), sampler_texdim }, 0 },
|
||||
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), nvts_texdim }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_SAMPLER(2), { STATE_SAMPLER(2), sampler_texdim }, 0 },
|
||||
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), nvts_texdim }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_SAMPLER(3), { STATE_SAMPLER(3), sampler_texdim }, 0 },
|
||||
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), nvts_texdim }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_SAMPLER(4), { STATE_SAMPLER(4), sampler_texdim }, 0 },
|
||||
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), nvts_texdim }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_SAMPLER(5), { STATE_SAMPLER(5), sampler_texdim }, 0 },
|
||||
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), nvts_texdim }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_SAMPLER(6), { STATE_SAMPLER(6), sampler_texdim }, 0 },
|
||||
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), nvts_texdim }, NV_TEXTURE_SHADER2 },
|
||||
{ STATE_SAMPLER(7), { STATE_SAMPLER(7), sampler_texdim }, 0 },
|
||||
{0 /* Terminate */, { 0, 0 }, 0 },
|
||||
};
|
||||
|
||||
const struct fragment_pipeline nvts_fragment_pipeline = {
|
||||
nvts_enable,
|
||||
nvrc_fragment_get_caps,
|
||||
nvrc_fragment_alloc,
|
||||
nvrc_fragment_free,
|
||||
nvts_conv_supported,
|
||||
nvrc_fragmentstate_template,
|
||||
FALSE /* we cannot disable projected textures. The vertex pipe has to do it */
|
||||
};
|
||||
|
||||
const struct fragment_pipeline nvrc_fragment_pipeline = {
|
||||
nvrc_enable,
|
||||
nvrc_fragment_get_caps,
|
||||
nvrc_fragment_alloc,
|
||||
nvrc_fragment_free,
|
||||
nvts_conv_supported,
|
||||
nvrc_fragmentstate_template,
|
||||
FALSE /* we cannot disable projected textures. The vertex pipe has to do it */
|
||||
};
|
||||
@@ -63,6 +63,7 @@ static ULONG WINAPI IWineD3DPaletteImpl_Release(IWineD3DPalette *iface) {
|
||||
TRACE("(%p)->() decrementing from %u.\n", This, ref + 1);
|
||||
|
||||
if (!ref) {
|
||||
DeleteObject(This->hpal);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
return 0;
|
||||
}
|
||||
@@ -110,6 +111,7 @@ static HRESULT WINAPI IWineD3DPaletteImpl_SetEntries(IWineD3DPalette *iface, DW
|
||||
IWineD3DResourceImpl *res;
|
||||
|
||||
TRACE("(%p)->(%08x,%d,%d,%p)\n",This,Flags,Start,Count,PalEnt);
|
||||
TRACE("Palette flags: %#x\n", This->Flags);
|
||||
|
||||
if (This->Flags & WINEDDPCAPS_8BITENTRIES) {
|
||||
unsigned int i;
|
||||
@@ -121,6 +123,19 @@ static HRESULT WINAPI IWineD3DPaletteImpl_SetEntries(IWineD3DPalette *iface, DW
|
||||
else {
|
||||
memcpy(This->palents+Start, PalEnt, Count * sizeof(PALETTEENTRY));
|
||||
|
||||
/* When WINEDDCAPS_ALLOW256 isn't set we need to override entry 0 with black and 255 with white */
|
||||
if(!(This->Flags & WINEDDPCAPS_ALLOW256))
|
||||
{
|
||||
TRACE("WINEDDPCAPS_ALLOW256 set, overriding palette entry 0 with black and 255 with white\n");
|
||||
This->palents[0].peRed = 0;
|
||||
This->palents[0].peGreen = 0;
|
||||
This->palents[0].peBlue = 0;
|
||||
|
||||
This->palents[255].peRed = 255;
|
||||
This->palents[255].peGreen = 255;
|
||||
This->palents[255].peBlue = 255;
|
||||
}
|
||||
|
||||
if (This->hpal)
|
||||
SetPaletteEntries(This->hpal, Start, Count, This->palents+Start);
|
||||
}
|
||||
@@ -142,17 +157,6 @@ static HRESULT WINAPI IWineD3DPaletteImpl_SetEntries(IWineD3DPalette *iface, DW
|
||||
}
|
||||
}
|
||||
|
||||
/* If the palette is the primary palette, set the entries to the device */
|
||||
if(This->Flags & WINEDDPCAPS_PRIMARYSURFACE) {
|
||||
unsigned int i;
|
||||
IWineD3DDeviceImpl *device = This->wineD3DDevice;
|
||||
PALETTEENTRY *entry = PalEnt;
|
||||
|
||||
for(i = Start; i < Start+Count; i++) {
|
||||
device->palettes[device->currentPalette][i] = *entry++;
|
||||
}
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
@@ -168,8 +172,8 @@ static HRESULT WINAPI IWineD3DPaletteImpl_GetParent(IWineD3DPalette *iface, IUn
|
||||
IWineD3DPaletteImpl *This = (IWineD3DPaletteImpl *)iface;
|
||||
TRACE("(%p)->(%p)\n", This, Parent);
|
||||
|
||||
*Parent = (IUnknown *) This->parent;
|
||||
IUnknown_AddRef( (IUnknown *) This->parent);
|
||||
*Parent = This->parent;
|
||||
IUnknown_AddRef(This->parent);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Copyright 2004 Christian Costa
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2006 Ivan Gyurdiev
|
||||
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -33,14 +34,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
||||
|
||||
#define GLINFO_LOCATION ((IWineD3DDeviceImpl *) This->baseShader.device)->adapter->gl_info
|
||||
|
||||
#if 0 /* Must not be 1 in cvs version */
|
||||
# define PSTRACE(A) TRACE A
|
||||
# define TRACE_VSVECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w)
|
||||
#else
|
||||
# define PSTRACE(A)
|
||||
# define TRACE_VSVECTOR(name)
|
||||
#endif
|
||||
|
||||
#define GLNAME_REQUIRE_GLSL ((const char *)1)
|
||||
|
||||
static HRESULT WINAPI IWineD3DPixelShaderImpl_QueryInterface(IWineD3DPixelShader *iface, REFIID riid, LPVOID *ppobj) {
|
||||
@@ -105,7 +98,7 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_GetFunction(IWineD3DPixelShader*
|
||||
}
|
||||
|
||||
CONST SHADER_OPCODE IWineD3DPixelShaderImpl_shader_ins[] = {
|
||||
/* Arithmethic */
|
||||
/* Arithmetic */
|
||||
{WINED3DSIO_NOP, "nop", "NOP", 0, 0, pshader_hw_map2gl, NULL, 0, 0},
|
||||
{WINED3DSIO_MOV, "mov", "MOV", 1, 2, pshader_hw_map2gl, shader_glsl_mov, 0, 0},
|
||||
{WINED3DSIO_ADD, "add", "ADD", 1, 3, pshader_hw_map2gl, shader_glsl_arith, 0, 0},
|
||||
@@ -280,10 +273,7 @@ static void pshader_set_limits(
|
||||
/** Generate a pixel shader string using either GL_FRAGMENT_PROGRAM_ARB
|
||||
or GLSL and send it to the card */
|
||||
static inline VOID IWineD3DPixelShaderImpl_GenerateShader(
|
||||
IWineD3DPixelShader *iface,
|
||||
shader_reg_maps* reg_maps,
|
||||
CONST DWORD *pFunction) {
|
||||
|
||||
IWineD3DPixelShader *iface) {
|
||||
IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface;
|
||||
SHADER_BUFFER buffer;
|
||||
|
||||
@@ -303,175 +293,7 @@ static inline VOID IWineD3DPixelShaderImpl_GenerateShader(
|
||||
buffer.lineNo = 0;
|
||||
buffer.newline = TRUE;
|
||||
|
||||
if (This->baseShader.shader_mode == SHADER_GLSL) {
|
||||
|
||||
/* Create the hw GLSL shader object and assign it as the baseShader.prgId */
|
||||
GLhandleARB shader_obj = GL_EXTCALL(glCreateShaderObjectARB(GL_FRAGMENT_SHADER_ARB));
|
||||
|
||||
if (GL_SUPPORT(ARB_DRAW_BUFFERS)) {
|
||||
shader_addline(&buffer, "#extension GL_ARB_draw_buffers : enable\n");
|
||||
}
|
||||
|
||||
/* Base Declarations */
|
||||
shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, &buffer, &GLINFO_LOCATION);
|
||||
|
||||
/* Pack 3.0 inputs */
|
||||
if (This->baseShader.hex_version >= WINED3DPS_VERSION(3,0)) {
|
||||
|
||||
if(((IWineD3DDeviceImpl *) This->baseShader.device)->strided_streams.u.s.position_transformed) {
|
||||
This->vertexprocessing = pretransformed;
|
||||
pshader_glsl_input_pack(&buffer, This->semantics_in, iface);
|
||||
} else if(!use_vs((IWineD3DDeviceImpl *) This->baseShader.device)) {
|
||||
This->vertexprocessing = fixedfunction;
|
||||
pshader_glsl_input_pack(&buffer, This->semantics_in, iface);
|
||||
} else {
|
||||
This->vertexprocessing = vertexshader;
|
||||
}
|
||||
}
|
||||
|
||||
/* Base Shader Body */
|
||||
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
|
||||
|
||||
/* Pixel shaders < 2.0 place the resulting color in R0 implicitly */
|
||||
if (This->baseShader.hex_version < WINED3DPS_VERSION(2,0)) {
|
||||
/* Some older cards like GeforceFX ones don't support multiple buffers, so also not gl_FragData */
|
||||
if(GL_SUPPORT(ARB_DRAW_BUFFERS))
|
||||
shader_addline(&buffer, "gl_FragData[0] = R0;\n");
|
||||
else
|
||||
shader_addline(&buffer, "gl_FragColor = R0;\n");
|
||||
}
|
||||
|
||||
/* Pixel shader < 3.0 do not replace the fog stage.
|
||||
* This implements linear fog computation and blending.
|
||||
* TODO: non linear fog
|
||||
* NOTE: gl_Fog.start and gl_Fog.end don't hold fog start s and end e but
|
||||
* -1/(e-s) and e/(e-s) respectively.
|
||||
*/
|
||||
if(This->baseShader.hex_version < WINED3DPS_VERSION(3,0)) {
|
||||
shader_addline(&buffer, "float Fog = clamp(gl_FogFragCoord * gl_Fog.start + gl_Fog.end, 0.0, 1.0);\n");
|
||||
if(GL_SUPPORT(ARB_DRAW_BUFFERS))
|
||||
shader_addline(&buffer, "gl_FragData[0].xyz = mix(gl_Fog.color.xyz, gl_FragData[0].xyz, Fog);\n");
|
||||
else
|
||||
shader_addline(&buffer, "gl_FragColor.xyz = mix(gl_Fog.color.xyz, gl_FragColor.xyz, Fog);\n");
|
||||
}
|
||||
if(This->srgb_enabled) {
|
||||
const char *fragcolor;
|
||||
|
||||
if(GL_SUPPORT(ARB_DRAW_BUFFERS)) {
|
||||
fragcolor = "gl_FragData[0]";
|
||||
} else {
|
||||
fragcolor = "gl_FragColor";
|
||||
}
|
||||
shader_addline(&buffer, "tmp0.xyz = pow(%s.xyz, vec3(%f, %f, %f)) * vec3(%f, %f, %f) - vec3(%f, %f, %f);\n",
|
||||
fragcolor, srgb_pow, srgb_pow, srgb_pow, srgb_mul_high, srgb_mul_high, srgb_mul_high,
|
||||
srgb_sub_high, srgb_sub_high, srgb_sub_high);
|
||||
shader_addline(&buffer, "tmp1.xyz = %s.xyz * srgb_mul_low.xyz;\n", fragcolor);
|
||||
shader_addline(&buffer, "%s.x = %s.x < srgb_comparison.x ? tmp1.x : tmp0.x;\n", fragcolor, fragcolor);
|
||||
shader_addline(&buffer, "%s.y = %s.y < srgb_comparison.y ? tmp1.y : tmp0.y;\n", fragcolor, fragcolor);
|
||||
shader_addline(&buffer, "%s.z = %s.z < srgb_comparison.z ? tmp1.z : tmp0.z;\n", fragcolor, fragcolor);
|
||||
shader_addline(&buffer, "%s = clamp(%s, 0.0, 1.0);\n", fragcolor, fragcolor);
|
||||
}
|
||||
|
||||
shader_addline(&buffer, "}\n");
|
||||
|
||||
TRACE("Compiling shader object %u\n", shader_obj);
|
||||
GL_EXTCALL(glShaderSourceARB(shader_obj, 1, (const char**)&buffer.buffer, NULL));
|
||||
GL_EXTCALL(glCompileShaderARB(shader_obj));
|
||||
print_glsl_info_log(&GLINFO_LOCATION, shader_obj);
|
||||
|
||||
/* Store the shader object */
|
||||
This->baseShader.prgId = shader_obj;
|
||||
|
||||
} else if (This->baseShader.shader_mode == SHADER_ARB) {
|
||||
/* Create the hw ARB shader */
|
||||
shader_addline(&buffer, "!!ARBfp1.0\n");
|
||||
|
||||
shader_addline(&buffer, "TEMP TMP;\n"); /* Used in matrix ops */
|
||||
shader_addline(&buffer, "TEMP TMP2;\n"); /* Used in matrix ops */
|
||||
shader_addline(&buffer, "TEMP TA;\n"); /* Used for modifiers */
|
||||
shader_addline(&buffer, "TEMP TB;\n"); /* Used for modifiers */
|
||||
shader_addline(&buffer, "TEMP TC;\n"); /* Used for modifiers */
|
||||
shader_addline(&buffer, "PARAM coefdiv = { 0.5, 0.25, 0.125, 0.0625 };\n");
|
||||
shader_addline(&buffer, "PARAM coefmul = { 2, 4, 8, 16 };\n");
|
||||
shader_addline(&buffer, "PARAM one = { 1.0, 1.0, 1.0, 1.0 };\n");
|
||||
|
||||
/* Base Declarations */
|
||||
shader_generate_arb_declarations( (IWineD3DBaseShader*) This, reg_maps, &buffer, &GLINFO_LOCATION);
|
||||
|
||||
/* We need two variables for fog blending */
|
||||
shader_addline(&buffer, "TEMP TMP_FOG;\n");
|
||||
if (This->baseShader.hex_version >= WINED3DPS_VERSION(2,0)) {
|
||||
shader_addline(&buffer, "TEMP TMP_COLOR;\n");
|
||||
}
|
||||
|
||||
/* Base Shader Body */
|
||||
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
|
||||
|
||||
/* calculate fog and blend it
|
||||
* NOTE: state.fog.params.y and state.fog.params.z don't hold fog start s and end e but
|
||||
* -1/(e-s) and e/(e-s) respectively.
|
||||
*/
|
||||
shader_addline(&buffer, "MAD_SAT TMP_FOG, fragment.fogcoord, state.fog.params.y, state.fog.params.z;\n");
|
||||
|
||||
if(This->srgb_enabled) {
|
||||
if (This->baseShader.hex_version < WINED3DPS_VERSION(2,0)) {
|
||||
shader_addline(&buffer, "LRP TMP_COLOR.rgb, TMP_FOG.x, R0, state.fog.color;\n");
|
||||
shader_addline(&buffer, "MOV result.color.a, R0.a;\n");
|
||||
} else {
|
||||
shader_addline(&buffer, "LRP TMP_COLOR.rgb, TMP_FOG.x, TMP_COLOR, state.fog.color;\n");
|
||||
shader_addline(&buffer, "MOV result.color.a, TMP_COLOR.a;\n");
|
||||
}
|
||||
/* Perform sRGB write correction. See GLX_EXT_framebuffer_sRGB */
|
||||
|
||||
/* Calculate the > 0.0031308 case */
|
||||
shader_addline(&buffer, "POW TMP.x, TMP_COLOR.x, srgb_pow.x;\n");
|
||||
shader_addline(&buffer, "POW TMP.y, TMP_COLOR.y, srgb_pow.y;\n");
|
||||
shader_addline(&buffer, "POW TMP.z, TMP_COLOR.z, srgb_pow.z;\n");
|
||||
shader_addline(&buffer, "MUL TMP, TMP, srgb_mul_hi;\n");
|
||||
shader_addline(&buffer, "SUB TMP, TMP, srgb_sub_hi;\n");
|
||||
/* Calculate the < case */
|
||||
shader_addline(&buffer, "MUL TMP2, srgb_mul_low, TMP_COLOR;\n");
|
||||
/* Get 1.0 / 0.0 masks for > 0.0031308 and < 0.0031308 */
|
||||
shader_addline(&buffer, "SLT TA, srgb_comparison, TMP_COLOR;\n");
|
||||
shader_addline(&buffer, "SGE TB, srgb_comparison, TMP_COLOR;\n");
|
||||
/* Store the components > 0.0031308 in the destination */
|
||||
shader_addline(&buffer, "MUL TMP_COLOR, TMP, TA;\n");
|
||||
/* Add the components that are < 0.0031308 */
|
||||
shader_addline(&buffer, "MAD result.color.xyz, TMP2, TB, TMP_COLOR;\n");
|
||||
/* [0.0;1.0] clamping. Not needed, this is done implicitly */
|
||||
} else {
|
||||
if (This->baseShader.hex_version < WINED3DPS_VERSION(2,0)) {
|
||||
shader_addline(&buffer, "LRP result.color.rgb, TMP_FOG.x, R0, state.fog.color;\n");
|
||||
shader_addline(&buffer, "MOV result.color.a, R0.a;\n");
|
||||
} else {
|
||||
shader_addline(&buffer, "LRP result.color.rgb, TMP_FOG.x, TMP_COLOR, state.fog.color;\n");
|
||||
shader_addline(&buffer, "MOV result.color.a, TMP_COLOR.a;\n");
|
||||
}
|
||||
}
|
||||
|
||||
shader_addline(&buffer, "END\n");
|
||||
|
||||
/* TODO: change to resource.glObjectHandle or something like that */
|
||||
GL_EXTCALL(glGenProgramsARB(1, &This->baseShader.prgId));
|
||||
|
||||
TRACE("Creating a hw pixel shader, prg=%d\n", This->baseShader.prgId);
|
||||
GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, This->baseShader.prgId));
|
||||
|
||||
TRACE("Created hw pixel shader, prg=%d\n", This->baseShader.prgId);
|
||||
/* Create the program and check for errors */
|
||||
GL_EXTCALL(glProgramStringARB(GL_FRAGMENT_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
buffer.bsize, buffer.buffer));
|
||||
|
||||
if (glGetError() == GL_INVALID_OPERATION) {
|
||||
GLint errPos;
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errPos);
|
||||
FIXME("HW PixelShader Error at position %d: %s\n",
|
||||
errPos, debugstr_a((const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
|
||||
This->baseShader.prgId = -1;
|
||||
}
|
||||
}
|
||||
|
||||
This->needsbumpmat = reg_maps->bumpmat;
|
||||
((IWineD3DDeviceImpl *)This->baseShader.device)->shader_backend->shader_generate_pshader(iface, &buffer);
|
||||
|
||||
#if 1 /* if were using the data buffer of device then we don't need to free it */
|
||||
HeapFree(GetProcessHeap(), 0, buffer.buffer);
|
||||
@@ -514,7 +336,7 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
|
||||
}
|
||||
|
||||
/* Don't do any register mapping magic if it is not needed, or if we can't
|
||||
* achive anything anyway
|
||||
* achieve anything anyway
|
||||
*/
|
||||
if(highest_reg_used < (GL_LIMITS(glsl_varyings) / 4) ||
|
||||
num_regs_used > (GL_LIMITS(glsl_varyings) / 4) ) {
|
||||
@@ -529,6 +351,7 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
|
||||
for(i = 0; i < MAX_REG_INPUT; i++) {
|
||||
This->input_reg_map[i] = i;
|
||||
}
|
||||
This->declared_in_count = highest_reg_used + 1;
|
||||
} else {
|
||||
j = 0;
|
||||
for(i = 0; i < MAX_REG_INPUT; i++) {
|
||||
@@ -539,6 +362,7 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i
|
||||
This->input_reg_map[i] = -1;
|
||||
}
|
||||
}
|
||||
This->declared_in_count = j;
|
||||
}
|
||||
}
|
||||
This->baseShader.load_local_constsF = FALSE;
|
||||
@@ -608,10 +432,11 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_CompileShader(IWineD3DPixelShader
|
||||
}
|
||||
}
|
||||
if(This->baseShader.hex_version >= WINED3DPS_VERSION(3,0)) {
|
||||
if(((IWineD3DDeviceImpl *) This->baseShader.device)->strided_streams.u.s.position_transformed &&
|
||||
This->vertexprocessing != pretransformed) {
|
||||
WARN("Recompiling shader because pretransformed vertices are provided, which wasn't the case before\n");
|
||||
goto recompile;
|
||||
if(((IWineD3DDeviceImpl *) This->baseShader.device)->strided_streams.u.s.position_transformed) {
|
||||
if(This->vertexprocessing != pretransformed) {
|
||||
WARN("Recompiling shader because pretransformed vertices are provided, which wasn't the case before\n");
|
||||
goto recompile;
|
||||
}
|
||||
} else if(!use_vs((IWineD3DDeviceImpl *) This->baseShader.device) &&
|
||||
This->vertexprocessing != fixedfunction) {
|
||||
WARN("Recompiling shader because fixed function vp is in use, which wasn't the case before\n");
|
||||
@@ -657,7 +482,7 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_CompileShader(IWineD3DPixelShader
|
||||
|
||||
/* Generate the HW shader */
|
||||
TRACE("(%p) : Generating hardware program\n", This);
|
||||
IWineD3DPixelShaderImpl_GenerateShader(iface, &This->baseShader.reg_maps, function);
|
||||
IWineD3DPixelShaderImpl_GenerateShader(iface);
|
||||
|
||||
This->baseShader.is_compiled = TRUE;
|
||||
|
||||
|
||||
@@ -2,8 +2,7 @@
|
||||
* IWineD3DQuery implementation
|
||||
*
|
||||
* Copyright 2005 Oliver Stieber
|
||||
*
|
||||
*
|
||||
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -25,8 +24,6 @@
|
||||
#include "wined3d_private.h"
|
||||
|
||||
/*
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/advancedtopics/Queries.asp
|
||||
*
|
||||
* Occlusion Queries:
|
||||
* http://www.gris.uni-tuebingen.de/~bartz/Publications/paper/hww98.pdf
|
||||
* http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
|
||||
@@ -65,6 +62,7 @@ static ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) {
|
||||
TRACE("(%p) : Releasing from %d\n", This, This->ref);
|
||||
ref = InterlockedDecrement(&This->ref);
|
||||
if (ref == 0) {
|
||||
ENTER_GL();
|
||||
if(This->type == WINED3DQUERYTYPE_EVENT) {
|
||||
if(GL_SUPPORT(APPLE_FENCE)) {
|
||||
GL_EXTCALL(glDeleteFencesAPPLE(1, &((WineQueryEventData *)(This->extendedData))->fenceId));
|
||||
@@ -77,6 +75,7 @@ static ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) {
|
||||
GL_EXTCALL(glDeleteQueriesARB(1, &((WineQueryOcclusionData *)(This->extendedData))->queryId));
|
||||
checkGLcall("glDeleteQueriesARB");
|
||||
}
|
||||
LEAVE_GL();
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->extendedData);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
@@ -111,13 +110,6 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
|
||||
TRACE("(%p) : type %#x, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, This->type, pData, dwSize, dwGetDataFlags);
|
||||
|
||||
if(dwSize == 0){
|
||||
/*you can use this method to poll the resource for the query status*/
|
||||
/*We return success(S_OK) if we support a feature, and faikure(S_FALSE) if we don't, just return success and fluff it for now*/
|
||||
return S_OK;
|
||||
}else{
|
||||
}
|
||||
|
||||
switch (This->type){
|
||||
|
||||
case WINED3DQUERYTYPE_VCACHE:
|
||||
@@ -125,6 +117,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
|
||||
WINED3DDEVINFO_VCACHE *data = (WINED3DDEVINFO_VCACHE *)pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_VCACHE\n", This);
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
data->Pattern = WINEMAKEFOURCC('C','A','C','H');
|
||||
data->OptMethod = 0; /*0 get longest strips, 1 optimize vertex cache*/
|
||||
data->CacheSize = 0; /*cache size, only required if OptMethod == 1*/
|
||||
@@ -137,9 +130,10 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
WINED3DDEVINFO_RESOURCEMANAGER *data = (WINED3DDEVINFO_RESOURCEMANAGER *)pData;
|
||||
int i;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_RESOURCEMANAGER\n", This);
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
for(i = 0; i < WINED3DRTYPECOUNT; i++){
|
||||
/*I'm setting the default values to 1 so as to reduce the risk of a div/0 in the caller*/
|
||||
/* isTextureResident could be used to get some of this infomration */
|
||||
/* isTextureResident could be used to get some of this information */
|
||||
data->stats[i].bThrashing = FALSE;
|
||||
data->stats[i].ApproxBytesDownloaded = 1;
|
||||
data->stats[i].NumEvicts = 1;
|
||||
@@ -159,65 +153,17 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
{
|
||||
WINED3DDEVINFO_VERTEXSTATS *data = (WINED3DDEVINFO_VERTEXSTATS *)pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_VERTEXSTATS\n", This);
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
data->NumRenderedTriangles = 1;
|
||||
data->NumExtraClippingTriangles = 1;
|
||||
|
||||
}
|
||||
break;
|
||||
case WINED3DQUERYTYPE_EVENT:
|
||||
{
|
||||
BOOL* data = pData;
|
||||
WineD3DContext *ctx = ((WineQueryEventData *)This->extendedData)->ctx;
|
||||
if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
|
||||
/* See comment in IWineD3DQuery::Issue, event query codeblock */
|
||||
WARN("Query context not active, reporting GPU idle\n");
|
||||
*data = TRUE;
|
||||
} else if(GL_SUPPORT(APPLE_FENCE)) {
|
||||
*data = GL_EXTCALL(glTestFenceAPPLE(((WineQueryEventData *)This->extendedData)->fenceId));
|
||||
checkGLcall("glTestFenceAPPLE");
|
||||
} else if(GL_SUPPORT(NV_FENCE)) {
|
||||
*data = GL_EXTCALL(glTestFenceNV(((WineQueryEventData *)This->extendedData)->fenceId));
|
||||
checkGLcall("glTestFenceNV");
|
||||
} else {
|
||||
WARN("(%p): reporting GPU idle\n", This);
|
||||
*data = TRUE;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WINED3DQUERYTYPE_OCCLUSION:
|
||||
{
|
||||
DWORD* data = pData;
|
||||
if (GL_SUPPORT(ARB_OCCLUSION_QUERY) &&
|
||||
((WineQueryOcclusionData *)This->extendedData)->ctx == This->wineD3DDevice->activeContext &&
|
||||
This->wineD3DDevice->activeContext->tid == GetCurrentThreadId()) {
|
||||
GLuint available;
|
||||
GLuint samples;
|
||||
GLuint queryId = ((WineQueryOcclusionData *)This->extendedData)->queryId;
|
||||
|
||||
GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_AVAILABLE_ARB, &available));
|
||||
checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)\n");
|
||||
TRACE("(%p) : available %d.\n", This, available);
|
||||
|
||||
if (available) {
|
||||
GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_ARB, &samples));
|
||||
checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)\n");
|
||||
TRACE("(%p) : Returning %d samples.\n", This, samples);
|
||||
*data = samples;
|
||||
res = S_OK;
|
||||
} else {
|
||||
res = S_FALSE;
|
||||
}
|
||||
} else {
|
||||
WARN("(%p) : Occlusion queries not supported, or wrong context. Returning 1.\n", This);
|
||||
*data = 1;
|
||||
res = S_OK;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WINED3DQUERYTYPE_TIMESTAMP:
|
||||
{
|
||||
UINT64* data = pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_TIMESTAMP\n", This);
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
*data = 1; /*Don't know what this is supposed to be*/
|
||||
}
|
||||
break;
|
||||
@@ -225,6 +171,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
{
|
||||
BOOL* data = pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_TIMESTAMPDISJOINT\n", This);
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
*data = FALSE; /*Don't know what this is supposed to be*/
|
||||
}
|
||||
break;
|
||||
@@ -232,6 +179,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
{
|
||||
UINT64* data = pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_TIMESTAMPFREQ\n", This);
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
*data = 1; /*Don't know what this is supposed to be*/
|
||||
}
|
||||
break;
|
||||
@@ -239,6 +187,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
{
|
||||
WINED3DDEVINFO_PIPELINETIMINGS *data = (WINED3DDEVINFO_PIPELINETIMINGS *)pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_PIPELINETIMINGS\n", This);
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
|
||||
data->VertexProcessingTimePercent = 1.0f;
|
||||
data->PixelProcessingTimePercent = 1.0f;
|
||||
@@ -251,6 +200,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
WINED3DDEVINFO_INTERFACETIMINGS *data = (WINED3DDEVINFO_INTERFACETIMINGS *)pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_INTERFACETIMINGS\n", This);
|
||||
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
data->WaitingForGPUToUseApplicationResourceTimePercent = 1.0f;
|
||||
data->WaitingForGPUToAcceptMoreCommandsTimePercent = 1.0f;
|
||||
data->WaitingForGPUToStayWithinLatencyTimePercent = 1.0f;
|
||||
@@ -264,6 +214,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
WINED3DDEVINFO_STAGETIMINGS *data = (WINED3DDEVINFO_STAGETIMINGS *)pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_VERTEXTIMINGS\n", This);
|
||||
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
data->MemoryProcessingPercent = 50.0f;
|
||||
data->ComputationProcessingPercent = 50.0f;
|
||||
|
||||
@@ -274,6 +225,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
WINED3DDEVINFO_STAGETIMINGS *data = (WINED3DDEVINFO_STAGETIMINGS *)pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_PIXELTIMINGS\n", This);
|
||||
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
data->MemoryProcessingPercent = 50.0f;
|
||||
data->ComputationProcessingPercent = 50.0f;
|
||||
}
|
||||
@@ -283,6 +235,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
WINED3DDEVINFO_BANDWIDTHTIMINGS *data = (WINED3DDEVINFO_BANDWIDTHTIMINGS *)pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_BANDWIDTHTIMINGS\n", This);
|
||||
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
data->MaxBandwidthUtilized = 1.0f;
|
||||
data->FrontEndUploadMemoryUtilizedPercent = 1.0f;
|
||||
data->VertexRateUtilizedPercent = 1.0f;
|
||||
@@ -295,6 +248,7 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
WINED3DDEVINFO_CACHEUTILIZATION *data = (WINED3DDEVINFO_CACHEUTILIZATION *)pData;
|
||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_CACHEUTILIZATION\n", This);
|
||||
|
||||
if(pData == NULL || dwSize == 0) break;
|
||||
data->TextureCacheHitRate = 1.0f;
|
||||
data->PostTransformVertexCacheHitRate = 1.0f;
|
||||
}
|
||||
@@ -312,6 +266,83 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
||||
return res; /* S_OK if the query data is available*/
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
|
||||
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
|
||||
DWORD* data = pData;
|
||||
HRESULT res;
|
||||
TRACE("(%p) : type D3DQUERY_OCCLUSION, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags);
|
||||
|
||||
if(This->state == QUERY_CREATED) {
|
||||
/* D3D allows GetData on a new query, OpenGL doesn't. So just invent the data ourselves */
|
||||
TRACE("Query wasn't yet started, returning S_OK\n");
|
||||
res = S_OK;
|
||||
if(data) *data = 0;
|
||||
} else if(This->state == QUERY_BUILDING) {
|
||||
/* Msdn says this returns an error, but our tests show that S_FALSE is returned */
|
||||
TRACE("Query is building, returning S_FALSE\n");
|
||||
res = S_FALSE;
|
||||
} else if (GL_SUPPORT(ARB_OCCLUSION_QUERY) &&
|
||||
((WineQueryOcclusionData *)This->extendedData)->ctx == This->wineD3DDevice->activeContext &&
|
||||
This->wineD3DDevice->activeContext->tid == GetCurrentThreadId()) {
|
||||
GLuint available;
|
||||
GLuint samples;
|
||||
GLuint queryId = ((WineQueryOcclusionData *)This->extendedData)->queryId;
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_AVAILABLE_ARB, &available));
|
||||
checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)\n");
|
||||
TRACE("(%p) : available %d.\n", This, available);
|
||||
|
||||
if (available) {
|
||||
if(data) {
|
||||
GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_ARB, &samples));
|
||||
checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)\n");
|
||||
TRACE("(%p) : Returning %d samples.\n", This, samples);
|
||||
*data = samples;
|
||||
}
|
||||
res = S_OK;
|
||||
} else {
|
||||
res = S_FALSE;
|
||||
}
|
||||
LEAVE_GL();
|
||||
} else {
|
||||
WARN("(%p) : Occlusion queries not supported, or wrong context. Returning 1.\n", This);
|
||||
*data = 1;
|
||||
res = S_OK;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
|
||||
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
|
||||
BOOL* data = pData;
|
||||
WineD3DContext *ctx;
|
||||
TRACE("(%p) : type D3DQUERY_EVENT, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags);
|
||||
|
||||
ctx = ((WineQueryEventData *)This->extendedData)->ctx;
|
||||
if(pData == NULL || dwSize == 0) {
|
||||
return S_OK;
|
||||
} if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
|
||||
/* See comment in IWineD3DQuery::Issue, event query codeblock */
|
||||
WARN("Query context not active, reporting GPU idle\n");
|
||||
*data = TRUE;
|
||||
} else if(GL_SUPPORT(APPLE_FENCE)) {
|
||||
ENTER_GL();
|
||||
*data = GL_EXTCALL(glTestFenceAPPLE(((WineQueryEventData *)This->extendedData)->fenceId));
|
||||
checkGLcall("glTestFenceAPPLE");
|
||||
LEAVE_GL();
|
||||
} else if(GL_SUPPORT(NV_FENCE)) {
|
||||
ENTER_GL();
|
||||
*data = GL_EXTCALL(glTestFenceNV(((WineQueryEventData *)This->extendedData)->fenceId));
|
||||
checkGLcall("glTestFenceNV");
|
||||
LEAVE_GL();
|
||||
} else {
|
||||
WARN("(%p): reporting GPU idle\n", This);
|
||||
*data = TRUE;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static DWORD WINAPI IWineD3DQueryImpl_GetDataSize(IWineD3DQuery* iface){
|
||||
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
|
||||
@@ -330,9 +361,6 @@ static DWORD WINAPI IWineD3DQueryImpl_GetDataSize(IWineD3DQuery* iface){
|
||||
case WINED3DQUERYTYPE_EVENT:
|
||||
dataSize = sizeof(BOOL);
|
||||
break;
|
||||
case WINED3DQUERYTYPE_OCCLUSION:
|
||||
dataSize = sizeof(DWORD);
|
||||
break;
|
||||
case WINED3DQUERYTYPE_TIMESTAMP:
|
||||
dataSize = sizeof(UINT64);
|
||||
break;
|
||||
@@ -367,6 +395,17 @@ static DWORD WINAPI IWineD3DQueryImpl_GetDataSize(IWineD3DQuery* iface){
|
||||
return dataSize;
|
||||
}
|
||||
|
||||
static DWORD WINAPI IWineD3DEventQueryImpl_GetDataSize(IWineD3DQuery* iface){
|
||||
TRACE("(%p) : type D3DQUERY_EVENT\n", iface);
|
||||
|
||||
return sizeof(BOOL);
|
||||
}
|
||||
|
||||
static DWORD WINAPI IWineD3DOcclusionQueryImpl_GetDataSize(IWineD3DQuery* iface){
|
||||
TRACE("(%p) : type D3DQUERY_OCCLUSION\n", iface);
|
||||
|
||||
return sizeof(DWORD);
|
||||
}
|
||||
|
||||
static WINED3DQUERYTYPE WINAPI IWineD3DQueryImpl_GetType(IWineD3DQuery* iface){
|
||||
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
|
||||
@@ -374,62 +413,102 @@ static WINED3DQUERYTYPE WINAPI IWineD3DQueryImpl_GetType(IWineD3DQuery* iface){
|
||||
}
|
||||
|
||||
|
||||
static HRESULT WINAPI IWineD3DEventQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
|
||||
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
|
||||
|
||||
TRACE("(%p) : dwIssueFlags %#x, type D3DQUERY_EVENT\n", This, dwIssueFlags);
|
||||
if (dwIssueFlags & WINED3DISSUE_END) {
|
||||
WineD3DContext *ctx = ((WineQueryEventData *)This->extendedData)->ctx;
|
||||
if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
|
||||
/* GL fences can be used only from the context that created them,
|
||||
* so if a different context is active, don't bother setting the query. The penalty
|
||||
* of a context switch is most likely higher than the gain of a correct query result
|
||||
*
|
||||
* If the query is used from a different thread, don't bother creating a multithread
|
||||
* context - there's no point in doing that as the query would be unusable anyway
|
||||
*/
|
||||
WARN("Query context not active\n");
|
||||
} else if(GL_SUPPORT(APPLE_FENCE)) {
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glSetFenceAPPLE(((WineQueryEventData *)This->extendedData)->fenceId));
|
||||
checkGLcall("glSetFenceAPPLE");
|
||||
LEAVE_GL();
|
||||
} else if (GL_SUPPORT(NV_FENCE)) {
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glSetFenceNV(((WineQueryEventData *)This->extendedData)->fenceId, GL_ALL_COMPLETED_NV));
|
||||
checkGLcall("glSetFenceNV");
|
||||
LEAVE_GL();
|
||||
}
|
||||
} else if(dwIssueFlags & WINED3DISSUE_BEGIN) {
|
||||
/* Started implicitly at device creation */
|
||||
ERR("Event query issued with START flag - what to do?\n");
|
||||
}
|
||||
|
||||
if(dwIssueFlags & WINED3DISSUE_BEGIN) {
|
||||
This->state = QUERY_BUILDING;
|
||||
} else {
|
||||
This->state = QUERY_SIGNALLED;
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags) {
|
||||
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
|
||||
|
||||
if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
|
||||
WineD3DContext *ctx = ((WineQueryOcclusionData *)This->extendedData)->ctx;
|
||||
|
||||
if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
|
||||
WARN("Not the owning context, can't start query\n");
|
||||
} else {
|
||||
ENTER_GL();
|
||||
/* This is allowed according to msdn and our tests. Reset the query and restart */
|
||||
if (dwIssueFlags & WINED3DISSUE_BEGIN) {
|
||||
if(This->state == QUERY_BUILDING) {
|
||||
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
|
||||
checkGLcall("glEndQuery()");
|
||||
}
|
||||
|
||||
GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, ((WineQueryOcclusionData *)This->extendedData)->queryId));
|
||||
checkGLcall("glBeginQuery()");
|
||||
}
|
||||
if (dwIssueFlags & WINED3DISSUE_END) {
|
||||
/* Msdn says _END on a non-building occlusion query returns an error, but
|
||||
* our tests show that it returns OK. But OpenGL doesn't like it, so avoid
|
||||
* generating an error
|
||||
*/
|
||||
if(This->state == QUERY_BUILDING) {
|
||||
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
|
||||
checkGLcall("glEndQuery()");
|
||||
}
|
||||
}
|
||||
LEAVE_GL();
|
||||
}
|
||||
} else {
|
||||
FIXME("(%p) : Occlusion queries not supported\n", This);
|
||||
}
|
||||
|
||||
if(dwIssueFlags & WINED3DISSUE_BEGIN) {
|
||||
This->state = QUERY_BUILDING;
|
||||
} else {
|
||||
This->state = QUERY_SIGNALLED;
|
||||
}
|
||||
return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags){
|
||||
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
|
||||
|
||||
TRACE("(%p) : dwIssueFlags %#x, type %#x\n", This, dwIssueFlags, This->type);
|
||||
|
||||
switch (This->type) {
|
||||
case WINED3DQUERYTYPE_OCCLUSION:
|
||||
if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
|
||||
WineD3DContext *ctx = ((WineQueryOcclusionData *)This->extendedData)->ctx;
|
||||
/* The fixme is printed when the app asks for the resulting data */
|
||||
WARN("(%p) : Unhandled query type %#x\n", This, This->type);
|
||||
|
||||
if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
|
||||
WARN("Not the owning context, can't start query\n");
|
||||
} else {
|
||||
if (dwIssueFlags & WINED3DISSUE_BEGIN) {
|
||||
GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, ((WineQueryOcclusionData *)This->extendedData)->queryId));
|
||||
checkGLcall("glBeginQuery()");
|
||||
}
|
||||
if (dwIssueFlags & WINED3DISSUE_END) {
|
||||
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
|
||||
checkGLcall("glEndQuery()");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
FIXME("(%p) : Occlusion queries not supported\n", This);
|
||||
}
|
||||
break;
|
||||
|
||||
case WINED3DQUERYTYPE_EVENT: {
|
||||
if (dwIssueFlags & WINED3DISSUE_END) {
|
||||
WineD3DContext *ctx = ((WineQueryEventData *)This->extendedData)->ctx;
|
||||
if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
|
||||
/* GL fences can be used only from the context that created them,
|
||||
* so if a different context is active, don't bother setting the query. The penalty
|
||||
* of a context switch is most likely higher than the gain of a correct query result
|
||||
*
|
||||
* If the query is used from a different thread, don't bother creating a multithread
|
||||
* context - there's no point in doing that as the query would be unusable anyway
|
||||
*/
|
||||
WARN("Query context not active\n");
|
||||
} else if(GL_SUPPORT(APPLE_FENCE)) {
|
||||
GL_EXTCALL(glSetFenceAPPLE(((WineQueryEventData *)This->extendedData)->fenceId));
|
||||
checkGLcall("glSetFenceAPPLE");
|
||||
} else if (GL_SUPPORT(NV_FENCE)) {
|
||||
GL_EXTCALL(glSetFenceNV(((WineQueryEventData *)This->extendedData)->fenceId, GL_ALL_COMPLETED_NV));
|
||||
checkGLcall("glSetFenceNV");
|
||||
}
|
||||
} else if(dwIssueFlags & WINED3DISSUE_BEGIN) {
|
||||
/* Started implicitly at device creation */
|
||||
ERR("Event query issued with START flag - what to do?\n");
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
/* The fixme is printed when the app asks for the resulting data */
|
||||
WARN("(%p) : Unhandled query type %#x\n", This, This->type);
|
||||
break;
|
||||
if(dwIssueFlags & WINED3DISSUE_BEGIN) {
|
||||
This->state = QUERY_BUILDING;
|
||||
} else {
|
||||
This->state = QUERY_SIGNALLED;
|
||||
}
|
||||
|
||||
return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */
|
||||
@@ -454,3 +533,33 @@ const IWineD3DQueryVtbl IWineD3DQuery_Vtbl =
|
||||
IWineD3DQueryImpl_GetType,
|
||||
IWineD3DQueryImpl_Issue
|
||||
};
|
||||
|
||||
const IWineD3DQueryVtbl IWineD3DEventQuery_Vtbl =
|
||||
{
|
||||
/*** IUnknown methods ***/
|
||||
IWineD3DQueryImpl_QueryInterface,
|
||||
IWineD3DQueryImpl_AddRef,
|
||||
IWineD3DQueryImpl_Release,
|
||||
/*** IWineD3Dquery methods ***/
|
||||
IWineD3DQueryImpl_GetParent,
|
||||
IWineD3DQueryImpl_GetDevice,
|
||||
IWineD3DEventQueryImpl_GetData,
|
||||
IWineD3DEventQueryImpl_GetDataSize,
|
||||
IWineD3DQueryImpl_GetType,
|
||||
IWineD3DEventQueryImpl_Issue
|
||||
};
|
||||
|
||||
const IWineD3DQueryVtbl IWineD3DOcclusionQuery_Vtbl =
|
||||
{
|
||||
/*** IUnknown methods ***/
|
||||
IWineD3DQueryImpl_QueryInterface,
|
||||
IWineD3DQueryImpl_AddRef,
|
||||
IWineD3DQueryImpl_Release,
|
||||
/*** IWineD3Dquery methods ***/
|
||||
IWineD3DQueryImpl_GetParent,
|
||||
IWineD3DQueryImpl_GetDevice,
|
||||
IWineD3DOcclusionQueryImpl_GetData,
|
||||
IWineD3DOcclusionQueryImpl_GetDataSize,
|
||||
IWineD3DQueryImpl_GetType,
|
||||
IWineD3DOcclusionQueryImpl_Issue
|
||||
};
|
||||
|
||||
@@ -88,11 +88,11 @@ void IWineD3DResourceImpl_CleanUp(IWineD3DResource *iface){
|
||||
|
||||
if (This->resource.wineD3DDevice != NULL) {
|
||||
IWineD3DDevice_ResourceReleased((IWineD3DDevice *)This->resource.wineD3DDevice, iface);
|
||||
}/* NOTE: this is not really an error for systemmem resoruces */
|
||||
}/* NOTE: this is not really an error for system memory resources */
|
||||
return;
|
||||
}
|
||||
|
||||
/* IWineD3DResource Interface follow: */
|
||||
/* IWineD3DResource Interface follows: */
|
||||
HRESULT WINAPI IWineD3DResourceImpl_GetDevice(IWineD3DResource *iface, IWineD3DDevice** ppDevice) {
|
||||
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
|
||||
TRACE("(%p) : returning %p\n", This, This->resource.wineD3DDevice);
|
||||
@@ -235,6 +235,11 @@ void WINAPI IWineD3DResourceImpl_PreLoad(IWineD3DResource *iface) {
|
||||
FIXME("(%p) : stub\n", This);
|
||||
}
|
||||
|
||||
void WINAPI IWineD3DResourceImpl_UnLoad(IWineD3DResource *iface) {
|
||||
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
}
|
||||
|
||||
WINED3DRESOURCETYPE WINAPI IWineD3DResourceImpl_GetType(IWineD3DResource *iface) {
|
||||
IWineD3DResourceImpl *This = (IWineD3DResourceImpl *)iface;
|
||||
TRACE("(%p) : returning %d\n", This, This->resource.resourceType);
|
||||
@@ -271,5 +276,6 @@ static const IWineD3DResourceVtbl IWineD3DResource_Vtbl =
|
||||
IWineD3DResourceImpl_SetPriority,
|
||||
IWineD3DResourceImpl_GetPriority,
|
||||
IWineD3DResourceImpl_PreLoad,
|
||||
IWineD3DResourceImpl_UnLoad,
|
||||
IWineD3DResourceImpl_GetType
|
||||
};
|
||||
|
||||
+2656
-1689
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@
|
||||
* Copyright 2002 Raphael Junqueira
|
||||
* Copyright 2004 Jason Edmeades
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2007 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -169,8 +170,7 @@ void stateblock_copy(
|
||||
Dest->viewport = This->viewport;
|
||||
Dest->material = This->material;
|
||||
Dest->pixelShader = This->pixelShader;
|
||||
Dest->glsl_program = This->glsl_program;
|
||||
memcpy(&Dest->scissorRect, &This->scissorRect, sizeof(Dest->scissorRect));
|
||||
Dest->scissorRect = This->scissorRect;
|
||||
|
||||
/* Lights */
|
||||
memset(This->activeLights, 0, sizeof(This->activeLights));
|
||||
@@ -185,7 +185,7 @@ void stateblock_copy(
|
||||
LIST_FOR_EACH(e1, &This->lightMap[l]) {
|
||||
PLIGHTINFOEL *light = LIST_ENTRY(e1, PLIGHTINFOEL, entry), *light2;
|
||||
light2 = HeapAlloc(GetProcessHeap(), 0, sizeof(*light));
|
||||
memcpy(light2, light, sizeof(*light));
|
||||
*light2 = *light;
|
||||
list_add_tail(&Dest->lightMap[l], &light2->entry);
|
||||
if(light2->glIndex != -1) Dest->activeLights[light2->glIndex] = light2;
|
||||
}
|
||||
@@ -342,7 +342,7 @@ static inline void record_lights(IWineD3DStateBlockImpl *This, IWineD3DStateBloc
|
||||
realLight = LIST_ENTRY(f, PLIGHTINFOEL, entry);
|
||||
if(realLight->OriginalIndex == src->OriginalIndex) {
|
||||
if(src->changed) {
|
||||
memcpy(&src->OriginalParms, &realLight->OriginalParms, sizeof(src->OriginalParms));
|
||||
src->OriginalParms = realLight->OriginalParms;
|
||||
}
|
||||
if(src->enabledChanged) {
|
||||
/* Need to double check because enabledChanged does not catch enabled -> disabled -> enabled
|
||||
@@ -367,7 +367,7 @@ static inline void record_lights(IWineD3DStateBlockImpl *This, IWineD3DStateBloc
|
||||
continue;
|
||||
} else if(src->changed) {
|
||||
/* Otherwise assign defaul params */
|
||||
memcpy(&src->OriginalParms, &WINED3D_default_light, sizeof(src->OriginalParms));
|
||||
src->OriginalParms = WINED3D_default_light;
|
||||
} else {
|
||||
/* Not enabled by default */
|
||||
src->glIndex = -1;
|
||||
@@ -477,9 +477,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||
/* Others + Render & Texture */
|
||||
for (i = 0; i < This->num_contained_transform_states; i++) {
|
||||
TRACE("Updating transform %d\n", i);
|
||||
memcpy(&This->transforms[This->contained_transform_states[i]],
|
||||
&targetStateBlock->transforms[This->contained_transform_states[i]],
|
||||
sizeof(WINED3DMATRIX));
|
||||
This->transforms[This->contained_transform_states[i]] =
|
||||
targetStateBlock->transforms[This->contained_transform_states[i]];
|
||||
}
|
||||
|
||||
if (This->changed.indices && ((This->pIndexData != targetStateBlock->pIndexData)
|
||||
@@ -506,14 +505,14 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||
&This->material,
|
||||
sizeof(WINED3DMATERIAL)) != 0) {
|
||||
TRACE("Updating material\n");
|
||||
memcpy(&This->material, &targetStateBlock->material, sizeof(WINED3DMATERIAL));
|
||||
This->material = targetStateBlock->material;
|
||||
}
|
||||
|
||||
if (This->changed.viewport && memcmp(&targetStateBlock->viewport,
|
||||
&This->viewport,
|
||||
sizeof(WINED3DVIEWPORT)) != 0) {
|
||||
TRACE("Updating viewport\n");
|
||||
memcpy(&This->viewport, &targetStateBlock->viewport, sizeof(WINED3DVIEWPORT));
|
||||
This->viewport = targetStateBlock->viewport;
|
||||
}
|
||||
|
||||
if(This->changed.scissorRect && memcmp(&targetStateBlock->scissorRect,
|
||||
@@ -521,7 +520,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||
sizeof(targetStateBlock->scissorRect)))
|
||||
{
|
||||
TRACE("Updating scissor rect\n");
|
||||
memcpy(&targetStateBlock->scissorRect, &This->scissorRect, sizeof(targetStateBlock->scissorRect));
|
||||
targetStateBlock->scissorRect = This->scissorRect;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAX_STREAMS; i++) {
|
||||
@@ -1038,6 +1037,12 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
|
||||
DWORD d;
|
||||
} tmpfloat;
|
||||
unsigned int i;
|
||||
IWineD3DSwapChain *swapchain;
|
||||
IWineD3DSurface *backbuffer;
|
||||
WINED3DSURFACE_DESC desc = {0};
|
||||
UINT width, height;
|
||||
RECT scissorrect;
|
||||
HRESULT hr;
|
||||
|
||||
/* Note this may have a large overhead but it should only be executed
|
||||
once, in order to initialize the complete state of the device and
|
||||
@@ -1047,10 +1052,10 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
|
||||
This->blockType = WINED3DSBT_INIT;
|
||||
|
||||
/* Set some of the defaults for lights, transforms etc */
|
||||
memcpy(&This->transforms[WINED3DTS_PROJECTION], &identity, sizeof(identity));
|
||||
memcpy(&This->transforms[WINED3DTS_VIEW], &identity, sizeof(identity));
|
||||
memcpy(&This->transforms[WINED3DTS_PROJECTION], identity, sizeof(identity));
|
||||
memcpy(&This->transforms[WINED3DTS_VIEW], identity, sizeof(identity));
|
||||
for (i = 0; i < 256; ++i) {
|
||||
memcpy(&This->transforms[WINED3DTS_WORLDMATRIX(i)], &identity, sizeof(identity));
|
||||
memcpy(&This->transforms[WINED3DTS_WORLDMATRIX(i)], identity, sizeof(identity));
|
||||
}
|
||||
|
||||
TRACE("Render states\n");
|
||||
@@ -1194,7 +1199,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
|
||||
/* Texture Stage States - Put directly into state block, we will call function below */
|
||||
for (i = 0; i < MAX_TEXTURES; i++) {
|
||||
TRACE("Setting up default texture states for texture Stage %d\n", i);
|
||||
memcpy(&This->transforms[WINED3DTS_TEXTURE0 + i], &identity, sizeof(identity));
|
||||
memcpy(&This->transforms[WINED3DTS_TEXTURE0 + i], identity, sizeof(identity));
|
||||
This->textureState[i][WINED3DTSS_COLOROP ] = (i==0)? WINED3DTOP_MODULATE : WINED3DTOP_DISABLE;
|
||||
This->textureState[i][WINED3DTSS_COLORARG1 ] = WINED3DTA_TEXTURE;
|
||||
This->textureState[i][WINED3DTSS_COLORARG2 ] = WINED3DTA_CURRENT;
|
||||
@@ -1234,71 +1239,35 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
|
||||
This->samplerState[i][WINED3DSAMP_DMAPOFFSET ] = 0; /* TODO: Vertex offset in the presampled displacement map */
|
||||
}
|
||||
|
||||
/* Under DirectX you can have texture stage operations even if no texture is
|
||||
bound, whereas opengl will only do texture operations when a valid texture is
|
||||
bound. We emulate this by creating dummy textures and binding them to each
|
||||
texture stage, but disable all stages by default. Hence if a stage is enabled
|
||||
then the default texture will kick in until replaced by a SetTexture call */
|
||||
ENTER_GL();
|
||||
|
||||
if(GL_SUPPORT(APPLE_CLIENT_STORAGE)) {
|
||||
/* The dummy texture does not have client storage backing */
|
||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE);
|
||||
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_FALSE)");
|
||||
}
|
||||
for (i = 0; i < GL_LIMITS(textures); i++) {
|
||||
GLubyte white = 255;
|
||||
|
||||
/* Note this avoids calling settexture, so pretend it has been called */
|
||||
for(i = 0; i < GL_LIMITS(textures); i++) {
|
||||
/* Note: This avoids calling SetTexture, so pretend it has been called */
|
||||
This->changed.textures[i] = TRUE;
|
||||
This->textures[i] = NULL;
|
||||
}
|
||||
|
||||
/* Make appropriate texture active */
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i));
|
||||
checkGLcall("glActiveTextureARB");
|
||||
} else if (i > 0) {
|
||||
FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n");
|
||||
/* Set the default scissor rect values */
|
||||
desc.Width = &width;
|
||||
desc.Height = &height;
|
||||
|
||||
/* check the return values, because the GetBackBuffer call isn't valid for ddraw */
|
||||
hr = IWineD3DDevice_GetSwapChain(device, 0, &swapchain);
|
||||
if( hr == WINED3D_OK && swapchain != NULL) {
|
||||
hr = IWineD3DSwapChain_GetBackBuffer(swapchain, 0, WINED3DBACKBUFFER_TYPE_MONO, &backbuffer);
|
||||
if( hr == WINED3D_OK && backbuffer != NULL) {
|
||||
IWineD3DSurface_GetDesc(backbuffer, &desc);
|
||||
IWineD3DSurface_Release(backbuffer);
|
||||
|
||||
scissorrect.left = 0;
|
||||
scissorrect.right = width;
|
||||
scissorrect.top = 0;
|
||||
scissorrect.bottom = height;
|
||||
hr = IWineD3DDevice_SetScissorRect(device, &scissorrect);
|
||||
if( hr != WINED3D_OK ) {
|
||||
ERR("This should never happen, expect rendering issues!\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* Generate an opengl texture name */
|
||||
glGenTextures(1, &ThisDevice->dummyTextureName[i]);
|
||||
checkGLcall("glGenTextures");
|
||||
TRACE("Dummy Texture %d given name %d\n", i, ThisDevice->dummyTextureName[i]);
|
||||
|
||||
/* Generate a dummy 2d texture (not using 1d because they cause many
|
||||
* DRI drivers fall back to sw) */
|
||||
This->textureDimensions[i] = GL_TEXTURE_2D;
|
||||
glBindTexture(GL_TEXTURE_2D, ThisDevice->dummyTextureName[i]);
|
||||
checkGLcall("glBindTexture");
|
||||
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 1, 1, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, &white);
|
||||
checkGLcall("glTexImage2D");
|
||||
IWineD3DSwapChain_Release(swapchain);
|
||||
}
|
||||
if(GL_SUPPORT(APPLE_CLIENT_STORAGE)) {
|
||||
/* Reenable because if supported it is enabled by default */
|
||||
glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE);
|
||||
checkGLcall("glPixelStorei(GL_UNPACK_CLIENT_STORAGE_APPLE, GL_TRUE)");
|
||||
}
|
||||
|
||||
LEAVE_GL();
|
||||
|
||||
|
||||
/* 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->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->wineD3DDevice->currentPalette = 0;
|
||||
|
||||
/* Set default GLSL program to NULL. We won't actually create one
|
||||
* until the app sets a vertex or pixel shader */
|
||||
This->glsl_program = NULL;
|
||||
|
||||
TRACE("-----------------------> Device defaults now set up...\n");
|
||||
return WINED3D_OK;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
||||
* Copyright 2002-2003 Raphael Junqueira
|
||||
* Copyright 2004 Christian Costa
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2006-2007 Stefan Dösinger for CodeWeavers
|
||||
* Copyright 2006-2008 Stefan Dösinger for CodeWeavers
|
||||
* Copyright 2007 Henri Verbeet
|
||||
* Copyright 2006-2007 Roderick Colenbrander
|
||||
*
|
||||
@@ -34,6 +34,57 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
|
||||
|
||||
/* See also float_16_to_32() in wined3d_private.h */
|
||||
static inline unsigned short float_32_to_16(const float *in)
|
||||
{
|
||||
int exp = 0;
|
||||
float tmp = fabs(*in);
|
||||
unsigned int mantissa;
|
||||
unsigned short ret;
|
||||
|
||||
/* Deal with special numbers */
|
||||
if(*in == 0.0) return 0x0000;
|
||||
if(isnan(*in)) return 0x7C01;
|
||||
if(!finite(*in)) return (*in < 0.0 ? 0xFC00 : 0x7c00);
|
||||
|
||||
if(tmp < pow(2, 10)) {
|
||||
do
|
||||
{
|
||||
tmp = tmp * 2.0;
|
||||
exp--;
|
||||
}while(tmp < pow(2, 10));
|
||||
} else if(tmp >= pow(2, 11)) {
|
||||
do
|
||||
{
|
||||
tmp /= 2.0;
|
||||
exp++;
|
||||
}while(tmp >= pow(2, 11));
|
||||
}
|
||||
|
||||
mantissa = (unsigned int) tmp;
|
||||
if(tmp - mantissa >= 0.5) mantissa++; /* round to nearest, away from zero */
|
||||
|
||||
exp += 10; /* Normalize the mantissa */
|
||||
exp += 15; /* Exponent is encoded with excess 15 */
|
||||
|
||||
if(exp > 30) { /* too big */
|
||||
ret = 0x7c00; /* INF */
|
||||
} else if(exp <= 0) {
|
||||
/* exp == 0: Non-normalized mantissa. Returns 0x0000 (=0.0) for too small numbers */
|
||||
while(exp <= 0) {
|
||||
mantissa = mantissa >> 1;
|
||||
exp++;
|
||||
}
|
||||
ret = mantissa & 0x3ff;
|
||||
} else {
|
||||
ret = (exp << 10) | (mantissa & 0x3ff);
|
||||
}
|
||||
|
||||
ret |= ((*in < 0.0 ? 1 : 0) << 15); /* Add the sign */
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/* Do NOT define GLINFO_LOCATION in this file. THIS CODE MUST NOT USE IT */
|
||||
|
||||
/* *******************************************
|
||||
@@ -197,30 +248,25 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetPalette(IWineD3DSurface *iface, IWineD
|
||||
IWineD3DPaletteImpl *PalImpl = (IWineD3DPaletteImpl *) Pal;
|
||||
TRACE("(%p)->(%p)\n", This, Pal);
|
||||
|
||||
if(This->palette == PalImpl) {
|
||||
TRACE("Nop palette change\n");
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
if(This->palette != NULL)
|
||||
if(This->resource.usage & WINED3DUSAGE_RENDERTARGET)
|
||||
This->palette->Flags &= ~WINEDDPCAPS_PRIMARYSURFACE;
|
||||
|
||||
if(PalImpl != NULL) {
|
||||
if(This->resource.usage & WINED3DUSAGE_RENDERTARGET) {
|
||||
/* Set the device's main palette if the palette
|
||||
* wasn't a primary palette before
|
||||
*/
|
||||
if(!(PalImpl->Flags & WINEDDPCAPS_PRIMARYSURFACE)) {
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
unsigned int i;
|
||||
|
||||
for(i=0; i < 256; i++) {
|
||||
device->palettes[device->currentPalette][i] = PalImpl->palents[i];
|
||||
}
|
||||
}
|
||||
|
||||
(PalImpl)->Flags |= WINEDDPCAPS_PRIMARYSURFACE;
|
||||
}
|
||||
}
|
||||
This->palette = PalImpl;
|
||||
|
||||
return IWineD3DSurface_RealizePalette(iface);
|
||||
if(PalImpl != NULL) {
|
||||
if(This->resource.usage & WINED3DUSAGE_RENDERTARGET) {
|
||||
(PalImpl)->Flags |= WINEDDPCAPS_PRIMARYSURFACE;
|
||||
}
|
||||
|
||||
return IWineD3DSurface_RealizePalette(iface);
|
||||
}
|
||||
else return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetColorKey(IWineD3DSurface *iface, DWORD Flags, WINEDDCOLORKEY *CKey) {
|
||||
@@ -287,45 +333,6 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetPalette(IWineD3DSurface *iface, IWineD
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSurfaceImpl_RealizePalette(IWineD3DSurface *iface) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
|
||||
RGBQUAD col[256];
|
||||
IWineD3DPaletteImpl *pal = This->palette;
|
||||
unsigned int n;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if(This->resource.format == WINED3DFMT_P8 ||
|
||||
This->resource.format == WINED3DFMT_A8P8)
|
||||
{
|
||||
if(!This->Flags & SFLAG_INSYSMEM) {
|
||||
FIXME("Palette changed with surface that does not have an up to date system memory copy\n");
|
||||
}
|
||||
TRACE("Dirtifying surface\n");
|
||||
IWineD3DSurface_ModifyLocation(iface, SFLAG_INSYSMEM, TRUE);
|
||||
}
|
||||
|
||||
if(This->Flags & SFLAG_DIBSECTION) {
|
||||
TRACE("(%p): Updating the hdc's palette\n", This);
|
||||
for (n=0; n<256; n++) {
|
||||
if(pal) {
|
||||
col[n].rgbRed = pal->palents[n].peRed;
|
||||
col[n].rgbGreen = pal->palents[n].peGreen;
|
||||
col[n].rgbBlue = pal->palents[n].peBlue;
|
||||
} else {
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
/* Use the default device palette */
|
||||
col[n].rgbRed = device->palettes[device->currentPalette][n].peRed;
|
||||
col[n].rgbGreen = device->palettes[device->currentPalette][n].peGreen;
|
||||
col[n].rgbBlue = device->palettes[device->currentPalette][n].peBlue;
|
||||
}
|
||||
col[n].rgbReserved = 0;
|
||||
}
|
||||
SetDIBColorTable(This->hDC, 0, 256, col);
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
|
||||
DWORD ret;
|
||||
@@ -350,8 +357,9 @@ DWORD WINAPI IWineD3DBaseSurfaceImpl_GetPitch(IWineD3DSurface *iface) {
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface, LONG X, LONG Y) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
|
||||
LONG w, h;
|
||||
|
||||
FIXME("(%p)->(%d,%d) Stub!\n", This, X, Y);
|
||||
TRACE("(%p)->(%d,%d) Stub!\n", This, X, Y);
|
||||
|
||||
if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))
|
||||
{
|
||||
@@ -359,21 +367,40 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_SetOverlayPosition(IWineD3DSurface *iface
|
||||
return WINEDDERR_NOTAOVERLAYSURFACE;
|
||||
}
|
||||
|
||||
w = This->overlay_destrect.right - This->overlay_destrect.left;
|
||||
h = This->overlay_destrect.bottom - This->overlay_destrect.top;
|
||||
This->overlay_destrect.left = X;
|
||||
This->overlay_destrect.top = Y;
|
||||
This->overlay_destrect.right = X + w;
|
||||
This->overlay_destrect.bottom = Y + h;
|
||||
|
||||
IWineD3DSurface_DrawOverlay(iface);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSurfaceImpl_GetOverlayPosition(IWineD3DSurface *iface, LONG *X, LONG *Y) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("(%p)->(%p,%p) Stub!\n", This, X, Y);
|
||||
TRACE("(%p)->(%p,%p)\n", This, X, Y);
|
||||
|
||||
if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))
|
||||
{
|
||||
TRACE("(%p): Not an overlay surface\n", This);
|
||||
return WINEDDERR_NOTAOVERLAYSURFACE;
|
||||
}
|
||||
if(This->overlay_dest == NULL) {
|
||||
*X = 0; *Y = 0;
|
||||
hr = WINEDDERR_OVERLAYNOTVISIBLE;
|
||||
} else {
|
||||
*X = This->overlay_destrect.left;
|
||||
*Y = This->overlay_destrect.top;
|
||||
hr = WINED3D_OK;
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
TRACE("Returning 0x%08x, position %d, %d\n", hr, *X, *Y);
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *iface, DWORD Flags, IWineD3DSurface *Ref) {
|
||||
@@ -394,14 +421,55 @@ HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlayZOrder(IWineD3DSurface *ifac
|
||||
HRESULT WINAPI IWineD3DBaseSurfaceImpl_UpdateOverlay(IWineD3DSurface *iface, RECT *SrcRect, IWineD3DSurface *DstSurface, RECT *DstRect, DWORD Flags, WINEDDOVERLAYFX *FX) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
|
||||
IWineD3DSurfaceImpl *Dst = (IWineD3DSurfaceImpl *) DstSurface;
|
||||
FIXME("(%p)->(%p, %p, %p, %08x, %p)\n", This, SrcRect, Dst, DstRect, Flags, FX);
|
||||
TRACE("(%p)->(%p, %p, %p, %08x, %p)\n", This, SrcRect, Dst, DstRect, Flags, FX);
|
||||
|
||||
if(!(This->resource.usage & WINED3DUSAGE_OVERLAY))
|
||||
{
|
||||
TRACE("(%p): Not an overlay surface\n", This);
|
||||
WARN("(%p): Not an overlay surface\n", This);
|
||||
return WINEDDERR_NOTAOVERLAYSURFACE;
|
||||
} else if(!DstSurface) {
|
||||
WARN("(%p): Dest surface is NULL\n", This);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if(SrcRect) {
|
||||
This->overlay_srcrect = *SrcRect;
|
||||
} else {
|
||||
This->overlay_srcrect.left = 0;
|
||||
This->overlay_srcrect.top = 0;
|
||||
This->overlay_srcrect.right = This->currentDesc.Width;
|
||||
This->overlay_srcrect.bottom = This->currentDesc.Height;
|
||||
}
|
||||
|
||||
if(DstRect) {
|
||||
This->overlay_destrect = *DstRect;
|
||||
} else {
|
||||
This->overlay_destrect.left = 0;
|
||||
This->overlay_destrect.top = 0;
|
||||
This->overlay_destrect.right = Dst ? Dst->currentDesc.Width : 0;
|
||||
This->overlay_destrect.bottom = Dst ? Dst->currentDesc.Height : 0;
|
||||
}
|
||||
|
||||
if(This->overlay_dest && (This->overlay_dest != Dst || Flags & WINEDDOVER_HIDE)) {
|
||||
list_remove(&This->overlay_entry);
|
||||
}
|
||||
|
||||
if(Flags & WINEDDOVER_SHOW) {
|
||||
if(This->overlay_dest != Dst) {
|
||||
This->overlay_dest = Dst;
|
||||
list_add_tail(&Dst->overlays, &This->overlay_entry);
|
||||
}
|
||||
} else if(Flags & WINEDDOVER_HIDE) {
|
||||
/* tests show that the rectangles are erased on hide */
|
||||
This->overlay_srcrect.left = 0; This->overlay_srcrect.top = 0;
|
||||
This->overlay_srcrect.right = 0; This->overlay_srcrect.bottom = 0;
|
||||
This->overlay_destrect.left = 0; This->overlay_destrect.top = 0;
|
||||
This->overlay_destrect.right = 0; This->overlay_destrect.bottom = 0;
|
||||
This->overlay_dest = NULL;
|
||||
}
|
||||
|
||||
IWineD3DSurface_DrawOverlay(iface);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
@@ -537,7 +605,7 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
||||
b_info->bmiHeader.biClrImportant = 0;
|
||||
|
||||
/* Get the bit masks */
|
||||
masks = (DWORD *) &(b_info->bmiColors);
|
||||
masks = (DWORD *)b_info->bmiColors;
|
||||
switch (This->resource.format) {
|
||||
case WINED3DFMT_R8G8B8:
|
||||
usage = DIB_RGB_COLORS;
|
||||
@@ -589,7 +657,7 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
||||
TRACE("DIBSection at : %p\n", This->dib.bitmap_data);
|
||||
/* copy the existing surface to the dib section */
|
||||
if(This->resource.allocatedMemory) {
|
||||
memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, b_info->bmiHeader.biSizeImage);
|
||||
memcpy(This->dib.bitmap_data, This->resource.allocatedMemory, This->currentDesc.Height * IWineD3DSurface_GetPitch(iface));
|
||||
} else {
|
||||
/* This is to make LockRect read the gl Texture although memory is allocated */
|
||||
This->Flags &= ~SFLAG_INSYSMEM;
|
||||
@@ -614,6 +682,111 @@ HRESULT IWineD3DBaseSurfaceImpl_CreateDIBSection(IWineD3DSurface *iface) {
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
void convert_r32f_r16f(BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h) {
|
||||
unsigned int x, y;
|
||||
float *src_f;
|
||||
unsigned short *dst_s;
|
||||
|
||||
TRACE("Converting %dx%d pixels, pitches %d %d\n", w, h, pitch_in, pitch_out);
|
||||
for(y = 0; y < h; y++) {
|
||||
src_f = (float *) (src + y * pitch_in);
|
||||
dst_s = (unsigned short *) (dst + y * pitch_out);
|
||||
for(x = 0; x < w; x++) {
|
||||
dst_s[x] = float_32_to_16(src_f + x);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct d3dfmt_convertor_desc {
|
||||
WINED3DFORMAT from, to;
|
||||
void (*convert)(BYTE *src, BYTE *dst, DWORD pitch_in, DWORD pitch_out, unsigned int w, unsigned int h);
|
||||
};
|
||||
|
||||
struct d3dfmt_convertor_desc convertors[] = {
|
||||
{WINED3DFMT_R32F, WINED3DFMT_R16F, convert_r32f_r16f},
|
||||
};
|
||||
|
||||
static inline struct d3dfmt_convertor_desc *find_convertor(WINED3DFORMAT from, WINED3DFORMAT to) {
|
||||
unsigned int i;
|
||||
for(i = 0; i < (sizeof(convertors) / sizeof(convertors[0])); i++) {
|
||||
if(convertors[i].from == from && convertors[i].to == to) {
|
||||
return &convertors[i];
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* surface_convert_format
|
||||
*
|
||||
* Creates a duplicate of a surface in a different format. Is used by Blt to
|
||||
* blit between surfaces with different formats
|
||||
*
|
||||
* Parameters
|
||||
* source: Source surface
|
||||
* fmt: Requested destination format
|
||||
*
|
||||
*****************************************************************************/
|
||||
IWineD3DSurfaceImpl *surface_convert_format(IWineD3DSurfaceImpl *source, WINED3DFORMAT to_fmt) {
|
||||
IWineD3DSurface *ret = NULL;
|
||||
struct d3dfmt_convertor_desc *conv;
|
||||
WINED3DLOCKED_RECT lock_src, lock_dst;
|
||||
HRESULT hr;
|
||||
|
||||
conv = find_convertor(source->resource.format, to_fmt);
|
||||
if(!conv) {
|
||||
FIXME("Cannot find a conversion function from format %s to %s\n",
|
||||
debug_d3dformat(source->resource.format), debug_d3dformat(to_fmt));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
IWineD3DDevice_CreateSurface((IWineD3DDevice *) source->resource.wineD3DDevice,
|
||||
source->currentDesc.Width,
|
||||
source->currentDesc.Height,
|
||||
to_fmt,
|
||||
TRUE, /* lockable */
|
||||
TRUE, /* discard */
|
||||
0, /* level */
|
||||
&ret,
|
||||
WINED3DRTYPE_SURFACE,
|
||||
0, /* usage */
|
||||
WINED3DPOOL_SCRATCH,
|
||||
WINED3DMULTISAMPLE_NONE, /* TODO: Multisampled conversion */
|
||||
0, /* MultiSampleQuality */
|
||||
NULL, /* SharedHandle */
|
||||
IWineD3DSurface_GetImplType((IWineD3DSurface *) source),
|
||||
NULL); /* parent */
|
||||
if(!ret) {
|
||||
ERR("Failed to create a destination surface for conversion\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
memset(&lock_src, 0, sizeof(lock_src));
|
||||
memset(&lock_dst, 0, sizeof(lock_dst));
|
||||
|
||||
hr = IWineD3DSurface_LockRect((IWineD3DSurface *) source, &lock_src, NULL, WINED3DLOCK_READONLY);
|
||||
if(FAILED(hr)) {
|
||||
ERR("Failed to lock the source surface\n");
|
||||
IWineD3DSurface_Release(ret);
|
||||
return NULL;
|
||||
}
|
||||
hr = IWineD3DSurface_LockRect(ret, &lock_dst, NULL, WINED3DLOCK_READONLY);
|
||||
if(FAILED(hr)) {
|
||||
ERR("Failed to lock the dest surface\n");
|
||||
IWineD3DSurface_UnlockRect((IWineD3DSurface *) source);
|
||||
IWineD3DSurface_Release(ret);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
conv->convert(lock_src.pBits, lock_dst.pBits, lock_src.Pitch, lock_dst.Pitch,
|
||||
source->currentDesc.Width, source->currentDesc.Height);
|
||||
|
||||
IWineD3DSurface_UnlockRect(ret);
|
||||
IWineD3DSurface_UnlockRect((IWineD3DSurface *) source);
|
||||
|
||||
return (IWineD3DSurfaceImpl *) ret;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* _Blt_ColorFill
|
||||
*
|
||||
@@ -651,7 +824,7 @@ static HRESULT
|
||||
case 2: COLORFILL_ROW(WORD)
|
||||
case 3:
|
||||
{
|
||||
BYTE *d = (BYTE *) buf;
|
||||
BYTE *d = buf;
|
||||
for (x = 0; x < width; x++,d+=3)
|
||||
{
|
||||
d[0] = (color ) & 0xFF;
|
||||
@@ -738,51 +911,53 @@ IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface,
|
||||
FIXME("Filters not supported in software blit\n");
|
||||
}
|
||||
|
||||
if (Src == This)
|
||||
/* First check for the validity of source / destination rectangles. This was
|
||||
* verified using a test application + by MSDN.
|
||||
*/
|
||||
if ((Src != NULL) && (SrcRect != NULL) &&
|
||||
((SrcRect->bottom > Src->currentDesc.Height)||(SrcRect->bottom < 0) ||
|
||||
(SrcRect->top > Src->currentDesc.Height)||(SrcRect->top < 0) ||
|
||||
(SrcRect->left > Src->currentDesc.Width) ||(SrcRect->left < 0) ||
|
||||
(SrcRect->right > Src->currentDesc.Width) ||(SrcRect->right < 0) ||
|
||||
(SrcRect->right < SrcRect->left) ||(SrcRect->bottom < SrcRect->top)))
|
||||
{
|
||||
IWineD3DSurface_LockRect(iface, &dlock, NULL, 0);
|
||||
dfmt = This->resource.format;
|
||||
slock = dlock;
|
||||
sfmt = dfmt;
|
||||
sEntry = getFormatDescEntry(sfmt, NULL, NULL);
|
||||
dEntry = sEntry;
|
||||
WARN("Application gave us bad source rectangle for Blt.\n");
|
||||
return WINEDDERR_INVALIDRECT;
|
||||
}
|
||||
else
|
||||
/* For the Destination rect, it can be out of bounds on the condition that a clipper
|
||||
* is set for the given surface.
|
||||
*/
|
||||
if ((/*This->clipper == NULL*/ TRUE) && (DestRect) &&
|
||||
((DestRect->bottom > This->currentDesc.Height)||(DestRect->bottom < 0) ||
|
||||
(DestRect->top > This->currentDesc.Height)||(DestRect->top < 0) ||
|
||||
(DestRect->left > This->currentDesc.Width) ||(DestRect->left < 0) ||
|
||||
(DestRect->right > This->currentDesc.Width) ||(DestRect->right < 0) ||
|
||||
(DestRect->right < DestRect->left) ||(DestRect->bottom < DestRect->top)))
|
||||
{
|
||||
if (Src)
|
||||
{
|
||||
IWineD3DSurface_LockRect(SrcSurface, &slock, NULL, WINED3DLOCK_READONLY);
|
||||
sfmt = Src->resource.format;
|
||||
}
|
||||
sEntry = getFormatDescEntry(sfmt, NULL, NULL);
|
||||
dfmt = This->resource.format;
|
||||
dEntry = getFormatDescEntry(dfmt, NULL, NULL);
|
||||
IWineD3DSurface_LockRect(iface, &dlock,NULL,0);
|
||||
WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n");
|
||||
return WINEDDERR_INVALIDRECT;
|
||||
}
|
||||
|
||||
if (!DDBltFx || !(DDBltFx->dwDDFX)) Flags &= ~WINEDDBLT_DDFX;
|
||||
/* Now handle negative values in the rectangles. Warning: only supported for now
|
||||
in the 'simple' cases (ie not in any stretching / rotation cases).
|
||||
|
||||
if (sEntry->isFourcc && dEntry->isFourcc)
|
||||
First, the case where nothing is to be done.
|
||||
*/
|
||||
if ((DestRect && ((DestRect->bottom <= 0) || (DestRect->right <= 0) ||
|
||||
(DestRect->top >= (int) This->currentDesc.Height) ||
|
||||
(DestRect->left >= (int) This->currentDesc.Width))) ||
|
||||
((Src != NULL) && (SrcRect != NULL) &&
|
||||
((SrcRect->bottom <= 0) || (SrcRect->right <= 0) ||
|
||||
(SrcRect->top >= (int) Src->currentDesc.Height) ||
|
||||
(SrcRect->left >= (int) Src->currentDesc.Width)) ))
|
||||
{
|
||||
if (sfmt != dfmt)
|
||||
{
|
||||
FIXME("FOURCC->FOURCC copy only supported for the same type of surface\n");
|
||||
ret = WINED3DERR_WRONGTEXTUREFORMAT;
|
||||
goto release;
|
||||
}
|
||||
memcpy(dlock.pBits, slock.pBits, This->resource.size);
|
||||
goto release;
|
||||
}
|
||||
|
||||
if (sEntry->isFourcc && !dEntry->isFourcc)
|
||||
{
|
||||
FIXME("DXTC decompression not supported right now\n");
|
||||
goto release;
|
||||
TRACE("Nothing to be done !\n");
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
if (DestRect)
|
||||
{
|
||||
memcpy(&xdst,DestRect,sizeof(xdst));
|
||||
xdst = *DestRect;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -794,7 +969,7 @@ IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface,
|
||||
|
||||
if (SrcRect)
|
||||
{
|
||||
memcpy(&xsrc,SrcRect,sizeof(xsrc));
|
||||
xsrc = *SrcRect;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -811,54 +986,8 @@ IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface,
|
||||
}
|
||||
}
|
||||
|
||||
/* First check for the validity of source / destination rectangles. This was
|
||||
* verified using a test application + by MSDN.
|
||||
*/
|
||||
if ((Src != NULL) &&
|
||||
((xsrc.bottom > Src->currentDesc.Height) || (xsrc.bottom < 0) ||
|
||||
(xsrc.top > Src->currentDesc.Height) || (xsrc.top < 0) ||
|
||||
(xsrc.left > Src->currentDesc.Width) || (xsrc.left < 0) ||
|
||||
(xsrc.right > Src->currentDesc.Width) || (xsrc.right < 0) ||
|
||||
(xsrc.right < xsrc.left) || (xsrc.bottom < xsrc.top)))
|
||||
{
|
||||
WARN("Application gave us bad source rectangle for Blt.\n");
|
||||
ret = WINEDDERR_INVALIDRECT;
|
||||
goto release;
|
||||
}
|
||||
/* For the Destination rect, it can be out of bounds on the condition that a clipper
|
||||
* is set for the given surface.
|
||||
*/
|
||||
if ((/*This->clipper == NULL*/ TRUE) &&
|
||||
((xdst.bottom > This->currentDesc.Height) || (xdst.bottom < 0) ||
|
||||
(xdst.top > This->currentDesc.Height) || (xdst.top < 0) ||
|
||||
(xdst.left > This->currentDesc.Width) || (xdst.left < 0) ||
|
||||
(xdst.right > This->currentDesc.Width) || (xdst.right < 0) ||
|
||||
(xdst.right < xdst.left) || (xdst.bottom < xdst.top)))
|
||||
{
|
||||
WARN("Application gave us bad destination rectangle for Blt without a clipper set.\n");
|
||||
ret = WINEDDERR_INVALIDRECT;
|
||||
goto release;
|
||||
}
|
||||
|
||||
/* Now handle negative values in the rectangles. Warning: only supported for now
|
||||
in the 'simple' cases (ie not in any stretching / rotation cases).
|
||||
|
||||
First, the case where nothing is to be done.
|
||||
*/
|
||||
if (((xdst.bottom <= 0) || (xdst.right <= 0) ||
|
||||
(xdst.top >= (int) This->currentDesc.Height) ||
|
||||
(xdst.left >= (int) This->currentDesc.Width)) ||
|
||||
((Src != NULL) &&
|
||||
((xsrc.bottom <= 0) || (xsrc.right <= 0) ||
|
||||
(xsrc.top >= (int) Src->currentDesc.Height) ||
|
||||
(xsrc.left >= (int) Src->currentDesc.Width)) ))
|
||||
{
|
||||
TRACE("Nothing to be done !\n");
|
||||
goto release;
|
||||
}
|
||||
|
||||
/* The easy case : the source-less blits.... */
|
||||
if (Src == NULL)
|
||||
if (Src == NULL && DestRect)
|
||||
{
|
||||
RECT full_rect;
|
||||
RECT temp_rect; /* No idea if intersect rect can be the same as one of the source rect */
|
||||
@@ -867,44 +996,44 @@ IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface,
|
||||
full_rect.top = 0;
|
||||
full_rect.right = This->currentDesc.Width;
|
||||
full_rect.bottom = This->currentDesc.Height;
|
||||
IntersectRect(&temp_rect, &full_rect, &xdst);
|
||||
IntersectRect(&temp_rect, &full_rect, DestRect);
|
||||
xdst = temp_rect;
|
||||
}
|
||||
else
|
||||
else if (DestRect)
|
||||
{
|
||||
/* Only handle clipping on the destination rectangle */
|
||||
int clip_horiz = (xdst.left < 0) || (xdst.right > (int) This->currentDesc.Width );
|
||||
int clip_vert = (xdst.top < 0) || (xdst.bottom > (int) This->currentDesc.Height);
|
||||
int clip_horiz = (DestRect->left < 0) || (DestRect->right > (int) This->currentDesc.Width );
|
||||
int clip_vert = (DestRect->top < 0) || (DestRect->bottom > (int) This->currentDesc.Height);
|
||||
if (clip_vert || clip_horiz)
|
||||
{
|
||||
/* Now check if this is a special case or not... */
|
||||
if ((((xdst.bottom - xdst.top ) != (xsrc.bottom - xsrc.top )) && clip_vert ) ||
|
||||
(((xdst.right - xdst.left) != (xsrc.right - xsrc.left)) && clip_horiz) ||
|
||||
if ((((DestRect->bottom - DestRect->top ) != (xsrc.bottom - xsrc.top )) && clip_vert ) ||
|
||||
(((DestRect->right - DestRect->left) != (xsrc.right - xsrc.left)) && clip_horiz) ||
|
||||
(Flags & WINEDDBLT_DDFX))
|
||||
{
|
||||
WARN("Out of screen rectangle in special case. Not handled right now.\n");
|
||||
goto release;
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
if (clip_horiz)
|
||||
{
|
||||
if (xdst.left < 0) { xsrc.left -= xdst.left; xdst.left = 0; }
|
||||
if (xdst.right > This->currentDesc.Width)
|
||||
if (DestRect->left < 0) { xsrc.left -= DestRect->left; xdst.left = 0; }
|
||||
if (DestRect->right > This->currentDesc.Width)
|
||||
{
|
||||
xsrc.right -= (xdst.right - (int) This->currentDesc.Width);
|
||||
xsrc.right -= (DestRect->right - (int) This->currentDesc.Width);
|
||||
xdst.right = (int) This->currentDesc.Width;
|
||||
}
|
||||
}
|
||||
if (clip_vert)
|
||||
{
|
||||
if (xdst.top < 0)
|
||||
if (DestRect->top < 0)
|
||||
{
|
||||
xsrc.top -= xdst.top;
|
||||
xsrc.top -= DestRect->top;
|
||||
xdst.top = 0;
|
||||
}
|
||||
if (xdst.bottom > This->currentDesc.Height)
|
||||
if (DestRect->bottom > This->currentDesc.Height)
|
||||
{
|
||||
xsrc.bottom -= (xdst.bottom - (int) This->currentDesc.Height);
|
||||
xsrc.bottom -= (DestRect->bottom - (int) This->currentDesc.Height);
|
||||
xdst.bottom = (int) This->currentDesc.Height;
|
||||
}
|
||||
}
|
||||
@@ -917,11 +1046,55 @@ IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface,
|
||||
(xsrc.left >= (int) Src->currentDesc.Width))
|
||||
{
|
||||
TRACE("Nothing to be done after clipping !\n");
|
||||
goto release;
|
||||
return WINED3D_OK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Src == This)
|
||||
{
|
||||
IWineD3DSurface_LockRect(iface, &dlock, NULL, 0);
|
||||
dfmt = This->resource.format;
|
||||
slock = dlock;
|
||||
sfmt = dfmt;
|
||||
sEntry = getFormatDescEntry(sfmt, NULL, NULL);
|
||||
dEntry = sEntry;
|
||||
}
|
||||
else
|
||||
{
|
||||
dfmt = This->resource.format;
|
||||
dEntry = getFormatDescEntry(dfmt, NULL, NULL);
|
||||
if (Src)
|
||||
{
|
||||
if(This->resource.format != Src->resource.format) {
|
||||
Src = surface_convert_format(Src, dfmt);
|
||||
if(!Src) {
|
||||
/* The conv function writes a FIXME */
|
||||
WARN("Cannot convert source surface format to dest format\n");
|
||||
goto release;
|
||||
}
|
||||
}
|
||||
IWineD3DSurface_LockRect((IWineD3DSurface *) Src, &slock, NULL, WINED3DLOCK_READONLY);
|
||||
sfmt = Src->resource.format;
|
||||
}
|
||||
sEntry = getFormatDescEntry(sfmt, NULL, NULL);
|
||||
if (DestRect)
|
||||
IWineD3DSurface_LockRect(iface, &dlock, &xdst, 0);
|
||||
else
|
||||
IWineD3DSurface_LockRect(iface, &dlock, NULL, 0);
|
||||
}
|
||||
|
||||
if (!DDBltFx || !(DDBltFx->dwDDFX)) Flags &= ~WINEDDBLT_DDFX;
|
||||
|
||||
if (sEntry->isFourcc && dEntry->isFourcc)
|
||||
{
|
||||
if (!DestRect || Src == This)
|
||||
{
|
||||
memcpy(dlock.pBits, slock.pBits, This->resource.size);
|
||||
goto release;
|
||||
}
|
||||
}
|
||||
|
||||
bpp = This->bytesPerPixel;
|
||||
srcheight = xsrc.bottom - xsrc.top;
|
||||
srcwidth = xsrc.right - xsrc.left;
|
||||
@@ -931,7 +1104,10 @@ IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface,
|
||||
|
||||
assert(width <= dlock.Pitch);
|
||||
|
||||
dbuf = (BYTE*)dlock.pBits+(xdst.top*dlock.Pitch)+(xdst.left*bpp);
|
||||
if (DestRect && Src != This)
|
||||
dbuf = (BYTE*)dlock.pBits;
|
||||
else
|
||||
dbuf = (BYTE*)dlock.pBits+(xdst.top*dlock.Pitch)+(xdst.left*bpp);
|
||||
|
||||
if (Flags & WINEDDBLT_WAIT)
|
||||
{
|
||||
@@ -1016,7 +1192,7 @@ IWineD3DBaseSurfaceImpl_Blt(IWineD3DSurface *iface,
|
||||
sbuf = sbase;
|
||||
|
||||
/* check for overlapping surfaces */
|
||||
if (SrcSurface != iface || xdst.top < xsrc.top ||
|
||||
if (Src != This || xdst.top < xsrc.top ||
|
||||
xdst.right <= xsrc.left || xsrc.right <= xdst.left)
|
||||
{
|
||||
/* no overlap, or dst above src, so copy from top downwards */
|
||||
@@ -1304,7 +1480,9 @@ error:
|
||||
|
||||
release:
|
||||
IWineD3DSurface_UnlockRect(iface);
|
||||
if (SrcSurface && SrcSurface != iface) IWineD3DSurface_UnlockRect(SrcSurface);
|
||||
if (Src && Src != This) IWineD3DSurface_UnlockRect((IWineD3DSurface *) Src);
|
||||
/* Release the converted surface if any */
|
||||
if (Src && SrcSurface != (IWineD3DSurface *) Src) IWineD3DSurface_Release((IWineD3DSurface *) Src);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -1427,8 +1605,8 @@ IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface,
|
||||
|
||||
/* Since slock was originally copied from this surface's description, we can just reuse it */
|
||||
assert(This->resource.allocatedMemory != NULL);
|
||||
sbuf = (BYTE *)This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp;
|
||||
dbuf = (BYTE *)This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp;
|
||||
sbuf = This->resource.allocatedMemory + lock_src.top * pitch + lock_src.left * bpp;
|
||||
dbuf = This->resource.allocatedMemory + lock_dst.top * pitch + lock_dst.left * bpp;
|
||||
sEntry = getFormatDescEntry(Src->resource.format, NULL, NULL);
|
||||
dEntry = sEntry;
|
||||
}
|
||||
@@ -1514,8 +1692,8 @@ IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface,
|
||||
{
|
||||
BYTE *d, *s;
|
||||
DWORD tmp;
|
||||
s = (BYTE *) sbuf;
|
||||
d = (BYTE *) dbuf;
|
||||
s = sbuf;
|
||||
d = dbuf;
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
for (x = 0; x < w * 3; x += 3)
|
||||
@@ -1544,13 +1722,28 @@ IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface,
|
||||
else
|
||||
{
|
||||
int width = w * bpp;
|
||||
INT sbufpitch, dbufpitch;
|
||||
|
||||
TRACE("NO color key copy\n");
|
||||
/* Handle overlapping surfaces */
|
||||
if (sbuf < dbuf)
|
||||
{
|
||||
sbuf += (h - 1) * slock.Pitch;
|
||||
dbuf += (h - 1) * dlock.Pitch;
|
||||
sbufpitch = -slock.Pitch;
|
||||
dbufpitch = -dlock.Pitch;
|
||||
}
|
||||
else
|
||||
{
|
||||
sbufpitch = slock.Pitch;
|
||||
dbufpitch = dlock.Pitch;
|
||||
}
|
||||
for (y = 0; y < h; y++)
|
||||
{
|
||||
/* This is pretty easy, a line for line memcpy */
|
||||
memcpy(dbuf, sbuf, width);
|
||||
sbuf += slock.Pitch;
|
||||
dbuf += dlock.Pitch;
|
||||
memmove(dbuf, sbuf, width);
|
||||
sbuf += sbufpitch;
|
||||
dbuf += dbufpitch;
|
||||
}
|
||||
TRACE("Copy done\n");
|
||||
}
|
||||
|
||||
@@ -34,99 +34,6 @@
|
||||
|
||||
/* Use the d3d_surface debug channel to have one channel for all surfaces */
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(fps);
|
||||
|
||||
/*****************************************************************************
|
||||
* x11_copy_to_screen
|
||||
*
|
||||
* Helper function that blts the front buffer contents to the target window
|
||||
*
|
||||
* Params:
|
||||
* This: Surface to copy from
|
||||
* rc: Rectangle to copy
|
||||
*
|
||||
*****************************************************************************/
|
||||
static void
|
||||
x11_copy_to_screen(IWineD3DSurfaceImpl *This,
|
||||
LPRECT rc)
|
||||
{
|
||||
if(This->resource.usage & WINED3DUSAGE_RENDERTARGET)
|
||||
{
|
||||
POINT offset = {0,0};
|
||||
HWND hDisplayWnd;
|
||||
HDC hDisplayDC;
|
||||
HDC hSurfaceDC = 0;
|
||||
RECT drawrect;
|
||||
TRACE("(%p)->(%p): Copying to screen\n", This, rc);
|
||||
|
||||
hSurfaceDC = This->hDC;
|
||||
|
||||
hDisplayWnd = This->resource.wineD3DDevice->ddraw_window;
|
||||
hDisplayDC = GetDCEx(hDisplayWnd, 0, DCX_CLIPSIBLINGS|DCX_CACHE);
|
||||
if(rc)
|
||||
{
|
||||
TRACE(" copying rect (%d,%d)->(%d,%d), offset (%d,%d)\n",
|
||||
rc->left, rc->top, rc->right, rc->bottom, offset.x, offset.y);
|
||||
}
|
||||
|
||||
/* Front buffer coordinates are screen coordinates. Map them to the destination
|
||||
* window if not fullscreened
|
||||
*/
|
||||
if(!This->resource.wineD3DDevice->ddraw_fullscreen) {
|
||||
ClientToScreen(hDisplayWnd, &offset);
|
||||
}
|
||||
#if 0
|
||||
/* FIXME: this doesn't work... if users really want to run
|
||||
* X in 8bpp, then we need to call directly into display.drv
|
||||
* (or Wine's equivalent), and force a private colormap
|
||||
* without default entries. */
|
||||
if (This->palette) {
|
||||
SelectPalette(hDisplayDC, This->palette->hpal, FALSE);
|
||||
RealizePalette(hDisplayDC); /* sends messages => deadlocks */
|
||||
}
|
||||
#endif
|
||||
drawrect.left = 0;
|
||||
drawrect.right = This->currentDesc.Width;
|
||||
drawrect.top = 0;
|
||||
drawrect.bottom = This->currentDesc.Height;
|
||||
|
||||
#if 0
|
||||
/* TODO: Support clippers */
|
||||
if (This->clipper)
|
||||
{
|
||||
RECT xrc;
|
||||
HWND hwnd = ((IWineD3DClipperImpl *) This->clipper)->hWnd;
|
||||
if (hwnd && GetClientRect(hwnd,&xrc))
|
||||
{
|
||||
OffsetRect(&xrc,offset.x,offset.y);
|
||||
IntersectRect(&drawrect,&drawrect,&xrc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (rc)
|
||||
{
|
||||
IntersectRect(&drawrect,&drawrect,rc);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Only use this if the caller did not pass a rectangle, since
|
||||
* due to double locking this could be the wrong one ...
|
||||
*/
|
||||
if (This->lockedRect.left != This->lockedRect.right)
|
||||
{
|
||||
IntersectRect(&drawrect,&drawrect,&This->lockedRect);
|
||||
}
|
||||
}
|
||||
|
||||
BitBlt(hDisplayDC,
|
||||
drawrect.left-offset.x, drawrect.top-offset.y,
|
||||
drawrect.right-drawrect.left, drawrect.bottom-drawrect.top,
|
||||
hSurfaceDC,
|
||||
drawrect.left, drawrect.top,
|
||||
SRCCOPY);
|
||||
ReleaseDC(hDisplayWnd, hDisplayDC);
|
||||
}
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DSurface::Release, GDI version
|
||||
@@ -140,7 +47,6 @@ ULONG WINAPI IWineGDISurfaceImpl_Release(IWineD3DSurface *iface) {
|
||||
ULONG ref = InterlockedDecrement(&This->resource.ref);
|
||||
TRACE("(%p) : Releasing from %d\n", This, ref + 1);
|
||||
if (ref == 0) {
|
||||
IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->resource.wineD3DDevice;
|
||||
TRACE("(%p) : cleaning up\n", This);
|
||||
|
||||
if(This->Flags & SFLAG_DIBSECTION) {
|
||||
@@ -157,8 +63,10 @@ ULONG WINAPI IWineGDISurfaceImpl_Release(IWineD3DSurface *iface) {
|
||||
HeapFree(GetProcessHeap(), 0, This->palette9);
|
||||
|
||||
IWineD3DResourceImpl_CleanUp((IWineD3DResource *)iface);
|
||||
if(iface == device->ddraw_primary)
|
||||
device->ddraw_primary = NULL;
|
||||
|
||||
if(This->overlay_dest) {
|
||||
list_remove(&This->overlay_entry);
|
||||
}
|
||||
|
||||
TRACE("(%p) Released\n", This);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
@@ -182,6 +90,20 @@ IWineGDISurfaceImpl_PreLoad(IWineD3DSurface *iface)
|
||||
ERR("(%p): Please report to wine-devel\n", iface);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DSurface::UnLoad, GDI version
|
||||
*
|
||||
* This call is unsupported on GDI surfaces, if it's called something went
|
||||
* wrong in the parent library. Write an informative warning.
|
||||
*
|
||||
*****************************************************************************/
|
||||
static void WINAPI IWineGDISurfaceImpl_UnLoad(IWineD3DSurface *iface)
|
||||
{
|
||||
ERR("(%p): UnLoad is not supported on X11 surfaces!\n", iface);
|
||||
ERR("(%p): Most likely the parent library did something wrong.\n", iface);
|
||||
ERR("(%p): Please report to wine-devel\n", iface);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DSurface::LockRect, GDI version
|
||||
*
|
||||
@@ -240,7 +162,7 @@ static HRESULT WINAPI
|
||||
IWineGDISurfaceImpl_UnlockRect(IWineD3DSurface *iface)
|
||||
{
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *)iface;
|
||||
IWineD3DDeviceImpl *dev = (IWineD3DDeviceImpl *) This->resource.wineD3DDevice;
|
||||
IWineD3DSwapChainImpl *swapchain = NULL;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if (!(This->Flags & SFLAG_LOCKED))
|
||||
@@ -269,10 +191,11 @@ IWineGDISurfaceImpl_UnlockRect(IWineD3DSurface *iface)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Update the screen */
|
||||
if(This == (IWineD3DSurfaceImpl *) dev->ddraw_primary)
|
||||
{
|
||||
x11_copy_to_screen(This, &This->lockedRect);
|
||||
/* Tell the swapchain to update the screen */
|
||||
IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **) &swapchain);
|
||||
if(swapchain) {
|
||||
x11_copy_to_screen(swapchain, &This->lockedRect);
|
||||
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
|
||||
}
|
||||
|
||||
This->Flags &= ~SFLAG_LOCKED;
|
||||
@@ -299,101 +222,18 @@ IWineGDISurfaceImpl_Flip(IWineD3DSurface *iface,
|
||||
IWineD3DSurface *override,
|
||||
DWORD Flags)
|
||||
{
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
|
||||
IWineD3DSurfaceImpl *Target = (IWineD3DSurfaceImpl *) override;
|
||||
TRACE("(%p)->(%p,%x)\n", This, override, Flags);
|
||||
IWineD3DSwapChainImpl *swapchain = NULL;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p) Flipping to surface %p\n", This, Target);
|
||||
|
||||
if(Target == NULL)
|
||||
{
|
||||
ERR("(%p): Can't flip without a target\n", This);
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **) &swapchain);
|
||||
if(!swapchain) {
|
||||
ERR("Flipped surface is not on a swapchain\n");
|
||||
return WINEDDERR_NOTFLIPPABLE;
|
||||
}
|
||||
|
||||
/* Flip the DC */
|
||||
{
|
||||
HDC tmp;
|
||||
tmp = This->hDC;
|
||||
This->hDC = Target->hDC;
|
||||
Target->hDC = tmp;
|
||||
}
|
||||
|
||||
/* Flip the DIBsection */
|
||||
{
|
||||
HBITMAP tmp;
|
||||
tmp = This->dib.DIBsection;
|
||||
This->dib.DIBsection = Target->dib.DIBsection;
|
||||
Target->dib.DIBsection = tmp;
|
||||
}
|
||||
|
||||
/* Flip the surface data */
|
||||
{
|
||||
void* tmp;
|
||||
|
||||
tmp = This->dib.bitmap_data;
|
||||
This->dib.bitmap_data = Target->dib.bitmap_data;
|
||||
Target->dib.bitmap_data = tmp;
|
||||
|
||||
tmp = This->resource.allocatedMemory;
|
||||
This->resource.allocatedMemory = Target->resource.allocatedMemory;
|
||||
Target->resource.allocatedMemory = tmp;
|
||||
|
||||
if(This->resource.heapMemory) {
|
||||
ERR("GDI Surface %p has heap memory allocated\n", This);
|
||||
}
|
||||
if(Target->resource.heapMemory) {
|
||||
ERR("GDI Surface %p has heap memory allocated\n", Target);
|
||||
}
|
||||
}
|
||||
|
||||
/* client_memory should not be different, but just in case */
|
||||
{
|
||||
BOOL tmp;
|
||||
tmp = This->dib.client_memory;
|
||||
This->dib.client_memory = Target->dib.client_memory;
|
||||
Target->dib.client_memory = tmp;
|
||||
}
|
||||
|
||||
/* Useful for debugging */
|
||||
#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, This->glDescription.target, This->glDescription.level, gen);
|
||||
IWineD3DSurfaceImpl_SaveSnapshot(iface, buffer);
|
||||
}
|
||||
/*
|
||||
* debugging crash code
|
||||
if (gen == 250) {
|
||||
void** test = NULL;
|
||||
*test = 0;
|
||||
}
|
||||
*/
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Update the screen */
|
||||
x11_copy_to_screen(This, NULL);
|
||||
|
||||
/* FPS support */
|
||||
if (TRACE_ON(fps))
|
||||
{
|
||||
static long prev_time, frames;
|
||||
|
||||
DWORD time = GetTickCount();
|
||||
frames++;
|
||||
/* every 1.5 seconds */
|
||||
if (time - prev_time > 1500) {
|
||||
TRACE_(fps)("@ approx %.2ffps\n", 1000.0*frames/(time - prev_time));
|
||||
prev_time = time;
|
||||
frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
hr = IWineD3DSwapChain_Present((IWineD3DSwapChain *) swapchain, NULL, NULL, 0, NULL, 0);
|
||||
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
|
||||
return hr;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -478,7 +318,7 @@ const char* filename)
|
||||
table[i][2] = This->palette->palents[i].peBlue;
|
||||
}
|
||||
for (y = 0; y < This->pow2Height; y++) {
|
||||
unsigned char *src = (unsigned char *) This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
|
||||
unsigned char *src = This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
|
||||
for (x = 0; x < This->pow2Width; x++) {
|
||||
unsigned char color = *src;
|
||||
src += 1;
|
||||
@@ -490,16 +330,17 @@ const char* filename)
|
||||
fwrite(output, 3 * This->pow2Width, 1, f);
|
||||
}
|
||||
} else {
|
||||
int red_shift, green_shift, blue_shift, pix_width;
|
||||
int red_shift, green_shift, blue_shift, pix_width, alpha_shift;
|
||||
|
||||
pix_width = This->bytesPerPixel;
|
||||
|
||||
red_shift = get_shift(formatEntry->redMask);
|
||||
green_shift = get_shift(formatEntry->greenMask);
|
||||
blue_shift = get_shift(formatEntry->blueMask);
|
||||
alpha_shift = get_shift(formatEntry->alphaMask);
|
||||
|
||||
for (y = 0; y < This->pow2Height; y++) {
|
||||
unsigned char *src = (unsigned char *) This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
|
||||
unsigned char *src = This->resource.allocatedMemory + (y * 1 * IWineD3DSurface_GetPitch(iface));
|
||||
for (x = 0; x < This->pow2Width; x++) {
|
||||
unsigned int color;
|
||||
unsigned int comp;
|
||||
@@ -515,8 +356,8 @@ const char* filename)
|
||||
output[3 * x + 0] = red_shift > 0 ? comp >> red_shift : comp << -red_shift;
|
||||
comp = color & formatEntry->greenMask;
|
||||
output[3 * x + 1] = green_shift > 0 ? comp >> green_shift : comp << -green_shift;
|
||||
comp = color & formatEntry->blueMask;
|
||||
output[3 * x + 2] = blue_shift > 0 ? comp >> blue_shift : comp << -blue_shift;
|
||||
comp = color & formatEntry->alphaMask;
|
||||
output[3 * x + 2] = alpha_shift > 0 ? comp >> alpha_shift : comp << -alpha_shift;
|
||||
}
|
||||
fwrite(output, 3 * This->pow2Width, 1, f);
|
||||
}
|
||||
@@ -564,28 +405,28 @@ HRESULT WINAPI IWineGDISurfaceImpl_GetDC(IWineD3DSurface *iface, HDC *pHDC) {
|
||||
if(This->resource.format == WINED3DFMT_P8 ||
|
||||
This->resource.format == WINED3DFMT_A8P8) {
|
||||
unsigned int n;
|
||||
PALETTEENTRY *pal = NULL;
|
||||
|
||||
if(This->palette) {
|
||||
PALETTEENTRY ent[256];
|
||||
|
||||
GetPaletteEntries(This->palette->hpal, 0, 256, ent);
|
||||
for (n=0; n<256; n++) {
|
||||
col[n].rgbRed = ent[n].peRed;
|
||||
col[n].rgbGreen = ent[n].peGreen;
|
||||
col[n].rgbBlue = ent[n].peBlue;
|
||||
col[n].rgbReserved = 0;
|
||||
}
|
||||
pal = This->palette->palents;
|
||||
} else {
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
IWineD3DSurfaceImpl *dds_primary;
|
||||
IWineD3DSwapChainImpl *swapchain;
|
||||
swapchain = (IWineD3DSwapChainImpl *)This->resource.wineD3DDevice->swapchains[0];
|
||||
dds_primary = (IWineD3DSurfaceImpl *)swapchain->frontBuffer;
|
||||
if (dds_primary && dds_primary->palette)
|
||||
pal = dds_primary->palette->palents;
|
||||
}
|
||||
|
||||
if (pal) {
|
||||
for (n=0; n<256; n++) {
|
||||
col[n].rgbRed = device->palettes[device->currentPalette][n].peRed;
|
||||
col[n].rgbGreen = device->palettes[device->currentPalette][n].peGreen;
|
||||
col[n].rgbBlue = device->palettes[device->currentPalette][n].peBlue;
|
||||
col[n].rgbRed = pal[n].peRed;
|
||||
col[n].rgbGreen = pal[n].peGreen;
|
||||
col[n].rgbBlue = pal[n].peBlue;
|
||||
col[n].rgbReserved = 0;
|
||||
}
|
||||
|
||||
SetDIBColorTable(This->hDC, 0, 256, col);
|
||||
}
|
||||
SetDIBColorTable(This->hDC, 0, 256, col);
|
||||
}
|
||||
|
||||
*pHDC = This->hDC;
|
||||
@@ -616,6 +457,39 @@ HRESULT WINAPI IWineGDISurfaceImpl_ReleaseDC(IWineD3DSurface *iface, HDC hDC) {
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineGDISurfaceImpl_RealizePalette(IWineD3DSurface *iface) {
|
||||
IWineD3DSurfaceImpl *This = (IWineD3DSurfaceImpl *) iface;
|
||||
RGBQUAD col[256];
|
||||
IWineD3DPaletteImpl *pal = This->palette;
|
||||
unsigned int n;
|
||||
IWineD3DSwapChainImpl *swapchain;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
if (!pal) return WINED3D_OK;
|
||||
|
||||
if(This->Flags & SFLAG_DIBSECTION) {
|
||||
TRACE("(%p): Updating the hdc's palette\n", This);
|
||||
for (n=0; n<256; n++) {
|
||||
col[n].rgbRed = pal->palents[n].peRed;
|
||||
col[n].rgbGreen = pal->palents[n].peGreen;
|
||||
col[n].rgbBlue = pal->palents[n].peBlue;
|
||||
col[n].rgbReserved = 0;
|
||||
}
|
||||
SetDIBColorTable(This->hDC, 0, 256, col);
|
||||
}
|
||||
|
||||
/* Update the image because of the palette change. Some games like e.g Red Alert
|
||||
call SetEntries a lot to implement fading. */
|
||||
/* Tell the swapchain to update the screen */
|
||||
IWineD3DSurface_GetContainer(iface, &IID_IWineD3DSwapChain, (void **) &swapchain);
|
||||
if(swapchain) {
|
||||
x11_copy_to_screen(swapchain, NULL);
|
||||
IWineD3DSwapChain_Release((IWineD3DSwapChain *) swapchain);
|
||||
}
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DSurface::PrivateSetup, GDI version
|
||||
*
|
||||
@@ -728,7 +602,7 @@ HRESULT WINAPI IWineGDISurfaceImpl_SetMem(IWineD3DSurface *iface, void *Mem) {
|
||||
/* Now free the old memory if any */
|
||||
HeapFree(GetProcessHeap(), 0, release);
|
||||
} else if(This->Flags & SFLAG_USERPTR) {
|
||||
/* Lockrect and GetDC will re-create the dib section and allocated memory */
|
||||
/* LockRect and GetDC will re-create the dib section and allocated memory */
|
||||
This->resource.allocatedMemory = NULL;
|
||||
This->Flags &= ~SFLAG_USERPTR;
|
||||
}
|
||||
@@ -757,6 +631,15 @@ static HRESULT WINAPI IWineGDISurfaceImpl_LoadLocation(IWineD3DSurface *iface, D
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static WINED3DSURFTYPE WINAPI IWineGDISurfaceImpl_GetImplType(IWineD3DSurface *iface) {
|
||||
return SURFACE_GDI;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineGDISurfaceImpl_DrawOverlay(IWineD3DSurface *iface) {
|
||||
FIXME("GDI surfaces can't draw overlays yet\n");
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/* FIXME: This vtable should not use any IWineD3DSurface* implementation functions,
|
||||
* only IWineD3DBaseSurface and IWineGDISurface ones.
|
||||
*/
|
||||
@@ -775,6 +658,7 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
|
||||
IWineD3DBaseSurfaceImpl_SetPriority,
|
||||
IWineD3DBaseSurfaceImpl_GetPriority,
|
||||
IWineGDISurfaceImpl_PreLoad,
|
||||
IWineGDISurfaceImpl_UnLoad,
|
||||
IWineD3DBaseSurfaceImpl_GetType,
|
||||
/* IWineD3DSurface */
|
||||
IWineD3DBaseSurfaceImpl_GetContainer,
|
||||
@@ -792,7 +676,7 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
|
||||
IWineD3DBaseSurfaceImpl_BltFast,
|
||||
IWineD3DBaseSurfaceImpl_GetPalette,
|
||||
IWineD3DBaseSurfaceImpl_SetPalette,
|
||||
IWineD3DBaseSurfaceImpl_RealizePalette,
|
||||
IWineGDISurfaceImpl_RealizePalette,
|
||||
IWineD3DBaseSurfaceImpl_SetColorKey,
|
||||
IWineD3DBaseSurfaceImpl_GetPitch,
|
||||
IWineGDISurfaceImpl_SetMem,
|
||||
@@ -814,5 +698,7 @@ const IWineD3DSurfaceVtbl IWineGDISurface_Vtbl =
|
||||
IWineD3DBaseSurfaceImpl_SetFormat,
|
||||
IWineGDISurfaceImpl_PrivateSetup,
|
||||
IWineGDISurfaceImpl_ModifyLocation,
|
||||
IWineGDISurfaceImpl_LoadLocation
|
||||
IWineGDISurfaceImpl_LoadLocation,
|
||||
IWineGDISurfaceImpl_GetImplType,
|
||||
IWineGDISurfaceImpl_DrawOverlay
|
||||
};
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
*Copyright 2002-2003 Jason Edmeades
|
||||
*Copyright 2002-2003 Raphael Junqueira
|
||||
*Copyright 2005 Oliver Stieber
|
||||
*Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
*This library is free software; you can redistribute it and/or
|
||||
*modify it under the terms of the GNU Lesser General Public
|
||||
@@ -34,59 +35,16 @@ WINE_DECLARE_DEBUG_CHANNEL(fps);
|
||||
|
||||
#define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info
|
||||
|
||||
/* IDirect3DSwapChain IUnknown parts follow: */
|
||||
static ULONG WINAPI IWineD3DSwapChainImpl_AddRef(IWineD3DSwapChain *iface) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
DWORD refCount = InterlockedIncrement(&This->ref);
|
||||
TRACE("(%p) : AddRef increasing from %d\n", This, refCount - 1);
|
||||
return refCount;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface, REFIID riid, LPVOID *ppobj)
|
||||
{
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppobj);
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DSwapChain)){
|
||||
IWineD3DSwapChainImpl_AddRef(iface);
|
||||
if(ppobj == NULL){
|
||||
ERR("Query interface called but now data allocated\n");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
*ppobj = This;
|
||||
return WINED3D_OK;
|
||||
}
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
|
||||
static ULONG WINAPI IWineD3DSwapChainImpl_Release(IWineD3DSwapChain *iface) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
DWORD refCount;
|
||||
refCount = InterlockedDecrement(&This->ref);
|
||||
TRACE("(%p) : ReleaseRef to %d\n", This, refCount);
|
||||
if (refCount == 0) {
|
||||
IWineD3DSwapChain_Destroy(iface, D3DCB_DefaultDestroySurface);
|
||||
}
|
||||
return refCount;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUnknown ** ppParent){
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
*ppParent = This->parent;
|
||||
IUnknown_AddRef(*ppParent);
|
||||
TRACE("(%p) returning %p\n", This , *ppParent);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
/*IWineD3DSwapChain parts follow: */
|
||||
static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface, D3DCB_DESTROYSURFACEFN D3DCB_DestroyRenderTarget) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
WINED3DDISPLAYMODE mode;
|
||||
int i;
|
||||
|
||||
TRACE("Destroying swapchain %p\n", iface);
|
||||
|
||||
IWineD3DSwapChain_SetGammaRamp(iface, 0, &This->orig_gamma);
|
||||
|
||||
/* release the ref to the front and back buffer parents */
|
||||
if(This->frontBuffer) {
|
||||
IWineD3DSurface_SetContainer(This->frontBuffer, 0);
|
||||
@@ -182,40 +140,11 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
||||
|
||||
if (pSourceRect || pDestRect) FIXME("Unhandled present options %p/%p\n", pSourceRect, pDestRect);
|
||||
/* TODO: If only source rect or dest rect are supplied then clip the window to match */
|
||||
TRACE("preseting HDC %p\n", This->context[0]->hdc);
|
||||
TRACE("presetting HDC %p\n", This->context[0]->hdc);
|
||||
|
||||
/* Don't call checkGLcall, as glGetError is not applicable here */
|
||||
if (hDestWindowOverride && This->win_handle != hDestWindowOverride) {
|
||||
WINED3DLOCKED_RECT r;
|
||||
BYTE *mem;
|
||||
|
||||
TRACE("Performing dest override of swapchain %p from window %p to %p\n", This, This->win_handle, hDestWindowOverride);
|
||||
if(This->context[0] == This->wineD3DDevice->contexts[0]) {
|
||||
/* The primary context 'owns' all the opengl resources. Destroying and recreating that context would require downloading
|
||||
* all opengl resources, deleting the gl resources, destroying all other contexts, then recreating all other contexts
|
||||
* and reload the resources
|
||||
*/
|
||||
ERR("Cannot change the destination window of the owner of the primary context\n");
|
||||
} else {
|
||||
This->win_handle = hDestWindowOverride;
|
||||
|
||||
/* The old back buffer has to be copied over to the new back buffer. A lockrect - switchcontext - unlockrect
|
||||
* would suffice in theory, but it is rather nasty and may cause troubles with future changes of the locking code
|
||||
* So lock read only, copy the surface out, then lock with the discard flag and write back
|
||||
*/
|
||||
IWineD3DSurface_LockRect(This->backBuffer[0], &r, NULL, WINED3DLOCK_READONLY);
|
||||
mem = HeapAlloc(GetProcessHeap(), 0, r.Pitch * ((IWineD3DSurfaceImpl *) This->backBuffer[0])->currentDesc.Height);
|
||||
memcpy(mem, r.pBits, r.Pitch * ((IWineD3DSurfaceImpl *) This->backBuffer[0])->currentDesc.Height);
|
||||
IWineD3DSurface_UnlockRect(This->backBuffer[0]);
|
||||
|
||||
DestroyContext(This->wineD3DDevice, This->context[0]);
|
||||
This->context[0] = CreateContext(This->wineD3DDevice, (IWineD3DSurfaceImpl *) This->frontBuffer, This->win_handle, FALSE /* pbuffer */, &This->presentParms);
|
||||
|
||||
IWineD3DSurface_LockRect(This->backBuffer[0], &r, NULL, WINED3DLOCK_DISCARD);
|
||||
memcpy(r.pBits, mem, r.Pitch * ((IWineD3DSurfaceImpl *) This->backBuffer[0])->currentDesc.Height);
|
||||
HeapFree(GetProcessHeap(), 0, mem);
|
||||
IWineD3DSurface_UnlockRect(This->backBuffer[0]);
|
||||
}
|
||||
IWineD3DSwapChain_SetDestWindowOverride(iface, hDestWindowOverride);
|
||||
}
|
||||
|
||||
SwapBuffers(This->context[0]->hdc); /* TODO: cycle through the swapchain buffers */
|
||||
@@ -274,8 +203,24 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
||||
}
|
||||
#endif
|
||||
|
||||
if (This->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD) {
|
||||
TRACE("Clearing the color buffer with pink color\n");
|
||||
/* This is disabled, but the code left in for debug purposes.
|
||||
*
|
||||
* Since we're allowed to modify the new back buffer on a D3DSWAPEFFECT_DISCARD flip,
|
||||
* we can clear it with some ugly color to make bad drawing visible and ease debugging.
|
||||
* The Debug runtime does the same on Windows. However, a few games do not redraw the
|
||||
* screen properly, like Max Payne 2, which leaves a few pixels undefined.
|
||||
*
|
||||
* Tests show that the content of the back buffer after a discard flip is indeed not
|
||||
* reliable, so no game can depend on the exact content. However, it resembles the
|
||||
* old contents in some way, for example by showing fragments at other locations. In
|
||||
* general, the color theme is still intact. So Max payne, which draws rather dark scenes
|
||||
* gets a dark background image. If we clear it with a bright ugly color, the game's
|
||||
* bug shows up much more than it does on Windows, and the players see single pixels
|
||||
* with wrong colors.
|
||||
* (The Max Payne bug has been confirmed on Windows with the debug runtime)
|
||||
*/
|
||||
if (FALSE && This->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD) {
|
||||
TRACE("Clearing the color buffer with cyan color\n");
|
||||
|
||||
IWineD3DDevice_Clear((IWineD3DDevice*)This->wineD3DDevice, 0, NULL,
|
||||
WINED3DCLEAR_TARGET, 0xff00ffff, 1.0, 0);
|
||||
@@ -286,83 +231,32 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
||||
/* Both memory copies of the surfaces are ok, flip them around too instead of dirtifying */
|
||||
IWineD3DSurfaceImpl *front = (IWineD3DSurfaceImpl *) This->frontBuffer;
|
||||
IWineD3DSurfaceImpl *back = (IWineD3DSurfaceImpl *) This->backBuffer[0];
|
||||
BOOL frontuptodate = front->Flags & SFLAG_INSYSMEM;
|
||||
BOOL backuptodate = back->Flags & SFLAG_INSYSMEM;
|
||||
|
||||
if(front->resource.size == back->resource.size) {
|
||||
/* Flip the DC */
|
||||
{
|
||||
HDC tmp;
|
||||
tmp = front->hDC;
|
||||
front->hDC = back->hDC;
|
||||
back->hDC = tmp;
|
||||
}
|
||||
DWORD fbflags;
|
||||
flip_surface(front, back);
|
||||
|
||||
/* Flip the DIBsection */
|
||||
{
|
||||
HBITMAP tmp;
|
||||
BOOL hasDib = front->Flags & SFLAG_DIBSECTION;
|
||||
tmp = front->dib.DIBsection;
|
||||
front->dib.DIBsection = back->dib.DIBsection;
|
||||
back->dib.DIBsection = tmp;
|
||||
|
||||
if(back->Flags & SFLAG_DIBSECTION) front->Flags |= SFLAG_DIBSECTION;
|
||||
else front->Flags &= ~SFLAG_DIBSECTION;
|
||||
if(hasDib) back->Flags |= SFLAG_DIBSECTION;
|
||||
else back->Flags &= ~SFLAG_DIBSECTION;
|
||||
}
|
||||
|
||||
/* Flip the surface data */
|
||||
{
|
||||
void* tmp;
|
||||
|
||||
tmp = front->dib.bitmap_data;
|
||||
front->dib.bitmap_data = back->dib.bitmap_data;
|
||||
back->dib.bitmap_data = tmp;
|
||||
|
||||
tmp = front->resource.allocatedMemory;
|
||||
front->resource.allocatedMemory = back->resource.allocatedMemory;
|
||||
back->resource.allocatedMemory = tmp;
|
||||
|
||||
tmp = front->resource.heapMemory;
|
||||
front->resource.heapMemory = back->resource.heapMemory;
|
||||
back->resource.heapMemory = tmp;
|
||||
}
|
||||
|
||||
/* Flip the PBO */
|
||||
{
|
||||
DWORD tmp_flags = front->Flags;
|
||||
|
||||
GLuint tmp_pbo = front->pbo;
|
||||
front->pbo = back->pbo;
|
||||
back->pbo = tmp_pbo;
|
||||
|
||||
if(back->Flags & SFLAG_PBO)
|
||||
front->Flags |= SFLAG_PBO;
|
||||
else
|
||||
front->Flags &= ~SFLAG_PBO;
|
||||
|
||||
if(tmp_flags & SFLAG_PBO)
|
||||
back->Flags |= SFLAG_PBO;
|
||||
else
|
||||
back->Flags &= ~SFLAG_PBO;
|
||||
}
|
||||
|
||||
/* client_memory should not be different, but just in case */
|
||||
{
|
||||
BOOL tmp;
|
||||
tmp = front->dib.client_memory;
|
||||
front->dib.client_memory = back->dib.client_memory;
|
||||
back->dib.client_memory = tmp;
|
||||
}
|
||||
if(frontuptodate) back->Flags |= SFLAG_INSYSMEM;
|
||||
else back->Flags &= ~SFLAG_INSYSMEM;
|
||||
if(backuptodate) front->Flags |= SFLAG_INSYSMEM;
|
||||
else front->Flags &= ~SFLAG_INSYSMEM;
|
||||
/* Tell the front buffer surface that is has been modified. However,
|
||||
* the other locations were preserved during that, so keep the flags.
|
||||
* This serves to update the emulated overlay, if any
|
||||
*/
|
||||
fbflags = front->Flags;
|
||||
IWineD3DSurface_ModifyLocation(This->frontBuffer, SFLAG_INDRAWABLE, TRUE);
|
||||
front->Flags = fbflags;
|
||||
} else {
|
||||
IWineD3DSurface_ModifyLocation((IWineD3DSurface *) front, SFLAG_INDRAWABLE, TRUE);
|
||||
IWineD3DSurface_ModifyLocation((IWineD3DSurface *) back, SFLAG_INDRAWABLE, TRUE);
|
||||
}
|
||||
} else {
|
||||
IWineD3DSurface_ModifyLocation(This->frontBuffer, SFLAG_INDRAWABLE, TRUE);
|
||||
/* If the swapeffect is DISCARD, the back buffer is undefined. That means the SYSMEM
|
||||
* and INTEXTURE copies can keep their old content if they have any defined content.
|
||||
* If the swapeffect is COPY, the content remains the same. If it is FLIP however,
|
||||
* the texture / sysmem copy needs to be reloaded from the drawable
|
||||
*/
|
||||
if(This->presentParms.SwapEffect == WINED3DSWAPEFFECT_FLIP) {
|
||||
IWineD3DSurface_ModifyLocation(This->backBuffer[0], SFLAG_INDRAWABLE, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
if(This->presentParms.PresentationInterval != WINED3DPRESENT_INTERVAL_IMMEDIATE && GL_SUPPORT(SGI_VIDEO_SYNC)) {
|
||||
@@ -410,150 +304,64 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *pDestSurface) {
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_SetDestWindowOverride(IWineD3DSwapChain *iface, HWND window) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
POINT start;
|
||||
WINED3DLOCKED_RECT r;
|
||||
BYTE *mem;
|
||||
|
||||
TRACE("(%p) : iface(%p) pDestSurface(%p)\n", This, iface, pDestSurface);
|
||||
if(window == This->win_handle) return WINED3D_OK;
|
||||
|
||||
start.x = 0;
|
||||
start.y = 0;
|
||||
|
||||
if (This->presentParms.Windowed) {
|
||||
MapWindowPoints(This->win_handle, NULL, &start, 1);
|
||||
}
|
||||
|
||||
IWineD3DSurface_BltFast(pDestSurface, start.x, start.y, This->frontBuffer, NULL, 0);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, UINT iBackBuffer, WINED3DBACKBUFFER_TYPE Type, IWineD3DSurface **ppBackBuffer) {
|
||||
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
|
||||
if (iBackBuffer > This->presentParms.BackBufferCount - 1) {
|
||||
TRACE("Back buffer count out of range\n");
|
||||
/* Native d3d9 doesn't set NULL here, just as wine's d3d9. But set it here
|
||||
* in wined3d to avoid problems in other libs
|
||||
TRACE("Performing dest override of swapchain %p from window %p to %p\n", This, This->win_handle, window);
|
||||
if(This->context[0] == This->wineD3DDevice->contexts[0]) {
|
||||
/* The primary context 'owns' all the opengl resources. Destroying and recreating that context requires downloading
|
||||
* all opengl resources, deleting the gl resources, destroying all other contexts, then recreating all other contexts
|
||||
* and reload the resources
|
||||
*/
|
||||
*ppBackBuffer = NULL;
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
delete_opengl_contexts((IWineD3DDevice *) This->wineD3DDevice, iface);
|
||||
This->win_handle = window;
|
||||
create_primary_opengl_context((IWineD3DDevice *) This->wineD3DDevice, iface);
|
||||
} else {
|
||||
This->win_handle = window;
|
||||
|
||||
*ppBackBuffer = This->backBuffer[iBackBuffer];
|
||||
TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, iBackBuffer, Type, *ppBackBuffer);
|
||||
/* The old back buffer has to be copied over to the new back buffer. A lockrect - switchcontext - unlockrect
|
||||
* would suffice in theory, but it is rather nasty and may cause troubles with future changes of the locking code
|
||||
* So lock read only, copy the surface out, then lock with the discard flag and write back
|
||||
*/
|
||||
IWineD3DSurface_LockRect(This->backBuffer[0], &r, NULL, WINED3DLOCK_READONLY);
|
||||
mem = HeapAlloc(GetProcessHeap(), 0, r.Pitch * ((IWineD3DSurfaceImpl *) This->backBuffer[0])->currentDesc.Height);
|
||||
memcpy(mem, r.pBits, r.Pitch * ((IWineD3DSurfaceImpl *) This->backBuffer[0])->currentDesc.Height);
|
||||
IWineD3DSurface_UnlockRect(This->backBuffer[0]);
|
||||
|
||||
/* Note inc ref on returned surface */
|
||||
if(*ppBackBuffer) IWineD3DSurface_AddRef(*ppBackBuffer);
|
||||
return WINED3D_OK;
|
||||
DestroyContext(This->wineD3DDevice, This->context[0]);
|
||||
This->context[0] = CreateContext(This->wineD3DDevice, (IWineD3DSurfaceImpl *) This->frontBuffer, This->win_handle, FALSE /* pbuffer */, &This->presentParms);
|
||||
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_GetRasterStatus(IWineD3DSwapChain *iface, WINED3DRASTER_STATUS *pRasterStatus) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
static BOOL showFixmes = TRUE;
|
||||
pRasterStatus->InVBlank = TRUE;
|
||||
pRasterStatus->ScanLine = 0;
|
||||
/* No openGL equivalent */
|
||||
if(showFixmes) {
|
||||
FIXME("(%p) : stub (once)\n", This);
|
||||
showFixmes = FALSE;
|
||||
IWineD3DSurface_LockRect(This->backBuffer[0], &r, NULL, WINED3DLOCK_DISCARD);
|
||||
memcpy(r.pBits, mem, r.Pitch * ((IWineD3DSurfaceImpl *) This->backBuffer[0])->currentDesc.Height);
|
||||
HeapFree(GetProcessHeap(), 0, mem);
|
||||
IWineD3DSurface_UnlockRect(This->backBuffer[0]);
|
||||
}
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface, WINED3DDISPLAYMODE*pMode) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
HDC hdc;
|
||||
int bpp = 0;
|
||||
|
||||
pMode->Width = GetSystemMetrics(SM_CXSCREEN);
|
||||
pMode->Height = GetSystemMetrics(SM_CYSCREEN);
|
||||
pMode->RefreshRate = 85; /* FIXME: How to identify? */
|
||||
|
||||
hdc = GetDC(0);
|
||||
bpp = GetDeviceCaps(hdc, BITSPIXEL);
|
||||
ReleaseDC(0, hdc);
|
||||
|
||||
switch (bpp) {
|
||||
case 8: pMode->Format = WINED3DFMT_R8G8B8; break;
|
||||
case 16: pMode->Format = WINED3DFMT_R5G6B5; break;
|
||||
case 24: /*pMode->Format = WINED3DFMT_R8G8B8; break; */ /* 32bpp and 24bpp can be aliased for X */
|
||||
case 32: pMode->Format = WINED3DFMT_A8R8G8B8; break;
|
||||
default:
|
||||
FIXME("Unrecognized display mode format\n");
|
||||
pMode->Format = WINED3DFMT_UNKNOWN;
|
||||
}
|
||||
|
||||
TRACE("(%p) : returning w(%d) h(%d) rr(%d) fmt(%u,%s)\n", This, pMode->Width, pMode->Height, pMode->RefreshRate,
|
||||
pMode->Format, debug_d3dformat(pMode->Format));
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_GetDevice(IWineD3DSwapChain *iface, IWineD3DDevice**ppDevice) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
|
||||
*ppDevice = (IWineD3DDevice *) This->wineD3DDevice;
|
||||
|
||||
/* Note Calling this method will increase the internal reference count
|
||||
on the IDirect3DDevice9 interface. */
|
||||
IWineD3DDevice_AddRef(*ppDevice);
|
||||
TRACE("(%p) : returning %p\n", This, *ppDevice);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_GetPresentParameters(IWineD3DSwapChain *iface, WINED3DPRESENT_PARAMETERS *pPresentationParameters) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
*pPresentationParameters = This->presentParms;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface, DWORD Flags, CONST WINED3DGAMMARAMP *pRamp){
|
||||
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
HDC hDC;
|
||||
TRACE("(%p) : pRamp@%p flags(%d)\n", This, pRamp, Flags);
|
||||
hDC = GetDC(This->win_handle);
|
||||
SetDeviceGammaRamp(hDC, (LPVOID)pRamp);
|
||||
ReleaseDC(This->win_handle, hDC);
|
||||
return WINED3D_OK;
|
||||
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface, WINED3DGAMMARAMP *pRamp){
|
||||
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
HDC hDC;
|
||||
TRACE("(%p) : pRamp@%p\n", This, pRamp);
|
||||
hDC = GetDC(This->win_handle);
|
||||
GetDeviceGammaRamp(hDC, pRamp);
|
||||
ReleaseDC(This->win_handle, hDC);
|
||||
return WINED3D_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
const IWineD3DSwapChainVtbl IWineD3DSwapChain_Vtbl =
|
||||
{
|
||||
/* IUnknown */
|
||||
IWineD3DSwapChainImpl_QueryInterface,
|
||||
IWineD3DSwapChainImpl_AddRef,
|
||||
IWineD3DSwapChainImpl_Release,
|
||||
IWineD3DBaseSwapChainImpl_QueryInterface,
|
||||
IWineD3DBaseSwapChainImpl_AddRef,
|
||||
IWineD3DBaseSwapChainImpl_Release,
|
||||
/* IWineD3DSwapChain */
|
||||
IWineD3DSwapChainImpl_GetParent,
|
||||
IWineD3DBaseSwapChainImpl_GetParent,
|
||||
IWineD3DSwapChainImpl_Destroy,
|
||||
IWineD3DSwapChainImpl_GetDevice,
|
||||
IWineD3DBaseSwapChainImpl_GetDevice,
|
||||
IWineD3DSwapChainImpl_Present,
|
||||
IWineD3DSwapChainImpl_GetFrontBufferData,
|
||||
IWineD3DSwapChainImpl_GetBackBuffer,
|
||||
IWineD3DSwapChainImpl_GetRasterStatus,
|
||||
IWineD3DSwapChainImpl_GetDisplayMode,
|
||||
IWineD3DSwapChainImpl_GetPresentParameters,
|
||||
IWineD3DSwapChainImpl_SetGammaRamp,
|
||||
IWineD3DSwapChainImpl_GetGammaRamp
|
||||
IWineD3DSwapChainImpl_SetDestWindowOverride,
|
||||
IWineD3DBaseSwapChainImpl_GetFrontBufferData,
|
||||
IWineD3DBaseSwapChainImpl_GetBackBuffer,
|
||||
IWineD3DBaseSwapChainImpl_GetRasterStatus,
|
||||
IWineD3DBaseSwapChainImpl_GetDisplayMode,
|
||||
IWineD3DBaseSwapChainImpl_GetPresentParameters,
|
||||
IWineD3DBaseSwapChainImpl_SetGammaRamp,
|
||||
IWineD3DBaseSwapChainImpl_GetGammaRamp
|
||||
};
|
||||
|
||||
WineD3DContext *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *iface) {
|
||||
@@ -585,3 +393,11 @@ WineD3DContext *IWineD3DSwapChainImpl_CreateContextForThread(IWineD3DSwapChain *
|
||||
TRACE("Returning context %p\n", ctx);
|
||||
return ctx;
|
||||
}
|
||||
|
||||
void get_drawable_size_swapchain(IWineD3DSurfaceImpl *This, UINT *width, UINT *height) {
|
||||
/* The drawable size of an onscreen drawable is the surface size.
|
||||
* (Actually: The window size, but the surface is created in window size)
|
||||
*/
|
||||
*width = This->currentDesc.Width;
|
||||
*height = This->currentDesc.Height;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
/*
|
||||
*IDirect3DSwapChain9 implementation
|
||||
*
|
||||
*Copyright 2002-2003 Jason Edmeades
|
||||
*Copyright 2002-2003 Raphael Junqueira
|
||||
*Copyright 2005 Oliver Stieber
|
||||
*Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
*This library is free software; you can redistribute it and/or
|
||||
*modify it under the terms of the GNU Lesser General Public
|
||||
*License as published by the Free Software Foundation; either
|
||||
*version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
*This library is distributed in the hope that it will be useful,
|
||||
*but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
*Lesser General Public License for more details.
|
||||
*
|
||||
*You should have received a copy of the GNU Lesser General Public
|
||||
*License along with this library; if not, write to the Free Software
|
||||
*Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wined3d_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
|
||||
/* IDirect3DSwapChain IUnknown parts follow: */
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_QueryInterface(IWineD3DSwapChain *iface, REFIID riid, LPVOID *ppobj)
|
||||
{
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppobj);
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DBase)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DSwapChain)){
|
||||
IWineD3DSwapChain_AddRef(iface);
|
||||
if(ppobj == NULL){
|
||||
ERR("Query interface called but now data allocated\n");
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
*ppobj = This;
|
||||
return WINED3D_OK;
|
||||
}
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
ULONG WINAPI IWineD3DBaseSwapChainImpl_AddRef(IWineD3DSwapChain *iface) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
DWORD refCount = InterlockedIncrement(&This->ref);
|
||||
TRACE("(%p) : AddRef increasing from %d\n", This, refCount - 1);
|
||||
return refCount;
|
||||
}
|
||||
|
||||
ULONG WINAPI IWineD3DBaseSwapChainImpl_Release(IWineD3DSwapChain *iface) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
DWORD refCount;
|
||||
refCount = InterlockedDecrement(&This->ref);
|
||||
TRACE("(%p) : ReleaseRef to %d\n", This, refCount);
|
||||
if (refCount == 0) {
|
||||
IWineD3DSwapChain_Destroy(iface, D3DCB_DefaultDestroySurface);
|
||||
}
|
||||
return refCount;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetParent(IWineD3DSwapChain *iface, IUnknown ** ppParent){
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
*ppParent = This->parent;
|
||||
IUnknown_AddRef(*ppParent);
|
||||
TRACE("(%p) returning %p\n", This , *ppParent);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetFrontBufferData(IWineD3DSwapChain *iface, IWineD3DSurface *pDestSurface) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
POINT start;
|
||||
|
||||
TRACE("(%p) : iface(%p) pDestSurface(%p)\n", This, iface, pDestSurface);
|
||||
|
||||
start.x = 0;
|
||||
start.y = 0;
|
||||
|
||||
if (This->presentParms.Windowed) {
|
||||
MapWindowPoints(This->win_handle, NULL, &start, 1);
|
||||
}
|
||||
|
||||
IWineD3DSurface_BltFast(pDestSurface, start.x, start.y, This->frontBuffer, NULL, 0);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetBackBuffer(IWineD3DSwapChain *iface, UINT iBackBuffer, WINED3DBACKBUFFER_TYPE Type, IWineD3DSurface **ppBackBuffer) {
|
||||
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
|
||||
if (iBackBuffer > This->presentParms.BackBufferCount - 1) {
|
||||
TRACE("Back buffer count out of range\n");
|
||||
/* Native d3d9 doesn't set NULL here, just as wine's d3d9. But set it here
|
||||
* in wined3d to avoid problems in other libs
|
||||
*/
|
||||
*ppBackBuffer = NULL;
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
/* Return invalid if there is no backbufferarray, otherwise it will crash when ddraw is
|
||||
* used (there This->backBuffer is allways NULL). We need this because this function have
|
||||
* to be called from IWineD3DStateBlockImpl_InitStartupStateBlock to get the default
|
||||
* scissorrect dimensions. */
|
||||
if( !This->backBuffer ) {
|
||||
*ppBackBuffer = NULL;
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
*ppBackBuffer = This->backBuffer[iBackBuffer];
|
||||
TRACE("(%p) : BackBuf %d Type %d returning %p\n", This, iBackBuffer, Type, *ppBackBuffer);
|
||||
|
||||
/* Note inc ref on returned surface */
|
||||
if(*ppBackBuffer) IWineD3DSurface_AddRef(*ppBackBuffer);
|
||||
return WINED3D_OK;
|
||||
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetRasterStatus(IWineD3DSwapChain *iface, WINED3DRASTER_STATUS *pRasterStatus) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
static BOOL showFixmes = TRUE;
|
||||
pRasterStatus->InVBlank = TRUE;
|
||||
pRasterStatus->ScanLine = 0;
|
||||
/* No openGL equivalent */
|
||||
if(showFixmes) {
|
||||
FIXME("(%p) : stub (once)\n", This);
|
||||
showFixmes = FALSE;
|
||||
}
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface, WINED3DDISPLAYMODE*pMode) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(%p): Calling GetAdapterDisplayMode\n", This, pMode);
|
||||
hr = IWineD3D_GetAdapterDisplayMode(This->wineD3DDevice->wineD3D, This->wineD3DDevice->adapter->num, pMode);
|
||||
|
||||
TRACE("(%p) : returning w(%d) h(%d) rr(%d) fmt(%u,%s)\n", This, pMode->Width, pMode->Height, pMode->RefreshRate,
|
||||
pMode->Format, debug_d3dformat(pMode->Format));
|
||||
return hr;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetDevice(IWineD3DSwapChain *iface, IWineD3DDevice**ppDevice) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
|
||||
*ppDevice = (IWineD3DDevice *) This->wineD3DDevice;
|
||||
|
||||
/* Note Calling this method will increase the internal reference count
|
||||
on the IDirect3DDevice9 interface. */
|
||||
IWineD3DDevice_AddRef(*ppDevice);
|
||||
TRACE("(%p) : returning %p\n", This, *ppDevice);
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetPresentParameters(IWineD3DSwapChain *iface, WINED3DPRESENT_PARAMETERS *pPresentationParameters) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
*pPresentationParameters = This->presentParms;
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_SetGammaRamp(IWineD3DSwapChain *iface, DWORD Flags, CONST WINED3DGAMMARAMP *pRamp){
|
||||
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
HDC hDC;
|
||||
TRACE("(%p) : pRamp@%p flags(%d)\n", This, pRamp, Flags);
|
||||
hDC = GetDC(This->win_handle);
|
||||
SetDeviceGammaRamp(hDC, (LPVOID)pRamp);
|
||||
ReleaseDC(This->win_handle, hDC);
|
||||
return WINED3D_OK;
|
||||
|
||||
}
|
||||
|
||||
HRESULT WINAPI IWineD3DBaseSwapChainImpl_GetGammaRamp(IWineD3DSwapChain *iface, WINED3DGAMMARAMP *pRamp){
|
||||
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
HDC hDC;
|
||||
TRACE("(%p) : pRamp@%p\n", This, pRamp);
|
||||
hDC = GetDC(This->win_handle);
|
||||
GetDeviceGammaRamp(hDC, pRamp);
|
||||
ReleaseDC(This->win_handle, hDC);
|
||||
return WINED3D_OK;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
/*
|
||||
*IDirect3DSwapChain9 implementation
|
||||
*
|
||||
*Copyright 2002-2003 Jason Edmeades
|
||||
*Copyright 2002-2003 Raphael Junqueira
|
||||
*Copyright 2005 Oliver Stieber
|
||||
*Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
*This library is free software; you can redistribute it and/or
|
||||
*modify it under the terms of the GNU Lesser General Public
|
||||
*License as published by the Free Software Foundation; either
|
||||
*version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
*This library is distributed in the hope that it will be useful,
|
||||
*but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
*MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
*Lesser General Public License for more details.
|
||||
*
|
||||
*You should have received a copy of the GNU Lesser General Public
|
||||
*License along with this library; if not, write to the Free Software
|
||||
*Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "wined3d_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
WINE_DECLARE_DEBUG_CHANNEL(fps);
|
||||
|
||||
static void WINAPI IWineGDISwapChainImpl_Destroy(IWineD3DSwapChain *iface, D3DCB_DESTROYSURFACEFN D3DCB_DestroyRenderback) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
WINED3DDISPLAYMODE mode;
|
||||
|
||||
TRACE("Destroying swapchain %p\n", iface);
|
||||
|
||||
IWineD3DSwapChain_SetGammaRamp(iface, 0, &This->orig_gamma);
|
||||
|
||||
/* release the ref to the front and back buffer parents */
|
||||
if(This->frontBuffer) {
|
||||
IWineD3DSurface_SetContainer(This->frontBuffer, 0);
|
||||
if(D3DCB_DestroyRenderback(This->frontBuffer) > 0) {
|
||||
FIXME("(%p) Something's still holding the front buffer\n",This);
|
||||
}
|
||||
}
|
||||
|
||||
if(This->backBuffer) {
|
||||
int i;
|
||||
for(i = 0; i < This->presentParms.BackBufferCount; i++) {
|
||||
IWineD3DSurface_SetContainer(This->backBuffer[i], 0);
|
||||
if(D3DCB_DestroyRenderback(This->backBuffer[i]) > 0) {
|
||||
FIXME("(%p) Something's still holding the back buffer\n",This);
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->backBuffer);
|
||||
}
|
||||
|
||||
/* Restore the screen resolution if we rendered in fullscreen
|
||||
* This will restore the screen resolution to what it was before creating the swapchain. In case of d3d8 and d3d9
|
||||
* this will be the original desktop resolution. In case of d3d7 this will be a NOP because ddraw sets the resolution
|
||||
* before starting up Direct3D, thus orig_width and orig_height will be equal to the modes in the presentation params
|
||||
*/
|
||||
if(This->presentParms.Windowed == FALSE) {
|
||||
mode.Width = This->orig_width;
|
||||
mode.Height = This->orig_height;
|
||||
mode.RefreshRate = 0;
|
||||
mode.Format = This->orig_fmt;
|
||||
IWineD3DDevice_SetDisplayMode((IWineD3DDevice *) This->wineD3DDevice, 0, &mode);
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
* x11_copy_to_screen
|
||||
*
|
||||
* Helper function that blts the front buffer contents to the target window
|
||||
*
|
||||
* Params:
|
||||
* This: Surface to copy from
|
||||
* rc: Rectangle to copy
|
||||
*
|
||||
*****************************************************************************/
|
||||
void x11_copy_to_screen(IWineD3DSwapChainImpl *This, LPRECT rc) {
|
||||
IWineD3DSurfaceImpl *front = (IWineD3DSurfaceImpl *) This->frontBuffer;
|
||||
|
||||
if(front->resource.usage & WINED3DUSAGE_RENDERTARGET) {
|
||||
POINT offset = {0,0};
|
||||
HWND hDisplayWnd;
|
||||
HDC hDisplayDC;
|
||||
HDC hSurfaceDC = 0;
|
||||
RECT drawrect;
|
||||
TRACE("(%p)->(%p): Copying to screen\n", front, rc);
|
||||
|
||||
hSurfaceDC = front->hDC;
|
||||
|
||||
hDisplayWnd = This->win_handle;
|
||||
hDisplayDC = GetDCEx(hDisplayWnd, 0, DCX_CLIPSIBLINGS|DCX_CACHE);
|
||||
if(rc) {
|
||||
TRACE(" copying rect (%d,%d)->(%d,%d), offset (%d,%d)\n",
|
||||
rc->left, rc->top, rc->right, rc->bottom, offset.x, offset.y);
|
||||
}
|
||||
|
||||
/* Front buffer coordinates are screen coordinates. Map them to the destination
|
||||
* window if not fullscreened
|
||||
*/
|
||||
if(This->presentParms.Windowed) {
|
||||
ClientToScreen(hDisplayWnd, &offset);
|
||||
}
|
||||
#if 0
|
||||
/* FIXME: This doesn't work... if users really want to run
|
||||
* X in 8bpp, then we need to call directly into display.drv
|
||||
* (or Wine's equivalent), and force a private colormap
|
||||
* without default entries. */
|
||||
if (front->palette) {
|
||||
SelectPalette(hDisplayDC, front->palette->hpal, FALSE);
|
||||
RealizePalette(hDisplayDC); /* sends messages => deadlocks */
|
||||
}
|
||||
#endif
|
||||
drawrect.left = 0;
|
||||
drawrect.right = front->currentDesc.Width;
|
||||
drawrect.top = 0;
|
||||
drawrect.bottom = front->currentDesc.Height;
|
||||
|
||||
#if 0
|
||||
/* TODO: Support clippers */
|
||||
if (front->clipper)
|
||||
{
|
||||
RECT xrc;
|
||||
HWND hwnd = ((IWineD3DClipperImpl *) front->clipper)->hWnd;
|
||||
if (hwnd && GetClientRect(hwnd,&xrc))
|
||||
{
|
||||
OffsetRect(&xrc,offset.x,offset.y);
|
||||
IntersectRect(&drawrect,&drawrect,&xrc);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (rc) {
|
||||
IntersectRect(&drawrect,&drawrect,rc);
|
||||
}
|
||||
else {
|
||||
/* Only use this if the caller did not pass a rectangle, since
|
||||
* due to double locking this could be the wrong one ...
|
||||
*/
|
||||
if (front->lockedRect.left != front->lockedRect.right) {
|
||||
IntersectRect(&drawrect,&drawrect,&front->lockedRect);
|
||||
}
|
||||
}
|
||||
|
||||
BitBlt(hDisplayDC,
|
||||
drawrect.left-offset.x, drawrect.top-offset.y,
|
||||
drawrect.right-drawrect.left, drawrect.bottom-drawrect.top,
|
||||
hSurfaceDC,
|
||||
drawrect.left, drawrect.top,
|
||||
SRCCOPY);
|
||||
ReleaseDC(hDisplayWnd, hDisplayDC);
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineGDISwapChainImpl_SetDestWindowOverride(IWineD3DSwapChain *iface, HWND window) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
|
||||
This->win_handle = window;
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineGDISwapChainImpl_Present(IWineD3DSwapChain *iface, CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *) iface;
|
||||
IWineD3DSurfaceImpl *front, *back;
|
||||
|
||||
if(!This->backBuffer) {
|
||||
WARN("Swapchain doesn't have a backbuffer, returning WINED3DERR_INVALIDCALL\n");
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
front = (IWineD3DSurfaceImpl *) This->frontBuffer;
|
||||
back = (IWineD3DSurfaceImpl *) This->backBuffer[0];
|
||||
|
||||
/* Flip the DC */
|
||||
{
|
||||
HDC tmp;
|
||||
tmp = front->hDC;
|
||||
front->hDC = back->hDC;
|
||||
back->hDC = tmp;
|
||||
}
|
||||
|
||||
/* Flip the DIBsection */
|
||||
{
|
||||
HBITMAP tmp;
|
||||
tmp = front->dib.DIBsection;
|
||||
front->dib.DIBsection = back->dib.DIBsection;
|
||||
back->dib.DIBsection = tmp;
|
||||
}
|
||||
|
||||
/* Flip the surface data */
|
||||
{
|
||||
void* tmp;
|
||||
|
||||
tmp = front->dib.bitmap_data;
|
||||
front->dib.bitmap_data = back->dib.bitmap_data;
|
||||
back->dib.bitmap_data = tmp;
|
||||
|
||||
tmp = front->resource.allocatedMemory;
|
||||
front->resource.allocatedMemory = back->resource.allocatedMemory;
|
||||
back->resource.allocatedMemory = tmp;
|
||||
|
||||
if(front->resource.heapMemory) {
|
||||
ERR("GDI Surface %p has heap memory allocated\n", front);
|
||||
}
|
||||
if(back->resource.heapMemory) {
|
||||
ERR("GDI Surface %p has heap memory allocated\n", back);
|
||||
}
|
||||
}
|
||||
|
||||
/* client_memory should not be different, but just in case */
|
||||
{
|
||||
BOOL tmp;
|
||||
tmp = front->dib.client_memory;
|
||||
front->dib.client_memory = back->dib.client_memory;
|
||||
back->dib.client_memory = tmp;
|
||||
}
|
||||
|
||||
/* FPS support */
|
||||
if (TRACE_ON(fps))
|
||||
{
|
||||
static long prev_time, frames;
|
||||
|
||||
DWORD time = GetTickCount();
|
||||
frames++;
|
||||
/* every 1.5 seconds */
|
||||
if (time - prev_time > 1500) {
|
||||
TRACE_(fps)("@ approx %.2ffps\n", 1000.0*frames/(time - prev_time));
|
||||
prev_time = time;
|
||||
frames = 0;
|
||||
}
|
||||
}
|
||||
|
||||
x11_copy_to_screen(This, NULL);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
/* FIXME: This should not be needed, the base version is OK */
|
||||
HRESULT WINAPI IWineGDIBaseSwapChainImpl_GetDisplayMode(IWineD3DSwapChain *iface, WINED3DDISPLAYMODE*pMode) {
|
||||
IWineD3DSwapChainImpl *This = (IWineD3DSwapChainImpl *)iface;
|
||||
IWineD3DDeviceImpl *device = This->wineD3DDevice;
|
||||
|
||||
pMode->Width = device->ddraw_width;
|
||||
pMode->Height = device->ddraw_height;
|
||||
pMode->Format = device->ddraw_format;
|
||||
pMode->RefreshRate = 0;
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
const IWineD3DSwapChainVtbl IWineGDISwapChain_Vtbl =
|
||||
{
|
||||
/* IUnknown */
|
||||
IWineD3DBaseSwapChainImpl_QueryInterface,
|
||||
IWineD3DBaseSwapChainImpl_AddRef,
|
||||
IWineD3DBaseSwapChainImpl_Release,
|
||||
/* IWineD3DSwapChain */
|
||||
IWineD3DBaseSwapChainImpl_GetParent,
|
||||
IWineGDISwapChainImpl_Destroy,
|
||||
IWineD3DBaseSwapChainImpl_GetDevice,
|
||||
IWineGDISwapChainImpl_Present,
|
||||
IWineGDISwapChainImpl_SetDestWindowOverride,
|
||||
IWineD3DBaseSwapChainImpl_GetFrontBufferData,
|
||||
IWineD3DBaseSwapChainImpl_GetBackBuffer,
|
||||
IWineD3DBaseSwapChainImpl_GetRasterStatus,
|
||||
IWineD3DBaseSwapChainImpl_GetDisplayMode,
|
||||
IWineD3DBaseSwapChainImpl_GetPresentParameters,
|
||||
IWineD3DBaseSwapChainImpl_SetGammaRamp,
|
||||
IWineD3DBaseSwapChainImpl_GetGammaRamp
|
||||
};
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright 2002-2005 Jason Edmeades
|
||||
* Copyright 2002-2005 Raphael Junqueira
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -95,7 +96,6 @@ static void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) {
|
||||
|
||||
/* Override the IWineD3DResource PreLoad method */
|
||||
unsigned int i;
|
||||
BOOL setGlTextureDesc = FALSE;
|
||||
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
BOOL srgb_mode = This->baseTexture.is_srgb;
|
||||
@@ -103,8 +103,6 @@ static void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) {
|
||||
|
||||
TRACE("(%p) : About to load texture\n", This);
|
||||
|
||||
if (This->baseTexture.textureName == 0) setGlTextureDesc = TRUE;
|
||||
|
||||
if(!device->isInDraw) {
|
||||
/* ActivateContext sets isInDraw to TRUE when loading a pbuffer into a texture, thus no danger of
|
||||
* recursive calls
|
||||
@@ -116,13 +114,20 @@ static void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) {
|
||||
This->baseTexture.is_srgb = srgb_mode;
|
||||
}
|
||||
|
||||
IWineD3DTexture_BindTexture(iface);
|
||||
ENTER_GL();
|
||||
if (This->resource.format == WINED3DFMT_P8 || This->resource.format == WINED3DFMT_A8P8) {
|
||||
for (i = 0; i < This->baseTexture.levels; i++) {
|
||||
if(palette9_changed((IWineD3DSurfaceImpl *)This->surfaces[i])) {
|
||||
TRACE("Reloading surface because the d3d8/9 palette was changed\n");
|
||||
/* TODO: This is not necessarily needed with hw palettized texture support */
|
||||
IWineD3DSurface_LoadLocation(This->surfaces[i], SFLAG_INSYSMEM, NULL);
|
||||
/* Make sure the texture is reloaded because of the palette change, this kills performance though :( */
|
||||
IWineD3DSurface_ModifyLocation(This->surfaces[i], SFLAG_INTEXTURE, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* If the texture is marked dirty or the srgb sampler setting has changed since the last load then reload the surfaces */
|
||||
if (This->baseTexture.dirty) {
|
||||
for (i = 0; i < This->baseTexture.levels; i++) {
|
||||
if(setGlTextureDesc)
|
||||
IWineD3DSurface_SetGlTextureDesc(This->surfaces[i], This->baseTexture.textureName, IWineD3DTexture_GetTextureDimensions(iface));
|
||||
IWineD3DSurface_LoadTexture(This->surfaces[i], srgb_mode);
|
||||
}
|
||||
} else if (srgb_was_toggled) {
|
||||
@@ -139,7 +144,6 @@ static void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) {
|
||||
} else {
|
||||
TRACE("(%p) Texture not dirty, nothing to do\n" , iface);
|
||||
}
|
||||
LEAVE_GL();
|
||||
|
||||
/* No longer dirty */
|
||||
This->baseTexture.dirty = FALSE;
|
||||
@@ -147,6 +151,23 @@ static void WINAPI IWineD3DTextureImpl_PreLoad(IWineD3DTexture *iface) {
|
||||
return ;
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DTextureImpl_UnLoad(IWineD3DTexture *iface) {
|
||||
unsigned int i;
|
||||
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
/* Unload all the surfaces and reset the texture name. If UnLoad was called on the
|
||||
* surface before, this one will be a NOP and vice versa. Unloading an unloaded
|
||||
* surface is fine
|
||||
*/
|
||||
for (i = 0; i < This->baseTexture.levels; i++) {
|
||||
IWineD3DSurface_UnLoad(This->surfaces[i]);
|
||||
IWineD3DSurface_SetGlTextureDesc(This->surfaces[i], 0, IWineD3DTexture_GetTextureDimensions(iface));
|
||||
}
|
||||
|
||||
IWineD3DBaseTextureImpl_UnLoad((IWineD3DBaseTexture *) iface);
|
||||
}
|
||||
|
||||
static WINED3DRESOURCETYPE WINAPI IWineD3DTextureImpl_GetType(IWineD3DTexture *iface) {
|
||||
return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
|
||||
}
|
||||
@@ -193,21 +214,56 @@ static BOOL WINAPI IWineD3DTextureImpl_GetDirty(IWineD3DTexture *iface) {
|
||||
|
||||
static HRESULT WINAPI IWineD3DTextureImpl_BindTexture(IWineD3DTexture *iface) {
|
||||
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
|
||||
TRACE("(%p) : relay to BaseTexture\n", This);
|
||||
return IWineD3DBaseTextureImpl_BindTexture((IWineD3DBaseTexture *)iface);
|
||||
}
|
||||
BOOL set_gl_texture_desc = This->baseTexture.textureName == 0;
|
||||
HRESULT hr;
|
||||
|
||||
static HRESULT WINAPI IWineD3DTextureImpl_UnBindTexture(IWineD3DTexture *iface) {
|
||||
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
|
||||
TRACE("(%p) : relay to BaseTexture\n", This);
|
||||
return IWineD3DBaseTextureImpl_UnBindTexture((IWineD3DBaseTexture *)iface);
|
||||
|
||||
hr = IWineD3DBaseTextureImpl_BindTexture((IWineD3DBaseTexture *)iface);
|
||||
if (set_gl_texture_desc && SUCCEEDED(hr)) {
|
||||
UINT i;
|
||||
for (i = 0; i < This->baseTexture.levels; ++i) {
|
||||
IWineD3DSurface_SetGlTextureDesc(This->surfaces[i], This->baseTexture.textureName, IWineD3DTexture_GetTextureDimensions(iface));
|
||||
}
|
||||
/* Conditinal non power of two textures use a different clamping default. If we're using the GL_WINE_normalized_texrect
|
||||
* partial driver emulation, we're dealing with a GL_TEXTURE_2D texture which has the address mode set to repeat - something
|
||||
* that prevents us from hitting the accelerated codepath. Thus manually set the GL state. The same applies to filtering.
|
||||
* Even if the texture has only one mip level, the default LINEAR_MIPMAP_LINEAR filter causes a SW fallback on macos.
|
||||
*/
|
||||
if(IWineD3DBaseTexture_IsCondNP2(iface)) {
|
||||
ENTER_GL();
|
||||
glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
|
||||
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)");
|
||||
glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)");
|
||||
glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MIN_FILTER, GL_NEAREST)");
|
||||
glTexParameteri(IWineD3DTexture_GetTextureDimensions(iface), GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
checkGLcall("glTexParameteri(dimension, GL_TEXTURE_MAG_FILTER, GL_NEAREST)");
|
||||
LEAVE_GL();
|
||||
This->baseTexture.states[WINED3DTEXSTA_ADDRESSU] = WINED3DTADDRESS_CLAMP;
|
||||
This->baseTexture.states[WINED3DTEXSTA_ADDRESSV] = WINED3DTADDRESS_CLAMP;
|
||||
This->baseTexture.states[WINED3DTEXSTA_MAGFILTER] = WINED3DTEXF_POINT;
|
||||
This->baseTexture.states[WINED3DTEXSTA_MINFILTER] = WINED3DTEXF_POINT;
|
||||
This->baseTexture.states[WINED3DTEXSTA_MIPFILTER] = WINED3DTEXF_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
static UINT WINAPI IWineD3DTextureImpl_GetTextureDimensions(IWineD3DTexture *iface) {
|
||||
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
return GL_TEXTURE_2D;
|
||||
return This->target;
|
||||
}
|
||||
|
||||
static BOOL WINAPI IWineD3DTextureImpl_IsCondNP2(IWineD3DTexture *iface) {
|
||||
IWineD3DTextureImpl *This = (IWineD3DTextureImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
return This->cond_np2;
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DTextureImpl_ApplyStateChanges(IWineD3DTexture *iface,
|
||||
@@ -256,7 +312,7 @@ static HRESULT WINAPI IWineD3DTextureImpl_GetSurfaceLevel(IWineD3DTexture *iface
|
||||
|
||||
if (Level < This->baseTexture.levels) {
|
||||
*ppSurfaceLevel = This->surfaces[Level];
|
||||
IWineD3DSurface_AddRef((IWineD3DSurface*) This->surfaces[Level]);
|
||||
IWineD3DSurface_AddRef(This->surfaces[Level]);
|
||||
hr = WINED3D_OK;
|
||||
TRACE("(%p) : returning %p for level %d\n", This, *ppSurfaceLevel, Level);
|
||||
}
|
||||
@@ -321,6 +377,7 @@ const IWineD3DTextureVtbl IWineD3DTexture_Vtbl =
|
||||
IWineD3DTextureImpl_SetPriority,
|
||||
IWineD3DTextureImpl_GetPriority,
|
||||
IWineD3DTextureImpl_PreLoad,
|
||||
IWineD3DTextureImpl_UnLoad,
|
||||
IWineD3DTextureImpl_GetType,
|
||||
/* IWineD3DBaseTexture */
|
||||
IWineD3DTextureImpl_SetLOD,
|
||||
@@ -332,8 +389,8 @@ const IWineD3DTextureVtbl IWineD3DTexture_Vtbl =
|
||||
IWineD3DTextureImpl_SetDirty,
|
||||
IWineD3DTextureImpl_GetDirty,
|
||||
IWineD3DTextureImpl_BindTexture,
|
||||
IWineD3DTextureImpl_UnBindTexture,
|
||||
IWineD3DTextureImpl_GetTextureDimensions,
|
||||
IWineD3DTextureImpl_IsCondNP2,
|
||||
IWineD3DTextureImpl_ApplyStateChanges,
|
||||
/* IWineD3DTexture */
|
||||
IWineD3DTextureImpl_Destroy,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -4,6 +4,7 @@
|
||||
* Copyright 2002-2005 Jason Edmeades
|
||||
* Raphael Junqueira
|
||||
* Copyright 2004 Christian Costa
|
||||
* Copyright 2007 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -104,76 +105,187 @@ static DWORD WINAPI IWineD3DVertexBufferImpl_GetPriority(IWineD3DVertexBuffer
|
||||
return IWineD3DResourceImpl_GetPriority((IWineD3DResource *)iface);
|
||||
}
|
||||
|
||||
static void fixup_vertices(
|
||||
BYTE *src, BYTE *dst,
|
||||
int stride,
|
||||
int num,
|
||||
int pos, BOOL haspos,
|
||||
int diffuse, BOOL hasdiffuse,
|
||||
int specular, BOOL hasspecular
|
||||
) {
|
||||
int i;
|
||||
static inline void fixup_d3dcolor(DWORD *pos) {
|
||||
DWORD srcColor = *pos;
|
||||
|
||||
/* Color conversion like in drawStridedSlow. watch out for little endianity
|
||||
* If we want that stuff to work on big endian machines too we have to consider more things
|
||||
*
|
||||
* 0xff000000: Alpha mask
|
||||
* 0x00ff0000: Blue mask
|
||||
* 0x0000ff00: Green mask
|
||||
* 0x000000ff: Red mask
|
||||
*/
|
||||
*pos = 0;
|
||||
*pos |= (srcColor & 0xff00ff00) ; /* Alpha Green */
|
||||
*pos |= (srcColor & 0x00ff0000) >> 16; /* Red */
|
||||
*pos |= (srcColor & 0x000000ff) << 16; /* Blue */
|
||||
}
|
||||
|
||||
static inline void fixup_transformed_pos(float *p) {
|
||||
float x, y, z, w;
|
||||
|
||||
for(i = num - 1; i >= 0; i--) {
|
||||
if(haspos) {
|
||||
float *p = (float *) ((src + pos) + i * stride);
|
||||
/* rhw conversion like in drawStridedSlow */
|
||||
if(p[3] == 1.0 || ((p[3] < eps) && (p[3] > -eps))) {
|
||||
x = p[0];
|
||||
y = p[1];
|
||||
z = p[2];
|
||||
w = 1.0;
|
||||
} else {
|
||||
w = 1.0 / p[3];
|
||||
x = p[0] * w;
|
||||
y = p[1] * w;
|
||||
z = p[2] * w;
|
||||
}
|
||||
p[0] = x;
|
||||
p[1] = y;
|
||||
p[2] = z;
|
||||
p[3] = w;
|
||||
}
|
||||
|
||||
/* rhw conversion like in drawStridedSlow */
|
||||
if(p[3] == 1.0 || ((p[3] < eps) && (p[3] > -eps))) {
|
||||
x = p[0];
|
||||
y = p[1];
|
||||
z = p[2];
|
||||
w = 1.0;
|
||||
} else {
|
||||
w = 1.0 / p[3];
|
||||
x = p[0] * w;
|
||||
y = p[1] * w;
|
||||
z = p[2] * w;
|
||||
}
|
||||
p = (float *) (dst + i * stride + pos);
|
||||
p[0] = x;
|
||||
p[1] = y;
|
||||
p[2] = z;
|
||||
p[3] = w;
|
||||
}
|
||||
if(hasdiffuse) {
|
||||
DWORD srcColor, *dstColor = (DWORD *) (dst + i * stride + diffuse);
|
||||
srcColor = * (DWORD *) ( (src + diffuse) + i * stride);
|
||||
DWORD *find_conversion_shift(IWineD3DVertexBufferImpl *This, WineDirect3DVertexStridedData *strided, DWORD stride) {
|
||||
DWORD *ret, i, shift, j, type;
|
||||
DWORD orig_type_size;
|
||||
|
||||
/* Color conversion like in drawStridedSlow. watch out for little endianity
|
||||
* If we want that stuff to work on big endian machines too we have to consider more things
|
||||
*
|
||||
* 0xff000000: Alpha mask
|
||||
* 0x00ff0000: Blue mask
|
||||
* 0x0000ff00: Green mask
|
||||
* 0x000000ff: Red mask
|
||||
*/
|
||||
if(!stride) {
|
||||
TRACE("No shift\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*dstColor = 0;
|
||||
*dstColor |= (srcColor & 0xff00ff00) ; /* Alpha Green */
|
||||
*dstColor |= (srcColor & 0x00ff0000) >> 16; /* Red */
|
||||
*dstColor |= (srcColor & 0x000000ff) << 16; /* Blue */
|
||||
}
|
||||
if(hasspecular) {
|
||||
DWORD srcColor, *dstColor = (DWORD *) (dst + i * stride + specular);
|
||||
srcColor = * (DWORD *) ( (src + specular) + i * stride);
|
||||
This->conv_stride = stride;
|
||||
ret = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DWORD) * stride);
|
||||
for(i = 0; i < MAX_ATTRIBS; i++) {
|
||||
if(strided->u.input[i].VBO != This->vbo) continue;
|
||||
|
||||
/* Similar to diffuse
|
||||
* TODO: Write the alpha value out for fog coords
|
||||
type = strided->u.input[i].dwType;
|
||||
if(type == WINED3DDECLTYPE_FLOAT16_2) {
|
||||
shift = 4;
|
||||
} else if(type == WINED3DDECLTYPE_FLOAT16_4) {
|
||||
shift = 8;
|
||||
/* Pre-shift the last 4 bytes in the FLOAT16_4 by 4 bytes - this makes FLOAT16_2 and FLOAT16_4 conversions
|
||||
* compatible
|
||||
*/
|
||||
*dstColor = 0;
|
||||
*dstColor |= (srcColor & 0xff00ff00) ; /* Alpha Green */
|
||||
*dstColor |= (srcColor & 0x00ff0000) >> 16; /* Red */
|
||||
*dstColor |= (srcColor & 0x000000ff) << 16; /* Blue */
|
||||
for(j = 4; j < 8; j++) {
|
||||
ret[(DWORD_PTR) strided->u.input[i].lpData + j ] += 4;
|
||||
}
|
||||
} else {
|
||||
shift = 0;
|
||||
}
|
||||
This->conv_stride += shift;
|
||||
|
||||
if(shift) {
|
||||
orig_type_size = WINED3D_ATR_TYPESIZE(type) * WINED3D_ATR_SIZE(type);
|
||||
for(j = (DWORD_PTR) strided->u.input[i].lpData + orig_type_size; j < stride; j++) {
|
||||
ret[j] += shift;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(TRACE_ON(d3d)) {
|
||||
TRACE("Dumping conversion shift:\n");
|
||||
for(i = 0; i < stride; i++) {
|
||||
TRACE("[%d]", ret[i]);
|
||||
}
|
||||
TRACE("\n");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline BOOL process_converted_attribute(IWineD3DVertexBufferImpl *This,
|
||||
const enum vbo_conversion_type conv_type,
|
||||
const WineDirect3DStridedData *attrib,
|
||||
DWORD *stride_this_run, const DWORD type) {
|
||||
DWORD attrib_size;
|
||||
BOOL ret = FALSE;
|
||||
int i;
|
||||
DWORD offset = This->resource.wineD3DDevice->stateBlock->streamOffset[attrib->streamNo];
|
||||
DWORD_PTR data;
|
||||
|
||||
/* Check for some valid situations which cause us pain. One is if the buffer is used for
|
||||
* constant attributes(stride = 0), the other one is if the buffer is used on two streams
|
||||
* with different strides. In the 2nd case we might have to drop conversion entirely,
|
||||
* it is possible that the same bytes are once read as FLOAT2 and once as UBYTE4N.
|
||||
*/
|
||||
if(attrib->dwStride == 0) {
|
||||
FIXME("%s used with stride 0, let's hope we get the vertex stride from somewhere else\n",
|
||||
debug_d3ddecltype(type));
|
||||
} else if(attrib->dwStride != *stride_this_run &&
|
||||
*stride_this_run) {
|
||||
FIXME("Got two concurrent strides, %d and %d\n", attrib->dwStride, *stride_this_run);
|
||||
} else {
|
||||
*stride_this_run = attrib->dwStride;
|
||||
if(This->stride != *stride_this_run) {
|
||||
/* We rely that this happens only on the first converted attribute that is found,
|
||||
* if at all. See above check
|
||||
*/
|
||||
TRACE("Reconverting because converted attributes occur, and the stride changed\n");
|
||||
This->stride = *stride_this_run;
|
||||
HeapFree(GetProcessHeap(), HEAP_ZERO_MEMORY, This->conv_map);
|
||||
This->conv_map = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This->conv_map) * This->stride);
|
||||
ret = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
data = (((DWORD_PTR) attrib->lpData) + offset) % This->stride;
|
||||
attrib_size = WINED3D_ATR_SIZE(type) * WINED3D_ATR_TYPESIZE(type);
|
||||
for(i = 0; i < attrib_size; i++) {
|
||||
if(This->conv_map[data + i] != conv_type) {
|
||||
TRACE("Byte %ld in vertex changed\n", i + data);
|
||||
TRACE("It was type %d, is %d now\n", This->conv_map[data + i], conv_type);
|
||||
ret = TRUE;
|
||||
This->conv_map[data + i] = conv_type;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline BOOL check_attribute(IWineD3DVertexBufferImpl *This, const WineDirect3DStridedData *attrib,
|
||||
const BOOL check_d3dcolor, const BOOL is_ffp_position, const BOOL is_ffp_color,
|
||||
DWORD *stride_this_run, BOOL *float16_used) {
|
||||
BOOL ret = FALSE;
|
||||
DWORD type;
|
||||
|
||||
/* Ignore attributes that do not have our vbo. After that check we can be sure that the attribute is
|
||||
* there, on nonexistent attribs the vbo is 0.
|
||||
*/
|
||||
if(attrib->VBO != This->vbo) return FALSE;
|
||||
|
||||
type = attrib->dwType;
|
||||
/* Look for newly appeared conversion */
|
||||
if(!GL_SUPPORT(NV_HALF_FLOAT) && (
|
||||
type == WINED3DDECLTYPE_FLOAT16_2 ||
|
||||
type == WINED3DDECLTYPE_FLOAT16_4)) {
|
||||
|
||||
ret = process_converted_attribute(This, CONV_FLOAT16_2, attrib, stride_this_run, type);
|
||||
|
||||
if(is_ffp_position) {
|
||||
FIXME("Test FLOAT16 fixed function processing positions\n");
|
||||
} else if(is_ffp_color) {
|
||||
FIXME("test FLOAT16 fixed function processing colors\n");
|
||||
}
|
||||
*float16_used = TRUE;
|
||||
} else if(check_d3dcolor && type == WINED3DDECLTYPE_D3DCOLOR) {
|
||||
|
||||
ret = process_converted_attribute(This, CONV_D3DCOLOR, attrib, stride_this_run, WINED3DDECLTYPE_D3DCOLOR);
|
||||
|
||||
if(!is_ffp_color) {
|
||||
FIXME("Test for non-color fixed function D3DCOLOR type\n");
|
||||
}
|
||||
} else if(is_ffp_position && type == WINED3DDECLTYPE_FLOAT4) {
|
||||
ret = process_converted_attribute(This, CONV_POSITIONT, attrib, stride_this_run, WINED3DDECLTYPE_FLOAT4);
|
||||
} else if(This->conv_map) {
|
||||
ret = process_converted_attribute(This, CONV_NONE, attrib, stride_this_run, type);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
inline BOOL WINAPI IWineD3DVertexBufferImpl_FindDecl(IWineD3DVertexBufferImpl *This)
|
||||
{
|
||||
WineDirect3DVertexStridedData strided;
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
BOOL ret = FALSE;
|
||||
int i;
|
||||
DWORD stride_this_run = 0;
|
||||
BOOL float16_used = FALSE;
|
||||
|
||||
/* In d3d7 the vertex buffer declaration NEVER changes because it is stored in the d3d7 vertex buffer.
|
||||
* Once we have our declaration there is no need to look it up again.
|
||||
@@ -182,92 +294,220 @@ inline BOOL WINAPI IWineD3DVertexBufferImpl_FindDecl(IWineD3DVertexBufferImpl *T
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* There are certain vertex data types that need to be fixed up. The Vertex Buffers FVF doesn't
|
||||
* help finding them, only the vertex declaration or the device FVF can determine that at drawPrim
|
||||
* time. Rules are as follows:
|
||||
TRACE("Finding vertex buffer conversion information\n");
|
||||
/* Certain declaration types need some fixups before we can pass them to opengl. This means D3DCOLOR attributes with fixed
|
||||
* function vertex processing, FLOAT4 POSITIONT with fixed function, and FLOAT16 if GL_NV_half_float is not supported.
|
||||
*
|
||||
* -> No modification when Vertex Shaders are used
|
||||
* -> Fix up position1 and position 2 if they are XYZRHW
|
||||
* -> Fix up diffuse color
|
||||
* -> Fix up specular color
|
||||
* The vertex buffer FVF doesn't help with finding them, we have to use the decoded vertex declaration and pick the things
|
||||
* that concern the current buffer. A problem with this is that this can change between draws, so we have to validate
|
||||
* the information and reprocess the buffer if it changes, and avoid false positives for performance reasons.
|
||||
*
|
||||
* The Declaration is only known at drawing time, and it can change from draw to draw. If any converted values
|
||||
* are changed, the whole buffer has to be reconverted and reloaded. (Converting is SLOW, so if this happens too
|
||||
* often PreLoad stops converting entirely and falls back to drawStridedSlow).
|
||||
* We have to distinguish between vertex shaders and fixed function to pick the way we access the
|
||||
* strided vertex information.
|
||||
*
|
||||
* Reconvert if:
|
||||
* -> New semantics that have to be converted appear
|
||||
* -> The position of semantics that have to be converted changes
|
||||
* -> The stride of the vertex changed AND there is stuff that needs conversion
|
||||
* -> (If a vertex shader is bound and in use assume that nothing that needs conversion is there)
|
||||
* This code sets up a per-byte array with the size of the detected stride of the arrays in the
|
||||
* buffer. For each byte we have a field that marks the conversion needed on this byte. For example,
|
||||
* the following declaration with fixed function vertex processing:
|
||||
*
|
||||
* Return values:
|
||||
* TRUE: Reload is needed
|
||||
* FALSE: otherwise
|
||||
* POSITIONT, FLOAT4
|
||||
* NORMAL, FLOAT3
|
||||
* DIFFUSE, FLOAT16_4
|
||||
* SPECULAR, D3DCOLOR
|
||||
*
|
||||
* Will result in
|
||||
* { POSITIONT }{ NORMAL }{ DIFFUSE }{SPECULAR }
|
||||
* [P][P][P][P][P][P][P][P][P][P][P][P][P][P][P][P][0][0][0][0][0][0][0][0][0][0][0][0][F][F][F][F][F][F][F][F][C][C][C][C]
|
||||
*
|
||||
* Where in this example map P means 4 component position conversion, 0 means no conversion, F means FLOAT16_2 conversion
|
||||
* and C means D3DCOLOR conversion(red / blue swizzle).
|
||||
*
|
||||
* If we're doing conversion and the stride changes we have to reconvert the whole buffer. Note that we do not mind if the
|
||||
* semantic changes, we only care for the conversion type. So if the NORMAL is replaced with a TEXCOORD, nothing has to be
|
||||
* done, or if the DIFFUSE is replaced with a D3DCOLOR BLENDWEIGHT we can happily dismiss the change. Some conversion types
|
||||
* depend on the semantic as well, for example a FLOAT4 texcoord needs no conversion while a FLOAT4 positiont needs one
|
||||
*/
|
||||
if(use_vs(device)) {
|
||||
TRACE("vhsader\n");
|
||||
/* If the current vertex declaration is marked for no half float conversion don't bother to
|
||||
* analyse the strided streams in depth, just set them up for no conversion. Return decl changed
|
||||
* if we used conversion before
|
||||
*/
|
||||
if(!((IWineD3DVertexDeclarationImpl *) device->stateBlock->vertexDecl)->half_float_conv_needed) {
|
||||
if(This->conv_map) {
|
||||
TRACE("Now using shaders without conversion, but conversion used before\n");
|
||||
HeapFree(GetProcessHeap(), 0, This->conv_map);
|
||||
HeapFree(GetProcessHeap(), 0, This->conv_shift);
|
||||
This->conv_map = NULL;
|
||||
This->stride = 0;
|
||||
This->conv_shift = NULL;
|
||||
This->conv_stride = 0;
|
||||
return TRUE;
|
||||
} else {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
for(i = 0; i < MAX_ATTRIBS; i++) {
|
||||
ret = check_attribute(This, &device->strided_streams.u.input[i], FALSE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
}
|
||||
|
||||
if (use_vs(device)) {
|
||||
/* Assume no conversion */
|
||||
memset(&strided, 0, sizeof(strided));
|
||||
/* Recalculate the conversion shift map if the declaration has changed,
|
||||
* and we're using float16 conversion or used it on the last run
|
||||
*/
|
||||
if(ret && (float16_used || This->conv_map)) {
|
||||
HeapFree(GetProcessHeap(), 0, This->conv_shift);
|
||||
This->conv_shift = find_conversion_shift(This, &device->strided_streams, This->stride);
|
||||
}
|
||||
} else {
|
||||
/* we need a copy because we modify some params */
|
||||
memcpy(&strided, &device->strided_streams, sizeof(strided));
|
||||
/* Fixed function is a bit trickier. We have to take care for D3DCOLOR types, FLOAT4 positions and of course
|
||||
* FLOAT16s if not supported. Also, we can't iterate over the array, so use macros to generate code for all
|
||||
* the attributes that our current fixed function pipeline implementation cares for.
|
||||
*/
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.position, TRUE, TRUE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.normal, TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.diffuse, TRUE, FALSE, TRUE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.specular, TRUE, FALSE, TRUE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.texCoords[0], TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.texCoords[1], TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.texCoords[2], TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.texCoords[3], TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.texCoords[4], TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.texCoords[5], TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.texCoords[6], TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
ret = check_attribute(This, &device->strided_streams.u.s.texCoords[7], TRUE, FALSE, FALSE, &stride_this_run, &float16_used) || ret;
|
||||
|
||||
/* Filter out data that does not come from this VBO */
|
||||
if(strided.u.s.position.VBO != This->vbo) memset(&strided.u.s.position, 0, sizeof(strided.u.s.position));
|
||||
if(strided.u.s.diffuse.VBO != This->vbo) memset(&strided.u.s.diffuse, 0, sizeof(strided.u.s.diffuse));
|
||||
if(strided.u.s.specular.VBO != This->vbo) memset(&strided.u.s.specular, 0, sizeof(strided.u.s.specular));
|
||||
if(strided.u.s.position2.VBO != This->vbo) memset(&strided.u.s.position2, 0, sizeof(strided.u.s.position2));
|
||||
if(float16_used) FIXME("Float16 conversion used with fixed function vertex processing\n");
|
||||
}
|
||||
|
||||
/* We have a declaration now in the buffer */
|
||||
if(stride_this_run == 0 && This->conv_map) {
|
||||
/* Sanity test */
|
||||
if(ret == FALSE) {
|
||||
ERR("no converted attributes found, old conversion map exists, and no declaration change???\n");
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, This->conv_map);
|
||||
This->conv_map = NULL;
|
||||
This->stride = 0;
|
||||
}
|
||||
This->Flags |= VBFLAG_HASDESC;
|
||||
|
||||
/* Find out if reload is needed
|
||||
* Position of the semantic in the vertex and the stride must be equal to the stored type. Don't mind if only unconverted stuff changed.
|
||||
*
|
||||
* If some stuff does not exist in the buffer, then lpData, dwStride and dwType are memsetted to 0. So if the semantic didn't exist before
|
||||
* and does not exist now all 3 values will be equal(=0).
|
||||
*
|
||||
* Checking the lpData field alone is not enough, because data may appear at offset 0 in the buffer. This is the same location as nonexistent
|
||||
* data uses, so we have to check the type and stride too. Colors can be at offset 0 too, because it is perfectly fine to render from 2 or more
|
||||
* buffers at the same time and get the position from one and the color from the other buffer.
|
||||
*/
|
||||
if( /* Position transformed vs untransformed */
|
||||
((This->strided.u.s.position_transformed || strided.u.s.position_transformed) &&
|
||||
(This->strided.u.s.position.lpData != strided.u.s.position.lpData ||
|
||||
This->strided.u.s.position.dwType != strided.u.s.position.dwType)) ||
|
||||
/* Diffuse position and data type */
|
||||
This->strided.u.s.diffuse.lpData != strided.u.s.diffuse.lpData || This->strided.u.s.diffuse.dwStride != strided.u.s.diffuse.dwStride ||
|
||||
This->strided.u.s.diffuse.dwType != strided.u.s.diffuse.dwType ||
|
||||
/* Specular position and data type */
|
||||
This->strided.u.s.specular.lpData != strided.u.s.specular.lpData || This->strided.u.s.specular.dwStride != strided.u.s.specular.dwStride ||
|
||||
This->strided.u.s.specular.dwType != strided.u.s.specular.dwType) {
|
||||
if(ret) TRACE("Conversion information changed\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
TRACE("Declaration changed, reloading buffer\n");
|
||||
/* Set the new description */
|
||||
memcpy(&This->strided, &strided, sizeof(strided));
|
||||
return TRUE;
|
||||
static void check_vbo_size(IWineD3DVertexBufferImpl *This) {
|
||||
DWORD size = This->conv_stride ? This->conv_stride * (This->resource.size / This->stride) : This->resource.size;
|
||||
if(This->vbo_size != size) {
|
||||
TRACE("Old size %d, creating new size %d\n", This->vbo_size, size);
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, This->vbo));
|
||||
checkGLcall("glBindBufferARB");
|
||||
GL_EXTCALL(glBufferDataARB(GL_ARRAY_BUFFER_ARB, size, NULL, This->vbo_usage));
|
||||
This->vbo_size = size;
|
||||
checkGLcall("glBufferDataARB");
|
||||
LEAVE_GL();
|
||||
}
|
||||
}
|
||||
|
||||
static void CreateVBO(IWineD3DVertexBufferImpl *This) {
|
||||
GLenum error, glUsage;
|
||||
DWORD vboUsage = This->resource.usage;
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
|
||||
TRACE("Creating an OpenGL vertex buffer object for IWineD3DVertexBuffer %p Usage(%s)\n", This, debug_d3dusage(vboUsage));
|
||||
|
||||
/* Make sure that a context is there. Needed in a multithreaded environment. Otherwise this call is a nop */
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
ENTER_GL();
|
||||
|
||||
/* Make sure that the gl error is cleared. Do not use checkGLcall
|
||||
* here because checkGLcall just prints a fixme and continues. However,
|
||||
* if an error during VBO creation occurs we can fall back to non-vbo operation
|
||||
* with full functionality(but performance loss)
|
||||
*/
|
||||
while(glGetError() != GL_NO_ERROR);
|
||||
|
||||
/* Basically the FVF parameter passed to CreateVertexBuffer is no good
|
||||
* It is the FVF set with IWineD3DDevice::SetFVF or the Vertex Declaration set with
|
||||
* IWineD3DDevice::SetVertexDeclaration that decides how the vertices in the buffer
|
||||
* look like. This means that on each DrawPrimitive call the vertex buffer has to be verified
|
||||
* to check if the rhw and color values are in the correct format.
|
||||
*/
|
||||
|
||||
GL_EXTCALL(glGenBuffersARB(1, &This->vbo));
|
||||
error = glGetError();
|
||||
if(This->vbo == 0 || error != GL_NO_ERROR) {
|
||||
WARN("Failed to create a VBO with error %s (%#x)\n", debug_glerror(error), error);
|
||||
goto error;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, This->vbo));
|
||||
error = glGetError();
|
||||
if(error != GL_NO_ERROR) {
|
||||
WARN("Failed to bind the VBO with error %s (%#x)\n", debug_glerror(error), error);
|
||||
goto error;
|
||||
}
|
||||
|
||||
/* Don't use static, because dx apps tend to update the buffer
|
||||
* quite often even if they specify 0 usage. Because we always keep the local copy
|
||||
* we never read from the vbo and can create a write only opengl buffer.
|
||||
*/
|
||||
switch(vboUsage & (WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_DYNAMIC) ) {
|
||||
case WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_DYNAMIC:
|
||||
case WINED3DUSAGE_DYNAMIC:
|
||||
TRACE("Gl usage = GL_STREAM_DRAW\n");
|
||||
glUsage = GL_STREAM_DRAW_ARB;
|
||||
break;
|
||||
case WINED3DUSAGE_WRITEONLY:
|
||||
default:
|
||||
TRACE("Gl usage = GL_DYNAMIC_DRAW\n");
|
||||
glUsage = GL_DYNAMIC_DRAW_ARB;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Reserve memory for the buffer. The amount of data won't change
|
||||
* so we are safe with calling glBufferData once with a NULL ptr and
|
||||
* calling glBufferSubData on updates
|
||||
*/
|
||||
GL_EXTCALL(glBufferDataARB(GL_ARRAY_BUFFER_ARB, This->resource.size, NULL, glUsage));
|
||||
error = glGetError();
|
||||
if(error != GL_NO_ERROR) {
|
||||
WARN("glBufferDataARB failed with error %s (%#x)\n", debug_glerror(error), error);
|
||||
goto error;
|
||||
}
|
||||
This->vbo_size = This->resource.size;
|
||||
This->vbo_usage = glUsage;
|
||||
This->dirtystart = 0;
|
||||
This->dirtyend = This->resource.size;
|
||||
This->Flags |= VBFLAG_DIRTY;
|
||||
|
||||
LEAVE_GL();
|
||||
|
||||
return;
|
||||
error:
|
||||
/* Clean up all vbo init, but continue because we can work without a vbo :-) */
|
||||
FIXME("Failed to create a vertex buffer object. Continuing, but performance issues can occur\n");
|
||||
if(This->vbo) GL_EXTCALL(glDeleteBuffersARB(1, &This->vbo));
|
||||
This->vbo = 0;
|
||||
LEAVE_GL();
|
||||
return;
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *iface) {
|
||||
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *) iface;
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
BYTE *data;
|
||||
UINT start = 0, end = 0, stride = 0;
|
||||
UINT start = 0, end = 0, vertices;
|
||||
BOOL declChanged = FALSE;
|
||||
int i, j;
|
||||
TRACE("(%p)->()\n", This);
|
||||
|
||||
if(This->Flags & VBFLAG_LOAD) {
|
||||
return; /* Already doing that stuff */
|
||||
}
|
||||
|
||||
if(!This->vbo) {
|
||||
/* TODO: Make converting independent from VBOs */
|
||||
return; /* Not doing any conversion */
|
||||
if(This->Flags & VBFLAG_CREATEVBO) {
|
||||
CreateVBO(This);
|
||||
This->Flags &= ~VBFLAG_CREATEVBO;
|
||||
} else {
|
||||
return; /* Not doing any conversion */
|
||||
}
|
||||
}
|
||||
|
||||
/* Reading the declaration makes only sense if the stateblock is finalized and the buffer bound to a stream */
|
||||
@@ -275,7 +515,7 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
|
||||
declChanged = IWineD3DVertexBufferImpl_FindDecl(This);
|
||||
} else if(This->Flags & VBFLAG_HASDESC) {
|
||||
/* Reuse the declaration stored in the buffer. It will most likely not change, and if it does
|
||||
* the stream source state handler will call PreLoad again and the change will be cought
|
||||
* the stream source state handler will call PreLoad again and the change will be caught
|
||||
*/
|
||||
} else {
|
||||
/* Cannot get a declaration, and no declaration is stored in the buffer. It is pointless to preload
|
||||
@@ -286,21 +526,22 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
|
||||
}
|
||||
|
||||
/* If applications change the declaration over and over, reconverting all the time is a huge
|
||||
* performance hit. So count the declaration changes and release the VBO if there are too much
|
||||
* of them(and thus stop converting)
|
||||
* performance hit. So count the declaration changes and release the VBO if there are too many
|
||||
* of them (and thus stop converting)
|
||||
*/
|
||||
if(declChanged) {
|
||||
This->declChanges++;
|
||||
This->draws = 0;
|
||||
|
||||
if(This->declChanges > VB_MAXDECLCHANGES) {
|
||||
FIXME("Too much declaration changes, stopping converting\n");
|
||||
FIXME("Too many declaration changes, stopping converting\n");
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glDeleteBuffersARB(1, &This->vbo));
|
||||
checkGLcall("glDeleteBuffersARB");
|
||||
LEAVE_GL();
|
||||
This->vbo = 0;
|
||||
HeapFree(GetProcessHeap(), 0, This->conv_shift);
|
||||
|
||||
/* The stream source state handler might have read the memory of the vertex buffer already
|
||||
* and got the memory in the vbo which is not valid any longer. Dirtify the stream source
|
||||
@@ -311,6 +552,7 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
|
||||
|
||||
return;
|
||||
}
|
||||
check_vbo_size(This);
|
||||
} else {
|
||||
/* However, it is perfectly fine to change the declaration every now and then. We don't want a game that
|
||||
* changes it every minute drop the VBO after VB_MAX_DECL_CHANGES minutes. So count draws without
|
||||
@@ -327,6 +569,11 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
|
||||
end = This->resource.size;
|
||||
} else if(This->Flags & VBFLAG_DIRTY) {
|
||||
/* No decl change, but dirty data, reload the changed stuff */
|
||||
if(This->conv_shift) {
|
||||
if(This->dirtystart != 0 || This->dirtyend != 0) {
|
||||
FIXME("Implement partial buffer loading with shifted conversion\n");
|
||||
}
|
||||
}
|
||||
start = This->dirtystart;
|
||||
end = This->dirtyend;
|
||||
} else {
|
||||
@@ -339,15 +586,12 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
|
||||
This->dirtystart = 0;
|
||||
This->dirtyend = 0;
|
||||
|
||||
if (This->strided.u.s.position.dwStride) stride = This->strided.u.s.position.dwStride;
|
||||
else if(This->strided.u.s.specular.dwStride) stride = This->strided.u.s.specular.dwStride;
|
||||
else if(This->strided.u.s.diffuse.dwStride) stride = This->strided.u.s.diffuse.dwStride;
|
||||
else {
|
||||
if(!This->conv_map) {
|
||||
/* That means that there is nothing to fixup. Just upload from This->resource.allocatedMemory
|
||||
* directly into the vbo. Do not free the system memory copy because drawPrimitive may need it if
|
||||
* the stride is 0, for instancing emulation, vertex blending emulation or shader emulation.
|
||||
*/
|
||||
TRACE("No conversion needed, locking directly into the VBO in future\n");
|
||||
TRACE("No conversion needed\n");
|
||||
|
||||
if(!device->isInDraw) {
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
@@ -361,40 +605,103 @@ static void WINAPI IWineD3DVertexBufferImpl_PreLoad(IWineD3DVertexBuffer *if
|
||||
return;
|
||||
}
|
||||
|
||||
/* OK, we have the original data from the app, the description of the buffer and the dirty area.
|
||||
* so convert the stuff
|
||||
*/
|
||||
data = HeapAlloc(GetProcessHeap(), 0, end-start);
|
||||
if(!data) {
|
||||
ERR("Out of memory\n");
|
||||
return;
|
||||
}
|
||||
memcpy(data, This->resource.allocatedMemory + start, end - start);
|
||||
/* Now for each vertex in the buffer that needs conversion */
|
||||
vertices = This->resource.size / This->stride;
|
||||
|
||||
fixup_vertices(data, data, stride, ( end - start) / stride,
|
||||
/* Position */
|
||||
(int)This->strided.u.s.position.lpData, /* Data location */
|
||||
This->strided.u.s.position_transformed, /* Do convert? */
|
||||
/* Diffuse color */
|
||||
(int)This->strided.u.s.diffuse.lpData, /* Location */
|
||||
This->strided.u.s.diffuse.dwType == WINED3DDECLTYPE_SHORT4 || This->strided.u.s.diffuse.dwType == WINED3DDECLTYPE_D3DCOLOR, /* Convert? */
|
||||
/* specular color */
|
||||
(int)This->strided.u.s.specular.lpData, /* location */
|
||||
This->strided.u.s.specular.dwType == WINED3DDECLTYPE_SHORT4 || This->strided.u.s.specular.dwType == WINED3DDECLTYPE_D3DCOLOR);
|
||||
if(This->conv_shift) {
|
||||
TRACE("Shifted conversion\n");
|
||||
data = HeapAlloc(GetProcessHeap(), 0, vertices * This->conv_stride);
|
||||
|
||||
if(!device->isInDraw) {
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
for(i = start / This->stride; i < min((end / This->stride) + 1, vertices); i++) {
|
||||
for(j = 0; j < This->stride; j++) {
|
||||
switch(This->conv_map[j]) {
|
||||
case CONV_NONE:
|
||||
data[This->conv_stride * i + j + This->conv_shift[j]] = This->resource.allocatedMemory[This->stride * i + j];
|
||||
break;
|
||||
|
||||
case CONV_FLOAT16_2:
|
||||
{
|
||||
float *out = (float *) (&data[This->conv_stride * i + j + This->conv_shift[j]]);
|
||||
WORD *in = (WORD *) (&This->resource.allocatedMemory[i * This->stride + j]);
|
||||
|
||||
out[1] = float_16_to_32(in + 1);
|
||||
out[0] = float_16_to_32(in + 0);
|
||||
j += 3; /* Skip 3 additional bytes,as a FLOAT16_2 has 4 bytes */
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
FIXME("Unimplemented conversion %d in shifted conversion\n", This->conv_map[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, This->vbo));
|
||||
checkGLcall("glBindBufferARB");
|
||||
GL_EXTCALL(glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, 0, vertices * This->conv_stride, data));
|
||||
checkGLcall("glBufferSubDataARB");
|
||||
LEAVE_GL();
|
||||
|
||||
} else {
|
||||
data = HeapAlloc(GetProcessHeap(), 0, This->resource.size);
|
||||
memcpy(data + start, This->resource.allocatedMemory + start, end - start);
|
||||
for(i = start / This->stride; i < min((end / This->stride) + 1, vertices); i++) {
|
||||
for(j = 0; j < This->stride; j++) {
|
||||
switch(This->conv_map[j]) {
|
||||
case CONV_NONE:
|
||||
/* Done already */
|
||||
j += 3;
|
||||
break;
|
||||
case CONV_D3DCOLOR:
|
||||
fixup_d3dcolor((DWORD *) (data + i * This->stride + j));
|
||||
j += 3;
|
||||
break;
|
||||
|
||||
case CONV_POSITIONT:
|
||||
fixup_transformed_pos((float *) (data + i * This->stride + j));
|
||||
j += 15;
|
||||
break;
|
||||
|
||||
case CONV_FLOAT16_2:
|
||||
ERR("Did not expect FLOAT16 conversion in unshifted conversion\n");
|
||||
default:
|
||||
FIXME("Unimplemented conversion %d in shifted conversion\n", This->conv_map[j]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, This->vbo));
|
||||
checkGLcall("glBindBufferARB");
|
||||
GL_EXTCALL(glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, start, end - start, data + start));
|
||||
checkGLcall("glBufferSubDataARB");
|
||||
LEAVE_GL();
|
||||
}
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glBindBufferARB(GL_ARRAY_BUFFER_ARB, This->vbo));
|
||||
checkGLcall("glBindBufferARB");
|
||||
GL_EXTCALL(glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, start, end - start, data));
|
||||
checkGLcall("glBufferSubDataARB");
|
||||
LEAVE_GL();
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DVertexBufferImpl_UnLoad(IWineD3DVertexBuffer *iface) {
|
||||
IWineD3DVertexBufferImpl *This = (IWineD3DVertexBufferImpl *) iface;
|
||||
IWineD3DDeviceImpl *device = This->resource.wineD3DDevice;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
/* This is easy: The whole content is shadowed in This->resource.allocatedMemory,
|
||||
* so we only have to destroy the vbo. Only do it if we have a vbo, which implies
|
||||
* that vbos are supported
|
||||
*/
|
||||
if(This->vbo) {
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
ENTER_GL();
|
||||
GL_EXTCALL(glDeleteBuffersARB(1, &This->vbo));
|
||||
checkGLcall("glDeleteBuffersARB");
|
||||
LEAVE_GL();
|
||||
This->vbo = 0;
|
||||
This->Flags |= VBFLAG_CREATEVBO; /* Recreate the VBO next load */
|
||||
}
|
||||
}
|
||||
|
||||
static WINED3DRESOURCETYPE WINAPI IWineD3DVertexBufferImpl_GetType(IWineD3DVertexBuffer *iface) {
|
||||
return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
|
||||
}
|
||||
@@ -481,6 +788,7 @@ const IWineD3DVertexBufferVtbl IWineD3DVertexBuffer_Vtbl =
|
||||
IWineD3DVertexBufferImpl_SetPriority,
|
||||
IWineD3DVertexBufferImpl_GetPriority,
|
||||
IWineD3DVertexBufferImpl_PreLoad,
|
||||
IWineD3DVertexBufferImpl_UnLoad,
|
||||
IWineD3DVertexBufferImpl_GetType,
|
||||
/* IWineD3DVertexBuffer */
|
||||
IWineD3DVertexBufferImpl_Lock,
|
||||
@@ -493,6 +801,14 @@ BYTE* WINAPI IWineD3DVertexBufferImpl_GetMemory(IWineD3DVertexBuffer* iface, DWO
|
||||
|
||||
*vbo = This->vbo;
|
||||
if(This->vbo == 0) {
|
||||
if(This->Flags & VBFLAG_CREATEVBO) {
|
||||
CreateVBO(This);
|
||||
This->Flags &= ~VBFLAG_CREATEVBO;
|
||||
if(This->vbo) {
|
||||
*vbo = This->vbo;
|
||||
return (BYTE *) iOffset;
|
||||
}
|
||||
}
|
||||
return This->resource.allocatedMemory + iOffset;
|
||||
} else {
|
||||
return (BYTE *) iOffset;
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_decl);
|
||||
|
||||
#define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info
|
||||
|
||||
static void dump_wined3dvertexelement(const WINED3DVERTEXELEMENT *element) {
|
||||
TRACE(" Stream: %d\n", element->Stream);
|
||||
TRACE(" Offset: %d\n", element->Offset);
|
||||
@@ -101,7 +103,7 @@ static HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDevice(IWineD3DVertexDecl
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration(IWineD3DVertexDeclaration *iface,
|
||||
WINED3DVERTEXELEMENT *elements, size_t *element_count) {
|
||||
WINED3DVERTEXELEMENT *elements, UINT *element_count) {
|
||||
IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface;
|
||||
HRESULT hr = WINED3D_OK;
|
||||
|
||||
@@ -117,7 +119,7 @@ static HRESULT WINAPI IWineD3DVertexDeclarationImpl_GetDeclaration(IWineD3DVerte
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DVertexDeclarationImpl_SetDeclaration(IWineD3DVertexDeclaration *iface,
|
||||
const WINED3DVERTEXELEMENT *elements, size_t element_count) {
|
||||
const WINED3DVERTEXELEMENT *elements, UINT element_count) {
|
||||
IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface;
|
||||
HRESULT hr = WINED3D_OK;
|
||||
int i, j;
|
||||
@@ -157,6 +159,18 @@ static HRESULT WINAPI IWineD3DVertexDeclarationImpl_SetDeclaration(IWineD3DVerte
|
||||
*/
|
||||
if(This->pDeclarationWine[i].Stream >= MAX_STREAMS) continue;
|
||||
|
||||
if(This->pDeclarationWine[i].Type == WINED3DDECLTYPE_UNUSED) {
|
||||
WARN("The application tries to use WINED3DDECLTYPE_UNUSED, returning E_FAIL\n");
|
||||
/* The caller will release the vdecl, which will free This->pDeclarationWine */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(This->pDeclarationWine[i].Offset & 0x3) {
|
||||
WARN("Declaration element %d is not 4 byte aligned(%d), returning E_FAIL\n", i, This->pDeclarationWine[i].Offset);
|
||||
HeapFree(GetProcessHeap(), 0, This->pDeclarationWine);
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(!isPreLoaded[This->pDeclarationWine[i].Stream]) {
|
||||
This->streams[This->num_streams] = This->pDeclarationWine[i].Stream;
|
||||
This->num_streams++;
|
||||
@@ -175,7 +189,7 @@ static HRESULT WINAPI IWineD3DVertexDeclarationImpl_SetDeclaration(IWineD3DVerte
|
||||
(This->swizzled_attribs[j].usage == This->pDeclarationWine[i].Usage &&
|
||||
This->swizzled_attribs[j].idx > This->pDeclarationWine[i].UsageIndex)) {
|
||||
memmove(&This->swizzled_attribs[j + 1], &This->swizzled_attribs[j],
|
||||
sizeof(This->swizzled_attribs) - (sizeof(This->swizzled_attribs[0]) * (j - 1)));
|
||||
sizeof(This->swizzled_attribs) - (sizeof(This->swizzled_attribs[0]) * (j + 1)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -183,6 +197,11 @@ static HRESULT WINAPI IWineD3DVertexDeclarationImpl_SetDeclaration(IWineD3DVerte
|
||||
This->swizzled_attribs[j].usage = This->pDeclarationWine[i].Usage;
|
||||
This->swizzled_attribs[j].idx = This->pDeclarationWine[i].UsageIndex;
|
||||
This->num_swizzled_attribs++;
|
||||
} else if(This->pDeclarationWine[i].Type == WINED3DDECLTYPE_FLOAT16_2 ||
|
||||
This->pDeclarationWine[i].Type == WINED3DDECLTYPE_FLOAT16_4) {
|
||||
if(!GL_SUPPORT(NV_HALF_FLOAT)) {
|
||||
This->half_float_conv_needed = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Copyright 2004 Christian Costa
|
||||
* Copyright 2005 Oliver Stieber
|
||||
* Copyright 2006 Ivan Gyurdiev
|
||||
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -33,50 +34,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_shader);
|
||||
|
||||
#define GLINFO_LOCATION ((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info
|
||||
|
||||
/* Shader debugging - Change the following line to enable debugging of software
|
||||
vertex shaders */
|
||||
#if 0 /* Musxt not be 1 in cvs version */
|
||||
# define VSTRACE(A) TRACE A
|
||||
# define TRACE_VSVECTOR(name) TRACE( #name "=(%f, %f, %f, %f)\n", name.x, name.y, name.z, name.w)
|
||||
#else
|
||||
# define VSTRACE(A)
|
||||
# define TRACE_VSVECTOR(name)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* DirectX9 SDK download
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/downloads/list/directx.asp
|
||||
*
|
||||
* Exploring D3DX
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndrive/html/directx07162002.asp
|
||||
*
|
||||
* Using Vertex Shaders
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndrive/html/directx02192001.asp
|
||||
*
|
||||
* Dx9 New
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/whatsnew.asp
|
||||
*
|
||||
* Dx9 Shaders
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/Shaders/VertexShader2_0/VertexShader2_0.asp
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/Shaders/VertexShader2_0/Instructions/Instructions.asp
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/GettingStarted/VertexDeclaration/VertexDeclaration.asp
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/Shaders/VertexShader3_0/VertexShader3_0.asp
|
||||
*
|
||||
* Dx9 D3DX
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/advancedtopics/VertexPipe/matrixstack/matrixstack.asp
|
||||
*
|
||||
* FVF
|
||||
* http://msdn.microsoft.com/library/en-us/directx9_c/directx/graphics/programmingguide/GettingStarted/VertexFormats/vformats.asp
|
||||
*
|
||||
* NVIDIA: DX8 Vertex Shader to NV Vertex Program
|
||||
* http://developer.nvidia.com/view.asp?IO=vstovp
|
||||
*
|
||||
* NVIDIA: Memory Management with VAR
|
||||
* http://developer.nvidia.com/view.asp?IO=var_memory_management
|
||||
*/
|
||||
|
||||
/* TODO: Vertex and Pixel shaders are almost identicle, the only exception being the way that some of the data is looked up or the availablity of some of the data i.e. some instructions are only valid for pshaders and some for vshaders
|
||||
because of this the bulk of the software pipeline can be shared between pixel and vertex shaders... and it wouldn't supprise me if the programes can be cross compiled using a large body body shared code */
|
||||
/* TODO: Vertex and Pixel shaders are almost identical, the only exception being the way that some of the data is looked up or the availability of some of the data i.e. some instructions are only valid for pshaders and some for vshaders
|
||||
because of this the bulk of the software pipeline can be shared between pixel and vertex shaders... and it wouldn't surprise me if the program can be cross compiled using a large body of shared code */
|
||||
|
||||
#define GLNAME_REQUIRE_GLSL ((const char *)1)
|
||||
|
||||
@@ -296,6 +255,9 @@ static inline void find_swizzled_attribs(IWineD3DVertexDeclaration *declaration,
|
||||
|
||||
for(i = 0; i < decl->num_swizzled_attribs; i++) {
|
||||
for(j = 0; j < MAX_ATTRIBS; j++) {
|
||||
|
||||
if(!This->baseShader.reg_maps.attributes[j]) continue;
|
||||
|
||||
usage_token = This->semantics_in[j].usage;
|
||||
usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
||||
usage_idx = (usage_token & WINED3DSP_DCL_USAGEINDEX_MASK) >> WINED3DSP_DCL_USAGEINDEX_SHIFT;
|
||||
@@ -336,7 +298,7 @@ static inline void find_swizzled_attribs(IWineD3DVertexDeclaration *declaration,
|
||||
oldswizzles[i].usage == This->swizzled_attribs[j].usage &&
|
||||
oldswizzles[i].idx > This->swizzled_attribs[j].idx)) {
|
||||
memmove(&This->swizzled_attribs[j + 1], &This->swizzled_attribs[j],
|
||||
sizeof(This->swizzled_attribs) - (sizeof(This->swizzled_attribs[0]) * (j - 1)));
|
||||
sizeof(This->swizzled_attribs) - (sizeof(This->swizzled_attribs[0]) * (j + 1)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -381,122 +343,7 @@ static VOID IWineD3DVertexShaderImpl_GenerateShader(
|
||||
buffer.lineNo = 0;
|
||||
buffer.newline = TRUE;
|
||||
|
||||
if (This->baseShader.shader_mode == SHADER_GLSL) {
|
||||
|
||||
/* Create the hw GLSL shader program and assign it as the baseShader.prgId */
|
||||
GLhandleARB shader_obj = GL_EXTCALL(glCreateShaderObjectARB(GL_VERTEX_SHADER_ARB));
|
||||
|
||||
/* Base Declarations */
|
||||
shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, &buffer, &GLINFO_LOCATION);
|
||||
|
||||
/* Base Shader Body */
|
||||
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
|
||||
|
||||
/* Unpack 3.0 outputs */
|
||||
if (This->baseShader.hex_version >= WINED3DVS_VERSION(3,0)) {
|
||||
shader_addline(&buffer, "order_ps_input(OUT);\n");
|
||||
} else {
|
||||
shader_addline(&buffer, "order_ps_input();\n");
|
||||
}
|
||||
|
||||
/* If this shader doesn't use fog copy the z coord to the fog coord so that we can use table fog */
|
||||
if (!reg_maps->fog)
|
||||
shader_addline(&buffer, "gl_FogFragCoord = gl_Position.z;\n");
|
||||
|
||||
/* Write the final position.
|
||||
*
|
||||
* OpenGL coordinates specify the center of the pixel while d3d coords specify
|
||||
* the corner. The offsets are stored in z and w in posFixup. posFixup.y contains
|
||||
* 1.0 or -1.0 to turn the rendering upside down for offscreen rendering. PosFixup.x
|
||||
* contains 1.0 to allow a mad.
|
||||
*/
|
||||
shader_addline(&buffer, "gl_Position.xy = gl_Position.xy * posFixup.xy + posFixup.zw;\n");
|
||||
|
||||
/* Z coord [0;1]->[-1;1] mapping, see comment in transform_projection in state.c
|
||||
*
|
||||
* Basically we want(in homogenous coordinates) z = z * 2 - 1. However, shaders are run
|
||||
* before the homogenous divide, so we have to take the w into account: z = ((z / w) * 2 - 1) * w,
|
||||
* which is the same as z = z / 2 - w.
|
||||
*/
|
||||
shader_addline(&buffer, "gl_Position.z = gl_Position.z * 2.0 - gl_Position.w;\n");
|
||||
|
||||
shader_addline(&buffer, "}\n");
|
||||
|
||||
TRACE("Compiling shader object %u\n", shader_obj);
|
||||
GL_EXTCALL(glShaderSourceARB(shader_obj, 1, (const char**)&buffer.buffer, NULL));
|
||||
GL_EXTCALL(glCompileShaderARB(shader_obj));
|
||||
print_glsl_info_log(&GLINFO_LOCATION, shader_obj);
|
||||
|
||||
/* Store the shader object */
|
||||
This->baseShader.prgId = shader_obj;
|
||||
|
||||
} else if (This->baseShader.shader_mode == SHADER_ARB) {
|
||||
|
||||
/* Create the hw ARB shader */
|
||||
shader_addline(&buffer, "!!ARBvp1.0\n");
|
||||
shader_addline(&buffer, "PARAM helper_const = { 2.0, -1.0, %d.0, 0.0 };\n", This->rel_offset);
|
||||
|
||||
/* Mesa supports only 95 constants */
|
||||
if (GL_VEND(MESA) || GL_VEND(WINE))
|
||||
This->baseShader.limits.constant_float =
|
||||
min(95, This->baseShader.limits.constant_float);
|
||||
|
||||
/* Some instructions need a temporary register. Add it if needed, but only if it is really needed */
|
||||
if(reg_maps->usesnrm || This->rel_offset) {
|
||||
shader_addline(&buffer, "TEMP TMP;\n");
|
||||
}
|
||||
|
||||
/* Base Declarations */
|
||||
shader_generate_arb_declarations( (IWineD3DBaseShader*) This, reg_maps, &buffer, &GLINFO_LOCATION);
|
||||
|
||||
/* We need a constant to fixup the final position */
|
||||
shader_addline(&buffer, "PARAM posFixup = program.env[%d];\n", ARB_SHADER_PRIVCONST_POS);
|
||||
|
||||
/* Base Shader Body */
|
||||
shader_generate_main( (IWineD3DBaseShader*) This, &buffer, reg_maps, pFunction);
|
||||
|
||||
/* If this shader doesn't use fog copy the z coord to the fog coord so that we can use table fog */
|
||||
if (!reg_maps->fog)
|
||||
shader_addline(&buffer, "MOV result.fogcoord, TMP_OUT.z;\n");
|
||||
|
||||
/* Write the final position.
|
||||
*
|
||||
* OpenGL coordinates specify the center of the pixel while d3d coords specify
|
||||
* the corner. The offsets are stored in z and w in posFixup. posFixup.y contains
|
||||
* 1.0 or -1.0 to turn the rendering upside down for offscreen rendering. PosFixup.x
|
||||
* contains 1.0 to allow a mad, but arb vs swizzles are too restricted for that.
|
||||
*/
|
||||
shader_addline(&buffer, "ADD TMP_OUT.x, TMP_OUT.x, posFixup.z;\n");
|
||||
shader_addline(&buffer, "MAD TMP_OUT.y, TMP_OUT.y, posFixup.y, posFixup.w;\n");
|
||||
|
||||
/* Z coord [0;1]->[-1;1] mapping, see comment in transform_projection in state.c
|
||||
* and the glsl equivalent
|
||||
*/
|
||||
shader_addline(&buffer, "MAD TMP_OUT.z, TMP_OUT.z, helper_const.x, -TMP_OUT.w;\n");
|
||||
|
||||
shader_addline(&buffer, "MOV result.position, TMP_OUT;\n");
|
||||
|
||||
shader_addline(&buffer, "END\n");
|
||||
|
||||
/* TODO: change to resource.glObjectHandle or something like that */
|
||||
GL_EXTCALL(glGenProgramsARB(1, &This->baseShader.prgId));
|
||||
|
||||
TRACE("Creating a hw vertex shader, prg=%d\n", This->baseShader.prgId);
|
||||
GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, This->baseShader.prgId));
|
||||
|
||||
TRACE("Created hw vertex shader, prg=%d\n", This->baseShader.prgId);
|
||||
/* Create the program and check for errors */
|
||||
GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB,
|
||||
buffer.bsize, buffer.buffer));
|
||||
|
||||
if (glGetError() == GL_INVALID_OPERATION) {
|
||||
GLint errPos;
|
||||
glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &errPos);
|
||||
FIXME("HW VertexShader Error at position %d: %s\n",
|
||||
errPos, debugstr_a((const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB)));
|
||||
This->baseShader.prgId = -1;
|
||||
}
|
||||
}
|
||||
((IWineD3DDeviceImpl *)This->baseShader.device)->shader_backend->shader_generate_vshader(iface, &buffer);
|
||||
|
||||
#if 1 /* if were using the data buffer of device then we don't need to free it */
|
||||
HeapFree(GetProcessHeap(), 0, buffer.buffer);
|
||||
@@ -678,8 +525,12 @@ static inline BOOL swizzled_attribs_differ(IWineD3DVertexShaderImpl *This, IWine
|
||||
DWORD usage_idx;
|
||||
|
||||
for(i = 0; i < vdecl->declarationWNumElements; i++) {
|
||||
/* Ignore tesselated streams and the termination entry(position0, stream 255, unused) */
|
||||
if(vdecl->pDeclarationWine[i].Stream >= MAX_STREAMS ||
|
||||
vdecl->pDeclarationWine[i].Type == WINED3DDECLTYPE_UNUSED) continue;
|
||||
|
||||
for(j = 0; j < MAX_ATTRIBS; j++) {
|
||||
if(!This->baseShader.reg_maps.attributes) continue;
|
||||
if(!This->baseShader.reg_maps.attributes[j]) continue;
|
||||
|
||||
usage_token = This->semantics_in[j].usage;
|
||||
usage = (usage_token & WINED3DSP_DCL_USAGE_MASK) >> WINED3DSP_DCL_USAGE_SHIFT;
|
||||
|
||||
@@ -23,9 +23,47 @@
|
||||
#include "config.h"
|
||||
#include "wined3d_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_surface);
|
||||
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
|
||||
|
||||
static void volume_bind_and_dirtify(IWineD3DVolume *iface) {
|
||||
IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface;
|
||||
IWineD3DVolumeTexture *texture;
|
||||
int active_sampler;
|
||||
|
||||
/* We don't need a specific texture unit, but after binding the texture the current unit is dirty.
|
||||
* Read the unit back instead of switching to 0, this avoids messing around with the state manager's
|
||||
* gl states. The current texture unit should always be a valid one.
|
||||
*
|
||||
* To be more specific, this is tricky because we can implicitly be called
|
||||
* from sampler() in state.c. This means we can't touch anything other than
|
||||
* whatever happens to be the currently active texture, or we would risk
|
||||
* marking already applied sampler states dirty again.
|
||||
*
|
||||
* TODO: Track the current active texture per GL context instead of using glGet
|
||||
*/
|
||||
if (GL_SUPPORT(ARB_MULTITEXTURE)) {
|
||||
GLint active_texture;
|
||||
ENTER_GL();
|
||||
glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture);
|
||||
LEAVE_GL();
|
||||
active_sampler = This->resource.wineD3DDevice->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB];
|
||||
} else {
|
||||
active_sampler = 0;
|
||||
}
|
||||
|
||||
if (active_sampler != -1) {
|
||||
IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(active_sampler));
|
||||
}
|
||||
|
||||
if (SUCCEEDED(IWineD3DSurface_GetContainer(iface, &IID_IWineD3DVolumeTexture, (void **)&texture))) {
|
||||
IWineD3DVolumeTexture_BindTexture(texture);
|
||||
IWineD3DVolumeTexture_Release(texture);
|
||||
} else {
|
||||
ERR("Volume should be part of a volume texture\n");
|
||||
}
|
||||
}
|
||||
|
||||
/* *******************************************
|
||||
IWineD3DVolume IUnknown parts follow
|
||||
******************************************* */
|
||||
@@ -97,6 +135,13 @@ static void WINAPI IWineD3DVolumeImpl_PreLoad(IWineD3DVolume *iface) {
|
||||
IWineD3DResourceImpl_PreLoad((IWineD3DResource *)iface);
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DVolumeImpl_UnLoad(IWineD3DVolume *iface) {
|
||||
/* The whole content is shadowed on This->resource.allocatedMemory, and the
|
||||
* texture name is managed by the VolumeTexture container
|
||||
*/
|
||||
TRACE("(%p): Nothing to do\n", iface);
|
||||
}
|
||||
|
||||
static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeImpl_GetType(IWineD3DVolume *iface) {
|
||||
return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
|
||||
}
|
||||
@@ -270,6 +315,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int
|
||||
|
||||
TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(format), format);
|
||||
|
||||
volume_bind_and_dirtify(iface);
|
||||
|
||||
TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n",
|
||||
GL_TEXTURE_3D,
|
||||
gl_level,
|
||||
@@ -316,6 +363,7 @@ const IWineD3DVolumeVtbl IWineD3DVolume_Vtbl =
|
||||
IWineD3DVolumeImpl_SetPriority,
|
||||
IWineD3DVolumeImpl_GetPriority,
|
||||
IWineD3DVolumeImpl_PreLoad,
|
||||
IWineD3DVolumeImpl_UnLoad,
|
||||
IWineD3DVolumeImpl_GetType,
|
||||
/* IWineD3DVolume */
|
||||
IWineD3DVolumeImpl_GetContainer,
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
#include "config.h"
|
||||
#include "wined3d_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
|
||||
#define GLINFO_LOCATION This->resource.wineD3DDevice->adapter->gl_info
|
||||
|
||||
/* *******************************************
|
||||
@@ -100,8 +100,6 @@ static void WINAPI IWineD3DVolumeTextureImpl_PreLoad(IWineD3DVolumeTexture *ifac
|
||||
|
||||
TRACE("(%p) : About to load texture\n", This);
|
||||
|
||||
IWineD3DVolumeTexture_BindTexture(iface);
|
||||
|
||||
if(!device->isInDraw) {
|
||||
ActivateContext(device, device->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD);
|
||||
} else if (GL_SUPPORT(EXT_TEXTURE_SRGB) && This->baseTexture.bindCount > 0) {
|
||||
@@ -135,6 +133,22 @@ static void WINAPI IWineD3DVolumeTextureImpl_PreLoad(IWineD3DVolumeTexture *ifac
|
||||
return ;
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DVolumeTextureImpl_UnLoad(IWineD3DVolumeTexture *iface) {
|
||||
unsigned int i;
|
||||
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
/* Unload all the surfaces and reset the texture name. If UnLoad was called on the
|
||||
* surface before, this one will be a NOP and vice versa. Unloading an unloaded
|
||||
* surface is fine
|
||||
*/
|
||||
for (i = 0; i < This->baseTexture.levels; i++) {
|
||||
IWineD3DVolume_UnLoad(This->volumes[i]);
|
||||
}
|
||||
|
||||
IWineD3DBaseTextureImpl_UnLoad((IWineD3DBaseTexture *) iface);
|
||||
}
|
||||
|
||||
static WINED3DRESOURCETYPE WINAPI IWineD3DVolumeTextureImpl_GetType(IWineD3DVolumeTexture *iface) {
|
||||
return IWineD3DResourceImpl_GetType((IWineD3DResource *)iface);
|
||||
}
|
||||
@@ -185,18 +199,19 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_BindTexture(IWineD3DVolumeTextur
|
||||
return IWineD3DBaseTextureImpl_BindTexture((IWineD3DBaseTexture *)iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DVolumeTextureImpl_UnBindTexture(IWineD3DVolumeTexture *iface) {
|
||||
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
|
||||
TRACE("(%p) : relay to BaseTexture\n", This);
|
||||
return IWineD3DBaseTextureImpl_UnBindTexture((IWineD3DBaseTexture *)iface);
|
||||
}
|
||||
|
||||
static UINT WINAPI IWineD3DVolumeTextureImpl_GetTextureDimensions(IWineD3DVolumeTexture *iface) {
|
||||
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
return GL_TEXTURE_3D;
|
||||
}
|
||||
|
||||
static BOOL WINAPI IWineD3DVolumeTextureImpl_IsCondNP2(IWineD3DVolumeTexture *iface) {
|
||||
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
|
||||
TRACE("(%p)\n", This);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void WINAPI IWineD3DVolumeTextureImpl_ApplyStateChanges(IWineD3DVolumeTexture *iface,
|
||||
const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1],
|
||||
const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) {
|
||||
@@ -228,7 +243,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTextu
|
||||
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
|
||||
if (Level < This->baseTexture.levels) {
|
||||
TRACE("(%p) Level (%d)\n", This, Level);
|
||||
return IWineD3DVolume_GetDesc((IWineD3DVolume *) This->volumes[Level], pDesc);
|
||||
return IWineD3DVolume_GetDesc(This->volumes[Level], pDesc);
|
||||
} else {
|
||||
FIXME("(%p) Level (%d)\n", This, Level);
|
||||
}
|
||||
@@ -237,8 +252,8 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetLevelDesc(IWineD3DVolumeTextu
|
||||
static HRESULT WINAPI IWineD3DVolumeTextureImpl_GetVolumeLevel(IWineD3DVolumeTexture *iface, UINT Level, IWineD3DVolume** ppVolumeLevel) {
|
||||
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
|
||||
if (Level < This->baseTexture.levels) {
|
||||
*ppVolumeLevel = (IWineD3DVolume *)This->volumes[Level];
|
||||
IWineD3DVolume_AddRef((IWineD3DVolume *) *ppVolumeLevel);
|
||||
*ppVolumeLevel = This->volumes[Level];
|
||||
IWineD3DVolume_AddRef(*ppVolumeLevel);
|
||||
TRACE("(%p) -> level(%d) returning volume@%p\n", This, Level, *ppVolumeLevel);
|
||||
} else {
|
||||
FIXME("(%p) Level(%d) overflow Levels(%d)\n", This, Level, This->baseTexture.levels);
|
||||
@@ -252,7 +267,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_LockBox(IWineD3DVolumeTexture *i
|
||||
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
|
||||
|
||||
if (Level < This->baseTexture.levels) {
|
||||
hr = IWineD3DVolume_LockBox((IWineD3DVolume *)This->volumes[Level], pLockedVolume, pBox, Flags);
|
||||
hr = IWineD3DVolume_LockBox(This->volumes[Level], pLockedVolume, pBox, Flags);
|
||||
TRACE("(%p) Level (%d) success(%u)\n", This, Level, hr);
|
||||
|
||||
} else {
|
||||
@@ -267,7 +282,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_UnlockBox(IWineD3DVolumeTexture
|
||||
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
|
||||
|
||||
if (Level < This->baseTexture.levels) {
|
||||
hr = IWineD3DVolume_UnlockBox((IWineD3DVolume*) This->volumes[Level]);
|
||||
hr = IWineD3DVolume_UnlockBox(This->volumes[Level]);
|
||||
TRACE("(%p) -> level(%d) success(%u)\n", This, Level, hr);
|
||||
|
||||
} else {
|
||||
@@ -281,7 +296,7 @@ static HRESULT WINAPI IWineD3DVolumeTextureImpl_AddDirtyBox(IWineD3DVolumeTextur
|
||||
IWineD3DVolumeTextureImpl *This = (IWineD3DVolumeTextureImpl *)iface;
|
||||
This->baseTexture.dirty = TRUE;
|
||||
TRACE("(%p) : dirtyfication of volume Level (0)\n", This);
|
||||
return IWineD3DVolume_AddDirtyBox((IWineD3DVolume *) This->volumes[0], pDirtyBox);
|
||||
return IWineD3DVolume_AddDirtyBox(This->volumes[0], pDirtyBox);
|
||||
}
|
||||
|
||||
const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
|
||||
@@ -299,6 +314,7 @@ const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
|
||||
IWineD3DVolumeTextureImpl_SetPriority,
|
||||
IWineD3DVolumeTextureImpl_GetPriority,
|
||||
IWineD3DVolumeTextureImpl_PreLoad,
|
||||
IWineD3DVolumeTextureImpl_UnLoad,
|
||||
IWineD3DVolumeTextureImpl_GetType,
|
||||
/* BaseTexture */
|
||||
IWineD3DVolumeTextureImpl_SetLOD,
|
||||
@@ -311,8 +327,8 @@ const IWineD3DVolumeTextureVtbl IWineD3DVolumeTexture_Vtbl =
|
||||
IWineD3DVolumeTextureImpl_GetDirty,
|
||||
/* not in d3d */
|
||||
IWineD3DVolumeTextureImpl_BindTexture,
|
||||
IWineD3DVolumeTextureImpl_UnBindTexture,
|
||||
IWineD3DVolumeTextureImpl_GetTextureDimensions,
|
||||
IWineD3DVolumeTextureImpl_IsCondNP2,
|
||||
IWineD3DVolumeTextureImpl_ApplyStateChanges,
|
||||
/* volume texture */
|
||||
IWineD3DVolumeTextureImpl_Destroy,
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
<library>uuid</library>
|
||||
<library>msvcrt</library>
|
||||
|
||||
<file>ati_fragment_shader.c</file>
|
||||
<file>arb_program_shader.c</file>
|
||||
<file>baseshader.c</file>
|
||||
<file>basetexture.c</file>
|
||||
@@ -30,6 +31,7 @@
|
||||
<file>drawprim.c</file>
|
||||
<file>glsl_shader.c</file>
|
||||
<file>indexbuffer.c</file>
|
||||
<file>nvidia_texture_shader.c</file>
|
||||
<file>palette.c</file>
|
||||
<file>pixelshader.c</file>
|
||||
<file>query.c</file>
|
||||
@@ -40,6 +42,8 @@
|
||||
<file>surface.c</file>
|
||||
<file>surface_gdi.c </file>
|
||||
<file>swapchain.c</file>
|
||||
<file>swapchain_base.c</file>
|
||||
<file>swapchain_gdi.c</file>
|
||||
<file>texture.c</file>
|
||||
<file>utils.c</file>
|
||||
<file>vertexbuffer.c</file>
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
* Copyright 2002-2003 The wine-d3d team
|
||||
* Copyright 2002-2003 Raphael Junqueira
|
||||
* Copyright 2004 Jason Edmeades
|
||||
* Copyright 2007-2008 Stefan Dösinger for CodeWeavers
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -25,7 +26,7 @@
|
||||
#include "initguid.h"
|
||||
#include "wined3d_private.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wine_d3d);
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
|
||||
int num_lock = 0;
|
||||
void (*wine_tsx11_lock_ptr)(void) = NULL;
|
||||
@@ -43,7 +44,8 @@ wined3d_settings_t wined3d_settings =
|
||||
ORM_BACKBUFFER, /* Use the backbuffer to do offscreen rendering */
|
||||
RTL_AUTO, /* Automatically determine best locking method */
|
||||
0, /* The default of memory is set in FillGLCaps */
|
||||
NULL /* No wine logo by default */
|
||||
NULL, /* No wine logo by default */
|
||||
FALSE /* Disable multisampling for now due to Nvidia driver bugs which happens for some users */
|
||||
};
|
||||
|
||||
IWineD3D* WINAPI WineDirect3DCreate(UINT SDKVersion, UINT dxVersion, IUnknown *parent) {
|
||||
@@ -254,6 +256,14 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
|
||||
wined3d_settings.logo = HeapAlloc(GetProcessHeap(), 0, strlen(buffer) + 1);
|
||||
if(wined3d_settings.logo) strcpy(wined3d_settings.logo, buffer);
|
||||
}
|
||||
if ( !get_config_key( hkey, appkey, "Multisampling", buffer, size) )
|
||||
{
|
||||
if (!strcmp(buffer,"enabled"))
|
||||
{
|
||||
TRACE("Allow multisampling\n");
|
||||
wined3d_settings.allow_multisampling = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wined3d_settings.vs_mode == VS_HW)
|
||||
TRACE("Allow HW vertex shaders\n");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -23,12 +23,12 @@
|
||||
#ifndef __WINE_WINED3D_TYPES_INTERNAL_H
|
||||
#define __WINE_WINED3D_TYPES_INTERNAL_H
|
||||
|
||||
/* Depth copy state */
|
||||
typedef enum {
|
||||
WINED3D_DCS_INITIAL = 0,
|
||||
WINED3D_DCS_COPY = 1,
|
||||
WINED3D_DCS_NO_COPY = 2
|
||||
} WINED3D_DEPTHCOPYSTATE;
|
||||
/* WineD3D pixel format flags */
|
||||
#define WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING 0x1
|
||||
#define WINED3DFMT_FLAG_FILTERING 0x2
|
||||
#define WINED3DFMT_FLAG_DEPTH 0x4
|
||||
#define WINED3DFMT_FLAG_STENCIL 0x8
|
||||
#define WINED3DFMT_FLAG_RENDERTARGET 0x10
|
||||
|
||||
/** DCL usage masks **/
|
||||
#define WINED3DSP_DCL_USAGE_SHIFT 0
|
||||
|
||||
@@ -111,9 +111,15 @@
|
||||
DEFINE_GUID(IID_IDirect3D9, 0x81BDCBCA, 0x64D4, 0x426D, 0xAE, 0x8D, 0xAD, 0x1, 0x47, 0xF4, 0x27, 0x5C);
|
||||
typedef struct IDirect3D9 *LPDIRECT3D9, *PDIRECT3D9;
|
||||
|
||||
DEFINE_GUID(IID_IDirect3D9Ex, 0x02177241, 0x69FC, 0x400C, 0x8F, 0xF1, 0x93, 0xA4, 0x4D, 0xF6, 0x86, 0x1D);
|
||||
typedef struct IDirect3D9Ex *LPDIRECT3D9EX, *PDIRECT3D9EX;
|
||||
|
||||
DEFINE_GUID(IID_IDirect3DDevice9, 0xd0223b96, 0xbf7a, 0x43fd, 0x92, 0xbd, 0xa4, 0x3b, 0xd, 0x82, 0xb9, 0xeb);
|
||||
typedef struct IDirect3DDevice9 *LPDIRECT3DDEVICE9;
|
||||
|
||||
DEFINE_GUID(IID_IDirect3DDevice9Ex, 0xb18b10ce, 0x2649, 0x405a, 0x87, 0xf, 0x95, 0xf7, 0x77, 0xd4, 0x31, 0x3a);
|
||||
typedef struct IDirect3DDevice9Ex *LPDIRECT3DDEVICE9EX, *PDIRECT3DDEVICE9EX;
|
||||
|
||||
DEFINE_GUID(IID_IDirect3DResource9, 0x5eec05d, 0x8f7d, 0x4362, 0xb9, 0x99, 0xd1, 0xba, 0xf3, 0x57, 0xc7, 0x4);
|
||||
typedef struct IDirect3DResource9 *LPDIRECT3DRESOURCE9, *PDIRECT3DRESOURCE9;
|
||||
|
||||
@@ -234,6 +240,88 @@ DECLARE_INTERFACE_(IDirect3D9,IUnknown)
|
||||
#define IDirect3D9_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3D9Ex interface
|
||||
*/
|
||||
#define INTERFACE IDirect3D9Ex
|
||||
DECLARE_INTERFACE_(IDirect3D9Ex,IDirect3D9)
|
||||
{
|
||||
/*** IUnknown methods ***/
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IDirect3D9 methods ***/
|
||||
STDMETHOD(RegisterSoftwareDevice)(THIS_ void* pInitializeFunction) PURE;
|
||||
STDMETHOD_(UINT, GetAdapterCount)(THIS) PURE;
|
||||
STDMETHOD(GetAdapterIdentifier)(THIS_ UINT Adapter, DWORD Flags, D3DADAPTER_IDENTIFIER9* pIdentifier) PURE;
|
||||
STDMETHOD_(UINT, GetAdapterModeCount)(THIS_ UINT Adapter, D3DFORMAT Format) PURE;
|
||||
STDMETHOD(EnumAdapterModes)(THIS_ UINT Adapter, D3DFORMAT Format, UINT Mode, D3DDISPLAYMODE* pMode) PURE;
|
||||
STDMETHOD(GetAdapterDisplayMode)(THIS_ UINT Adapter, D3DDISPLAYMODE* pMode) PURE;
|
||||
STDMETHOD(CheckDeviceType)(THIS_ UINT iAdapter, D3DDEVTYPE DevType, D3DFORMAT DisplayFormat, D3DFORMAT BackBufferFormat, BOOL bWindowed) PURE;
|
||||
STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, DWORD Usage, D3DRESOURCETYPE RType, D3DFORMAT CheckFormat) PURE;
|
||||
STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SurfaceFormat, BOOL Windowed, D3DMULTISAMPLE_TYPE MultiSampleType, DWORD* pQualityLevels) PURE;
|
||||
STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT AdapterFormat, D3DFORMAT RenderTargetFormat, D3DFORMAT DepthStencilFormat) PURE;
|
||||
STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DFORMAT SourceFormat, D3DFORMAT TargetFormat) PURE;
|
||||
STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, D3DCAPS9* pCaps) PURE;
|
||||
STDMETHOD_(HMONITOR, GetAdapterMonitor)(THIS_ UINT Adapter) PURE;
|
||||
STDMETHOD(CreateDevice)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, struct IDirect3DDevice9** ppReturnedDeviceInterface) PURE;
|
||||
/*** IDirect3D9Ex methods ***/
|
||||
STDMETHOD_(UINT, GetAdapterModeCountEx)(THIS_ UINT Adapter, CONST D3DDISPLAYMODEFILTER *pFilter) PURE;
|
||||
STDMETHOD(EnumAdapterModesEx)(THIS_ UINT Adapter, CONST D3DDISPLAYMODEFILTER *pFilter, UINT Mode, D3DDISPLAYMODEEX* pMode) PURE;
|
||||
STDMETHOD(GetAdapterDisplayModeEx)(THIS_ UINT Adapter, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation);
|
||||
STDMETHOD(CreateDeviceEx)(THIS_ UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviorFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, D3DDISPLAYMODEEX* pFullscreenDisplayMode, struct IDirect3DDevice9Ex **ppReturnedDeviceInterface) PURE;
|
||||
STDMETHOD(GetAdapterLUID)(THIS_ UINT Adatper, LUID *pLUID) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
#if !defined(__cplusplus) || defined(CINTERFACE)
|
||||
/*** IUnknown methods ***/
|
||||
#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define IDirect3D9Ex_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define IDirect3D9Ex_Release(p) (p)->lpVtbl->Release(p)
|
||||
/*** IDirect3D9 methods ***/
|
||||
#define IDirect3D9Ex_RegisterSoftwareDevice(p,a) (p)->lpVtbl->RegisterSoftwareDevice(p,a)
|
||||
#define IDirect3D9Ex_GetAdapterCount(p) (p)->lpVtbl->GetAdapterCount(p)
|
||||
#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->lpVtbl->GetAdapterIdentifier(p,a,b,c)
|
||||
#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->lpVtbl->GetAdapterModeCount(p,a,b)
|
||||
#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModes(p,a,b,c,d)
|
||||
#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->lpVtbl->GetAdapterDisplayMode(p,a,b)
|
||||
#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e)
|
||||
#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f)
|
||||
#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f)
|
||||
#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e)
|
||||
#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->lpVtbl->CheckDeviceFormatConversion(p,a,b,c,d)
|
||||
#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->lpVtbl->GetDeviceCaps(p,a,b,c)
|
||||
#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->lpVtbl->GetAdapterMonitor(p,a)
|
||||
#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f)
|
||||
/*** IDirect3D9Ex methods ***/
|
||||
#define IDirect3D9Ex_GetAdapterModeCountEx(p,a,b) (p)->lpVtbl->GetAdapterModeCountEx(p,a,b)
|
||||
#define IDirect3D9Ex_EnumAdapterModesEx(p,a,b,c,d) (p)->lpVtbl->EnumAdapterModesEx(p,a,b,c,d)
|
||||
#define IDirect3D9Ex_GetAdapterDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetAdapterDisplayModeEx(p,a,b,c)
|
||||
#define IDirect3D9Ex_CreateDeviceEx(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateDeviceEx(p,a,b,c,d,e,f,g)
|
||||
#define IDirect3D9Ex_GetAdapterLUID(p,a,b) (p)->lpVtbl->GetAdapterLUID(p,a,b)
|
||||
#else
|
||||
/*** IUnknown methods ***/
|
||||
#define IDirect3D9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
|
||||
#define IDirect3D9Ex_AddRef(p) (p)->AddRef()
|
||||
#define IDirect3D9Ex_Release(p) (p)->Release()
|
||||
/*** IDirect3D9 methods ***/
|
||||
#define IDirect3D9Ex_RegisterSoftwareDevice(p,a) (p)->RegisterSoftwareDevice(a)
|
||||
#define IDirect3D9Ex_GetAdapterCount(p) (p)->GetAdapterCount()
|
||||
#define IDirect3D9Ex_GetAdapterIdentifier(p,a,b,c) (p)->GetAdapterIdentifier(a,b,c)
|
||||
#define IDirect3D9Ex_GetAdapterModeCount(p,a,b) (p)->GetAdapterModeCount(a,b)
|
||||
#define IDirect3D9Ex_EnumAdapterModes(p,a,b,c,d) (p)->EnumAdapterModes(a,b,c,d)
|
||||
#define IDirect3D9Ex_GetAdapterDisplayMode(p,a,b) (p)->GetAdapterDisplayMode(a,b)
|
||||
#define IDirect3D9Ex_CheckDeviceType(p,a,b,c,d,e) (p)->CheckDeviceType(a,b,c,d,e)
|
||||
#define IDirect3D9Ex_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->CheckDeviceFormat(a,b,c,d,e,f)
|
||||
#define IDirect3D9Ex_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->CheckDeviceMultiSampleType(a,b,c,d,e,f)
|
||||
#define IDirect3D9Ex_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->CheckDepthStencilMatch(a,b,c,d,e)
|
||||
#define IDirect3D9Ex_CheckDeviceFormatConversion(p,a,b,c,d) (p)->CheckDeviceFormatConversion(a,b,c,d)
|
||||
#define IDirect3D9Ex_GetDeviceCaps(p,a,b,c) (p)->GetDeviceCaps(a,b,c)
|
||||
#define IDirect3D9Ex_GetAdapterMonitor(p,a) (p)->GetAdapterMonitor(a)
|
||||
#define IDirect3D9Ex_CreateDevice(p,a,b,c,d,e,f) (p)->CreateDevice(a,b,c,d,e,f)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3DVolume9 interface
|
||||
*/
|
||||
@@ -1493,6 +1581,431 @@ DECLARE_INTERFACE_(IDirect3DDevice9,IUnknown)
|
||||
#endif
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* IDirect3DDevice9Ex interface
|
||||
*/
|
||||
#define INTERFACE IDirect3DDevice9Ex
|
||||
DECLARE_INTERFACE_(IDirect3DDevice9Ex,IDirect3DDevice9)
|
||||
{
|
||||
/*** IUnknown methods ***/
|
||||
STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE;
|
||||
STDMETHOD_(ULONG,AddRef)(THIS) PURE;
|
||||
STDMETHOD_(ULONG,Release)(THIS) PURE;
|
||||
/*** IDirect3DDevice9 methods ***/
|
||||
STDMETHOD(TestCooperativeLevel)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE;
|
||||
STDMETHOD(EvictManagedResources)(THIS) PURE;
|
||||
STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE;
|
||||
STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE;
|
||||
STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain, D3DDISPLAYMODE* pMode) PURE;
|
||||
STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE;
|
||||
STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) PURE;
|
||||
STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y, DWORD Flags) PURE;
|
||||
STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE;
|
||||
STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DSwapChain9** pSwapChain) PURE;
|
||||
STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain, IDirect3DSwapChain9** pSwapChain) PURE;
|
||||
STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE;
|
||||
STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE;
|
||||
STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect, CONST RECT* pDestRect, HWND hDestWindowOverride, CONST RGNDATA* pDirtyRegion) PURE;
|
||||
STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain, UINT iBackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) PURE;
|
||||
STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain, D3DRASTER_STATUS* pRasterStatus) PURE;
|
||||
STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE;
|
||||
STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain, DWORD Flags, CONST D3DGAMMARAMP* pRamp) PURE;
|
||||
STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain, D3DGAMMARAMP* pRamp) PURE;
|
||||
STDMETHOD(CreateTexture)(THIS_ UINT Width, UINT Height, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DTexture9** ppTexture, HANDLE* pSharedHandle) PURE;
|
||||
STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width, UINT Height, UINT Depth, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DVolumeTexture9** ppVolumeTexture, HANDLE* pSharedHandle) PURE;
|
||||
STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength, UINT Levels, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DCubeTexture9** ppCubeTexture, HANDLE* pSharedHandle) PURE;
|
||||
STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length, DWORD Usage, DWORD FVF, D3DPOOL Pool, IDirect3DVertexBuffer9** ppVertexBuffer, HANDLE* pSharedHandle) PURE;
|
||||
STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length, DWORD Usage, D3DFORMAT Format, D3DPOOL Pool, IDirect3DIndexBuffer9** ppIndexBuffer, HANDLE* pSharedHandle) PURE;
|
||||
STDMETHOD(CreateRenderTarget)(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) PURE;
|
||||
STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Discard, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) PURE;
|
||||
STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestinationSurface, CONST POINT* pDestPoint) PURE;
|
||||
STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture, IDirect3DBaseTexture9* pDestinationTexture) PURE;
|
||||
STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget, IDirect3DSurface9* pDestSurface) PURE;
|
||||
STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain, IDirect3DSurface9* pDestSurface) PURE;
|
||||
STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface, CONST RECT* pSourceRect, IDirect3DSurface9* pDestSurface, CONST RECT* pDestRect, D3DTEXTUREFILTERTYPE Filter) PURE;
|
||||
STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface, CONST RECT* pRect, D3DCOLOR color) PURE;
|
||||
STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) PURE;
|
||||
STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex, IDirect3DSurface9* pRenderTarget) PURE;
|
||||
STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex, IDirect3DSurface9** ppRenderTarget) PURE;
|
||||
STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE;
|
||||
STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE;
|
||||
STDMETHOD(BeginScene)(THIS) PURE;
|
||||
STDMETHOD(EndScene)(THIS) PURE;
|
||||
STDMETHOD(Clear)(THIS_ DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) PURE;
|
||||
STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State, D3DMATRIX* pMatrix) PURE;
|
||||
STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE, CONST D3DMATRIX*) PURE;
|
||||
STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE;
|
||||
STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE;
|
||||
STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE;
|
||||
STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE;
|
||||
STDMETHOD(SetLight)(THIS_ DWORD Index, CONST D3DLIGHT9*) PURE;
|
||||
STDMETHOD(GetLight)(THIS_ DWORD Index, D3DLIGHT9*) PURE;
|
||||
STDMETHOD(LightEnable)(THIS_ DWORD Index, BOOL Enable) PURE;
|
||||
STDMETHOD(GetLightEnable)(THIS_ DWORD Index, BOOL* pEnable) PURE;
|
||||
STDMETHOD(SetClipPlane)(THIS_ DWORD Index, CONST float* pPlane) PURE;
|
||||
STDMETHOD(GetClipPlane)(THIS_ DWORD Index, float* pPlane) PURE;
|
||||
STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State, DWORD Value) PURE;
|
||||
STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State, DWORD* pValue) PURE;
|
||||
STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type, IDirect3DStateBlock9** ppSB) PURE;
|
||||
STDMETHOD(BeginStateBlock)(THIS) PURE;
|
||||
STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE;
|
||||
STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE;
|
||||
STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE;
|
||||
STDMETHOD(GetTexture)(THIS_ DWORD Stage, IDirect3DBaseTexture9** ppTexture) PURE;
|
||||
STDMETHOD(SetTexture)(THIS_ DWORD Stage, IDirect3DBaseTexture9* pTexture) PURE;
|
||||
STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) PURE;
|
||||
STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) PURE;
|
||||
STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) PURE;
|
||||
STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD Value) PURE;
|
||||
STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE;
|
||||
STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber, CONST PALETTEENTRY* pEntries) PURE;
|
||||
STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE;
|
||||
STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE;
|
||||
STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE;
|
||||
STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE;
|
||||
STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE;
|
||||
STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE;
|
||||
STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE;
|
||||
STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE;
|
||||
STDMETHOD_(float, GetNPatchMode)(THIS) PURE;
|
||||
STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) PURE;
|
||||
STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) PURE;
|
||||
STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) PURE;
|
||||
STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) PURE;
|
||||
STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) PURE;
|
||||
STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements, IDirect3DVertexDeclaration9** ppDecl) PURE;
|
||||
STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE;
|
||||
STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE;
|
||||
STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
|
||||
STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE;
|
||||
STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction, IDirect3DVertexShader9** ppShader) PURE;
|
||||
STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE;
|
||||
STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE;
|
||||
STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) PURE;
|
||||
STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister, float* pConstantData, UINT Vector4fCount) PURE;
|
||||
STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) PURE;
|
||||
STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister, int* pConstantData, UINT Vector4iCount) PURE;
|
||||
STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) PURE;
|
||||
STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister, BOOL* pConstantData, UINT BoolCount) PURE;
|
||||
STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber, IDirect3DVertexBuffer9* pStreamData, UINT OffsetInBytes, UINT Stride) PURE;
|
||||
STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber, IDirect3DVertexBuffer9** ppStreamData, UINT* OffsetInBytes, UINT* pStride) PURE;
|
||||
STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber, UINT Divider) PURE;
|
||||
STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber, UINT* Divider) PURE;
|
||||
STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE;
|
||||
STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE;
|
||||
STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction, IDirect3DPixelShader9** ppShader) PURE;
|
||||
STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE;
|
||||
STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE;
|
||||
STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister, CONST float* pConstantData, UINT Vector4fCount) PURE;
|
||||
STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister, float* pConstantData, UINT Vector4fCount) PURE;
|
||||
STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister, CONST int* pConstantData, UINT Vector4iCount) PURE;
|
||||
STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister, int* pConstantData, UINT Vector4iCount) PURE;
|
||||
STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister, CONST BOOL* pConstantData, UINT BoolCount) PURE;
|
||||
STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister, BOOL* pConstantData, UINT BoolCount) PURE;
|
||||
STDMETHOD(DrawRectPatch)(THIS_ UINT Handle, CONST float* pNumSegs, CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE;
|
||||
STDMETHOD(DrawTriPatch)(THIS_ UINT Handle, CONST float* pNumSegs, CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE;
|
||||
STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE;
|
||||
STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type, IDirect3DQuery9** ppQuery) PURE;
|
||||
/* IDirect3DDevice9Ex methods */
|
||||
STDMETHOD(SetConvolutionMonoKernel)(THIS_ UINT width, UINT height, float *rows, float *columns) PURE;
|
||||
STDMETHOD(ComposeRects)(THIS_ IDirect3DSurface9 *pSrc, IDirect3DDevice9 *pDst, IDirect3DVertexBuffer9 *pSrcRectDescs, UINT NumRects, IDirect3DVertexBuffer9 *pDstRectDescs, D3DCOMPOSERECTSOP Operation, int Xoffset, int Yoffset) PURE;
|
||||
STDMETHOD(PresentEx)(THIS_ CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags) PURE;
|
||||
STDMETHOD(GetGPUThreadPriority)(THIS_ INT *pPriority) PURE;
|
||||
STDMETHOD(SetGPUThreadPriority)(THIS_ INT Priority) PURE;
|
||||
STDMETHOD(WaitForVBlank)(THIS_ UINT iSwapChain) PURE;
|
||||
STDMETHOD(CheckresourceResidency)(THIS_ IDirect3DResource9 ** pResourceArray, UINT32 Numresources) PURE;
|
||||
STDMETHOD(SetMaximumFrameLatency)(THIS_ UINT MaxLatency) PURE;
|
||||
STDMETHOD(GetMaximumFrameLatency)(THIS_ UINT *pMaxLatenxy) PURE;
|
||||
STDMETHOD(CheckdeviceState)(THIS_ HWND hDestinationWindow) PURE;
|
||||
STDMETHOD(CreateRenderTargetEx)(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultiSampleQuality, BOOL Lockable, IDirect3DSurface9 ** ppSurface, HANDLE *pSharedHandle, DWORD Usage) PURE;
|
||||
STDMETHOD(CreateOffscreenPlainSurfaceEx)(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DPOOL Pool, IDirect3DSurface9 **ppSurface, HANDLE *pSharedHandle, DWORD Usage) PURE;
|
||||
STDMETHOD(CreateDepthStencilSurfaceEx)(THIS_ UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultiSampleQuality, BOOL Discard, IDirect3DSurface9 **ppSurfface, HANDLE *pSharedHandle, DWORD Usage) PURE;
|
||||
STDMETHOD(ResetEx)(THIS_ D3DPRESENT_PARAMETERS *pPresentationParameters, D3DDISPLAYMODEEX *pFullscreenDisplayMode) PURE;
|
||||
STDMETHOD(GetDisplayModeEx)(THIS_ UINT iSwapChain, D3DDISPLAYMODEEX *pMode, D3DDISPLAYROTATION *pRotation) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
#if !defined(__cplusplus) || defined(CINTERFACE)
|
||||
/*** IUnknown methods ***/
|
||||
#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
|
||||
#define IDirect3DDevice9Ex_AddRef(p) (p)->lpVtbl->AddRef(p)
|
||||
#define IDirect3DDevice9Ex_Release(p) (p)->lpVtbl->Release(p)
|
||||
/*** IDirect3DDevice9 methods ***/
|
||||
#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->lpVtbl->TestCooperativeLevel(p)
|
||||
#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p)
|
||||
#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p)
|
||||
#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a)
|
||||
#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->lpVtbl->GetDeviceCaps(p,a)
|
||||
#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->lpVtbl->GetCreationParameters(p,a)
|
||||
#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->lpVtbl->SetCursorProperties(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->lpVtbl->SetCursorPosition(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->lpVtbl->ShowCursor(p,a)
|
||||
#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->lpVtbl->GetSwapChain(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p)
|
||||
#define IDirect3DDevice9Ex_Reset(p,a) (p)->lpVtbl->Reset(p,a)
|
||||
#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->lpVtbl->Present(p,a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->lpVtbl->GetBackBuffer(p,a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->lpVtbl->GetRasterStatus(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a)
|
||||
#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->lpVtbl->SetGammaRamp(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->lpVtbl->GetGammaRamp(p,a,b)
|
||||
#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateTexture(p,a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i)
|
||||
#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g)
|
||||
#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateVertexBuffer(p,a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->lpVtbl->CreateIndexBuffer(p,a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateRenderTarget(p,a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->lpVtbl->UpdateTexture(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->lpVtbl->GetRenderTargetData(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b)
|
||||
#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->lpVtbl->StretchRect(p,a,b,c,d,e)
|
||||
#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->lpVtbl->ColorFill(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->lpVtbl->CreateOffscreenPlainSurface(p,a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->lpVtbl->SetRenderTarget(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->lpVtbl->GetRenderTarget(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->lpVtbl->SetDepthStencilSurface(p,a)
|
||||
#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->lpVtbl->GetDepthStencilSurface(p,a)
|
||||
#define IDirect3DDevice9Ex_BeginScene(p) (p)->lpVtbl->BeginScene(p)
|
||||
#define IDirect3DDevice9Ex_EndScene(p) (p)->lpVtbl->EndScene(p)
|
||||
#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->lpVtbl->Clear(p,a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->lpVtbl->SetTransform(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->lpVtbl->GetTransform(p,a,b)
|
||||
#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->lpVtbl->MultiplyTransform(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->lpVtbl->SetViewport(p,a)
|
||||
#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->lpVtbl->GetViewport(p,a)
|
||||
#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->lpVtbl->SetMaterial(p,a)
|
||||
#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->lpVtbl->GetMaterial(p,a)
|
||||
#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->lpVtbl->SetLight(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->lpVtbl->GetLight(p,a,b)
|
||||
#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->lpVtbl->LightEnable(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->lpVtbl->GetLightEnable(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->lpVtbl->SetClipPlane(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->lpVtbl->GetClipPlane(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->lpVtbl->SetRenderState(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->lpVtbl->GetRenderState(p,a,b)
|
||||
#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->lpVtbl->CreateStateBlock(p,a,b)
|
||||
#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->lpVtbl->BeginStateBlock(p)
|
||||
#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->lpVtbl->EndStateBlock(p,a)
|
||||
#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->lpVtbl->SetClipStatus(p,a)
|
||||
#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->lpVtbl->GetClipStatus(p,a)
|
||||
#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->lpVtbl->GetTexture(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->lpVtbl->SetTexture(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->lpVtbl->GetTextureStageState(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->lpVtbl->SetTextureStageState(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->lpVtbl->GetSamplerState(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->lpVtbl->SetSamplerState(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->lpVtbl->ValidateDevice(p,a)
|
||||
#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->lpVtbl->SetPaletteEntries(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->lpVtbl->GetPaletteEntries(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->lpVtbl->SetCurrentTexturePalette(p,a)
|
||||
#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->lpVtbl->GetCurrentTexturePalette(p,a)
|
||||
#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->lpVtbl->SetScissorRect(p,a)
|
||||
#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->lpVtbl->GetScissorRect(p,a)
|
||||
#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->lpVtbl->SetSoftwareVertexProcessing(p,a)
|
||||
#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->lpVtbl->GetSoftwareVertexProcessing(p)
|
||||
#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->lpVtbl->SetNPatchMode(p,a)
|
||||
#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->lpVtbl->GetNPatchMode(p)
|
||||
#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->lpVtbl->DrawPrimitive(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->lpVtbl->DrawIndexedPrimitive(p,a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->lpVtbl->DrawPrimitiveUP(p,a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->lpVtbl->ProcessVertices(p,a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->lpVtbl->CreateVertexDeclaration(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->lpVtbl->SetVertexDeclaration(p,a)
|
||||
#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->lpVtbl->GetVertexDeclaration(p,a)
|
||||
#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->lpVtbl->SetFVF(p,a)
|
||||
#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->lpVtbl->GetFVF(p,a)
|
||||
#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->lpVtbl->CreateVertexShader(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->lpVtbl->SetVertexShader(p,a)
|
||||
#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->lpVtbl->GetVertexShader(p,a)
|
||||
#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantF(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantF(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantI(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantI(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->SetVertexShaderConstantB(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->lpVtbl->GetVertexShaderConstantB(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->lpVtbl->SetStreamSource(p,a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->lpVtbl->GetStreamSource(p,a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->lpVtbl->SetStreamSourceFreq(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->lpVtbl->GetStreamSourceFreq(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->lpVtbl->SetIndices(p,a)
|
||||
#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->lpVtbl->GetIndices(p,a)
|
||||
#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->lpVtbl->CreatePixelShader(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->lpVtbl->SetPixelShader(p,a)
|
||||
#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->lpVtbl->GetPixelShader(p,a)
|
||||
#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantF(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantF(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantI(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantI(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->SetPixelShaderConstantB(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->lpVtbl->GetPixelShaderConstantB(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->lpVtbl->DrawRectPatch(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->lpVtbl->DrawTriPatch(p,a,b,c)
|
||||
#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->lpVtbl->DeletePatch(p,a)
|
||||
#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->lpVtbl->CreateQuery(p,a,b)
|
||||
/* IDirect3DDevice9Ex */
|
||||
#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->lpVtbl->SetConvolutionMonoKernel(p,a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->ComposeRects(p,a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->lpVtbl->PresentEx(p,a,b,c,d,e)
|
||||
#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->lpVtbl->GetGPUThreadPriority(p,a)
|
||||
#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->lpVtbl->SetGPUThreadPriority(p,a)
|
||||
#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->lpVtbl->WaitForVBlank(p,a)
|
||||
#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->lpVtbl->CheckResourceResidency(p,a,b)
|
||||
#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->lpVtbl->SetMaximumFrameLatency(p,a)
|
||||
#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->lpVtbl->GetMaximumFrameLatency(p,a)
|
||||
#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->lpVtbl->CheckDeviceState(p,a)
|
||||
#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i)
|
||||
#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g)(p)->lpVtbl->CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g)
|
||||
#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i)(p)->lpVtbl->CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i)
|
||||
#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->lpVtbl->ResetEx(p,a,b)
|
||||
#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->lpVtbl->GetDisplayModeEx(p,a,b,c)
|
||||
#else
|
||||
/*** IUnknown methods ***/
|
||||
#define IDirect3DDevice9Ex_QueryInterface(p,a,b) (p)->QueryInterface(a,b)
|
||||
#define IDirect3DDevice9Ex_AddRef(p) (p)->AddRef()
|
||||
#define IDirect3DDevice9Ex_Release(p) (p)->Release()
|
||||
/*** IDirect3DDevice9 methods ***/
|
||||
#define IDirect3DDevice9Ex_TestCooperativeLevel(p) (p)->TestCooperativeLevel()
|
||||
#define IDirect3DDevice9Ex_GetAvailableTextureMem(p) (p)->GetAvailableTextureMem()
|
||||
#define IDirect3DDevice9Ex_EvictManagedResources(p) (p)->EvictManagedResources()
|
||||
#define IDirect3DDevice9Ex_GetDirect3D(p,a) (p)->GetDirect3D(a)
|
||||
#define IDirect3DDevice9Ex_GetDeviceCaps(p,a) (p)->GetDeviceCaps(a)
|
||||
#define IDirect3DDevice9Ex_GetDisplayMode(p,a,b) (p)->GetDisplayMode(a,b)
|
||||
#define IDirect3DDevice9Ex_GetCreationParameters(p,a) (p)->GetCreationParameters(a)
|
||||
#define IDirect3DDevice9Ex_SetCursorProperties(p,a,b,c) (p)->SetCursorProperties(a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetCursorPosition(p,a,b,c) (p)->SetCursorPosition(a,b,c)
|
||||
#define IDirect3DDevice9Ex_ShowCursor(p,a) (p)->ShowCursor(a)
|
||||
#define IDirect3DDevice9Ex_CreateAdditionalSwapChain(p,a,b) (p)->CreateAdditionalSwapChain(a,b)
|
||||
#define IDirect3DDevice9Ex_GetSwapChain(p,a,b) (p)->GetSwapChain(a,b)
|
||||
#define IDirect3DDevice9Ex_GetNumberOfSwapChains(p) (p)->GetNumberOfSwapChains()
|
||||
#define IDirect3DDevice9Ex_Reset(p,a) (p)->Reset(a)
|
||||
#define IDirect3DDevice9Ex_Present(p,a,b,c,d) (p)->Present(a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_GetBackBuffer(p,a,b,c,d) (p)->GetBackBuffer(a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_GetRasterStatus(p,a,b) (p)->GetRasterStatus(a,b)
|
||||
#define IDirect3DDevice9Ex_SetDialogBoxMode(p,a) (p)->SetDialogBoxMode(a)
|
||||
#define IDirect3DDevice9Ex_SetGammaRamp(p,a,b,c) (p)->SetGammaRamp(a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetGammaRamp(p,a,b) (p)->GetGammaRamp(a,b)
|
||||
#define IDirect3DDevice9Ex_CreateTexture(p,a,b,c,d,e,f,g,h) (p)->CreateTexture(a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_CreateVolumeTexture(p,a,b,c,d,e,f,g,h,i) (p)->CreateVolumeTexture(a,b,c,d,e,f,g,h,i)
|
||||
#define IDirect3DDevice9Ex_CreateCubeTexture(p,a,b,c,d,e,f,g) (p)->CreateCubeTexture(a,b,c,d,e,f,g)
|
||||
#define IDirect3DDevice9Ex_CreateVertexBuffer(p,a,b,c,d,e,f) (p)->CreateVertexBuffer(a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_CreateIndexBuffer(p,a,b,c,d,e,f) (p)->CreateIndexBuffer(a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_CreateRenderTarget(p,a,b,c,d,e,f,g,h) (p)->CreateRenderTarget(a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_CreateDepthStencilSurface(p,a,b,c,d,e,f,g,h) (p)->CreateDepthStencilSurface(a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_UpdateSurface(p,a,b,c,d) (p)->UpdateSurface(a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_UpdateTexture(p,a,b) (p)->UpdateTexture(a,b)
|
||||
#define IDirect3DDevice9Ex_GetRenderTargetData(p,a,b) (p)->GetRenderTargetData(a,b)
|
||||
#define IDirect3DDevice9Ex_GetFrontBufferData(p,a,b) (p)->GetFrontBufferData(a,b)
|
||||
#define IDirect3DDevice9Ex_StretchRect(p,a,b,c,d,e) (p)->StretchRect(a,b,c,d,e)
|
||||
#define IDirect3DDevice9Ex_ColorFill(p,a,b,c) (p)->ColorFill(a,b,c)
|
||||
#define IDirect3DDevice9Ex_CreateOffscreenPlainSurface(p,a,b,c,d,e,f) (p)->CreateOffscreenPlainSurface(a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_SetRenderTarget(p,a,b) (p)->SetRenderTarget(a,b)
|
||||
#define IDirect3DDevice9Ex_GetRenderTarget(p,a,b) (p)->GetRenderTarget(a,b)
|
||||
#define IDirect3DDevice9Ex_SetDepthStencilSurface(p,a) (p)->SetDepthStencilSurface(a)
|
||||
#define IDirect3DDevice9Ex_GetDepthStencilSurface(p,a) (p)->GetDepthStencilSurface(a)
|
||||
#define IDirect3DDevice9Ex_BeginScene(p) (p)->BeginScene()
|
||||
#define IDirect3DDevice9Ex_EndScene(p) (p)->EndScene()
|
||||
#define IDirect3DDevice9Ex_Clear(p,a,b,c,d,e,f) (p)->Clear(a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_SetTransform(p,a,b) (p)->SetTransform(a,b)
|
||||
#define IDirect3DDevice9Ex_GetTransform(p,a,b) (p)->GetTransform(a,b)
|
||||
#define IDirect3DDevice9Ex_MultiplyTransform(p,a,b) (p)->MultiplyTransform(a,b)
|
||||
#define IDirect3DDevice9Ex_SetViewport(p,a) (p)->SetViewport(a)
|
||||
#define IDirect3DDevice9Ex_GetViewport(p,a) (p)->GetViewport(a)
|
||||
#define IDirect3DDevice9Ex_SetMaterial(p,a) (p)->SetMaterial(a)
|
||||
#define IDirect3DDevice9Ex_GetMaterial(p,a) (p)->GetMaterial(a)
|
||||
#define IDirect3DDevice9Ex_SetLight(p,a,b) (p)->SetLight(a,b)
|
||||
#define IDirect3DDevice9Ex_GetLight(p,a,b) (p)->GetLight(a,b)
|
||||
#define IDirect3DDevice9Ex_LightEnable(p,a,b) (p)->LightEnable(a,b)
|
||||
#define IDirect3DDevice9Ex_GetLightEnable(p,a,b) (p)->GetLightEnable(a,b)
|
||||
#define IDirect3DDevice9Ex_SetClipPlane(p,a,b) (p)->SetClipPlane(a,b)
|
||||
#define IDirect3DDevice9Ex_GetClipPlane(p,a,b) (p)->GetClipPlane(a,b)
|
||||
#define IDirect3DDevice9Ex_SetRenderState(p,a,b) (p)->SetRenderState(a,b)
|
||||
#define IDirect3DDevice9Ex_GetRenderState(p,a,b) (p)->GetRenderState(a,b)
|
||||
#define IDirect3DDevice9Ex_CreateStateBlock(p,a,b) (p)->CreateStateBlock(a,b)
|
||||
#define IDirect3DDevice9Ex_BeginStateBlock(p) (p)->BeginStateBlock()
|
||||
#define IDirect3DDevice9Ex_EndStateBlock(p,a) (p)->EndStateBlock(a)
|
||||
#define IDirect3DDevice9Ex_SetClipStatus(p,a) (p)->SetClipStatus(a)
|
||||
#define IDirect3DDevice9Ex_GetClipStatus(p,a) (p)->GetClipStatus(a)
|
||||
#define IDirect3DDevice9Ex_GetTexture(p,a,b) (p)->GetTexture(a,b)
|
||||
#define IDirect3DDevice9Ex_SetTexture(p,a,b) (p)->SetTexture(a,b)
|
||||
#define IDirect3DDevice9Ex_GetTextureStageState(p,a,b,c) (p)->GetTextureStageState(a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetTextureStageState(p,a,b,c) (p)->SetTextureStageState(a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetSamplerState(p,a,b,c) (p)->GetSamplerState(a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetSamplerState(p,a,b,c) (p)->SetSamplerState(a,b,c)
|
||||
#define IDirect3DDevice9Ex_ValidateDevice(p,a) (p)->ValidateDevice(a)
|
||||
#define IDirect3DDevice9Ex_SetPaletteEntries(p,a,b) (p)->SetPaletteEntries(a,b)
|
||||
#define IDirect3DDevice9Ex_GetPaletteEntries(p,a,b) (p)->GetPaletteEntries(a,b)
|
||||
#define IDirect3DDevice9Ex_SetCurrentTexturePalette(p,a) (p)->SetCurrentTexturePalette(a)
|
||||
#define IDirect3DDevice9Ex_GetCurrentTexturePalette(p,a) (p)->GetCurrentTexturePalette(a)
|
||||
#define IDirect3DDevice9Ex_SetScissorRect(p,a) (p)->SetScissorRect(a)
|
||||
#define IDirect3DDevice9Ex_GetScissorRect(p,a) (p)->GetScissorRect(a)
|
||||
#define IDirect3DDevice9Ex_SetSoftwareVertexProcessing(p,a) (p)->SetSoftwareVertexProcessing(a)
|
||||
#define IDirect3DDevice9Ex_GetSoftwareVertexProcessing(p) (p)->GetSoftwareVertexProcessing()
|
||||
#define IDirect3DDevice9Ex_SetNPatchMode(p,a) (p)->SetNPatchMode(a)
|
||||
#define IDirect3DDevice9Ex_GetNPatchMode(p) (p)->GetNPatchMode()
|
||||
#define IDirect3DDevice9Ex_DrawPrimitive(p,a,b,c) (p)->DrawPrimitive(a,b,c)
|
||||
#define IDirect3DDevice9Ex_DrawIndexedPrimitive(p,a,b,c,d,e,f) (p)->DrawIndexedPrimitive(a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_DrawPrimitiveUP(p,a,b,c,d) (p)->DrawPrimitiveUP(a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_DrawIndexedPrimitiveUP(p,a,b,c,d,e,f,g,h) (p)->DrawIndexedPrimitiveUP(a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_ProcessVertices(p,a,b,c,d,e,f) (p)->ProcessVertices(a,b,c,d,e,f)
|
||||
#define IDirect3DDevice9Ex_CreateVertexDeclaration(p,a,b) (p)->CreateVertexDeclaration(a,b)
|
||||
#define IDirect3DDevice9Ex_SetVertexDeclaration(p,a) (p)->SetVertexDeclaration(a)
|
||||
#define IDirect3DDevice9Ex_GetVertexDeclaration(p,a) (p)->GetVertexDeclaration(a)
|
||||
#define IDirect3DDevice9Ex_SetFVF(p,a) (p)->SetFVF(a)
|
||||
#define IDirect3DDevice9Ex_GetFVF(p,a) (p)->GetFVF(a)
|
||||
#define IDirect3DDevice9Ex_CreateVertexShader(p,a,b) (p)->CreateVertexShader(a,b)
|
||||
#define IDirect3DDevice9Ex_SetVertexShader(p,a) (p)->SetVertexShader(a)
|
||||
#define IDirect3DDevice9Ex_GetVertexShader(p,a) (p)->GetVertexShader(a)
|
||||
#define IDirect3DDevice9Ex_SetVertexShaderConstantF(p,a,b,c) (p)->SetVertexShaderConstantF(a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetVertexShaderConstantF(p,a,b,c) (p)->GetVertexShaderConstantF(a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetVertexShaderConstantI(p,a,b,c) (p)->SetVertexShaderConstantI(a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetVertexShaderConstantI(p,a,b,c) (p)->GetVertexShaderConstantI(a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetVertexShaderConstantB(p,a,b,c) (p)->SetVertexShaderConstantB(a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetVertexShaderConstantB(p,a,b,c) (p)->GetVertexShaderConstantB(a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetStreamSource(p,a,b,c,d) (p)->SetStreamSource(a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_GetStreamSource(p,a,b,c,d) (p)->GetStreamSource(a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_SetStreamSourceFreq(p,a,b) (p)->SetStreamSourceFreq(a,b)
|
||||
#define IDirect3DDevice9Ex_GetStreamSourceFreq(p,a,b) (p)->GetStreamSourceFreq(a,b)
|
||||
#define IDirect3DDevice9Ex_SetIndices(p,a) (p)->SetIndices(a)
|
||||
#define IDirect3DDevice9Ex_GetIndices(p,a) (p)->GetIndices(a)
|
||||
#define IDirect3DDevice9Ex_CreatePixelShader(p,a,b) (p)->CreatePixelShader(a,b)
|
||||
#define IDirect3DDevice9Ex_SetPixelShader(p,a) (p)->SetPixelShader(a)
|
||||
#define IDirect3DDevice9Ex_GetPixelShader(p,a) (p)->GetPixelShader(a)
|
||||
#define IDirect3DDevice9Ex_SetPixelShaderConstantF(p,a,b,c) (p)->SetPixelShaderConstantF(a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetPixelShaderConstantF(p,a,b,c) (p)->GetPixelShaderConstantF(a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetPixelShaderConstantI(p,a,b,c) (p)->SetPixelShaderConstantI(a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetPixelShaderConstantI(p,a,b,c) (p)->GetPixelShaderConstantI(a,b,c)
|
||||
#define IDirect3DDevice9Ex_SetPixelShaderConstantB(p,a,b,c) (p)->SetPixelShaderConstantB(a,b,c)
|
||||
#define IDirect3DDevice9Ex_GetPixelShaderConstantB(p,a,b,c) (p)->GetPixelShaderConstantB(a,b,c)
|
||||
#define IDirect3DDevice9Ex_DrawRectPatch(p,a,b,c) (p)->DrawRectPatch(a,b,c)
|
||||
#define IDirect3DDevice9Ex_DrawTriPatch(p,a,b,c) (p)->DrawTriPatch(a,b,c)
|
||||
#define IDirect3DDevice9Ex_DeletePatch(p,a) (p)->DeletePatch(a)
|
||||
#define IDirect3DDevice9Ex_CreateQuery(p,a,b) (p)->CreateQuery(a,b)
|
||||
/* IDirect3DDevice9Ex */
|
||||
#define IDirect3DDevice9Ex_SetConvolutionMonoKernel(p,a,b,c,d) (p)->SetConvolutionMonoKernel(a,b,c,d)
|
||||
#define IDirect3DDevice9Ex_ComposeRects(p,a,b,c,d,e,f,g,h) (p)->ComposeRects(a,b,c,d,e,f,g,h)
|
||||
#define IDirect3DDevice9Ex_PresentEx(p,a,b,c,d,e) (p)->PresentEx(a,b,c,d,e)
|
||||
#define IDirect3DDevice9Ex_GetGPUThreadPriority(p,a) (p)->GetGPUThreadPriority(a)
|
||||
#define IDirect3DDevice9Ex_SetGPUThreadPriority(p,a) (p)->SetGPUThreadPriority(a)
|
||||
#define IDirect3DDevice9Ex_WaitForVBlank(p,a) (p)->WaitForVBlank(a)
|
||||
#define IDirect3DDevice9Ex_CheckResourceResidency(p,a,b) (p)->CheckResourceResidency(a,b)
|
||||
#define IDirect3DDevice9Ex_SetMaximumFrameLatency(p,a) (p)->SetMaximumFrameLatency(a)
|
||||
#define IDirect3DDevice9Ex_GetMaximumFrameLatency(p,a) (p)->GetMaximumFrameLatency(a)
|
||||
#define IDirect3DDevice9Ex_CheckDeviceState(p,a) (p)->CheckDeviceState(a)
|
||||
#define IDirect3DDevice9Ex_CreateRenderTargetEx(p,a,b,c,d,e,f,g,h,i) (p)->CreateRenderTargetEx(a,b,c,d,e,f,g,h,i)
|
||||
#define IDirect3DDevice9Ex_CreateOffscreenPlainSurfaceEx(p,a,b,c,d,e,f,g)(p)->CreateOffscreenPlainSurfaceEx(a,b,c,d,e,f,g)
|
||||
#define IDirect3DDevice9Ex_CreateDepthStencilSurfaceEx(p,a,b,c,d,e,f,g,h,i)(p)->CreateDepthStencilSurfaceEx(a,b,c,d,e,f,g,h,i)
|
||||
#define IDirect3DDevice9Ex_ResetEx(p,a,b) (p)->ResetEx(a,b)
|
||||
#define IDirect3DDevice9Ex_GetDisplayModeEx(p,a,b,c) (p)->GetDisplayModeEx(a,b,c)
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* defined(__cplusplus) */
|
||||
|
||||
@@ -1541,6 +1541,49 @@ typedef struct _D3DVOLUME_DESC {
|
||||
UINT Depth;
|
||||
} D3DVOLUME_DESC;
|
||||
|
||||
#if !defined(D3D_DISABLE_9EX)
|
||||
typedef enum D3DSCANLINEORDERING
|
||||
{
|
||||
D3DSCANLINEORDERING_UNKNOWN,
|
||||
D3DSCANLINEORDERING_PROGRESSIVE,
|
||||
D3DSCANLINEORDERING_INTERLACED,
|
||||
} D3DSCANLINEORDERING;
|
||||
|
||||
|
||||
typedef struct D3DDISPLAYMODEFILTER
|
||||
{
|
||||
UINT Size;
|
||||
D3DFORMAT Format;
|
||||
D3DSCANLINEORDERING ScanLineOrdering;
|
||||
} D3DDISPLAYMODEFILTER;
|
||||
|
||||
typedef struct D3DDISPLAYMODEEX
|
||||
{
|
||||
UINT Size;
|
||||
UINT Width;
|
||||
UINT Height;
|
||||
UINT RefreshRate;
|
||||
D3DFORMAT Format;
|
||||
D3DSCANLINEORDERING ScanLineOrdering;
|
||||
} D3DDISPLAYMODEEX;
|
||||
|
||||
typedef enum D3DDISPLAYROTATION
|
||||
{
|
||||
D3DDISPLAYROTATION_IDENTITY = 1,
|
||||
D3DDISPLAYROTATION_90,
|
||||
D3DDISPLAYROTATION_180,
|
||||
D3DDISPLAYROTATION_270
|
||||
} D3DDISPLAYROTATION;
|
||||
|
||||
typedef enum _D3DCOMPOSERECTSOP{
|
||||
D3DCOMPOSERECTS_COPY = 1,
|
||||
D3DCOMPOSERECTS_OR,
|
||||
D3DCOMPOSERECTS_AND,
|
||||
D3DCOMPOSERECTS_NEG,
|
||||
D3DCOMPOSERECTS_FORCE_DWORD = 0x7fffffff
|
||||
} D3DCOMPOSERECTSOP;
|
||||
#endif /* D3D_DISABLE_9EX */
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif /* __WINE_D3D9TYPES_H */
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#define WINED3DLINECAPS_BLEND 0x00000004
|
||||
#define WINED3DLINECAPS_ALPHACMP 0x00000008
|
||||
#define WINED3DLINECAPS_FOG 0x00000010
|
||||
#define WINED3DLINECAPS_ANTIALIAS 0x00000020
|
||||
|
||||
#define WINED3DMAX30SHADERINSTRUCTIONS 32768
|
||||
#define WINED3DMIN30SHADERINSTRUCTIONS 512
|
||||
@@ -168,4 +169,144 @@
|
||||
|
||||
#define WINED3DVS20CAPS_PREDICATION 0x00000001
|
||||
|
||||
/* DirectDraw Caps */
|
||||
#define WINEDDSCAPS_RESERVED1 0x00000001
|
||||
#define WINEDDSCAPS_ALPHA 0x00000002
|
||||
#define WINEDDSCAPS_BACKBUFFER 0x00000004
|
||||
#define WINEDDSCAPS_COMPLEX 0x00000008
|
||||
#define WINEDDSCAPS_FLIP 0x00000010
|
||||
#define WINEDDSCAPS_FRONTBUFFER 0x00000020
|
||||
#define WINEDDSCAPS_OFFSCREENPLAIN 0x00000040
|
||||
#define WINEDDSCAPS_OVERLAY 0x00000080
|
||||
#define WINEDDSCAPS_PALETTE 0x00000100
|
||||
#define WINEDDSCAPS_PRIMARYSURFACE 0x00000200
|
||||
#define WINEDDSCAPS_PRIMARYSURFACELEFT 0x00000400
|
||||
#define WINEDDSCAPS_SYSTEMMEMORY 0x00000800
|
||||
#define WINEDDSCAPS_TEXTURE 0x00001000
|
||||
#define WINEDDSCAPS_3DDEVICE 0x00002000
|
||||
#define WINEDDSCAPS_VIDEOMEMORY 0x00004000
|
||||
#define WINEDDSCAPS_VISIBLE 0x00008000
|
||||
#define WINEDDSCAPS_WRITEONLY 0x00010000
|
||||
#define WINEDDSCAPS_ZBUFFER 0x00020000
|
||||
#define WINEDDSCAPS_OWNDC 0x00040000
|
||||
#define WINEDDSCAPS_LIVEVIDEO 0x00080000
|
||||
#define WINEDDSCAPS_HWCODEC 0x00100000
|
||||
#define WINEDDSCAPS_MODEX 0x00200000
|
||||
#define WINEDDSCAPS_MIPMAP 0x00400000
|
||||
#define WINEDDSCAPS_RESERVED2 0x00800000
|
||||
#define WINEDDSCAPS_ALLOCONLOAD 0x04000000
|
||||
#define WINEDDSCAPS_VIDEOPORT 0x08000000
|
||||
#define WINEDDSCAPS_LOCALVIDMEM 0x10000000
|
||||
#define WINEDDSCAPS_NONLOCALVIDMEM 0x20000000
|
||||
#define WINEDDSCAPS_STANDARDVGAMODE 0x40000000
|
||||
#define WINEDDSCAPS_OPTIMIZED 0x80000000
|
||||
|
||||
#define WINEDDCKEYCAPS_DESTBLT 0x00000001
|
||||
#define WINEDDCKEYCAPS_DESTBLTCLRSPACE 0x00000002
|
||||
#define WINEDDCKEYCAPS_DESTBLTCLRSPACEYUV 0x00000004
|
||||
#define WINEDDCKEYCAPS_DESTBLTYUV 0x00000008
|
||||
#define WINEDDCKEYCAPS_DESTOVERLAY 0x00000010
|
||||
#define WINEDDCKEYCAPS_DESTOVERLAYCLRSPACE 0x00000020
|
||||
#define WINEDDCKEYCAPS_DESTOVERLAYCLRSPACEYUV 0x00000040
|
||||
#define WINEDDCKEYCAPS_DESTOVERLAYONEACTIVE 0x00000080
|
||||
#define WINEDDCKEYCAPS_DESTOVERLAYYUV 0x00000100
|
||||
#define WINEDDCKEYCAPS_SRCBLT 0x00000200
|
||||
#define WINEDDCKEYCAPS_SRCBLTCLRSPACE 0x00000400
|
||||
#define WINEDDCKEYCAPS_SRCBLTCLRSPACEYUV 0x00000800
|
||||
#define WINEDDCKEYCAPS_SRCBLTYUV 0x00001000
|
||||
#define WINEDDCKEYCAPS_SRCOVERLAY 0x00002000
|
||||
#define WINEDDCKEYCAPS_SRCOVERLAYCLRSPACE 0x00004000
|
||||
#define WINEDDCKEYCAPS_SRCOVERLAYCLRSPACEYUV 0x00008000
|
||||
#define WINEDDCKEYCAPS_SRCOVERLAYONEACTIVE 0x00010000
|
||||
#define WINEDDCKEYCAPS_SRCOVERLAYYUV 0x00020000
|
||||
#define WINEDDCKEYCAPS_NOCOSTOVERLAY 0x00040000
|
||||
|
||||
#define WINEDDFXCAPS_BLTALPHA 0x00000001
|
||||
#define WINEDDFXCAPS_OVERLAYALPHA 0x00000004
|
||||
#define WINEDDFXCAPS_BLTARITHSTRETCHYN 0x00000010
|
||||
#define WINEDDFXCAPS_BLTARITHSTRETCHY 0x00000020
|
||||
#define WINEDDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040
|
||||
#define WINEDDFXCAPS_BLTMIRRORUPDOWN 0x00000080
|
||||
#define WINEDDFXCAPS_BLTROTATION 0x00000100
|
||||
#define WINEDDFXCAPS_BLTROTATION90 0x00000200
|
||||
#define WINEDDFXCAPS_BLTSHRINKX 0x00000400
|
||||
#define WINEDDFXCAPS_BLTSHRINKXN 0x00000800
|
||||
#define WINEDDFXCAPS_BLTSHRINKY 0x00001000
|
||||
#define WINEDDFXCAPS_BLTSHRINKYN 0x00002000
|
||||
#define WINEDDFXCAPS_BLTSTRETCHX 0x00004000
|
||||
#define WINEDDFXCAPS_BLTSTRETCHXN 0x00008000
|
||||
#define WINEDDFXCAPS_BLTSTRETCHY 0x00010000
|
||||
#define WINEDDFXCAPS_BLTSTRETCHYN 0x00020000
|
||||
#define WINEDDFXCAPS_OVERLAYARITHSTRETCHY 0x00040000
|
||||
#define WINEDDFXCAPS_OVERLAYARITHSTRETCHYN 0x00000008
|
||||
#define WINEDDFXCAPS_OVERLAYSHRINKX 0x00080000
|
||||
#define WINEDDFXCAPS_OVERLAYSHRINKXN 0x00100000
|
||||
#define WINEDDFXCAPS_OVERLAYSHRINKY 0x00200000
|
||||
#define WINEDDFXCAPS_OVERLAYSHRINKYN 0x00400000
|
||||
#define WINEDDFXCAPS_OVERLAYSTRETCHX 0x00800000
|
||||
#define WINEDDFXCAPS_OVERLAYSTRETCHXN 0x01000000
|
||||
#define WINEDDFXCAPS_OVERLAYSTRETCHY 0x02000000
|
||||
#define WINEDDFXCAPS_OVERLAYSTRETCHYN 0x04000000
|
||||
#define WINEDDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000
|
||||
#define WINEDDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000
|
||||
|
||||
#define WINEDDCAPS_3D 0x00000001
|
||||
#define WINEDDCAPS_ALIGNBOUNDARYDEST 0x00000002
|
||||
#define WINEDDCAPS_ALIGNSIZEDEST 0x00000004
|
||||
#define WINEDDCAPS_ALIGNBOUNDARYSRC 0x00000008
|
||||
#define WINEDDCAPS_ALIGNSIZESRC 0x00000010
|
||||
#define WINEDDCAPS_ALIGNSTRIDE 0x00000020
|
||||
#define WINEDDCAPS_BLT 0x00000040
|
||||
#define WINEDDCAPS_BLTQUEUE 0x00000080
|
||||
#define WINEDDCAPS_BLTFOURCC 0x00000100
|
||||
#define WINEDDCAPS_BLTSTRETCH 0x00000200
|
||||
#define WINEDDCAPS_GDI 0x00000400
|
||||
#define WINEDDCAPS_OVERLAY 0x00000800
|
||||
#define WINEDDCAPS_OVERLAYCANTCLIP 0x00001000
|
||||
#define WINEDDCAPS_OVERLAYFOURCC 0x00002000
|
||||
#define WINEDDCAPS_OVERLAYSTRETCH 0x00004000
|
||||
#define WINEDDCAPS_PALETTE 0x00008000
|
||||
#define WINEDDCAPS_PALETTEVSYNC 0x00010000
|
||||
#define WINEDDCAPS_READSCANLINE 0x00020000
|
||||
#define WINEDDCAPS_STEREOVIEW 0x00040000
|
||||
#define WINEDDCAPS_VBI 0x00080000
|
||||
#define WINEDDCAPS_ZBLTS 0x00100000
|
||||
#define WINEDDCAPS_ZOVERLAYS 0x00200000
|
||||
#define WINEDDCAPS_COLORKEY 0x00400000
|
||||
#define WINEDDCAPS_ALPHA 0x00800000
|
||||
#define WINEDDCAPS_COLORKEYHWASSIST 0x01000000
|
||||
#define WINEDDCAPS_NOHARDWARE 0x02000000
|
||||
#define WINEDDCAPS_BLTCOLORFILL 0x04000000
|
||||
#define WINEDDCAPS_BANKSWITCHED 0x08000000
|
||||
#define WINEDDCAPS_BLTDEPTHFILL 0x10000000
|
||||
#define WINEDDCAPS_CANCLIP 0x20000000
|
||||
#define WINEDDCAPS_CANCLIPSTRETCHED 0x40000000
|
||||
#define WINEDDCAPS_CANBLTSYSMEM 0x80000000
|
||||
|
||||
#define WINEDDCAPS2_CERTIFIED 0x00000001
|
||||
#define WINEDDCAPS2_NO2DDURING3DSCENE 0x00000002
|
||||
#define WINEDDCAPS2_VIDEOPORT 0x00000004
|
||||
#define WINEDDCAPS2_AUTOFLIPOVERLAY 0x00000008
|
||||
#define WINEDDCAPS2_CANBOBINTERLEAVED 0x00000010
|
||||
#define WINEDDCAPS2_CANBOBNONINTERLEAVED 0x00000020
|
||||
#define WINEDDCAPS2_COLORCONTROLOVERLAY 0x00000040
|
||||
#define WINEDDCAPS2_COLORCONTROLPRIMARY 0x00000080
|
||||
#define WINEDDCAPS2_CANDROPZ16BIT 0x00000100
|
||||
#define WINEDDCAPS2_NONLOCALVIDMEM 0x00000200
|
||||
#define WINEDDCAPS2_NONLOCALVIDMEMCAPS 0x00000400
|
||||
#define WINEDDCAPS2_NOPAGELOCKREQUIRED 0x00000800
|
||||
#define WINEDDCAPS2_WIDESURFACES 0x00001000
|
||||
#define WINEDDCAPS2_CANFLIPODDEVEN 0x00002000
|
||||
#define WINEDDCAPS2_CANBOBHARDWARE 0x00004000
|
||||
#define WINEDDCAPS2_COPYFOURCC 0x00008000
|
||||
#define WINEDDCAPS2_PRIMARYGAMMA 0x00020000
|
||||
#define WINEDDCAPS2_CANRENDERWINDOWED 0x00080000
|
||||
#define WINEDDCAPS2_CANCALIBRATEGAMMA 0x00100000
|
||||
#define WINEDDCAPS2_FLIPINTERVAL 0x00200000
|
||||
#define WINEDDCAPS2_FLIPNOVSYNC 0x00400000
|
||||
#define WINEDDCAPS2_CANMANAGETEXTURE 0x00800000
|
||||
#define WINEDDCAPS2_TEXMANINNONLOCALVIDMEM 0x01000000
|
||||
#define WINEDDCAPS2_STEREO 0x02000000
|
||||
#define WINEDDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000
|
||||
|
||||
#endif /* __WINE_WINED3D_CAPS_H */
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -80,6 +80,7 @@ struct IWineD3DSurface;
|
||||
#define WINEDDERR_SURFACEBUSY MAKE_WINED3DHRESULT(430)
|
||||
#define WINEDDERR_INVALIDRECT MAKE_WINED3DHRESULT(150)
|
||||
#define WINEDDERR_NOCLIPLIST MAKE_WINED3DHRESULT(205)
|
||||
#define WINEDDERR_OVERLAYNOTVISIBLE MAKE_WINED3DHRESULT(577)
|
||||
#define WINED3DOK_NOAUTOGEN MAKE_WINED3DSTATUS(2159)
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -247,6 +248,10 @@ typedef HRESULT (WINAPI *D3DCB_CREATEADDITIONALSWAPCHAIN) (IUnknown *pDevice,
|
||||
struct IWineD3DSwapChain **pSwapChain
|
||||
);
|
||||
|
||||
typedef HRESULT (WINAPI *D3DCB_ENUMRESOURCES) (struct IWineD3DResource *resource,
|
||||
void *pData
|
||||
);
|
||||
|
||||
/*****************************************************************************
|
||||
* Callback functions for custom implicit object destruction.
|
||||
*/
|
||||
@@ -305,7 +310,7 @@ DECLARE_INTERFACE_(IWineD3D, IWineD3DBase)
|
||||
STDMETHOD(CheckDeviceMultiSampleType)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT SurfaceFormat, BOOL Windowed, WINED3DMULTISAMPLE_TYPE MultiSampleType, DWORD *pQuality) PURE;
|
||||
STDMETHOD(CheckDepthStencilMatch)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, WINED3DFORMAT RenderTargetFormat, WINED3DFORMAT DepthStencilFormat) PURE;
|
||||
STDMETHOD(CheckDeviceType)(THIS_ UINT Adapter, WINED3DDEVTYPE CheckType, WINED3DFORMAT DisplayFormat, WINED3DFORMAT BackBufferFormat, BOOL Windowed) PURE;
|
||||
STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat) PURE;
|
||||
STDMETHOD(CheckDeviceFormat)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT AdapterFormat, DWORD Usage, WINED3DRESOURCETYPE RType, WINED3DFORMAT CheckFormat, WINED3DSURFTYPE SurfaceType) PURE;
|
||||
STDMETHOD(CheckDeviceFormatConversion)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DFORMAT SourceFormat, WINED3DFORMAT TargetFormat) PURE;
|
||||
STDMETHOD(GetDeviceCaps)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType, WINED3DCAPS *pCaps) PURE;
|
||||
STDMETHOD(CreateDevice)(THIS_ UINT Adapter, WINED3DDEVTYPE DeviceType,HWND hFocusWindow, DWORD BehaviorFlags, struct IWineD3DDevice **ppReturnedDeviceInterface, IUnknown *parent) PURE;
|
||||
@@ -331,7 +336,7 @@ DECLARE_INTERFACE_(IWineD3D, IWineD3DBase)
|
||||
#define IWineD3D_CheckDeviceMultiSampleType(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceMultiSampleType(p,a,b,c,d,e,f)
|
||||
#define IWineD3D_CheckDepthStencilMatch(p,a,b,c,d,e) (p)->lpVtbl->CheckDepthStencilMatch(p,a,b,c,d,e)
|
||||
#define IWineD3D_CheckDeviceType(p,a,b,c,d,e) (p)->lpVtbl->CheckDeviceType(p,a,b,c,d,e)
|
||||
#define IWineD3D_CheckDeviceFormat(p,a,b,c,d,e,f) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f)
|
||||
#define IWineD3D_CheckDeviceFormat(p,a,b,c,d,e,f,g) (p)->lpVtbl->CheckDeviceFormat(p,a,b,c,d,e,f,g)
|
||||
#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) (p)->lpVtbl->CreateDevice(p,a,b,c,d,e,f)
|
||||
@@ -362,15 +367,16 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
||||
STDMETHOD(CreateVolume)(THIS_ UINT Width, UINT Height, UINT Depth, DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool, struct IWineD3DVolume** ppVolumeTexture, HANDLE* pSharedHandle, IUnknown *parent) PURE;
|
||||
STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength, UINT Levels, DWORD Usage, WINED3DFORMAT Format, WINED3DPOOL Pool, struct IWineD3DCubeTexture** ppCubeTexture, HANDLE* pSharedHandle, IUnknown *parent, D3DCB_CREATESURFACEFN pFn) PURE;
|
||||
STDMETHOD(CreateQuery)(THIS_ WINED3DQUERYTYPE Type, struct IWineD3DQuery **ppQuery, IUnknown *pParent);
|
||||
STDMETHOD(CreateAdditionalSwapChain)(THIS_ WINED3DPRESENT_PARAMETERS *pPresentationParameters, struct IWineD3DSwapChain **pSwapChain, IUnknown *pParent, D3DCB_CREATERENDERTARGETFN pFn, D3DCB_CREATEDEPTHSTENCILSURFACEFN pFn2);
|
||||
STDMETHOD(CreateVertexDeclaration)(THIS_ struct IWineD3DVertexDeclaration** ppDecl, IUnknown* pParent, const WINED3DVERTEXELEMENT *elements, size_t element_count) PURE;
|
||||
STDMETHOD(CreateAdditionalSwapChain)(THIS_ WINED3DPRESENT_PARAMETERS *pPresentationParameters, struct IWineD3DSwapChain **pSwapChain, IUnknown *pParent, D3DCB_CREATERENDERTARGETFN pFn, D3DCB_CREATEDEPTHSTENCILSURFACEFN pFn2, WINED3DSURFTYPE surface_type);
|
||||
STDMETHOD(CreateVertexDeclaration)(THIS_ struct IWineD3DVertexDeclaration** ppDecl, IUnknown* pParent, const WINED3DVERTEXELEMENT *elements, UINT element_count) PURE;
|
||||
STDMETHOD(CreateVertexDeclarationFromFVF)(THIS_ struct IWineD3DVertexDeclaration** ppDecl, IUnknown* pParent, DWORD Fvf) PURE;
|
||||
STDMETHOD(CreateVertexShader)(THIS_ struct IWineD3DVertexDeclaration *vertex_declaration, CONST DWORD* pFunction, struct IWineD3DVertexShader** ppShader, IUnknown *pParent) PURE;
|
||||
STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction, struct IWineD3DPixelShader** ppShader, IUnknown *pParent) PURE;
|
||||
STDMETHOD_(HRESULT,CreatePalette)(THIS_ DWORD Flags, PALETTEENTRY *PalEnt, struct IWineD3DPalette **Palette, IUnknown *Parent);
|
||||
STDMETHOD(Init3D)(THIS_ WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain);
|
||||
STDMETHOD(InitGDI)(THIS_ WINED3DPRESENT_PARAMETERS* pPresentationParameters, D3DCB_CREATEADDITIONALSWAPCHAIN D3DCB_CreateAdditionalSwapChain);
|
||||
STDMETHOD(Uninit3D)(THIS, D3DCB_DESTROYSURFACEFN pFn, D3DCB_DESTROYSWAPCHAINFN pFn2);
|
||||
STDMETHOD_(void, SetFullscreen)(THIS_ BOOL fullscreen);
|
||||
STDMETHOD(UninitGDI)(THIS, D3DCB_DESTROYSWAPCHAINFN pFn2);
|
||||
STDMETHOD_(void, SetMultithreaded)(THIS);
|
||||
STDMETHOD(EvictManagedResources)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE;
|
||||
@@ -380,8 +386,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
||||
STDMETHOD(GetDirect3D)(THIS_ IWineD3D** ppD3D) PURE;
|
||||
STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain, WINED3DDISPLAYMODE* pMode) PURE;
|
||||
STDMETHOD(SetDisplayMode)(THIS_ UINT iSwapChain, WINED3DDISPLAYMODE* pMode) PURE;
|
||||
STDMETHOD(GetHWND)(THIS_ HWND *hwnd) PURE;
|
||||
STDMETHOD(SetHWND)(THIS_ HWND hwnd) PURE;
|
||||
STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE;
|
||||
STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain, WINED3DRASTER_STATUS* pRasterStatus) PURE;
|
||||
STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain, struct IWineD3DSwapChain **pSwapChain) PURE;
|
||||
@@ -482,6 +486,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
||||
STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,struct IWineD3DSurface* pSurface) PURE;
|
||||
/*** object tracking ***/
|
||||
STDMETHOD_(void, ResourceReleased)(THIS_ struct IWineD3DResource *resource);
|
||||
STDMETHOD(EnumResources)(THIS_ D3DCB_ENUMRESOURCES pCallback, void *pData);
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
@@ -502,15 +507,16 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
||||
#define IWineD3DDevice_CreateVolume(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateVolume(p,a,b,c,d,e,f,g,h,i)
|
||||
#define IWineD3DDevice_CreateCubeTexture(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CreateCubeTexture(p,a,b,c,d,e,f,g,h,i)
|
||||
#define IWineD3DDevice_CreateQuery(p,a,b,c) (p)->lpVtbl->CreateQuery(p,a,b,c)
|
||||
#define IWineD3DDevice_CreateAdditionalSwapChain(p,a,b,c,d,e) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b,c,d,e)
|
||||
#define IWineD3DDevice_CreateAdditionalSwapChain(p,a,b,c,d,e,f) (p)->lpVtbl->CreateAdditionalSwapChain(p,a,b,c,d,e,f)
|
||||
#define IWineD3DDevice_CreateVertexDeclaration(p,a,b,c,d) (p)->lpVtbl->CreateVertexDeclaration(p,a,b,c,d)
|
||||
#define IWineD3DDevice_CreateVertexDeclarationFromFVF(p,a,b,c) (p)->lpVtbl->CreateVertexDeclarationFromFVF(p,a,b,c)
|
||||
#define IWineD3DDevice_CreateVertexShader(p,a,b,c,d) (p)->lpVtbl->CreateVertexShader(p,a,b,c,d)
|
||||
#define IWineD3DDevice_CreatePixelShader(p,a,b,c) (p)->lpVtbl->CreatePixelShader(p,a,b,c)
|
||||
#define IWineD3DDevice_CreatePalette(p, a, b, c, d) (p)->lpVtbl->CreatePalette(p, a, b, c, d)
|
||||
#define IWineD3DDevice_Init3D(p, a, b) (p)->lpVtbl->Init3D(p, a, b)
|
||||
#define IWineD3DDevice_InitGDI(p, a, b) (p)->lpVtbl->InitGDI(p, a, b)
|
||||
#define IWineD3DDevice_Uninit3D(p, a, b) (p)->lpVtbl->Uninit3D(p, a, b)
|
||||
#define IWineD3DDevice_SetFullscreen(p, a) (p)->lpVtbl->SetFullscreen(p, a)
|
||||
#define IWineD3DDevice_UninitGDI(p, a) (p)->lpVtbl->UninitGDI(p, a)
|
||||
#define IWineD3DDevice_SetMultithreaded(p) (p)->lpVtbl->SetMultithreaded(p)
|
||||
#define IWineD3DDevice_EvictManagedResources(p) (p)->lpVtbl->EvictManagedResources(p)
|
||||
#define IWineD3DDevice_GetAvailableTextureMem(p) (p)->lpVtbl->GetAvailableTextureMem(p)
|
||||
@@ -520,8 +526,6 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
||||
#define IWineD3DDevice_GetDirect3D(p,a) (p)->lpVtbl->GetDirect3D(p,a)
|
||||
#define IWineD3DDevice_GetDisplayMode(p,a,b) (p)->lpVtbl->GetDisplayMode(p,a,b)
|
||||
#define IWineD3DDevice_SetDisplayMode(p,a,b) (p)->lpVtbl->SetDisplayMode(p,a,b)
|
||||
#define IWineD3DDevice_GetHWND(p, a) (p)->lpVtbl->GetHWND(p, a)
|
||||
#define IWineD3DDevice_SetHWND(p, a) (p)->lpVtbl->SetHWND(p, a)
|
||||
#define IWineD3DDevice_GetNumberOfSwapChains(p) (p)->lpVtbl->GetNumberOfSwapChains(p)
|
||||
#define IWineD3DDevice_Reset(p,a) (p)->lpVtbl->Reset(p,a)
|
||||
#define IWineD3DDevice_SetDialogBoxMode(p,a) (p)->lpVtbl->SetDialogBoxMode(p,a)
|
||||
@@ -621,6 +625,7 @@ DECLARE_INTERFACE_(IWineD3DDevice,IWineD3DBase)
|
||||
#define IWineD3DDevice_UpdateSurface(p,a,b,c,d) (p)->lpVtbl->UpdateSurface(p,a,b,c,d)
|
||||
#define IWineD3DDevice_GetFrontBufferData(p,a,b) (p)->lpVtbl->GetFrontBufferData(p,a,b)
|
||||
#define IWineD3DDevice_ResourceReleased(p,a) (p)->lpVtbl->ResourceReleased(p,a)
|
||||
#define IWineD3DDevice_EnumResources(p,a,b) (p)->lpVtbl->EnumResources(p,a,b)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -643,6 +648,7 @@ DECLARE_INTERFACE_(IWineD3DResource,IWineD3DBase)
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(void,UnLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE,GetType)(THIS) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
@@ -662,6 +668,7 @@ DECLARE_INTERFACE_(IWineD3DResource,IWineD3DBase)
|
||||
#define IWineD3DResource_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
|
||||
#define IWineD3DResource_GetPriority(p) (p)->lpVtbl->GetPriority(p)
|
||||
#define IWineD3DResource_PreLoad(p) (p)->lpVtbl->PreLoad(p)
|
||||
#define IWineD3DResource_UnLoad(p) (p)->lpVtbl->UnLoad(p)
|
||||
#define IWineD3DResource_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
#endif
|
||||
|
||||
@@ -685,6 +692,7 @@ DECLARE_INTERFACE_(IWineD3DVertexBuffer,IWineD3DResource)
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(void,UnLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE,GetType)(THIS) PURE;
|
||||
/*** IWineD3DVertexBuffer methods ***/
|
||||
STDMETHOD(Lock)(THIS_ UINT OffsetToLock, UINT SizeToLock, BYTE ** ppbData, DWORD Flags) PURE;
|
||||
@@ -708,6 +716,7 @@ DECLARE_INTERFACE_(IWineD3DVertexBuffer,IWineD3DResource)
|
||||
#define IWineD3DVertexBuffer_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
|
||||
#define IWineD3DVertexBuffer_GetPriority(p) (p)->lpVtbl->GetPriority(p)
|
||||
#define IWineD3DVertexBuffer_PreLoad(p) (p)->lpVtbl->PreLoad(p)
|
||||
#define IWineD3DVertexBuffer_UnLoad(p) (p)->lpVtbl->UnLoad(p)
|
||||
#define IWineD3DVertexBuffer_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
/*** IWineD3DVertexBuffer methods ***/
|
||||
#define IWineD3DVertexBuffer_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d)
|
||||
@@ -735,6 +744,7 @@ DECLARE_INTERFACE_(IWineD3DIndexBuffer,IWineD3DResource)
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(void,UnLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE,GetType)(THIS) PURE;
|
||||
/*** IWineD3DIndexBuffer methods ***/
|
||||
STDMETHOD(Lock)(THIS_ UINT OffsetToLock, UINT SizeToLock, BYTE ** ppbData, DWORD Flags) PURE;
|
||||
@@ -758,6 +768,7 @@ DECLARE_INTERFACE_(IWineD3DIndexBuffer,IWineD3DResource)
|
||||
#define IWineD3DIndexBuffer_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
|
||||
#define IWineD3DIndexBuffer_GetPriority(p) (p)->lpVtbl->GetPriority(p)
|
||||
#define IWineD3DIndexBuffer_PreLoad(p) (p)->lpVtbl->PreLoad(p)
|
||||
#define IWineD3DIndexBuffer_UnLoad(p) (p)->lpVtbl->UnLoad(p)
|
||||
#define IWineD3DIndexBuffer_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
/*** IWineD3DIndexBuffer methods ***/
|
||||
#define IWineD3DIndexBuffer_Lock(p,a,b,c,d) (p)->lpVtbl->Lock(p,a,b,c,d)
|
||||
@@ -787,6 +798,7 @@ DECLARE_INTERFACE_(IWineD3DBaseTexture,IWineD3DResource)
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(void,UnLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE,GetType)(THIS) PURE;
|
||||
/*** IWineD3DBaseTexture methods ***/
|
||||
STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;
|
||||
@@ -798,8 +810,8 @@ DECLARE_INTERFACE_(IWineD3DBaseTexture,IWineD3DResource)
|
||||
STDMETHOD_(BOOL, SetDirty)(THIS_ BOOL) PURE;
|
||||
STDMETHOD_(BOOL, GetDirty)(THIS) PURE;
|
||||
STDMETHOD(BindTexture)(THIS) PURE;
|
||||
STDMETHOD(UnBindTexture)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetTextureDimensions)(THIS) PURE;
|
||||
STDMETHOD_(BOOL, IsCondNP2)(THIS) PURE;
|
||||
STDMETHOD_(void, ApplyStateChanges)(THIS_ const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) PURE;
|
||||
|
||||
};
|
||||
@@ -820,6 +832,7 @@ DECLARE_INTERFACE_(IWineD3DBaseTexture,IWineD3DResource)
|
||||
#define IWineD3DBaseTexture_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
|
||||
#define IWineD3DBaseTexture_GetPriority(p) (p)->lpVtbl->GetPriority(p)
|
||||
#define IWineD3DBaseTexture_PreLoad(p) (p)->lpVtbl->PreLoad(p)
|
||||
#define IWineD3DBaseTexture_UnLoad(p) (p)->lpVtbl->UnLoad(p)
|
||||
#define IWineD3DBaseTexture_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
/*** IWineD3DBaseTexture methods ***/
|
||||
#define IWineD3DBaseTexture_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a)
|
||||
@@ -832,8 +845,8 @@ DECLARE_INTERFACE_(IWineD3DBaseTexture,IWineD3DResource)
|
||||
#define IWineD3DBaseTexture_GetDirty(p) (p)->lpVtbl->GetDirty(p)
|
||||
/*** internal methods ***/
|
||||
#define IWineD3DBaseTexture_BindTexture(p) (p)->lpVtbl->BindTexture(p)
|
||||
#define IWineD3DBaseTexture_UnBindTexture(p) (p)->lpVtbl->UnBindTexture(p)
|
||||
#define IWineD3DBaseTexture_GetTextureDimensions(p) (p)->lpVtbl->GetTextureDimensions(p)
|
||||
#define IWineD3DBaseTexture_IsCondNP2(p) (p)->lpVtbl->IsCondNP2(p)
|
||||
#define IWineD3DBaseTexture_ApplyStateChanges(p,a,b) (p)->lpVtbl->ApplyStateChanges(p,a,b)
|
||||
#endif
|
||||
|
||||
@@ -857,6 +870,7 @@ DECLARE_INTERFACE_(IWineD3DTexture,IWineD3DBaseTexture)
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(void,UnLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE,GetType)(THIS) PURE;
|
||||
/*** IWineD3DBaseTexture methods ***/
|
||||
STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;
|
||||
@@ -868,8 +882,8 @@ DECLARE_INTERFACE_(IWineD3DTexture,IWineD3DBaseTexture)
|
||||
STDMETHOD_(BOOL, SetDirty)(THIS_ BOOL) PURE;
|
||||
STDMETHOD_(BOOL, GetDirty)(THIS) PURE;
|
||||
STDMETHOD(BindTexture)(THIS) PURE;
|
||||
STDMETHOD(UnBindTexture)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetTextureDimensions)(THIS) PURE;
|
||||
STDMETHOD_(BOOL, IsCondNP2)(THIS) PURE;
|
||||
STDMETHOD_(void, ApplyStateChanges)(THIS_ const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) PURE;
|
||||
/*** IWineD3DTexture methods ***/
|
||||
STDMETHOD_(void, Destroy)(THIS_ D3DCB_DESTROYSURFACEFN pFn) PURE;
|
||||
@@ -896,6 +910,7 @@ DECLARE_INTERFACE_(IWineD3DTexture,IWineD3DBaseTexture)
|
||||
#define IWineD3DTexture_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
|
||||
#define IWineD3DTexture_GetPriority(p) (p)->lpVtbl->GetPriority(p)
|
||||
#define IWineD3DTexture_PreLoad(p) (p)->lpVtbl->PreLoad(p)
|
||||
#define IWineD3DTexture_UnLoad(p) (p)->lpVtbl->UnLoad(p)
|
||||
#define IWineD3DTexture_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
/*** IWineD3DTexture methods: IWineD3DBaseTexture ***/
|
||||
#define IWineD3DTexture_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a)
|
||||
@@ -907,8 +922,8 @@ DECLARE_INTERFACE_(IWineD3DTexture,IWineD3DBaseTexture)
|
||||
#define IWineD3DTexture_SetDirty(p,a) (p)->lpVtbl->SetDirty(p,a)
|
||||
#define IWineD3DTexture_GetDirty(p) (p)->lpVtbl->GetDirty(p)
|
||||
#define IWineD3DTexture_BindTexture(p) (p)->lpVtbl->BindTexture(p)
|
||||
#define IWineD3DTexture_UnBindTexture(p) (p)->lpVtbl->UnBindTexture(p)
|
||||
#define IWineD3DTexture_GetTextureDimensions(p) (p)->lpVtbl->GetTextureDimensions(p)
|
||||
#define IWineD3DTexture_IsCondNP2(p) (p)->lpVtbl->IsCondNP2(p)
|
||||
#define IWineD3DTexture_ApplyStateChanges(p,a,b) (p)->lpVtbl->ApplyStateChanges(p,a,b)
|
||||
/*** IWineD3DTexture methods ***/
|
||||
#define IWineD3DTexture_Destroy(p,a) (p)->lpVtbl->Destroy(p,a)
|
||||
@@ -939,6 +954,7 @@ DECLARE_INTERFACE_(IWineD3DCubeTexture,IWineD3DBaseTexture)
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(void,UnLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE,GetType)(THIS) PURE;
|
||||
/*** IWineD3DBaseTexture methods ***/
|
||||
STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;
|
||||
@@ -950,8 +966,8 @@ DECLARE_INTERFACE_(IWineD3DCubeTexture,IWineD3DBaseTexture)
|
||||
STDMETHOD_(BOOL, SetDirty)(THIS_ BOOL) PURE;
|
||||
STDMETHOD_(BOOL, GetDirty)(THIS) PURE;
|
||||
STDMETHOD(BindTexture)(THIS) PURE;
|
||||
STDMETHOD(UnBindTexture)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetTextureDimensions)(THIS) PURE;
|
||||
STDMETHOD_(BOOL, IsCondNP2)(THIS) PURE;
|
||||
STDMETHOD_(void, ApplyStateChanges)(THIS_ DWORD const textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) PURE;
|
||||
/*** IWineD3DCubeTexture methods ***/
|
||||
STDMETHOD_(void, Destroy)(THIS_ D3DCB_DESTROYSURFACEFN pFn) PURE;
|
||||
@@ -978,6 +994,7 @@ DECLARE_INTERFACE_(IWineD3DCubeTexture,IWineD3DBaseTexture)
|
||||
#define IWineD3DCubeTexture_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
|
||||
#define IWineD3DCubeTexture_GetPriority(p) (p)->lpVtbl->GetPriority(p)
|
||||
#define IWineD3DCubeTexture_PreLoad(p) (p)->lpVtbl->PreLoad(p)
|
||||
#define IWineD3DCubeTexture_UnLoad(p) (p)->lpVtbl->UnLoad(p)
|
||||
#define IWineD3DCubeTexture_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
/*** IWineD3DCubeTexture methods: IWineD3DBaseTexture ***/
|
||||
#define IWineD3DCubeTexture_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a)
|
||||
@@ -989,8 +1006,8 @@ DECLARE_INTERFACE_(IWineD3DCubeTexture,IWineD3DBaseTexture)
|
||||
#define IWineD3DCubeTexture_SetDirty(p,a) (p)->lpVtbl->SetDirty(p,a)
|
||||
#define IWineD3DCubeTexture_GetDirty(p) (p)->lpVtbl->GetDirty(p)
|
||||
#define IWineD3DCubeTexture_BindTexture(p) (p)->lpVtbl->BindTexture(p)
|
||||
#define IWineD3DCubeTexture_UnBindTexture(p) (p)->lpVtbl->UnBindTexture(p)
|
||||
#define IWineD3DCubeTexture_GetTextureDimensions(p) (p)->lpVtbl->GetTextureDimensions(p)
|
||||
#define IWineD3DCubeTexture_IsCondNP2(p) (p)->lpVtbl->IsCondNP2(p)
|
||||
#define IWineD3DCubeTexture_ApplyStateChanges(p,a,b) (p)->lpVtbl->ApplyStateChanges(p,a,b)
|
||||
/*** IWineD3DCubeTexture methods ***/
|
||||
#define IWineD3DCubeTexture_Destroy(p,a) (p)->lpVtbl->Destroy(p,a)
|
||||
@@ -1022,6 +1039,7 @@ DECLARE_INTERFACE_(IWineD3DVolumeTexture,IWineD3DBaseTexture)
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(void,UnLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE,GetType)(THIS) PURE;
|
||||
/*** IWineD3DBaseTexture methods ***/
|
||||
STDMETHOD_(DWORD, SetLOD)(THIS_ DWORD LODNew) PURE;
|
||||
@@ -1033,8 +1051,8 @@ DECLARE_INTERFACE_(IWineD3DVolumeTexture,IWineD3DBaseTexture)
|
||||
STDMETHOD_(BOOL, SetDirty)(THIS_ BOOL) PURE;
|
||||
STDMETHOD_(BOOL, GetDirty)(THIS) PURE;
|
||||
STDMETHOD(BindTexture)(THIS) PURE;
|
||||
STDMETHOD(UnBindTexture)(THIS) PURE;
|
||||
STDMETHOD_(UINT, GetTextureDimensions)(THIS) PURE;
|
||||
STDMETHOD_(BOOL, IsCondNP2)(THIS) PURE;
|
||||
STDMETHOD_(void, ApplyStateChanges)(THIS_ const DWORD textureStates[WINED3D_HIGHEST_TEXTURE_STATE + 1], const DWORD samplerStates[WINED3D_HIGHEST_SAMPLER_STATE + 1]) PURE;
|
||||
/*** IWineD3DVolumeTexture methods ***/
|
||||
STDMETHOD_(void, Destroy)(THIS_ D3DCB_DESTROYVOLUMEFN pFn) PURE;
|
||||
@@ -1061,6 +1079,7 @@ DECLARE_INTERFACE_(IWineD3DVolumeTexture,IWineD3DBaseTexture)
|
||||
#define IWineD3DVolumeTexture_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
|
||||
#define IWineD3DVolumeTexture_GetPriority(p) (p)->lpVtbl->GetPriority(p)
|
||||
#define IWineD3DVolumeTexture_PreLoad(p) (p)->lpVtbl->PreLoad(p)
|
||||
#define IWineD3DVolumeTexture_UnLoad(p) (p)->lpVtbl->UnLoad(p)
|
||||
#define IWineD3DVolumeTexture_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
/*** IWineD3DVolumeTexture methods: IWineD3DBaseTexture ***/
|
||||
#define IWineD3DVolumeTexture_SetLOD(p,a) (p)->lpVtbl->SetLOD(p,a)
|
||||
@@ -1072,8 +1091,8 @@ DECLARE_INTERFACE_(IWineD3DVolumeTexture,IWineD3DBaseTexture)
|
||||
#define IWineD3DVolumeTexture_SetDirty(p,a) (p)->lpVtbl->SetDirty(p,a)
|
||||
#define IWineD3DVolumeTexture_GetDirty(p) (p)->lpVtbl->GetDirty(p)
|
||||
#define IWineD3DVolumeTexture_BindTexture(p) (p)->lpVtbl->BindTexture(p)
|
||||
#define IWineD3DVolumeTexture_UnBindTexture(p) (p)->lpVtbl->UnBindTexture(p)
|
||||
#define IWineD3DVolumeTexture_GetTextureDimensions(p) (p)->lpVtbl->GetTextureDimensions(p)
|
||||
#define IWineD3DVolumeTexture_IsCondNP2(p) (p)->lpVtbl->IsCondNP2(p)
|
||||
#define IWineD3DVolumeTexture_ApplyStateChanges(p,a,b) (p)->lpVtbl->ApplyStateChanges(p,a,b)
|
||||
/*** IWineD3DVolumeTexture methods ***/
|
||||
#define IWineD3DVolumeTexture_Destroy(p,a) (p)->lpVtbl->Destroy(p,a)
|
||||
@@ -1104,6 +1123,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(void,UnLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE,GetType)(THIS) PURE;
|
||||
/*** IWineD3DSurface methods ***/
|
||||
STDMETHOD(GetContainer)(THIS_ REFIID riid, void ** ppContainer) PURE;
|
||||
@@ -1144,6 +1164,8 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
|
||||
STDMETHOD(PrivateSetup)(THIS) PURE;
|
||||
STDMETHOD_(void,ModifyLocation)(THIS_ DWORD flag, BOOL persistent);
|
||||
STDMETHOD(LoadLocation)(THIS_ DWORD flag, const RECT *rect);
|
||||
STDMETHOD_(WINED3DSURFTYPE,GetImplType)(THIS);
|
||||
STDMETHOD(DrawOverlay)(THIS);
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
@@ -1162,6 +1184,7 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
|
||||
#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_UnLoad(p) (p)->lpVtbl->UnLoad(p)
|
||||
#define IWineD3DSurface_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
/*** IWineD3DSurface methods ***/
|
||||
#define IWineD3DSurface_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b)
|
||||
@@ -1201,7 +1224,9 @@ DECLARE_INTERFACE_(IWineD3DSurface,IWineD3DResource)
|
||||
#define IWineD3DSurface_SetFormat(p,a) (p)->lpVtbl->SetFormat(p,a)
|
||||
#define IWineD3DSurface_PrivateSetup(p) (p)->lpVtbl->PrivateSetup(p)
|
||||
#define IWineD3DSurface_ModifyLocation(p,a,b) (p)->lpVtbl->ModifyLocation(p,a,b)
|
||||
#define IWineD3DSurface_LoadLocation(p,a,b) (p)->lpVtbl->LoadLocation(p,a,b)
|
||||
#define IWineD3DSurface_LoadLocation(p,a,b) (p)->lpVtbl->LoadLocation(p,a,b)
|
||||
#define IWineD3DSurface_GetImplType(p) (p)->lpVtbl->GetImplType(p)
|
||||
#define IWineD3DSurface_DrawOverlay(p) (p)->lpVtbl->DrawOverlay(p)
|
||||
#endif
|
||||
|
||||
/*****************************************************************************
|
||||
@@ -1224,7 +1249,8 @@ DECLARE_INTERFACE_(IWineD3DVolume,IWineD3DResource)
|
||||
STDMETHOD_(DWORD,SetPriority)(THIS_ DWORD PriorityNew) PURE;
|
||||
STDMETHOD_(DWORD,GetPriority)(THIS) PURE;
|
||||
STDMETHOD_(void,PreLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE, GetType)(THIS) PURE;
|
||||
STDMETHOD_(void,UnLoad)(THIS) PURE;
|
||||
STDMETHOD_(WINED3DRESOURCETYPE, GetType)(THIS) PURE;
|
||||
/*** IWineD3DVolume methods ***/
|
||||
STDMETHOD(GetContainer)(THIS_ REFIID riid, void ** ppContainer) PURE;
|
||||
STDMETHOD(GetDesc)(THIS_ WINED3DVOLUME_DESC * pDesc) PURE;
|
||||
@@ -1252,6 +1278,7 @@ DECLARE_INTERFACE_(IWineD3DVolume,IWineD3DResource)
|
||||
#define IWineD3DVolume_SetPriority(p,a) (p)->lpVtbl->SetPriority(p,a)
|
||||
#define IWineD3DVolume_GetPriority(p) (p)->lpVtbl->GetPriority(p)
|
||||
#define IWineD3DVolume_PreLoad(p) (p)->lpVtbl->PreLoad(p)
|
||||
#define IWineD3DVolume_UnLoad(p) (p)->lpVtbl->UnLoad(p)
|
||||
#define IWineD3DVolume_GetType(p) (p)->lpVtbl->GetType(p)
|
||||
/*** IWineD3DVolume methods ***/
|
||||
#define IWineD3DVolume_GetContainer(p,a,b) (p)->lpVtbl->GetContainer(p,a,b)
|
||||
@@ -1278,8 +1305,8 @@ DECLARE_INTERFACE_(IWineD3DVertexDeclaration,IWineD3DBase)
|
||||
STDMETHOD(GetParent)(THIS_ IUnknown **pParent) PURE;
|
||||
/*** IWineD3DVertexDeclaration methods ***/
|
||||
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice **ppDevice) PURE;
|
||||
STDMETHOD(GetDeclaration)(THIS_ WINED3DVERTEXELEMENT *elements, size_t *elements_count) PURE;
|
||||
STDMETHOD(SetDeclaration)(THIS_ const WINED3DVERTEXELEMENT *elements, size_t element_count) PURE;
|
||||
STDMETHOD(GetDeclaration)(THIS_ WINED3DVERTEXELEMENT *elements, UINT *elements_count) PURE;
|
||||
STDMETHOD(SetDeclaration)(THIS_ const WINED3DVERTEXELEMENT *elements, UINT element_count) PURE;
|
||||
};
|
||||
#undef INTERFACE
|
||||
|
||||
@@ -1386,6 +1413,7 @@ DECLARE_INTERFACE_(IWineD3DSwapChain,IWineD3DBase)
|
||||
STDMETHOD_(void, Destroy)(THIS_ D3DCB_DESTROYSURFACEFN pFn) PURE;
|
||||
STDMETHOD(GetDevice)(THIS_ IWineD3DDevice **ppDevice) PURE;
|
||||
STDMETHOD(Present)(THIS_ CONST RECT *pSourceRect, CONST RECT *pDestRect, HWND hDestWindowOverride, CONST RGNDATA *pDirtyRegion, DWORD dwFlags) PURE;
|
||||
STDMETHOD(SetDestWindowOverride)(THIS_ HWND window);
|
||||
STDMETHOD(GetFrontBufferData)(THIS_ IWineD3DSurface *pDestSurface) PURE;
|
||||
STDMETHOD(GetBackBuffer)(THIS_ UINT iBackBuffer, WINED3DBACKBUFFER_TYPE Type, IWineD3DSurface **ppBackBuffer) PURE;
|
||||
STDMETHOD(GetRasterStatus)(THIS_ WINED3DRASTER_STATUS *pRasterStatus) PURE;
|
||||
@@ -1407,6 +1435,7 @@ DECLARE_INTERFACE_(IWineD3DSwapChain,IWineD3DBase)
|
||||
#define IWineD3DSwapChain_Destroy(p,a) (p)->lpVtbl->Destroy(p,a)
|
||||
#define IWineD3DSwapChain_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a)
|
||||
#define IWineD3DSwapChain_Present(p,a,b,c,d,e) (p)->lpVtbl->Present(p,a,b,c,d,e)
|
||||
#define IWineD3DSwapChain_SetDestWindowOverride(p,a) (p)->lpVtbl->SetDestWindowOverride(p,a)
|
||||
#define IWineD3DSwapChain_GetFrontBufferData(p,a) (p)->lpVtbl->GetFrontBufferData(p,a)
|
||||
#define IWineD3DSwapChain_GetBackBuffer(p,a,b,c) (p)->lpVtbl->GetBackBuffer(p,a,b,c)
|
||||
#define IWineD3DSwapChain_GetRasterStatus(p,a) (p)->lpVtbl->GetRasterStatus(p,a)
|
||||
|
||||
@@ -266,6 +266,7 @@ typedef enum _WINED3DFORMAT {
|
||||
|
||||
WINED3DFMT_UYVY = WINEMAKEFOURCC('U', 'Y', 'V', 'Y'),
|
||||
WINED3DFMT_YUY2 = WINEMAKEFOURCC('Y', 'U', 'Y', '2'),
|
||||
WINED3DFMT_YV12 = WINEMAKEFOURCC('Y', 'V', '1', '2'),
|
||||
WINED3DFMT_DXT1 = WINEMAKEFOURCC('D', 'X', 'T', '1'),
|
||||
WINED3DFMT_DXT2 = WINEMAKEFOURCC('D', 'X', 'T', '2'),
|
||||
WINED3DFMT_DXT3 = WINEMAKEFOURCC('D', 'X', 'T', '3'),
|
||||
@@ -302,6 +303,10 @@ typedef enum _WINED3DFORMAT {
|
||||
|
||||
WINED3DFMT_CxV8U8 = 117,
|
||||
|
||||
/* Vendor specific formats */
|
||||
WINED3DFMT_ATI2N = WINEMAKEFOURCC('A', 'T', 'I', '2'),
|
||||
WINED3DFMT_NVHU = WINEMAKEFOURCC('N', 'V', 'H', 'U'),
|
||||
WINED3DFMT_NVHS = WINEMAKEFOURCC('N', 'V', 'H', 'S'),
|
||||
|
||||
WINED3DFMT_FORCE_DWORD = 0xFFFFFFFF
|
||||
} WINED3DFORMAT;
|
||||
@@ -1095,112 +1100,134 @@ typedef struct _WINED3DINDEXBUFFER_DESC {
|
||||
*/
|
||||
|
||||
typedef struct _WINED3DVSHADERCAPS2_0 {
|
||||
DWORD *Caps;
|
||||
INT *DynamicFlowControlDepth;
|
||||
INT *NumTemps;
|
||||
INT *StaticFlowControlDepth;
|
||||
DWORD Caps;
|
||||
INT DynamicFlowControlDepth;
|
||||
INT NumTemps;
|
||||
INT StaticFlowControlDepth;
|
||||
} WINED3DVSHADERCAPS2_0;
|
||||
|
||||
typedef struct _WINED3DPSHADERCAPS2_0 {
|
||||
DWORD *Caps;
|
||||
INT *DynamicFlowControlDepth;
|
||||
INT *NumTemps;
|
||||
INT *StaticFlowControlDepth;
|
||||
INT *NumInstructionSlots;
|
||||
DWORD Caps;
|
||||
INT DynamicFlowControlDepth;
|
||||
INT NumTemps;
|
||||
INT StaticFlowControlDepth;
|
||||
INT NumInstructionSlots;
|
||||
} WINED3DPSHADERCAPS2_0;
|
||||
|
||||
typedef struct _WINEDDCAPS {
|
||||
DWORD Caps;
|
||||
DWORD Caps2;
|
||||
DWORD CKeyCaps;
|
||||
DWORD FXCaps;
|
||||
DWORD FXAlphaCaps;
|
||||
DWORD PalCaps;
|
||||
DWORD SVCaps;
|
||||
DWORD SVBCaps;
|
||||
DWORD SVBCKeyCaps;
|
||||
DWORD SVBFXCaps;
|
||||
DWORD VSBCaps;
|
||||
DWORD VSBCKeyCaps;
|
||||
DWORD VSBFXCaps;
|
||||
DWORD SSBCaps;
|
||||
DWORD SSBCKeyCaps;
|
||||
DWORD SSBFXCaps;
|
||||
DWORD ddsCaps;
|
||||
DWORD StrideAlign;
|
||||
} WINEDDCAPS;
|
||||
|
||||
typedef struct _WINED3DCAPS {
|
||||
WINED3DDEVTYPE *DeviceType;
|
||||
UINT *AdapterOrdinal;
|
||||
WINED3DDEVTYPE DeviceType;
|
||||
UINT AdapterOrdinal;
|
||||
|
||||
DWORD *Caps;
|
||||
DWORD *Caps2;
|
||||
DWORD *Caps3;
|
||||
DWORD *PresentationIntervals;
|
||||
DWORD Caps;
|
||||
DWORD Caps2;
|
||||
DWORD Caps3;
|
||||
DWORD PresentationIntervals;
|
||||
|
||||
DWORD *CursorCaps;
|
||||
DWORD CursorCaps;
|
||||
|
||||
DWORD *DevCaps;
|
||||
DWORD DevCaps;
|
||||
|
||||
DWORD *PrimitiveMiscCaps;
|
||||
DWORD *RasterCaps;
|
||||
DWORD *ZCmpCaps;
|
||||
DWORD *SrcBlendCaps;
|
||||
DWORD *DestBlendCaps;
|
||||
DWORD *AlphaCmpCaps;
|
||||
DWORD *ShadeCaps;
|
||||
DWORD *TextureCaps;
|
||||
DWORD *TextureFilterCaps;
|
||||
DWORD *CubeTextureFilterCaps;
|
||||
DWORD *VolumeTextureFilterCaps;
|
||||
DWORD *TextureAddressCaps;
|
||||
DWORD *VolumeTextureAddressCaps;
|
||||
DWORD PrimitiveMiscCaps;
|
||||
DWORD RasterCaps;
|
||||
DWORD ZCmpCaps;
|
||||
DWORD SrcBlendCaps;
|
||||
DWORD DestBlendCaps;
|
||||
DWORD AlphaCmpCaps;
|
||||
DWORD ShadeCaps;
|
||||
DWORD TextureCaps;
|
||||
DWORD TextureFilterCaps;
|
||||
DWORD CubeTextureFilterCaps;
|
||||
DWORD VolumeTextureFilterCaps;
|
||||
DWORD TextureAddressCaps;
|
||||
DWORD VolumeTextureAddressCaps;
|
||||
|
||||
DWORD *LineCaps;
|
||||
DWORD LineCaps;
|
||||
|
||||
DWORD *MaxTextureWidth;
|
||||
DWORD *MaxTextureHeight;
|
||||
DWORD *MaxVolumeExtent;
|
||||
DWORD MaxTextureWidth;
|
||||
DWORD MaxTextureHeight;
|
||||
DWORD MaxVolumeExtent;
|
||||
|
||||
DWORD *MaxTextureRepeat;
|
||||
DWORD *MaxTextureAspectRatio;
|
||||
DWORD *MaxAnisotropy;
|
||||
float *MaxVertexW;
|
||||
DWORD MaxTextureRepeat;
|
||||
DWORD MaxTextureAspectRatio;
|
||||
DWORD MaxAnisotropy;
|
||||
float MaxVertexW;
|
||||
|
||||
float *GuardBandLeft;
|
||||
float *GuardBandTop;
|
||||
float *GuardBandRight;
|
||||
float *GuardBandBottom;
|
||||
float GuardBandLeft;
|
||||
float GuardBandTop;
|
||||
float GuardBandRight;
|
||||
float GuardBandBottom;
|
||||
|
||||
float *ExtentsAdjust;
|
||||
DWORD *StencilCaps;
|
||||
float ExtentsAdjust;
|
||||
DWORD StencilCaps;
|
||||
|
||||
DWORD *FVFCaps;
|
||||
DWORD *TextureOpCaps;
|
||||
DWORD *MaxTextureBlendStages;
|
||||
DWORD *MaxSimultaneousTextures;
|
||||
DWORD FVFCaps;
|
||||
DWORD TextureOpCaps;
|
||||
DWORD MaxTextureBlendStages;
|
||||
DWORD MaxSimultaneousTextures;
|
||||
|
||||
DWORD *VertexProcessingCaps;
|
||||
DWORD *MaxActiveLights;
|
||||
DWORD *MaxUserClipPlanes;
|
||||
DWORD *MaxVertexBlendMatrices;
|
||||
DWORD *MaxVertexBlendMatrixIndex;
|
||||
DWORD VertexProcessingCaps;
|
||||
DWORD MaxActiveLights;
|
||||
DWORD MaxUserClipPlanes;
|
||||
DWORD MaxVertexBlendMatrices;
|
||||
DWORD MaxVertexBlendMatrixIndex;
|
||||
|
||||
float *MaxPointSize;
|
||||
float MaxPointSize;
|
||||
|
||||
DWORD *MaxPrimitiveCount;
|
||||
DWORD *MaxVertexIndex;
|
||||
DWORD *MaxStreams;
|
||||
DWORD *MaxStreamStride;
|
||||
DWORD MaxPrimitiveCount;
|
||||
DWORD MaxVertexIndex;
|
||||
DWORD MaxStreams;
|
||||
DWORD MaxStreamStride;
|
||||
|
||||
DWORD *VertexShaderVersion;
|
||||
DWORD *MaxVertexShaderConst;
|
||||
DWORD VertexShaderVersion;
|
||||
DWORD MaxVertexShaderConst;
|
||||
|
||||
DWORD *PixelShaderVersion;
|
||||
float *PixelShader1xMaxValue;
|
||||
DWORD PixelShaderVersion;
|
||||
float PixelShader1xMaxValue;
|
||||
|
||||
/* DX 9 */
|
||||
DWORD *DevCaps2;
|
||||
DWORD DevCaps2;
|
||||
|
||||
float *MaxNpatchTessellationLevel;
|
||||
DWORD *Reserved5; /*undocumented*/
|
||||
float MaxNpatchTessellationLevel;
|
||||
DWORD Reserved5; /*undocumented*/
|
||||
|
||||
UINT *MasterAdapterOrdinal;
|
||||
UINT *AdapterOrdinalInGroup;
|
||||
UINT *NumberOfAdaptersInGroup;
|
||||
DWORD *DeclTypes;
|
||||
DWORD *NumSimultaneousRTs;
|
||||
DWORD *StretchRectFilterCaps;
|
||||
UINT MasterAdapterOrdinal;
|
||||
UINT AdapterOrdinalInGroup;
|
||||
UINT NumberOfAdaptersInGroup;
|
||||
DWORD DeclTypes;
|
||||
DWORD NumSimultaneousRTs;
|
||||
DWORD StretchRectFilterCaps;
|
||||
WINED3DVSHADERCAPS2_0 VS20Caps;
|
||||
WINED3DPSHADERCAPS2_0 PS20Caps;
|
||||
DWORD *VertexTextureFilterCaps;
|
||||
DWORD *MaxVShaderInstructionsExecuted;
|
||||
DWORD *MaxPShaderInstructionsExecuted;
|
||||
DWORD *MaxVertexShader30InstructionSlots;
|
||||
DWORD *MaxPixelShader30InstructionSlots;
|
||||
DWORD *Reserved2;/* Not in the microsoft headers but documented */
|
||||
DWORD *Reserved3;
|
||||
DWORD VertexTextureFilterCaps;
|
||||
DWORD MaxVShaderInstructionsExecuted;
|
||||
DWORD MaxPShaderInstructionsExecuted;
|
||||
DWORD MaxVertexShader30InstructionSlots;
|
||||
DWORD MaxPixelShader30InstructionSlots;
|
||||
DWORD Reserved2;/* Not in the microsoft headers but documented */
|
||||
DWORD Reserved3;
|
||||
|
||||
WINEDDCAPS DirectDrawCaps;
|
||||
} WINED3DCAPS;
|
||||
|
||||
typedef enum _WINED3DSTATEBLOCKTYPE {
|
||||
@@ -1259,11 +1286,11 @@ typedef enum _WINED3DDECLTYPE {
|
||||
#define WINED3DDECL_END() {0xFF,0,WINED3DDECLTYPE_UNUSED,0,0,0,-1}
|
||||
|
||||
typedef struct WineDirect3DStridedData {
|
||||
BYTE *lpData; /* Pointer to start of data */
|
||||
DWORD dwStride; /* Stride between occurances of this data */
|
||||
DWORD dwType; /* Type (as in D3DVSDT_TYPE) */
|
||||
int VBO; /* Vertex buffer object this data is in */
|
||||
UINT streamNo; /* D3D stream number */
|
||||
BYTE *lpData; /* Pointer to start of data */
|
||||
DWORD dwStride; /* Stride between occurrences of this data */
|
||||
DWORD dwType; /* Type (as in D3DVSDT_TYPE) */
|
||||
int VBO; /* Vertex buffer object this data is in */
|
||||
UINT streamNo; /* D3D stream number */
|
||||
} WineDirect3DStridedData;
|
||||
|
||||
typedef struct WineDirect3DVertexStridedData {
|
||||
@@ -1333,7 +1360,7 @@ typedef enum {
|
||||
#define WINED3DUSAGE_AUTOGENMIPMAP 0x00000400L
|
||||
#define WINED3DUSAGE_DMAP 0x00004000L
|
||||
#define WINED3DUSAGE_MASK 0x00004FFFL
|
||||
#define WINED3DUSAGE_OVERLAY 0x00010000L
|
||||
#define WINED3DUSAGE_OVERLAY 0x80000000L
|
||||
|
||||
#define WINED3DUSAGE_QUERY_LEGACYBUMPMAP 0x00008000L
|
||||
#define WINED3DUSAGE_QUERY_FILTER 0x00020000L
|
||||
@@ -1342,13 +1369,12 @@ typedef enum {
|
||||
#define WINED3DUSAGE_QUERY_SRGBWRITE 0x00040000L
|
||||
#define WINED3DUSAGE_QUERY_VERTEXTEXTURE 0x00100000L
|
||||
#define WINED3DUSAGE_QUERY_WRAPANDMIP 0x00200000L
|
||||
#define WINED3DUSAGE_QUERY_MASK 0x002F8000L
|
||||
#define WINED3DUSAGE_QUERY_MASK 0x003F8000L
|
||||
|
||||
typedef enum _WINED3DSURFTYPE {
|
||||
SURFACE_UNKNOWN = 0, /* Default / Unknown surface type */
|
||||
SURFACE_OPENGL, /* OpenGL surface: Renders using libGL, needed for 3D */
|
||||
SURFACE_GDI, /* User surface. No 3D, DirectDraw rendering with GDI */
|
||||
SURFACE_XRENDER /* Future dreams: Use XRENDER / EXA / whatever stuff */
|
||||
} WINED3DSURFTYPE;
|
||||
|
||||
#define WINED3DCAPS2_NO2DDURING3DSCENE 0x00000002L
|
||||
@@ -1778,4 +1804,28 @@ typedef struct _WINEDDOVERLAYFX
|
||||
#define WINEDDFLIP_INTERVAL3 0x03000000
|
||||
#define WINEDDFLIP_INTERVAL4 0x04000000
|
||||
|
||||
#define WINEDDOVER_ALPHADEST 0x00000001
|
||||
#define WINEDDOVER_ALPHADESTCONSTOVERRIDE 0x00000002
|
||||
#define WINEDDOVER_ALPHADESTNEG 0x00000004
|
||||
#define WINEDDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008
|
||||
#define WINEDDOVER_ALPHAEDGEBLEND 0x00000010
|
||||
#define WINEDDOVER_ALPHASRC 0x00000020
|
||||
#define WINEDDOVER_ALPHASRCCONSTOVERRIDE 0x00000040
|
||||
#define WINEDDOVER_ALPHASRCNEG 0x00000080
|
||||
#define WINEDDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100
|
||||
#define WINEDDOVER_HIDE 0x00000200
|
||||
#define WINEDDOVER_KEYDEST 0x00000400
|
||||
#define WINEDDOVER_KEYDESTOVERRIDE 0x00000800
|
||||
#define WINEDDOVER_KEYSRC 0x00001000
|
||||
#define WINEDDOVER_KEYSRCOVERRIDE 0x00002000
|
||||
#define WINEDDOVER_SHOW 0x00004000
|
||||
#define WINEDDOVER_ADDDIRTYRECT 0x00008000
|
||||
#define WINEDDOVER_REFRESHDIRTYRECTS 0x00010000
|
||||
#define WINEDDOVER_REFRESHALL 0x00020000
|
||||
#define WINEDDOVER_DDFX 0x00080000
|
||||
#define WINEDDOVER_AUTOFLIP 0x00100000
|
||||
#define WINEDDOVER_BOB 0x00200000
|
||||
#define WINEDDOVER_OVERRIDEBOBWEAVE 0x00400000
|
||||
#define WINEDDOVER_INTERLEAVED 0x00800000
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user