[D3D8][D3D9][DDRAW][DXGI][QEDIT][WINED3D]
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 19 Apr 2014 17:30:00 +0000 (17:30 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 19 Apr 2014 17:30:00 +0000 (17:30 +0000)
* Sync with Wine 1.7.17.
CORE-8080

svn path=/trunk/; revision=62811

56 files changed:
reactos/dll/directx/wine/d3d8/buffer.c
reactos/dll/directx/wine/d3d8/d3d8_main.c
reactos/dll/directx/wine/d3d8/d3d8_private.h
reactos/dll/directx/wine/d3d8/device.c
reactos/dll/directx/wine/d3d8/directx.c
reactos/dll/directx/wine/d3d8/surface.c
reactos/dll/directx/wine/d3d8/texture.c
reactos/dll/directx/wine/d3d8/volume.c
reactos/dll/directx/wine/d3d9/buffer.c
reactos/dll/directx/wine/d3d9/d3d9_main.c
reactos/dll/directx/wine/d3d9/d3d9_private.h
reactos/dll/directx/wine/d3d9/device.c
reactos/dll/directx/wine/d3d9/directx.c
reactos/dll/directx/wine/d3d9/query.c
reactos/dll/directx/wine/d3d9/surface.c
reactos/dll/directx/wine/d3d9/texture.c
reactos/dll/directx/wine/d3d9/volume.c
reactos/dll/directx/wine/ddraw/ddraw.c
reactos/dll/directx/wine/ddraw/ddraw.rc
reactos/dll/directx/wine/ddraw/ddraw_classes.rgs [moved from reactos/dll/directx/wine/ddraw/ddraw.rgs with 100% similarity]
reactos/dll/directx/wine/ddraw/ddraw_private.h
reactos/dll/directx/wine/ddraw/device.c
reactos/dll/directx/wine/ddraw/main.c
reactos/dll/directx/wine/ddraw/surface.c
reactos/dll/directx/wine/ddraw/utils.c
reactos/dll/directx/wine/ddraw/vertexbuffer.c
reactos/dll/directx/wine/ddraw/viewport.c
reactos/dll/directx/wine/dxgi/adapter.c
reactos/dll/directx/wine/dxgi/dxgi.spec
reactos/dll/directx/wine/dxgi/dxgi_main.c
reactos/dll/directx/wine/dxgi/dxgi_private.h
reactos/dll/directx/wine/dxgi/factory.c
reactos/dll/directx/wine/dxgi/guid.c
reactos/dll/directx/wine/dxgi/output.c
reactos/dll/directx/wine/dxgi/surface.c
reactos/dll/directx/wine/qedit/CMakeLists.txt
reactos/dll/directx/wine/qedit/qedit_classes.idl
reactos/dll/directx/wine/qedit/samplegrabber.c
reactos/dll/directx/wine/wined3d/arb_program_shader.c
reactos/dll/directx/wine/wined3d/buffer.c
reactos/dll/directx/wine/wined3d/context.c
reactos/dll/directx/wine/wined3d/cs.c
reactos/dll/directx/wine/wined3d/device.c
reactos/dll/directx/wine/wined3d/directx.c
reactos/dll/directx/wine/wined3d/query.c
reactos/dll/directx/wine/wined3d/resource.c
reactos/dll/directx/wine/wined3d/surface.c
reactos/dll/directx/wine/wined3d/utils.c
reactos/dll/directx/wine/wined3d/wined3d.spec
reactos/dll/directx/wine/wined3d/wined3d_gl.h
reactos/dll/directx/wine/wined3d/wined3d_main.c
reactos/dll/directx/wine/wined3d/wined3d_private.h
reactos/include/reactos/wine/wgl_driver.h
reactos/include/reactos/wine/wined3d.h
reactos/include/reactos/wine/winedxgi.idl
reactos/media/doc/README.WINE

index 93a3cf0..e230519 100644 (file)
@@ -45,7 +45,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_QueryInterface(IDirect3DVertexBuffer8 *i
 static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface)
 {
     struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
-    ULONG refcount = InterlockedIncrement(&buffer->refcount);
+    ULONG refcount = InterlockedIncrement(&buffer->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, refcount);
 
@@ -63,7 +63,7 @@ static ULONG WINAPI d3d8_vertexbuffer_AddRef(IDirect3DVertexBuffer8 *iface)
 static ULONG WINAPI d3d8_vertexbuffer_Release(IDirect3DVertexBuffer8 *iface)
 {
     struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
-    ULONG refcount = InterlockedDecrement(&buffer->refcount);
+    ULONG refcount = InterlockedDecrement(&buffer->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, refcount);
 
@@ -101,52 +101,28 @@ static HRESULT WINAPI d3d8_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer8 *i
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_set_private_data(&buffer->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d8_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer8 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_get_private_data(&buffer->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d8_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer8 *iface, REFGUID guid)
 {
     struct d3d8_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_free_private_data(&buffer->resource, guid);
 }
 
 static DWORD WINAPI d3d8_vertexbuffer_SetPriority(IDirect3DVertexBuffer8 *iface, DWORD priority)
@@ -271,7 +247,9 @@ static const IDirect3DVertexBuffer8Vtbl Direct3DVertexBuffer8_Vtbl =
 
 static void STDMETHODCALLTYPE d3d8_vertexbuffer_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d8_vertexbuffer *buffer = parent;
+    d3d8_resource_cleanup(&buffer->resource);
+    HeapFree(GetProcessHeap(), 0, buffer);
 }
 
 static const struct wined3d_parent_ops d3d8_vertexbuffer_wined3d_parent_ops =
@@ -285,7 +263,7 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *
     HRESULT hr;
 
     buffer->IDirect3DVertexBuffer8_iface.lpVtbl = &Direct3DVertexBuffer8_Vtbl;
-    buffer->refcount = 1;
+    d3d8_resource_init(&buffer->resource);
     buffer->fvf = fvf;
 
     wined3d_mutex_lock();
@@ -340,7 +318,7 @@ static HRESULT WINAPI d3d8_indexbuffer_QueryInterface(IDirect3DIndexBuffer8 *ifa
 static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface)
 {
     struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
-    ULONG refcount = InterlockedIncrement(&buffer->refcount);
+    ULONG refcount = InterlockedIncrement(&buffer->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, refcount);
 
@@ -358,7 +336,7 @@ static ULONG WINAPI d3d8_indexbuffer_AddRef(IDirect3DIndexBuffer8 *iface)
 static ULONG WINAPI d3d8_indexbuffer_Release(IDirect3DIndexBuffer8 *iface)
 {
     struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
-    ULONG refcount = InterlockedDecrement(&buffer->refcount);
+    ULONG refcount = InterlockedDecrement(&buffer->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, refcount);
 
@@ -396,52 +374,28 @@ static HRESULT WINAPI d3d8_indexbuffer_SetPrivateData(IDirect3DIndexBuffer8 *ifa
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_set_private_data(&buffer->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d8_indexbuffer_GetPrivateData(IDirect3DIndexBuffer8 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_get_private_data(&buffer->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d8_indexbuffer_FreePrivateData(IDirect3DIndexBuffer8 *iface, REFGUID guid)
 {
     struct d3d8_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_free_private_data(&buffer->resource, guid);
 }
 
 static DWORD WINAPI d3d8_indexbuffer_SetPriority(IDirect3DIndexBuffer8 *iface, DWORD priority)
@@ -565,7 +519,9 @@ static const IDirect3DIndexBuffer8Vtbl d3d8_indexbuffer_vtbl =
 
 static void STDMETHODCALLTYPE d3d8_indexbuffer_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d8_indexbuffer *buffer = parent;
+    d3d8_resource_cleanup(&buffer->resource);
+    HeapFree(GetProcessHeap(), 0, buffer);
 }
 
 static const struct wined3d_parent_ops d3d8_indexbuffer_wined3d_parent_ops =
@@ -579,7 +535,7 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *de
     HRESULT hr;
 
     buffer->IDirect3DIndexBuffer8_iface.lpVtbl = &d3d8_indexbuffer_vtbl;
-    buffer->refcount = 1;
+    d3d8_resource_init(&buffer->resource);
     buffer->format = wined3dformat_from_d3dformat(format);
 
     wined3d_mutex_lock();
index 51e5991..a4dc5e6 100644 (file)
@@ -132,3 +132,81 @@ HRESULT WINAPI ValidatePixelShader(DWORD* pixelshader, DWORD* reserved1, BOOL bo
         }
   return ret;
 }
+
+void d3d8_resource_cleanup(struct d3d8_resource *resource)
+{
+    wined3d_private_store_cleanup(&resource->private_store);
+}
+
+HRESULT d3d8_resource_free_private_data(struct d3d8_resource *resource, const GUID *guid)
+{
+    struct wined3d_private_data *entry;
+
+    wined3d_mutex_lock();
+    entry = wined3d_private_store_get_private_data(&resource->private_store, guid);
+    if (!entry)
+    {
+        wined3d_mutex_unlock();
+        return D3DERR_NOTFOUND;
+    }
+
+    wined3d_private_store_free_private_data(&resource->private_store, entry);
+    wined3d_mutex_unlock();
+
+    return D3D_OK;
+}
+
+HRESULT d3d8_resource_get_private_data(struct d3d8_resource *resource, const GUID *guid,
+        void *data, DWORD *data_size)
+{
+    const struct wined3d_private_data *stored_data;
+    DWORD size_in;
+    HRESULT hr;
+
+    wined3d_mutex_lock();
+    stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid);
+    if (!stored_data)
+    {
+        hr = D3DERR_NOTFOUND;
+        goto done;
+    }
+
+    size_in = *data_size;
+    *data_size = stored_data->size;
+    if (!data)
+    {
+        hr = D3D_OK;
+        goto done;
+    }
+    if (size_in < stored_data->size)
+    {
+        hr = D3DERR_MOREDATA;
+        goto done;
+    }
+
+    if (stored_data->flags & WINED3DSPD_IUNKNOWN)
+        IUnknown_AddRef(stored_data->content.object);
+    memcpy(data, stored_data->content.data, stored_data->size);
+    hr = D3D_OK;
+
+done:
+    wined3d_mutex_unlock();
+    return hr;
+}
+
+void d3d8_resource_init(struct d3d8_resource *resource)
+{
+    resource->refcount = 1;
+    wined3d_private_store_init(&resource->private_store);
+}
+
+HRESULT d3d8_resource_set_private_data(struct d3d8_resource *resource, const GUID *guid,
+        const void *data, DWORD data_size, DWORD flags)
+{
+    HRESULT hr;
+
+    wined3d_mutex_lock();
+    hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags);
+    wined3d_mutex_unlock();
+    return hr;
+}
index 9f4c224..a60652d 100644 (file)
@@ -183,10 +183,24 @@ struct d3d8_device
 HRESULT device_init(struct d3d8_device *device, struct d3d8 *parent, struct wined3d *wined3d, UINT adapter,
         D3DDEVTYPE device_type, HWND focus_window, DWORD flags, D3DPRESENT_PARAMETERS *parameters) DECLSPEC_HIDDEN;
 
+struct d3d8_resource
+{
+    LONG refcount;
+    struct wined3d_private_store private_store;
+};
+
+void d3d8_resource_cleanup(struct d3d8_resource *resource) DECLSPEC_HIDDEN;
+HRESULT d3d8_resource_free_private_data(struct d3d8_resource *resource, const GUID *guid) DECLSPEC_HIDDEN;
+HRESULT d3d8_resource_get_private_data(struct d3d8_resource *resource, const GUID *guid,
+        void *data, DWORD *data_size) DECLSPEC_HIDDEN;
+void d3d8_resource_init(struct d3d8_resource *resource) DECLSPEC_HIDDEN;
+HRESULT d3d8_resource_set_private_data(struct d3d8_resource *resource, const GUID *guid,
+        const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN;
+
 struct d3d8_volume
 {
     IDirect3DVolume8 IDirect3DVolume8_iface;
-    LONG refcount;
+    struct d3d8_resource resource;
     struct wined3d_volume *wined3d_volume;
     IUnknown *container;
     IUnknown *forwardReference;
@@ -209,7 +223,7 @@ HRESULT d3d8_swapchain_create(struct d3d8_device *device, struct wined3d_swapcha
 struct d3d8_surface
 {
     IDirect3DSurface8 IDirect3DSurface8_iface;
-    LONG refcount;
+    struct d3d8_resource resource;
     struct wined3d_surface *wined3d_surface;
     IDirect3DDevice8 *parent_device;
 
@@ -227,7 +241,7 @@ struct d3d8_surface *unsafe_impl_from_IDirect3DSurface8(IDirect3DSurface8 *iface
 struct d3d8_vertexbuffer
 {
     IDirect3DVertexBuffer8 IDirect3DVertexBuffer8_iface;
-    LONG refcount;
+    struct d3d8_resource resource;
     struct wined3d_buffer *wined3d_buffer;
     IDirect3DDevice8 *parent_device;
     DWORD fvf;
@@ -240,7 +254,7 @@ struct d3d8_vertexbuffer *unsafe_impl_from_IDirect3DVertexBuffer8(IDirect3DVerte
 struct d3d8_indexbuffer
 {
     IDirect3DIndexBuffer8 IDirect3DIndexBuffer8_iface;
-    LONG refcount;
+    struct d3d8_resource resource;
     struct wined3d_buffer *wined3d_buffer;
     IDirect3DDevice8 *parent_device;
     enum wined3d_format_id format;
@@ -253,7 +267,7 @@ struct d3d8_indexbuffer *unsafe_impl_from_IDirect3DIndexBuffer8(IDirect3DIndexBu
 struct d3d8_texture
 {
     IDirect3DBaseTexture8 IDirect3DBaseTexture8_iface;
-    LONG refcount;
+    struct d3d8_resource resource;
     struct wined3d_texture *wined3d_texture;
     IDirect3DDevice8 *parent_device;
 };
index 3737a74..c519f80 100644 (file)
@@ -585,7 +585,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
         }
 
         surface = wined3d_resource_get_parent(resource);
-        if (surface->refcount)
+        if (surface->resource.refcount)
         {
             WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource);
             return D3DERR_DEVICELOST;
index 954bf49..10b4ea0 100644 (file)
@@ -395,7 +395,7 @@ BOOL d3d8_init(struct d3d8 *d3d8)
     d3d8->refcount = 1;
 
     wined3d_mutex_lock();
-    d3d8->wined3d = wined3d_create(8, flags);
+    d3d8->wined3d = wined3d_create(flags);
     wined3d_mutex_unlock();
     if (!d3d8->wined3d)
         return FALSE;
index 10abee8..116b5b9 100644 (file)
@@ -59,7 +59,7 @@ static ULONG WINAPI d3d8_surface_AddRef(IDirect3DSurface8 *iface)
     else
     {
         /* No container, handle our own refcounting */
-        ULONG ref = InterlockedIncrement(&surface->refcount);
+        ULONG ref = InterlockedIncrement(&surface->resource.refcount);
 
         TRACE("%p increasing refcount to %u.\n", iface, ref);
 
@@ -91,7 +91,7 @@ static ULONG WINAPI d3d8_surface_Release(IDirect3DSurface8 *iface)
     else
     {
         /* No container, handle our own refcounting */
-        ULONG ref = InterlockedDecrement(&surface->refcount);
+        ULONG ref = InterlockedDecrement(&surface->resource.refcount);
 
         TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
@@ -147,52 +147,28 @@ static HRESULT WINAPI d3d8_surface_SetPrivateData(IDirect3DSurface8 *iface, REFG
         const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_surface_get_resource(surface->wined3d_surface);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_set_private_data(&surface->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d8_surface_GetPrivateData(IDirect3DSurface8 *iface, REFGUID guid,
         void *data, DWORD *data_size)
 {
     struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_surface_get_resource(surface->wined3d_surface);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_get_private_data(&surface->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d8_surface_FreePrivateData(IDirect3DSurface8 *iface, REFGUID guid)
 {
     struct d3d8_surface *surface = impl_from_IDirect3DSurface8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_surface_get_resource(surface->wined3d_surface);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_free_private_data(&surface->resource, guid);
 }
 
 static HRESULT WINAPI d3d8_surface_GetContainer(IDirect3DSurface8 *iface, REFIID riid, void **container)
@@ -322,7 +298,9 @@ static const IDirect3DSurface8Vtbl d3d8_surface_vtbl =
 
 static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d8_surface *surface = parent;
+    d3d8_resource_cleanup(&surface->resource);
+    HeapFree(GetProcessHeap(), 0, surface);
 }
 
 static const struct wined3d_parent_ops d3d8_surface_wined3d_parent_ops =
@@ -334,7 +312,7 @@ void surface_init(struct d3d8_surface *surface, struct wined3d_surface *wined3d_
         struct d3d8_device *device, const struct wined3d_parent_ops **parent_ops)
 {
     surface->IDirect3DSurface8_iface.lpVtbl = &d3d8_surface_vtbl;
-    surface->refcount = 1;
+    d3d8_resource_init(&surface->resource);
     wined3d_surface_incref(wined3d_surface);
     surface->wined3d_surface = wined3d_surface;
     surface->parent_device = &device->IDirect3DDevice8_iface;
index 9ea83e7..7aadf5b 100644 (file)
@@ -56,7 +56,7 @@ static HRESULT WINAPI d3d8_texture_2d_QueryInterface(IDirect3DTexture8 *iface, R
 static ULONG WINAPI d3d8_texture_2d_AddRef(IDirect3DTexture8 *iface)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
-    ULONG ref = InterlockedIncrement(&texture->refcount);
+    ULONG ref = InterlockedIncrement(&texture->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, ref);
 
@@ -74,7 +74,7 @@ static ULONG WINAPI d3d8_texture_2d_AddRef(IDirect3DTexture8 *iface)
 static ULONG WINAPI d3d8_texture_2d_Release(IDirect3DTexture8 *iface)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
-    ULONG ref = InterlockedDecrement(&texture->refcount);
+    ULONG ref = InterlockedDecrement(&texture->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
@@ -110,52 +110,28 @@ static HRESULT WINAPI d3d8_texture_2d_SetPrivateData(IDirect3DTexture8 *iface,
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_set_private_data(&texture->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d8_texture_2d_GetPrivateData(IDirect3DTexture8 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_get_private_data(&texture->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d8_texture_2d_FreePrivateData(IDirect3DTexture8 *iface, REFGUID guid)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DTexture8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_free_private_data(&texture->resource, guid);
 }
 
 static DWORD WINAPI d3d8_texture_2d_SetPriority(IDirect3DTexture8 *iface, DWORD priority)
@@ -424,7 +400,7 @@ static HRESULT WINAPI d3d8_texture_cube_QueryInterface(IDirect3DCubeTexture8 *if
 static ULONG WINAPI d3d8_texture_cube_AddRef(IDirect3DCubeTexture8 *iface)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
-    ULONG ref = InterlockedIncrement(&texture->refcount);
+    ULONG ref = InterlockedIncrement(&texture->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, ref);
 
@@ -442,7 +418,7 @@ static ULONG WINAPI d3d8_texture_cube_AddRef(IDirect3DCubeTexture8 *iface)
 static ULONG WINAPI d3d8_texture_cube_Release(IDirect3DCubeTexture8 *iface)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
-    ULONG ref = InterlockedDecrement(&texture->refcount);
+    ULONG ref = InterlockedDecrement(&texture->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
@@ -480,52 +456,28 @@ static HRESULT WINAPI d3d8_texture_cube_SetPrivateData(IDirect3DCubeTexture8 *if
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_set_private_data(&texture->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d8_texture_cube_GetPrivateData(IDirect3DCubeTexture8 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_get_private_data(&texture->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d8_texture_cube_FreePrivateData(IDirect3DCubeTexture8 *iface, REFGUID guid)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DCubeTexture8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_free_private_data(&texture->resource, guid);
 }
 
 static DWORD WINAPI d3d8_texture_cube_SetPriority(IDirect3DCubeTexture8 *iface, DWORD priority)
@@ -817,7 +769,7 @@ static HRESULT WINAPI d3d8_texture_3d_QueryInterface(IDirect3DVolumeTexture8 *if
 static ULONG WINAPI d3d8_texture_3d_AddRef(IDirect3DVolumeTexture8 *iface)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
-    ULONG ref = InterlockedIncrement(&texture->refcount);
+    ULONG ref = InterlockedIncrement(&texture->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, ref);
 
@@ -835,7 +787,7 @@ static ULONG WINAPI d3d8_texture_3d_AddRef(IDirect3DVolumeTexture8 *iface)
 static ULONG WINAPI d3d8_texture_3d_Release(IDirect3DVolumeTexture8 *iface)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
-    ULONG ref = InterlockedDecrement(&texture->refcount);
+    ULONG ref = InterlockedDecrement(&texture->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
@@ -871,52 +823,28 @@ static HRESULT WINAPI d3d8_texture_3d_SetPrivateData(IDirect3DVolumeTexture8 *if
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_set_private_data(&texture->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d8_texture_3d_GetPrivateData(IDirect3DVolumeTexture8 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_get_private_data(&texture->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d8_texture_3d_FreePrivateData(IDirect3DVolumeTexture8 *iface, REFGUID guid)
 {
     struct d3d8_texture *texture = impl_from_IDirect3DVolumeTexture8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_free_private_data(&texture->resource, guid);
 }
 
 static DWORD WINAPI d3d8_texture_3d_SetPriority(IDirect3DVolumeTexture8 *iface, DWORD priority)
@@ -1171,7 +1099,9 @@ struct d3d8_texture *unsafe_impl_from_IDirect3DBaseTexture8(IDirect3DBaseTexture
 
 static void STDMETHODCALLTYPE d3d8_texture_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d8_texture *texture = parent;
+    d3d8_resource_cleanup(&texture->resource);
+    HeapFree(GetProcessHeap(), 0, texture);
 }
 
 static const struct wined3d_parent_ops d3d8_texture_wined3d_parent_ops =
@@ -1187,7 +1117,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
     HRESULT hr;
 
     texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DTexture8_Vtbl;
-    texture->refcount = 1;
+    d3d8_resource_init(&texture->resource);
 
     desc.resource_type = WINED3D_RTYPE_TEXTURE;
     desc.format = wined3dformat_from_d3dformat(format);
@@ -1228,7 +1158,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic
     HRESULT hr;
 
     texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DCubeTexture8_Vtbl;
-    texture->refcount = 1;
+    d3d8_resource_init(&texture->resource);
 
     desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE;
     desc.format = wined3dformat_from_d3dformat(format);
@@ -1268,7 +1198,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev
     HRESULT hr;
 
     texture->IDirect3DBaseTexture8_iface.lpVtbl = (const IDirect3DBaseTexture8Vtbl *)&Direct3DVolumeTexture8_Vtbl;
-    texture->refcount = 1;
+    d3d8_resource_init(&texture->resource);
 
     desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE;
     desc.format = wined3dformat_from_d3dformat(format);
index d2399d5..6396887 100644 (file)
@@ -58,7 +58,7 @@ static ULONG WINAPI d3d8_volume_AddRef(IDirect3DVolume8 *iface)
     else
     {
         /* No container, handle our own refcounting */
-        ULONG ref = InterlockedIncrement(&volume->refcount);
+        ULONG ref = InterlockedIncrement(&volume->resource.refcount);
 
         TRACE("%p increasing refcount to %u.\n", iface, ref);
 
@@ -88,7 +88,7 @@ static ULONG WINAPI d3d8_volume_Release(IDirect3DVolume8 *iface)
     else
     {
         /* No container, handle our own refcounting */
-        ULONG ref = InterlockedDecrement(&volume->refcount);
+        ULONG ref = InterlockedDecrement(&volume->resource.refcount);
 
         TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
@@ -127,52 +127,28 @@ static HRESULT WINAPI d3d8_volume_SetPrivateData(IDirect3DVolume8 *iface, REFGUI
         const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_volume_get_resource(volume->wined3d_volume);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_set_private_data(&volume->resource, guid, data, data_size, flags);
 }
 
-static HRESULT WINAPI d3d8_volume_GetPrivateData(IDirect3DVolume8 *iface, REFGUID  guid,
+static HRESULT WINAPI d3d8_volume_GetPrivateData(IDirect3DVolume8 *iface, REFGUID guid,
         void *data, DWORD *data_size)
 {
     struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_volume_get_resource(volume->wined3d_volume);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_get_private_data(&volume->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d8_volume_FreePrivateData(IDirect3DVolume8 *iface, REFGUID guid)
 {
     struct d3d8_volume *volume = impl_from_IDirect3DVolume8(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_volume_get_resource(volume->wined3d_volume);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d8_resource_free_private_data(&volume->resource, guid);
 }
 
 static HRESULT WINAPI d3d8_volume_GetContainer(IDirect3DVolume8 *iface, REFIID riid, void **container)
@@ -272,7 +248,9 @@ static const IDirect3DVolume8Vtbl d3d8_volume_vtbl =
 
 static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d8_volume *volume = parent;
+    d3d8_resource_cleanup(&volume->resource);
+    HeapFree(GetProcessHeap(), 0, volume);
 }
 
 static const struct wined3d_parent_ops d3d8_volume_wined3d_parent_ops =
@@ -284,7 +262,7 @@ void volume_init(struct d3d8_volume *volume, struct wined3d_volume *wined3d_volu
         const struct wined3d_parent_ops **parent_ops)
 {
     volume->IDirect3DVolume8_iface.lpVtbl = &d3d8_volume_vtbl;
-    volume->refcount = 1;
+    d3d8_resource_init(&volume->resource);
     wined3d_volume_incref(wined3d_volume);
     volume->wined3d_volume = wined3d_volume;
 
index 92691b2..bb91b2a 100644 (file)
@@ -47,7 +47,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_QueryInterface(IDirect3DVertexBuffer9 *i
 static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface)
 {
     struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface);
-    ULONG refcount = InterlockedIncrement(&buffer->refcount);
+    ULONG refcount = InterlockedIncrement(&buffer->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, refcount);
 
@@ -65,7 +65,7 @@ static ULONG WINAPI d3d9_vertexbuffer_AddRef(IDirect3DVertexBuffer9 *iface)
 static ULONG WINAPI d3d9_vertexbuffer_Release(IDirect3DVertexBuffer9 *iface)
 {
     struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface);
-    ULONG refcount = InterlockedDecrement(&buffer->refcount);
+    ULONG refcount = InterlockedDecrement(&buffer->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, refcount);
 
@@ -102,52 +102,28 @@ static HRESULT WINAPI d3d9_vertexbuffer_SetPrivateData(IDirect3DVertexBuffer9 *i
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_set_private_data(&buffer->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d9_vertexbuffer_GetPrivateData(IDirect3DVertexBuffer9 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_get_private_data(&buffer->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d9_vertexbuffer_FreePrivateData(IDirect3DVertexBuffer9 *iface, REFGUID guid)
 {
     struct d3d9_vertexbuffer *buffer = impl_from_IDirect3DVertexBuffer9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_free_private_data(&buffer->resource, guid);
 }
 
 static DWORD WINAPI d3d9_vertexbuffer_SetPriority(IDirect3DVertexBuffer9 *iface, DWORD priority)
@@ -272,7 +248,9 @@ static const IDirect3DVertexBuffer9Vtbl d3d9_vertexbuffer_vtbl =
 
 static void STDMETHODCALLTYPE d3d9_vertexbuffer_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d9_vertexbuffer *buffer = parent;
+    d3d9_resource_cleanup(&buffer->resource);
+    HeapFree(GetProcessHeap(), 0, buffer);
 }
 
 static const struct wined3d_parent_ops d3d9_vertexbuffer_wined3d_parent_ops =
@@ -286,8 +264,8 @@ HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device *
     HRESULT hr;
 
     buffer->IDirect3DVertexBuffer9_iface.lpVtbl = &d3d9_vertexbuffer_vtbl;
-    buffer->refcount = 1;
     buffer->fvf = fvf;
+    d3d9_resource_init(&buffer->resource);
 
     wined3d_mutex_lock();
     hr = wined3d_buffer_create_vb(device->wined3d_device, size, usage & WINED3DUSAGE_MASK,
@@ -341,7 +319,7 @@ static HRESULT WINAPI d3d9_indexbuffer_QueryInterface(IDirect3DIndexBuffer9 *ifa
 static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface)
 {
     struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface);
-    ULONG refcount = InterlockedIncrement(&buffer->refcount);
+    ULONG refcount = InterlockedIncrement(&buffer->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, refcount);
 
@@ -359,7 +337,7 @@ static ULONG WINAPI d3d9_indexbuffer_AddRef(IDirect3DIndexBuffer9 *iface)
 static ULONG WINAPI d3d9_indexbuffer_Release(IDirect3DIndexBuffer9 *iface)
 {
     struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface);
-    ULONG refcount = InterlockedDecrement(&buffer->refcount);
+    ULONG refcount = InterlockedDecrement(&buffer->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, refcount);
 
@@ -396,52 +374,28 @@ static HRESULT WINAPI d3d9_indexbuffer_SetPrivateData(IDirect3DIndexBuffer9 *ifa
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_set_private_data(&buffer->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d9_indexbuffer_GetPrivateData(IDirect3DIndexBuffer9 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_get_private_data(&buffer->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d9_indexbuffer_FreePrivateData(IDirect3DIndexBuffer9 *iface, REFGUID guid)
 {
     struct d3d9_indexbuffer *buffer = impl_from_IDirect3DIndexBuffer9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_buffer_get_resource(buffer->wined3d_buffer);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_free_private_data(&buffer->resource, guid);
 }
 
 static DWORD WINAPI d3d9_indexbuffer_SetPriority(IDirect3DIndexBuffer9 *iface, DWORD priority)
@@ -564,7 +518,9 @@ static const IDirect3DIndexBuffer9Vtbl d3d9_indexbuffer_vtbl =
 
 static void STDMETHODCALLTYPE d3d9_indexbuffer_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d9_indexbuffer *buffer = parent;
+    d3d9_resource_cleanup(&buffer->resource);
+    HeapFree(GetProcessHeap(), 0, buffer);
 }
 
 static const struct wined3d_parent_ops d3d9_indexbuffer_wined3d_parent_ops =
@@ -578,8 +534,8 @@ HRESULT indexbuffer_init(struct d3d9_indexbuffer *buffer, struct d3d9_device *de
     HRESULT hr;
 
     buffer->IDirect3DIndexBuffer9_iface.lpVtbl = &d3d9_indexbuffer_vtbl;
-    buffer->refcount = 1;
     buffer->format = wined3dformat_from_d3dformat(format);
+    d3d9_resource_init(&buffer->resource);
 
     wined3d_mutex_lock();
     hr = wined3d_buffer_create_ib(device->wined3d_device, size, usage & WINED3DUSAGE_MASK,
index b2a1c68..c051856 100644 (file)
@@ -158,3 +158,81 @@ void WINAPI D3DPERF_SetRegion(D3DCOLOR color, const WCHAR *name)
 {
     FIXME("color 0x%08x, name %s stub!\n", color, debugstr_w(name));
 }
+
+void d3d9_resource_cleanup(struct d3d9_resource *resource)
+{
+    wined3d_private_store_cleanup(&resource->private_store);
+}
+
+HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid)
+{
+    struct wined3d_private_data *entry;
+
+    wined3d_mutex_lock();
+    entry = wined3d_private_store_get_private_data(&resource->private_store, guid);
+    if (!entry)
+    {
+        wined3d_mutex_unlock();
+        return D3DERR_NOTFOUND;
+    }
+
+    wined3d_private_store_free_private_data(&resource->private_store, entry);
+    wined3d_mutex_unlock();
+
+    return D3D_OK;
+}
+
+HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid,
+        void *data, DWORD *data_size)
+{
+    const struct wined3d_private_data *stored_data;
+    DWORD size_in;
+    HRESULT hr;
+
+    wined3d_mutex_lock();
+    stored_data = wined3d_private_store_get_private_data(&resource->private_store, guid);
+    if (!stored_data)
+    {
+        hr = D3DERR_NOTFOUND;
+        goto done;
+    }
+
+    size_in = *data_size;
+    *data_size = stored_data->size;
+    if (!data)
+    {
+        hr = D3D_OK;
+        goto done;
+    }
+    if (size_in < stored_data->size)
+    {
+        hr = D3DERR_MOREDATA;
+        goto done;
+    }
+
+    if (stored_data->flags & WINED3DSPD_IUNKNOWN)
+        IUnknown_AddRef(stored_data->content.object);
+    memcpy(data, stored_data->content.data, stored_data->size);
+    hr = D3D_OK;
+
+done:
+    wined3d_mutex_unlock();
+    return hr;
+}
+
+void d3d9_resource_init(struct d3d9_resource *resource)
+{
+    resource->refcount = 1;
+    wined3d_private_store_init(&resource->private_store);
+}
+
+HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid,
+        const void *data, DWORD data_size, DWORD flags)
+{
+    HRESULT hr;
+
+    wined3d_mutex_lock();
+    hr = wined3d_private_store_set_private_data(&resource->private_store, guid, data, data_size, flags);
+    wined3d_mutex_unlock();
+    return hr;
+}
index e896c28..fb8d166 100644 (file)
@@ -172,10 +172,24 @@ HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wine
         UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags,
         D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) DECLSPEC_HIDDEN;
 
+struct d3d9_resource
+{
+    LONG refcount;
+    struct wined3d_private_store private_store;
+};
+
+void d3d9_resource_cleanup(struct d3d9_resource *resource) DECLSPEC_HIDDEN;
+HRESULT d3d9_resource_free_private_data(struct d3d9_resource *resource, const GUID *guid) DECLSPEC_HIDDEN;
+HRESULT d3d9_resource_get_private_data(struct d3d9_resource *resource, const GUID *guid,
+        void *data, DWORD *data_size) DECLSPEC_HIDDEN;
+void d3d9_resource_init(struct d3d9_resource *resource) DECLSPEC_HIDDEN;
+HRESULT d3d9_resource_set_private_data(struct d3d9_resource *resource, const GUID *guid,
+        const void *data, DWORD data_size, DWORD flags) DECLSPEC_HIDDEN;
+
 struct d3d9_volume
 {
     IDirect3DVolume9 IDirect3DVolume9_iface;
-    LONG refcount;
+    struct d3d9_resource resource;
     struct wined3d_volume *wined3d_volume;
     IUnknown *container;
     IUnknown *forwardReference;
@@ -198,7 +212,7 @@ HRESULT d3d9_swapchain_create(struct d3d9_device *device, struct wined3d_swapcha
 struct d3d9_surface
 {
     IDirect3DSurface9 IDirect3DSurface9_iface;
-    LONG refcount;
+    struct d3d9_resource resource;
     struct wined3d_surface *wined3d_surface;
     IDirect3DDevice9Ex *parent_device;
     IUnknown *container;
@@ -213,7 +227,7 @@ struct d3d9_surface *unsafe_impl_from_IDirect3DSurface9(IDirect3DSurface9 *iface
 struct d3d9_vertexbuffer
 {
     IDirect3DVertexBuffer9 IDirect3DVertexBuffer9_iface;
-    LONG refcount;
+    struct d3d9_resource resource;
     struct wined3d_buffer *wined3d_buffer;
     IDirect3DDevice9Ex *parent_device;
     DWORD fvf;
@@ -226,7 +240,7 @@ struct d3d9_vertexbuffer *unsafe_impl_from_IDirect3DVertexBuffer9(IDirect3DVerte
 struct d3d9_indexbuffer
 {
     IDirect3DIndexBuffer9 IDirect3DIndexBuffer9_iface;
-    LONG refcount;
+    struct d3d9_resource resource;
     struct wined3d_buffer *wined3d_buffer;
     IDirect3DDevice9Ex *parent_device;
     enum wined3d_format_id format;
@@ -239,7 +253,7 @@ struct d3d9_indexbuffer *unsafe_impl_from_IDirect3DIndexBuffer9(IDirect3DIndexBu
 struct d3d9_texture
 {
     IDirect3DBaseTexture9 IDirect3DBaseTexture9_iface;
-    LONG refcount;
+    struct d3d9_resource resource;
     struct wined3d_texture *wined3d_texture;
     IDirect3DDevice9Ex *parent_device;
 };
index efff993..7306d08 100644 (file)
@@ -578,7 +578,7 @@ static HRESULT CDECL reset_enum_callback(struct wined3d_resource *resource)
         }
 
         surface = wined3d_resource_get_parent(resource);
-        if (surface->refcount)
+        if (surface->resource.refcount)
         {
             WARN("Surface %p (resource %p) in pool D3DPOOL_DEFAULT blocks the Reset call.\n", surface, resource);
             return D3DERR_INVALIDCALL;
@@ -3063,7 +3063,7 @@ static HRESULT WINAPI d3d9_device_ComposeRects(IDirect3DDevice9Ex *iface,
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI d3d9_device_PresentEx(IDirect3DDevice9Ex *iface,
+static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_PresentEx(IDirect3DDevice9Ex *iface,
         const RECT *src_rect, const RECT *dst_rect, HWND dst_window_override,
         const RGNDATA *dirty_region, DWORD flags)
 {
@@ -3182,7 +3182,7 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurfaceEx(IDirect3DDevice9Ex
     return E_NOTIMPL;
 }
 
-static HRESULT WINAPI d3d9_device_ResetEx(IDirect3DDevice9Ex *iface,
+static HRESULT WINAPI DECLSPEC_HOTPATCH d3d9_device_ResetEx(IDirect3DDevice9Ex *iface,
         D3DPRESENT_PARAMETERS *present_parameters, D3DDISPLAYMODEEX *mode)
 {
     struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
index be1917c..6b68838 100644 (file)
@@ -229,6 +229,10 @@ static HRESULT WINAPI d3d9_CheckDeviceType(IDirect3D9Ex *iface, UINT adapter, D3
     TRACE("iface %p, adapter %u, device_type %#x, display_format %#x, backbuffer_format %#x, windowed %#x.\n",
             iface, adapter, device_type, display_format, backbuffer_format, windowed);
 
+    /* Others than that not supported by d3d9, but reported by wined3d for ddraw. Filter them out. */
+    if (!windowed && display_format != D3DFMT_X8R8G8B8 && display_format != D3DFMT_R5G6B5)
+        return WINED3DERR_NOTAVAILABLE;
+
     wined3d_mutex_lock();
     hr = wined3d_check_device_type(d3d9->wined3d, adapter, device_type, wined3dformat_from_d3dformat(display_format),
             wined3dformat_from_d3dformat(backbuffer_format), windowed);
@@ -629,12 +633,15 @@ static const struct IDirect3D9ExVtbl d3d9_vtbl =
 
 BOOL d3d9_init(struct d3d9 *d3d9, BOOL extended)
 {
-    DWORD flags = extended ? 0 : WINED3D_VIDMEM_ACCOUNTING;
+    DWORD flags = WINED3D_PRESENT_CONVERSION;
+
+    if (!extended)
+        flags |= WINED3D_VIDMEM_ACCOUNTING;
     d3d9->IDirect3D9Ex_iface.lpVtbl = &d3d9_vtbl;
     d3d9->refcount = 1;
 
     wined3d_mutex_lock();
-    d3d9->wined3d = wined3d_create(9, flags);
+    d3d9->wined3d = wined3d_create(flags);
     wined3d_mutex_unlock();
     if (!d3d9->wined3d)
         return FALSE;
index 87cc54d..044a2ad 100644 (file)
@@ -105,12 +105,17 @@ static D3DQUERYTYPE WINAPI d3d9_query_GetType(IDirect3DQuery9 *iface)
 static DWORD WINAPI d3d9_query_GetDataSize(IDirect3DQuery9 *iface)
 {
     struct d3d9_query *query = impl_from_IDirect3DQuery9(iface);
+    enum wined3d_query_type type;
     DWORD ret;
 
     TRACE("iface %p.\n", iface);
 
     wined3d_mutex_lock();
-    ret = wined3d_query_get_data_size(query->wined3d_query);
+    type = wined3d_query_get_type(query->wined3d_query);
+    if (type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT)
+        ret = sizeof(BOOL);
+    else
+        ret = wined3d_query_get_data_size(query->wined3d_query);
     wined3d_mutex_unlock();
 
     return ret;
@@ -133,13 +138,25 @@ static HRESULT WINAPI d3d9_query_Issue(IDirect3DQuery9 *iface, DWORD flags)
 static HRESULT WINAPI d3d9_query_GetData(IDirect3DQuery9 *iface, void *data, DWORD size, DWORD flags)
 {
     struct d3d9_query *query = impl_from_IDirect3DQuery9(iface);
+    enum wined3d_query_type type;
     HRESULT hr;
 
     TRACE("iface %p, data %p, size %u, flags %#x.\n",
             iface, data, size, flags);
 
     wined3d_mutex_lock();
-    hr = wined3d_query_get_data(query->wined3d_query, data, size, flags);
+    type = wined3d_query_get_type(query->wined3d_query);
+    if (type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT && data)
+    {
+        struct wined3d_query_data_timestamp_disjoint data_disjoint;
+
+        hr = wined3d_query_get_data(query->wined3d_query, &data_disjoint, sizeof(data_disjoint), flags);
+        *(BOOL *)data = data_disjoint.disjoint;
+    }
+    else
+    {
+        hr = wined3d_query_get_data(query->wined3d_query, data, size, flags);
+    }
     wined3d_mutex_unlock();
 
     return hr;
index 27e6744..785e860 100644 (file)
@@ -58,7 +58,7 @@ static ULONG WINAPI d3d9_surface_AddRef(IDirect3DSurface9 *iface)
         return IUnknown_AddRef(surface->forwardReference);
     }
 
-    refcount = InterlockedIncrement(&surface->refcount);
+    refcount = InterlockedIncrement(&surface->resource.refcount);
     TRACE("%p increasing refcount to %u.\n", iface, refcount);
 
     if (refcount == 1)
@@ -86,7 +86,7 @@ static ULONG WINAPI d3d9_surface_Release(IDirect3DSurface9 *iface)
         return IUnknown_Release(surface->forwardReference);
     }
 
-    refcount = InterlockedDecrement(&surface->refcount);
+    refcount = InterlockedDecrement(&surface->resource.refcount);
     TRACE("%p decreasing refcount to %u.\n", iface, refcount);
 
     if (!refcount)
@@ -140,52 +140,28 @@ static HRESULT WINAPI d3d9_surface_SetPrivateData(IDirect3DSurface9 *iface, REFG
         const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_surface_get_resource(surface->wined3d_surface);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_set_private_data(&surface->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d9_surface_GetPrivateData(IDirect3DSurface9 *iface, REFGUID guid,
         void *data, DWORD *data_size)
 {
     struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_surface_get_resource(surface->wined3d_surface);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_get_private_data(&surface->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d9_surface_FreePrivateData(IDirect3DSurface9 *iface, REFGUID guid)
 {
     struct d3d9_surface *surface = impl_from_IDirect3DSurface9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_surface_get_resource(surface->wined3d_surface);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_free_private_data(&surface->resource, guid);
 }
 
 static DWORD WINAPI d3d9_surface_SetPriority(IDirect3DSurface9 *iface, DWORD priority)
@@ -382,7 +358,9 @@ static const struct IDirect3DSurface9Vtbl d3d9_surface_vtbl =
 
 static void STDMETHODCALLTYPE surface_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d9_surface *surface = parent;
+    d3d9_resource_cleanup(&surface->resource);
+    HeapFree(GetProcessHeap(), 0, surface);
 }
 
 static const struct wined3d_parent_ops d3d9_surface_wined3d_parent_ops =
@@ -396,7 +374,7 @@ void surface_init(struct d3d9_surface *surface, struct wined3d_surface *wined3d_
     struct wined3d_resource_desc desc;
 
     surface->IDirect3DSurface9_iface.lpVtbl = &d3d9_surface_vtbl;
-    surface->refcount = 1;
+    d3d9_resource_init(&surface->resource);
 
     wined3d_resource_get_desc(wined3d_surface_get_resource(wined3d_surface), &desc);
     switch (d3dformat_from_wined3dformat(desc.format))
index 2cddc57..5f14bf2 100644 (file)
@@ -58,7 +58,7 @@ static HRESULT WINAPI d3d9_texture_2d_QueryInterface(IDirect3DTexture9 *iface, R
 static ULONG WINAPI d3d9_texture_2d_AddRef(IDirect3DTexture9 *iface)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
-    ULONG ref = InterlockedIncrement(&texture->refcount);
+    ULONG ref = InterlockedIncrement(&texture->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, ref);
 
@@ -76,7 +76,7 @@ static ULONG WINAPI d3d9_texture_2d_AddRef(IDirect3DTexture9 *iface)
 static ULONG WINAPI d3d9_texture_2d_Release(IDirect3DTexture9 *iface)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
-    ULONG ref = InterlockedDecrement(&texture->refcount);
+    ULONG ref = InterlockedDecrement(&texture->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
@@ -112,52 +112,28 @@ static HRESULT WINAPI d3d9_texture_2d_SetPrivateData(IDirect3DTexture9 *iface,
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d9_texture_2d_GetPrivateData(IDirect3DTexture9 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d9_texture_2d_FreePrivateData(IDirect3DTexture9 *iface, REFGUID guid)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DTexture9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_free_private_data(&texture->resource, guid);
 }
 
 static DWORD WINAPI d3d9_texture_2d_SetPriority(IDirect3DTexture9 *iface, DWORD priority)
@@ -469,7 +445,7 @@ static HRESULT WINAPI d3d9_texture_cube_QueryInterface(IDirect3DCubeTexture9 *if
 static ULONG WINAPI d3d9_texture_cube_AddRef(IDirect3DCubeTexture9 *iface)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
-    ULONG ref = InterlockedIncrement(&texture->refcount);
+    ULONG ref = InterlockedIncrement(&texture->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, ref);
 
@@ -487,7 +463,7 @@ static ULONG WINAPI d3d9_texture_cube_AddRef(IDirect3DCubeTexture9 *iface)
 static ULONG WINAPI d3d9_texture_cube_Release(IDirect3DCubeTexture9 *iface)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
-    ULONG ref = InterlockedDecrement(&texture->refcount);
+    ULONG ref = InterlockedDecrement(&texture->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
@@ -525,52 +501,28 @@ static HRESULT WINAPI d3d9_texture_cube_SetPrivateData(IDirect3DCubeTexture9 *if
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d9_texture_cube_GetPrivateData(IDirect3DCubeTexture9 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d9_texture_cube_FreePrivateData(IDirect3DCubeTexture9 *iface, REFGUID guid)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DCubeTexture9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_free_private_data(&texture->resource, guid);
 }
 
 static DWORD WINAPI d3d9_texture_cube_SetPriority(IDirect3DCubeTexture9 *iface, DWORD priority)
@@ -908,7 +860,7 @@ static HRESULT WINAPI d3d9_texture_3d_QueryInterface(IDirect3DVolumeTexture9 *if
 static ULONG WINAPI d3d9_texture_3d_AddRef(IDirect3DVolumeTexture9 *iface)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
-    ULONG ref = InterlockedIncrement(&texture->refcount);
+    ULONG ref = InterlockedIncrement(&texture->resource.refcount);
 
     TRACE("%p increasing refcount to %u.\n", iface, ref);
 
@@ -926,7 +878,7 @@ static ULONG WINAPI d3d9_texture_3d_AddRef(IDirect3DVolumeTexture9 *iface)
 static ULONG WINAPI d3d9_texture_3d_Release(IDirect3DVolumeTexture9 *iface)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
-    ULONG ref = InterlockedDecrement(&texture->refcount);
+    ULONG ref = InterlockedDecrement(&texture->resource.refcount);
 
     TRACE("%p decreasing refcount to %u.\n", iface, ref);
 
@@ -962,52 +914,28 @@ static HRESULT WINAPI d3d9_texture_3d_SetPrivateData(IDirect3DVolumeTexture9 *if
         REFGUID guid, const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_set_private_data(&texture->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d9_texture_3d_GetPrivateData(IDirect3DVolumeTexture9 *iface,
         REFGUID guid, void *data, DWORD *data_size)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_get_private_data(&texture->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d9_texture_3d_FreePrivateData(IDirect3DVolumeTexture9 *iface, REFGUID guid)
 {
     struct d3d9_texture *texture = impl_from_IDirect3DVolumeTexture9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_texture_get_resource(texture->wined3d_texture);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_free_private_data(&texture->resource, guid);
 }
 
 static DWORD WINAPI d3d9_texture_3d_SetPriority(IDirect3DVolumeTexture9 *iface, DWORD priority)
@@ -1295,7 +1223,9 @@ struct d3d9_texture *unsafe_impl_from_IDirect3DBaseTexture9(IDirect3DBaseTexture
 
 static void STDMETHODCALLTYPE d3d9_texture_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d9_texture *texture = parent;
+    d3d9_resource_cleanup(&texture->resource);
+    HeapFree(GetProcessHeap(), 0, texture);
 }
 
 static const struct wined3d_parent_ops d3d9_texture_wined3d_parent_ops =
@@ -1311,7 +1241,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
     HRESULT hr;
 
     texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_2d_vtbl;
-    texture->refcount = 1;
+    d3d9_resource_init(&texture->resource);
 
     desc.resource_type = WINED3D_RTYPE_TEXTURE;
     desc.format = wined3dformat_from_d3dformat(format);
@@ -1352,7 +1282,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
     HRESULT hr;
 
     texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_cube_vtbl;
-    texture->refcount = 1;
+    d3d9_resource_init(&texture->resource);
 
     desc.resource_type = WINED3D_RTYPE_CUBE_TEXTURE;
     desc.format = wined3dformat_from_d3dformat(format);
@@ -1392,7 +1322,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
     HRESULT hr;
 
     texture->IDirect3DBaseTexture9_iface.lpVtbl = (const IDirect3DBaseTexture9Vtbl *)&d3d9_texture_3d_vtbl;
-    texture->refcount = 1;
+    d3d9_resource_init(&texture->resource);
 
     desc.resource_type = WINED3D_RTYPE_VOLUME_TEXTURE;
     desc.format = wined3dformat_from_d3dformat(format);
index b0a6290..9a3419d 100644 (file)
@@ -57,7 +57,7 @@ static ULONG WINAPI d3d9_volume_AddRef(IDirect3DVolume9 *iface)
         return IUnknown_AddRef(volume->forwardReference);
     }
 
-    refcount = InterlockedIncrement(&volume->refcount);
+    refcount = InterlockedIncrement(&volume->resource.refcount);
     TRACE("%p increasing refcount to %u.\n", iface, refcount);
 
     if (refcount == 1)
@@ -83,7 +83,7 @@ static ULONG WINAPI d3d9_volume_Release(IDirect3DVolume9 *iface)
         return IUnknown_Release(volume->forwardReference);
     }
 
-    refcount = InterlockedDecrement(&volume->refcount);
+    refcount = InterlockedDecrement(&volume->resource.refcount);
     TRACE("%p decreasing refcount to %u.\n", iface, refcount);
 
     if (!refcount)
@@ -120,52 +120,28 @@ static HRESULT WINAPI d3d9_volume_SetPrivateData(IDirect3DVolume9 *iface, REFGUI
         const void *data, DWORD data_size, DWORD flags)
 {
     struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %u, flags %#x.\n",
             iface, debugstr_guid(guid), data, data_size, flags);
 
-    wined3d_mutex_lock();
-    resource = wined3d_volume_get_resource(volume->wined3d_volume);
-    hr = wined3d_resource_set_private_data(resource, guid, data, data_size, flags);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_set_private_data(&volume->resource, guid, data, data_size, flags);
 }
 
 static HRESULT WINAPI d3d9_volume_GetPrivateData(IDirect3DVolume9 *iface, REFGUID guid,
         void *data, DWORD *data_size)
 {
     struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s, data %p, data_size %p.\n",
             iface, debugstr_guid(guid), data, data_size);
 
-    wined3d_mutex_lock();
-    resource = wined3d_volume_get_resource(volume->wined3d_volume);
-    hr = wined3d_resource_get_private_data(resource, guid, data, data_size);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_get_private_data(&volume->resource, guid, data, data_size);
 }
 
 static HRESULT WINAPI d3d9_volume_FreePrivateData(IDirect3DVolume9 *iface, REFGUID guid)
 {
     struct d3d9_volume *volume = impl_from_IDirect3DVolume9(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
-
     TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid));
 
-    wined3d_mutex_lock();
-    resource = wined3d_volume_get_resource(volume->wined3d_volume);
-    hr = wined3d_resource_free_private_data(resource, guid);
-    wined3d_mutex_unlock();
-
-    return hr;
+    return d3d9_resource_free_private_data(&volume->resource, guid);
 }
 
 static HRESULT WINAPI d3d9_volume_GetContainer(IDirect3DVolume9 *iface, REFIID riid, void **container)
@@ -263,7 +239,9 @@ static const struct IDirect3DVolume9Vtbl d3d9_volume_vtbl =
 
 static void STDMETHODCALLTYPE volume_wined3d_object_destroyed(void *parent)
 {
-    HeapFree(GetProcessHeap(), 0, parent);
+    struct d3d9_volume *volume = parent;
+    d3d9_resource_cleanup(&volume->resource);
+    HeapFree(GetProcessHeap(), 0, volume);
 }
 
 static const struct wined3d_parent_ops d3d9_volume_wined3d_parent_ops =
@@ -275,7 +253,7 @@ void volume_init(struct d3d9_volume *volume, struct wined3d_volume *wined3d_volu
         const struct wined3d_parent_ops **parent_ops)
 {
     volume->IDirect3DVolume9_iface.lpVtbl = &d3d9_volume_vtbl;
-    volume->refcount = 1;
+    d3d9_resource_init(&volume->resource);
     wined3d_volume_incref(wined3d_volume);
     volume->wined3d_volume = wined3d_volume;
 
index 272e109..e16a23d 100644 (file)
@@ -30,7 +30,7 @@ static BOOL restore_mode;
 /* Device identifier. Don't relay it to WineD3D */
 static const DDDEVICEIDENTIFIER2 deviceidentifier =
 {
-    "display",
+    "vga.dll", /* default 2D driver */
     "DirectDraw HAL",
     { { 0x00010001, 0x00010001 } },
     0, 0, 0, 0,
@@ -2556,19 +2556,46 @@ static HRESULT WINAPI ddraw7_EvaluateMode(IDirectDraw7 *iface, DWORD Flags, DWOR
 static HRESULT WINAPI ddraw7_GetDeviceIdentifier(IDirectDraw7 *iface,
         DDDEVICEIDENTIFIER2 *DDDI, DWORD Flags)
 {
+    struct ddraw *ddraw = impl_from_IDirectDraw7(iface);
+    struct wined3d_adapter_identifier adapter_id;
+    HRESULT hr = S_OK;
+
     TRACE("iface %p, device_identifier %p, flags %#x.\n", iface, DDDI, Flags);
 
-    if(!DDDI)
+    if (!DDDI)
         return DDERR_INVALIDPARAMS;
 
-    /* The DDGDI_GETHOSTIDENTIFIER returns the information about the 2D
-     * host adapter, if there's a secondary 3D adapter. This doesn't apply
-     * to any modern hardware, nor is it interesting for Wine, so ignore it.
-     * Size of DDDEVICEIDENTIFIER2 may be aligned to 8 bytes and thus 4
-     * bytes too long. So only copy the relevant part of the structure
-     */
+    if (Flags & DDGDI_GETHOSTIDENTIFIER)
+    {
+        /* The DDGDI_GETHOSTIDENTIFIER returns the information about the 2D
+         * host adapter, if there's a secondary 3D adapter. This doesn't apply
+         * to any modern hardware, nor is it interesting for Wine, so ignore it.
+         * Size of DDDEVICEIDENTIFIER2 may be aligned to 8 bytes and thus 4
+         * bytes too long. So only copy the relevant part of the structure
+         */
 
-    memcpy(DDDI, &deviceidentifier, FIELD_OFFSET(DDDEVICEIDENTIFIER2, dwWHQLLevel) + sizeof(DWORD));
+        memcpy(DDDI, &deviceidentifier, FIELD_OFFSET(DDDEVICEIDENTIFIER2, dwWHQLLevel) + sizeof(DWORD));
+        return DD_OK;
+    }
+
+    /* Drakan: Order of the Flame expects accurate D3D device information from ddraw */
+    adapter_id.driver = DDDI->szDriver;
+    adapter_id.driver_size = sizeof(DDDI->szDriver);
+    adapter_id.description = DDDI->szDescription;
+    adapter_id.description_size = sizeof(DDDI->szDescription);
+    adapter_id.device_name_size = 0;
+    wined3d_mutex_lock();
+    hr = wined3d_get_adapter_identifier(ddraw->wined3d, WINED3DADAPTER_DEFAULT, 0x0, &adapter_id);
+    wined3d_mutex_unlock();
+    if (FAILED(hr)) return hr;
+
+    DDDI->liDriverVersion = adapter_id.driver_version;
+    DDDI->dwVendorId = adapter_id.vendor_id;
+    DDDI->dwDeviceId = adapter_id.device_id;
+    DDDI->dwSubSysId = adapter_id.subsystem_id;
+    DDDI->dwRevision = adapter_id.revision;
+    DDDI->guidDeviceIdentifier = adapter_id.device_identifier;
+    DDDI->dwWHQLLevel = adapter_id.whql_level;
     return DD_OK;
 }
 
@@ -4839,9 +4866,9 @@ HRESULT ddraw_init(struct ddraw *ddraw, enum wined3d_device_type device_type)
     ddraw->ref7 = 1;
 
     flags = WINED3D_LEGACY_DEPTH_BIAS | WINED3D_VIDMEM_ACCOUNTING;
-    if (!(ddraw->wined3d = wined3d_create(7, flags)))
+    if (!(ddraw->wined3d = wined3d_create(flags)))
     {
-        if (!(ddraw->wined3d = wined3d_create(7, flags | WINED3D_NO3D)))
+        if (!(ddraw->wined3d = wined3d_create(flags | WINED3D_NO3D)))
         {
             WARN("Failed to create a wined3d object.\n");
             return E_FAIL;
index 3926bb4..6ab8c4e 100644 (file)
@@ -1,3 +1,3 @@
 #include "version.rc"
 
-1 WINE_REGISTRY ddraw.rgs
+1 WINE_REGISTRY ddraw_classes.rgs
index a312ed7..ae2adbd 100644 (file)
@@ -157,6 +157,7 @@ struct ddraw_surface
     struct ddraw *ddraw;
     struct wined3d_surface *wined3d_surface;
     struct wined3d_texture *wined3d_texture;
+    struct wined3d_private_store private_store;
     struct d3d_device *device1;
 
     /* This implementation handles attaching surfaces to other surfaces */
@@ -550,8 +551,6 @@ struct d3d_vertex_buffer
     DWORD                fvf;
     DWORD                size;
     BOOL                 dynamic;
-
-    BOOL                 read_since_last_map;
 };
 
 HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **buffer, struct ddraw *ddraw,
index cfad802..c53f69b 100644 (file)
@@ -4264,9 +4264,6 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE
     wined3d_device_set_primitive_type(device->wined3d_device, PrimitiveType);
     hr = wined3d_device_draw_primitive(device->wined3d_device, StartVertex, NumVertices);
 
-    if (SUCCEEDED(hr))
-        vb->read_since_last_map = TRUE;
-
     wined3d_mutex_unlock();
 
     return hr;
@@ -4392,9 +4389,6 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface,
     wined3d_device_set_primitive_type(This->wined3d_device, PrimitiveType);
     hr = wined3d_device_draw_indexed_primitive(This->wined3d_device, ib_pos / sizeof(WORD), IndexCount);
 
-    if (SUCCEEDED(hr))
-        vb->read_since_last_map = TRUE;
-
     wined3d_mutex_unlock();
 
     return hr;
index 9387cc0..bac39e8 100644 (file)
@@ -402,9 +402,9 @@ HRESULT WINAPI DirectDrawEnumerateExA(LPDDENUMCALLBACKEXA callback, void *contex
         FIXME("flags 0x%08x not handled\n", flags & ~DDENUM_ATTACHEDSECONDARYDEVICES);
 
     TRACE("Enumerating ddraw interfaces\n");
-    if (!(wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS)))
+    if (!(wined3d = wined3d_create(WINED3D_LEGACY_DEPTH_BIAS)))
     {
-        if (!(wined3d = wined3d_create(7, WINED3D_LEGACY_DEPTH_BIAS | WINED3D_NO3D)))
+        if (!(wined3d = wined3d_create(WINED3D_LEGACY_DEPTH_BIAS | WINED3D_NO3D)))
         {
             WARN("Failed to create a wined3d object.\n");
             return E_FAIL;
index 9a35b1a..4e465d3 100644 (file)
@@ -1665,106 +1665,94 @@ static HRESULT WINAPI ddraw_surface7_AddAttachedSurface(IDirectDrawSurface7 *ifa
 
 static HRESULT WINAPI ddraw_surface4_AddAttachedSurface(IDirectDrawSurface4 *iface, IDirectDrawSurface4 *attachment)
 {
-    struct ddraw_surface *This = impl_from_IDirectDrawSurface4(iface);
+    struct ddraw_surface *surface = impl_from_IDirectDrawSurface4(iface);
     struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface4(attachment);
     HRESULT hr;
 
     TRACE("iface %p, attachment %p.\n", iface, attachment);
 
-    hr = ddraw_surface7_AddAttachedSurface(&This->IDirectDrawSurface7_iface,
-            attachment_impl ? &attachment_impl->IDirectDrawSurface7_iface : NULL);
-    if (FAILED(hr))
-    {
-        return hr;
-    }
-    attachment_impl->attached_iface = (IUnknown *)attachment;
-    IUnknown_AddRef(attachment_impl->attached_iface);
-    ddraw_surface7_Release(&attachment_impl->IDirectDrawSurface7_iface);
-    return hr;
-}
-static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *iface, IDirectDrawSurface3 *attachment)
-{
-    struct ddraw_surface *This = impl_from_IDirectDrawSurface3(iface);
-    struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface3(attachment);
-    HRESULT hr;
-
-    TRACE("iface %p, attachment %p.\n", iface, attachment);
-
     /* Tests suggest that
      * -> offscreen plain surfaces can be attached to other offscreen plain surfaces
      * -> offscreen plain surfaces can be attached to primaries
      * -> primaries can be attached to offscreen plain surfaces
      * -> z buffers can be attached to primaries */
-    if (This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_OFFSCREENPLAIN)
+    if (surface->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_OFFSCREENPLAIN)
             && attachment_impl->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_OFFSCREENPLAIN))
     {
         /* Sizes have to match */
-        if (attachment_impl->surface_desc.dwWidth != This->surface_desc.dwWidth
-                || attachment_impl->surface_desc.dwHeight != This->surface_desc.dwHeight)
+        if (attachment_impl->surface_desc.dwWidth != surface->surface_desc.dwWidth
+                || attachment_impl->surface_desc.dwHeight != surface->surface_desc.dwHeight)
         {
             WARN("Surface sizes do not match.\n");
             return DDERR_CANNOTATTACHSURFACE;
         }
-        /* OK */
-    }
-    else if (This->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE)
-            && attachment_impl->surface_desc.ddsCaps.dwCaps & (DDSCAPS_ZBUFFER))
-    {
-        /* OK */
     }
-    else
+    else if (!(surface->surface_desc.ddsCaps.dwCaps & (DDSCAPS_PRIMARYSURFACE | DDSCAPS_3DDEVICE))
+            || !(attachment_impl->surface_desc.ddsCaps.dwCaps & (DDSCAPS_ZBUFFER)))
     {
         WARN("Invalid attachment combination.\n");
         return DDERR_CANNOTATTACHSURFACE;
     }
 
-    hr = ddraw_surface_attach_surface(This, attachment_impl);
-    if (FAILED(hr))
-    {
+    if (FAILED(hr = ddraw_surface_attach_surface(surface, attachment_impl)))
         return hr;
-    }
+
     attachment_impl->attached_iface = (IUnknown *)attachment;
     IUnknown_AddRef(attachment_impl->attached_iface);
     return hr;
 }
 
+static HRESULT WINAPI ddraw_surface3_AddAttachedSurface(IDirectDrawSurface3 *iface, IDirectDrawSurface3 *attachment)
+{
+    struct ddraw_surface *surface = impl_from_IDirectDrawSurface3(iface);
+    struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface3(attachment);
+    HRESULT hr;
+
+    TRACE("iface %p, attachment %p.\n", iface, attachment);
+
+    if (FAILED(hr = ddraw_surface4_AddAttachedSurface(&surface->IDirectDrawSurface4_iface,
+            attachment_impl ? &attachment_impl->IDirectDrawSurface4_iface : NULL)))
+        return hr;
+
+    attachment_impl->attached_iface = (IUnknown *)attachment;
+    IUnknown_AddRef(attachment_impl->attached_iface);
+    ddraw_surface4_Release(&attachment_impl->IDirectDrawSurface4_iface);
+    return hr;
+}
+
 static HRESULT WINAPI ddraw_surface2_AddAttachedSurface(IDirectDrawSurface2 *iface, IDirectDrawSurface2 *attachment)
 {
-    struct ddraw_surface *This = impl_from_IDirectDrawSurface2(iface);
+    struct ddraw_surface *surface = impl_from_IDirectDrawSurface2(iface);
     struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface2(attachment);
     HRESULT hr;
 
     TRACE("iface %p, attachment %p.\n", iface, attachment);
 
-    hr = ddraw_surface3_AddAttachedSurface(&This->IDirectDrawSurface3_iface,
-            attachment_impl ? &attachment_impl->IDirectDrawSurface3_iface : NULL);
-    if (FAILED(hr))
-    {
+    if (FAILED(hr = ddraw_surface4_AddAttachedSurface(&surface->IDirectDrawSurface4_iface,
+            attachment_impl ? &attachment_impl->IDirectDrawSurface4_iface : NULL)))
         return hr;
-    }
+
     attachment_impl->attached_iface = (IUnknown *)attachment;
     IUnknown_AddRef(attachment_impl->attached_iface);
-    ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface);
+    ddraw_surface4_Release(&attachment_impl->IDirectDrawSurface4_iface);
     return hr;
 }
 
 static HRESULT WINAPI ddraw_surface1_AddAttachedSurface(IDirectDrawSurface *iface, IDirectDrawSurface *attachment)
 {
-    struct ddraw_surface *This = impl_from_IDirectDrawSurface(iface);
+    struct ddraw_surface *surface = impl_from_IDirectDrawSurface(iface);
     struct ddraw_surface *attachment_impl = unsafe_impl_from_IDirectDrawSurface(attachment);
     HRESULT hr;
 
     TRACE("iface %p, attachment %p.\n", iface, attachment);
 
-    hr = ddraw_surface3_AddAttachedSurface(&This->IDirectDrawSurface3_iface,
-            attachment_impl ? &attachment_impl->IDirectDrawSurface3_iface : NULL);
-    if (FAILED(hr))
-    {
+    if (FAILED(hr = ddraw_surface4_AddAttachedSurface(&surface->IDirectDrawSurface4_iface,
+            attachment_impl ? &attachment_impl->IDirectDrawSurface4_iface : NULL)))
         return hr;
-    }
+
     attachment_impl->attached_iface = (IUnknown *)attachment;
     IUnknown_AddRef(attachment_impl->attached_iface);
-    ddraw_surface3_Release(&attachment_impl->IDirectDrawSurface3_iface);
+    ddraw_surface4_Release(&attachment_impl->IDirectDrawSurface4_iface);
     return hr;
 }
 
@@ -2253,25 +2241,24 @@ static HRESULT WINAPI ddraw_surface7_GetPriority(IDirectDrawSurface7 *iface, DWO
  *
  *****************************************************************************/
 static HRESULT WINAPI ddraw_surface7_SetPrivateData(IDirectDrawSurface7 *iface,
-        REFGUID tag, void *Data, DWORD Size, DWORD Flags)
+        REFGUID tag, void *data, DWORD size, DWORD flags)
 {
     struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
-    struct wined3d_resource *resource;
     HRESULT hr;
 
     TRACE("iface %p, tag %s, data %p, data_size %u, flags %#x.\n",
-            iface, debugstr_guid(tag), Data, Size, Flags);
-
-    wined3d_mutex_lock();
-    resource = wined3d_surface_get_resource(surface->wined3d_surface);
-    hr = wined3d_resource_set_private_data(resource, tag, Data, Size, Flags);
-    wined3d_mutex_unlock();
+            iface, debugstr_guid(tag), data, size, flags);
 
-    switch(hr)
+    if (!data)
     {
-        case WINED3DERR_INVALIDCALL:        return DDERR_INVALIDPARAMS;
-        default:                            return hr;
+        WARN("data is NULL, returning DDERR_INVALIDPARAMS.\n");
+        return DDERR_INVALIDPARAMS;
     }
+
+    wined3d_mutex_lock();
+    hr = wined3d_private_store_set_private_data(&surface->private_store, tag, data, size, flags);
+    wined3d_mutex_unlock();
+    return hr_ddraw_from_wined3d(hr);
 }
 
 static HRESULT WINAPI ddraw_surface4_SetPrivateData(IDirectDrawSurface4 *iface,
@@ -2301,23 +2288,45 @@ static HRESULT WINAPI ddraw_surface4_SetPrivateData(IDirectDrawSurface4 *iface,
  *  For more details, see IWineD3DSurface::GetPrivateData
  *
  *****************************************************************************/
-static HRESULT WINAPI ddraw_surface7_GetPrivateData(IDirectDrawSurface7 *iface, REFGUID tag, void *Data, DWORD *Size)
+static HRESULT WINAPI ddraw_surface7_GetPrivateData(IDirectDrawSurface7 *iface, REFGUID tag, void *data, DWORD *size)
 {
     struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
-    struct wined3d_resource *resource;
+    const struct wined3d_private_data *stored_data;
     HRESULT hr;
 
     TRACE("iface %p, tag %s, data %p, data_size %p.\n",
-            iface, debugstr_guid(tag), Data, Size);
-
-    if(!Data)
-        return DDERR_INVALIDPARAMS;
+            iface, debugstr_guid(tag), data, size);
 
     wined3d_mutex_lock();
-    resource = wined3d_surface_get_resource(surface->wined3d_surface);
-    hr = wined3d_resource_get_private_data(resource, tag, Data, Size);
-    wined3d_mutex_unlock();
+    stored_data = wined3d_private_store_get_private_data(&surface->private_store, tag);
+    if (!stored_data)
+    {
+        hr = DDERR_NOTFOUND;
+        goto done;
+    }
+    if (!size)
+    {
+        hr = DDERR_INVALIDPARAMS;
+        goto done;
+    }
+    if (*size < stored_data->size)
+    {
+        *size = stored_data->size;
+        hr = DDERR_MOREDATA;
+        goto done;
+    }
+    if (!data)
+    {
+        hr = DDERR_INVALIDPARAMS;
+        goto done;
+    }
+
+    *size = stored_data->size;
+    memcpy(data, stored_data->content.data, stored_data->size);
+    hr = DD_OK;
 
+done:
+    wined3d_mutex_unlock();
     return hr;
 }
 
@@ -2347,17 +2356,22 @@ static HRESULT WINAPI ddraw_surface4_GetPrivateData(IDirectDrawSurface4 *iface,
 static HRESULT WINAPI ddraw_surface7_FreePrivateData(IDirectDrawSurface7 *iface, REFGUID tag)
 {
     struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface);
-    struct wined3d_resource *resource;
-    HRESULT hr;
+    struct wined3d_private_data *entry;
 
     TRACE("iface %p, tag %s.\n", iface, debugstr_guid(tag));
 
     wined3d_mutex_lock();
-    resource = wined3d_surface_get_resource(surface->wined3d_surface);
-    hr = wined3d_resource_free_private_data(resource, tag);
+    entry = wined3d_private_store_get_private_data(&surface->private_store, tag);
+    if (!entry)
+    {
+        wined3d_mutex_unlock();
+        return DDERR_NOTFOUND;
+    }
+
+    wined3d_private_store_free_private_data(&surface->private_store, entry);
     wined3d_mutex_unlock();
 
-    return hr;
+    return DD_OK;
 }
 
 static HRESULT WINAPI ddraw_surface4_FreePrivateData(IDirectDrawSurface4 *iface, REFGUID tag)
@@ -5476,6 +5490,8 @@ static void STDMETHODCALLTYPE ddraw_surface_wined3d_object_destroyed(void *paren
     if (surface == surface->ddraw->primary)
         surface->ddraw->primary = NULL;
 
+    wined3d_private_store_cleanup(&surface->private_store);
+
     HeapFree(GetProcessHeap(), 0, surface);
 }
 
@@ -5538,11 +5554,6 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
     /* Ensure DDSD_CAPS is always set. */
     desc->dwFlags |= DDSD_CAPS;
 
-    /* If the surface is of the 'ALLOCONLOAD' type, ignore the LPSURFACE
-     * field. Frank Herbert's Dune specifies a NULL pointer for lpSurface. */
-    if ((desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || !desc->lpSurface)
-        desc->dwFlags &= ~DDSD_LPSURFACE;
-
     if (desc->ddsCaps.dwCaps & DDSCAPS_PRIMARYSURFACE)
     {
         DWORD flippable = desc->ddsCaps.dwCaps & (DDSCAPS_FLIP | DDSCAPS_COMPLEX);
@@ -5820,6 +5831,34 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
         }
     }
 
+    /* If the surface is of the 'ALLOCONLOAD' type, ignore the LPSURFACE
+     * field. Frank Herbert's Dune specifies a NULL pointer for lpSurface. */
+    if ((desc->ddsCaps.dwCaps & DDSCAPS_ALLOCONLOAD) || !desc->lpSurface)
+        desc->dwFlags &= ~DDSD_LPSURFACE;
+    if (desc->dwFlags & DDSD_LPSURFACE)
+    {
+        if (wined3d_desc.pool != WINED3D_POOL_SYSTEM_MEM)
+        {
+            WARN("User memory surfaces should be in the system memory pool.\n");
+            HeapFree(GetProcessHeap(), 0, texture);
+            return DDERR_INVALIDCAPS;
+        }
+
+        if (version < 4)
+        {
+            WARN("User memory surfaces not supported before version 4.\n");
+            HeapFree(GetProcessHeap(), 0, texture);
+            return DDERR_INVALIDPARAMS;
+        }
+
+        if (!(desc->dwFlags & DDSD_PITCH))
+        {
+            WARN("User memory surfaces should explicitly specify the pitch.\n");
+            HeapFree(GetProcessHeap(), 0, texture);
+            return DDERR_INVALIDPARAMS;
+        }
+    }
+
     if (desc->ddsCaps.dwCaps & (DDSCAPS_OVERLAY))
         wined3d_desc.usage |= WINED3DUSAGE_OVERLAY;
 
@@ -6050,34 +6089,36 @@ HRESULT ddraw_surface_init(struct ddraw_surface *surface, struct ddraw *ddraw, s
         else
             surface->surface_desc.u1.dwLinearSize = max(4, desc->dwWidth) * max(4, desc->dwHeight);
     }
-    else
+    else if (!(desc->dwFlags & DDSD_LPSURFACE))
     {
-        surface->surface_desc.dwFlags |= DDSD_PITCH;
-        surface->surface_desc.u1.lPitch = wined3d_surface_get_pitch(wined3d_surface);
+        desc->dwFlags |= DDSD_PITCH;
+        desc->u1.lPitch = wined3d_surface_get_pitch(wined3d_surface);
     }
 
     if (desc->dwFlags & DDSD_LPSURFACE)
     {
-        UINT pitch = 0;
-
-        if (desc->dwFlags & DDSD_PITCH)
+        if (desc->u1.lPitch < wined3d_surface_get_pitch(wined3d_surface) || desc->u1.lPitch & 3)
         {
-            pitch = desc->u1.lPitch;
-            surface->surface_desc.u1.lPitch = pitch;
+            WARN("Invalid pitch %u specified.\n", desc->u1.lPitch);
+            return DDERR_INVALIDPARAMS;
         }
 
         if (FAILED(hr = wined3d_surface_update_desc(wined3d_surface, wined3d_desc.width,
                 wined3d_desc.height, wined3d_desc.format, WINED3D_MULTISAMPLE_NONE, 0,
-                desc->lpSurface, pitch)))
+                desc->lpSurface, desc->u1.lPitch)))
         {
             ERR("Failed to set surface memory, hr %#x.\n", hr);
             return hr;
         }
+
+        desc->dwFlags &= ~DDSD_LPSURFACE;
     }
 
     wined3d_surface_incref(wined3d_surface);
     surface->wined3d_surface = wined3d_surface;
     *parent_ops = &ddraw_surface_wined3d_parent_ops;
 
+    wined3d_private_store_init(&surface->private_store);
+
     return DD_OK;
 }
index 6f9dd9c..daf0f6c 100644 (file)
@@ -751,7 +751,7 @@ DDRAW_dump_pixelformat(const DDPIXELFORMAT *pf)
         case 16: cmd = "%04lx"; break;
         case 24: cmd = "%06lx"; break;
         case 32: cmd = "%08lx"; break;
-        default: ERR("Unexpected bit depth !\n"); cmd = "%d"; break;
+        default: ERR("Unexpected bit depth!\n"); cmd = "%d"; break;
         }
         TRACE(" R "); TRACE(cmd, pf->u2.dwRBitMask);
         TRACE(" G "); TRACE(cmd, pf->u3.dwGBitMask);
index 4c05698..842a3bd 100644 (file)
@@ -240,7 +240,7 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface,
         wined3d_flags |= WINED3D_MAP_READONLY;
     if (flags & DDLOCK_NOOVERWRITE)
         wined3d_flags |= WINED3D_MAP_NOOVERWRITE;
-    if (flags & DDLOCK_DISCARDCONTENTS && buffer->read_since_last_map)
+    if (flags & DDLOCK_DISCARDCONTENTS)
     {
         wined3d_flags |= WINED3D_MAP_DISCARD;
 
@@ -274,9 +274,6 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface,
 
     hr = wined3d_buffer_map(buffer->wineD3DVertexBuffer, 0, 0, (BYTE **)data, wined3d_flags);
 
-    if (SUCCEEDED(hr))
-        buffer->read_since_last_map = FALSE;
-
     wined3d_mutex_unlock();
 
     return hr;
index 373a180..4264005 100644 (file)
@@ -672,7 +672,7 @@ static HRESULT WINAPI d3d_viewport_Clear(IDirect3DViewport3 *iface,
     }
 
     if (This->active_device == NULL) {
-        ERR(" Trying to clear a viewport not attached to a device !\n");
+        ERR(" Trying to clear a viewport not attached to a device!\n");
         return D3DERR_VIEWPORTHASNODEVICE;
     }
     d3d_device3 = &This->active_device->IDirect3DDevice3_iface;
@@ -682,7 +682,7 @@ static HRESULT WINAPI d3d_viewport_Clear(IDirect3DViewport3 *iface,
     if (flags & D3DCLEAR_TARGET)
     {
         if (This->background == NULL) {
-            ERR(" Trying to clear the color buffer without background material !\n");
+            ERR(" Trying to clear the color buffer without background material!\n");
         }
         else
         {
index 6195c30..b6d2695 100644 (file)
@@ -33,6 +33,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_QueryInterface(IWineDXGIAdapter *i
     if (IsEqualGUID(riid, &IID_IUnknown)
             || IsEqualGUID(riid, &IID_IDXGIObject)
             || IsEqualGUID(riid, &IID_IDXGIAdapter)
+            || IsEqualGUID(riid, &IID_IDXGIAdapter1)
             || IsEqualGUID(riid, &IID_IWineDXGIAdapter))
     {
         IUnknown_AddRef(iface);
@@ -130,9 +131,9 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_EnumOutputs(IWineDXGIAdapter *ifac
     return S_OK;
 }
 
-static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc)
+static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc1(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC1 *desc)
 {
-    struct dxgi_adapter *This = impl_from_IWineDXGIAdapter(iface);
+    struct dxgi_adapter *adapter = impl_from_IWineDXGIAdapter(iface);
     struct wined3d_adapter_identifier adapter_id;
     char description[128];
     struct wined3d *wined3d;
@@ -140,38 +141,57 @@ static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, D
 
     TRACE("iface %p, desc %p.\n", iface, desc);
 
-    if (!desc) return E_INVALIDARG;
+    if (!desc)
+        return E_INVALIDARG;
 
-    wined3d = IWineDXGIFactory_get_wined3d(This->parent);
+    wined3d = IWineDXGIFactory_get_wined3d(adapter->parent);
     adapter_id.driver_size = 0;
     adapter_id.description = description;
     adapter_id.description_size = sizeof(description);
     adapter_id.device_name_size = 0;
 
     EnterCriticalSection(&dxgi_cs);
-    hr = wined3d_get_adapter_identifier(wined3d, This->ordinal, 0, &adapter_id);
+    hr = wined3d_get_adapter_identifier(wined3d, adapter->ordinal, 0, &adapter_id);
     wined3d_decref(wined3d);
     LeaveCriticalSection(&dxgi_cs);
 
-    if (SUCCEEDED(hr))
+    if (FAILED(hr))
+        return hr;
+
+    if (!MultiByteToWideChar(CP_ACP, 0, description, -1, desc->Description, 128))
     {
-        if (!MultiByteToWideChar(CP_ACP, 0, description, -1, desc->Description, 128))
-        {
-            DWORD err = GetLastError();
-            ERR("Failed to translate description %s (%#x).\n", debugstr_a(description), err);
-            hr = E_FAIL;
-        }
-
-        desc->VendorId = adapter_id.vendor_id;
-        desc->DeviceId = adapter_id.device_id;
-        desc->SubSysId = adapter_id.subsystem_id;
-        desc->Revision = adapter_id.revision;
-        desc->DedicatedVideoMemory = adapter_id.video_memory;
-        desc->DedicatedSystemMemory = 0; /* FIXME */
-        desc->SharedSystemMemory = 0; /* FIXME */
-        memcpy(&desc->AdapterLuid, &adapter_id.adapter_luid, sizeof(desc->AdapterLuid));
+        DWORD err = GetLastError();
+        ERR("Failed to translate description %s (%#x).\n", debugstr_a(description), err);
+        hr = E_FAIL;
     }
 
+    desc->VendorId = adapter_id.vendor_id;
+    desc->DeviceId = adapter_id.device_id;
+    desc->SubSysId = adapter_id.subsystem_id;
+    desc->Revision = adapter_id.revision;
+    desc->DedicatedVideoMemory = adapter_id.video_memory;
+    desc->DedicatedSystemMemory = 0; /* FIXME */
+    desc->SharedSystemMemory = 0; /* FIXME */
+    memcpy(&desc->AdapterLuid, &adapter_id.adapter_luid, sizeof(desc->AdapterLuid));
+    desc->Flags = 0;
+
+    return hr;
+}
+
+static HRESULT STDMETHODCALLTYPE dxgi_adapter_GetDesc(IWineDXGIAdapter *iface, DXGI_ADAPTER_DESC *desc)
+{
+    DXGI_ADAPTER_DESC1 desc1;
+    HRESULT hr;
+
+    TRACE("iface %p, desc %p.\n", iface, desc);
+
+    if (!desc)
+        return E_INVALIDARG;
+
+    if (FAILED(hr = dxgi_adapter_GetDesc1(iface, &desc1)))
+        return hr;
+    memcpy(desc, &desc1, sizeof(*desc));
+
     return hr;
 }
 
@@ -209,6 +229,8 @@ static const struct IWineDXGIAdapterVtbl dxgi_adapter_vtbl =
     dxgi_adapter_EnumOutputs,
     dxgi_adapter_GetDesc,
     dxgi_adapter_CheckInterfaceSupport,
+    /* IDXGIAdapter1 methods */
+    dxgi_adapter_GetDesc1,
     /* IWineDXGIAdapter methods */
     dxgi_adapter_get_ordinal,
 };
index 853d8e2..2232f88 100644 (file)
@@ -1,3 +1,4 @@
 @ stdcall CreateDXGIFactory(ptr ptr)
+@ stdcall CreateDXGIFactory1(ptr ptr)
 @ stdcall DXGID3D10CreateDevice(ptr ptr ptr long ptr ptr)
 @ stdcall DXGID3D10RegisterLayers(ptr long)
index e20be15..a12f3a6 100644 (file)
@@ -43,55 +43,35 @@ static void dxgi_main_cleanup(void)
     DeleteCriticalSection(&dxgi_cs);
 }
 
-BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
+BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, void *reserved)
 {
-    TRACE("fdwReason %u\n", fdwReason);
-
-    switch(fdwReason)
+    switch (reason)
     {
         case DLL_PROCESS_ATTACH:
-            DisableThreadLibraryCalls(hInstDLL);
+            DisableThreadLibraryCalls(inst);
             break;
 
         case DLL_PROCESS_DETACH:
-            if (lpv) break;
-            dxgi_main_cleanup();
+            if (!reserved)
+                dxgi_main_cleanup();
             break;
     }
 
     return TRUE;
 }
 
-HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory)
+HRESULT WINAPI CreateDXGIFactory1(REFIID riid, void **factory)
 {
-    struct dxgi_factory *object;
-    HRESULT hr;
-
     TRACE("riid %s, factory %p\n", debugstr_guid(riid), factory);
 
-    object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
-    if (!object)
-    {
-        ERR("Failed to allocate DXGI factory object memory\n");
-        *factory = NULL;
-        return E_OUTOFMEMORY;
-    }
-
-    hr = dxgi_factory_init(object);
-    if (FAILED(hr))
-    {
-        WARN("Failed to initialize swapchain, hr %#x.\n", hr);
-        HeapFree(GetProcessHeap(), 0, object);
-        *factory = NULL;
-        return hr;
-    }
-
-    TRACE("Created IDXGIFactory %p\n", object);
+    return dxgi_factory_create(riid, factory, TRUE);
+}
 
-    hr = IDXGIFactory_QueryInterface((IDXGIFactory *)object, riid, factory);
-    IDXGIFactory_Release((IDXGIFactory *)object);
+HRESULT WINAPI CreateDXGIFactory(REFIID riid, void **factory)
+{
+    TRACE("riid %s, factory %p\n", debugstr_guid(riid), factory);
 
-    return hr;
+    return dxgi_factory_create(riid, factory, FALSE);
 }
 
 static BOOL get_layer(enum dxgi_device_layer_id id, struct dxgi_device_layer *layer)
@@ -125,8 +105,7 @@ static HRESULT register_d3d10core_layers(HMODULE d3d10core)
         HMODULE mod;
         BOOL ret;
 
-        ret = GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCSTR)d3d10core, &mod);
-        if (!ret)
+        if (!(ret = GetModuleHandleExA(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (const char *)d3d10core, &mod)))
         {
             LeaveCriticalSection(&dxgi_cs);
             return E_FAIL;
index 1921e9a..15d8e21 100644 (file)
@@ -90,10 +90,11 @@ struct dxgi_factory
     LONG refcount;
     struct wined3d *wined3d;
     UINT adapter_count;
-    IDXGIAdapter **adapters;
+    IWineDXGIAdapter **adapters;
+    BOOL extended;
 };
 
-HRESULT dxgi_factory_init(struct dxgi_factory *factory) DECLSPEC_HIDDEN;
+HRESULT dxgi_factory_create(REFIID riid, void **factory, BOOL extended) DECLSPEC_HIDDEN;
 
 /* IDXGIDevice */
 struct dxgi_device
index 5570566..a0c0937 100644 (file)
@@ -28,11 +28,14 @@ static inline struct dxgi_factory *impl_from_IWineDXGIFactory(IWineDXGIFactory *
 
 static HRESULT STDMETHODCALLTYPE dxgi_factory_QueryInterface(IWineDXGIFactory *iface, REFIID riid, void **object)
 {
+    struct dxgi_factory *factory = impl_from_IWineDXGIFactory(iface);
+
     TRACE("iface %p, riid %s, object %p\n", iface, debugstr_guid(riid), object);
 
     if (IsEqualGUID(riid, &IID_IUnknown)
             || IsEqualGUID(riid, &IID_IDXGIObject)
             || IsEqualGUID(riid, &IID_IDXGIFactory)
+            || (factory->extended && IsEqualGUID(riid, &IID_IDXGIFactory1))
             || IsEqualGUID(riid, &IID_IWineDXGIFactory))
     {
         IUnknown_AddRef(iface);
@@ -69,7 +72,7 @@ static ULONG STDMETHODCALLTYPE dxgi_factory_Release(IWineDXGIFactory *iface)
 
         for (i = 0; i < This->adapter_count; ++i)
         {
-            IDXGIAdapter_Release(This->adapters[i]);
+            IWineDXGIAdapter_Release(This->adapters[i]);
         }
         HeapFree(GetProcessHeap(), 0, This->adapters);
 
@@ -119,29 +122,38 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_GetParent(IWineDXGIFactory *iface,
 
 /* IDXGIFactory methods */
 
-static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *iface,
-        UINT adapter_idx, IDXGIAdapter **adapter)
+static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters1(IWineDXGIFactory *iface,
+        UINT adapter_idx, IDXGIAdapter1 **adapter)
 {
-    struct dxgi_factory *This = impl_from_IWineDXGIFactory(iface);
+    struct dxgi_factory *factory = impl_from_IWineDXGIFactory(iface);
 
     TRACE("iface %p, adapter_idx %u, adapter %p\n", iface, adapter_idx, adapter);
 
-    if (!adapter) return DXGI_ERROR_INVALID_CALL;
+    if (!adapter)
+        return DXGI_ERROR_INVALID_CALL;
 
-    if (adapter_idx >= This->adapter_count)
+    if (adapter_idx >= factory->adapter_count)
     {
         *adapter = NULL;
         return DXGI_ERROR_NOT_FOUND;
     }
 
-    *adapter = This->adapters[adapter_idx];
-    IDXGIAdapter_AddRef(*adapter);
+    *adapter = (IDXGIAdapter1 *)factory->adapters[adapter_idx];
+    IDXGIAdapter1_AddRef(*adapter);
 
     TRACE("Returning adapter %p\n", *adapter);
 
     return S_OK;
 }
 
+static HRESULT STDMETHODCALLTYPE dxgi_factory_EnumAdapters(IWineDXGIFactory *iface,
+        UINT adapter_idx, IDXGIAdapter **adapter)
+{
+    TRACE("iface %p, adapter_idx %u, adapter %p\n", iface, adapter_idx, adapter);
+
+    return dxgi_factory_EnumAdapters1(iface, adapter_idx, (IDXGIAdapter1 **)adapter);
+}
+
 static HRESULT STDMETHODCALLTYPE dxgi_factory_MakeWindowAssociation(IWineDXGIFactory *iface, HWND window, UINT flags)
 {
     FIXME("iface %p, window %p, flags %#x stub!\n\n", iface, window, flags);
@@ -258,6 +270,13 @@ static HRESULT STDMETHODCALLTYPE dxgi_factory_CreateSoftwareAdapter(IWineDXGIFac
     return E_NOTIMPL;
 }
 
+static BOOL STDMETHODCALLTYPE dxgi_factory_IsCurrent(IWineDXGIFactory *iface)
+{
+    FIXME("iface %p stub!\n", iface);
+
+    return TRUE;
+}
+
 /* IWineDXGIFactory methods */
 
 static struct wined3d * STDMETHODCALLTYPE dxgi_factory_get_wined3d(IWineDXGIFactory *iface)
@@ -289,11 +308,14 @@ static const struct IWineDXGIFactoryVtbl dxgi_factory_vtbl =
     dxgi_factory_GetWindowAssociation,
     dxgi_factory_CreateSwapChain,
     dxgi_factory_CreateSoftwareAdapter,
+    /* IDXGIFactory1 methods */
+    dxgi_factory_EnumAdapters1,
+    dxgi_factory_IsCurrent,
     /* IWineDXGIFactory methods */
     dxgi_factory_get_wined3d,
 };
 
-HRESULT dxgi_factory_init(struct dxgi_factory *factory)
+static HRESULT dxgi_factory_init(struct dxgi_factory *factory, BOOL extended)
 {
     HRESULT hr;
     UINT i;
@@ -302,7 +324,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory)
     factory->refcount = 1;
 
     EnterCriticalSection(&dxgi_cs);
-    factory->wined3d = wined3d_create(10, 0);
+    factory->wined3d = wined3d_create(0);
     if (!factory->wined3d)
     {
         LeaveCriticalSection(&dxgi_cs);
@@ -330,7 +352,7 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory)
 
             for (j = 0; j < i; ++j)
             {
-                IDXGIAdapter_Release(factory->adapters[j]);
+                IWineDXGIAdapter_Release(factory->adapters[j]);
             }
             hr = E_OUTOFMEMORY;
             goto fail;
@@ -346,14 +368,16 @@ HRESULT dxgi_factory_init(struct dxgi_factory *factory)
             HeapFree(GetProcessHeap(), 0, adapter);
             for (j = 0; j < i; ++j)
             {
-                IDXGIAdapter_Release(factory->adapters[j]);
+                IWineDXGIAdapter_Release(factory->adapters[j]);
             }
             goto fail;
         }
 
-        factory->adapters[i] = (IDXGIAdapter *)adapter;
+        factory->adapters[i] = &adapter->IWineDXGIAdapter_iface;
     }
 
+    factory->extended = extended;
+
     return S_OK;
 
 fail:
@@ -363,3 +387,26 @@ fail:
     LeaveCriticalSection(&dxgi_cs);
     return hr;
 }
+
+HRESULT dxgi_factory_create(REFIID riid, void **factory, BOOL extended)
+{
+    struct dxgi_factory *object;
+    HRESULT hr;
+
+    if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
+        return E_OUTOFMEMORY;
+
+    if (FAILED(hr = dxgi_factory_init(object, extended)))
+    {
+        WARN("Failed to initialize factory, hr %#x.\n", hr);
+        HeapFree(GetProcessHeap(), 0, object);
+        return hr;
+    }
+
+    TRACE("Created factory %p.\n", object);
+
+    hr = IWineDXGIFactory_QueryInterface(&object->IWineDXGIFactory_iface, riid, factory);
+    IWineDXGIFactory_Release(&object->IWineDXGIFactory_iface);
+
+    return hr;
+}
index c971ac4..6925944 100644 (file)
@@ -5,6 +5,7 @@
 #define WIN32_NO_STATUS
 #define _INC_WINDOWS
 #define COM_NO_WINDOWS_H
+#define COBJMACROS
 
 #include <windef.h>
 #include <winbase.h>
index 1a9f9e4..1b8c647 100644 (file)
@@ -127,9 +127,7 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
             iface, debug_dxgi_format(format), flags, mode_count, desc);
 
     if (!mode_count)
-    {
-        return S_OK;
-    }
+        return DXGI_ERROR_INVALID_CALL;
 
     if (format == DXGI_FORMAT_UNKNOWN)
     {
@@ -152,7 +150,14 @@ static HRESULT STDMETHODCALLTYPE dxgi_output_GetDisplayModeList(IDXGIOutput *ifa
         return S_OK;
     }
 
-    *mode_count = min(*mode_count,max_count);
+    if (max_count > *mode_count)
+    {
+        wined3d_decref(wined3d);
+        LeaveCriticalSection(&dxgi_cs);
+        return DXGI_ERROR_MORE_DATA;
+    }
+
+    *mode_count = max_count;
 
     for (i = 0; i < *mode_count; ++i)
     {
index bd12cc6..5aae215 100644 (file)
@@ -66,10 +66,7 @@ static ULONG STDMETHODCALLTYPE dxgi_surface_inner_Release(IUnknown *iface)
     TRACE("%p decreasing refcount to %u.\n", surface, refcount);
 
     if (!refcount)
-    {
-        IDXGIDevice_Release(surface->device);
         HeapFree(GetProcessHeap(), 0, surface);
-    }
 
     return refcount;
 }
@@ -205,7 +202,6 @@ HRESULT dxgi_surface_init(struct dxgi_surface *surface, IDXGIDevice *device, IUn
     surface->refcount = 1;
     surface->outer_unknown = outer ? outer : &surface->IUnknown_iface;
     surface->device = device;
-    IDXGIDevice_AddRef(device);
 
     return S_OK;
 }
index 00f965b..5d844ac 100644 (file)
@@ -15,7 +15,7 @@ add_library(qedit SHARED
     ${CMAKE_CURRENT_BINARY_DIR}/qedit.def)
 
 set_module_type(qedit win32dll)
-target_link_libraries(qedit strmiids uuid wine)
+target_link_libraries(qedit strmbase strmiids uuid wine)
 add_importlibs(qedit ole32 oleaut32 msvcrt kernel32 ntdll)
 add_pch(qedit qedit_private.h SOURCE)
 add_cd_file(TARGET qedit DESTINATION reactos/system32 FOR all)
index 3106f4c..138e1a6 100644 (file)
@@ -18,6 +18,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#pragma makedep register
+
 [
     threading(both),
     uuid(65bd0711-24d2-4ff7-9324-ed2e5d3abafa)
index edae0ae..3af5c3c 100644 (file)
 
 #include "qedit_private.h"
 
+#include <wine/strmbase.h>
+
 static const WCHAR vendor_name[] = { 'W', 'i', 'n', 'e', 0 };
 static const WCHAR pin_in_name[] = { 'I', 'n', 0 };
 static const WCHAR pin_out_name[] = { 'O', 'u', 't', 0 };
 
-static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount);
 static IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype);
 
-/* Fixed pins enumerator, holds filter referenced */
-typedef struct _PE_Impl {
-    IEnumPins pe;
-    IBaseFilter *filter;
-    LONG refCount;
-    ULONG numPins;
-    ULONG index;
-    IPin *pins[0];
-} PE_Impl;
-
-
-/* IEnumPins interface implementation */
-
-/* IUnknown */
-static ULONG WINAPI
-Fixed_IEnumPins_AddRef(IEnumPins *iface)
-{
-    PE_Impl *This = (PE_Impl *)iface;
-    ULONG refCount = InterlockedIncrement(&This->refCount);
-    TRACE("(%p) new ref = %u\n", This, refCount);
-    return refCount;
-}
-
-/* IUnknown */
-static ULONG WINAPI
-Fixed_IEnumPins_Release(IEnumPins *iface)
-{
-    PE_Impl *This = (PE_Impl *)iface;
-    ULONG refCount = InterlockedDecrement(&This->refCount);
-    TRACE("(%p) new ref = %u\n", This, refCount);
-    if (refCount == 0)
-    {
-        IBaseFilter_Release(This->filter);
-        CoTaskMemFree(This);
-        return 0;
-    }
-    return refCount;
-}
-
-/* IUnknown */
-static HRESULT WINAPI
-Fixed_IEnumPins_QueryInterface(IEnumPins *iface, REFIID riid, void **ppvObject)
-{
-    PE_Impl *This = (PE_Impl *)iface;
-    TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject);
-
-    if (IsEqualIID(riid, &IID_IUnknown) ||
-        IsEqualIID(riid, &IID_IEnumPins)) {
-       Fixed_IEnumPins_AddRef(iface);
-        *ppvObject = This->pins;
-        return S_OK;
-    }
-    *ppvObject = NULL;
-    WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppvObject);
-    return E_NOINTERFACE;
-}
-
-/* IEnumPins */
-static HRESULT WINAPI
-Fixed_IEnumPins_Next(IEnumPins *iface, ULONG nPins, IPin **pins, ULONG *fetched)
-{
-    PE_Impl *This = (PE_Impl *)iface;
-    ULONG count = 0;
-    TRACE("(%p)->(%u, %p, %p) index = %u\n", This, nPins, pins, fetched, This->index);
-    if (!nPins)
-        return E_INVALIDARG;
-    if (!pins || ((nPins != 1) && !fetched))
-        return E_POINTER;
-    while ((count < nPins) && (This->index < This->numPins)) {
-        IPin *pin = This->pins[This->index++];
-        IPin_AddRef(pin);
-        pins[count++] = pin;
-    }
-    if (fetched)
-        *fetched = count;
-    return (count == nPins) ? S_OK : S_FALSE;
-}
-
-/* IEnumPins */
-static HRESULT WINAPI
-Fixed_IEnumPins_Skip(IEnumPins *iface, ULONG nPins)
-{
-    PE_Impl *This = (PE_Impl *)iface;
-    TRACE("(%p)->(%u) index = %u\n", This, nPins, This->index);
-    nPins += This->index;
-    if (nPins >= This->numPins) {
-        This->index = This->numPins;
-        return S_FALSE;
-    }
-    This->index = nPins;
-    return S_OK;
-}
-
-/* IEnumPins */
-static HRESULT WINAPI
-Fixed_IEnumPins_Reset(IEnumPins *iface)
-{
-    PE_Impl *This = (PE_Impl *)iface;
-    TRACE("(%p)->() index = %u\n", This, This->index);
-    This->index = 0;
-    return S_OK;
-}
-
-/* IEnumPins */
-static HRESULT WINAPI
-Fixed_IEnumPins_Clone(IEnumPins *iface, IEnumPins **pins)
-{
-    PE_Impl *This = (PE_Impl *)iface;
-    TRACE("(%p)->(%p) index = %u\n", This, pins, This->index);
-    if (!pins)
-        return E_POINTER;
-    *pins = pinsenum_create(This->filter, This->pins, This->numPins);
-    if (!*pins)
-        return E_OUTOFMEMORY;
-    ((PE_Impl *)*pins)->index = This->index;
-    return S_OK;
-}
-
-
-/* Virtual tables and constructor */
-
-static const IEnumPinsVtbl IEnumPins_VTable =
-{
-    Fixed_IEnumPins_QueryInterface,
-    Fixed_IEnumPins_AddRef,
-    Fixed_IEnumPins_Release,
-    Fixed_IEnumPins_Next,
-    Fixed_IEnumPins_Skip,
-    Fixed_IEnumPins_Reset,
-    Fixed_IEnumPins_Clone,
-};
-
-static IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount)
-{
-    ULONG len = sizeof(PE_Impl) + (pinCount * sizeof(IPin *));
-    PE_Impl *obj = CoTaskMemAlloc(len);
-    if (obj) {
-        ULONG i;
-        ZeroMemory(obj, len);
-        obj->pe.lpVtbl = &IEnumPins_VTable;
-        obj->refCount = 1;
-        obj->filter = filter;
-        obj->numPins = pinCount;
-        obj->index = 0;
-        for (i=0; i<pinCount; i++)
-            obj->pins[i] = pins[i];
-        IBaseFilter_AddRef(filter);
-    }
-    return &obj->pe;
-}
-
-
 /* Single media type enumerator */
 typedef struct _ME_Impl {
     IEnumMediaTypes me;
@@ -353,22 +202,16 @@ static inline SG_Pin *impl_from_IPin(IPin *iface)
 /* Sample Grabber filter implementation */
 typedef struct _SG_Impl {
     IUnknown IUnknown_inner;
-    IBaseFilter IBaseFilter_iface;
+    BaseFilter filter;
     ISampleGrabber ISampleGrabber_iface;
-    IMemInputPin IMemInputPin_iface;
     /* IMediaSeeking and IMediaPosition are implemented by ISeekingPassThru */
     IUnknown* seekthru_unk;
-    /* TODO: IQualityControl */
     IUnknown *outer_unk;
-    LONG ref;
-    CRITICAL_SECTION critSect;
-    FILTER_INFO info;
-    FILTER_STATE state;
     AM_MEDIA_TYPE mtype;
     SG_Pin pin_in;
     SG_Pin pin_out;
+    IMemInputPin IMemInputPin_iface;
     IMemAllocator *allocator;
-    IReferenceClock *refClock;
     IMemInputPin *memOutput;
     ISampleGrabberCB *grabberIface;
     LONG grabberMethod;
@@ -388,9 +231,14 @@ static inline SG_Impl *impl_from_IUnknown(IUnknown *iface)
     return CONTAINING_RECORD(iface, SG_Impl, IUnknown_inner);
 }
 
+static inline SG_Impl *impl_from_BaseFilter(BaseFilter *iface)
+{
+    return CONTAINING_RECORD(iface, SG_Impl, filter);
+}
+
 static inline SG_Impl *impl_from_IBaseFilter(IBaseFilter *iface)
 {
-    return CONTAINING_RECORD(iface, SG_Impl, IBaseFilter_iface);
+    return CONTAINING_RECORD(iface, SG_Impl, filter.IBaseFilter_iface);
 }
 
 static inline SG_Impl *impl_from_ISampleGrabber(ISampleGrabber *iface)
@@ -408,12 +256,10 @@ static inline SG_Impl *impl_from_IMemInputPin(IMemInputPin *iface)
 static void SampleGrabber_cleanup(SG_Impl *This)
 {
     TRACE("(%p)\n", This);
-    if (This->info.pGraph)
-       WARN("(%p) still joined to filter graph %p\n", This, This->info.pGraph);
+    if (This->filter.filterInfo.pGraph)
+        WARN("(%p) still joined to filter graph %p\n", This, This->filter.filterInfo.pGraph);
     if (This->allocator)
         IMemAllocator_Release(This->allocator);
-    if (This->refClock)
-       IReferenceClock_Release(This->refClock);
     if (This->memOutput)
         IMemInputPin_Release(This->memOutput);
     if (This->grabberIface)
@@ -424,8 +270,6 @@ static void SampleGrabber_cleanup(SG_Impl *This)
         CoTaskMemFree(This->bufferData);
     if(This->seekthru_unk)
         IUnknown_Release(This->seekthru_unk);
-    This->critSect.DebugInfo->Spare[0] = 0;
-    DeleteCriticalSection(&This->critSect);
 }
 
 /* SampleGrabber inner IUnknown */
@@ -440,17 +284,13 @@ static HRESULT WINAPI SampleGrabber_QueryInterface(IUnknown *iface, REFIID riid,
         *ppv = &This->IUnknown_inner;
     else if (IsEqualIID(riid, &IID_IPersist) || IsEqualIID(riid, &IID_IMediaFilter) ||
         IsEqualIID(riid, &IID_IBaseFilter))
-        *ppv = &This->IBaseFilter_iface;
+        *ppv = &This->filter.IBaseFilter_iface;
     else if (IsEqualIID(riid, &IID_ISampleGrabber))
         *ppv = &This->ISampleGrabber_iface;
-    else if (IsEqualIID(riid, &IID_IMemInputPin))
-        *ppv = &This->IMemInputPin_iface;
     else if (IsEqualIID(riid, &IID_IMediaPosition))
         return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
     else if (IsEqualIID(riid, &IID_IMediaSeeking))
         return IUnknown_QueryInterface(This->seekthru_unk, riid, ppv);
-    else if (IsEqualIID(riid, &IID_IQualityControl))
-        FIXME("IQualityControl not implemented\n");
     else
         WARN("(%p, %s,%p): not found\n", This, debugstr_guid(riid), ppv);
 
@@ -464,9 +304,9 @@ static HRESULT WINAPI SampleGrabber_QueryInterface(IUnknown *iface, REFIID riid,
 static ULONG WINAPI SampleGrabber_AddRef(IUnknown *iface)
 {
     SG_Impl *This = impl_from_IUnknown(iface);
-    ULONG ref = InterlockedIncrement(&This->ref);
+    ULONG ref = BaseFilterImpl_AddRef(&This->filter.IBaseFilter_iface);
 
-    TRACE("(%p) new ref = %u\n", This, ref);
+    TRACE("(%p) ref=%d\n", This, ref);
 
     return ref;
 }
@@ -474,9 +314,9 @@ static ULONG WINAPI SampleGrabber_AddRef(IUnknown *iface)
 static ULONG WINAPI SampleGrabber_Release(IUnknown *iface)
 {
     SG_Impl *This = impl_from_IUnknown(iface);
-    ULONG ref = InterlockedDecrement(&This->ref);
+    ULONG ref = BaseFilterImpl_Release(&This->filter.IBaseFilter_iface);
 
-    TRACE("(%p) new ref = %u\n", This, ref);
+    TRACE("(%p) ref=%d\n", This, ref);
 
     if (ref == 0)
     {
@@ -494,6 +334,32 @@ static const IUnknownVtbl samplegrabber_vtbl =
     SampleGrabber_Release,
 };
 
+static IPin *WINAPI SampleGrabber_GetPin(BaseFilter *iface, int pos)
+{
+    SG_Impl *This = impl_from_BaseFilter(iface);
+    IPin *pin;
+
+    if (pos == 0)
+        pin = &This->pin_in.IPin_iface;
+    else if (pos == 1)
+        pin = &This->pin_out.IPin_iface;
+    else
+        return NULL;
+
+    IPin_AddRef(pin);
+    return pin;
+}
+
+static LONG WINAPI SampleGrabber_GetPinCount(BaseFilter *iface)
+{
+    return 2;
+}
+
+static const BaseFilterFuncTable basefunc_vtbl = {
+    SampleGrabber_GetPin,
+    SampleGrabber_GetPinCount
+};
+
 /* Helper that buffers data and/or calls installed sample callbacks */
 static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
 {
@@ -505,7 +371,7 @@ static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
         if (size >= 0 && SUCCEEDED(IMediaSample_GetPointer(sample, &data))) {
             if (!data)
                 size = 0;
-            EnterCriticalSection(&This->critSect);
+            EnterCriticalSection(&This->filter.csFilter);
             if (This->bufferLen != size) {
                 if (This->bufferData)
                     CoTaskMemFree(This->bufferData);
@@ -514,7 +380,7 @@ static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
             }
             if (size)
                 CopyMemory(This->bufferData, data, size);
-            LeaveCriticalSection(&This->critSect);
+            LeaveCriticalSection(&This->filter.csFilter);
         }
     }
     if (!This->grabberIface)
@@ -580,24 +446,13 @@ SampleGrabber_IBaseFilter_Release(IBaseFilter *iface)
     return IUnknown_Release(This->outer_unk);
 }
 
-/* IPersist */
-static HRESULT WINAPI
-SampleGrabber_IBaseFilter_GetClassID(IBaseFilter *iface, CLSID *pClassID)
-{
-    TRACE("(%p)\n", pClassID);
-    if (!pClassID)
-        return E_POINTER;
-    *pClassID = CLSID_SampleGrabber;
-    return S_OK;
-}
-
 /* IMediaFilter */
 static HRESULT WINAPI
 SampleGrabber_IBaseFilter_Stop(IBaseFilter *iface)
 {
     SG_Impl *This = impl_from_IBaseFilter(iface);
     TRACE("(%p)\n", This);
-    This->state = State_Stopped;
+    This->filter.state = State_Stopped;
     return S_OK;
 }
 
@@ -607,7 +462,7 @@ SampleGrabber_IBaseFilter_Pause(IBaseFilter *iface)
 {
     SG_Impl *This = impl_from_IBaseFilter(iface);
     TRACE("(%p)\n", This);
-    This->state = State_Paused;
+    This->filter.state = State_Paused;
     return S_OK;
 }
 
@@ -617,68 +472,10 @@ SampleGrabber_IBaseFilter_Run(IBaseFilter *iface, REFERENCE_TIME tStart)
 {
     SG_Impl *This = impl_from_IBaseFilter(iface);
     TRACE("(%p)\n", This);
-    This->state = State_Running;
-    return S_OK;
-}
-
-/* IMediaFilter */
-static HRESULT WINAPI
-SampleGrabber_IBaseFilter_GetState(IBaseFilter *iface, DWORD msTout, FILTER_STATE *state)
-{
-    SG_Impl *This = impl_from_IBaseFilter(iface);
-    TRACE("(%p)->(%u, %p)\n", This, msTout, state);
-    if (!state)
-        return E_POINTER;
-    *state = This->state;
-    return S_OK;
-}
-
-/* IMediaFilter */
-static HRESULT WINAPI
-SampleGrabber_IBaseFilter_SetSyncSource(IBaseFilter *iface, IReferenceClock *clock)
-{
-    SG_Impl *This = impl_from_IBaseFilter(iface);
-    TRACE("(%p)->(%p)\n", This, clock);
-    if (clock != This->refClock)
-    {
-       if (clock)
-           IReferenceClock_AddRef(clock);
-       if (This->refClock)
-           IReferenceClock_Release(This->refClock);
-       This->refClock = clock;
-    }
-    return S_OK;
-}
-
-/* IMediaFilter */
-static HRESULT WINAPI
-SampleGrabber_IBaseFilter_GetSyncSource(IBaseFilter *iface, IReferenceClock **clock)
-{
-    SG_Impl *This = impl_from_IBaseFilter(iface);
-    TRACE("(%p)->(%p)\n", This, clock);
-    if (!clock)
-        return E_POINTER;
-    if (This->refClock)
-       IReferenceClock_AddRef(This->refClock);
-    *clock = This->refClock;
+    This->filter.state = State_Running;
     return S_OK;
 }
 
-/* IBaseFilter */
-static HRESULT WINAPI
-SampleGrabber_IBaseFilter_EnumPins(IBaseFilter *iface, IEnumPins **pins)
-{
-    SG_Impl *This = impl_from_IBaseFilter(iface);
-    IPin *pin[2];
-    TRACE("(%p)->(%p)\n", This, pins);
-    if (!pins)
-        return E_POINTER;
-    pin[0] = &This->pin_in.IPin_iface;
-    pin[1] = &This->pin_out.IPin_iface;
-    *pins = pinsenum_create(iface, pin, 2);
-    return *pins ? S_OK : E_OUTOFMEMORY;
-}
-
 /* IBaseFilter */
 static HRESULT WINAPI
 SampleGrabber_IBaseFilter_FindPin(IBaseFilter *iface, LPCWSTR id, IPin **pin)
@@ -703,30 +500,17 @@ SampleGrabber_IBaseFilter_FindPin(IBaseFilter *iface, LPCWSTR id, IPin **pin)
     return VFW_E_NOT_FOUND;
 }
 
-/* IBaseFilter */
-static HRESULT WINAPI
-SampleGrabber_IBaseFilter_QueryFilterInfo(IBaseFilter *iface, FILTER_INFO *info)
-{
-    SG_Impl *This = impl_from_IBaseFilter(iface);
-    TRACE("(%p)->(%p)\n", This, info);
-    if (!info)
-        return E_POINTER;
-    if (This->info.pGraph)
-       IFilterGraph_AddRef(This->info.pGraph);
-    *info = This->info;
-    return S_OK;
-}
-
 /* IBaseFilter */
 static HRESULT WINAPI
 SampleGrabber_IBaseFilter_JoinFilterGraph(IBaseFilter *iface, IFilterGraph *graph, LPCWSTR name)
 {
     SG_Impl *This = impl_from_IBaseFilter(iface);
+
     TRACE("(%p)->(%p, %s)\n", This, graph, debugstr_w(name));
-    This->info.pGraph = graph;
-    if (name)
-       lstrcpynW(This->info.achName,name,MAX_FILTER_NAME);
+
+    BaseFilterImpl_JoinFilterGraph(iface, graph, name);
     This->oneShot = OneShot_None;
+
     return S_OK;
 }
 
@@ -828,14 +612,14 @@ SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL buffer
 {
     SG_Impl *This = impl_from_ISampleGrabber(iface);
     TRACE("(%p)->(%u)\n", This, bufferEm);
-    EnterCriticalSection(&This->critSect);
+    EnterCriticalSection(&This->filter.csFilter);
     if (bufferEm) {
         if (This->bufferLen < 0)
             This->bufferLen = 0;
     }
     else
         This->bufferLen = -1;
-    LeaveCriticalSection(&This->critSect);
+    LeaveCriticalSection(&This->filter.csFilter);
     return S_OK;
 }
 
@@ -848,7 +632,7 @@ SampleGrabber_ISampleGrabber_GetCurrentBuffer(ISampleGrabber *iface, LONG *bufSi
     TRACE("(%p)->(%p, %p)\n", This, bufSize, buffer);
     if (!bufSize)
         return E_POINTER;
-    EnterCriticalSection(&This->critSect);
+    EnterCriticalSection(&This->filter.csFilter);
     if (!This->pin_in.pair)
         ret = VFW_E_NOT_CONNECTED;
     else if (This->bufferLen < 0)
@@ -864,7 +648,7 @@ SampleGrabber_ISampleGrabber_GetCurrentBuffer(ISampleGrabber *iface, LONG *bufSi
         }
         *bufSize = This->bufferLen;
     }
-    LeaveCriticalSection(&This->critSect);
+    LeaveCriticalSection(&This->filter.csFilter);
     return ret;
 }
 
@@ -970,7 +754,7 @@ SampleGrabber_IMemInputPin_Receive(IMemInputPin *iface, IMediaSample *sample)
     TRACE("(%p)->(%p) output = %p, grabber = %p\n", This, sample, This->memOutput, This->grabberIface);
     if (!sample)
         return E_POINTER;
-    if ((This->state != State_Running) || (This->oneShot == OneShot_Past))
+    if ((This->filter.state != State_Running) || (This->oneShot == OneShot_Past))
         return S_FALSE;
     SampleGrabber_callback(This, sample);
     hr = This->memOutput ? IMemInputPin_Receive(This->memOutput, sample) : S_OK;
@@ -992,7 +776,7 @@ SampleGrabber_IMemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **s
     TRACE("(%p)->(%p, %u, %p) output = %p, grabber = %p\n", This, samples, nSamples, nProcessed, This->memOutput, This->grabberIface);
     if (!samples || !nProcessed)
         return E_POINTER;
-    if ((This->state != State_Running) || (This->oneShot == OneShot_Past))
+    if ((This->filter.state != State_Running) || (This->oneShot == OneShot_Past))
         return S_FALSE;
     for (idx = 0; idx < nSamples; idx++)
         SampleGrabber_callback(This, samples[idx]);
@@ -1072,7 +856,7 @@ SampleGrabber_Out_IPin_Connect(IPin *iface, IPin *receiver, const AM_MEDIA_TYPE
         return E_POINTER;
     if (This->pair)
         return VFW_E_ALREADY_CONNECTED;
-    if (This->sg->state != State_Stopped)
+    if (This->sg->filter.state != State_Stopped)
         return VFW_E_NOT_STOPPED;
     if (type) {
        TRACE("Media type: %s/%s ssize: %u format: %s (%u bytes)\n",
@@ -1120,7 +904,7 @@ SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_M
         return E_POINTER;
     if (This->pair)
         return VFW_E_ALREADY_CONNECTED;
-    if (This->sg->state != State_Stopped)
+    if (This->sg->filter.state != State_Stopped)
         return VFW_E_NOT_STOPPED;
     if (type) {
        TRACE("Media type: %s/%s ssize: %u format: %s (%u bytes)\n",
@@ -1172,7 +956,7 @@ SampleGrabber_In_IPin_Disconnect(IPin *iface)
     SG_Pin *This = impl_from_IPin(iface);
 
     TRACE("(%p)->() pair = %p\n", This, This->pair);
-    if (This->sg->state != State_Stopped)
+    if (This->sg->filter.state != State_Stopped)
         return VFW_E_NOT_STOPPED;
     if (This->pair) {
         This->pair = NULL;
@@ -1188,7 +972,7 @@ SampleGrabber_Out_IPin_Disconnect(IPin *iface)
     SG_Pin *This = impl_from_IPin(iface);
 
     TRACE("(%p)->() pair = %p\n", This, This->pair);
-    if (This->sg->state != State_Stopped)
+    if (This->sg->filter.state != State_Stopped)
         return VFW_E_NOT_STOPPED;
     if (This->pair) {
         This->pair = NULL;
@@ -1246,8 +1030,8 @@ SampleGrabber_IPin_QueryPinInfo(IPin *iface, PIN_INFO *info)
     TRACE("(%p)->(%p)\n", This, info);
     if (!info)
         return E_POINTER;
-    IBaseFilter_AddRef(&This->sg->IBaseFilter_iface);
-    info->pFilter = &This->sg->IBaseFilter_iface;
+    info->pFilter = &This->sg->filter.IBaseFilter_iface;
+    IBaseFilter_AddRef(info->pFilter);
     info->dir = This->dir;
     lstrcpynW(info->achName,This->name,MAX_PIN_NAME);
     return S_OK;
@@ -1374,16 +1158,16 @@ static const IBaseFilterVtbl IBaseFilter_VTable =
     SampleGrabber_IBaseFilter_QueryInterface,
     SampleGrabber_IBaseFilter_AddRef,
     SampleGrabber_IBaseFilter_Release,
-    SampleGrabber_IBaseFilter_GetClassID,
+    BaseFilterImpl_GetClassID,
     SampleGrabber_IBaseFilter_Stop,
     SampleGrabber_IBaseFilter_Pause,
     SampleGrabber_IBaseFilter_Run,
-    SampleGrabber_IBaseFilter_GetState,
-    SampleGrabber_IBaseFilter_SetSyncSource,
-    SampleGrabber_IBaseFilter_GetSyncSource,
-    SampleGrabber_IBaseFilter_EnumPins,
+    BaseFilterImpl_GetState,
+    BaseFilterImpl_SetSyncSource,
+    BaseFilterImpl_GetSyncSource,
+    BaseFilterImpl_EnumPins,
     SampleGrabber_IBaseFilter_FindPin,
-    SampleGrabber_IBaseFilter_QueryFilterInfo,
+    BaseFilterImpl_QueryFilterInfo,
     SampleGrabber_IBaseFilter_JoinFilterGraph,
     SampleGrabber_IBaseFilter_QueryVendorInfo,
 };
@@ -1474,9 +1258,9 @@ HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv)
     }
     ZeroMemory(obj, sizeof(SG_Impl));
 
-    obj->ref = 1;
+    BaseFilter_Init(&obj->filter, &IBaseFilter_VTable, &CLSID_SampleGrabber,
+            (DWORD_PTR)(__FILE__ ": SG_Impl.csFilter"), &basefunc_vtbl);
     obj->IUnknown_inner.lpVtbl = &samplegrabber_vtbl;
-    obj->IBaseFilter_iface.lpVtbl = &IBaseFilter_VTable;
     obj->ISampleGrabber_iface.lpVtbl = &ISampleGrabber_VTable;
     obj->IMemInputPin_iface.lpVtbl = &IMemInputPin_VTable;
     obj->pin_in.IPin_iface.lpVtbl = &IPin_In_VTable;
@@ -1489,16 +1273,10 @@ HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv)
     obj->pin_out.name = pin_out_name;
     obj->pin_out.sg = obj;
     obj->pin_out.pair = NULL;
-    InitializeCriticalSection(&obj->critSect);
-    obj->critSect.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SG_Impl.critSect");
-    obj->info.achName[0] = 0;
-    obj->info.pGraph = NULL;
-    obj->state = State_Stopped;
     obj->mtype.majortype = GUID_NULL;
     obj->mtype.subtype = MEDIASUBTYPE_None;
     obj->mtype.formattype = FORMAT_None;
     obj->allocator = NULL;
-    obj->refClock = NULL;
     obj->memOutput = NULL;
     obj->grabberIface = NULL;
     obj->grabberMethod = -1;
index 2d30dd2..3519c78 100644 (file)
@@ -9,7 +9,7 @@
  * Copyright 2006 Ivan Gyurdiev
  * Copyright 2006 Jason Green
  * Copyright 2006 Henri Verbeet
- * Copyright 2007-2011, 2013 Stefan Dösinger for CodeWeavers
+ * Copyright 2007-2011, 2013-2014 Stefan Dösinger for CodeWeavers
  * Copyright 2009 Henri Verbeet for CodeWeavers
  *
  * This library is free software; you can redistribute it and/or
@@ -1786,6 +1786,11 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins)
 
 static void shader_hw_nop(const struct wined3d_shader_instruction *ins) {}
 
+static DWORD shader_arb_select_component(DWORD swizzle, DWORD component)
+{
+    return ((swizzle >> 2 * component) & 0x3) * 0x55;
+}
+
 static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
 {
     const struct wined3d_shader *shader = ins->ctx->shader;
@@ -1856,7 +1861,7 @@ static void shader_hw_mov(const struct wined3d_shader_instruction *ins)
              * with more than one component. Thus replicate the first source argument over all
              * 4 components. For example, .xyzw -> .x (or better: .xxxx), .zwxy -> .z, etc) */
             struct wined3d_shader_src_param tmp_src = ins->src[0];
-            tmp_src.swizzle = (tmp_src.swizzle & 0x3) * 0x55;
+            tmp_src.swizzle = shader_arb_select_component(tmp_src.swizzle, 0);
             shader_arb_get_src_param(ins, &tmp_src, 0, src0_param);
             shader_addline(buffer, "ARL A0.x, %s;\n", src0_param);
         }
@@ -2466,30 +2471,36 @@ static void shader_hw_mnxn(const struct wined3d_shader_instruction *ins)
     }
 }
 
-static void shader_hw_rcp(const struct wined3d_shader_instruction *ins)
+static DWORD abs_modifier(DWORD mod, BOOL *need_abs)
 {
-    struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
-
-    char dst[50];
-    char src[50];
+    *need_abs = FALSE;
 
-    shader_arb_get_dst_param(ins, &ins->dst[0], dst); /* Destination */
-    shader_arb_get_src_param(ins, &ins->src[0], 0, src);
-    if (ins->src[0].swizzle == WINED3DSP_NOSWIZZLE)
+    switch(mod)
     {
-        /* Dx sdk says .x is used if no swizzle is given, but our test shows that
-         * .w is used
-         */
-        strcat(src, ".w");
+        case WINED3DSPSM_NONE:      return WINED3DSPSM_ABS;
+        case WINED3DSPSM_NEG:       return WINED3DSPSM_ABS;
+        case WINED3DSPSM_BIAS:      *need_abs = TRUE; return WINED3DSPSM_BIAS;
+        case WINED3DSPSM_BIASNEG:   *need_abs = TRUE; return WINED3DSPSM_BIASNEG;
+        case WINED3DSPSM_SIGN:      *need_abs = TRUE; return WINED3DSPSM_SIGN;
+        case WINED3DSPSM_SIGNNEG:   *need_abs = TRUE; return WINED3DSPSM_SIGNNEG;
+        case WINED3DSPSM_COMP:      *need_abs = TRUE; return WINED3DSPSM_COMP;
+        case WINED3DSPSM_X2:        *need_abs = TRUE; return WINED3DSPSM_X2;
+        case WINED3DSPSM_X2NEG:     *need_abs = TRUE; return WINED3DSPSM_X2NEG;
+        case WINED3DSPSM_DZ:        *need_abs = TRUE; return WINED3DSPSM_DZ;
+        case WINED3DSPSM_DW:        *need_abs = TRUE; return WINED3DSPSM_DW;
+        case WINED3DSPSM_ABS:       return WINED3DSPSM_ABS;
+        case WINED3DSPSM_ABSNEG:    return WINED3DSPSM_ABS;
     }
-
-    shader_addline(buffer, "RCP%s %s, %s;\n", shader_arb_get_modifier(ins), dst, src);
+    FIXME("Unknown modifier %u\n", mod);
+    return mod;
 }
 
 static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins)
 {
     struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
     const char *instruction;
+    struct wined3d_shader_src_param src0_copy = ins->src[0];
+    BOOL need_abs = FALSE;
 
     char dst[50];
     char src[50];
@@ -2498,24 +2509,46 @@ static void shader_hw_scalar_op(const struct wined3d_shader_instruction *ins)
     {
         case WINED3DSIH_RSQ:  instruction = "RSQ"; break;
         case WINED3DSIH_RCP:  instruction = "RCP"; break;
-        case WINED3DSIH_EXP:  instruction = "EX2"; break;
-        case WINED3DSIH_EXPP: instruction = "EXP"; break;
+        case WINED3DSIH_EXPP:
+            if (ins->ctx->reg_maps->shader_version.major < 2)
+            {
+                instruction = "EXP";
+                break;
+            }
+            /* Drop through. */
+        case WINED3DSIH_EXP:
+            instruction = "EX2";
+            break;
+        case WINED3DSIH_LOG:
+        case WINED3DSIH_LOGP:
+            /* The precision requirements suggest that LOGP matches ARBvp's LOG
+             * instruction, but notice that the output of those instructions is
+             * different. */
+            src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs);
+            instruction = "LG2";
+            break;
         default: instruction = "";
             FIXME("Unhandled opcode %#x\n", ins->handler_idx);
             break;
     }
 
+    /* Dx sdk says .x is used if no swizzle is given, but our test shows that
+     * .w is used. */
+    src0_copy.swizzle = shader_arb_select_component(src0_copy.swizzle, 3);
+
     shader_arb_get_dst_param(ins, &ins->dst[0], dst); /* Destination */
-    shader_arb_get_src_param(ins, &ins->src[0], 0, src);
-    if (ins->src[0].swizzle == WINED3DSP_NOSWIZZLE)
+    shader_arb_get_src_param(ins, &src0_copy, 0, src);
+
+    if(need_abs)
     {
-        /* Dx sdk says .x is used if no swizzle is given, but our test shows that
-         * .w is used
-         */
-        strcat(src, ".w");
+        shader_addline(buffer, "ABS TA.w, %s;\n", src);
+        shader_addline(buffer, "%s%s %s, TA.w;\n", instruction, shader_arb_get_modifier(ins), dst);
+    }
+    else
+    {
+        shader_addline(buffer, "%s%s %s, %s;\n", instruction, shader_arb_get_modifier(ins), dst, src);
     }
 
-    shader_addline(buffer, "%s%s %s, %s;\n", instruction, shader_arb_get_modifier(ins), dst, src);
 }
 
 static void shader_hw_nrm(const struct wined3d_shader_instruction *ins)
@@ -2755,64 +2788,6 @@ static void shader_hw_dsy(const struct wined3d_shader_instruction *ins)
     shader_addline(buffer, "MUL%s %s, %s, ycorrection.y;\n", shader_arb_get_modifier(ins), dst, dst_name);
 }
 
-static DWORD abs_modifier(DWORD mod, BOOL *need_abs)
-{
-    *need_abs = FALSE;
-
-    switch(mod)
-    {
-        case WINED3DSPSM_NONE:      return WINED3DSPSM_ABS;
-        case WINED3DSPSM_NEG:       return WINED3DSPSM_ABS;
-        case WINED3DSPSM_BIAS:      *need_abs = TRUE; return WINED3DSPSM_BIAS;
-        case WINED3DSPSM_BIASNEG:   *need_abs = TRUE; return WINED3DSPSM_BIASNEG;
-        case WINED3DSPSM_SIGN:      *need_abs = TRUE; return WINED3DSPSM_SIGN;
-        case WINED3DSPSM_SIGNNEG:   *need_abs = TRUE; return WINED3DSPSM_SIGNNEG;
-        case WINED3DSPSM_COMP:      *need_abs = TRUE; return WINED3DSPSM_COMP;
-        case WINED3DSPSM_X2:        *need_abs = TRUE; return WINED3DSPSM_X2;
-        case WINED3DSPSM_X2NEG:     *need_abs = TRUE; return WINED3DSPSM_X2NEG;
-        case WINED3DSPSM_DZ:        *need_abs = TRUE; return WINED3DSPSM_DZ;
-        case WINED3DSPSM_DW:        *need_abs = TRUE; return WINED3DSPSM_DW;
-        case WINED3DSPSM_ABS:       return WINED3DSPSM_ABS;
-        case WINED3DSPSM_ABSNEG:    return WINED3DSPSM_ABS;
-    }
-    FIXME("Unknown modifier %u\n", mod);
-    return mod;
-}
-
-static void shader_hw_log(const struct wined3d_shader_instruction *ins)
-{
-    struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
-    char src0[50], dst[50];
-    struct wined3d_shader_src_param src0_copy = ins->src[0];
-    BOOL need_abs = FALSE;
-    const char *instr;
-
-    switch(ins->handler_idx)
-    {
-        case WINED3DSIH_LOG:  instr = "LG2"; break;
-        case WINED3DSIH_LOGP: instr = "LOG"; break;
-        default:
-            ERR("Unexpected instruction %d\n", ins->handler_idx);
-            return;
-    }
-
-    /* LOG and LOGP operate on the absolute value of the input */
-    src0_copy.modifiers = abs_modifier(src0_copy.modifiers, &need_abs);
-
-    shader_arb_get_dst_param(ins, &ins->dst[0], dst);
-    shader_arb_get_src_param(ins, &src0_copy, 0, src0);
-
-    if(need_abs)
-    {
-        shader_addline(buffer, "ABS TA, %s;\n", src0);
-        shader_addline(buffer, "%s%s %s, TA;\n", instr, shader_arb_get_modifier(ins), dst);
-    }
-    else
-    {
-        shader_addline(buffer, "%s%s %s, %s;\n", instr, shader_arb_get_modifier(ins), dst, src0);
-    }
-}
-
 static void shader_hw_pow(const struct wined3d_shader_instruction *ins)
 {
     struct wined3d_shader_buffer *buffer = ins->ctx->buffer;
@@ -5046,8 +5021,12 @@ static BOOL shader_arb_allocate_context_data(struct wined3d_context *context)
 
 static void shader_arb_free_context_data(struct wined3d_context *context)
 {
-    struct shader_arb_priv *priv = context->swapchain->device->shader_priv;
+    struct shader_arb_priv *priv;
+
+    if (!context->swapchain)
+        return;
 
+    priv = context->swapchain->device->shader_priv;
     if (priv->last_context == context)
         priv->last_context = NULL;
 }
@@ -5233,8 +5212,8 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
     /* WINED3DSIH_LABEL                 */ shader_hw_label,
     /* WINED3DSIH_LD                    */ NULL,
     /* WINED3DSIH_LIT                   */ shader_hw_map2gl,
-    /* WINED3DSIH_LOG                   */ shader_hw_log,
-    /* WINED3DSIH_LOGP                  */ shader_hw_log,
+    /* WINED3DSIH_LOG                   */ shader_hw_scalar_op,
+    /* WINED3DSIH_LOGP                  */ shader_hw_scalar_op,
     /* WINED3DSIH_LOOP                  */ shader_hw_loop,
     /* WINED3DSIH_LRP                   */ shader_hw_lrp,
     /* WINED3DSIH_LT                    */ NULL,
@@ -5254,7 +5233,7 @@ static const SHADER_HANDLER shader_arb_instruction_handler_table[WINED3DSIH_TABL
     /* WINED3DSIH_NRM                   */ shader_hw_nrm,
     /* WINED3DSIH_PHASE                 */ shader_hw_nop,
     /* WINED3DSIH_POW                   */ shader_hw_pow,
-    /* WINED3DSIH_RCP                   */ shader_hw_rcp,
+    /* WINED3DSIH_RCP                   */ shader_hw_scalar_op,
     /* WINED3DSIH_REP                   */ shader_hw_rep,
     /* WINED3DSIH_RET                   */ shader_hw_ret,
     /* WINED3DSIH_ROUND_NI              */ NULL,
@@ -6762,21 +6741,72 @@ const struct fragment_pipeline arbfp_fragment_pipeline = {
     arbfp_fragmentstate_template,
 };
 
-struct arbfp_blit_priv {
-    GLenum yuy2_rect_shader, yuy2_2d_shader;
-    GLenum uyvy_rect_shader, uyvy_2d_shader;
-    GLenum yv12_rect_shader, yv12_2d_shader;
-    GLenum p8_rect_shader, p8_2d_shader;
+struct arbfp_blit_type
+{
+    enum complex_fixup fixup;
+    GLenum textype;
+};
+
+struct arbfp_blit_desc
+{
+    GLenum shader;
+    struct arbfp_blit_type type;
+    struct wine_rb_entry entry;
+};
+
+struct arbfp_blit_priv
+{
+    struct wine_rb_tree shaders;
     GLuint palette_texture;
 };
 
+static int arbfp_blit_type_compare(const void *key, const struct wine_rb_entry *entry)
+{
+    const struct arbfp_blit_type *ka = key;
+    const struct arbfp_blit_type *kb = &WINE_RB_ENTRY_VALUE(entry, const struct arbfp_blit_desc, entry)->type;
+
+    if (ka->fixup != kb->fixup)
+        return ka->fixup < kb->fixup ? -1 : 1;
+    if (ka->textype != kb->textype)
+        return ka->textype < kb->textype ? -1 : 1;
+    return 0;
+}
+
+/* Context activation is done by the caller. */
+static void arbfp_free_blit_shader(struct wine_rb_entry *entry, void *context)
+{
+    const struct wined3d_gl_info *gl_info = context;
+    struct arbfp_blit_desc *entry_arb = WINE_RB_ENTRY_VALUE(entry, struct arbfp_blit_desc, entry);
+
+    GL_EXTCALL(glDeleteProgramsARB(1, &entry_arb->shader));
+    checkGLcall("glDeleteProgramsARB(1, &entry_arb->shader)");
+    HeapFree(GetProcessHeap(), 0, entry_arb);
+}
+
+const struct wine_rb_functions wined3d_arbfp_blit_rb_functions =
+{
+    wined3d_rb_alloc,
+    wined3d_rb_realloc,
+    wined3d_rb_free,
+    arbfp_blit_type_compare,
+};
+
 static HRESULT arbfp_blit_alloc(struct wined3d_device *device)
 {
-    device->blit_priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct arbfp_blit_priv));
-    if(!device->blit_priv) {
-        ERR("Out of memory\n");
+    struct arbfp_blit_priv *priv;
+
+    if (!(priv = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*priv))))
+        return E_OUTOFMEMORY;
+
+    if (wine_rb_init(&priv->shaders, &wined3d_arbfp_blit_rb_functions) == -1)
+    {
+        ERR("Failed to initialize rbtree.\n");
+        HeapFree(GetProcessHeap(), 0, priv);
         return E_OUTOFMEMORY;
     }
+
+    device->blit_priv = priv;
+
     return WINED3D_OK;
 }
 
@@ -6786,15 +6816,8 @@ static void arbfp_blit_free(struct wined3d_device *device)
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
     struct arbfp_blit_priv *priv = device->blit_priv;
 
-    GL_EXTCALL(glDeleteProgramsARB(1, &priv->yuy2_rect_shader));
-    GL_EXTCALL(glDeleteProgramsARB(1, &priv->yuy2_2d_shader));
-    GL_EXTCALL(glDeleteProgramsARB(1, &priv->uyvy_rect_shader));
-    GL_EXTCALL(glDeleteProgramsARB(1, &priv->uyvy_2d_shader));
-    GL_EXTCALL(glDeleteProgramsARB(1, &priv->yv12_rect_shader));
-    GL_EXTCALL(glDeleteProgramsARB(1, &priv->yv12_2d_shader));
-    GL_EXTCALL(glDeleteProgramsARB(1, &priv->p8_rect_shader));
-    GL_EXTCALL(glDeleteProgramsARB(1, &priv->p8_2d_shader));
-    checkGLcall("Delete yuv and p8 programs");
+    wine_rb_destroy(&priv->shaders, arbfp_free_blit_shader, &device->adapter->gl_info);
+    checkGLcall("Delete blit programs");
 
     if (priv->palette_texture)
         gl_info->gl_ops.gl.p_glDeleteTextures(1, &priv->palette_texture);
@@ -6926,11 +6949,11 @@ static BOOL gen_yv12_read(struct wined3d_shader_buffer *buffer, GLenum textype,
      *        |                                  |
      *        +----------------+-----------------+----
      *        |                |                 |
-     *        |  U even rows   |  U odd rows     |
+     *        |  V even rows   |  V odd rows     |
      *        |                |                 |   1
      *        +----------------+------------------   -
      *        |                |                 |   3
-     *        |  V even rows   |  V odd rows     |
+     *        |  U even rows   |  U odd rows     |
      *        |                |                 |
      *        +----------------+-----------------+----
      *        |                |                 |
@@ -6997,7 +7020,7 @@ static BOOL gen_yv12_read(struct wined3d_shader_buffer *buffer, GLenum textype,
         shader_addline(buffer, "MAD temp.y, size.y, coef.w, size.y;\n");
         shader_addline(buffer, "ADD temp.y, temp.y, -coef.y;\n");
         shader_addline(buffer, "MIN texcrd.y, temp.y, texcrd.y;\n");
-        shader_addline(buffer, "ADD temp.y, size.y, -coef.y;\n");
+        shader_addline(buffer, "ADD temp.y, size.y, coef.y;\n");
         shader_addline(buffer, "MAX texcrd.y, temp.y, texcrd.y;\n");
     }
     /* Read the texture, put the result into the output register */
@@ -7040,6 +7063,154 @@ static BOOL gen_yv12_read(struct wined3d_shader_buffer *buffer, GLenum textype,
     return TRUE;
 }
 
+static BOOL gen_nv12_read(struct wined3d_shader_buffer *buffer, GLenum textype,
+        char *luminance)
+{
+    const char *tex;
+    static const float nv12_coef[]
+            = {2.0f / 3.0f, 1.0f / 3.0f, 1.0f, 1.0f};
+
+    switch (textype)
+    {
+        case GL_TEXTURE_2D:
+            tex = "2D";
+            break;
+        case GL_TEXTURE_RECTANGLE_ARB:
+            tex = "RECT";
+            break;
+        default:
+            FIXME("Implement nv12 correction for non-2d, non-rect textures\n");
+            return FALSE;
+    }
+
+    /* NV12 surfaces contain a WxH sized luminance plane, followed by a (W/2)x(H/2)
+     * sized plane where each component is an UV pair. So the effective
+     * bitdepth is 12 bits per pixel If the whole texture is interpreted as luminance
+     * data it looks approximately like this:
+     *
+     *        +----------------------------------+----
+     *        |                                  |
+     *        |                                  |
+     *        |                                  |
+     *        |                                  |
+     *        |                                  |   2
+     *        |            LUMINANCE             |   -
+     *        |                                  |   3
+     *        |                                  |
+     *        |                                  |
+     *        |                                  |
+     *        |                                  |
+     *        +----------------------------------+----
+     *        |UVUVUVUVUVUVUVUVUVUVUVUVUVUVUVUVUV|
+     *        |UVUVUVUVUVUVUVUVUVUVUVUVUVUVUVUVUV|
+     *        |                                  |   1
+     *        |                                  |   -
+     *        |                                  |   3
+     *        |                                  |
+     *        |                                  |
+     *        +----------------------------------+----
+     *
+     * When reading from rectangle textures, keep in mind that the input y coordinates
+     * go from 0 to d3d_height, whereas the opengl texture height is 1.5 * d3d_height. */
+
+    shader_addline(buffer, "PARAM nv12_coef = ");
+    shader_arb_append_imm_vec4(buffer, nv12_coef);
+    shader_addline(buffer, ";\n");
+
+    shader_addline(buffer, "MOV texcrd, fragment.texcoord[0];\n");
+    /* We only have half the number of chroma pixels. */
+    shader_addline(buffer, "MUL texcrd.x, texcrd.x, coef.y;\n");
+
+    if (textype == GL_TEXTURE_2D)
+    {
+        shader_addline(buffer, "RCP chroma.w, size.x;\n");
+        shader_addline(buffer, "RCP chroma.z, size.y;\n");
+
+        shader_addline(buffer, "MAD texcrd.y, texcrd.y, nv12_coef.y, nv12_coef.x;\n");
+
+        /* We must not allow filtering horizontally, this would mix U and V.
+         * Vertical filtering is ok. However, bear in mind that the pixel center is at
+         * 0.5, so add 0.5. */
+
+        /* Convert to non-normalized coordinates so we can find the
+         * individual pixel. */
+        shader_addline(buffer, "MUL texcrd.x, texcrd.x, size.x;\n");
+        shader_addline(buffer, "FLR texcrd.x, texcrd.x;\n");
+        /* Multiply by 2 since chroma components are stored in UV pixel pairs,
+         * add 0.5 to hit the center of the pixel. */
+        shader_addline(buffer, "MAD texcrd.x, texcrd.x, coef.z, coef.y;\n");
+
+        /* Convert back to normalized coordinates. */
+        shader_addline(buffer, "MUL texcrd.x, texcrd.x, chroma.w;\n");
+
+        /* Clamp, keep the half pixel origin in mind. */
+        shader_addline(buffer, "MAD temp.y, coef.y, chroma.z, nv12_coef.x;\n");
+        shader_addline(buffer, "MAX texcrd.y, temp.y, texcrd.y;\n");
+        shader_addline(buffer, "MAD temp.y, -coef.y, chroma.z, nv12_coef.z;\n");
+        shader_addline(buffer, "MIN texcrd.y, temp.y, texcrd.y;\n");
+    }
+    else
+    {
+        /* Read from [size - size+size/2] */
+        shader_addline(buffer, "MAD texcrd.y, texcrd.y, coef.y, size.y;\n");
+
+        shader_addline(buffer, "FLR texcrd.x, texcrd.x;\n");
+        /* Multiply by 2 since chroma components are stored in UV pixel pairs,
+         * add 0.5 to hit the center of the pixel. */
+        shader_addline(buffer, "MAD texcrd.x, texcrd.x, coef.z, coef.y;\n");
+
+        /* Clamp */
+        shader_addline(buffer, "MAD temp.y, size.y, coef.y, size.y;\n");
+        shader_addline(buffer, "ADD temp.y, temp.y, -coef.y;\n");
+        shader_addline(buffer, "MIN texcrd.y, temp.y, texcrd.y;\n");
+        shader_addline(buffer, "ADD temp.y, size.y, coef.y;\n");
+        shader_addline(buffer, "MAX texcrd.y, temp.y, texcrd.y;\n");
+    }
+    /* Read the texture, put the result into the output register. */
+    shader_addline(buffer, "TEX temp, texcrd, texture[0], %s;\n", tex);
+    shader_addline(buffer, "MOV chroma.y, temp.w;\n");
+
+    if (textype == GL_TEXTURE_2D)
+    {
+        /* Add 1/size.x */
+        shader_addline(buffer, "ADD texcrd.x, texcrd.x, chroma.w;\n");
+    }
+    else
+    {
+        /* Add 1 */
+        shader_addline(buffer, "ADD texcrd.x, texcrd.x, coef.x;\n");
+    }
+    shader_addline(buffer, "TEX temp, texcrd, texture[0], %s;\n", tex);
+    shader_addline(buffer, "MOV chroma.x, temp.w;\n");
+
+    /* Sample the luminance value. It is in the top 2/3rd of the texture, so scale the y coordinate.
+     * Clamp the y coordinate to prevent the chroma values from bleeding into the sampled luminance
+     * values due to filtering. */
+    shader_addline(buffer, "MOV texcrd, fragment.texcoord[0];\n");
+    if (textype == GL_TEXTURE_2D)
+    {
+        /* Multiply the y coordinate by 2/3 and clamp it */
+        shader_addline(buffer, "MUL texcrd.y, texcrd.y, nv12_coef.x;\n");
+        shader_addline(buffer, "MAD temp.y, -coef.y, chroma.w, nv12_coef.x;\n");
+        shader_addline(buffer, "MIN texcrd.y, temp.y, texcrd.y;\n");
+        shader_addline(buffer, "TEX luminance, texcrd, texture[0], %s;\n", tex);
+    }
+    else
+    {
+        /* Reading from texture_rectangles is pretty straightforward, just use the unmodified
+         * texture coordinate. It is still a good idea to clamp it though, since the opengl texture
+         * is bigger
+         */
+        shader_addline(buffer, "ADD temp.x, size.y, -coef.y;\n");
+        shader_addline(buffer, "MIN texcrd.y, texcrd.y, size.x;\n");
+        shader_addline(buffer, "TEX luminance, texcrd, texture[0], %s;\n", tex);
+    }
+    *luminance = 'a';
+
+    return TRUE;
+}
+
+/* Context activation is done by the caller. */
 static GLuint gen_p8_shader(struct arbfp_blit_priv *priv,
         const struct wined3d_gl_info *gl_info, GLenum textype)
 {
@@ -7093,11 +7264,6 @@ static GLuint gen_p8_shader(struct arbfp_blit_priv *priv,
         shader_arb_dump_program_source(buffer.buffer);
     }
 
-    if (textype == GL_TEXTURE_RECTANGLE_ARB)
-        priv->p8_rect_shader = shader;
-    else
-        priv->p8_2d_shader = shader;
-
     shader_buffer_free(&buffer);
 
     return shader;
@@ -7224,6 +7390,14 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_
             }
             break;
 
+        case COMPLEX_FIXUP_NV12:
+            if (!gen_nv12_read(&buffer, textype, &luminance_component))
+            {
+                shader_buffer_free(&buffer);
+                return 0;
+            }
+            break;
+
         default:
             FIXME("Unsupported YUV fixup %#x\n", yuv_fixup);
             shader_buffer_free(&buffer);
@@ -7264,26 +7438,6 @@ static GLuint gen_yuv_shader(struct arbfp_blit_priv *priv, const struct wined3d_
 
     shader_buffer_free(&buffer);
 
-    switch (yuv_fixup)
-    {
-        case COMPLEX_FIXUP_YUY2:
-            if (textype == GL_TEXTURE_RECTANGLE_ARB) priv->yuy2_rect_shader = shader;
-            else priv->yuy2_2d_shader = shader;
-            break;
-
-        case COMPLEX_FIXUP_UYVY:
-            if (textype == GL_TEXTURE_RECTANGLE_ARB) priv->uyvy_rect_shader = shader;
-            else priv->uyvy_2d_shader = shader;
-            break;
-
-        case COMPLEX_FIXUP_YV12:
-            if (textype == GL_TEXTURE_RECTANGLE_ARB) priv->yv12_rect_shader = shader;
-            else priv->yv12_2d_shader = shader;
-            break;
-        default:
-            ERR("Unsupported complex fixup: %d\n", yuv_fixup);
-    }
-
     return shader;
 }
 
@@ -7296,6 +7450,9 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context,
     enum complex_fixup fixup;
     const struct wined3d_gl_info *gl_info = context->gl_info;
     GLenum textype = surface->container->target;
+    struct wine_rb_entry *entry;
+    struct arbfp_blit_type type;
+    struct arbfp_blit_desc *desc;
 
     if (surface->flags & SFLAG_CONVERTED)
     {
@@ -7316,35 +7473,57 @@ static HRESULT arbfp_blit_set(void *blit_priv, struct wined3d_context *context,
 
     fixup = get_complex_fixup(surface->resource.format->color_fixup);
 
-    switch(fixup)
+    type.fixup = fixup;
+    type.textype = textype;
+    entry = wine_rb_get(&priv->shaders, &type);
+    if (entry)
     {
-        case COMPLEX_FIXUP_YUY2:
-            shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->yuy2_rect_shader : priv->yuy2_2d_shader;
-            break;
-
-        case COMPLEX_FIXUP_UYVY:
-            shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->uyvy_rect_shader : priv->uyvy_2d_shader;
-            break;
-
-        case COMPLEX_FIXUP_YV12:
-            shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->yv12_rect_shader : priv->yv12_2d_shader;
-            break;
-
-        case COMPLEX_FIXUP_P8:
-            shader = textype == GL_TEXTURE_RECTANGLE_ARB ? priv->p8_rect_shader : priv->p8_2d_shader;
-            if (!shader) shader = gen_p8_shader(priv, gl_info, textype);
+        desc = WINE_RB_ENTRY_VALUE(entry, struct arbfp_blit_desc, entry);
+        shader = desc->shader;
+    }
+    else
+    {
+        switch (fixup)
+        {
+            case COMPLEX_FIXUP_P8:
+                shader = gen_p8_shader(priv, gl_info, textype);
+                break;
 
-            upload_palette(surface, context);
-            break;
+            default:
+                shader = gen_yuv_shader(priv, gl_info, fixup, textype);
+                break;
+        }
 
-        default:
+        if (!shader)
+        {
             FIXME("Unsupported complex fixup %#x, not setting a shader\n", fixup);
             gl_info->gl_ops.gl.p_glEnable(textype);
             checkGLcall("glEnable(textype)");
             return E_NOTIMPL;
+        }
+
+        desc = HeapAlloc(GetProcessHeap(), 0, sizeof(*desc));
+        if (!desc)
+            goto err_out;
+
+        desc->type.textype = textype;
+        desc->type.fixup = fixup;
+        desc->shader = shader;
+        if (wine_rb_put(&priv->shaders, &desc->type, &desc->entry) == -1)
+        {
+err_out:
+            ERR("Out of memory\n");
+            GL_EXTCALL(glDeleteProgramsARB(1, &shader));
+            checkGLcall("GL_EXTCALL(glDeleteProgramsARB(1, &shader))");
+            GL_EXTCALL(glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0));
+            checkGLcall("glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, 0)");
+            HeapFree(GetProcessHeap(), 0, desc);
+            return E_OUTOFMEMORY;
+        }
     }
 
-    if (!shader) shader = gen_yuv_shader(priv, gl_info, fixup, textype);
+    if (fixup == COMPLEX_FIXUP_P8)
+        upload_palette(surface, context);
 
     gl_info->gl_ops.gl.p_glEnable(GL_FRAGMENT_PROGRAM_ARB);
     checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB)");
@@ -7424,6 +7603,7 @@ static BOOL arbfp_blit_supported(const struct wined3d_gl_info *gl_info, enum win
         case COMPLEX_FIXUP_YUY2:
         case COMPLEX_FIXUP_UYVY:
         case COMPLEX_FIXUP_YV12:
+        case COMPLEX_FIXUP_NV12:
         case COMPLEX_FIXUP_P8:
             TRACE("[OK]\n");
             return TRUE;
index 6a6fbcf..2bffe83 100644 (file)
@@ -941,13 +941,20 @@ struct wined3d_resource * CDECL wined3d_buffer_get_resource(struct wined3d_buffe
 
 HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UINT size, BYTE **data, DWORD flags)
 {
-    BOOL dirty = buffer_is_dirty(buffer);
     LONG count;
     BYTE *base;
 
     TRACE("buffer %p, offset %u, size %u, data %p, flags %#x\n", buffer, offset, size, data, flags);
 
     flags = wined3d_resource_sanitize_map_flags(&buffer->resource, flags);
+    /* Filter redundant WINED3D_MAP_DISCARD maps. The 3DMark2001 multitexture
+     * fill rate test seems to depend on this. When we map a buffer with
+     * GL_MAP_INVALIDATE_BUFFER_BIT, the driver is free to discard the
+     * previous contents of the buffer. The r600g driver only does this when
+     * the buffer is currently in use, while the proprietary NVIDIA driver
+     * appears to do this unconditionally. */
+    if (buffer->flags & WINED3D_BUFFER_DISCARD)
+        flags &= ~WINED3D_MAP_DISCARD;
     count = ++buffer->resource.map_count;
 
     if (buffer->buffer_object)
@@ -1023,25 +1030,14 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
                 context_release(context);
             }
         }
-        else
-        {
-            if (dirty)
-            {
-                if (buffer->flags & WINED3D_BUFFER_NOSYNC && !(flags & WINED3D_MAP_NOOVERWRITE))
-                {
-                    buffer->flags &= ~WINED3D_BUFFER_NOSYNC;
-                }
-            }
-            else if(flags & WINED3D_MAP_NOOVERWRITE)
-            {
-                buffer->flags |= WINED3D_BUFFER_NOSYNC;
-            }
 
-            if (flags & WINED3D_MAP_DISCARD)
-            {
-                buffer->flags |= WINED3D_BUFFER_DISCARD;
-            }
-        }
+        if (flags & WINED3D_MAP_DISCARD)
+            buffer->flags |= WINED3D_BUFFER_DISCARD;
+
+        if (!(flags & WINED3D_MAP_NOOVERWRITE))
+            buffer->flags &= ~WINED3D_BUFFER_NOSYNC;
+        else if (!buffer_is_dirty(buffer))
+            buffer->flags |= WINED3D_BUFFER_NOSYNC;
     }
 
     base = buffer->map_ptr ? buffer->map_ptr : buffer->resource.heap_memory;
@@ -1114,6 +1110,7 @@ void CDECL wined3d_buffer_unmap(struct wined3d_buffer *buffer)
         context_release(context);
 
         buffer_clear_dirty_areas(buffer);
+        buffer->map_ptr = NULL;
     }
     else if (buffer->flags & WINED3D_BUFFER_HASDESC)
     {
index b9afbe1..a8d3033 100644 (file)
@@ -606,6 +606,53 @@ void context_free_event_query(struct wined3d_event_query *query)
     context->free_event_queries[context->free_event_query_count++] = query->object;
 }
 
+/* Context activation is done by the caller. */
+void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query)
+{
+    const struct wined3d_gl_info *gl_info = context->gl_info;
+
+    if (context->free_timestamp_query_count)
+    {
+        query->id = context->free_timestamp_queries[--context->free_timestamp_query_count];
+    }
+    else
+    {
+        GL_EXTCALL(glGenQueriesARB(1, &query->id));
+        checkGLcall("glGenQueriesARB");
+
+        TRACE("Allocated timestamp query %u in context %p.\n", query->id, context);
+    }
+
+    query->context = context;
+    list_add_head(&context->timestamp_queries, &query->entry);
+}
+
+void context_free_timestamp_query(struct wined3d_timestamp_query *query)
+{
+    struct wined3d_context *context = query->context;
+
+    list_remove(&query->entry);
+    query->context = NULL;
+
+    if (context->free_timestamp_query_count >= context->free_timestamp_query_size - 1)
+    {
+        UINT new_size = context->free_timestamp_query_size << 1;
+        GLuint *new_data = HeapReAlloc(GetProcessHeap(), 0, context->free_timestamp_queries,
+                new_size * sizeof(*context->free_timestamp_queries));
+
+        if (!new_data)
+        {
+            ERR("Failed to grow free list, leaking query %u in context %p.\n", query->id, context);
+            return;
+        }
+
+        context->free_timestamp_query_size = new_size;
+        context->free_timestamp_queries = new_data;
+    }
+
+    context->free_timestamp_queries[context->free_timestamp_query_count++] = query->id;
+}
+
 typedef void (context_fbo_entry_func_t)(struct wined3d_context *context, struct fbo_entry *entry);
 
 static void context_enum_surface_fbo_entries(const struct wined3d_device *device,
@@ -711,11 +758,47 @@ void context_surface_update(struct wined3d_context *context, const struct wined3
     }
 }
 
-static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC dc, int format)
+static BOOL context_restore_pixel_format(struct wined3d_context *ctx)
+{
+    const struct wined3d_gl_info *gl_info = ctx->gl_info;
+    BOOL ret = FALSE;
+
+    if (ctx->restore_pf && IsWindow(ctx->restore_pf_win))
+    {
+        if (ctx->gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH])
+        {
+            HDC dc = GetDC(ctx->restore_pf_win);
+            if (dc)
+            {
+                if (!(ret = GL_EXTCALL(wglSetPixelFormatWINE(dc, ctx->restore_pf))))
+                {
+                    ERR("wglSetPixelFormatWINE failed to restore pixel format %d on window %p.\n",
+                            ctx->restore_pf, ctx->restore_pf_win);
+                }
+                ReleaseDC(ctx->restore_pf_win, dc);
+            }
+        }
+        else
+        {
+            ERR("can't restore pixel format %d on window %p\n", ctx->restore_pf, ctx->restore_pf_win);
+        }
+    }
+
+    ctx->restore_pf = 0;
+    ctx->restore_pf_win = NULL;
+    return ret;
+}
+
+static BOOL context_set_pixel_format(struct wined3d_context *context, HDC dc, BOOL private, int format)
 {
-    int current = GetPixelFormat(dc);
+    const struct wined3d_gl_info *gl_info = context->gl_info;
+    int current;
 
-    if (current == format) return TRUE;
+    if (dc == context->hdc && context->hdc_is_private && context->hdc_has_format)
+        return TRUE;
+
+    current = GetPixelFormat(dc);
+    if (current == format) goto success;
 
     if (!current)
     {
@@ -726,7 +809,10 @@ static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC
                     format, dc, GetLastError());
             return FALSE;
         }
-        return TRUE;
+
+        context->restore_pf = 0;
+        context->restore_pf_win = private ? NULL : WindowFromDC(dc);
+        goto success;
     }
 
     /* By default WGL doesn't allow pixel format adjustments but we need it
@@ -735,13 +821,25 @@ static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC
      * when really needed. */
     if (gl_info->supported[WGL_WINE_PIXEL_FORMAT_PASSTHROUGH])
     {
+        HWND win;
+
         if (!GL_EXTCALL(wglSetPixelFormatWINE(dc, format)))
         {
             ERR("wglSetPixelFormatWINE failed to set pixel format %d on device context %p.\n",
                     format, dc);
             return FALSE;
         }
-        return TRUE;
+
+        win = private ? NULL : WindowFromDC(dc);
+        if (win != context->restore_pf_win)
+        {
+            context_restore_pixel_format(context);
+
+            context->restore_pf = private ? 0 : current;
+            context->restore_pf_win = win;
+        }
+
+        goto success;
     }
 
     /* OpenGL doesn't allow pixel format adjustments. Print an error and
@@ -751,6 +849,11 @@ static BOOL context_set_pixel_format(const struct wined3d_gl_info *gl_info, HDC
     ERR("Unable to set pixel format %d on device context %p. Already using format %d.\n",
             format, dc, current);
     return TRUE;
+
+success:
+    if (dc == context->hdc && context->hdc_is_private)
+        context->hdc_has_format = TRUE;
+    return TRUE;
 }
 
 static BOOL context_set_gl_context(struct wined3d_context *ctx)
@@ -758,7 +861,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx)
     struct wined3d_swapchain *swapchain = ctx->swapchain;
     BOOL backup = FALSE;
 
-    if (!context_set_pixel_format(ctx->gl_info, ctx->hdc, ctx->pixel_format))
+    if (!context_set_pixel_format(ctx, ctx->hdc, ctx->hdc_is_private, ctx->pixel_format))
     {
         WARN("Failed to set pixel format %d on device context %p.\n",
                 ctx->pixel_format, ctx->hdc);
@@ -791,7 +894,7 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx)
             return FALSE;
         }
 
-        if (!context_set_pixel_format(ctx->gl_info, dc, ctx->pixel_format))
+        if (!context_set_pixel_format(ctx, dc, TRUE, ctx->pixel_format))
         {
             ERR("Failed to set pixel format %d on device context %p.\n",
                     ctx->pixel_format, dc);
@@ -809,18 +912,12 @@ static BOOL context_set_gl_context(struct wined3d_context *ctx)
 
         ctx->valid = 1;
     }
+    ctx->needs_set = 0;
     return TRUE;
 }
 
-static void context_restore_gl_context(const struct wined3d_gl_info *gl_info, HDC dc, HGLRC gl_ctx, int pf)
+static void context_restore_gl_context(const struct wined3d_gl_info *gl_info, HDC dc, HGLRC gl_ctx)
 {
-    if (!context_set_pixel_format(gl_info, dc, pf))
-    {
-        ERR("Failed to restore pixel format %d on device context %p.\n", pf, dc);
-        context_set_current(NULL);
-        return;
-    }
-
     if (!wglMakeCurrent(dc, gl_ctx))
     {
         ERR("Failed to restore GL context %p on device context %p, last error %#x.\n",
@@ -837,53 +934,47 @@ static void context_update_window(struct wined3d_context *context)
     TRACE("Updating context %p window from %p to %p.\n",
             context, context->win_handle, context->swapchain->win_handle);
 
-    if (context->valid)
+    if (context->hdc)
         wined3d_release_dc(context->win_handle, context->hdc);
-    else
-        context->valid = 1;
 
     context->win_handle = context->swapchain->win_handle;
+    context->hdc_is_private = FALSE;
+    context->hdc_has_format = FALSE;
+    context->needs_set = 1;
+    context->valid = 1;
 
     if (!(context->hdc = GetDC(context->win_handle)))
     {
         ERR("Failed to get a device context for window %p.\n", context->win_handle);
-        goto err;
+        context->valid = 0;
     }
-
-    if (!context_set_pixel_format(context->gl_info, context->hdc, context->pixel_format))
-    {
-        ERR("Failed to set pixel format %d on device context %p.\n",
-                context->pixel_format, context->hdc);
-        goto err;
-    }
-
-    context_set_gl_context(context);
-
-    return;
-
-err:
-    context->valid = 0;
 }
 
 static void context_destroy_gl_resources(struct wined3d_context *context)
 {
     const struct wined3d_gl_info *gl_info = context->gl_info;
+    struct wined3d_timestamp_query *timestamp_query;
     struct wined3d_occlusion_query *occlusion_query;
     struct wined3d_event_query *event_query;
     struct fbo_entry *entry, *entry2;
     HGLRC restore_ctx;
     HDC restore_dc;
     unsigned int i;
-    int restore_pf;
 
     restore_ctx = wglGetCurrentContext();
     restore_dc = wglGetCurrentDC();
-    restore_pf = GetPixelFormat(restore_dc);
 
-    if (context->valid && restore_ctx != context->glCtx)
-        context_set_gl_context(context);
-    else
+    if (restore_ctx == context->glCtx)
         restore_ctx = NULL;
+    else if (context->valid)
+        context_set_gl_context(context);
+
+    LIST_FOR_EACH_ENTRY(timestamp_query, &context->timestamp_queries, struct wined3d_timestamp_query, entry)
+    {
+        if (context->valid)
+            GL_EXTCALL(glDeleteQueriesARB(1, &timestamp_query->id));
+        timestamp_query->context = NULL;
+    }
 
     LIST_FOR_EACH_ENTRY(occlusion_query, &context->occlusion_queries, struct wined3d_occlusion_query, entry)
     {
@@ -925,6 +1016,9 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
             GL_EXTCALL(glDeleteProgramsARB(1, &context->dummy_arbfp_prog));
         }
 
+        if (gl_info->supported[ARB_TIMER_QUERY])
+            GL_EXTCALL(glDeleteQueriesARB(context->free_timestamp_query_count, context->free_timestamp_queries));
+
         if (gl_info->supported[ARB_OCCLUSION_QUERY])
             GL_EXTCALL(glDeleteQueriesARB(context->free_occlusion_query_count, context->free_occlusion_queries));
 
@@ -953,12 +1047,14 @@ static void context_destroy_gl_resources(struct wined3d_context *context)
         checkGLcall("context cleanup");
     }
 
+    HeapFree(GetProcessHeap(), 0, context->free_timestamp_queries);
     HeapFree(GetProcessHeap(), 0, context->free_occlusion_queries);
     HeapFree(GetProcessHeap(), 0, context->free_event_queries);
 
+    context_restore_pixel_format(context);
     if (restore_ctx)
     {
-        context_restore_gl_context(gl_info, restore_dc, restore_ctx, restore_pf);
+        context_restore_gl_context(gl_info, restore_dc, restore_ctx);
     }
     else if (wglGetCurrentContext() && !wglMakeCurrent(NULL, NULL))
     {
@@ -1054,12 +1150,17 @@ void context_release(struct wined3d_context *context)
             WARN("Context %p is not the current context.\n", context);
     }
 
-    if (!--context->level && context->restore_ctx)
+    if (!--context->level)
     {
-        TRACE("Restoring GL context %p on device context %p.\n", context->restore_ctx, context->restore_dc);
-        context_restore_gl_context(context->gl_info, context->restore_dc, context->restore_ctx, context->restore_pf);
-        context->restore_ctx = NULL;
-        context->restore_dc = NULL;
+        if (context_restore_pixel_format(context))
+            context->needs_set = 1;
+        if (context->restore_ctx)
+        {
+            TRACE("Restoring GL context %p on device context %p.\n", context->restore_ctx, context->restore_dc);
+            context_restore_gl_context(context->gl_info, context->restore_dc, context->restore_ctx);
+            context->restore_ctx = NULL;
+            context->restore_dc = NULL;
+        }
     }
 }
 
@@ -1078,8 +1179,11 @@ static void context_enter(struct wined3d_context *context)
                     current_gl, wglGetCurrentDC());
             context->restore_ctx = current_gl;
             context->restore_dc = wglGetCurrentDC();
-            context->restore_pf = GetPixelFormat(context->restore_dc);
+            context->needs_set = 1;
         }
+        else if (!context->needs_set && !(context->hdc_is_private && context->hdc_has_format)
+                    && context->pixel_format != GetPixelFormat(context->hdc))
+            context->needs_set = 1;
     }
 }
 
@@ -1287,6 +1391,7 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     int swap_interval;
     DWORD state;
     HDC hdc;
+    BOOL hdc_is_private = FALSE;
 
     TRACE("swapchain %p, target %p, window %p.\n", swapchain, target, swapchain->win_handle);
 
@@ -1304,6 +1409,13 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     if (!ret->draw_buffers)
         goto out;
 
+    ret->free_timestamp_query_size = 4;
+    ret->free_timestamp_queries = HeapAlloc(GetProcessHeap(), 0,
+            ret->free_timestamp_query_size * sizeof(*ret->free_timestamp_queries));
+    if (!ret->free_timestamp_queries)
+        goto out;
+    list_init(&ret->timestamp_queries);
+
     ret->free_occlusion_query_size = 4;
     ret->free_occlusion_queries = HeapAlloc(GetProcessHeap(), 0,
             ret->free_occlusion_query_size * sizeof(*ret->free_occlusion_queries));
@@ -1347,7 +1459,9 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     {
         WARN("Failed to retireve device context, trying swapchain backup.\n");
 
-        if (!(hdc = swapchain_get_backup_dc(swapchain)))
+        if ((hdc = swapchain_get_backup_dc(swapchain)))
+            hdc_is_private = TRUE;
+        else
         {
             ERR("Failed to retrieve a device context.\n");
             goto out;
@@ -1396,7 +1510,9 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
 
     context_enter(ret);
 
-    if (!context_set_pixel_format(gl_info, hdc, pixel_format))
+    ret->gl_info = gl_info;
+
+    if (!context_set_pixel_format(ret, hdc, hdc_is_private, pixel_format))
     {
         ERR("Failed to set pixel format %d on device context %p.\n", pixel_format, hdc);
         context_release(ret);
@@ -1451,7 +1567,6 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
         goto out;
     }
 
-    ret->gl_info = gl_info;
     ret->d3d_info = &device->adapter->d3d_info;
     ret->state_table = device->StateTable;
 
@@ -1474,7 +1589,10 @@ struct wined3d_context *context_create(struct wined3d_swapchain *swapchain,
     ret->glCtx = ctx;
     ret->win_handle = swapchain->win_handle;
     ret->hdc = hdc;
+    ret->hdc_is_private = hdc_is_private;
+    ret->hdc_has_format = TRUE;
     ret->pixel_format = pixel_format;
+    ret->needs_set = 1;
 
     /* Set up the context defaults */
     if (!context_set_current(ret))
@@ -1640,6 +1758,7 @@ out:
     device->shader_backend->shader_free_context_data(ret);
     HeapFree(GetProcessHeap(), 0, ret->free_event_queries);
     HeapFree(GetProcessHeap(), 0, ret->free_occlusion_queries);
+    HeapFree(GetProcessHeap(), 0, ret->free_timestamp_queries);
     HeapFree(GetProcessHeap(), 0, ret->draw_buffers);
     HeapFree(GetProcessHeap(), 0, ret->blit_targets);
     HeapFree(GetProcessHeap(), 0, ret);
@@ -2992,9 +3111,9 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str
             context = swapchain_get_context(device->swapchains[0]);
     }
 
+    context_enter(context);
     context_update_window(context);
     context_setup_target(context, target);
-    context_enter(context);
     if (!context->valid) return context;
 
     if (context != current_context)
@@ -3002,7 +3121,7 @@ struct wined3d_context *context_acquire(const struct wined3d_device *device, str
         if (!context_set_current(context))
             ERR("Failed to activate the new context.\n");
     }
-    else if (context->restore_ctx)
+    else if (context->needs_set)
     {
         context_set_gl_context(context);
     }
index 338a3e1..f85cf98 100644 (file)
@@ -937,5 +937,6 @@ void wined3d_cs_destroy(struct wined3d_cs *cs)
 {
     state_cleanup(&cs->state);
     HeapFree(GetProcessHeap(), 0, cs->fb.render_targets);
+    HeapFree(GetProcessHeap(), 0, cs->data);
     HeapFree(GetProcessHeap(), 0, cs);
 }
index 7e60fe3..37d9acb 100644 (file)
@@ -1008,9 +1008,6 @@ HRESULT CDECL wined3d_device_uninit_3d(struct wined3d_device *device)
     if (!device->d3d_initialized)
         return WINED3DERR_INVALIDCALL;
 
-    /* Force making the context current again, to verify it is still valid
-     * (workaround for broken drivers) */
-    context_set_current(NULL);
     /* I don't think that the interface guarantees that the device is destroyed from the same thread
      * it was created. Thus make sure a context is active for the glDelete* calls
      */
@@ -4129,7 +4126,19 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
     }
 
     if (reset_state)
+    {
+        if (device->logo_texture)
+        {
+            wined3d_texture_decref(device->logo_texture);
+            device->logo_texture = NULL;
+        }
+        if (device->cursor_texture)
+        {
+            wined3d_texture_decref(device->cursor_texture);
+            device->cursor_texture = NULL;
+        }
         state_unbind_resources(&device->state);
+    }
 
     if (device->fb.render_targets)
     {
index ffdcc66..4ecbf6e 100644 (file)
@@ -50,6 +50,7 @@ enum wined3d_display_driver
     DRIVER_NVIDIA_GEFORCE2MX,
     DRIVER_NVIDIA_GEFORCEFX,
     DRIVER_NVIDIA_GEFORCE6,
+    DRIVER_VMWARE,
     DRIVER_UNKNOWN
 };
 
@@ -66,7 +67,6 @@ enum wined3d_gl_vendor
     GL_VENDOR_UNKNOWN,
     GL_VENDOR_APPLE,
     GL_VENDOR_FGLRX,
-    GL_VENDOR_INTEL,
     GL_VENDOR_MESA,
     GL_VENDOR_NVIDIA,
 };
@@ -91,6 +91,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
     {"GL_APPLE_ycbcr_422",                  APPLE_YCBCR_422               },
 
     /* ARB */
+    {"GL_ARB_blend_func_extended",          ARB_BLEND_FUNC_EXTENDED       },
     {"GL_ARB_color_buffer_float",           ARB_COLOR_BUFFER_FLOAT        },
     {"GL_ARB_debug_output",                 ARB_DEBUG_OUTPUT              },
     {"GL_ARB_depth_buffer_float",           ARB_DEPTH_BUFFER_FLOAT        },
@@ -136,6 +137,7 @@ static const struct wined3d_extension_map gl_extension_map[] =
     {"GL_ARB_texture_non_power_of_two",     ARB_TEXTURE_NON_POWER_OF_TWO  },
     {"GL_ARB_texture_rectangle",            ARB_TEXTURE_RECTANGLE         },
     {"GL_ARB_texture_rg",                   ARB_TEXTURE_RG                },
+    {"GL_ARB_timer_query",                  ARB_TIMER_QUERY               },
     {"GL_ARB_vertex_array_bgra",            ARB_VERTEX_ARRAY_BGRA         },
     {"GL_ARB_vertex_blend",                 ARB_VERTEX_BLEND              },
     {"GL_ARB_vertex_buffer_object",         ARB_VERTEX_BUFFER_OBJECT      },
@@ -601,7 +603,7 @@ static BOOL match_dx10_capable(const struct wined3d_gl_info *gl_info, const char
     /* DX9 cards support 40 single float varyings in hardware, most drivers report 32. ATI misreports
      * 44 varyings. So assume that if we have more than 44 varyings we have a dx10 card.
      * This detection is for the gl_ClipPos varying quirk. If a d3d9 card really supports more than 44
-     * varyings and we subtract one in dx9 shaders its not going to hurt us because the dx9 limit is
+     * varyings and we subtract one in dx9 shaders it's not going to hurt us because the dx9 limit is
      * hardcoded
      *
      * dx10 cards usually have 64 varyings */
@@ -1166,6 +1168,9 @@ static const struct driver_version_information driver_version_table[] =
     {DRIVER_NVIDIA_GEFORCEFX,   DRIVER_MODEL_NT5X,  "nv4_disp.dll", 14, 11, 7516},
     {DRIVER_NVIDIA_GEFORCE6,    DRIVER_MODEL_NT5X,  "nv4_disp.dll", 15, 12, 6658},
     {DRIVER_NVIDIA_GEFORCE6,    DRIVER_MODEL_NT6X,  "nvd3dum.dll",  15, 12, 6658},
+
+    /* VMware */
+    {DRIVER_VMWARE,             DRIVER_MODEL_NT5X,  "vm3dum.dll",   14, 1,  1134},
 };
 
 struct gpu_description
@@ -1256,6 +1261,9 @@ static const struct gpu_description gpu_description_table[] =
     {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX670,     "NVIDIA GeForce GTX 670",           DRIVER_NVIDIA_GEFORCE6,  2048},
     {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX670MX,   "NVIDIA GeForce GTX 670MX",         DRIVER_NVIDIA_GEFORCE6,  3072},
     {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX680,     "NVIDIA GeForce GTX 680",           DRIVER_NVIDIA_GEFORCE6,  2048},
+    {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX750,     "NVIDIA GeForce GTX 750",           DRIVER_NVIDIA_GEFORCE6,  1024},
+    {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX750TI,   "NVIDIA GeForce GTX 750 Ti",        DRIVER_NVIDIA_GEFORCE6,  2048},
+    {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX760,     "NVIDIA Geforce GTX 760",           DRIVER_NVIDIA_GEFORCE6,  2048},
     {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX765M,    "NVIDIA GeForce GTX 765M",          DRIVER_NVIDIA_GEFORCE6,  2048},
     {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX770M,    "NVIDIA GeForce GTX 770M",          DRIVER_NVIDIA_GEFORCE6,  3072},
     {HW_VENDOR_NVIDIA,     CARD_NVIDIA_GEFORCE_GTX770,     "NVIDIA GeForce GTX 770",           DRIVER_NVIDIA_GEFORCE6,  2048},
@@ -1294,6 +1302,10 @@ static const struct gpu_description gpu_description_table[] =
     {HW_VENDOR_AMD,        CARD_AMD_RADEON_HD7700,         "AMD Radeon HD 7700 Series",        DRIVER_AMD_R600,         1024},
     {HW_VENDOR_AMD,        CARD_AMD_RADEON_HD7800,         "AMD Radeon HD 7800 Series",        DRIVER_AMD_R600,         2048},
     {HW_VENDOR_AMD,        CARD_AMD_RADEON_HD7900,         "AMD Radeon HD 7900 Series",        DRIVER_AMD_R600,         2048},
+
+    /* VMware */
+    {HW_VENDOR_VMWARE,     CARD_VMWARE_SVGA3D,             "VMware SVGA 3D (Microsoft Corporation - WDDM)",             DRIVER_VMWARE,        1024},
+
     /* Intel cards */
     {HW_VENDOR_INTEL,      CARD_INTEL_830M,                "Intel(R) 82830M Graphics Controller",                       DRIVER_INTEL_GMA800,  32 },
     {HW_VENDOR_INTEL,      CARD_INTEL_855GM,               "Intel(R) 82852/82855 GM/GME Graphics Controller",           DRIVER_INTEL_GMA800,  32 },
@@ -1376,7 +1388,7 @@ static void init_driver_info(struct wined3d_driver_info *driver_info,
     }
     driver_info->device = device;
 
-    /* Set a default amount of video memory (64MB). In general this code isn't used unless the user
+    /* Set a default amount of video memory (64 MB). In general this code isn't used unless the user
      * overrides the pci ids to a card which is not in our database. */
     driver_info->vidmem = WINE_DEFAULT_VIDMEM;
 
@@ -1567,20 +1579,16 @@ static enum wined3d_gl_vendor wined3d_guess_gl_vendor(const struct wined3d_gl_in
     if (strstr(gl_vendor_string, "ATI"))
         return GL_VENDOR_FGLRX;
 
-    if (strstr(gl_vendor_string, "Intel(R)")
-            /* Intel switched from Intel(R) to Intel® recently, so just match Intel. */
-            || strstr(gl_renderer, "Intel")
-            || strstr(gl_vendor_string, "Intel Inc."))
-        return GL_VENDOR_INTEL;
-
     if (strstr(gl_vendor_string, "Mesa")
             || strstr(gl_vendor_string, "X.Org")
             || strstr(gl_vendor_string, "Advanced Micro Devices, Inc.")
             || strstr(gl_vendor_string, "DRI R300 Project")
             || strstr(gl_vendor_string, "Tungsten Graphics, Inc")
             || strstr(gl_vendor_string, "VMware, Inc.")
+            || strstr(gl_vendor_string, "Intel")
             || strstr(gl_renderer, "Mesa")
-            || strstr(gl_renderer, "Gallium"))
+            || strstr(gl_renderer, "Gallium")
+            || strstr(gl_renderer, "Intel"))
         return GL_VENDOR_MESA;
 
     FIXME("Received unrecognized GL_VENDOR %s. Returning GL_VENDOR_UNKNOWN.\n",
@@ -1614,6 +1622,9 @@ static enum wined3d_pci_vendor wined3d_guess_card_vendor(const char *gl_vendor_s
             || strstr(gl_vendor_string, "Intel Inc."))
         return HW_VENDOR_INTEL;
 
+    if (strstr(gl_renderer, "SVGA3D"))
+        return HW_VENDOR_VMWARE;
+
     if (strstr(gl_vendor_string, "Mesa")
             || strstr(gl_vendor_string, "Brian Paul")
             || strstr(gl_vendor_string, "Tungsten Graphics, Inc")
@@ -1665,6 +1676,9 @@ static enum wined3d_pci_device select_card_nvidia_binary(const struct wined3d_gl
             {"GTX 770M",    CARD_NVIDIA_GEFORCE_GTX770M},   /* Geforce 700 - midend high mobile */
             {"GTX 770",     CARD_NVIDIA_GEFORCE_GTX770},    /* Geforce 700 - highend */
             {"GTX 765M",    CARD_NVIDIA_GEFORCE_GTX765M},   /* Geforce 700 - midend high mobile */
+            {"GTX 760",     CARD_NVIDIA_GEFORCE_GTX760},    /* Geforce 700 - midend high  */
+            {"GTX 750 Ti",  CARD_NVIDIA_GEFORCE_GTX750TI},  /* Geforce 700 - midend */
+            {"GTX 750",     CARD_NVIDIA_GEFORCE_GTX750},    /* Geforce 700 - midend */
             {"GTX 680",     CARD_NVIDIA_GEFORCE_GTX680},    /* Geforce 600 - highend */
             {"GTX 670MX",   CARD_NVIDIA_GEFORCE_GTX670MX},  /* Geforce 600 - highend */
             {"GTX 670",     CARD_NVIDIA_GEFORCE_GTX670},    /* Geforce 600 - midend high */
@@ -1971,7 +1985,7 @@ static enum wined3d_pci_device select_card_amd_binary(const struct wined3d_gl_in
             return CARD_AMD_RADEON_X700;
         }
 
-        /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400MHz */
+        /* Radeon Xpress Series - onboard, DX9b, Shader 2.0, 300-400 MHz */
         if (strstr(gl_renderer, "Radeon Xpress"))
         {
             return CARD_AMD_RADEON_XPRESS_200M;
@@ -2119,7 +2133,7 @@ static enum wined3d_pci_device select_card_amd_mesa(const struct wined3d_gl_info
         {"R420",        CARD_AMD_RADEON_X700},
         {"R410",        CARD_AMD_RADEON_X700},
         {"RV410",       CARD_AMD_RADEON_X700},
-        /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400MHz */
+        /* Radeon Xpress - onboard, DX9b, Shader 2.0, 300-400 MHz */
         {"RS740",       CARD_AMD_RADEON_XPRESS_200M},
         {"RS690",       CARD_AMD_RADEON_XPRESS_200M},
         {"RS600",       CARD_AMD_RADEON_XPRESS_200M},
@@ -2158,6 +2172,8 @@ static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_i
     }
     cards[] =
     {
+        /* Maxwell */
+        {"NV117",   CARD_NVIDIA_GEFORCE_GTX750},
         /* Kepler */
         {"NVE6",    CARD_NVIDIA_GEFORCE_GTX770M},
         {"NVE4",    CARD_NVIDIA_GEFORCE_GTX680},
@@ -2236,29 +2252,40 @@ static enum wined3d_pci_device select_card_nvidia_mesa(const struct wined3d_gl_i
     return PCI_DEVICE_NONE;
 }
 
+static enum wined3d_pci_device select_card_vmware(const struct wined3d_gl_info *gl_info, const char *gl_renderer)
+{
+    if (strstr(gl_renderer, "SVGA3D"))
+        return CARD_VMWARE_SVGA3D;
+
+    return PCI_DEVICE_NONE;
+}
+
 static const struct gl_vendor_selection
 {
     enum wined3d_gl_vendor gl_vendor;
     const char *description;        /* Description of the card selector i.e. Apple OS/X Intel */
     enum wined3d_pci_device (*select_card)(const struct wined3d_gl_info *gl_info, const char *gl_renderer);
 }
+amd_gl_vendor_table[] =
+{
+    {GL_VENDOR_APPLE,   "Apple OSX AMD/ATI binary driver",  select_card_amd_binary},
+    {GL_VENDOR_FGLRX,   "AMD/ATI binary driver",            select_card_amd_binary},
+    {GL_VENDOR_MESA,    "Mesa AMD/ATI driver",              select_card_amd_mesa},
+},
 nvidia_gl_vendor_table[] =
 {
-    {GL_VENDOR_NVIDIA, "Nvidia binary driver", select_card_nvidia_binary},
-    {GL_VENDOR_APPLE, "Apple OSX NVidia binary driver", select_card_nvidia_binary},
-    {GL_VENDOR_MESA, "Mesa Nouveau driver", select_card_nvidia_mesa},
+    {GL_VENDOR_APPLE,   "Apple OSX NVidia binary driver",   select_card_nvidia_binary},
+    {GL_VENDOR_MESA,    "Mesa Nouveau driver",              select_card_nvidia_mesa},
+    {GL_VENDOR_NVIDIA,  "Nvidia binary driver",             select_card_nvidia_binary},
 },
-amd_gl_vendor_table[] =
+vmware_gl_vendor_table[] =
 {
-    {GL_VENDOR_APPLE, "Apple OSX AMD/ATI binary driver", select_card_amd_binary},
-    {GL_VENDOR_FGLRX, "AMD/ATI binary driver", select_card_amd_binary},
-    {GL_VENDOR_MESA, "Mesa AMD/ATI driver", select_card_amd_mesa},
+    {GL_VENDOR_MESA,    "VMware driver",                    select_card_vmware},
 },
 intel_gl_vendor_table[] =
 {
-    {GL_VENDOR_APPLE, "Apple OSX Intel binary driver", select_card_intel},
-    {GL_VENDOR_INTEL, "Mesa Intel driver", select_card_intel},
-    {GL_VENDOR_MESA, "Mesa Intel driver", select_card_intel},
+    {GL_VENDOR_APPLE,   "Apple OSX Intel binary driver",    select_card_intel},
+    {GL_VENDOR_MESA,    "Mesa Intel driver",                select_card_intel},
 };
 
 static enum wined3d_pci_device select_card_fallback_nvidia(const struct wined3d_gl_info *gl_info)
@@ -2331,14 +2358,17 @@ static const struct
 }
 card_vendor_table[] =
 {
-    {HW_VENDOR_NVIDIA,  "Nvidia",  nvidia_gl_vendor_table,
-            sizeof(nvidia_gl_vendor_table) / sizeof(nvidia_gl_vendor_table[0]),
+    {HW_VENDOR_AMD,         "AMD",      amd_gl_vendor_table,
+            sizeof(amd_gl_vendor_table) / sizeof(*amd_gl_vendor_table),
+            select_card_fallback_amd},
+    {HW_VENDOR_NVIDIA,      "Nvidia",   nvidia_gl_vendor_table,
+            sizeof(nvidia_gl_vendor_table) / sizeof(*nvidia_gl_vendor_table),
             select_card_fallback_nvidia},
-    {HW_VENDOR_AMD,     "AMD",     amd_gl_vendor_table,
-            sizeof(amd_gl_vendor_table) / sizeof(amd_gl_vendor_table[0]),
+    {HW_VENDOR_VMWARE,      "VMware",   vmware_gl_vendor_table,
+            sizeof(vmware_gl_vendor_table) / sizeof(*vmware_gl_vendor_table),
             select_card_fallback_amd},
-    {HW_VENDOR_INTEL,   "Intel",   intel_gl_vendor_table,
-            sizeof(intel_gl_vendor_table) / sizeof(intel_gl_vendor_table[0]),
+    {HW_VENDOR_INTEL,       "Intel",    intel_gl_vendor_table,
+            sizeof(intel_gl_vendor_table) / sizeof(*intel_gl_vendor_table),
             select_card_fallback_intel},
 };
 
@@ -2937,6 +2967,15 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter)
         if (!counter_bits)
             gl_info->supported[ARB_OCCLUSION_QUERY] = FALSE;
     }
+    if (gl_info->supported[ARB_TIMER_QUERY])
+    {
+        GLint counter_bits;
+
+        GL_EXTCALL(glGetQueryivARB(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS_ARB, &counter_bits));
+        TRACE("Timestamp query counter has %d bits.\n", counter_bits);
+        if (!counter_bits)
+            gl_info->supported[ARB_TIMER_QUERY] = FALSE;
+    }
     if (!gl_info->supported[ATI_TEXTURE_MIRROR_ONCE] && gl_info->supported[EXT_TEXTURE_MIRROR_CLAMP])
     {
         TRACE(" IMPLIED: ATI_texture_mirror_once support (by EXT_texture_mirror_clamp).\n");
@@ -3411,7 +3450,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
         const char *name = adapter->driver_info.name;
         len = min(strlen(name), identifier->driver_size - 1);
         memcpy(identifier->driver, name, len);
-        identifier->driver[len] = '\0';
+        memset(&identifier->driver[len], 0, identifier->driver_size - len);
     }
 
     if (identifier->description_size)
@@ -3419,7 +3458,7 @@ HRESULT CDECL wined3d_get_adapter_identifier(const struct wined3d *wined3d,
         const char *description = adapter->driver_info.description;
         len = min(strlen(description), identifier->description_size - 1);
         memcpy(identifier->description, description, len);
-        identifier->description[len] = '\0';
+        memset(&identifier->description[len], 0, identifier->description_size - len);
     }
 
     /* Note that d3d8 doesn't supply a device name. */
@@ -3998,8 +4037,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
         enum wined3d_device_type device_type, enum wined3d_format_id display_format,
         enum wined3d_format_id backbuffer_format, BOOL windowed)
 {
-    UINT mode_count;
-    HRESULT hr;
+    BOOL present_conversion = wined3d->flags & WINED3D_PRESENT_CONVERSION;
 
     TRACE("wined3d %p, adapter_idx %u, device_type %s, display_format %s, backbuffer_format %s, windowed %#x.\n",
             wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(display_format),
@@ -4012,10 +4050,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
      * combination is available on the given adapter. In fullscreen mode microsoft specified
      * that the display format shouldn't provide alpha and that ignoring alpha the backbuffer
      * and display format should match exactly.
-     * In windowed mode format conversion can occur and this depends on the driver. When format
-     * conversion is done, this function should nevertheless fail and applications need to use
-     * CheckDeviceFormatConversion.
-     * At the moment we assume that fullscreen and windowed have the same capabilities. */
+     * In windowed mode format conversion can occur and this depends on the driver. */
 
     /* There are only 4 display formats. */
     if (!(display_format == WINED3DFMT_B5G6R5_UNORM
@@ -4027,72 +4062,88 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
         return WINED3DERR_NOTAVAILABLE;
     }
 
-    /* If the requested display format is not available, don't continue. */
-    mode_count = wined3d_get_adapter_mode_count(wined3d, adapter_idx,
-            display_format, WINED3D_SCANLINE_ORDERING_UNKNOWN);
-    if (!mode_count)
+    if (!windowed)
     {
-        TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format));
-        return WINED3DERR_NOTAVAILABLE;
-    }
+        /* If the requested display format is not available, don't continue. */
+        if (!wined3d_get_adapter_mode_count(wined3d, adapter_idx,
+                display_format, WINED3D_SCANLINE_ORDERING_UNKNOWN))
+        {
+            TRACE("No available modes for display format %s.\n", debug_d3dformat(display_format));
+            return WINED3DERR_NOTAVAILABLE;
+        }
 
-    /* Windowed mode allows you to specify WINED3DFMT_UNKNOWN for the backbuffer format,
-     * it means 'reuse' the display format for the backbuffer. */
-    if (!windowed && backbuffer_format == WINED3DFMT_UNKNOWN)
-    {
-        TRACE("backbuffer_format WINED3FMT_UNKNOWN only available in windowed mode.\n");
-        return WINED3DERR_NOTAVAILABLE;
+        present_conversion = FALSE;
     }
-
-    /* In FULLSCREEN mode WINED3DFMT_B5G6R5_UNORM can only be mixed with
-     * backbuffer format WINED3DFMT_B5G6R5_UNORM. */
-    if (display_format == WINED3DFMT_B5G6R5_UNORM && backbuffer_format != WINED3DFMT_B5G6R5_UNORM)
+    else if (display_format == WINED3DFMT_B10G10R10A2_UNORM)
     {
-        TRACE("Unsupported display/backbuffer format combination %s / %s.\n",
+        /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode. */
+        TRACE("Unsupported format combination %s / %s in windowed mode.\n",
                 debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
         return WINED3DERR_NOTAVAILABLE;
     }
 
-    /* In FULLSCREEN mode WINED3DFMT_B5G5R5X1_UNORM can only be mixed with
-     * backbuffer formats WINED3DFMT_B5G5R5X1_UNORM and
-     * WINED3DFMT_B5G5R5A1_UNORM. */
-    if (display_format == WINED3DFMT_B5G5R5X1_UNORM
-            && !(backbuffer_format == WINED3DFMT_B5G5R5X1_UNORM || backbuffer_format == WINED3DFMT_B5G5R5A1_UNORM))
+    if (present_conversion)
     {
-        TRACE("Unsupported display/backbuffer format combination %s / %s.\n",
-                debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
-        return WINED3DERR_NOTAVAILABLE;
-    }
+        /* Use the display format as back buffer format if the latter is
+         * WINED3DFMT_UNKNOWN. */
+        if (backbuffer_format == WINED3DFMT_UNKNOWN)
+            backbuffer_format = display_format;
 
-    /* In FULLSCREEN mode WINED3DFMT_B8G8R8X8_UNORM can only be mixed with
-     * backbuffer formats WINED3DFMT_B8G8R8X8_UNORM and
-     * WINED3DFMT_B8G8R8A8_UNORM. */
-    if (display_format == WINED3DFMT_B8G8R8X8_UNORM
-            && !(backbuffer_format == WINED3DFMT_B8G8R8X8_UNORM || backbuffer_format == WINED3DFMT_B8G8R8A8_UNORM))
+        if (FAILED(wined3d_check_device_format_conversion(wined3d, adapter_idx,
+                device_type, backbuffer_format, display_format)))
+        {
+            TRACE("Format conversion from %s to %s not supported.\n",
+                    debug_d3dformat(backbuffer_format), debug_d3dformat(display_format));
+            return WINED3DERR_NOTAVAILABLE;
+        }
+    }
+    else
     {
-        TRACE("Unsupported display/backbuffer format combination %s / %s.\n",
-                debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
-        return WINED3DERR_NOTAVAILABLE;
+        /* When format conversion from the back buffer format to the display
+         * format is not allowed, only a limited number of combinations are
+         * valid. */
+
+        if (display_format == WINED3DFMT_B5G6R5_UNORM && backbuffer_format != WINED3DFMT_B5G6R5_UNORM)
+        {
+            TRACE("Unsupported format combination %s / %s.\n",
+                    debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
+            return WINED3DERR_NOTAVAILABLE;
+        }
+
+        if (display_format == WINED3DFMT_B5G5R5X1_UNORM
+                && !(backbuffer_format == WINED3DFMT_B5G5R5X1_UNORM || backbuffer_format == WINED3DFMT_B5G5R5A1_UNORM))
+        {
+            TRACE("Unsupported format combination %s / %s.\n",
+                    debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
+            return WINED3DERR_NOTAVAILABLE;
+        }
+
+        if (display_format == WINED3DFMT_B8G8R8X8_UNORM
+                && !(backbuffer_format == WINED3DFMT_B8G8R8X8_UNORM || backbuffer_format == WINED3DFMT_B8G8R8A8_UNORM))
+        {
+            TRACE("Unsupported format combination %s / %s.\n",
+                    debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
+            return WINED3DERR_NOTAVAILABLE;
+        }
+
+        if (display_format == WINED3DFMT_B10G10R10A2_UNORM
+                && backbuffer_format != WINED3DFMT_B10G10R10A2_UNORM)
+        {
+            TRACE("Unsupported format combination %s / %s.\n",
+                    debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
+            return WINED3DERR_NOTAVAILABLE;
+        }
     }
 
-    /* WINED3DFMT_B10G10R10A2_UNORM is only allowed in fullscreen mode and it
-     * can only be mixed with backbuffer format WINED3DFMT_B10G10R10A2_UNORM. */
-    if (display_format == WINED3DFMT_B10G10R10A2_UNORM
-            && (backbuffer_format != WINED3DFMT_B10G10R10A2_UNORM || windowed))
+    /* Validate that the back buffer format is usable for render targets. */
+    if (FAILED(wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format,
+            WINED3DUSAGE_RENDERTARGET, WINED3D_RTYPE_SURFACE, backbuffer_format)))
     {
-        TRACE("Unsupported display/backbuffer format combination %s / %s.\n",
-                debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
+        TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format));
         return WINED3DERR_NOTAVAILABLE;
     }
 
-    /* Use CheckDeviceFormat to see if the backbuffer_format is usable with the given display_format */
-    hr = wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format,
-            WINED3DUSAGE_RENDERTARGET, WINED3D_RTYPE_SURFACE, backbuffer_format);
-    if (FAILED(hr))
-        TRACE("Unsupported display/backbuffer format combination %s / %s.\n",
-                debug_d3dformat(display_format), debug_d3dformat(backbuffer_format));
-
-    return hr;
+    return WINED3D_OK;
 }
 
 HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapter_idx,
@@ -4197,6 +4248,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
                       WINED3DPCMPCAPS_NEVER        |
                       WINED3DPCMPCAPS_NOTEQUAL;
 
+    /* WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA
+     * are legacy settings for srcblend only. */
     caps->SrcBlendCaps  =  WINED3DPBLENDCAPS_BOTHINVSRCALPHA |
                            WINED3DPBLENDCAPS_BOTHSRCALPHA    |
                            WINED3DPBLENDCAPS_DESTALPHA       |
@@ -4221,12 +4274,9 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
                            WINED3DPBLENDCAPS_SRCALPHA        |
                            WINED3DPBLENDCAPS_SRCCOLOR        |
                            WINED3DPBLENDCAPS_ZERO;
-    /* NOTE: WINED3DPBLENDCAPS_SRCALPHASAT is not supported as dest blend factor,
-     * according to the glBlendFunc manpage
-     *
-     * WINED3DPBLENDCAPS_BOTHINVSRCALPHA and WINED3DPBLENDCAPS_BOTHSRCALPHA are
-     * legacy settings for srcblend only
-     */
+
+    if (gl_info->supported[ARB_BLEND_FUNC_EXTENDED])
+        caps->DestBlendCaps |= WINED3DPBLENDCAPS_SRCALPHASAT;
 
     if (gl_info->supported[EXT_BLEND_COLOR])
     {
@@ -4439,8 +4489,8 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
     caps->MaxAnisotropy = gl_info->limits.anisotropy;
     caps->MaxPointSize = gl_info->limits.pointsize_max;
 
-    caps->MaxPrimitiveCount   = 0xfffff; /* For now set 2^20-1 which is used by most >=Geforce3/Radeon8500 cards */
-    caps->MaxVertexIndex      = 0xfffff;
+    caps->MaxPrimitiveCount   = 0x555555; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
+    caps->MaxVertexIndex      = 0xffffff; /* Taken from an AMD Radeon HD 5700 (Evergreen) GPU. */
     caps->MaxStreams          = MAX_STREAMS;
     caps->MaxStreamStride     = 1024;
 
@@ -4504,6 +4554,7 @@ HRESULT CDECL wined3d_get_device_caps(const struct wined3d *wined3d, UINT adapte
 
         caps->MaxVShaderInstructionsExecuted    = 65535; /* VS 3.0 needs at least 65535, some cards even use 2^32-1 */
         caps->MaxVertexShader30InstructionSlots = max(512, adapter->gl_info.limits.arb_vs_instructions);
+        caps->VertexTextureFilterCaps = WINED3DPTFILTERCAPS_MINFPOINT | WINED3DPTFILTERCAPS_MAGFPOINT;
     }
     else if (caps->VertexShaderVersion == 2)
     {
@@ -5170,9 +5221,8 @@ const struct wined3d_parent_ops wined3d_null_parent_ops =
     wined3d_null_wined3d_object_destroyed,
 };
 
-HRESULT wined3d_init(struct wined3d *wined3d, UINT version, DWORD flags)
+HRESULT wined3d_init(struct wined3d *wined3d, DWORD flags)
 {
-    wined3d->dxVersion = version;
     wined3d->ref = 1;
     wined3d->flags = flags;
 
index becea1b..6ebb53c 100644 (file)
@@ -255,6 +255,14 @@ ULONG CDECL wined3d_query_decref(struct wined3d_query *query)
             if (oq->context) context_free_occlusion_query(oq);
             HeapFree(GetProcessHeap(), 0, query->extendedData);
         }
+        else if (query->type == WINED3D_QUERY_TYPE_TIMESTAMP)
+        {
+            struct wined3d_timestamp_query *tq = query->extendedData;
+
+            if (tq->context)
+                context_free_timestamp_query(tq);
+            HeapFree(GetProcessHeap(), 0, query->extendedData);
+        }
 
         HeapFree(GetProcessHeap(), 0, query);
     }
@@ -517,6 +525,148 @@ static HRESULT wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DW
     return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL.    */
 }
 
+static HRESULT wined3d_timestamp_query_ops_get_data(struct wined3d_query *query,
+        void *data, DWORD size, DWORD flags)
+{
+    struct wined3d_timestamp_query *tq = query->extendedData;
+    struct wined3d_device *device = query->device;
+    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+    struct wined3d_context *context;
+    UINT64 *u64data = data;
+    GLuint available;
+    GLuint64 timestamp;
+    HRESULT res;
+
+    TRACE("(%p) : type D3DQUERY_TIMESTAMP, data %p, size %#x, flags %#x.\n", query, data, size, flags);
+
+    if (!tq->context)
+        query->state = QUERY_CREATED;
+
+    if (query->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");
+        if (u64data)
+            *u64data = 0;
+        return S_OK;
+    }
+
+    if (tq->context->tid != GetCurrentThreadId())
+    {
+        FIXME("%p Wrong thread, returning 1.\n", query);
+        if (u64data)
+            *u64data = 1;
+        return S_OK;
+    }
+
+    context = context_acquire(query->device, tq->context->current_rt);
+
+    GL_EXTCALL(glGetQueryObjectuivARB(tq->id, GL_QUERY_RESULT_AVAILABLE_ARB, &available));
+    checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)");
+    TRACE("available %#x.\n", available);
+
+    if (available)
+    {
+        if (u64data)
+        {
+            GL_EXTCALL(glGetQueryObjectui64v(tq->id, GL_QUERY_RESULT_ARB, &timestamp));
+            checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)");
+            TRACE("Returning timestamp %s.\n", wine_dbgstr_longlong(timestamp));
+            *u64data = timestamp;
+        }
+        res = S_OK;
+    }
+    else
+    {
+        res = S_FALSE;
+    }
+
+    context_release(context);
+
+    return res;
+}
+
+static HRESULT wined3d_timestamp_query_ops_issue(struct wined3d_query *query, DWORD flags)
+{
+    struct wined3d_device *device = query->device;
+    const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
+
+    TRACE("query %p, flags %#x.\n", query, flags);
+
+    if (gl_info->supported[ARB_TIMER_QUERY])
+    {
+        struct wined3d_timestamp_query *tq = query->extendedData;
+        struct wined3d_context *context;
+
+        if (flags & WINED3DISSUE_BEGIN)
+        {
+            WARN("Ignoring WINED3DISSUE_BEGIN with a TIMESTAMP query.\n");
+        }
+        if (flags & WINED3DISSUE_END)
+        {
+            if (tq->context)
+                context_free_timestamp_query(tq);
+            context = context_acquire(query->device, NULL);
+            context_alloc_timestamp_query(context, tq);
+            GL_EXTCALL(glQueryCounter(tq->id, GL_TIMESTAMP));
+            checkGLcall("glQueryCounter()");
+            context_release(context);
+        }
+    }
+    else
+    {
+        ERR("Timestamp queries not supported.\n");
+    }
+
+    if (flags & WINED3DISSUE_END)
+        query->state = QUERY_SIGNALLED;
+
+    return WINED3D_OK;
+}
+
+static HRESULT wined3d_timestamp_disjoint_query_ops_get_data(struct wined3d_query *query,
+        void *data, DWORD size, DWORD flags)
+{
+    TRACE("(%p) : type D3DQUERY_TIMESTAMP_DISJOINT, data %p, size %#x, flags %#x.\n", query, data, size, flags);
+
+    if (query->type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT)
+    {
+        struct wined3d_query_data_timestamp_disjoint *disjoint_data = data;
+
+        if (query->state == QUERY_BUILDING)
+        {
+            TRACE("Query is building, returning S_FALSE.\n");
+            return S_FALSE;
+        }
+
+        if (disjoint_data)
+        {
+            disjoint_data->disjoint = FALSE;
+            disjoint_data->frequency = 1000 * 1000 * 1000;
+        }
+    }
+    else
+    {
+        UINT64 *u64data = data;
+
+        if (u64data)
+            *u64data = 1000 * 1000 * 1000;
+    }
+    return S_OK;
+}
+
+static HRESULT wined3d_timestamp_disjoint_query_ops_issue(struct wined3d_query *query, DWORD flags)
+{
+    TRACE("query %p, flags %#x.\n", query, flags);
+
+    if (flags & WINED3DISSUE_BEGIN)
+        query->state = QUERY_BUILDING;
+    if (flags & WINED3DISSUE_END)
+        query->state = QUERY_SIGNALLED;
+
+    return WINED3D_OK;
+}
+
 static const struct wined3d_query_ops event_query_ops =
 {
     wined3d_event_query_ops_get_data,
@@ -529,6 +679,18 @@ static const struct wined3d_query_ops occlusion_query_ops =
     wined3d_occlusion_query_ops_issue,
 };
 
+static const struct wined3d_query_ops timestamp_query_ops =
+{
+    wined3d_timestamp_query_ops_get_data,
+    wined3d_timestamp_query_ops_issue,
+};
+
+static const struct wined3d_query_ops timestamp_disjoint_query_ops =
+{
+    wined3d_timestamp_disjoint_query_ops_get_data,
+    wined3d_timestamp_disjoint_query_ops_issue,
+};
+
 static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *device, enum wined3d_query_type type)
 {
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -573,12 +735,41 @@ static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *de
             }
             break;
 
-        case WINED3D_QUERY_TYPE_VCACHE:
-        case WINED3D_QUERY_TYPE_RESOURCE_MANAGER:
-        case WINED3D_QUERY_TYPE_VERTEX_STATS:
         case WINED3D_QUERY_TYPE_TIMESTAMP:
+            TRACE("Timestamp query.\n");
+            if (!gl_info->supported[ARB_TIMER_QUERY])
+            {
+                WARN("Unsupported in local OpenGL implementation: ARB_TIMER_QUERY.\n");
+                return WINED3DERR_NOTAVAILABLE;
+            }
+            query->query_ops = &timestamp_query_ops;
+            query->data_size = sizeof(UINT64);
+            query->extendedData = HeapAlloc(GetProcessHeap(), 0, sizeof(struct wined3d_timestamp_query));
+            if (!query->extendedData)
+            {
+                ERR("Failed to allocate timestamp query extended data.\n");
+                return E_OUTOFMEMORY;
+            }
+            ((struct wined3d_timestamp_query *)query->extendedData)->context = NULL;
+            break;
+
         case WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT:
         case WINED3D_QUERY_TYPE_TIMESTAMP_FREQ:
+            TRACE("TIMESTAMP_DISJOINT query.\n");
+            if (!gl_info->supported[ARB_TIMER_QUERY])
+            {
+                WARN("Unsupported in local OpenGL implementation: ARB_TIMER_QUERY.\n");
+                return WINED3DERR_NOTAVAILABLE;
+            }
+            query->query_ops = &timestamp_disjoint_query_ops;
+            query->data_size = type == WINED3D_QUERY_TYPE_TIMESTAMP_DISJOINT
+                    ? sizeof(struct wined3d_query_data_timestamp_disjoint) : sizeof(UINT64);
+            query->extendedData = NULL;
+            break;
+
+        case WINED3D_QUERY_TYPE_VCACHE:
+        case WINED3D_QUERY_TYPE_RESOURCE_MANAGER:
+        case WINED3D_QUERY_TYPE_VERTEX_STATS:
         case WINED3D_QUERY_TYPE_PIPELINE_TIMINGS:
         case WINED3D_QUERY_TYPE_INTERFACE_TIMINGS:
         case WINED3D_QUERY_TYPE_VERTEX_TIMINGS:
index 5c7bc81..d65cc29 100644 (file)
 
 WINE_DEFAULT_DEBUG_CHANNEL(d3d);
 
-struct private_data
-{
-    struct list entry;
-
-    GUID tag;
-    DWORD flags; /* DDSPD_* */
-
-    union
-    {
-        void *data;
-        IUnknown *object;
-    } ptr;
-
-    DWORD size;
-};
-
 static DWORD resource_access_from_pool(enum wined3d_pool pool)
 {
     switch (pool)
@@ -114,7 +98,6 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
     resource->parent = parent;
     resource->parent_ops = parent_ops;
     resource->resource_ops = resource_ops;
-    list_init(&resource->privateData);
 
     if (size)
     {
@@ -149,9 +132,6 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
 void resource_cleanup(struct wined3d_resource *resource)
 {
     const struct wined3d *d3d = resource->device->wined3d;
-    struct private_data *data;
-    struct list *e1, *e2;
-    HRESULT hr;
 
     TRACE("Cleaning up resource %p.\n", resource);
 
@@ -161,14 +141,6 @@ void resource_cleanup(struct wined3d_resource *resource)
         adapter_adjust_memory(resource->device->adapter, 0 - resource->size);
     }
 
-    LIST_FOR_EACH_SAFE(e1, e2, &resource->privateData)
-    {
-        data = LIST_ENTRY(e1, struct private_data, entry);
-        hr = wined3d_resource_free_private_data(resource, &data->tag);
-        if (FAILED(hr))
-            ERR("Failed to free private data when destroying resource %p, hr = %#x.\n", resource, hr);
-    }
-
     wined3d_resource_free_sysmem(resource);
 
     device_resource_released(resource->device, resource);
@@ -183,128 +155,6 @@ void resource_unload(struct wined3d_resource *resource)
             resource, resource->type);
 }
 
-static struct private_data *resource_find_private_data(const struct wined3d_resource *resource, REFGUID tag)
-{
-    struct private_data *data;
-    struct list *entry;
-
-    TRACE("Searching for private data %s\n", debugstr_guid(tag));
-    LIST_FOR_EACH(entry, &resource->privateData)
-    {
-        data = LIST_ENTRY(entry, struct private_data, entry);
-        if (IsEqualGUID(&data->tag, tag)) {
-            TRACE("Found %p\n", data);
-            return data;
-        }
-    }
-    TRACE("Not found\n");
-    return NULL;
-}
-
-HRESULT CDECL wined3d_resource_set_private_data(struct wined3d_resource *resource, REFGUID guid,
-        const void *data, DWORD data_size, DWORD flags)
-{
-    struct private_data *d;
-
-    TRACE("resource %p, riid %s, data %p, data_size %u, flags %#x.\n",
-            resource, debugstr_guid(guid), data, data_size, flags);
-
-    wined3d_resource_free_private_data(resource, guid);
-
-    d = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*d));
-    if (!d) return E_OUTOFMEMORY;
-
-    d->tag = *guid;
-    d->flags = flags;
-
-    if (flags & WINED3DSPD_IUNKNOWN)
-    {
-        if (data_size != sizeof(IUnknown *))
-        {
-            WARN("IUnknown data with size %u, returning WINED3DERR_INVALIDCALL.\n", data_size);
-            HeapFree(GetProcessHeap(), 0, d);
-            return WINED3DERR_INVALIDCALL;
-        }
-        d->ptr.object = (IUnknown *)data;
-        d->size = sizeof(IUnknown *);
-        IUnknown_AddRef(d->ptr.object);
-    }
-    else
-    {
-        d->ptr.data = HeapAlloc(GetProcessHeap(), 0, data_size);
-        if (!d->ptr.data)
-        {
-            HeapFree(GetProcessHeap(), 0, d);
-            return E_OUTOFMEMORY;
-        }
-        d->size = data_size;
-        memcpy(d->ptr.data, data, data_size);
-    }
-    list_add_tail(&resource->privateData, &d->entry);
-
-    return WINED3D_OK;
-}
-
-HRESULT CDECL wined3d_resource_get_private_data(const struct wined3d_resource *resource, REFGUID guid,
-        void *data, DWORD *data_size)
-{
-    const struct private_data *d;
-
-    TRACE("resource %p, guid %s, data %p, data_size %p.\n",
-            resource, debugstr_guid(guid), data, data_size);
-
-    d = resource_find_private_data(resource, guid);
-    if (!d) return WINED3DERR_NOTFOUND;
-
-    if (*data_size < d->size)
-    {
-        *data_size = d->size;
-        return WINED3DERR_MOREDATA;
-    }
-
-    if (d->flags & WINED3DSPD_IUNKNOWN)
-    {
-        *(IUnknown **)data = d->ptr.object;
-        if (resource->device->wined3d->dxVersion != 7)
-        {
-            /* D3D8 and D3D9 addref the private data, DDraw does not. This
-             * can't be handled in ddraw because it doesn't know if the
-             * pointer returned is an IUnknown * or just a blob. */
-            IUnknown_AddRef(d->ptr.object);
-        }
-    }
-    else
-    {
-        memcpy(data, d->ptr.data, d->size);
-    }
-
-    return WINED3D_OK;
-}
-HRESULT CDECL wined3d_resource_free_private_data(struct wined3d_resource *resource, REFGUID guid)
-{
-    struct private_data *data;
-
-    TRACE("resource %p, guid %s.\n", resource, debugstr_guid(guid));
-
-    data = resource_find_private_data(resource, guid);
-    if (!data) return WINED3DERR_NOTFOUND;
-
-    if (data->flags & WINED3DSPD_IUNKNOWN)
-    {
-        if (data->ptr.object)
-            IUnknown_Release(data->ptr.object);
-    }
-    else
-    {
-        HeapFree(GetProcessHeap(), 0, data->ptr.data);
-    }
-    list_remove(&data->entry);
-
-    HeapFree(GetProcessHeap(), 0, data);
-
-    return WINED3D_OK;
-}
-
 DWORD resource_set_priority(struct wined3d_resource *resource, DWORD priority)
 {
     DWORD prev = resource->priority;
index aea626d..b995b35 100644 (file)
@@ -672,7 +672,8 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
     surface->texture_target = GL_TEXTURE_2D;
 
     /* Non-power2 support */
-    if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT])
+    if (gl_info->supported[ARB_TEXTURE_NON_POWER_OF_TWO] || gl_info->supported[WINED3D_GL_NORMALIZED_TEXRECT]
+            || gl_info->supported[ARB_TEXTURE_RECTANGLE])
     {
         pow2Width = surface->resource.width;
         pow2Height = surface->resource.height;
@@ -692,9 +693,9 @@ static HRESULT surface_private_setup(struct wined3d_surface *surface)
     if (pow2Width > surface->resource.width || pow2Height > surface->resource.height)
     {
         /* TODO: Add support for non power two compressed textures. */
-        if (surface->resource.format->flags & WINED3DFMT_FLAG_COMPRESSED)
+        if (surface->resource.format->flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_HEIGHT_SCALE))
         {
-            FIXME("(%p) Compressed non-power-two textures are not supported w(%d) h(%d)\n",
+            FIXME("(%p) Compressed or height scaled non-power-two textures are not supported w(%d) h(%d)\n",
                   surface, surface->resource.width, surface->resource.height);
             return WINED3DERR_NOTAVAILABLE;
         }
@@ -2602,8 +2603,9 @@ HRESULT CDECL wined3d_surface_update_desc(struct wined3d_surface *surface,
     HRESULT hr;
     DWORD valid_location = 0;
 
-    TRACE("surface %p, width %u, height %u, format %s, multisample_type %#x, multisample_quality %u.\n",
-            surface, width, height, debug_d3dformat(format_id), multisample_type, multisample_type);
+    TRACE("surface %p, width %u, height %u, format %s, multisample_type %#x, multisample_quality %u, "
+            "mem %p, pitch %u.\n",
+            surface, width, height, debug_d3dformat(format_id), multisample_type, multisample_type, mem, pitch);
 
     if (!resource_size)
         return WINED3DERR_INVALIDCALL;
@@ -5119,7 +5121,8 @@ HRESULT surface_load_location(struct wined3d_surface *surface, DWORD location)
 
     if (surface->resource.usage & WINED3DUSAGE_DEPTHSTENCIL)
     {
-        if (location == WINED3D_LOCATION_TEXTURE_RGB && surface->locations & WINED3D_LOCATION_DRAWABLE)
+        if (location == WINED3D_LOCATION_TEXTURE_RGB
+                && surface->locations & (WINED3D_LOCATION_DRAWABLE | WINED3D_LOCATION_DISCARDED))
         {
             struct wined3d_context *context = context_acquire(device, NULL);
             surface_load_ds_location(surface, context, location);
index 18ee65e..cd55f2e 100644 (file)
@@ -50,6 +50,7 @@ static const struct wined3d_format_channels formats[] =
     {WINED3DFMT_UYVY,                       0,  0,  0,  0,   0,  0,  0,  0,    2,   0,     0},
     {WINED3DFMT_YUY2,                       0,  0,  0,  0,   0,  0,  0,  0,    2,   0,     0},
     {WINED3DFMT_YV12,                       0,  0,  0,  0,   0,  0,  0,  0,    1,   0,     0},
+    {WINED3DFMT_NV12,                       0,  0,  0,  0,   0,  0,  0,  0,    1,   0,     0},
     {WINED3DFMT_DXT1,                       0,  0,  0,  0,   0,  0,  0,  0,    1,   0,     0},
     {WINED3DFMT_DXT2,                       0,  0,  0,  0,   0,  0,  0,  0,    1,   0,     0},
     {WINED3DFMT_DXT3,                       0,  0,  0,  0,   0,  0,  0,  0,    1,   0,     0},
@@ -665,6 +666,10 @@ static const struct wined3d_format_texture_info format_texture_info[] =
             GL_ALPHA,                   GL_UNSIGNED_BYTE,                 0,
             WINED3DFMT_FLAG_FILTERING,
             WINED3D_GL_EXT_NONE,        NULL},
+    {WINED3DFMT_NV12,                   GL_ALPHA,                         GL_ALPHA,                               0,
+            GL_ALPHA,                   GL_UNSIGNED_BYTE,                 0,
+            WINED3DFMT_FLAG_FILTERING,
+            WINED3D_GL_EXT_NONE,        NULL},
     {WINED3DFMT_DXT1,                   GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, 0,
             GL_RGBA,                    GL_UNSIGNED_BYTE,                 0,
             WINED3DFMT_FLAG_TEXTURE | WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING
@@ -1832,6 +1837,12 @@ static void apply_format_fixups(struct wined3d_adapter *adapter, struct wined3d_
     gl_info->formats[idx].height_scale.denominator = 2;
     gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_YV12);
 
+    idx = getFmtIdx(WINED3DFMT_NV12);
+    gl_info->formats[idx].flags |= WINED3DFMT_FLAG_HEIGHT_SCALE;
+    gl_info->formats[idx].height_scale.numerator = 3;
+    gl_info->formats[idx].height_scale.denominator = 2;
+    gl_info->formats[idx].color_fixup = create_complex_fixup_desc(COMPLEX_FIXUP_NV12);
+
     if (gl_info->supported[ARB_FRAGMENT_PROGRAM])
     {
         idx = getFmtIdx(WINED3DFMT_P8_UINT);
@@ -2068,6 +2079,7 @@ const char *debug_d3dformat(enum wined3d_format_id format_id)
         FMT_TO_STR(WINED3DFMT_UYVY);
         FMT_TO_STR(WINED3DFMT_YUY2);
         FMT_TO_STR(WINED3DFMT_YV12);
+        FMT_TO_STR(WINED3DFMT_NV12);
         FMT_TO_STR(WINED3DFMT_DXT1);
         FMT_TO_STR(WINED3DFMT_DXT2);
         FMT_TO_STR(WINED3DFMT_DXT3);
@@ -2771,6 +2783,7 @@ static const char *debug_complex_fixup(enum complex_fixup fixup)
         WINED3D_TO_STR(COMPLEX_FIXUP_YUY2);
         WINED3D_TO_STR(COMPLEX_FIXUP_UYVY);
         WINED3D_TO_STR(COMPLEX_FIXUP_YV12);
+        WINED3D_TO_STR(COMPLEX_FIXUP_NV12);
         WINED3D_TO_STR(COMPLEX_FIXUP_P8);
 #undef WINED3D_TO_STR
         default:
index 3a6dd33..bdfe017 100644 (file)
@@ -6,7 +6,7 @@
 @ cdecl wined3d_check_device_format_conversion(ptr long long long long)
 @ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr)
 @ cdecl wined3d_check_device_type(ptr long long long long long)
-@ cdecl wined3d_create(long long)
+@ cdecl wined3d_create(long)
 @ cdecl wined3d_decref(ptr)
 @ cdecl wined3d_enum_adapter_modes(ptr long long long long ptr)
 @ cdecl wined3d_get_adapter_count(ptr)
 @ cdecl wined3d_query_incref(ptr)
 @ cdecl wined3d_query_issue(ptr long)
 
-@ cdecl wined3d_resource_free_private_data(ptr ptr)
 @ cdecl wined3d_resource_get_desc(ptr ptr)
 @ cdecl wined3d_resource_get_parent(ptr)
-@ cdecl wined3d_resource_get_private_data(ptr ptr ptr ptr)
 @ cdecl wined3d_resource_set_parent(ptr ptr)
-@ cdecl wined3d_resource_set_private_data(ptr ptr ptr long long)
 
 @ cdecl wined3d_rendertarget_view_create(ptr ptr ptr)
 @ cdecl wined3d_rendertarget_view_decref(ptr)
index b357bb1..acfbe3c 100644 (file)
@@ -43,6 +43,7 @@ enum wined3d_gl_extension
     APPLE_FLUSH_BUFFER_RANGE,
     APPLE_YCBCR_422,
     /* ARB */
+    ARB_BLEND_FUNC_EXTENDED,
     ARB_COLOR_BUFFER_FLOAT,
     ARB_DEBUG_OUTPUT,
     ARB_DEPTH_BUFFER_FLOAT,
@@ -88,6 +89,7 @@ enum wined3d_gl_extension
     ARB_TEXTURE_NON_POWER_OF_TWO,
     ARB_TEXTURE_RECTANGLE,
     ARB_TEXTURE_RG,
+    ARB_TIMER_QUERY,
     ARB_VERTEX_ARRAY_BGRA,
     ARB_VERTEX_BLEND,
     ARB_VERTEX_BUFFER_OBJECT,
@@ -180,6 +182,9 @@ enum wined3d_gl_extension
     /* GL_APPLE_flush_buffer_range */ \
     USE_GL_FUNC(glBufferParameteriAPPLE) \
     USE_GL_FUNC(glFlushMappedBufferRangeAPPLE) \
+    /* GL_ARB_blend_func_extended */ \
+    USE_GL_FUNC(glBindFragDataLocationIndexed) \
+    USE_GL_FUNC(glGetFragDataIndex) \
     /* GL_ARB_color_buffer_float */ \
     USE_GL_FUNC(glClampColorARB) \
     /* GL_ARB_debug_output */ \
@@ -317,6 +322,9 @@ enum wined3d_gl_extension
     USE_GL_FUNC(glCompressedTexSubImage2DARB) \
     USE_GL_FUNC(glCompressedTexSubImage3DARB) \
     USE_GL_FUNC(glGetCompressedTexImageARB) \
+    /* GL_ARB_timer_query */ \
+    USE_GL_FUNC(glQueryCounter) \
+    USE_GL_FUNC(glGetQueryObjectui64v) \
     /* GL_ARB_vertex_blend */ \
     USE_GL_FUNC(glVertexBlendARB) \
     USE_GL_FUNC(glWeightPointerARB) \
index d290a6f..c62d1f5 100644 (file)
@@ -85,7 +85,7 @@ struct wined3d_settings wined3d_settings =
     FALSE,          /* 3D support enabled by default. */
 };
 
-struct wined3d * CDECL wined3d_create(UINT version, DWORD flags)
+struct wined3d * CDECL wined3d_create(DWORD flags)
 {
     struct wined3d *object;
     HRESULT hr;
@@ -97,10 +97,10 @@ struct wined3d * CDECL wined3d_create(UINT version, DWORD flags)
         return NULL;
     }
 
-    if (version == 7 && wined3d_settings.no_3d)
+    if (wined3d_settings.no_3d)
         flags |= WINED3D_NO3D;
 
-    hr = wined3d_init(object, version, flags);
+    hr = wined3d_init(object, flags);
     if (FAILED(hr))
     {
         WARN("Failed to initialize wined3d object, hr %#x.\n", hr);
@@ -108,7 +108,7 @@ struct wined3d * CDECL wined3d_create(UINT version, DWORD flags)
         return NULL;
     }
 
-    TRACE("Created wined3d object %p for d3d%d support.\n", object, version);
+    TRACE("Created wined3d object %p.\n", object);
 
     return object;
 }
index abfcb7a..6863f14 100644 (file)
@@ -94,6 +94,7 @@ enum complex_fixup
     COMPLEX_FIXUP_UYVY = 2,
     COMPLEX_FIXUP_YV12 = 3,
     COMPLEX_FIXUP_P8   = 4,
+    COMPLEX_FIXUP_NV12 = 5,
 };
 
 #include <pshpack2.h>
@@ -1053,6 +1054,16 @@ enum wined3d_event_query_result wined3d_event_query_finish(const struct wined3d_
 void wined3d_event_query_issue(struct wined3d_event_query *query, const struct wined3d_device *device) DECLSPEC_HIDDEN;
 BOOL wined3d_event_query_supported(const struct wined3d_gl_info *gl_info) DECLSPEC_HIDDEN;
 
+struct wined3d_timestamp_query
+{
+    struct list entry;
+    GLuint id;
+    struct wined3d_context *context;
+};
+
+void context_alloc_timestamp_query(struct wined3d_context *context, struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
+void context_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
+
 struct wined3d_context
 {
     const struct wined3d_gl_info *gl_info;
@@ -1093,7 +1104,10 @@ struct wined3d_context
     DWORD fixed_function_usage_map : 8; /* MAX_TEXTURES, 8 */
     DWORD lowest_disabled_stage : 4;    /* Max MAX_TEXTURES, 8 */
     DWORD rebind_fbo : 1;
-    DWORD padding : 19;
+    DWORD needs_set : 1;
+    DWORD hdc_is_private : 1;
+    DWORD hdc_has_format : 1;           /* only meaningful if hdc_is_private */
+    DWORD padding : 16;
     DWORD shader_update_mask;
     DWORD constant_update_mask;
     DWORD                   numbered_array_mask;
@@ -1111,6 +1125,7 @@ struct wined3d_context
     HGLRC restore_ctx;
     HDC restore_dc;
     int restore_pf;
+    HWND restore_pf_win;
     HGLRC                   glCtx;
     HWND                    win_handle;
     HDC                     hdc;
@@ -1141,6 +1156,11 @@ struct wined3d_context
     UINT free_event_query_count;
     struct list event_queries;
 
+    GLuint *free_timestamp_queries;
+    UINT free_timestamp_query_size;
+    UINT free_timestamp_query_count;
+    struct list timestamp_queries;
+
     struct wined3d_stream_info stream_info;
 
     /* Fences for GL_APPLE_flush_buffer_range */
@@ -1356,10 +1376,11 @@ struct wined3d_pixel_format
 
 enum wined3d_pci_vendor
 {
-    HW_VENDOR_SOFTWARE                 = 0x0000,
-    HW_VENDOR_AMD                      = 0x1002,
-    HW_VENDOR_NVIDIA                   = 0x10de,
-    HW_VENDOR_INTEL                    = 0x8086,
+    HW_VENDOR_SOFTWARE              = 0x0000,
+    HW_VENDOR_AMD                   = 0x1002,
+    HW_VENDOR_NVIDIA                = 0x10de,
+    HW_VENDOR_VMWARE                = 0x15ad,
+    HW_VENDOR_INTEL                 = 0x8086,
 };
 
 enum wined3d_pci_device
@@ -1477,10 +1498,15 @@ enum wined3d_pci_device
     CARD_NVIDIA_GEFORCE_GTX670      = 0x1189,
     CARD_NVIDIA_GEFORCE_GTX670MX    = 0x11a1,
     CARD_NVIDIA_GEFORCE_GTX680      = 0x1180,
+    CARD_NVIDIA_GEFORCE_GTX750      = 0x1381,
+    CARD_NVIDIA_GEFORCE_GTX750TI    = 0x1380,
+    CARD_NVIDIA_GEFORCE_GTX760      = 0x1187,
     CARD_NVIDIA_GEFORCE_GTX765M     = 0x11e2,
     CARD_NVIDIA_GEFORCE_GTX770M     = 0x11e0,
     CARD_NVIDIA_GEFORCE_GTX770      = 0x1184,
 
+    CARD_VMWARE_SVGA3D              = 0x0405,
+
     CARD_INTEL_830M                 = 0x3577,
     CARD_INTEL_855GM                = 0x3582,
     CARD_INTEL_845G                 = 0x2562,
@@ -1788,12 +1814,11 @@ struct wined3d
 {
     LONG ref;
     DWORD flags;
-    UINT dxVersion;
     UINT adapter_count;
     struct wined3d_adapter adapters[1];
 };
 
-HRESULT wined3d_init(struct wined3d *wined3d, UINT version, DWORD flags) DECLSPEC_HIDDEN;
+HRESULT wined3d_init(struct wined3d *wined3d, DWORD flags) DECLSPEC_HIDDEN;
 BOOL wined3d_register_window(HWND window, struct wined3d_device *device) DECLSPEC_HIDDEN;
 void wined3d_unregister_window(HWND window) DECLSPEC_HIDDEN;
 
@@ -2009,7 +2034,6 @@ struct wined3d_resource
     UINT size;
     DWORD priority;
     void *heap_memory;
-    struct list privateData;
     struct list resource_list_entry;
 
     void *parent;
index 8d23501..7dbf6a1 100644 (file)
@@ -1,4 +1,4 @@
-/* Automatically generated from http://www.opengl.org/registry/api files; DO NOT EDIT! */
+/* Automatically generated from http://www.opengl.org/registry files; DO NOT EDIT! */
 
 #ifndef __WINE_WGL_DRIVER_H
 #define __WINE_WGL_DRIVER_H
@@ -7,7 +7,7 @@
 #define WINE_GLAPI
 #endif
 
-#define WINE_WGL_DRIVER_VERSION 10
+#define WINE_WGL_DRIVER_VERSION 11
 
 struct wgl_context;
 struct wgl_pbuffer;
@@ -39,7 +39,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glBitmap)(GLsizei,GLsizei,GLfloat,GLfloat,GLfloat,GLfloat,const GLubyte*);
         void       (WINE_GLAPI *p_glBlendFunc)(GLenum,GLenum);
         void       (WINE_GLAPI *p_glCallList)(GLuint);
-        void       (WINE_GLAPI *p_glCallLists)(GLsizei,GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glCallLists)(GLsizei,GLenum,const void*);
         void       (WINE_GLAPI *p_glClear)(GLbitfield);
         void       (WINE_GLAPI *p_glClearAccum)(GLfloat,GLfloat,GLfloat,GLfloat);
         void       (WINE_GLAPI *p_glClearColor)(GLfloat,GLfloat,GLfloat,GLfloat);
@@ -81,7 +81,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glColor4usv)(const GLushort*);
         void       (WINE_GLAPI *p_glColorMask)(GLboolean,GLboolean,GLboolean,GLboolean);
         void       (WINE_GLAPI *p_glColorMaterial)(GLenum,GLenum);
-        void       (WINE_GLAPI *p_glColorPointer)(GLint,GLenum,GLsizei,const GLvoid*);
+        void       (WINE_GLAPI *p_glColorPointer)(GLint,GLenum,GLsizei,const void*);
         void       (WINE_GLAPI *p_glCopyPixels)(GLint,GLint,GLsizei,GLsizei,GLenum);
         void       (WINE_GLAPI *p_glCopyTexImage1D)(GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLint);
         void       (WINE_GLAPI *p_glCopyTexImage2D)(GLenum,GLint,GLenum,GLint,GLint,GLsizei,GLsizei,GLint);
@@ -97,10 +97,10 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glDisableClientState)(GLenum);
         void       (WINE_GLAPI *p_glDrawArrays)(GLenum,GLint,GLsizei);
         void       (WINE_GLAPI *p_glDrawBuffer)(GLenum);
-        void       (WINE_GLAPI *p_glDrawElements)(GLenum,GLsizei,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glDrawPixels)(GLsizei,GLsizei,GLenum,GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glDrawElements)(GLenum,GLsizei,GLenum,const void*);
+        void       (WINE_GLAPI *p_glDrawPixels)(GLsizei,GLsizei,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glEdgeFlag)(GLboolean);
-        void       (WINE_GLAPI *p_glEdgeFlagPointer)(GLsizei,const GLvoid*);
+        void       (WINE_GLAPI *p_glEdgeFlagPointer)(GLsizei,const void*);
         void       (WINE_GLAPI *p_glEdgeFlagv)(const GLboolean*);
         void       (WINE_GLAPI *p_glEnable)(GLenum);
         void       (WINE_GLAPI *p_glEnableClientState)(GLenum);
@@ -145,22 +145,22 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetPixelMapfv)(GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetPixelMapuiv)(GLenum,GLuint*);
         void       (WINE_GLAPI *p_glGetPixelMapusv)(GLenum,GLushort*);
-        void       (WINE_GLAPI *p_glGetPointerv)(GLenum,GLvoid**);
+        void       (WINE_GLAPI *p_glGetPointerv)(GLenum,void**);
         void       (WINE_GLAPI *p_glGetPolygonStipple)(GLubyte*);
-        const GLubyte * (WINE_GLAPI *p_glGetString)(GLenum);
+        const GLubyte* (WINE_GLAPI *p_glGetString)(GLenum);
         void       (WINE_GLAPI *p_glGetTexEnvfv)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetTexEnviv)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetTexGendv)(GLenum,GLenum,GLdouble*);
         void       (WINE_GLAPI *p_glGetTexGenfv)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetTexGeniv)(GLenum,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetTexImage)(GLenum,GLint,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetTexImage)(GLenum,GLint,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetTexLevelParameterfv)(GLenum,GLint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetTexLevelParameteriv)(GLenum,GLint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetTexParameterfv)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetTexParameteriv)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glHint)(GLenum,GLenum);
         void       (WINE_GLAPI *p_glIndexMask)(GLuint);
-        void       (WINE_GLAPI *p_glIndexPointer)(GLenum,GLsizei,const GLvoid*);
+        void       (WINE_GLAPI *p_glIndexPointer)(GLenum,GLsizei,const void*);
         void       (WINE_GLAPI *p_glIndexd)(GLdouble);
         void       (WINE_GLAPI *p_glIndexdv)(const GLdouble*);
         void       (WINE_GLAPI *p_glIndexf)(GLfloat);
@@ -172,7 +172,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glIndexub)(GLubyte);
         void       (WINE_GLAPI *p_glIndexubv)(const GLubyte*);
         void       (WINE_GLAPI *p_glInitNames)(void);
-        void       (WINE_GLAPI *p_glInterleavedArrays)(GLenum,GLsizei,const GLvoid*);
+        void       (WINE_GLAPI *p_glInterleavedArrays)(GLenum,GLsizei,const void*);
         GLboolean  (WINE_GLAPI *p_glIsEnabled)(GLenum);
         GLboolean  (WINE_GLAPI *p_glIsList)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsTexture)(GLuint);
@@ -218,12 +218,12 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glNormal3iv)(const GLint*);
         void       (WINE_GLAPI *p_glNormal3s)(GLshort,GLshort,GLshort);
         void       (WINE_GLAPI *p_glNormal3sv)(const GLshort*);
-        void       (WINE_GLAPI *p_glNormalPointer)(GLenum,GLsizei,const GLvoid*);
+        void       (WINE_GLAPI *p_glNormalPointer)(GLenum,GLsizei,const void*);
         void       (WINE_GLAPI *p_glOrtho)(GLdouble,GLdouble,GLdouble,GLdouble,GLdouble,GLdouble);
         void       (WINE_GLAPI *p_glPassThrough)(GLfloat);
-        void       (WINE_GLAPI *p_glPixelMapfv)(GLenum,GLint,const GLfloat*);
-        void       (WINE_GLAPI *p_glPixelMapuiv)(GLenum,GLint,const GLuint*);
-        void       (WINE_GLAPI *p_glPixelMapusv)(GLenum,GLint,const GLushort*);
+        void       (WINE_GLAPI *p_glPixelMapfv)(GLenum,GLsizei,const GLfloat*);
+        void       (WINE_GLAPI *p_glPixelMapuiv)(GLenum,GLsizei,const GLuint*);
+        void       (WINE_GLAPI *p_glPixelMapusv)(GLenum,GLsizei,const GLushort*);
         void       (WINE_GLAPI *p_glPixelStoref)(GLenum,GLfloat);
         void       (WINE_GLAPI *p_glPixelStorei)(GLenum,GLint);
         void       (WINE_GLAPI *p_glPixelTransferf)(GLenum,GLfloat);
@@ -267,7 +267,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glRasterPos4s)(GLshort,GLshort,GLshort,GLshort);
         void       (WINE_GLAPI *p_glRasterPos4sv)(const GLshort*);
         void       (WINE_GLAPI *p_glReadBuffer)(GLenum);
-        void       (WINE_GLAPI *p_glReadPixels)(GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glReadPixels)(GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glRectd)(GLdouble,GLdouble,GLdouble,GLdouble);
         void       (WINE_GLAPI *p_glRectdv)(const GLdouble*,const GLdouble*);
         void       (WINE_GLAPI *p_glRectf)(GLfloat,GLfloat,GLfloat,GLfloat);
@@ -319,7 +319,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glTexCoord4iv)(const GLint*);
         void       (WINE_GLAPI *p_glTexCoord4s)(GLshort,GLshort,GLshort,GLshort);
         void       (WINE_GLAPI *p_glTexCoord4sv)(const GLshort*);
-        void       (WINE_GLAPI *p_glTexCoordPointer)(GLint,GLenum,GLsizei,const GLvoid*);
+        void       (WINE_GLAPI *p_glTexCoordPointer)(GLint,GLenum,GLsizei,const void*);
         void       (WINE_GLAPI *p_glTexEnvf)(GLenum,GLenum,GLfloat);
         void       (WINE_GLAPI *p_glTexEnvfv)(GLenum,GLenum,const GLfloat*);
         void       (WINE_GLAPI *p_glTexEnvi)(GLenum,GLenum,GLint);
@@ -330,14 +330,14 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glTexGenfv)(GLenum,GLenum,const GLfloat*);
         void       (WINE_GLAPI *p_glTexGeni)(GLenum,GLenum,GLint);
         void       (WINE_GLAPI *p_glTexGeniv)(GLenum,GLenum,const GLint*);
-        void       (WINE_GLAPI *p_glTexImage1D)(GLenum,GLint,GLint,GLsizei,GLint,GLenum,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glTexImage2D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLint,GLenum,GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glTexImage1D)(GLenum,GLint,GLint,GLsizei,GLint,GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glTexImage2D)(GLenum,GLint,GLint,GLsizei,GLsizei,GLint,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glTexParameterf)(GLenum,GLenum,GLfloat);
         void       (WINE_GLAPI *p_glTexParameterfv)(GLenum,GLenum,const GLfloat*);
         void       (WINE_GLAPI *p_glTexParameteri)(GLenum,GLenum,GLint);
         void       (WINE_GLAPI *p_glTexParameteriv)(GLenum,GLenum,const GLint*);
-        void       (WINE_GLAPI *p_glTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glTranslated)(GLdouble,GLdouble,GLdouble);
         void       (WINE_GLAPI *p_glTranslatef)(GLfloat,GLfloat,GLfloat);
         void       (WINE_GLAPI *p_glVertex2d)(GLdouble,GLdouble);
@@ -364,12 +364,13 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glVertex4iv)(const GLint*);
         void       (WINE_GLAPI *p_glVertex4s)(GLshort,GLshort,GLshort,GLshort);
         void       (WINE_GLAPI *p_glVertex4sv)(const GLshort*);
-        void       (WINE_GLAPI *p_glVertexPointer)(GLint,GLenum,GLsizei,const GLvoid*);
+        void       (WINE_GLAPI *p_glVertexPointer)(GLint,GLenum,GLsizei,const void*);
         void       (WINE_GLAPI *p_glViewport)(GLint,GLint,GLsizei,GLsizei);
     } gl;
 
     struct
     {
+        void       (WINE_GLAPI *p_glAccumxOES)(GLenum,GLfixed);
         void       (WINE_GLAPI *p_glActiveProgramEXT)(GLuint);
         void       (WINE_GLAPI *p_glActiveShaderProgram)(GLuint,GLuint);
         void       (WINE_GLAPI *p_glActiveStencilFaceEXT)(GLenum);
@@ -379,6 +380,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glAlphaFragmentOp1ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint);
         void       (WINE_GLAPI *p_glAlphaFragmentOp2ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint);
         void       (WINE_GLAPI *p_glAlphaFragmentOp3ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint);
+        void       (WINE_GLAPI *p_glAlphaFuncxOES)(GLenum,GLfixed);
         void       (WINE_GLAPI *p_glApplyTextureEXT)(GLenum);
         GLboolean  (WINE_GLAPI *p_glAreProgramsResidentNV)(GLsizei,const GLuint*,GLboolean*);
         GLboolean  (WINE_GLAPI *p_glAreTexturesResidentEXT)(GLsizei,const GLuint*,GLboolean*);
@@ -389,6 +391,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glAttachShader)(GLuint,GLuint);
         void       (WINE_GLAPI *p_glBeginConditionalRender)(GLuint,GLenum);
         void       (WINE_GLAPI *p_glBeginConditionalRenderNV)(GLuint,GLenum);
+        void       (WINE_GLAPI *p_glBeginConditionalRenderNVX)(GLuint);
         void       (WINE_GLAPI *p_glBeginFragmentShaderATI)(void);
         void       (WINE_GLAPI *p_glBeginOcclusionQueryNV)(GLuint);
         void       (WINE_GLAPI *p_glBeginPerfMonitorAMD)(GLuint);
@@ -412,6 +415,8 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glBindBufferRange)(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr);
         void       (WINE_GLAPI *p_glBindBufferRangeEXT)(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr);
         void       (WINE_GLAPI *p_glBindBufferRangeNV)(GLenum,GLuint,GLuint,GLintptr,GLsizeiptr);
+        void       (WINE_GLAPI *p_glBindBuffersBase)(GLenum,GLuint,GLsizei,const GLuint*);
+        void       (WINE_GLAPI *p_glBindBuffersRange)(GLenum,GLuint,GLsizei,const GLuint*,const GLintptr*,const GLsizeiptr*);
         void       (WINE_GLAPI *p_glBindFragDataLocation)(GLuint,GLuint,const GLchar*);
         void       (WINE_GLAPI *p_glBindFragDataLocationEXT)(GLuint,GLuint,const GLchar*);
         void       (WINE_GLAPI *p_glBindFragDataLocationIndexed)(GLuint,GLuint,GLuint,const GLchar*);
@@ -420,6 +425,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glBindFramebufferEXT)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glBindImageTexture)(GLuint,GLuint,GLint,GLboolean,GLint,GLenum,GLenum);
         void       (WINE_GLAPI *p_glBindImageTextureEXT)(GLuint,GLuint,GLint,GLboolean,GLint,GLenum,GLint);
+        void       (WINE_GLAPI *p_glBindImageTextures)(GLuint,GLsizei,const GLuint*);
         GLuint     (WINE_GLAPI *p_glBindLightParameterEXT)(GLenum,GLenum);
         GLuint     (WINE_GLAPI *p_glBindMaterialParameterEXT)(GLenum,GLenum);
         void       (WINE_GLAPI *p_glBindMultiTextureEXT)(GLenum,GLenum,GLuint);
@@ -430,14 +436,17 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glBindRenderbuffer)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glBindRenderbufferEXT)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glBindSampler)(GLuint,GLuint);
+        void       (WINE_GLAPI *p_glBindSamplers)(GLuint,GLsizei,const GLuint*);
         GLuint     (WINE_GLAPI *p_glBindTexGenParameterEXT)(GLenum,GLenum,GLenum);
         void       (WINE_GLAPI *p_glBindTextureEXT)(GLenum,GLuint);
         GLuint     (WINE_GLAPI *p_glBindTextureUnitParameterEXT)(GLenum,GLenum);
+        void       (WINE_GLAPI *p_glBindTextures)(GLuint,GLsizei,const GLuint*);
         void       (WINE_GLAPI *p_glBindTransformFeedback)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glBindTransformFeedbackNV)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glBindVertexArray)(GLuint);
         void       (WINE_GLAPI *p_glBindVertexArrayAPPLE)(GLuint);
         void       (WINE_GLAPI *p_glBindVertexBuffer)(GLuint,GLuint,GLintptr,GLsizei);
+        void       (WINE_GLAPI *p_glBindVertexBuffers)(GLuint,GLsizei,const GLuint*,const GLintptr*,const GLsizei*);
         void       (WINE_GLAPI *p_glBindVertexShaderEXT)(GLuint);
         void       (WINE_GLAPI *p_glBindVideoCaptureStreamBufferNV)(GLuint,GLuint,GLenum,GLintptrARB);
         void       (WINE_GLAPI *p_glBindVideoCaptureStreamTextureNV)(GLuint,GLuint,GLenum,GLenum,GLuint);
@@ -451,9 +460,12 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glBinormal3ivEXT)(const GLint*);
         void       (WINE_GLAPI *p_glBinormal3sEXT)(GLshort,GLshort,GLshort);
         void       (WINE_GLAPI *p_glBinormal3svEXT)(const GLshort*);
-        void       (WINE_GLAPI *p_glBinormalPointerEXT)(GLenum,GLsizei,const GLvoid*);
+        void       (WINE_GLAPI *p_glBinormalPointerEXT)(GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glBitmapxOES)(GLsizei,GLsizei,GLfixed,GLfixed,GLfixed,GLfixed,const GLubyte*);
+        void       (WINE_GLAPI *p_glBlendBarrierNV)(void);
         void       (WINE_GLAPI *p_glBlendColor)(GLfloat,GLfloat,GLfloat,GLfloat);
         void       (WINE_GLAPI *p_glBlendColorEXT)(GLfloat,GLfloat,GLfloat,GLfloat);
+        void       (WINE_GLAPI *p_glBlendColorxOES)(GLfixed,GLfixed,GLfixed,GLfixed);
         void       (WINE_GLAPI *p_glBlendEquation)(GLenum);
         void       (WINE_GLAPI *p_glBlendEquationEXT)(GLenum);
         void       (WINE_GLAPI *p_glBlendEquationIndexedAMD)(GLuint,GLenum);
@@ -473,20 +485,23 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glBlendFuncSeparateiARB)(GLuint,GLenum,GLenum,GLenum,GLenum);
         void       (WINE_GLAPI *p_glBlendFunci)(GLuint,GLenum,GLenum);
         void       (WINE_GLAPI *p_glBlendFunciARB)(GLuint,GLenum,GLenum);
+        void       (WINE_GLAPI *p_glBlendParameteriNV)(GLenum,GLint);
         void       (WINE_GLAPI *p_glBlitFramebuffer)(GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLbitfield,GLenum);
         void       (WINE_GLAPI *p_glBlitFramebufferEXT)(GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLint,GLbitfield,GLenum);
-        void       (WINE_GLAPI *p_glBufferAddressRangeNV)(GLenum,GLuint,UINT64,GLsizeiptr);
-        void       (WINE_GLAPI *p_glBufferData)(GLenum,GLsizeiptr,const GLvoid*,GLenum);
-        void       (WINE_GLAPI *p_glBufferDataARB)(GLenum,GLsizeiptrARB,const GLvoid*,GLenum);
+        void       (WINE_GLAPI *p_glBufferAddressRangeNV)(GLenum,GLuint,GLuint64EXT,GLsizeiptr);
+        void       (WINE_GLAPI *p_glBufferData)(GLenum,GLsizeiptr,const void*,GLenum);
+        void       (WINE_GLAPI *p_glBufferDataARB)(GLenum,GLsizeiptrARB,const void*,GLenum);
         void       (WINE_GLAPI *p_glBufferParameteriAPPLE)(GLenum,GLenum,GLint);
         GLuint     (WINE_GLAPI *p_glBufferRegionEnabled)(void);
-        void       (WINE_GLAPI *p_glBufferSubData)(GLenum,GLintptr,GLsizeiptr,const GLvoid*);
-        void       (WINE_GLAPI *p_glBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,const GLvoid*);
+        void       (WINE_GLAPI *p_glBufferStorage)(GLenum,GLsizeiptr,const void*,GLbitfield);
+        void       (WINE_GLAPI *p_glBufferSubData)(GLenum,GLintptr,GLsizeiptr,const void*);
+        void       (WINE_GLAPI *p_glBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,const void*);
         GLenum     (WINE_GLAPI *p_glCheckFramebufferStatus)(GLenum);
         GLenum     (WINE_GLAPI *p_glCheckFramebufferStatusEXT)(GLenum);
         GLenum     (WINE_GLAPI *p_glCheckNamedFramebufferStatusEXT)(GLuint,GLenum);
         void       (WINE_GLAPI *p_glClampColor)(GLenum,GLenum);
         void       (WINE_GLAPI *p_glClampColorARB)(GLenum,GLenum);
+        void       (WINE_GLAPI *p_glClearAccumxOES)(GLfixed,GLfixed,GLfixed,GLfixed);
         void       (WINE_GLAPI *p_glClearBufferData)(GLenum,GLenum,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glClearBufferSubData)(GLenum,GLenum,GLintptr,GLsizeiptr,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glClearBufferfi)(GLenum,GLint,GLfloat,GLint);
@@ -495,19 +510,28 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glClearBufferuiv)(GLenum,GLint,const GLuint*);
         void       (WINE_GLAPI *p_glClearColorIiEXT)(GLint,GLint,GLint,GLint);
         void       (WINE_GLAPI *p_glClearColorIuiEXT)(GLuint,GLuint,GLuint,GLuint);
+        void       (WINE_GLAPI *p_glClearColorxOES)(GLfixed,GLfixed,GLfixed,GLfixed);
         void       (WINE_GLAPI *p_glClearDepthdNV)(GLdouble);
         void       (WINE_GLAPI *p_glClearDepthf)(GLfloat);
+        void       (WINE_GLAPI *p_glClearDepthfOES)(GLclampf);
+        void       (WINE_GLAPI *p_glClearDepthxOES)(GLfixed);
         void       (WINE_GLAPI *p_glClearNamedBufferDataEXT)(GLuint,GLenum,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glClearNamedBufferSubDataEXT)(GLuint,GLenum,GLenum,GLenum,GLsizeiptr,GLsizeiptr,const void*);
+        void       (WINE_GLAPI *p_glClearTexImage)(GLuint,GLint,GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glClearTexSubImage)(GLuint,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glClientActiveTexture)(GLenum);
         void       (WINE_GLAPI *p_glClientActiveTextureARB)(GLenum);
         void       (WINE_GLAPI *p_glClientActiveVertexStreamATI)(GLenum);
         void       (WINE_GLAPI *p_glClientAttribDefaultEXT)(GLbitfield);
-        GLenum     (WINE_GLAPI *p_glClientWaitSync)(GLvoid*,GLbitfield,UINT64);
+        GLenum     (WINE_GLAPI *p_glClientWaitSync)(GLsync,GLbitfield,GLuint64);
+        void       (WINE_GLAPI *p_glClipPlanefOES)(GLenum,const GLfloat*);
+        void       (WINE_GLAPI *p_glClipPlanexOES)(GLenum,const GLfixed*);
         void       (WINE_GLAPI *p_glColor3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat);
         void       (WINE_GLAPI *p_glColor3fVertex3fvSUN)(const GLfloat*,const GLfloat*);
         void       (WINE_GLAPI *p_glColor3hNV)(GLhalfNV,GLhalfNV,GLhalfNV);
         void       (WINE_GLAPI *p_glColor3hvNV)(const GLhalfNV*);
+        void       (WINE_GLAPI *p_glColor3xOES)(GLfixed,GLfixed,GLfixed);
+        void       (WINE_GLAPI *p_glColor3xvOES)(const GLfixed*);
         void       (WINE_GLAPI *p_glColor4fNormal3fVertex3fSUN)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat);
         void       (WINE_GLAPI *p_glColor4fNormal3fVertex3fvSUN)(const GLfloat*,const GLfloat*,const GLfloat*);
         void       (WINE_GLAPI *p_glColor4hNV)(GLhalfNV,GLhalfNV,GLhalfNV,GLhalfNV);
@@ -516,6 +540,8 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glColor4ubVertex2fvSUN)(const GLubyte*,const GLfloat*);
         void       (WINE_GLAPI *p_glColor4ubVertex3fSUN)(GLubyte,GLubyte,GLubyte,GLubyte,GLfloat,GLfloat,GLfloat);
         void       (WINE_GLAPI *p_glColor4ubVertex3fvSUN)(const GLubyte*,const GLfloat*);
+        void       (WINE_GLAPI *p_glColor4xOES)(GLfixed,GLfixed,GLfixed,GLfixed);
+        void       (WINE_GLAPI *p_glColor4xvOES)(const GLfixed*);
         void       (WINE_GLAPI *p_glColorFormatNV)(GLint,GLenum,GLsizei);
         void       (WINE_GLAPI *p_glColorFragmentOp1ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint);
         void       (WINE_GLAPI *p_glColorFragmentOp2ATI)(GLenum,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint,GLuint);
@@ -526,18 +552,18 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glColorP3uiv)(GLenum,const GLuint*);
         void       (WINE_GLAPI *p_glColorP4ui)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glColorP4uiv)(GLenum,const GLuint*);
-        void       (WINE_GLAPI *p_glColorPointerEXT)(GLint,GLenum,GLsizei,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glColorPointerListIBM)(GLint,GLenum,GLint,const GLvoid**,GLint);
-        void       (WINE_GLAPI *p_glColorPointervINTEL)(GLint,GLenum,const GLvoid**);
-        void       (WINE_GLAPI *p_glColorSubTable)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glColorSubTableEXT)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glColorTable)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glColorTableEXT)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glColorPointerEXT)(GLint,GLenum,GLsizei,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glColorPointerListIBM)(GLint,GLenum,GLint,const void**,GLint);
+        void       (WINE_GLAPI *p_glColorPointervINTEL)(GLint,GLenum,const void**);
+        void       (WINE_GLAPI *p_glColorSubTable)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glColorSubTableEXT)(GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glColorTable)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glColorTableEXT)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glColorTableParameterfv)(GLenum,GLenum,const GLfloat*);
         void       (WINE_GLAPI *p_glColorTableParameterfvSGI)(GLenum,GLenum,const GLfloat*);
         void       (WINE_GLAPI *p_glColorTableParameteriv)(GLenum,GLenum,const GLint*);
         void       (WINE_GLAPI *p_glColorTableParameterivSGI)(GLenum,GLenum,const GLint*);
-        void       (WINE_GLAPI *p_glColorTableSGI)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glColorTableSGI)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glCombinerInputNV)(GLenum,GLenum,GLenum,GLenum,GLenum,GLenum);
         void       (WINE_GLAPI *p_glCombinerOutputNV)(GLenum,GLenum,GLenum,GLenum,GLenum,GLenum,GLenum,GLboolean,GLboolean,GLboolean);
         void       (WINE_GLAPI *p_glCombinerParameterfNV)(GLenum,GLfloat);
@@ -547,35 +573,35 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glCombinerStageParameterfvNV)(GLenum,GLenum,const GLfloat*);
         void       (WINE_GLAPI *p_glCompileShader)(GLuint);
         void       (WINE_GLAPI *p_glCompileShaderARB)(GLhandleARB);
-        void       (WINE_GLAPI *p_glCompileShaderIncludeARB)(GLuint,GLsizei,const GLchar**,const GLint*);
-        void       (WINE_GLAPI *p_glCompressedMultiTexImage1DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedMultiTexImage2DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedMultiTexImage3DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedMultiTexSubImage1DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedMultiTexSubImage2DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedMultiTexSubImage3DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexImage1D)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexImage1DARB)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexImage2D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexImage2DARB)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexImage3D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexImage3DARB)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexSubImage1DARB)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexSubImage2DARB)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTexSubImage3DARB)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTextureImage1DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTextureImage2DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTextureImage3DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTextureSubImage1DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glCompressedTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glConvolutionFilter1D)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glConvolutionFilter1DEXT)(GLenum,GLenum,GLsizei,GLenum,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glConvolutionFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glConvolutionFilter2DEXT)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glCompileShaderIncludeARB)(GLuint,GLsizei,const GLchar*const*,const GLint*);
+        void       (WINE_GLAPI *p_glCompressedMultiTexImage1DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedMultiTexImage2DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedMultiTexImage3DEXT)(GLenum,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedMultiTexSubImage1DEXT)(GLenum,GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedMultiTexSubImage2DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedMultiTexSubImage3DEXT)(GLenum,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexImage1D)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexImage1DARB)(GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexImage2D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexImage2DARB)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexImage3D)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexImage3DARB)(GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexSubImage1D)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexSubImage1DARB)(GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexSubImage2D)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexSubImage2DARB)(GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexSubImage3D)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTexSubImage3DARB)(GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTextureImage1DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTextureImage2DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTextureImage3DEXT)(GLuint,GLenum,GLint,GLenum,GLsizei,GLsizei,GLsizei,GLint,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTextureSubImage1DEXT)(GLuint,GLenum,GLint,GLint,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLsizei,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glCompressedTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei,GLsizei,GLsizei,GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glConvolutionFilter1D)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glConvolutionFilter1DEXT)(GLenum,GLenum,GLsizei,GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glConvolutionFilter2D)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glConvolutionFilter2DEXT)(GLenum,GLenum,GLsizei,GLsizei,GLenum,GLenum,const void*);
         void       (WINE_GLAPI *p_glConvolutionParameterf)(GLenum,GLenum,GLfloat);
         void       (WINE_GLAPI *p_glConvolutionParameterfEXT)(GLenum,GLenum,GLfloat);
         void       (WINE_GLAPI *p_glConvolutionParameterfv)(GLenum,GLenum,const GLfloat*);
@@ -584,6 +610,8 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glConvolutionParameteriEXT)(GLenum,GLenum,GLint);
         void       (WINE_GLAPI *p_glConvolutionParameteriv)(GLenum,GLenum,const GLint*);
         void       (WINE_GLAPI *p_glConvolutionParameterivEXT)(GLenum,GLenum,const GLint*);
+        void       (WINE_GLAPI *p_glConvolutionParameterxOES)(GLenum,GLenum,GLfixed);
+        void       (WINE_GLAPI *p_glConvolutionParameterxvOES)(GLenum,GLenum,const GLfixed*);
         void       (WINE_GLAPI *p_glCopyBufferSubData)(GLenum,GLenum,GLintptr,GLintptr,GLsizeiptr);
         void       (WINE_GLAPI *p_glCopyColorSubTable)(GLenum,GLsizei,GLint,GLint,GLsizei);
         void       (WINE_GLAPI *p_glCopyColorSubTableEXT)(GLenum,GLsizei,GLint,GLint,GLsizei);
@@ -612,23 +640,23 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glCopyTextureSubImage1DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLsizei);
         void       (WINE_GLAPI *p_glCopyTextureSubImage2DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei);
         void       (WINE_GLAPI *p_glCopyTextureSubImage3DEXT)(GLuint,GLenum,GLint,GLint,GLint,GLint,GLint,GLint,GLsizei,GLsizei);
-        void       (WINE_GLAPI *p_glCoverFillPathInstancedNV)(GLsizei,GLenum,const GLvoid*,GLuint,GLenum,GLenum,const GLfloat*);
+        void       (WINE_GLAPI *p_glCoverFillPathInstancedNV)(GLsizei,GLenum,const void*,GLuint,GLenum,GLenum,const GLfloat*);
         void       (WINE_GLAPI *p_glCoverFillPathNV)(GLuint,GLenum);
-        void       (WINE_GLAPI *p_glCoverStrokePathInstancedNV)(GLsizei,GLenum,const GLvoid*,GLuint,GLenum,GLenum,const GLfloat*);
+        void       (WINE_GLAPI *p_glCoverStrokePathInstancedNV)(GLsizei,GLenum,const void*,GLuint,GLenum,GLenum,const GLfloat*);
         void       (WINE_GLAPI *p_glCoverStrokePathNV)(GLuint,GLenum);
         GLuint     (WINE_GLAPI *p_glCreateProgram)(void);
         GLhandleARB (WINE_GLAPI *p_glCreateProgramObjectARB)(void);
         GLuint     (WINE_GLAPI *p_glCreateShader)(GLenum);
         GLhandleARB (WINE_GLAPI *p_glCreateShaderObjectARB)(GLenum);
         GLuint     (WINE_GLAPI *p_glCreateShaderProgramEXT)(GLenum,const GLchar*);
-        GLuint     (WINE_GLAPI *p_glCreateShaderProgramv)(GLenum,GLsizei,const GLchar* const*);
-        GLvoid*    (WINE_GLAPI *p_glCreateSyncFromCLeventARB)(void *,void *,GLbitfield);
+        GLuint     (WINE_GLAPI *p_glCreateShaderProgramv)(GLenum,GLsizei,const GLchar*const*);
+        GLsync     (WINE_GLAPI *p_glCreateSyncFromCLeventARB)(void*,void*,GLbitfield);
         void       (WINE_GLAPI *p_glCullParameterdvEXT)(GLenum,GLdouble*);
         void       (WINE_GLAPI *p_glCullParameterfvEXT)(GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glCurrentPaletteMatrixARB)(GLint);
         void       (WINE_GLAPI *p_glDebugMessageCallback)(void *,const void*);
-        void       (WINE_GLAPI *p_glDebugMessageCallbackAMD)(void *,GLvoid*);
-        void       (WINE_GLAPI *p_glDebugMessageCallbackARB)(void *,const GLvoid*);
+        void       (WINE_GLAPI *p_glDebugMessageCallbackAMD)(void *,void*);
+        void       (WINE_GLAPI *p_glDebugMessageCallbackARB)(void *,const void*);
         void       (WINE_GLAPI *p_glDebugMessageControl)(GLenum,GLenum,GLenum,GLsizei,const GLuint*,GLboolean);
         void       (WINE_GLAPI *p_glDebugMessageControlARB)(GLenum,GLenum,GLenum,GLsizei,const GLuint*,GLboolean);
         void       (WINE_GLAPI *p_glDebugMessageEnableAMD)(GLenum,GLenum,GLsizei,const GLuint*,GLboolean);
@@ -664,7 +692,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glDeleteRenderbuffersEXT)(GLsizei,const GLuint*);
         void       (WINE_GLAPI *p_glDeleteSamplers)(GLsizei,const GLuint*);
         void       (WINE_GLAPI *p_glDeleteShader)(GLuint);
-        void       (WINE_GLAPI *p_glDeleteSync)(GLvoid*);
+        void       (WINE_GLAPI *p_glDeleteSync)(GLsync);
         void       (WINE_GLAPI *p_glDeleteTexturesEXT)(GLsizei,const GLuint*);
         void       (WINE_GLAPI *p_glDeleteTransformFeedbacks)(GLsizei,const GLuint*);
         void       (WINE_GLAPI *p_glDeleteTransformFeedbacksNV)(GLsizei,const GLuint*);
@@ -677,20 +705,26 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glDepthRangeIndexed)(GLuint,GLdouble,GLdouble);
         void       (WINE_GLAPI *p_glDepthRangedNV)(GLdouble,GLdouble);
         void       (WINE_GLAPI *p_glDepthRangef)(GLfloat,GLfloat);
+        void       (WINE_GLAPI *p_glDepthRangefOES)(GLclampf,GLclampf);
+        void       (WINE_GLAPI *p_glDepthRangexOES)(GLfixed,GLfixed);
         void       (WINE_GLAPI *p_glDetachObjectARB)(GLhandleARB,GLhandleARB);
         void       (WINE_GLAPI *p_glDetachShader)(GLuint,GLuint);
         void       (WINE_GLAPI *p_glDetailTexFuncSGIS)(GLenum,GLsizei,const GLfloat*);
         void       (WINE_GLAPI *p_glDisableClientStateIndexedEXT)(GLenum,GLuint);
+        void       (WINE_GLAPI *p_glDisableClientStateiEXT)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glDisableIndexedEXT)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glDisableVariantClientStateEXT)(GLuint);
+        void       (WINE_GLAPI *p_glDisableVertexArrayAttribEXT)(GLuint,GLuint);
+        void       (WINE_GLAPI *p_glDisableVertexArrayEXT)(GLuint,GLenum);
         void       (WINE_GLAPI *p_glDisableVertexAttribAPPLE)(GLuint,GLenum);
         void       (WINE_GLAPI *p_glDisableVertexAttribArray)(GLuint);
         void       (WINE_GLAPI *p_glDisableVertexAttribArrayARB)(GLuint);
         void       (WINE_GLAPI *p_glDisablei)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glDispatchCompute)(GLuint,GLuint,GLuint);
+        void       (WINE_GLAPI *p_glDispatchComputeGroupSizeARB)(GLuint,GLuint,GLuint,GLuint,GLuint,GLuint);
         void       (WINE_GLAPI *p_glDispatchComputeIndirect)(GLintptr);
         void       (WINE_GLAPI *p_glDrawArraysEXT)(GLenum,GLint,GLsizei);
-        void       (WINE_GLAPI *p_glDrawArraysIndirect)(GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glDrawArraysIndirect)(GLenum,const void*);
         void       (WINE_GLAPI *p_glDrawArraysInstanced)(GLenum,GLint,GLsizei,GLsizei);
         void       (WINE_GLAPI *p_glDrawArraysInstancedARB)(GLenum,GLint,GLsizei,GLsizei);
         void       (WINE_GLAPI *p_glDrawArraysInstancedBaseInstance)(GLenum,GLint,GLsizei,GLsizei,GLuint);
@@ -701,20 +735,21 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glDrawBuffersATI)(GLsizei,const GLenum*);
         void       (WINE_GLAPI *p_glDrawElementArrayAPPLE)(GLenum,GLint,GLsizei);
         void       (WINE_GLAPI *p_glDrawElementArrayATI)(GLenum,GLsizei);
-        void       (WINE_GLAPI *p_glDrawElementsBaseVertex)(GLenum,GLsizei,GLenum,const GLvoid*,GLint);
-        void       (WINE_GLAPI *p_glDrawElementsIndirect)(GLenum,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glDrawElementsInstanced)(GLenum,GLsizei,GLenum,const GLvoid*,GLsizei);
-        void       (WINE_GLAPI *p_glDrawElementsInstancedARB)(GLenum,GLsizei,GLenum,const GLvoid*,GLsizei);
+        void       (WINE_GLAPI *p_glDrawElementsBaseVertex)(GLenum,GLsizei,GLenum,const void*,GLint);
+        void       (WINE_GLAPI *p_glDrawElementsIndirect)(GLenum,GLenum,const void*);
+        void       (WINE_GLAPI *p_glDrawElementsInstanced)(GLenum,GLsizei,GLenum,const void*,GLsizei);
+        void       (WINE_GLAPI *p_glDrawElementsInstancedARB)(GLenum,GLsizei,GLenum,const void*,GLsizei);
         void       (WINE_GLAPI *p_glDrawElementsInstancedBaseInstance)(GLenum,GLsizei,GLenum,const void*,GLsizei,GLuint);
-        void       (WINE_GLAPI *p_glDrawElementsInstancedBaseVertex)(GLenum,GLsizei,GLenum,const GLvoid*,GLsizei,GLint);
+        void       (WINE_GLAPI *p_glDrawElementsInstancedBaseVertex)(GLenum,GLsizei,GLenum,const void*,GLsizei,GLint);
         void       (WINE_GLAPI *p_glDrawElementsInstancedBaseVertexBaseInstance)(GLenum,GLsizei,GLenum,const void*,GLsizei,GLint,GLuint);
-        void       (WINE_GLAPI *p_glDrawElementsInstancedEXT)(GLenum,GLsizei,GLenum,const GLvoid*,GLsizei);
+        void       (WINE_GLAPI *p_glDrawElementsInstancedEXT)(GLenum,GLsizei,GLenum,const void*,GLsizei);
         void       (WINE_GLAPI *p_glDrawMeshArraysSUN)(GLenum,GLint,GLsizei,GLsizei);
         void       (WINE_GLAPI *p_glDrawRangeElementArrayAPPLE)(GLenum,GLuint,GLuint,GLint,GLsizei);
         void       (WINE_GLAPI *p_glDrawRangeElementArrayATI)(GLenum,GLuint,GLuint,GLsizei);
-        void       (WINE_GLAPI *p_glDrawRangeElements)(GLenum,GLuint,GLuint,GLsizei,GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glDrawRangeElementsBaseVertex)(GLenum,GLuint,GLuint,GLsizei,GLenum,const GLvoid*,GLint);
-        void       (WINE_GLAPI *p_glDrawRangeElementsEXT)(GLenum,GLuint,GLuint,GLsizei,GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glDrawRangeElements)(GLenum,GLuint,GLuint,GLsizei,GLenum,const void*);
+        void       (WINE_GLAPI *p_glDrawRangeElementsBaseVertex)(GLenum,GLuint,GLuint,GLsizei,GLenum,const void*,GLint);
+        void       (WINE_GLAPI *p_glDrawRangeElementsEXT)(GLenum,GLuint,GLuint,GLsizei,GLenum,const void*);
+        void       (WINE_GLAPI *p_glDrawTextureNV)(GLuint,GLuint,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat);
         void       (WINE_GLAPI *p_glDrawTransformFeedback)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glDrawTransformFeedbackInstanced)(GLenum,GLuint,GLsizei);
         void       (WINE_GLAPI *p_glDrawTransformFeedbackNV)(GLenum,GLuint);
@@ -723,17 +758,21 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glEdgeFlagFormatNV)(GLsizei);
         void       (WINE_GLAPI *p_glEdgeFlagPointerEXT)(GLsizei,GLsizei,const GLboolean*);
         void       (WINE_GLAPI *p_glEdgeFlagPointerListIBM)(GLint,const GLboolean**,GLint);
-        void       (WINE_GLAPI *p_glElementPointerAPPLE)(GLenum,const GLvoid*);
-        void       (WINE_GLAPI *p_glElementPointerATI)(GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glElementPointerAPPLE)(GLenum,const void*);
+        void       (WINE_GLAPI *p_glElementPointerATI)(GLenum,const void*);
         void       (WINE_GLAPI *p_glEnableClientStateIndexedEXT)(GLenum,GLuint);
+        void       (WINE_GLAPI *p_glEnableClientStateiEXT)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glEnableIndexedEXT)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glEnableVariantClientStateEXT)(GLuint);
+        void       (WINE_GLAPI *p_glEnableVertexArrayAttribEXT)(GLuint,GLuint);
+        void       (WINE_GLAPI *p_glEnableVertexArrayEXT)(GLuint,GLenum);
         void       (WINE_GLAPI *p_glEnableVertexAttribAPPLE)(GLuint,GLenum);
         void       (WINE_GLAPI *p_glEnableVertexAttribArray)(GLuint);
         void       (WINE_GLAPI *p_glEnableVertexAttribArrayARB)(GLuint);
         void       (WINE_GLAPI *p_glEnablei)(GLenum,GLuint);
         void       (WINE_GLAPI *p_glEndConditionalRender)(void);
         void       (WINE_GLAPI *p_glEndConditionalRenderNV)(void);
+        void       (WINE_GLAPI *p_glEndConditionalRenderNVX)(void);
         void       (WINE_GLAPI *p_glEndFragmentShaderATI)(void);
         void       (WINE_GLAPI *p_glEndOcclusionQueryNV)(void);
         void       (WINE_GLAPI *p_glEndPerfMonitorAMD)(GLuint);
@@ -745,10 +784,15 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glEndTransformFeedbackNV)(void);
         void       (WINE_GLAPI *p_glEndVertexShaderEXT)(void);
         void       (WINE_GLAPI *p_glEndVideoCaptureNV)(GLuint);
+        void       (WINE_GLAPI *p_glEvalCoord1xOES)(GLfixed);
+        void       (WINE_GLAPI *p_glEvalCoord1xvOES)(const GLfixed*);
+        void       (WINE_GLAPI *p_glEvalCoord2xOES)(GLfixed,GLfixed);
+        void       (WINE_GLAPI *p_glEvalCoord2xvOES)(const GLfixed*);
         void       (WINE_GLAPI *p_glEvalMapsNV)(GLenum,GLenum);
         void       (WINE_GLAPI *p_glExecuteProgramNV)(GLenum,GLuint,const GLfloat*);
         void       (WINE_GLAPI *p_glExtractComponentEXT)(GLuint,GLuint,GLuint);
-        GLvoid*    (WINE_GLAPI *p_glFenceSync)(GLenum,GLbitfield);
+        void       (WINE_GLAPI *p_glFeedbackBufferxOES)(GLsizei,GLenum,const GLfixed*);
+        GLsync     (WINE_GLAPI *p_glFenceSync)(GLenum,GLbitfield);
         void       (WINE_GLAPI *p_glFinalCombinerInputNV)(GLenum,GLenum,GLenum,GLenum);
         GLint      (WINE_GLAPI *p_glFinishAsyncSGIX)(GLuint*);
         void       (WINE_GLAPI *p_glFinishFenceAPPLE)(GLuint);
@@ -760,12 +804,13 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glFlushMappedNamedBufferRangeEXT)(GLuint,GLintptr,GLsizeiptr);
         void       (WINE_GLAPI *p_glFlushPixelDataRangeNV)(GLenum);
         void       (WINE_GLAPI *p_glFlushRasterSGIX)(void);
-        void       (WINE_GLAPI *p_glFlushVertexArrayRangeAPPLE)(GLsizei,GLvoid*);
+        void       (WINE_GLAPI *p_glFlushStaticDataIBM)(GLenum);
+        void       (WINE_GLAPI *p_glFlushVertexArrayRangeAPPLE)(GLsizei,void*);
         void       (WINE_GLAPI *p_glFlushVertexArrayRangeNV)(void);
         void       (WINE_GLAPI *p_glFogCoordFormatNV)(GLenum,GLsizei);
-        void       (WINE_GLAPI *p_glFogCoordPointer)(GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glFogCoordPointerEXT)(GLenum,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glFogCoordPointerListIBM)(GLenum,GLint,const GLvoid**,GLint);
+        void       (WINE_GLAPI *p_glFogCoordPointer)(GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glFogCoordPointerEXT)(GLenum,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glFogCoordPointerListIBM)(GLenum,GLint,const void**,GLint);
         void       (WINE_GLAPI *p_glFogCoordd)(GLdouble);
         void       (WINE_GLAPI *p_glFogCoorddEXT)(GLdouble);
         void       (WINE_GLAPI *p_glFogCoorddv)(const GLdouble*);
@@ -777,6 +822,8 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glFogCoordhNV)(GLhalfNV);
         void       (WINE_GLAPI *p_glFogCoordhvNV)(const GLhalfNV*);
         void       (WINE_GLAPI *p_glFogFuncSGIS)(GLsizei,const GLfloat*);
+        void       (WINE_GLAPI *p_glFogxOES)(GLenum,GLfixed);
+        void       (WINE_GLAPI *p_glFogxvOES)(GLenum,const GLfixed*);
         void       (WINE_GLAPI *p_glFragmentColorMaterialSGIX)(GLenum,GLenum);
         void       (WINE_GLAPI *p_glFragmentLightModelfSGIX)(GLenum,GLfloat);
         void       (WINE_GLAPI *p_glFragmentLightModelfvSGIX)(GLenum,const GLfloat*);
@@ -813,6 +860,8 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glFramebufferTextureLayerARB)(GLenum,GLenum,GLuint,GLint,GLint);
         void       (WINE_GLAPI *p_glFramebufferTextureLayerEXT)(GLenum,GLenum,GLuint,GLint,GLint);
         void       (WINE_GLAPI *p_glFreeObjectBufferATI)(GLuint);
+        void       (WINE_GLAPI *p_glFrustumfOES)(GLfloat,GLfloat,GLfloat,GLfloat,GLfloat,GLfloat);
+        void       (WINE_GLAPI *p_glFrustumxOES)(GLfixed,GLfixed,GLfixed,GLfixed,GLfixed,GLfixed);
         GLuint     (WINE_GLAPI *p_glGenAsyncMarkersSGIX)(GLsizei);
         void       (WINE_GLAPI *p_glGenBuffers)(GLsizei,GLuint*);
         void       (WINE_GLAPI *p_glGenBuffersARB)(GLsizei,GLuint*);
@@ -865,49 +914,55 @@ struct opengl_funcs
         GLint      (WINE_GLAPI *p_glGetAttribLocationARB)(GLhandleARB,const GLcharARB*);
         void       (WINE_GLAPI *p_glGetBooleanIndexedvEXT)(GLenum,GLuint,GLboolean*);
         void       (WINE_GLAPI *p_glGetBooleani_v)(GLenum,GLuint,GLboolean*);
-        void       (WINE_GLAPI *p_glGetBufferParameteri64v)(GLenum,GLenum,INT64*);
+        void       (WINE_GLAPI *p_glGetBufferParameteri64v)(GLenum,GLenum,GLint64*);
         void       (WINE_GLAPI *p_glGetBufferParameteriv)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetBufferParameterivARB)(GLenum,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetBufferParameterui64vNV)(GLenum,GLenum,UINT64*);
-        void       (WINE_GLAPI *p_glGetBufferPointerv)(GLenum,GLenum,GLvoid**);
-        void       (WINE_GLAPI *p_glGetBufferPointervARB)(GLenum,GLenum,GLvoid**);
-        void       (WINE_GLAPI *p_glGetBufferSubData)(GLenum,GLintptr,GLsizeiptr,GLvoid*);
-        void       (WINE_GLAPI *p_glGetBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,GLvoid*);
-        void       (WINE_GLAPI *p_glGetColorTable)(GLenum,GLenum,GLenum,GLvoid*);
-        void       (WINE_GLAPI *p_glGetColorTableEXT)(GLenum,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetBufferParameterui64vNV)(GLenum,GLenum,GLuint64EXT*);
+        void       (WINE_GLAPI *p_glGetBufferPointerv)(GLenum,GLenum,void**);
+        void       (WINE_GLAPI *p_glGetBufferPointervARB)(GLenum,GLenum,void**);
+        void       (WINE_GLAPI *p_glGetBufferSubData)(GLenum,GLintptr,GLsizeiptr,void*);
+        void       (WINE_GLAPI *p_glGetBufferSubDataARB)(GLenum,GLintptrARB,GLsizeiptrARB,void*);
+        void       (WINE_GLAPI *p_glGetClipPlanefOES)(GLenum,GLfloat*);
+        void       (WINE_GLAPI *p_glGetClipPlanexOES)(GLenum,GLfixed*);
+        void       (WINE_GLAPI *p_glGetColorTable)(GLenum,GLenum,GLenum,void*);
+        void       (WINE_GLAPI *p_glGetColorTableEXT)(GLenum,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetColorTableParameterfv)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetColorTableParameterfvEXT)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetColorTableParameterfvSGI)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetColorTableParameteriv)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetColorTableParameterivEXT)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetColorTableParameterivSGI)(GLenum,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetColorTableSGI)(GLenum,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetColorTableSGI)(GLenum,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetCombinerInputParameterfvNV)(GLenum,GLenum,GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetCombinerInputParameterivNV)(GLenum,GLenum,GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetCombinerOutputParameterfvNV)(GLenum,GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetCombinerOutputParameterivNV)(GLenum,GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetCombinerStageParameterfvNV)(GLenum,GLenum,GLfloat*);
-        void       (WINE_GLAPI *p_glGetCompressedMultiTexImageEXT)(GLenum,GLenum,GLint,GLvoid*);
-        void       (WINE_GLAPI *p_glGetCompressedTexImage)(GLenum,GLint,GLvoid*);
-        void       (WINE_GLAPI *p_glGetCompressedTexImageARB)(GLenum,GLint,GLvoid*);
-        void       (WINE_GLAPI *p_glGetCompressedTextureImageEXT)(GLuint,GLenum,GLint,GLvoid*);
-        void       (WINE_GLAPI *p_glGetConvolutionFilter)(GLenum,GLenum,GLenum,GLvoid*);
-        void       (WINE_GLAPI *p_glGetConvolutionFilterEXT)(GLenum,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetCompressedMultiTexImageEXT)(GLenum,GLenum,GLint,void*);
+        void       (WINE_GLAPI *p_glGetCompressedTexImage)(GLenum,GLint,void*);
+        void       (WINE_GLAPI *p_glGetCompressedTexImageARB)(GLenum,GLint,void*);
+        void       (WINE_GLAPI *p_glGetCompressedTextureImageEXT)(GLuint,GLenum,GLint,void*);
+        void       (WINE_GLAPI *p_glGetConvolutionFilter)(GLenum,GLenum,GLenum,void*);
+        void       (WINE_GLAPI *p_glGetConvolutionFilterEXT)(GLenum,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetConvolutionParameterfv)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetConvolutionParameterfvEXT)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetConvolutionParameteriv)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetConvolutionParameterivEXT)(GLenum,GLenum,GLint*);
+        void       (WINE_GLAPI *p_glGetConvolutionParameterxvOES)(GLenum,GLenum,GLfixed*);
         GLuint     (WINE_GLAPI *p_glGetDebugMessageLog)(GLuint,GLsizei,GLenum*,GLenum*,GLuint*,GLenum*,GLsizei*,GLchar*);
         GLuint     (WINE_GLAPI *p_glGetDebugMessageLogAMD)(GLuint,GLsizei,GLenum*,GLuint*,GLuint*,GLsizei*,GLchar*);
         GLuint     (WINE_GLAPI *p_glGetDebugMessageLogARB)(GLuint,GLsizei,GLenum*,GLenum*,GLuint*,GLenum*,GLsizei*,GLchar*);
         void       (WINE_GLAPI *p_glGetDetailTexFuncSGIS)(GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetDoubleIndexedvEXT)(GLenum,GLuint,GLdouble*);
         void       (WINE_GLAPI *p_glGetDoublei_v)(GLenum,GLuint,GLdouble*);
+        void       (WINE_GLAPI *p_glGetDoublei_vEXT)(GLenum,GLuint,GLdouble*);
         void       (WINE_GLAPI *p_glGetFenceivNV)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetFinalCombinerInputParameterfvNV)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetFinalCombinerInputParameterivNV)(GLenum,GLenum,GLint*);
+        void       (WINE_GLAPI *p_glGetFixedvOES)(GLenum,GLfixed*);
         void       (WINE_GLAPI *p_glGetFloatIndexedvEXT)(GLenum,GLuint,GLfloat*);
         void       (WINE_GLAPI *p_glGetFloati_v)(GLenum,GLuint,GLfloat*);
+        void       (WINE_GLAPI *p_glGetFloati_vEXT)(GLenum,GLuint,GLfloat*);
         void       (WINE_GLAPI *p_glGetFogFuncSGIS)(GLfloat*);
         GLint      (WINE_GLAPI *p_glGetFragDataIndex)(GLuint,const GLchar*);
         GLint      (WINE_GLAPI *p_glGetFragDataLocation)(GLuint,const GLchar*);
@@ -922,28 +977,31 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetFramebufferParameterivEXT)(GLuint,GLenum,GLint*);
         GLenum     (WINE_GLAPI *p_glGetGraphicsResetStatusARB)(void);
         GLhandleARB (WINE_GLAPI *p_glGetHandleARB)(GLenum);
-        void       (WINE_GLAPI *p_glGetHistogram)(GLenum,GLboolean,GLenum,GLenum,GLvoid*);
-        void       (WINE_GLAPI *p_glGetHistogramEXT)(GLenum,GLboolean,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetHistogram)(GLenum,GLboolean,GLenum,GLenum,void*);
+        void       (WINE_GLAPI *p_glGetHistogramEXT)(GLenum,GLboolean,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetHistogramParameterfv)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetHistogramParameterfvEXT)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetHistogramParameteriv)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetHistogramParameterivEXT)(GLenum,GLenum,GLint*);
-        UINT64     (WINE_GLAPI *p_glGetImageHandleNV)(GLuint,GLint,GLboolean,GLint,GLenum);
+        void       (WINE_GLAPI *p_glGetHistogramParameterxvOES)(GLenum,GLenum,GLfixed*);
+        GLuint64   (WINE_GLAPI *p_glGetImageHandleARB)(GLuint,GLint,GLboolean,GLint,GLenum);
+        GLuint64   (WINE_GLAPI *p_glGetImageHandleNV)(GLuint,GLint,GLboolean,GLint,GLenum);
         void       (WINE_GLAPI *p_glGetImageTransformParameterfvHP)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetImageTransformParameterivHP)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetInfoLogARB)(GLhandleARB,GLsizei,GLsizei*,GLcharARB*);
         GLint      (WINE_GLAPI *p_glGetInstrumentsSGIX)(void);
-        void       (WINE_GLAPI *p_glGetInteger64i_v)(GLenum,GLuint,INT64*);
-        void       (WINE_GLAPI *p_glGetInteger64v)(GLenum,INT64*);
+        void       (WINE_GLAPI *p_glGetInteger64i_v)(GLenum,GLuint,GLint64*);
+        void       (WINE_GLAPI *p_glGetInteger64v)(GLenum,GLint64*);
         void       (WINE_GLAPI *p_glGetIntegerIndexedvEXT)(GLenum,GLuint,GLint*);
         void       (WINE_GLAPI *p_glGetIntegeri_v)(GLenum,GLuint,GLint*);
-        void       (WINE_GLAPI *p_glGetIntegerui64i_vNV)(GLenum,GLuint,UINT64*);
-        void       (WINE_GLAPI *p_glGetIntegerui64vNV)(GLenum,UINT64*);
-        void       (WINE_GLAPI *p_glGetInternalformati64v)(GLenum,GLenum,GLenum,GLsizei,INT64*);
+        void       (WINE_GLAPI *p_glGetIntegerui64i_vNV)(GLenum,GLuint,GLuint64EXT*);
+        void       (WINE_GLAPI *p_glGetIntegerui64vNV)(GLenum,GLuint64EXT*);
+        void       (WINE_GLAPI *p_glGetInternalformati64v)(GLenum,GLenum,GLenum,GLsizei,GLint64*);
         void       (WINE_GLAPI *p_glGetInternalformativ)(GLenum,GLenum,GLenum,GLsizei,GLint*);
         void       (WINE_GLAPI *p_glGetInvariantBooleanvEXT)(GLuint,GLenum,GLboolean*);
         void       (WINE_GLAPI *p_glGetInvariantFloatvEXT)(GLuint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetInvariantIntegervEXT)(GLuint,GLenum,GLint*);
+        void       (WINE_GLAPI *p_glGetLightxOES)(GLenum,GLenum,GLfixed*);
         void       (WINE_GLAPI *p_glGetListParameterfvSGIX)(GLuint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetListParameterivSGIX)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetLocalConstantBooleanvEXT)(GLuint,GLenum,GLboolean*);
@@ -951,11 +1009,13 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetLocalConstantIntegervEXT)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetMapAttribParameterfvNV)(GLenum,GLuint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetMapAttribParameterivNV)(GLenum,GLuint,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetMapControlPointsNV)(GLenum,GLuint,GLenum,GLsizei,GLsizei,GLboolean,GLvoid*);
+        void       (WINE_GLAPI *p_glGetMapControlPointsNV)(GLenum,GLuint,GLenum,GLsizei,GLsizei,GLboolean,void*);
         void       (WINE_GLAPI *p_glGetMapParameterfvNV)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetMapParameterivNV)(GLenum,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetMinmax)(GLenum,GLboolean,GLenum,GLenum,GLvoid*);
-        void       (WINE_GLAPI *p_glGetMinmaxEXT)(GLenum,GLboolean,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetMapxvOES)(GLenum,GLenum,GLfixed*);
+        void       (WINE_GLAPI *p_glGetMaterialxOES)(GLenum,GLenum,GLfixed);
+        void       (WINE_GLAPI *p_glGetMinmax)(GLenum,GLboolean,GLenum,GLenum,void*);
+        void       (WINE_GLAPI *p_glGetMinmaxEXT)(GLenum,GLboolean,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetMinmaxParameterfv)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetMinmaxParameterfvEXT)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetMinmaxParameteriv)(GLenum,GLenum,GLint*);
@@ -965,7 +1025,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetMultiTexGendvEXT)(GLenum,GLenum,GLenum,GLdouble*);
         void       (WINE_GLAPI *p_glGetMultiTexGenfvEXT)(GLenum,GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetMultiTexGenivEXT)(GLenum,GLenum,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetMultiTexImageEXT)(GLenum,GLenum,GLint,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetMultiTexImageEXT)(GLenum,GLenum,GLint,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetMultiTexLevelParameterfvEXT)(GLenum,GLenum,GLint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetMultiTexLevelParameterivEXT)(GLenum,GLenum,GLint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetMultiTexParameterIivEXT)(GLenum,GLenum,GLenum,GLint*);
@@ -975,16 +1035,16 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetMultisamplefv)(GLenum,GLuint,GLfloat*);
         void       (WINE_GLAPI *p_glGetMultisamplefvNV)(GLenum,GLuint,GLfloat*);
         void       (WINE_GLAPI *p_glGetNamedBufferParameterivEXT)(GLuint,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetNamedBufferParameterui64vNV)(GLuint,GLenum,UINT64*);
-        void       (WINE_GLAPI *p_glGetNamedBufferPointervEXT)(GLuint,GLenum,GLvoid**);
-        void       (WINE_GLAPI *p_glGetNamedBufferSubDataEXT)(GLuint,GLintptr,GLsizeiptr,GLvoid*);
+        void       (WINE_GLAPI *p_glGetNamedBufferParameterui64vNV)(GLuint,GLenum,GLuint64EXT*);
+        void       (WINE_GLAPI *p_glGetNamedBufferPointervEXT)(GLuint,GLenum,void**);
+        void       (WINE_GLAPI *p_glGetNamedBufferSubDataEXT)(GLuint,GLintptr,GLsizeiptr,void*);
         void       (WINE_GLAPI *p_glGetNamedFramebufferAttachmentParameterivEXT)(GLuint,GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetNamedFramebufferParameterivEXT)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetNamedProgramLocalParameterIivEXT)(GLuint,GLenum,GLuint,GLint*);
         void       (WINE_GLAPI *p_glGetNamedProgramLocalParameterIuivEXT)(GLuint,GLenum,GLuint,GLuint*);
         void       (WINE_GLAPI *p_glGetNamedProgramLocalParameterdvEXT)(GLuint,GLenum,GLuint,GLdouble*);
         void       (WINE_GLAPI *p_glGetNamedProgramLocalParameterfvEXT)(GLuint,GLenum,GLuint,GLfloat*);
-        void       (WINE_GLAPI *p_glGetNamedProgramStringEXT)(GLuint,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetNamedProgramStringEXT)(GLuint,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetNamedProgramivEXT)(GLuint,GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetNamedRenderbufferParameterivEXT)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetNamedStringARB)(GLint,const GLchar*,GLsizei,GLint*,GLchar*);
@@ -992,6 +1052,7 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetObjectBufferfvATI)(GLuint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetObjectBufferivATI)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetObjectLabel)(GLenum,GLuint,GLsizei,GLsizei*,GLchar*);
+        void       (WINE_GLAPI *p_glGetObjectLabelEXT)(GLenum,GLuint,GLsizei,GLsizei*,GLchar*);
         void       (WINE_GLAPI *p_glGetObjectParameterfvARB)(GLhandleARB,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetObjectParameterivAPPLE)(GLenum,GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetObjectParameterivARB)(GLhandleARB,GLenum,GLint*);
@@ -1005,25 +1066,27 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetPathDashArrayNV)(GLuint,GLfloat*);
         GLfloat    (WINE_GLAPI *p_glGetPathLengthNV)(GLuint,GLsizei,GLsizei);
         void       (WINE_GLAPI *p_glGetPathMetricRangeNV)(GLbitfield,GLuint,GLsizei,GLsizei,GLfloat*);
-        void       (WINE_GLAPI *p_glGetPathMetricsNV)(GLbitfield,GLsizei,GLenum,const GLvoid*,GLuint,GLsizei,GLfloat*);
+        void       (WINE_GLAPI *p_glGetPathMetricsNV)(GLbitfield,GLsizei,GLenum,const void*,GLuint,GLsizei,GLfloat*);
         void       (WINE_GLAPI *p_glGetPathParameterfvNV)(GLuint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetPathParameterivNV)(GLuint,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetPathSpacingNV)(GLenum,GLsizei,GLenum,const GLvoid*,GLuint,GLfloat,GLfloat,GLenum,GLfloat*);
+        void       (WINE_GLAPI *p_glGetPathSpacingNV)(GLenum,GLsizei,GLenum,const void*,GLuint,GLfloat,GLfloat,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetPathTexGenfvNV)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetPathTexGenivNV)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetPerfMonitorCounterDataAMD)(GLuint,GLenum,GLsizei,GLuint*,GLint*);
-        void       (WINE_GLAPI *p_glGetPerfMonitorCounterInfoAMD)(GLuint,GLuint,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetPerfMonitorCounterInfoAMD)(GLuint,GLuint,GLenum,void*);
         void       (WINE_GLAPI *p_glGetPerfMonitorCounterStringAMD)(GLuint,GLuint,GLsizei,GLsizei*,GLchar*);
         void       (WINE_GLAPI *p_glGetPerfMonitorCountersAMD)(GLuint,GLint*,GLint*,GLsizei,GLuint*);
         void       (WINE_GLAPI *p_glGetPerfMonitorGroupStringAMD)(GLuint,GLsizei,GLsizei*,GLchar*);
         void       (WINE_GLAPI *p_glGetPerfMonitorGroupsAMD)(GLint*,GLsizei,GLuint*);
+        void       (WINE_GLAPI *p_glGetPixelMapxv)(GLenum,GLint,GLfixed*);
         void       (WINE_GLAPI *p_glGetPixelTexGenParameterfvSGIS)(GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetPixelTexGenParameterivSGIS)(GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetPixelTransformParameterfvEXT)(GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetPixelTransformParameterivEXT)(GLenum,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetPointerIndexedvEXT)(GLenum,GLuint,GLvoid**);
-        void       (WINE_GLAPI *p_glGetPointervEXT)(GLenum,GLvoid**);
-        void       (WINE_GLAPI *p_glGetProgramBinary)(GLuint,GLsizei,GLsizei*,GLenum*,GLvoid*);
+        void       (WINE_GLAPI *p_glGetPointerIndexedvEXT)(GLenum,GLuint,void**);
+        void       (WINE_GLAPI *p_glGetPointeri_vEXT)(GLenum,GLuint,void**);
+        void       (WINE_GLAPI *p_glGetPointervEXT)(GLenum,void**);
+        void       (WINE_GLAPI *p_glGetProgramBinary)(GLuint,GLsizei,GLsizei*,GLenum*,void*);
         void       (WINE_GLAPI *p_glGetProgramEnvParameterIivNV)(GLenum,GLuint,GLint*);
         void       (WINE_GLAPI *p_glGetProgramEnvParameterIuivNV)(GLenum,GLuint,GLuint*);
         void       (WINE_GLAPI *p_glGetProgramEnvParameterdvARB)(GLenum,GLuint,GLdouble*);
@@ -1046,19 +1109,19 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetProgramResourceName)(GLuint,GLenum,GLuint,GLsizei,GLsizei*,GLchar*);
         void       (WINE_GLAPI *p_glGetProgramResourceiv)(GLuint,GLenum,GLuint,GLsizei,const GLenum*,GLsizei,GLsizei*,GLint*);
         void       (WINE_GLAPI *p_glGetProgramStageiv)(GLuint,GLenum,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetProgramStringARB)(GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetProgramStringARB)(GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetProgramStringNV)(GLuint,GLenum,GLubyte*);
         void       (WINE_GLAPI *p_glGetProgramSubroutineParameteruivNV)(GLenum,GLuint,GLuint*);
         void       (WINE_GLAPI *p_glGetProgramiv)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetProgramivARB)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetProgramivNV)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetQueryIndexediv)(GLenum,GLuint,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetQueryObjecti64v)(GLuint,GLenum,INT64*);
-        void       (WINE_GLAPI *p_glGetQueryObjecti64vEXT)(GLuint,GLenum,INT64*);
+        void       (WINE_GLAPI *p_glGetQueryObjecti64v)(GLuint,GLenum,GLint64*);
+        void       (WINE_GLAPI *p_glGetQueryObjecti64vEXT)(GLuint,GLenum,GLint64*);
         void       (WINE_GLAPI *p_glGetQueryObjectiv)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetQueryObjectivARB)(GLuint,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetQueryObjectui64v)(GLuint,GLenum,UINT64*);
-        void       (WINE_GLAPI *p_glGetQueryObjectui64vEXT)(GLuint,GLenum,UINT64*);
+        void       (WINE_GLAPI *p_glGetQueryObjectui64v)(GLuint,GLenum,GLuint64*);
+        void       (WINE_GLAPI *p_glGetQueryObjectui64vEXT)(GLuint,GLenum,GLuint64*);
         void       (WINE_GLAPI *p_glGetQueryObjectuiv)(GLuint,GLenum,GLuint*);
         void       (WINE_GLAPI *p_glGetQueryObjectuivARB)(GLuint,GLenum,GLuint*);
         void       (WINE_GLAPI *p_glGetQueryiv)(GLenum,GLenum,GLint*);
@@ -1069,42 +1132,48 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetSamplerParameterIuiv)(GLuint,GLenum,GLuint*);
         void       (WINE_GLAPI *p_glGetSamplerParameterfv)(GLuint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetSamplerParameteriv)(GLuint,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetSeparableFilter)(GLenum,GLenum,GLenum,GLvoid*,GLvoid*,GLvoid*);
-        void       (WINE_GLAPI *p_glGetSeparableFilterEXT)(GLenum,GLenum,GLenum,GLvoid*,GLvoid*,GLvoid*);
+        void       (WINE_GLAPI *p_glGetSeparableFilter)(GLenum,GLenum,GLenum,void*,void*,void*);
+        void       (WINE_GLAPI *p_glGetSeparableFilterEXT)(GLenum,GLenum,GLenum,void*,void*,void*);
         void       (WINE_GLAPI *p_glGetShaderInfoLog)(GLuint,GLsizei,GLsizei*,GLchar*);
         void       (WINE_GLAPI *p_glGetShaderPrecisionFormat)(GLenum,GLenum,GLint*,GLint*);
         void       (WINE_GLAPI *p_glGetShaderSource)(GLuint,GLsizei,GLsizei*,GLchar*);
         void       (WINE_GLAPI *p_glGetShaderSourceARB)(GLhandleARB,GLsizei,GLsizei*,GLcharARB*);
         void       (WINE_GLAPI *p_glGetShaderiv)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetSharpenTexFuncSGIS)(GLenum,GLfloat*);
-        const GLubyte * (WINE_GLAPI *p_glGetStringi)(GLenum,GLuint);
+        const GLubyte* (WINE_GLAPI *p_glGetStringi)(GLenum,GLuint);
         GLuint     (WINE_GLAPI *p_glGetSubroutineIndex)(GLuint,GLenum,const GLchar*);
         GLint      (WINE_GLAPI *p_glGetSubroutineUniformLocation)(GLuint,GLenum,const GLchar*);
-        void       (WINE_GLAPI *p_glGetSynciv)(GLvoid*,GLenum,GLsizei,GLsizei*,GLint*);
+        void       (WINE_GLAPI *p_glGetSynciv)(GLsync,GLenum,GLsizei,GLsizei*,GLint*);
         void       (WINE_GLAPI *p_glGetTexBumpParameterfvATI)(GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetTexBumpParameterivATI)(GLenum,GLint*);
+        void       (WINE_GLAPI *p_glGetTexEnvxvOES)(GLenum,GLenum,GLfixed*);
         void       (WINE_GLAPI *p_glGetTexFilterFuncSGIS)(GLenum,GLenum,GLfloat*);
+        void       (WINE_GLAPI *p_glGetTexGenxvOES)(GLenum,GLenum,GLfixed*);
+        void       (WINE_GLAPI *p_glGetTexLevelParameterxvOES)(GLenum,GLint,GLenum,GLfixed*);
         void       (WINE_GLAPI *p_glGetTexParameterIiv)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetTexParameterIivEXT)(GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetTexParameterIuiv)(GLenum,GLenum,GLuint*);
         void       (WINE_GLAPI *p_glGetTexParameterIuivEXT)(GLenum,GLenum,GLuint*);
-        void       (WINE_GLAPI *p_glGetTexParameterPointervAPPLE)(GLenum,GLenum,GLvoid**);
-        UINT64     (WINE_GLAPI *p_glGetTextureHandleNV)(GLuint);
-        void       (WINE_GLAPI *p_glGetTextureImageEXT)(GLuint,GLenum,GLint,GLenum,GLenum,GLvoid*);
+        void       (WINE_GLAPI *p_glGetTexParameterPointervAPPLE)(GLenum,GLenum,void**);
+        void       (WINE_GLAPI *p_glGetTexParameterxvOES)(GLenum,GLenum,GLfixed*);
+        GLuint64   (WINE_GLAPI *p_glGetTextureHandleARB)(GLuint);
+        GLuint64   (WINE_GLAPI *p_glGetTextureHandleNV)(GLuint);
+        void       (WINE_GLAPI *p_glGetTextureImageEXT)(GLuint,GLenum,GLint,GLenum,GLenum,void*);
         void       (WINE_GLAPI *p_glGetTextureLevelParameterfvEXT)(GLuint,GLenum,GLint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetTextureLevelParameterivEXT)(GLuint,GLenum,GLint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetTextureParameterIivEXT)(GLuint,GLenum,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetTextureParameterIuivEXT)(GLuint,GLenum,GLenum,GLuint*);
         void       (WINE_GLAPI *p_glGetTextureParameterfvEXT)(GLuint,GLenum,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetTextureParameterivEXT)(GLuint,GLenum,GLenum,GLint*);
-        UINT64     (WINE_GLAPI *p_glGetTextureSamplerHandleNV)(GLuint,GLuint);
+        GLuint64   (WINE_GLAPI *p_glGetTextureSamplerHandleARB)(GLuint,GLuint);
+        GLuint64   (WINE_GLAPI *p_glGetTextureSamplerHandleNV)(GLuint,GLuint);
         void       (WINE_GLAPI *p_glGetTrackMatrixivNV)(GLenum,GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetTransformFeedbackVarying)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,GLchar*);
         void       (WINE_GLAPI *p_glGetTransformFeedbackVaryingEXT)(GLuint,GLuint,GLsizei,GLsizei*,GLsizei*,GLenum*,GLchar*);
         void       (WINE_GLAPI *p_glGetTransformFeedbackVaryingNV)(GLuint,GLuint,GLint*);
         GLuint     (WINE_GLAPI *p_glGetUniformBlockIndex)(GLuint,const GLchar*);
         GLint      (WINE_GLAPI *p_glGetUniformBufferSizeEXT)(GLuint,GLint);
-        void       (WINE_GLAPI *p_glGetUniformIndices)(GLuint,GLsizei,const GLchar* const*,GLuint*);
+        void       (WINE_GLAPI *p_glGetUniformIndices)(GLuint,GLsizei,const GLchar*const*,GLuint*);
         GLint      (WINE_GLAPI *p_glGetUniformLocation)(GLuint,const GLchar*);
         GLint      (WINE_GLAPI *p_glGetUniformLocationARB)(GLhandleARB,const GLcharARB*);
         GLintptr   (WINE_GLAPI *p_glGetUniformOffsetEXT)(GLuint,GLint);
@@ -1112,10 +1181,10 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetUniformdv)(GLuint,GLint,GLdouble*);
         void       (WINE_GLAPI *p_glGetUniformfv)(GLuint,GLint,GLfloat*);
         void       (WINE_GLAPI *p_glGetUniformfvARB)(GLhandleARB,GLint,GLfloat*);
-        void       (WINE_GLAPI *p_glGetUniformi64vNV)(GLuint,GLint,INT64*);
+        void       (WINE_GLAPI *p_glGetUniformi64vNV)(GLuint,GLint,GLint64EXT*);
         void       (WINE_GLAPI *p_glGetUniformiv)(GLuint,GLint,GLint*);
         void       (WINE_GLAPI *p_glGetUniformivARB)(GLhandleARB,GLint,GLint*);
-        void       (WINE_GLAPI *p_glGetUniformui64vNV)(GLuint,GLint,UINT64*);
+        void       (WINE_GLAPI *p_glGetUniformui64vNV)(GLuint,GLint,GLuint64EXT*);
         void       (WINE_GLAPI *p_glGetUniformuiv)(GLuint,GLint,GLuint*);
         void       (WINE_GLAPI *p_glGetUniformuivEXT)(GLuint,GLint,GLuint*);
         void       (WINE_GLAPI *p_glGetVariantArrayObjectfvATI)(GLuint,GLenum,GLfloat*);
@@ -1123,8 +1192,12 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetVariantBooleanvEXT)(GLuint,GLenum,GLboolean*);
         void       (WINE_GLAPI *p_glGetVariantFloatvEXT)(GLuint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetVariantIntegervEXT)(GLuint,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetVariantPointervEXT)(GLuint,GLenum,GLvoid**);
+        void       (WINE_GLAPI *p_glGetVariantPointervEXT)(GLuint,GLenum,void**);
         GLint      (WINE_GLAPI *p_glGetVaryingLocationNV)(GLuint,const GLchar*);
+        void       (WINE_GLAPI *p_glGetVertexArrayIntegeri_vEXT)(GLuint,GLuint,GLenum,GLint*);
+        void       (WINE_GLAPI *p_glGetVertexArrayIntegervEXT)(GLuint,GLenum,GLint*);
+        void       (WINE_GLAPI *p_glGetVertexArrayPointeri_vEXT)(GLuint,GLuint,GLenum,void**);
+        void       (WINE_GLAPI *p_glGetVertexArrayPointervEXT)(GLuint,GLenum,void**);
         void       (WINE_GLAPI *p_glGetVertexAttribArrayObjectfvATI)(GLuint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetVertexAttribArrayObjectivATI)(GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetVertexAttribIiv)(GLuint,GLenum,GLint*);
@@ -1133,11 +1206,12 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetVertexAttribIuivEXT)(GLuint,GLenum,GLuint*);
         void       (WINE_GLAPI *p_glGetVertexAttribLdv)(GLuint,GLenum,GLdouble*);
         void       (WINE_GLAPI *p_glGetVertexAttribLdvEXT)(GLuint,GLenum,GLdouble*);
-        void       (WINE_GLAPI *p_glGetVertexAttribLi64vNV)(GLuint,GLenum,INT64*);
-        void       (WINE_GLAPI *p_glGetVertexAttribLui64vNV)(GLuint,GLenum,UINT64*);
-        void       (WINE_GLAPI *p_glGetVertexAttribPointerv)(GLuint,GLenum,GLvoid**);
-        void       (WINE_GLAPI *p_glGetVertexAttribPointervARB)(GLuint,GLenum,GLvoid**);
-        void       (WINE_GLAPI *p_glGetVertexAttribPointervNV)(GLuint,GLenum,GLvoid**);
+        void       (WINE_GLAPI *p_glGetVertexAttribLi64vNV)(GLuint,GLenum,GLint64EXT*);
+        void       (WINE_GLAPI *p_glGetVertexAttribLui64vARB)(GLuint,GLenum,GLuint64EXT*);
+        void       (WINE_GLAPI *p_glGetVertexAttribLui64vNV)(GLuint,GLenum,GLuint64EXT*);
+        void       (WINE_GLAPI *p_glGetVertexAttribPointerv)(GLuint,GLenum,void**);
+        void       (WINE_GLAPI *p_glGetVertexAttribPointervARB)(GLuint,GLenum,void**);
+        void       (WINE_GLAPI *p_glGetVertexAttribPointervNV)(GLuint,GLenum,void**);
         void       (WINE_GLAPI *p_glGetVertexAttribdv)(GLuint,GLenum,GLdouble*);
         void       (WINE_GLAPI *p_glGetVertexAttribdvARB)(GLuint,GLenum,GLdouble*);
         void       (WINE_GLAPI *p_glGetVertexAttribdvNV)(GLuint,GLenum,GLdouble*);
@@ -1151,24 +1225,24 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glGetVideoCaptureStreamfvNV)(GLuint,GLuint,GLenum,GLfloat*);
         void       (WINE_GLAPI *p_glGetVideoCaptureStreamivNV)(GLuint,GLuint,GLenum,GLint*);
         void       (WINE_GLAPI *p_glGetVideoCaptureivNV)(GLuint,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetVideoi64vNV)(GLuint,GLenum,INT64*);
+        void       (WINE_GLAPI *p_glGetVideoi64vNV)(GLuint,GLenum,GLint64EXT*);
         void       (WINE_GLAPI *p_glGetVideoivNV)(GLuint,GLenum,GLint*);
-        void       (WINE_GLAPI *p_glGetVideoui64vNV)(GLuint,GLenum,UINT64*);
+        void       (WINE_GLAPI *p_glGetVideoui64vNV)(GLuint,GLenum,GLuint64EXT*);
         void       (WINE_GLAPI *p_glGetVideouivNV)(GLuint,GLenum,GLuint*);
-        void       (WINE_GLAPI *p_glGetnColorTableARB)(GLenum,GLenum,GLenum,GLsizei,GLvoid*);
-        void       (WINE_GLAPI *p_glGetnCompressedTexImageARB)(GLenum,GLint,GLsizei,GLvoid*);
-        void       (WINE_GLAPI *p_glGetnConvolutionFilterARB)(GLenum,GLenum,GLenum,GLsizei,GLvoid*);
-        void       (WINE_GLAPI *p_glGetnHistogramARB)(GLenum,GLboolean,GLenum,GLenum,GLsizei,GLvoid*);
+        void       (WINE_GLAPI *p_glGetnColorTableARB)(GLenum,GLenum,GLenum,GLsizei,void*);
+        void       (WINE_GLAPI *p_glGetnCompressedTexImageARB)(GLenum,GLint,GLsizei,void*);
+        void       (WINE_GLAPI *p_glGetnConvolutionFilterARB)(GLenum,GLenum,GLenum,GLsizei,void*);
+        void       (WINE_GLAPI *p_glGetnHistogramARB)(GLenum,GLboolean,GLenum,GLenum,GLsizei,void*);
         void       (WINE_GLAPI *p_glGetnMapdvARB)(GLenum,GLenum,GLsizei,GLdouble*);
         void       (WINE_GLAPI *p_glGetnMapfvARB)(GLenum,GLenum,GLsizei,GLfloat*);
         void       (WINE_GLAPI *p_glGetnMapivARB)(GLenum,GLenum,GLsizei,GLint*);
-        void       (WINE_GLAPI *p_glGetnMinmaxARB)(GLenum,GLboolean,GLenum,GLenum,GLsizei,GLvoid*);
+        void       (WINE_GLAPI *p_glGetnMinmaxARB)(GLenum,GLboolean,GLenum,GLenum,GLsizei,void*);
         void       (WINE_GLAPI *p_glGetnPixelMapfvARB)(GLenum,GLsizei,GLfloat*);
         void       (WINE_GLAPI *p_glGetnPixelMapuivARB)(GLenum,GLsizei,GLuint*);
         void       (WINE_GLAPI *p_glGetnPixelMapusvARB)(GLenum,GLsizei,GLushort*);
         void       (WINE_GLAPI *p_glGetnPolygonStippleARB)(GLsizei,GLubyte*);
-        void       (WINE_GLAPI *p_glGetnSeparableFilterARB)(GLenum,GLenum,GLenum,GLsizei,GLvoid*,GLsizei,GLvoid*,GLvoid*);
-        void       (WINE_GLAPI *p_glGetnTexImageARB)(GLenum,GLint,GLenum,GLenum,GLsizei,GLvoid*);
+        void       (WINE_GLAPI *p_glGetnSeparableFilterARB)(GLenum,GLenum,GLenum,GLsizei,void*,GLsizei,void*,void*);
+        void       (WINE_GLAPI *p_glGetnTexImageARB)(GLenum,GLint,GLenum,GLenum,GLsizei,void*);
         void       (WINE_GLAPI *p_glGetnUniformdvARB)(GLuint,GLint,GLsizei,GLdouble*);
         void       (WINE_GLAPI *p_glGetnUniformfvARB)(GLuint,GLint,GLsizei,GLfloat*);
         void       (WINE_GLAPI *p_glGetnUniformivARB)(GLuint,GLint,GLsizei,GLint*);
@@ -1184,18 +1258,21 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glHintPGI)(GLenum,GLint);
         void       (WINE_GLAPI *p_glHistogram)(GLenum,GLsizei,GLenum,GLboolean);
         void       (WINE_GLAPI *p_glHistogramEXT)(GLenum,GLsizei,GLenum,GLboolean);
-        void       (WINE_GLAPI *p_glIglooInterfaceSGIX)(GLenum,const GLvoid*);
+        void       (WINE_GLAPI *p_glIglooInterfaceSGIX)(GLenum,const void*);
         void       (WINE_GLAPI *p_glImageTransformParameterfHP)(GLenum,GLenum,GLfloat);
         void       (WINE_GLAPI *p_glImageTransformParameterfvHP)(GLenum,GLenum,const GLfloat*);
         void       (WINE_GLAPI *p_glImageTransformParameteriHP)(GLenum,GLenum,GLint);
         void       (WINE_GLAPI *p_glImageTransformParameterivHP)(GLenum,GLenum,const GLint*);
-        GLvoid*    (WINE_GLAPI *p_glImportSyncEXT)(GLenum,GLintptr,GLbitfield);
+        GLsync     (WINE_GLAPI *p_glImportSyncEXT)(GLenum,GLintptr,GLbitfield);
         void       (WINE_GLAPI *p_glIndexFormatNV)(GLenum,GLsizei);
         void       (WINE_GLAPI *p_glIndexFuncEXT)(GLenum,GLclampf);
         void       (WINE_GLAPI *p_glIndexMaterialEXT)(GLenum,GLenum);
-        void       (WINE_GLAPI *p_glIndexPointerEXT)(GLenum,GLsizei,GLsizei,const GLvoid*);
-        void       (WINE_GLAPI *p_glIndexPointerListIBM)(GLenum,GLint,const GLvoid**,GLint);
+        void       (WINE_GLAPI *p_glIndexPointerEXT)(GLenum,GLsizei,GLsizei,const void*);
+        void       (WINE_GLAPI *p_glIndexPointerListIBM)(GLenum,GLint,const void**,GLint);
+        void       (WINE_GLAPI *p_glIndexxOES)(GLfixed);
+        void       (WINE_GLAPI *p_glIndexxvOES)(const GLfixed*);
         void       (WINE_GLAPI *p_glInsertComponentEXT)(GLuint,GLuint,GLuint);
+        void       (WINE_GLAPI *p_glInsertEventMarkerEXT)(GLsizei,const GLchar*);
         void       (WINE_GLAPI *p_glInstrumentsBufferSGIX)(GLsizei,GLint*);
         void       (WINE_GLAPI *p_glInterpolatePathsNV)(GLuint,GLuint,GLuint,GLfloat);
         void       (WINE_GLAPI *p_glInvalidateBufferData)(GLuint);
@@ -1214,7 +1291,8 @@ struct opengl_funcs
         GLboolean  (WINE_GLAPI *p_glIsFenceNV)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsFramebuffer)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsFramebufferEXT)(GLuint);
-        GLboolean  (WINE_GLAPI *p_glIsImageHandleResidentNV)(UINT64);
+        GLboolean  (WINE_GLAPI *p_glIsImageHandleResidentARB)(GLuint64);
+        GLboolean  (WINE_GLAPI *p_glIsImageHandleResidentNV)(GLuint64);
         GLboolean  (WINE_GLAPI *p_glIsNameAMD)(GLenum,GLuint);
         GLboolean  (WINE_GLAPI *p_glIsNamedBufferResidentNV)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsNamedStringARB)(GLint,const GLchar*);
@@ -1233,16 +1311,23 @@ struct opengl_funcs
         GLboolean  (WINE_GLAPI *p_glIsRenderbufferEXT)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsSampler)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsShader)(GLuint);
-        GLboolean  (WINE_GLAPI *p_glIsSync)(GLvoid*);
+        GLboolean  (WINE_GLAPI *p_glIsSync)(GLsync);
         GLboolean  (WINE_GLAPI *p_glIsTextureEXT)(GLuint);
-        GLboolean  (WINE_GLAPI *p_glIsTextureHandleResidentNV)(UINT64);
+        GLboolean  (WINE_GLAPI *p_glIsTextureHandleResidentARB)(GLuint64);
+        GLboolean  (WINE_GLAPI *p_glIsTextureHandleResidentNV)(GLuint64);
         GLboolean  (WINE_GLAPI *p_glIsTransformFeedback)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsTransformFeedbackNV)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsVariantEnabledEXT)(GLuint,GLenum);
         GLboolean  (WINE_GLAPI *p_glIsVertexArray)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsVertexArrayAPPLE)(GLuint);
         GLboolean  (WINE_GLAPI *p_glIsVertexAttribEnabledAPPLE)(GLuint,GLenum);
+        void       (WINE_GLAPI *p_glLabelObjectEXT)(GLenum,GLuint,GLsizei,const GLchar*);
         void       (WINE_GLAPI *p_glLightEnviSGIX)(GLenum,GLint);
+        void       (WINE_GLAPI *p_glLightModelxOES)(GLenum,GLfixed);
+        void       (WINE_GLAPI *p_glLightModelxvOES)(GLenum,const GLfixed*);
+        void       (WINE_GLAPI *p_glLightxOES)(GLenum,GLenum,GLfixed);
+        void       (WINE_GLAPI *p_glLightxvOES)(GLenum,GLenum,const GLfixed*);
+        void       (WINE_GLAPI *p_glLineWidthxOES)(GLfixed);
         void       (WINE_GLAPI *p_glLinkProgram)(GLuint);
         void       (WINE_GLAPI *p_glLinkProgramARB)(GLhandleARB);
         void       (WINE_GLAPI *p_glListParameterfSGIX)(GLuint,GLenum,GLfloat);
@@ -1250,37 +1335,50 @@ struct opengl_funcs
         void       (WINE_GLAPI *p_glListParameteriSGIX)(GLuint,GLenum,GLint);
         void       (WINE_GLAPI *p_glListParameterivSGIX)(GLuint,GLenum,const GLint*);
         void       (WINE_GLAPI *p_glLoadIdentityDeformationMapSGIX)(GLbitfield);
+        void       (WINE_GLAPI *p_glLoadMatrixxOES)(const GLfixed*);
         void       (WINE_GLAPI *p_glLoadProgramNV)(GLenum,GLuint,GLsizei,const GLubyte*);
         void       (WINE_GLAPI *p_glLoadTransposeMatrixd)(const GLdouble*);
         void       (WINE_GLAPI *p_glLoadTransposeMatrixdARB)(const GLdouble*);
         void       (WINE_GLAPI *p_glLoadTransposeMatrixf)(const GLfloat*);
         void       (WINE_GLAPI *p_glLoadTransposeMatrixfARB)(const GLfloat*);
+        void       (WINE_GLAPI *p_glLoadTransposeMatrixxOES)(const GLfixed*);
         void       (WINE_GLAPI *p_glLockArraysEXT)(GLint,GLsizei);
         void       (WINE_GLAPI *p_glMTexCoord2fSGIS)(GLenum,GLfloat,GLfloat);
         void       (WINE_GLAPI *p_glMTexCoord2fvSGIS)(GLenum,GLfloat *);
         void       (WINE_GLAPI *p_glMakeBufferNonResidentNV)(GLenum);
         void       (WINE_GLAPI *p_glMakeBufferResidentNV)(GLenum,GLenum);
-        void       (WINE_GLAPI *p_glMakeImageHandleNonResidentNV)(UINT64);
-        void       (WINE_GLAPI *p_glMakeImageHandleResidentNV)(UINT64,GLenum);
+        void       (WINE_GLAPI *p_glMakeImageHandleNonResidentARB)(GLuint64);
+        void       (WINE_GLAPI *p_glMakeImageHandleNonResidentNV)(GLuint64);
+        void       (WINE_GLAPI *p_glMakeImageHandleResidentARB)(GLuint64,GLenum);
+        void       (WINE_GLAPI *p_glMakeImageHandleResidentNV)(GLuint64,GLenum);
         void       (WINE_GLAPI *p_glMakeNamedBufferNonResidentNV)(GLuint);
         void       (WINE_GLAPI *p_glMakeNamedBufferResidentNV)(GLuint,GLenum);
-        void       (WINE_GLAPI *p_glMakeTextureHandleNonResidentNV)(UINT64);
-        void       (WINE_GLAPI *p_glMakeTextureHandleResidentNV)(UINT64);
-        GLvoid*    (WINE_GLAPI *p_glMapBuffer)(GLenum,GLenum);
-        GLvoid*    (WINE_GLAPI *p_glMapBufferARB)(GLenum,GLenum);
-        GLvoid*    (WINE_GLAPI *p_glMapBufferRange)(GLenum,GLintptr,GLsizeiptr,GLbitfield);
-        void       (WINE_GLAPI *p_glMapControlPointsNV)(GLenum,GLuint,GLenum,GLsizei,GLsizei,GLint,GLint,GLboolean,const GLvoid*);
-        GLvoid*    (WINE_GLAPI *p_glMapNamedBufferEXT)(GLuint,GLenum);
-        GLvoid*    (WINE_GLAPI *p_glMapNamedBufferRangeEXT)(GLuint,GLintptr,GLsizeiptr,GLbitfield);
-        GLvoid*    (WINE_GLAPI *p_glMapObjectBufferATI)(GLuint);
+        void       (WINE_GLAPI *p_glMakeTextureHandleNonResidentARB)(GLuint64);
+        void       (WINE_GLAPI *p_glMakeTextureHandleNonResidentNV)(GLuint64);
+        void       (WINE_GLAPI *p_glMakeTextureHandleResidentARB)(GLuint64);
+        void       (WINE_GLAPI *p_glMakeTextureHandleResidentNV)(GLuint64);
+        void       (WINE_GLAPI *p_glMap1xOES)(GLenum,GLfixed,GLfixed,GLint,GLint,GLfixed);
+        void       (WINE_GLAPI *p_glMap2xOES)(GLenum,GLfixed,GLfixed,GLint,GLint,GLfixed,GLfixed,GLint,GLint,GLfixed);
+        void