ddraw: Just pass NULL as index buffer parent.
Since the parent is just an opaque pointer instead of a COM object now, it can just be NULL instead of needing IParent hacks.
This commit is contained in:
parent
39aa477e4c
commit
b7c427b483
|
@ -285,17 +285,12 @@ IDirect3DDeviceImpl_7_Release(IDirect3DDevice7 *iface)
|
||||||
*/
|
*/
|
||||||
if (ref == 0)
|
if (ref == 0)
|
||||||
{
|
{
|
||||||
IParent *IndexBufferParent;
|
|
||||||
DWORD i;
|
DWORD i;
|
||||||
|
|
||||||
EnterCriticalSection(&ddraw_cs);
|
EnterCriticalSection(&ddraw_cs);
|
||||||
/* Free the index buffer. */
|
/* Free the index buffer. */
|
||||||
IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
|
IWineD3DDevice_SetIndexBuffer(This->wineD3DDevice, NULL, WINED3DFMT_UNKNOWN);
|
||||||
IndexBufferParent = IWineD3DBuffer_GetParent(This->indexbuffer);
|
IWineD3DBuffer_Release(This->indexbuffer);
|
||||||
if (IParent_Release(IndexBufferParent))
|
|
||||||
{
|
|
||||||
ERR(" (%p) Something is still holding the index buffer parent %p\n", This, IndexBufferParent);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* There is no need to unset the vertex buffer here, IWineD3DDevice_Uninit3D will do that when
|
/* There is no need to unset the vertex buffer here, IWineD3DDevice_Uninit3D will do that when
|
||||||
* destroying the primary stateblock. If a vertex buffer is destroyed while it is bound
|
* destroying the primary stateblock. If a vertex buffer is destroyed while it is bound
|
||||||
|
@ -4183,13 +4178,11 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
|
||||||
{
|
{
|
||||||
UINT size = max(desc.Size * 2, IndexCount * sizeof(WORD));
|
UINT size = max(desc.Size * 2, IndexCount * sizeof(WORD));
|
||||||
IWineD3DBuffer *buffer;
|
IWineD3DBuffer *buffer;
|
||||||
IParentImpl *parent;
|
|
||||||
|
|
||||||
TRACE("Growing index buffer to %u bytes\n", size);
|
TRACE("Growing index buffer to %u bytes\n", size);
|
||||||
|
|
||||||
parent = IWineD3DBuffer_GetParent(This->indexbuffer);
|
|
||||||
hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, size, WINED3DUSAGE_DYNAMIC /* Usage */,
|
hr = IWineD3DDevice_CreateIndexBuffer(This->wineD3DDevice, size, WINED3DUSAGE_DYNAMIC /* Usage */,
|
||||||
WINED3DPOOL_DEFAULT, parent, &ddraw_null_wined3d_parent_ops, &buffer);
|
WINED3DPOOL_DEFAULT, NULL, &ddraw_null_wined3d_parent_ops, &buffer);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("(%p) IWineD3DDevice::CreateIndexBuffer failed with hr = %08x\n", This, hr);
|
ERR("(%p) IWineD3DDevice::CreateIndexBuffer failed with hr = %08x\n", This, hr);
|
||||||
|
@ -4199,8 +4192,6 @@ IDirect3DDeviceImpl_7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
|
||||||
|
|
||||||
IWineD3DBuffer_Release(This->indexbuffer);
|
IWineD3DBuffer_Release(This->indexbuffer);
|
||||||
This->indexbuffer = buffer;
|
This->indexbuffer = buffer;
|
||||||
|
|
||||||
parent->child = (IUnknown *)buffer;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* copy the index stream into the index buffer.
|
/* copy the index stream into the index buffer.
|
||||||
|
@ -6781,7 +6772,6 @@ IDirect3DDeviceImpl_UpdateDepthStencil(IDirect3DDeviceImpl *This)
|
||||||
|
|
||||||
HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDirectDrawSurfaceImpl *target)
|
HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDirectDrawSurfaceImpl *target)
|
||||||
{
|
{
|
||||||
IParentImpl *index_buffer_parent;
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
if (ddraw->cooperative_level & DDSCL_FPUPRESERVE)
|
if (ddraw->cooperative_level & DDSCL_FPUPRESERVE)
|
||||||
|
@ -6805,27 +6795,15 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
|
||||||
device->legacyTextureBlending = FALSE;
|
device->legacyTextureBlending = FALSE;
|
||||||
|
|
||||||
/* Create an index buffer, it's needed for indexed drawing */
|
/* Create an index buffer, it's needed for indexed drawing */
|
||||||
index_buffer_parent = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*index_buffer_parent));
|
|
||||||
if (!index_buffer_parent)
|
|
||||||
{
|
|
||||||
ERR("Failed to allocate index buffer parent memory.\n");
|
|
||||||
ddraw_handle_table_destroy(&device->handle_table);
|
|
||||||
return DDERR_OUTOFMEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
ddraw_parent_init(index_buffer_parent);
|
|
||||||
|
|
||||||
hr = IWineD3DDevice_CreateIndexBuffer(ddraw->wineD3DDevice, 0x40000 /* Length. Don't know how long it should be */,
|
hr = IWineD3DDevice_CreateIndexBuffer(ddraw->wineD3DDevice, 0x40000 /* Length. Don't know how long it should be */,
|
||||||
WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, index_buffer_parent,
|
WINED3DUSAGE_DYNAMIC /* Usage */, WINED3DPOOL_DEFAULT, NULL,
|
||||||
&ddraw_null_wined3d_parent_ops, &device->indexbuffer);
|
&ddraw_null_wined3d_parent_ops, &device->indexbuffer);
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("Failed to create an index buffer, hr %#x.\n", hr);
|
ERR("Failed to create an index buffer, hr %#x.\n", hr);
|
||||||
HeapFree(GetProcessHeap(), 0, index_buffer_parent);
|
|
||||||
ddraw_handle_table_destroy(&device->handle_table);
|
ddraw_handle_table_destroy(&device->handle_table);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
index_buffer_parent->child = (IUnknown *)device->indexbuffer;
|
|
||||||
|
|
||||||
/* This is for convenience. */
|
/* This is for convenience. */
|
||||||
device->wineD3DDevice = ddraw->wineD3DDevice;
|
device->wineD3DDevice = ddraw->wineD3DDevice;
|
||||||
|
@ -6836,7 +6814,7 @@ HRESULT d3d_device_init(IDirect3DDeviceImpl *device, IDirectDrawImpl *ddraw, IDi
|
||||||
if (FAILED(hr))
|
if (FAILED(hr))
|
||||||
{
|
{
|
||||||
ERR("Failed to set render target, hr %#x.\n", hr);
|
ERR("Failed to set render target, hr %#x.\n", hr);
|
||||||
IParent_Release((IParent *)index_buffer_parent);
|
IWineD3DBuffer_Release(device->indexbuffer);
|
||||||
ddraw_handle_table_destroy(&device->handle_table);
|
ddraw_handle_table_destroy(&device->handle_table);
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue