Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/wined3d/buffer.c | 8 ++++---- dlls/wined3d/wined3d_private.h | 10 ++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 5b3419d29e0..4b66193746f 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -782,7 +782,7 @@ static void wined3d_buffer_destroy_object(void *object) }
heap_free(buffer->maps); - heap_free(buffer); + heap_free(wined3d_buffer_gl(buffer)); }
ULONG CDECL wined3d_buffer_decref(struct wined3d_buffer *buffer) @@ -1444,7 +1444,7 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_buffer **buffer) { - struct wined3d_buffer *object; + struct wined3d_buffer_gl *object; HRESULT hr;
TRACE("device %p, desc byte_width %u, usage %s, bind_flags %s, access %s, data %p, parent %p, " @@ -1456,7 +1456,7 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct if (!(object = heap_alloc_zero(sizeof(*object)))) return E_OUTOFMEMORY;
- if (FAILED(hr = wined3d_buffer_init(object, device, desc, data, parent, parent_ops))) + if (FAILED(hr = wined3d_buffer_init(&object->b, device, desc, data, parent, parent_ops))) { WARN("Failed to initialize buffer, hr %#x.\n", hr); heap_free(object); @@ -1465,7 +1465,7 @@ HRESULT CDECL wined3d_buffer_create(struct wined3d_device *device, const struct
TRACE("Created buffer %p.\n", object);
- *buffer = object; + *buffer = &object->b;
return WINED3D_OK; } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 3abe5e6154d..0402603c527 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3796,6 +3796,16 @@ void wined3d_buffer_copy(struct wined3d_buffer *dst_buffer, unsigned int dst_off void wined3d_buffer_upload_data(struct wined3d_buffer *buffer, struct wined3d_context *context, const struct wined3d_box *box, const void *data) DECLSPEC_HIDDEN;
+struct wined3d_buffer_gl +{ + struct wined3d_buffer b; +}; + +static inline struct wined3d_buffer_gl *wined3d_buffer_gl(struct wined3d_buffer *buffer) +{ + return CONTAINING_RECORD(buffer, struct wined3d_buffer_gl, b); +} + struct wined3d_rendertarget_view { LONG refcount;