Commit 5a7ff3b4 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

ddraw: Store surface handles in the global table.

parent b9eb9a74
......@@ -319,14 +319,6 @@ static ULONG WINAPI d3d_device_inner_Release(IUnknown *iface)
break;
}
case DDRAW_HANDLE_SURFACE:
{
struct ddraw_surface *surf = entry->object;
FIXME("Texture handle %#lx (%p) not unset properly.\n", i + 1, surf);
surf->Handle = 0;
break;
}
default:
FIXME("Handle %#lx (%p) has unknown type %#x.\n", i + 1, entry->object, entry->type);
break;
......@@ -2760,7 +2752,7 @@ static HRESULT WINAPI d3d_device3_SetRenderState(IDirect3DDevice3 *iface,
break;
}
surf = ddraw_get_object(&device->handle_table, value - 1, DDRAW_HANDLE_SURFACE);
surf = ddraw_get_object(NULL, value - 1, DDRAW_HANDLE_SURFACE);
if (!surf)
{
WARN("Invalid texture handle.\n");
......
......@@ -347,14 +347,12 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, struct d3d
instr += size;
if (!(dst = ddraw_get_object(&device->handle_table,
ci->hDestTexture - 1, DDRAW_HANDLE_SURFACE)))
if (!(dst = ddraw_get_object(NULL, ci->hDestTexture - 1, DDRAW_HANDLE_SURFACE)))
{
WARN("Invalid destination texture handle %#lx.\n", ci->hDestTexture);
continue;
}
if (!(src = ddraw_get_object(&device->handle_table,
ci->hSrcTexture - 1, DDRAW_HANDLE_SURFACE)))
if (!(src = ddraw_get_object(NULL, ci->hSrcTexture - 1, DDRAW_HANDLE_SURFACE)))
{
WARN("Invalid source texture handle %#lx.\n", ci->hSrcTexture);
continue;
......
......@@ -916,6 +916,10 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
WARN("Material handle %#x (%p) not unset properly.\n", i + 1, entry->object);
break;
case DDRAW_HANDLE_SURFACE:
WARN("Texture handle %#x (%p) not unset properly.\n", i + 1, entry->object);
break;
default:
WARN("Handle %#x (%p) has unknown type %#x.\n", i + 1, entry->object, entry->type);
break;
......
......@@ -5441,7 +5441,6 @@ static HRESULT WINAPI d3d_texture2_GetHandle(IDirect3DTexture2 *iface,
IDirect3DDevice2 *device, D3DTEXTUREHANDLE *handle)
{
struct ddraw_surface *surface = impl_from_IDirect3DTexture2(iface);
struct d3d_device *device_impl = unsafe_impl_from_IDirect3DDevice2(device);
TRACE("iface %p, device %p, handle %p.\n", iface, device, handle);
......@@ -5449,7 +5448,7 @@ static HRESULT WINAPI d3d_texture2_GetHandle(IDirect3DTexture2 *iface,
if (!surface->Handle)
{
DWORD h = ddraw_allocate_handle(&device_impl->handle_table, surface, DDRAW_HANDLE_SURFACE);
DWORD h = ddraw_allocate_handle(NULL, surface, DDRAW_HANDLE_SURFACE);
if (h == DDRAW_INVALID_HANDLE)
{
ERR("Failed to allocate a texture handle.\n");
......@@ -6060,7 +6059,7 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren
/* Having a texture handle set implies that the device still exists. */
if (surface->Handle)
ddraw_free_handle(&surface->ddraw->d3ddevice->handle_table, surface->Handle - 1, DDRAW_HANDLE_SURFACE);
ddraw_free_handle(NULL, surface->Handle - 1, DDRAW_HANDLE_SURFACE);
/* Reduce the ddraw surface count. */
list_remove(&surface->surface_list_entry);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment