mirror of
https://github.com/reactos/wine.git
synced 2025-02-25 23:35:31 +00:00
wined3d: Remove COM from the stateblock.
This commit is contained in:
parent
a538d28f28
commit
4b109ff1f8
@ -1401,7 +1401,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_BeginStateBlock(IDirect3DDevice8 *ifa
|
||||
static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(IDirect3DDevice8 *iface, DWORD *pToken)
|
||||
{
|
||||
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
||||
IWineD3DStateBlock *stateblock;
|
||||
struct wined3d_stateblock *stateblock;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, token %p.\n", iface, pToken);
|
||||
@ -1424,7 +1424,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(IDirect3DDevice8 *iface
|
||||
{
|
||||
ERR("Failed to create a handle\n");
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DStateBlock_Release(stateblock);
|
||||
wined3d_stateblock_decref(stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
return E_FAIL;
|
||||
}
|
||||
@ -1437,8 +1437,8 @@ static HRESULT WINAPI IDirect3DDevice8Impl_EndStateBlock(IDirect3DDevice8 *iface
|
||||
|
||||
static HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(IDirect3DDevice8 *iface, DWORD Token)
|
||||
{
|
||||
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
||||
IWineD3DStateBlock *stateblock;
|
||||
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
||||
struct wined3d_stateblock *stateblock;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, token %#x.\n", iface, Token);
|
||||
@ -1453,7 +1453,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(IDirect3DDevice8 *ifa
|
||||
wined3d_mutex_unlock();
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
hr = IWineD3DStateBlock_Apply(stateblock);
|
||||
hr = wined3d_stateblock_apply(stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
@ -1462,7 +1462,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_ApplyStateBlock(IDirect3DDevice8 *ifa
|
||||
static HRESULT WINAPI IDirect3DDevice8Impl_CaptureStateBlock(IDirect3DDevice8 *iface, DWORD Token)
|
||||
{
|
||||
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
||||
IWineD3DStateBlock *stateblock;
|
||||
struct wined3d_stateblock *stateblock;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, token %#x.\n", iface, Token);
|
||||
@ -1475,7 +1475,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CaptureStateBlock(IDirect3DDevice8 *i
|
||||
wined3d_mutex_unlock();
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
hr = IWineD3DStateBlock_Capture(stateblock);
|
||||
hr = wined3d_stateblock_capture(stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
@ -1484,7 +1484,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CaptureStateBlock(IDirect3DDevice8 *i
|
||||
static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(IDirect3DDevice8 *iface, DWORD Token)
|
||||
{
|
||||
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
||||
IWineD3DStateBlock *stateblock;
|
||||
struct wined3d_stateblock *stateblock;
|
||||
|
||||
TRACE("iface %p, token %#x.\n", iface, Token);
|
||||
|
||||
@ -1498,7 +1498,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_DeleteStateBlock(IDirect3DDevice8 *if
|
||||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if (IWineD3DStateBlock_Release((IUnknown *)stateblock))
|
||||
if (wined3d_stateblock_decref(stateblock))
|
||||
{
|
||||
ERR("Stateblock %p has references left, this shouldn't happen.\n", stateblock);
|
||||
}
|
||||
@ -1511,7 +1511,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *if
|
||||
D3DSTATEBLOCKTYPE Type, DWORD *handle)
|
||||
{
|
||||
IDirect3DDevice8Impl *This = impl_from_IDirect3DDevice8(iface);
|
||||
IWineD3DStateBlock *stateblock;
|
||||
struct wined3d_stateblock *stateblock;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, type %#x, handle %p.\n", iface, Type, handle);
|
||||
@ -1540,7 +1540,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateStateBlock(IDirect3DDevice8 *if
|
||||
{
|
||||
ERR("Failed to allocate a handle.\n");
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DStateBlock_Release(stateblock);
|
||||
wined3d_stateblock_decref(stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
return E_FAIL;
|
||||
}
|
||||
|
@ -411,14 +411,14 @@ typedef struct IDirect3DStateBlock9Impl {
|
||||
LONG ref;
|
||||
|
||||
/* IDirect3DStateBlock9 fields */
|
||||
IWineD3DStateBlock *wineD3DStateBlock;
|
||||
struct wined3d_stateblock *wined3d_stateblock;
|
||||
|
||||
/* Parent reference */
|
||||
LPDIRECT3DDEVICE9EX parentDevice;
|
||||
} IDirect3DStateBlock9Impl;
|
||||
|
||||
HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Impl *device,
|
||||
D3DSTATEBLOCKTYPE type, IWineD3DStateBlock *wined3d_stateblock) DECLSPEC_HIDDEN;
|
||||
D3DSTATEBLOCKTYPE type, struct wined3d_stateblock *wined3d_stateblock) DECLSPEC_HIDDEN;
|
||||
|
||||
/* --------------------------- */
|
||||
/* IDirect3DVertexDeclaration9 */
|
||||
|
@ -1533,7 +1533,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_BeginStateBlock(IDirect3DDevice9Ex *i
|
||||
static HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *iface, IDirect3DStateBlock9 **stateblock)
|
||||
{
|
||||
IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface;
|
||||
IWineD3DStateBlock *wined3d_stateblock;
|
||||
struct wined3d_stateblock *wined3d_stateblock;
|
||||
IDirect3DStateBlock9Impl *object;
|
||||
HRESULT hr;
|
||||
|
||||
@ -1553,7 +1553,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *ifa
|
||||
{
|
||||
ERR("Failed to allocate stateblock memory.\n");
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DStateBlock_Release(wined3d_stateblock);
|
||||
wined3d_stateblock_decref(wined3d_stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
@ -1563,7 +1563,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(IDirect3DDevice9Ex *ifa
|
||||
{
|
||||
WARN("Failed to initialize stateblock, hr %#x.\n", hr);
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DStateBlock_Release(wined3d_stateblock);
|
||||
wined3d_stateblock_decref(wined3d_stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
HeapFree(GetProcessHeap(), 0, object);
|
||||
return hr;
|
||||
|
@ -60,7 +60,7 @@ static ULONG WINAPI IDirect3DStateBlock9Impl_Release(LPDIRECT3DSTATEBLOCK9 iface
|
||||
|
||||
if (ref == 0) {
|
||||
wined3d_mutex_lock();
|
||||
IWineD3DStateBlock_Release(This->wineD3DStateBlock);
|
||||
wined3d_stateblock_decref(This->wined3d_stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
IDirect3DDevice9Ex_Release(This->parentDevice);
|
||||
@ -91,7 +91,7 @@ static HRESULT WINAPI IDirect3DStateBlock9Impl_Capture(LPDIRECT3DSTATEBLOCK9 ifa
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = IWineD3DStateBlock_Capture(This->wineD3DStateBlock);
|
||||
hr = wined3d_stateblock_capture(This->wined3d_stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
@ -104,7 +104,7 @@ static HRESULT WINAPI IDirect3DStateBlock9Impl_Apply(LPDIRECT3DSTATEBLOCK9 iface
|
||||
TRACE("iface %p.\n", iface);
|
||||
|
||||
wined3d_mutex_lock();
|
||||
hr = IWineD3DStateBlock_Apply(This->wineD3DStateBlock);
|
||||
hr = wined3d_stateblock_apply(This->wined3d_stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
@ -124,7 +124,7 @@ static const IDirect3DStateBlock9Vtbl Direct3DStateBlock9_Vtbl =
|
||||
};
|
||||
|
||||
HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Impl *device,
|
||||
D3DSTATEBLOCKTYPE type, IWineD3DStateBlock *wined3d_stateblock)
|
||||
D3DSTATEBLOCKTYPE type, struct wined3d_stateblock *wined3d_stateblock)
|
||||
{
|
||||
HRESULT hr;
|
||||
|
||||
@ -133,13 +133,13 @@ HRESULT stateblock_init(IDirect3DStateBlock9Impl *stateblock, IDirect3DDevice9Im
|
||||
|
||||
if (wined3d_stateblock)
|
||||
{
|
||||
stateblock->wineD3DStateBlock = wined3d_stateblock;
|
||||
stateblock->wined3d_stateblock = wined3d_stateblock;
|
||||
}
|
||||
else
|
||||
{
|
||||
wined3d_mutex_lock();
|
||||
hr = IWineD3DDevice_CreateStateBlock(device->WineD3DDevice,
|
||||
(WINED3DSTATEBLOCKTYPE)type, &stateblock->wineD3DStateBlock);
|
||||
(WINED3DSTATEBLOCKTYPE)type, &stateblock->wined3d_stateblock);
|
||||
wined3d_mutex_unlock();
|
||||
if (FAILED(hr))
|
||||
{
|
||||
|
@ -5484,7 +5484,7 @@ IDirect3DDeviceImpl_7_EndStateBlock(IDirect3DDevice7 *iface,
|
||||
DWORD *BlockHandle)
|
||||
{
|
||||
IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface;
|
||||
IWineD3DStateBlock *wined3d_sb;
|
||||
struct wined3d_stateblock *wined3d_sb;
|
||||
HRESULT hr;
|
||||
DWORD h;
|
||||
|
||||
@ -5511,7 +5511,7 @@ IDirect3DDeviceImpl_7_EndStateBlock(IDirect3DDevice7 *iface,
|
||||
if (h == DDRAW_INVALID_HANDLE)
|
||||
{
|
||||
ERR("Failed to allocate a stateblock handle.\n");
|
||||
IWineD3DStateBlock_Release(wined3d_sb);
|
||||
wined3d_stateblock_decref(wined3d_sb);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
*BlockHandle = 0;
|
||||
return DDERR_OUTOFMEMORY;
|
||||
@ -5617,7 +5617,7 @@ IDirect3DDeviceImpl_7_ApplyStateBlock(IDirect3DDevice7 *iface,
|
||||
DWORD BlockHandle)
|
||||
{
|
||||
IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface;
|
||||
IWineD3DStateBlock *wined3d_sb;
|
||||
struct wined3d_stateblock *wined3d_sb;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, stateblock %#x.\n", iface, BlockHandle);
|
||||
@ -5632,7 +5632,7 @@ IDirect3DDeviceImpl_7_ApplyStateBlock(IDirect3DDevice7 *iface,
|
||||
return D3DERR_INVALIDSTATEBLOCK;
|
||||
}
|
||||
|
||||
hr = IWineD3DStateBlock_Apply(wined3d_sb);
|
||||
hr = wined3d_stateblock_apply(wined3d_sb);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
|
||||
return hr_ddraw_from_wined3d(hr);
|
||||
@ -5680,7 +5680,7 @@ IDirect3DDeviceImpl_7_CaptureStateBlock(IDirect3DDevice7 *iface,
|
||||
DWORD BlockHandle)
|
||||
{
|
||||
IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface;
|
||||
IWineD3DStateBlock *wined3d_sb;
|
||||
struct wined3d_stateblock *wined3d_sb;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, stateblock %#x.\n", iface, BlockHandle);
|
||||
@ -5695,7 +5695,7 @@ IDirect3DDeviceImpl_7_CaptureStateBlock(IDirect3DDevice7 *iface,
|
||||
return D3DERR_INVALIDSTATEBLOCK;
|
||||
}
|
||||
|
||||
hr = IWineD3DStateBlock_Capture(wined3d_sb);
|
||||
hr = wined3d_stateblock_capture(wined3d_sb);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
return hr_ddraw_from_wined3d(hr);
|
||||
}
|
||||
@ -5741,7 +5741,7 @@ IDirect3DDeviceImpl_7_DeleteStateBlock(IDirect3DDevice7 *iface,
|
||||
DWORD BlockHandle)
|
||||
{
|
||||
IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface;
|
||||
IWineD3DStateBlock *wined3d_sb;
|
||||
struct wined3d_stateblock *wined3d_sb;
|
||||
ULONG ref;
|
||||
|
||||
TRACE("iface %p, stateblock %#x.\n", iface, BlockHandle);
|
||||
@ -5756,7 +5756,7 @@ IDirect3DDeviceImpl_7_DeleteStateBlock(IDirect3DDevice7 *iface,
|
||||
return D3DERR_INVALIDSTATEBLOCK;
|
||||
}
|
||||
|
||||
if ((ref = IWineD3DStateBlock_Release(wined3d_sb)))
|
||||
if ((ref = wined3d_stateblock_decref(wined3d_sb)))
|
||||
{
|
||||
ERR("Something is still holding stateblock %p (refcount %u).\n", wined3d_sb, ref);
|
||||
}
|
||||
@ -5808,7 +5808,7 @@ IDirect3DDeviceImpl_7_CreateStateBlock(IDirect3DDevice7 *iface,
|
||||
DWORD *BlockHandle)
|
||||
{
|
||||
IDirect3DDeviceImpl *This = (IDirect3DDeviceImpl *)iface;
|
||||
IWineD3DStateBlock *wined3d_sb;
|
||||
struct wined3d_stateblock *wined3d_sb;
|
||||
HRESULT hr;
|
||||
DWORD h;
|
||||
|
||||
@ -5840,7 +5840,7 @@ IDirect3DDeviceImpl_7_CreateStateBlock(IDirect3DDevice7 *iface,
|
||||
if (h == DDRAW_INVALID_HANDLE)
|
||||
{
|
||||
ERR("Failed to allocate stateblock handle.\n");
|
||||
IWineD3DStateBlock_Release(wined3d_sb);
|
||||
wined3d_stateblock_decref(wined3d_sb);
|
||||
LeaveCriticalSection(&ddraw_cs);
|
||||
return DDERR_OUTOFMEMORY;
|
||||
}
|
||||
|
@ -1894,7 +1894,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface,
|
||||
}
|
||||
TRACE("(%p) : Created stateblock (%p)\n", This, This->stateBlock);
|
||||
This->updateStateBlock = This->stateBlock;
|
||||
IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)This->updateStateBlock);
|
||||
wined3d_stateblock_incref(This->updateStateBlock);
|
||||
|
||||
This->render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
||||
sizeof(*This->render_targets) * gl_info->limits.buffers);
|
||||
@ -2052,8 +2052,9 @@ err_out:
|
||||
if(swapchain) {
|
||||
IWineD3DSwapChain_Release( (IWineD3DSwapChain *) swapchain);
|
||||
}
|
||||
if(This->stateBlock) {
|
||||
IWineD3DStateBlock_Release((IWineD3DStateBlock *) This->stateBlock);
|
||||
if (This->stateBlock)
|
||||
{
|
||||
wined3d_stateblock_decref(This->stateBlock);
|
||||
This->stateBlock = NULL;
|
||||
}
|
||||
if (This->blit_priv) {
|
||||
@ -2175,22 +2176,20 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface,
|
||||
}
|
||||
|
||||
/* Release the update stateblock */
|
||||
if(IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock) > 0){
|
||||
if(This->updateStateBlock != This->stateBlock)
|
||||
FIXME("(%p) Something's still holding the Update stateblock\n",This);
|
||||
if (wined3d_stateblock_decref(This->updateStateBlock))
|
||||
{
|
||||
if (This->updateStateBlock != This->stateBlock)
|
||||
FIXME("Something's still holding the update stateblock.\n");
|
||||
}
|
||||
This->updateStateBlock = NULL;
|
||||
|
||||
{ /* because were not doing proper internal refcounts releasing the primary state block
|
||||
causes recursion with the extra checks in ResourceReleased, to avoid this we have
|
||||
to set this->stateBlock = NULL; first */
|
||||
IWineD3DStateBlock *stateBlock = (IWineD3DStateBlock *)This->stateBlock;
|
||||
{
|
||||
struct wined3d_stateblock *stateblock = This->stateBlock;
|
||||
This->stateBlock = NULL;
|
||||
|
||||
/* Release the stateblock */
|
||||
if(IWineD3DStateBlock_Release(stateBlock) > 0){
|
||||
FIXME("(%p) Something's still holding the Update stateblock\n",This);
|
||||
}
|
||||
if (wined3d_stateblock_decref(stateblock))
|
||||
FIXME("Something's still holding the stateblock.\n");
|
||||
}
|
||||
|
||||
/* Destroy the shader backend. Note that this has to happen after all shaders are destroyed. */
|
||||
@ -4650,7 +4649,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_BeginStateBlock(IWineD3DDevice *iface)
|
||||
hr = IWineD3DDeviceImpl_CreateStateBlock(iface, WINED3DSBT_RECORDED, &stateblock);
|
||||
if (FAILED(hr)) return hr;
|
||||
|
||||
IWineD3DStateBlock_Release((IWineD3DStateBlock*)This->updateStateBlock);
|
||||
wined3d_stateblock_decref(This->updateStateBlock);
|
||||
This->updateStateBlock = (IWineD3DStateBlockImpl *)stateblock;
|
||||
This->isRecordingState = TRUE;
|
||||
|
||||
@ -4674,7 +4673,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IW
|
||||
*ppStateBlock = (IWineD3DStateBlock*) object;
|
||||
This->isRecordingState = FALSE;
|
||||
This->updateStateBlock = This->stateBlock;
|
||||
IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)This->updateStateBlock);
|
||||
wined3d_stateblock_incref(This->updateStateBlock);
|
||||
/* IWineD3DStateBlock_AddRef(*ppStateBlock); don't need to do this, since we should really just release UpdateStateBlock first */
|
||||
TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, *ppStateBlock);
|
||||
return WINED3D_OK;
|
||||
@ -6404,8 +6403,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
|
||||
IWineD3DDevice_SetDepthStencilSurface(iface, NULL);
|
||||
|
||||
TRACE("Resetting stateblock\n");
|
||||
IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->updateStateBlock);
|
||||
IWineD3DStateBlock_Release((IWineD3DStateBlock *)This->stateBlock);
|
||||
wined3d_stateblock_decref(This->updateStateBlock);
|
||||
wined3d_stateblock_decref(This->stateBlock);
|
||||
|
||||
delete_opengl_contexts(This, swapchain);
|
||||
|
||||
@ -6526,7 +6525,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Reset(IWineD3DDevice *iface,
|
||||
if (FAILED(hr)) ERR("Resetting the stateblock failed with error 0x%08x\n", hr);
|
||||
else TRACE("Created stateblock %p\n", This->stateBlock);
|
||||
This->updateStateBlock = This->stateBlock;
|
||||
IWineD3DStateBlock_AddRef((IWineD3DStateBlock *)This->updateStateBlock);
|
||||
wined3d_stateblock_incref(This->updateStateBlock);
|
||||
|
||||
stateblock_init_default_state(This->stateBlock);
|
||||
|
||||
|
@ -457,53 +457,37 @@ static void stateblock_init_lights(IWineD3DStateBlockImpl *stateblock, struct li
|
||||
}
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* IWineD3DStateBlockImpl IUnknown parts follows
|
||||
**********************************************************/
|
||||
static HRESULT WINAPI IWineD3DStateBlockImpl_QueryInterface(IWineD3DStateBlock *iface,REFIID riid,LPVOID *ppobj)
|
||||
ULONG CDECL wined3d_stateblock_incref(struct wined3d_stateblock *stateblock)
|
||||
{
|
||||
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
|
||||
TRACE("(%p)->(%s,%p)\n",This,debugstr_guid(riid),ppobj);
|
||||
if (IsEqualGUID(riid, &IID_IUnknown)
|
||||
|| IsEqualGUID(riid, &IID_IWineD3DStateBlock))
|
||||
ULONG refcount = InterlockedIncrement(&stateblock->ref);
|
||||
|
||||
TRACE("%p increasing refcount to %u.\n", stateblock, refcount);
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
ULONG CDECL wined3d_stateblock_decref(struct wined3d_stateblock *stateblock)
|
||||
{
|
||||
ULONG refcount = InterlockedDecrement(&stateblock->ref);
|
||||
|
||||
TRACE("%p decreasing refcount to %u\n", stateblock, refcount);
|
||||
|
||||
if (!refcount)
|
||||
{
|
||||
IUnknown_AddRef(iface);
|
||||
*ppobj = This;
|
||||
return S_OK;
|
||||
}
|
||||
*ppobj = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IWineD3DStateBlockImpl_AddRef(IWineD3DStateBlock *iface) {
|
||||
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
|
||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p) : AddRef increasing from %d\n", This, refCount - 1);
|
||||
return refCount;
|
||||
}
|
||||
|
||||
static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
||||
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
|
||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p) : Releasing from %d\n", This, refCount + 1);
|
||||
|
||||
if (!refCount) {
|
||||
int counter;
|
||||
|
||||
if (This->state.vertex_declaration)
|
||||
IWineD3DVertexDeclaration_Release((IWineD3DVertexDeclaration *)This->state.vertex_declaration);
|
||||
if (stateblock->state.vertex_declaration)
|
||||
IWineD3DVertexDeclaration_Release((IWineD3DVertexDeclaration *)stateblock->state.vertex_declaration);
|
||||
|
||||
for (counter = 0; counter < MAX_COMBINED_SAMPLERS; counter++)
|
||||
{
|
||||
if (This->state.textures[counter])
|
||||
IWineD3DBaseTexture_Release((IWineD3DBaseTexture *)This->state.textures[counter]);
|
||||
if (stateblock->state.textures[counter])
|
||||
IWineD3DBaseTexture_Release((IWineD3DBaseTexture *)stateblock->state.textures[counter]);
|
||||
}
|
||||
|
||||
for (counter = 0; counter < MAX_STREAMS; ++counter)
|
||||
{
|
||||
struct wined3d_buffer *buffer = This->state.streams[counter].buffer;
|
||||
struct wined3d_buffer *buffer = stateblock->state.streams[counter].buffer;
|
||||
if (buffer)
|
||||
{
|
||||
if (IWineD3DBuffer_Release((IWineD3DBuffer *)buffer))
|
||||
@ -512,13 +496,17 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (This->state.index_buffer) IWineD3DBuffer_Release((IWineD3DBuffer *)This->state.index_buffer);
|
||||
if (This->state.vertex_shader) IWineD3DVertexShader_Release((IWineD3DVertexShader *)This->state.vertex_shader);
|
||||
if (This->state.pixel_shader) IWineD3DPixelShader_Release((IWineD3DPixelShader *)This->state.pixel_shader);
|
||||
if (stateblock->state.index_buffer)
|
||||
IWineD3DBuffer_Release((IWineD3DBuffer *)stateblock->state.index_buffer);
|
||||
if (stateblock->state.vertex_shader)
|
||||
IWineD3DVertexShader_Release((IWineD3DVertexShader *)stateblock->state.vertex_shader);
|
||||
if (stateblock->state.pixel_shader)
|
||||
IWineD3DPixelShader_Release((IWineD3DPixelShader *)stateblock->state.pixel_shader);
|
||||
|
||||
for(counter = 0; counter < LIGHTMAP_SIZE; counter++) {
|
||||
for (counter = 0; counter < LIGHTMAP_SIZE; ++counter)
|
||||
{
|
||||
struct list *e1, *e2;
|
||||
LIST_FOR_EACH_SAFE(e1, e2, &This->state.light_map[counter])
|
||||
LIST_FOR_EACH_SAFE(e1, e2, &stateblock->state.light_map[counter])
|
||||
{
|
||||
struct wined3d_light_info *light = LIST_ENTRY(e1, struct wined3d_light_info, entry);
|
||||
list_remove(&light->entry);
|
||||
@ -526,15 +514,16 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) {
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, This->state.vs_consts_f);
|
||||
HeapFree(GetProcessHeap(), 0, This->changed.vertexShaderConstantsF);
|
||||
HeapFree(GetProcessHeap(), 0, This->state.ps_consts_f);
|
||||
HeapFree(GetProcessHeap(), 0, This->changed.pixelShaderConstantsF);
|
||||
HeapFree(GetProcessHeap(), 0, This->contained_vs_consts_f);
|
||||
HeapFree(GetProcessHeap(), 0, This->contained_ps_consts_f);
|
||||
HeapFree(GetProcessHeap(), 0, This);
|
||||
HeapFree(GetProcessHeap(), 0, stateblock->state.vs_consts_f);
|
||||
HeapFree(GetProcessHeap(), 0, stateblock->changed.vertexShaderConstantsF);
|
||||
HeapFree(GetProcessHeap(), 0, stateblock->state.ps_consts_f);
|
||||
HeapFree(GetProcessHeap(), 0, stateblock->changed.pixelShaderConstantsF);
|
||||
HeapFree(GetProcessHeap(), 0, stateblock->contained_vs_consts_f);
|
||||
HeapFree(GetProcessHeap(), 0, stateblock->contained_ps_consts_f);
|
||||
HeapFree(GetProcessHeap(), 0, stateblock);
|
||||
}
|
||||
return refCount;
|
||||
|
||||
return refcount;
|
||||
}
|
||||
|
||||
static void wined3d_state_record_lights(struct wined3d_state *dst_state, const struct wined3d_state *src_state)
|
||||
@ -594,33 +583,32 @@ static void wined3d_state_record_lights(struct wined3d_state *dst_state, const s
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||
HRESULT CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock)
|
||||
{
|
||||
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
|
||||
const struct wined3d_state *src_state = &This->device->stateBlock->state;
|
||||
const struct wined3d_state *src_state = &stateblock->device->stateBlock->state;
|
||||
unsigned int i;
|
||||
DWORD map;
|
||||
|
||||
TRACE("iface %p.\n", iface);
|
||||
TRACE("stateblock %p.\n", stateblock);
|
||||
|
||||
TRACE("Capturing state %p.\n", src_state);
|
||||
|
||||
if (This->changed.vertexShader && This->state.vertex_shader != src_state->vertex_shader)
|
||||
if (stateblock->changed.vertexShader && stateblock->state.vertex_shader != src_state->vertex_shader)
|
||||
{
|
||||
TRACE("Updating vertex shader from %p to %p\n",
|
||||
This->state.vertex_shader, src_state->vertex_shader);
|
||||
stateblock->state.vertex_shader, src_state->vertex_shader);
|
||||
|
||||
if (src_state->vertex_shader)
|
||||
IWineD3DVertexShader_AddRef((IWineD3DVertexShader *)src_state->vertex_shader);
|
||||
if (This->state.vertex_shader)
|
||||
IWineD3DVertexShader_Release((IWineD3DVertexShader *)This->state.vertex_shader);
|
||||
This->state.vertex_shader = src_state->vertex_shader;
|
||||
if (stateblock->state.vertex_shader)
|
||||
IWineD3DVertexShader_Release((IWineD3DVertexShader *)stateblock->state.vertex_shader);
|
||||
stateblock->state.vertex_shader = src_state->vertex_shader;
|
||||
}
|
||||
|
||||
/* Vertex Shader Float Constants */
|
||||
for (i = 0; i < This->num_contained_vs_consts_f; ++i)
|
||||
/* Vertex shader float constants. */
|
||||
for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i)
|
||||
{
|
||||
unsigned int idx = This->contained_vs_consts_f[i];
|
||||
unsigned int idx = stateblock->contained_vs_consts_f[i];
|
||||
|
||||
TRACE("Setting vs_consts_f[%u] to {%.8e, %.8e, %.8e, %.8e}.\n", idx,
|
||||
src_state->vs_consts_f[idx * 4 + 0],
|
||||
@ -628,16 +616,16 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||
src_state->vs_consts_f[idx * 4 + 2],
|
||||
src_state->vs_consts_f[idx * 4 + 3]);
|
||||
|
||||
This->state.vs_consts_f[idx * 4 + 0] = src_state->vs_consts_f[idx * 4 + 0];
|
||||
This->state.vs_consts_f[idx * 4 + 1] = src_state->vs_consts_f[idx * 4 + 1];
|
||||
This->state.vs_consts_f[idx * 4 + 2] = src_state->vs_consts_f[idx * 4 + 2];
|
||||
This->state.vs_consts_f[idx * 4 + 3] = src_state->vs_consts_f[idx * 4 + 3];
|
||||
stateblock->state.vs_consts_f[idx * 4 + 0] = src_state->vs_consts_f[idx * 4 + 0];
|
||||
stateblock->state.vs_consts_f[idx * 4 + 1] = src_state->vs_consts_f[idx * 4 + 1];
|
||||
stateblock->state.vs_consts_f[idx * 4 + 2] = src_state->vs_consts_f[idx * 4 + 2];
|
||||
stateblock->state.vs_consts_f[idx * 4 + 3] = src_state->vs_consts_f[idx * 4 + 3];
|
||||
}
|
||||
|
||||
/* Vertex Shader Integer Constants */
|
||||
for (i = 0; i < This->num_contained_vs_consts_i; ++i)
|
||||
/* Vertex shader integer constants. */
|
||||
for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i)
|
||||
{
|
||||
unsigned int idx = This->contained_vs_consts_i[i];
|
||||
unsigned int idx = stateblock->contained_vs_consts_i[i];
|
||||
|
||||
TRACE("Setting vs_consts[%u] to {%d, %d, %d, %d}.\n", idx,
|
||||
src_state->vs_consts_i[idx * 4 + 0],
|
||||
@ -645,27 +633,27 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||
src_state->vs_consts_i[idx * 4 + 2],
|
||||
src_state->vs_consts_i[idx * 4 + 3]);
|
||||
|
||||
This->state.vs_consts_i[idx * 4 + 0] = src_state->vs_consts_i[idx * 4 + 0];
|
||||
This->state.vs_consts_i[idx * 4 + 1] = src_state->vs_consts_i[idx * 4 + 1];
|
||||
This->state.vs_consts_i[idx * 4 + 2] = src_state->vs_consts_i[idx * 4 + 2];
|
||||
This->state.vs_consts_i[idx * 4 + 3] = src_state->vs_consts_i[idx * 4 + 3];
|
||||
stateblock->state.vs_consts_i[idx * 4 + 0] = src_state->vs_consts_i[idx * 4 + 0];
|
||||
stateblock->state.vs_consts_i[idx * 4 + 1] = src_state->vs_consts_i[idx * 4 + 1];
|
||||
stateblock->state.vs_consts_i[idx * 4 + 2] = src_state->vs_consts_i[idx * 4 + 2];
|
||||
stateblock->state.vs_consts_i[idx * 4 + 3] = src_state->vs_consts_i[idx * 4 + 3];
|
||||
}
|
||||
|
||||
/* Vertex Shader Boolean Constants */
|
||||
for (i = 0; i < This->num_contained_vs_consts_b; ++i)
|
||||
/* Vertex shader boolean constants. */
|
||||
for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i)
|
||||
{
|
||||
unsigned int idx = This->contained_vs_consts_b[i];
|
||||
unsigned int idx = stateblock->contained_vs_consts_b[i];
|
||||
|
||||
TRACE("Setting vs_consts_b[%u] to %s.\n",
|
||||
idx, src_state->vs_consts_b[idx] ? "TRUE" : "FALSE");
|
||||
|
||||
This->state.vs_consts_b[idx] = src_state->vs_consts_b[idx];
|
||||
stateblock->state.vs_consts_b[idx] = src_state->vs_consts_b[idx];
|
||||
}
|
||||
|
||||
/* Pixel Shader Float Constants */
|
||||
for (i = 0; i < This->num_contained_ps_consts_f; ++i)
|
||||
/* Pixel shader float constants. */
|
||||
for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i)
|
||||
{
|
||||
unsigned int idx = This->contained_ps_consts_f[i];
|
||||
unsigned int idx = stateblock->contained_ps_consts_f[i];
|
||||
|
||||
TRACE("Setting ps_consts_f[%u] to {%.8e, %.8e, %.8e, %.8e}.\n", idx,
|
||||
src_state->ps_consts_f[idx * 4 + 0],
|
||||
@ -673,210 +661,212 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface)
|
||||
src_state->ps_consts_f[idx * 4 + 2],
|
||||
src_state->ps_consts_f[idx * 4 + 3]);
|
||||
|
||||
This->state.ps_consts_f[idx * 4 + 0] = src_state->ps_consts_f[idx * 4 + 0];
|
||||
This->state.ps_consts_f[idx * 4 + 1] = src_state->ps_consts_f[idx * 4 + 1];
|
||||
This->state.ps_consts_f[idx * 4 + 2] = src_state->ps_consts_f[idx * 4 + 2];
|
||||
This->state.ps_consts_f[idx * 4 + 3] = src_state->ps_consts_f[idx * 4 + 3];
|
||||
stateblock->state.ps_consts_f[idx * 4 + 0] = src_state->ps_consts_f[idx * 4 + 0];
|
||||
stateblock->state.ps_consts_f[idx * 4 + 1] = src_state->ps_consts_f[idx * 4 + 1];
|
||||
stateblock->state.ps_consts_f[idx * 4 + 2] = src_state->ps_consts_f[idx * 4 + 2];
|
||||
stateblock->state.ps_consts_f[idx * 4 + 3] = src_state->ps_consts_f[idx * 4 + 3];
|
||||
}
|
||||
|
||||
/* Pixel Shader Integer Constants */
|
||||
for (i = 0; i < This->num_contained_ps_consts_i; ++i)
|
||||
/* Pixel shader integer constants. */
|
||||
for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i)
|
||||
{
|
||||
unsigned int idx = This->contained_ps_consts_i[i];
|
||||
unsigned int idx = stateblock->contained_ps_consts_i[i];
|
||||
TRACE("Setting ps_consts_i[%u] to {%d, %d, %d, %d}.\n", idx,
|
||||
src_state->ps_consts_i[idx * 4 + 0],
|
||||
src_state->ps_consts_i[idx * 4 + 1],
|
||||
src_state->ps_consts_i[idx * 4 + 2],
|
||||
src_state->ps_consts_i[idx * 4 + 3]);
|
||||
|
||||
This->state.ps_consts_i[idx * 4 + 0] = src_state->ps_consts_i[idx * 4 + 0];
|
||||
This->state.ps_consts_i[idx * 4 + 1] = src_state->ps_consts_i[idx * 4 + 1];
|
||||
This->state.ps_consts_i[idx * 4 + 2] = src_state->ps_consts_i[idx * 4 + 2];
|
||||
This->state.ps_consts_i[idx * 4 + 3] = src_state->ps_consts_i[idx * 4 + 3];
|
||||
stateblock->state.ps_consts_i[idx * 4 + 0] = src_state->ps_consts_i[idx * 4 + 0];
|
||||
stateblock->state.ps_consts_i[idx * 4 + 1] = src_state->ps_consts_i[idx * 4 + 1];
|
||||
stateblock->state.ps_consts_i[idx * 4 + 2] = src_state->ps_consts_i[idx * 4 + 2];
|
||||
stateblock->state.ps_consts_i[idx * 4 + 3] = src_state->ps_consts_i[idx * 4 + 3];
|
||||
}
|
||||
|
||||
/* Pixel Shader Boolean Constants */
|
||||
for (i = 0; i < This->num_contained_ps_consts_b; ++i)
|
||||
/* Pixel shader boolean constants. */
|
||||
for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i)
|
||||
{
|
||||
unsigned int idx = This->contained_ps_consts_b[i];
|
||||
unsigned int idx = stateblock->contained_ps_consts_b[i];
|
||||
TRACE("Setting ps_consts_b[%u] to %s.\n",
|
||||
idx, src_state->ps_consts_b[idx] ? "TRUE" : "FALSE");
|
||||
|
||||
This->state.ps_consts_b[idx] = src_state->ps_consts_b[idx];
|
||||
stateblock->state.ps_consts_b[idx] = src_state->ps_consts_b[idx];
|
||||
}
|
||||
|
||||
/* Others + Render & Texture */
|
||||
for (i = 0; i < This->num_contained_transform_states; ++i)
|
||||
for (i = 0; i < stateblock->num_contained_transform_states; ++i)
|
||||
{
|
||||
WINED3DTRANSFORMSTATETYPE transform = This->contained_transform_states[i];
|
||||
WINED3DTRANSFORMSTATETYPE transform = stateblock->contained_transform_states[i];
|
||||
|
||||
TRACE("Updating transform %#x.\n", transform);
|
||||
|
||||
This->state.transforms[transform] = src_state->transforms[transform];
|
||||
stateblock->state.transforms[transform] = src_state->transforms[transform];
|
||||
}
|
||||
|
||||
if (This->changed.primitive_type)
|
||||
This->state.gl_primitive_type = src_state->gl_primitive_type;
|
||||
if (stateblock->changed.primitive_type)
|
||||
stateblock->state.gl_primitive_type = src_state->gl_primitive_type;
|
||||
|
||||
if (This->changed.indices
|
||||
&& ((This->state.index_buffer != src_state->index_buffer)
|
||||
|| (This->state.base_vertex_index != src_state->base_vertex_index)
|
||||
|| (This->state.index_format != src_state->index_format)))
|
||||
if (stateblock->changed.indices
|
||||
&& ((stateblock->state.index_buffer != src_state->index_buffer)
|
||||
|| (stateblock->state.base_vertex_index != src_state->base_vertex_index)
|
||||
|| (stateblock->state.index_format != src_state->index_format)))
|
||||
{
|
||||
TRACE("Updating index buffer to %p, base vertex index to %d.\n",
|
||||
src_state->index_buffer, src_state->base_vertex_index);
|
||||
|
||||
if (src_state->index_buffer)
|
||||
IWineD3DBuffer_AddRef((IWineD3DBuffer *)src_state->index_buffer);
|
||||
if (This->state.index_buffer)
|
||||
IWineD3DBuffer_Release((IWineD3DBuffer *)This->state.index_buffer);
|
||||
This->state.index_buffer = src_state->index_buffer;
|
||||
This->state.base_vertex_index = src_state->base_vertex_index;
|
||||
This->state.index_format = src_state->index_format;
|
||||
if (stateblock->state.index_buffer)
|
||||
IWineD3DBuffer_Release((IWineD3DBuffer *)stateblock->state.index_buffer);
|
||||
stateblock->state.index_buffer = src_state->index_buffer;
|
||||
stateblock->state.base_vertex_index = src_state->base_vertex_index;
|
||||
stateblock->state.index_format = src_state->index_format;
|
||||
}
|
||||
|
||||
if (This->changed.vertexDecl && This->state.vertex_declaration != src_state->vertex_declaration)
|
||||
if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration != src_state->vertex_declaration)
|
||||
{
|
||||
TRACE("Updating vertex declaration from %p to %p.\n",
|
||||
This->state.vertex_declaration, src_state->vertex_declaration);
|
||||
stateblock->state.vertex_declaration, src_state->vertex_declaration);
|
||||
|
||||
if (src_state->vertex_declaration)
|
||||
IWineD3DVertexDeclaration_AddRef((IWineD3DVertexDeclaration *)src_state->vertex_declaration);
|
||||
if (This->state.vertex_declaration)
|
||||
IWineD3DVertexDeclaration_Release((IWineD3DVertexDeclaration *)This->state.vertex_declaration);
|
||||
This->state.vertex_declaration = src_state->vertex_declaration;
|
||||
if (stateblock->state.vertex_declaration)
|
||||
IWineD3DVertexDeclaration_Release((IWineD3DVertexDeclaration *)stateblock->state.vertex_declaration);
|
||||
stateblock->state.vertex_declaration = src_state->vertex_declaration;
|
||||
}
|
||||
|
||||
if (This->changed.material && memcmp(&src_state->material, &This->state.material, sizeof(This->state.material)))
|
||||
if (stateblock->changed.material
|
||||
&& memcmp(&src_state->material, &stateblock->state.material, sizeof(stateblock->state.material)))
|
||||
{
|
||||
TRACE("Updating material.\n");
|
||||
|
||||
This->state.material = src_state->material;
|
||||
stateblock->state.material = src_state->material;
|
||||
}
|
||||
|
||||
if (This->changed.viewport && memcmp(&src_state->viewport, &This->state.viewport, sizeof(This->state.viewport)))
|
||||
if (stateblock->changed.viewport
|
||||
&& memcmp(&src_state->viewport, &stateblock->state.viewport, sizeof(stateblock->state.viewport)))
|
||||
{
|
||||
TRACE("Updating viewport.\n");
|
||||
|
||||
This->state.viewport = src_state->viewport;
|
||||
stateblock->state.viewport = src_state->viewport;
|
||||
}
|
||||
|
||||
if (This->changed.scissorRect && memcmp(&src_state->scissor_rect,
|
||||
&This->state.scissor_rect, sizeof(This->state.scissor_rect)))
|
||||
if (stateblock->changed.scissorRect && memcmp(&src_state->scissor_rect,
|
||||
&stateblock->state.scissor_rect, sizeof(stateblock->state.scissor_rect)))
|
||||
{
|
||||
TRACE("Updating scissor rect.\n");
|
||||
|
||||
This->state.scissor_rect = src_state->scissor_rect;
|
||||
stateblock->state.scissor_rect = src_state->scissor_rect;
|
||||
}
|
||||
|
||||
map = This->changed.streamSource;
|
||||
map = stateblock->changed.streamSource;
|
||||
for (i = 0; map; map >>= 1, ++i)
|
||||
{
|
||||
if (!(map & 1)) continue;
|
||||
|
||||
if (This->state.streams[i].stride != src_state->streams[i].stride
|
||||
|| This->state.streams[i].buffer != src_state->streams[i].buffer)
|
||||
if (stateblock->state.streams[i].stride != src_state->streams[i].stride
|
||||
|| stateblock->state.streams[i].buffer != src_state->streams[i].buffer)
|
||||
{
|
||||
TRACE("Updating stream source %u to %p, stride to %u.\n",
|
||||
i, src_state->streams[i].buffer,
|
||||
src_state->streams[i].stride);
|
||||
|
||||
This->state.streams[i].stride = src_state->streams[i].stride;
|
||||
stateblock->state.streams[i].stride = src_state->streams[i].stride;
|
||||
if (src_state->streams[i].buffer)
|
||||
IWineD3DBuffer_AddRef((IWineD3DBuffer *)src_state->streams[i].buffer);
|
||||
if (This->state.streams[i].buffer)
|
||||
IWineD3DBuffer_Release((IWineD3DBuffer *)This->state.streams[i].buffer);
|
||||
This->state.streams[i].buffer = src_state->streams[i].buffer;
|
||||
if (stateblock->state.streams[i].buffer)
|
||||
IWineD3DBuffer_Release((IWineD3DBuffer *)stateblock->state.streams[i].buffer);
|
||||
stateblock->state.streams[i].buffer = src_state->streams[i].buffer;
|
||||
}
|
||||
}
|
||||
|
||||
map = This->changed.streamFreq;
|
||||
map = stateblock->changed.streamFreq;
|
||||
for (i = 0; map; map >>= 1, ++i)
|
||||
{
|
||||
if (!(map & 1)) continue;
|
||||
|
||||
if (This->state.streams[i].frequency != src_state->streams[i].frequency
|
||||
|| This->state.streams[i].flags != src_state->streams[i].flags)
|
||||
if (stateblock->state.streams[i].frequency != src_state->streams[i].frequency
|
||||
|| stateblock->state.streams[i].flags != src_state->streams[i].flags)
|
||||
{
|
||||
TRACE("Updating stream frequency %u to %u flags to %#x.\n",
|
||||
i, src_state->streams[i].frequency, src_state->streams[i].flags);
|
||||
|
||||
This->state.streams[i].frequency = src_state->streams[i].frequency;
|
||||
This->state.streams[i].flags = src_state->streams[i].flags;
|
||||
stateblock->state.streams[i].frequency = src_state->streams[i].frequency;
|
||||
stateblock->state.streams[i].flags = src_state->streams[i].flags;
|
||||
}
|
||||
}
|
||||
|
||||
map = This->changed.clipplane;
|
||||
map = stateblock->changed.clipplane;
|
||||
for (i = 0; map; map >>= 1, ++i)
|
||||
{
|
||||
if (!(map & 1)) continue;
|
||||
|
||||
if (memcmp(src_state->clip_planes[i], This->state.clip_planes[i], sizeof(*This->state.clip_planes)))
|
||||
if (memcmp(src_state->clip_planes[i], stateblock->state.clip_planes[i], sizeof(*stateblock->state.clip_planes)))
|
||||
{
|
||||
TRACE("Updating clipplane %u.\n", i);
|
||||
memcpy(This->state.clip_planes[i], src_state->clip_planes[i], sizeof(*This->state.clip_planes));
|
||||
memcpy(stateblock->state.clip_planes[i], src_state->clip_planes[i], sizeof(*stateblock->state.clip_planes));
|
||||
}
|
||||
}
|
||||
|
||||
/* Render */
|
||||
for (i = 0; i < This->num_contained_render_states; ++i)
|
||||
for (i = 0; i < stateblock->num_contained_render_states; ++i)
|
||||
{
|
||||
WINED3DRENDERSTATETYPE rs = This->contained_render_states[i];
|
||||
WINED3DRENDERSTATETYPE rs = stateblock->contained_render_states[i];
|
||||
|
||||
TRACE("Updating render state %#x to %u.\n", rs, src_state->render_states[rs]);
|
||||
|
||||
This->state.render_states[rs] = src_state->render_states[rs];
|
||||
stateblock->state.render_states[rs] = src_state->render_states[rs];
|
||||
}
|
||||
|
||||
/* Texture states */
|
||||
for (i = 0; i < This->num_contained_tss_states; ++i)
|
||||
for (i = 0; i < stateblock->num_contained_tss_states; ++i)
|
||||
{
|
||||
DWORD stage = This->contained_tss_states[i].stage;
|
||||
DWORD state = This->contained_tss_states[i].state;
|
||||
DWORD stage = stateblock->contained_tss_states[i].stage;
|
||||
DWORD state = stateblock->contained_tss_states[i].state;
|
||||
|
||||
TRACE("Updating texturestage state %u, %u to %#x (was %#x).\n", stage, state,
|
||||
src_state->texture_states[stage][state], This->state.texture_states[stage][state]);
|
||||
src_state->texture_states[stage][state], stateblock->state.texture_states[stage][state]);
|
||||
|
||||
This->state.texture_states[stage][state] = src_state->texture_states[stage][state];
|
||||
stateblock->state.texture_states[stage][state] = src_state->texture_states[stage][state];
|
||||
}
|
||||
|
||||
/* Samplers */
|
||||
map = This->changed.textures;
|
||||
map = stateblock->changed.textures;
|
||||
for (i = 0; map; map >>= 1, ++i)
|
||||
{
|
||||
if (!(map & 1)) continue;
|
||||
|
||||
TRACE("Updating texture %u to %p (was %p).\n",
|
||||
i, src_state->textures[i], This->state.textures[i]);
|
||||
i, src_state->textures[i], stateblock->state.textures[i]);
|
||||
|
||||
if (src_state->textures[i])
|
||||
IWineD3DBaseTexture_AddRef((IWineD3DBaseTexture *)src_state->textures[i]);
|
||||
if (This->state.textures[i])
|
||||
IWineD3DBaseTexture_Release((IWineD3DBaseTexture *)This->state.textures[i]);
|
||||
This->state.textures[i] = src_state->textures[i];
|
||||
if (stateblock->state.textures[i])
|
||||
IWineD3DBaseTexture_Release((IWineD3DBaseTexture *)stateblock->state.textures[i]);
|
||||
stateblock->state.textures[i] = src_state->textures[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < This->num_contained_sampler_states; ++i)
|
||||
for (i = 0; i < stateblock->num_contained_sampler_states; ++i)
|
||||
{
|
||||
DWORD stage = This->contained_sampler_states[i].stage;
|
||||
DWORD state = This->contained_sampler_states[i].state;
|
||||
DWORD stage = stateblock->contained_sampler_states[i].stage;
|
||||
DWORD state = stateblock->contained_sampler_states[i].state;
|
||||
|
||||
TRACE("Updating sampler state %u, %u to %#x (was %#x).\n", stage, state,
|
||||
src_state->sampler_states[stage][state], This->state.sampler_states[stage][state]);
|
||||
src_state->sampler_states[stage][state], stateblock->state.sampler_states[stage][state]);
|
||||
|
||||
This->state.sampler_states[stage][state] = src_state->sampler_states[stage][state];
|
||||
stateblock->state.sampler_states[stage][state] = src_state->sampler_states[stage][state];
|
||||
}
|
||||
|
||||
if (This->changed.pixelShader && This->state.pixel_shader != src_state->pixel_shader)
|
||||
if (stateblock->changed.pixelShader && stateblock->state.pixel_shader != src_state->pixel_shader)
|
||||
{
|
||||
if (src_state->pixel_shader)
|
||||
IWineD3DPixelShader_AddRef((IWineD3DPixelShader *)src_state->pixel_shader);
|
||||
if (This->state.pixel_shader)
|
||||
IWineD3DPixelShader_Release((IWineD3DPixelShader *)This->state.pixel_shader);
|
||||
This->state.pixel_shader = src_state->pixel_shader;
|
||||
if (stateblock->state.pixel_shader)
|
||||
IWineD3DPixelShader_Release((IWineD3DPixelShader *)stateblock->state.pixel_shader);
|
||||
stateblock->state.pixel_shader = src_state->pixel_shader;
|
||||
}
|
||||
|
||||
wined3d_state_record_lights(&This->state, src_state);
|
||||
wined3d_state_record_lights(&stateblock->state, src_state);
|
||||
|
||||
TRACE("Captue done.\n");
|
||||
|
||||
@ -901,142 +891,142 @@ static void apply_lights(IWineD3DDevice *device, const struct wined3d_state *sta
|
||||
}
|
||||
}
|
||||
|
||||
static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
|
||||
HRESULT CDECL wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock)
|
||||
{
|
||||
IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface;
|
||||
IWineD3DDevice *device = (IWineD3DDevice *)This->device;
|
||||
IWineD3DDevice *device = (IWineD3DDevice *)stateblock->device;
|
||||
unsigned int i;
|
||||
DWORD map;
|
||||
|
||||
TRACE("(%p) : Applying state block %p ------------------v\n", This, device);
|
||||
TRACE("Applying stateblock %p to device %p.\n", stateblock, device);
|
||||
TRACE("Blocktype: %#x.\n", stateblock->blockType);
|
||||
|
||||
TRACE("Blocktype: %d\n", This->blockType);
|
||||
if (stateblock->changed.vertexShader)
|
||||
IWineD3DDevice_SetVertexShader(device, (IWineD3DVertexShader *)stateblock->state.vertex_shader);
|
||||
|
||||
if (This->changed.vertexShader)
|
||||
IWineD3DDevice_SetVertexShader(device, (IWineD3DVertexShader *)This->state.vertex_shader);
|
||||
|
||||
/* Vertex Shader Constants */
|
||||
for (i = 0; i < This->num_contained_vs_consts_f; ++i)
|
||||
/* Vertex Shader Constants. */
|
||||
for (i = 0; i < stateblock->num_contained_vs_consts_f; ++i)
|
||||
{
|
||||
IWineD3DDevice_SetVertexShaderConstantF(device, This->contained_vs_consts_f[i],
|
||||
This->state.vs_consts_f + This->contained_vs_consts_f[i] * 4, 1);
|
||||
IWineD3DDevice_SetVertexShaderConstantF(device, stateblock->contained_vs_consts_f[i],
|
||||
stateblock->state.vs_consts_f + stateblock->contained_vs_consts_f[i] * 4, 1);
|
||||
}
|
||||
for (i = 0; i < This->num_contained_vs_consts_i; ++i)
|
||||
for (i = 0; i < stateblock->num_contained_vs_consts_i; ++i)
|
||||
{
|
||||
IWineD3DDevice_SetVertexShaderConstantI(device, This->contained_vs_consts_i[i],
|
||||
This->state.vs_consts_i + This->contained_vs_consts_i[i] * 4, 1);
|
||||
IWineD3DDevice_SetVertexShaderConstantI(device, stateblock->contained_vs_consts_i[i],
|
||||
stateblock->state.vs_consts_i + stateblock->contained_vs_consts_i[i] * 4, 1);
|
||||
}
|
||||
for (i = 0; i < This->num_contained_vs_consts_b; ++i)
|
||||
for (i = 0; i < stateblock->num_contained_vs_consts_b; ++i)
|
||||
{
|
||||
IWineD3DDevice_SetVertexShaderConstantB(device, This->contained_vs_consts_b[i],
|
||||
This->state.vs_consts_b + This->contained_vs_consts_b[i], 1);
|
||||
IWineD3DDevice_SetVertexShaderConstantB(device, stateblock->contained_vs_consts_b[i],
|
||||
stateblock->state.vs_consts_b + stateblock->contained_vs_consts_b[i], 1);
|
||||
}
|
||||
|
||||
apply_lights(device, &This->state);
|
||||
apply_lights(device, &stateblock->state);
|
||||
|
||||
if (This->changed.pixelShader)
|
||||
IWineD3DDevice_SetPixelShader(device, (IWineD3DPixelShader *)This->state.pixel_shader);
|
||||
if (stateblock->changed.pixelShader)
|
||||
IWineD3DDevice_SetPixelShader(device, (IWineD3DPixelShader *)stateblock->state.pixel_shader);
|
||||
|
||||
/* Pixel Shader Constants */
|
||||
for (i = 0; i < This->num_contained_ps_consts_f; ++i)
|
||||
/* Pixel Shader Constants. */
|
||||
for (i = 0; i < stateblock->num_contained_ps_consts_f; ++i)
|
||||
{
|
||||
IWineD3DDevice_SetPixelShaderConstantF(device, This->contained_ps_consts_f[i],
|
||||
This->state.ps_consts_f + This->contained_ps_consts_f[i] * 4, 1);
|
||||
IWineD3DDevice_SetPixelShaderConstantF(device, stateblock->contained_ps_consts_f[i],
|
||||
stateblock->state.ps_consts_f + stateblock->contained_ps_consts_f[i] * 4, 1);
|
||||
}
|
||||
for (i = 0; i < This->num_contained_ps_consts_i; ++i)
|
||||
for (i = 0; i < stateblock->num_contained_ps_consts_i; ++i)
|
||||
{
|
||||
IWineD3DDevice_SetPixelShaderConstantI(device, This->contained_ps_consts_i[i],
|
||||
This->state.ps_consts_i + This->contained_ps_consts_i[i] * 4, 1);
|
||||
IWineD3DDevice_SetPixelShaderConstantI(device, stateblock->contained_ps_consts_i[i],
|
||||
stateblock->state.ps_consts_i + stateblock->contained_ps_consts_i[i] * 4, 1);
|
||||
}
|
||||
for (i = 0; i < This->num_contained_ps_consts_b; ++i)
|
||||
for (i = 0; i < stateblock->num_contained_ps_consts_b; ++i)
|
||||
{
|
||||
IWineD3DDevice_SetPixelShaderConstantB(device, This->contained_ps_consts_b[i],
|
||||
This->state.ps_consts_b + This->contained_ps_consts_b[i], 1);
|
||||
IWineD3DDevice_SetPixelShaderConstantB(device, stateblock->contained_ps_consts_b[i],
|
||||
stateblock->state.ps_consts_b + stateblock->contained_ps_consts_b[i], 1);
|
||||
}
|
||||
|
||||
/* Render */
|
||||
for (i = 0; i < This->num_contained_render_states; ++i)
|
||||
/* Render states. */
|
||||
for (i = 0; i < stateblock->num_contained_render_states; ++i)
|
||||
{
|
||||
IWineD3DDevice_SetRenderState(device, This->contained_render_states[i],
|
||||
This->state.render_states[This->contained_render_states[i]]);
|
||||
IWineD3DDevice_SetRenderState(device, stateblock->contained_render_states[i],
|
||||
stateblock->state.render_states[stateblock->contained_render_states[i]]);
|
||||
}
|
||||
|
||||
/* Texture states */
|
||||
for (i = 0; i < This->num_contained_tss_states; ++i)
|
||||
/* Texture states. */
|
||||
for (i = 0; i < stateblock->num_contained_tss_states; ++i)
|
||||
{
|
||||
DWORD stage = This->contained_tss_states[i].stage;
|
||||
DWORD state = This->contained_tss_states[i].state;
|
||||
DWORD stage = stateblock->contained_tss_states[i].stage;
|
||||
DWORD state = stateblock->contained_tss_states[i].state;
|
||||
|
||||
IWineD3DDevice_SetTextureStageState(device, stage, state, This->state.texture_states[stage][state]);
|
||||
IWineD3DDevice_SetTextureStageState(device, stage, state, stateblock->state.texture_states[stage][state]);
|
||||
}
|
||||
|
||||
/* Sampler states */
|
||||
for (i = 0; i < This->num_contained_sampler_states; ++i)
|
||||
/* Sampler states. */
|
||||
for (i = 0; i < stateblock->num_contained_sampler_states; ++i)
|
||||
{
|
||||
DWORD stage = This->contained_sampler_states[i].stage;
|
||||
DWORD state = This->contained_sampler_states[i].state;
|
||||
DWORD value = This->state.sampler_states[stage][state];
|
||||
DWORD stage = stateblock->contained_sampler_states[i].stage;
|
||||
DWORD state = stateblock->contained_sampler_states[i].state;
|
||||
DWORD value = stateblock->state.sampler_states[stage][state];
|
||||
|
||||
if (stage >= MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS;
|
||||
IWineD3DDevice_SetSamplerState(device, stage, state, value);
|
||||
}
|
||||
|
||||
for (i = 0; i < This->num_contained_transform_states; ++i)
|
||||
/* Transform states. */
|
||||
for (i = 0; i < stateblock->num_contained_transform_states; ++i)
|
||||
{
|
||||
IWineD3DDevice_SetTransform(device, This->contained_transform_states[i],
|
||||
&This->state.transforms[This->contained_transform_states[i]]);
|
||||
IWineD3DDevice_SetTransform(device, stateblock->contained_transform_states[i],
|
||||
&stateblock->state.transforms[stateblock->contained_transform_states[i]]);
|
||||
}
|
||||
|
||||
if (This->changed.primitive_type)
|
||||
if (stateblock->changed.primitive_type)
|
||||
{
|
||||
This->device->updateStateBlock->changed.primitive_type = TRUE;
|
||||
This->device->updateStateBlock->state.gl_primitive_type = This->state.gl_primitive_type;
|
||||
stateblock->device->updateStateBlock->changed.primitive_type = TRUE;
|
||||
stateblock->device->updateStateBlock->state.gl_primitive_type = stateblock->state.gl_primitive_type;
|
||||
}
|
||||
|
||||
if (This->changed.indices)
|
||||
if (stateblock->changed.indices)
|
||||
{
|
||||
IWineD3DDevice_SetIndexBuffer(device, (IWineD3DBuffer *)This->state.index_buffer, This->state.index_format);
|
||||
IWineD3DDevice_SetBaseVertexIndex(device, This->state.base_vertex_index);
|
||||
IWineD3DDevice_SetIndexBuffer(device, (IWineD3DBuffer *)stateblock->state.index_buffer,
|
||||
stateblock->state.index_format);
|
||||
IWineD3DDevice_SetBaseVertexIndex(device, stateblock->state.base_vertex_index);
|
||||
}
|
||||
|
||||
if (This->changed.vertexDecl && This->state.vertex_declaration)
|
||||
if (stateblock->changed.vertexDecl && stateblock->state.vertex_declaration)
|
||||
{
|
||||
IWineD3DDevice_SetVertexDeclaration(device, (IWineD3DVertexDeclaration *)This->state.vertex_declaration);
|
||||
IWineD3DDevice_SetVertexDeclaration(device, (IWineD3DVertexDeclaration *)stateblock->state.vertex_declaration);
|
||||
}
|
||||
|
||||
if (This->changed.material)
|
||||
if (stateblock->changed.material)
|
||||
{
|
||||
IWineD3DDevice_SetMaterial(device, &This->state.material);
|
||||
IWineD3DDevice_SetMaterial(device, &stateblock->state.material);
|
||||
}
|
||||
|
||||
if (This->changed.viewport)
|
||||
if (stateblock->changed.viewport)
|
||||
{
|
||||
IWineD3DDevice_SetViewport(device, &This->state.viewport);
|
||||
IWineD3DDevice_SetViewport(device, &stateblock->state.viewport);
|
||||
}
|
||||
|
||||
if (This->changed.scissorRect)
|
||||
if (stateblock->changed.scissorRect)
|
||||
{
|
||||
IWineD3DDevice_SetScissorRect(device, &This->state.scissor_rect);
|
||||
IWineD3DDevice_SetScissorRect(device, &stateblock->state.scissor_rect);
|
||||
}
|
||||
|
||||
map = This->changed.streamSource;
|
||||
map = stateblock->changed.streamSource;
|
||||
for (i = 0; map; map >>= 1, ++i)
|
||||
{
|
||||
if (map & 1)
|
||||
IWineD3DDevice_SetStreamSource(device, i,
|
||||
(IWineD3DBuffer *)This->state.streams[i].buffer,
|
||||
0, This->state.streams[i].stride);
|
||||
(IWineD3DBuffer *)stateblock->state.streams[i].buffer,
|
||||
0, stateblock->state.streams[i].stride);
|
||||
}
|
||||
|
||||
map = This->changed.streamFreq;
|
||||
map = stateblock->changed.streamFreq;
|
||||
for (i = 0; map; map >>= 1, ++i)
|
||||
{
|
||||
if (map & 1)
|
||||
IWineD3DDevice_SetStreamSourceFreq(device, i,
|
||||
This->state.streams[i].frequency | This->state.streams[i].flags);
|
||||
stateblock->state.streams[i].frequency | stateblock->state.streams[i].flags);
|
||||
}
|
||||
|
||||
map = This->changed.textures;
|
||||
map = stateblock->changed.textures;
|
||||
for (i = 0; map; map >>= 1, ++i)
|
||||
{
|
||||
DWORD stage;
|
||||
@ -1044,33 +1034,34 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Apply(IWineD3DStateBlock *iface)
|
||||
if (!(map & 1)) continue;
|
||||
|
||||
stage = i < MAX_FRAGMENT_SAMPLERS ? i : WINED3DVERTEXTEXTURESAMPLER0 + i - MAX_FRAGMENT_SAMPLERS;
|
||||
IWineD3DDevice_SetTexture(device, stage, (IWineD3DBaseTexture *)This->state.textures[i]);
|
||||
IWineD3DDevice_SetTexture(device, stage, (IWineD3DBaseTexture *)stateblock->state.textures[i]);
|
||||
}
|
||||
|
||||
map = This->changed.clipplane;
|
||||
map = stateblock->changed.clipplane;
|
||||
for (i = 0; map; map >>= 1, ++i)
|
||||
{
|
||||
float clip[4];
|
||||
|
||||
if (!(map & 1)) continue;
|
||||
|
||||
clip[0] = This->state.clip_planes[i][0];
|
||||
clip[1] = This->state.clip_planes[i][1];
|
||||
clip[2] = This->state.clip_planes[i][2];
|
||||
clip[3] = This->state.clip_planes[i][3];
|
||||
clip[0] = stateblock->state.clip_planes[i][0];
|
||||
clip[1] = stateblock->state.clip_planes[i][1];
|
||||
clip[2] = stateblock->state.clip_planes[i][2];
|
||||
clip[3] = stateblock->state.clip_planes[i][3];
|
||||
IWineD3DDevice_SetClipPlane(device, i, clip);
|
||||
}
|
||||
|
||||
This->device->stateBlock->state.lowest_disabled_stage = MAX_TEXTURES - 1;
|
||||
stateblock->device->stateBlock->state.lowest_disabled_stage = MAX_TEXTURES - 1;
|
||||
for (i = 0; i < MAX_TEXTURES - 1; ++i)
|
||||
{
|
||||
if (This->device->stateBlock->state.texture_states[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE)
|
||||
if (stateblock->device->stateBlock->state.texture_states[i][WINED3DTSS_COLOROP] == WINED3DTOP_DISABLE)
|
||||
{
|
||||
This->device->stateBlock->state.lowest_disabled_stage = i;
|
||||
stateblock->device->stateBlock->state.lowest_disabled_stage = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
TRACE("(%p) : Applied state block %p ------------------^\n", This, device);
|
||||
|
||||
TRACE("Applied stateblock %p.\n", stateblock);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
@ -1326,27 +1317,11 @@ void stateblock_init_default_state(IWineD3DStateBlockImpl *stateblock)
|
||||
TRACE("Done.\n");
|
||||
}
|
||||
|
||||
/**********************************************************
|
||||
* IWineD3DStateBlock VTbl follows
|
||||
**********************************************************/
|
||||
|
||||
static const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl =
|
||||
{
|
||||
/* IUnknown */
|
||||
IWineD3DStateBlockImpl_QueryInterface,
|
||||
IWineD3DStateBlockImpl_AddRef,
|
||||
IWineD3DStateBlockImpl_Release,
|
||||
/* IWineD3DStateBlock */
|
||||
IWineD3DStateBlockImpl_Capture,
|
||||
IWineD3DStateBlockImpl_Apply,
|
||||
};
|
||||
|
||||
HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *device, WINED3DSTATEBLOCKTYPE type)
|
||||
{
|
||||
unsigned int i;
|
||||
HRESULT hr;
|
||||
|
||||
stateblock->lpVtbl = &IWineD3DStateBlock_Vtbl;
|
||||
stateblock->ref = 1;
|
||||
stateblock->device = device;
|
||||
stateblock->blockType = type;
|
||||
@ -1389,7 +1364,7 @@ HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *
|
||||
}
|
||||
|
||||
stateblock_init_contained_states(stateblock);
|
||||
IWineD3DStateBlockImpl_Capture((IWineD3DStateBlock *)stateblock);
|
||||
wined3d_stateblock_capture(stateblock);
|
||||
|
||||
return WINED3D_OK;
|
||||
}
|
||||
|
@ -2,3 +2,8 @@
|
||||
@ stdcall WineDirect3DCreateClipper()
|
||||
@ stdcall wined3d_mutex_lock()
|
||||
@ stdcall wined3d_mutex_unlock()
|
||||
|
||||
@ cdecl wined3d_stateblock_apply(ptr)
|
||||
@ cdecl wined3d_stateblock_capture(ptr)
|
||||
@ cdecl wined3d_stateblock_decref(ptr)
|
||||
@ cdecl wined3d_stateblock_incref(ptr)
|
||||
|
@ -52,7 +52,8 @@
|
||||
#define WINED3D_QUIRK_NV_CLIP_BROKEN 0x00000010
|
||||
#define WINED3D_QUIRK_FBO_TEX_UPDATE 0x00000020
|
||||
|
||||
typedef struct IWineD3DStateBlockImpl IWineD3DStateBlockImpl;
|
||||
typedef struct wined3d_stateblock IWineD3DStateBlockImpl;
|
||||
typedef struct wined3d_stateblock IWineD3DStateBlock;
|
||||
typedef struct IWineD3DSurfaceImpl IWineD3DSurfaceImpl;
|
||||
typedef struct IWineD3DPaletteImpl IWineD3DPaletteImpl;
|
||||
typedef struct IWineD3DDeviceImpl IWineD3DDeviceImpl;
|
||||
@ -2432,10 +2433,9 @@ struct wined3d_state
|
||||
DWORD render_states[WINEHIGHEST_RENDER_STATE + 1];
|
||||
};
|
||||
|
||||
struct IWineD3DStateBlockImpl
|
||||
struct wined3d_stateblock
|
||||
{
|
||||
/* IUnknown fields */
|
||||
const IWineD3DStateBlockVtbl *lpVtbl;
|
||||
LONG ref; /* Note: Ref counting not required */
|
||||
|
||||
/* IWineD3DStateBlock information */
|
||||
|
@ -2110,6 +2110,7 @@ interface IWineD3DSurface;
|
||||
interface IWineD3DVolume;
|
||||
interface IWineD3DSwapChain;
|
||||
interface IWineD3DDevice;
|
||||
struct wined3d_stateblock;
|
||||
|
||||
[
|
||||
object,
|
||||
@ -2611,19 +2612,6 @@ interface IWineD3DVertexDeclaration : IWineD3DBase
|
||||
{
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
uuid(83b073ce-6f30-11d9-c687-00046142c14f)
|
||||
]
|
||||
interface IWineD3DStateBlock : IUnknown
|
||||
{
|
||||
HRESULT Capture(
|
||||
);
|
||||
HRESULT Apply(
|
||||
);
|
||||
}
|
||||
|
||||
[
|
||||
object,
|
||||
local,
|
||||
@ -2790,7 +2778,7 @@ interface IWineD3DDevice : IUnknown
|
||||
);
|
||||
HRESULT CreateStateBlock(
|
||||
[in] WINED3DSTATEBLOCKTYPE type,
|
||||
[out] IWineD3DStateBlock **stateblock
|
||||
[out] struct wined3d_stateblock **stateblock
|
||||
);
|
||||
HRESULT CreateSurface(
|
||||
[in] UINT width,
|
||||
@ -3245,7 +3233,7 @@ interface IWineD3DDevice : IUnknown
|
||||
HRESULT BeginStateBlock(
|
||||
);
|
||||
HRESULT EndStateBlock(
|
||||
[out] IWineD3DStateBlock **stateblock
|
||||
[out] struct wined3d_stateblock **stateblock
|
||||
);
|
||||
HRESULT BeginScene(
|
||||
);
|
||||
@ -3365,3 +3353,8 @@ IWineD3D * __stdcall WineDirect3DCreate(UINT dxVersion, void *parent);
|
||||
IWineD3DClipper * __stdcall WineDirect3DCreateClipper(void);
|
||||
void __stdcall wined3d_mutex_lock(void);
|
||||
void __stdcall wined3d_mutex_unlock(void);
|
||||
|
||||
HRESULT __cdecl wined3d_stateblock_apply(const struct wined3d_stateblock *stateblock);
|
||||
HRESULT __cdecl wined3d_stateblock_capture(struct wined3d_stateblock *stateblock);
|
||||
ULONG __cdecl wined3d_stateblock_decref(struct wined3d_stateblock *stateblock);
|
||||
ULONG __cdecl wined3d_stateblock_incref(struct wined3d_stateblock *stateblock);
|
||||
|
Loading…
x
Reference in New Issue
Block a user