wined3d: Make the adapter responsible for query creation and destruction.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5356292ee9
commit
1174c894e8
|
@ -5069,6 +5069,42 @@ static void adapter_gl_destroy_sampler(struct wined3d_sampler *sampler)
|
|||
wined3d_cs_destroy_object(sampler->device->cs, wined3d_sampler_gl_destroy_object, sampler_gl);
|
||||
}
|
||||
|
||||
static HRESULT adapter_gl_create_query(struct wined3d_device *device, enum wined3d_query_type type,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
|
||||
{
|
||||
TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
|
||||
device, type, parent, parent_ops, query);
|
||||
|
||||
return wined3d_query_gl_create(device, type, parent, parent_ops, query);
|
||||
}
|
||||
|
||||
static void wined3d_query_gl_destroy_object(void *object)
|
||||
{
|
||||
struct wined3d_query *query = object;
|
||||
|
||||
if (query->buffer_object)
|
||||
{
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(query->device, NULL, 0);
|
||||
wined3d_query_gl_destroy_buffer_object(wined3d_context_gl(context), query);
|
||||
context_release(context);
|
||||
}
|
||||
|
||||
/* Queries are specific to the GL context that created them. Not
|
||||
* deleting the query will obviously leak it, but that's still better
|
||||
* than potentially deleting a different query with the same id in this
|
||||
* context, and (still) leaking the actual query. */
|
||||
query->query_ops->query_destroy(query);
|
||||
}
|
||||
|
||||
static void adapter_gl_destroy_query(struct wined3d_query *query)
|
||||
{
|
||||
TRACE("query %p.\n", query);
|
||||
|
||||
wined3d_cs_destroy_object(query->device->cs, wined3d_query_gl_destroy_object, query);
|
||||
}
|
||||
|
||||
static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
|
||||
{
|
||||
adapter_gl_destroy,
|
||||
|
@ -5094,6 +5130,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_gl_ops =
|
|||
adapter_gl_destroy_unordered_access_view,
|
||||
adapter_gl_create_sampler,
|
||||
adapter_gl_destroy_sampler,
|
||||
adapter_gl_create_query,
|
||||
adapter_gl_destroy_query,
|
||||
};
|
||||
|
||||
static BOOL wined3d_adapter_gl_init(struct wined3d_adapter_gl *adapter_gl,
|
||||
|
|
|
@ -759,6 +759,20 @@ static void adapter_vk_destroy_sampler(struct wined3d_sampler *sampler)
|
|||
wined3d_cs_destroy_object(sampler->device->cs, heap_free, sampler);
|
||||
}
|
||||
|
||||
static HRESULT adapter_vk_create_query(struct wined3d_device *device, enum wined3d_query_type type,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
|
||||
{
|
||||
TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
|
||||
device, type, parent, parent_ops, query);
|
||||
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
static void adapter_vk_destroy_query(struct wined3d_query *query)
|
||||
{
|
||||
TRACE("query %p.\n", query);
|
||||
}
|
||||
|
||||
static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
|
||||
{
|
||||
adapter_vk_destroy,
|
||||
|
@ -784,6 +798,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_vk_ops =
|
|||
adapter_vk_destroy_unordered_access_view,
|
||||
adapter_vk_create_sampler,
|
||||
adapter_vk_destroy_sampler,
|
||||
adapter_vk_create_query,
|
||||
adapter_vk_destroy_query,
|
||||
};
|
||||
|
||||
static unsigned int wined3d_get_wine_vk_version(void)
|
||||
|
|
|
@ -2568,6 +2568,20 @@ static void adapter_no3d_destroy_sampler(struct wined3d_sampler *sampler)
|
|||
TRACE("sampler %p.\n", sampler);
|
||||
}
|
||||
|
||||
static HRESULT adapter_no3d_create_query(struct wined3d_device *device, enum wined3d_query_type type,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
|
||||
{
|
||||
TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
|
||||
device, type, parent, parent_ops, query);
|
||||
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
static void adapter_no3d_destroy_query(struct wined3d_query *query)
|
||||
{
|
||||
TRACE("query %p.\n", query);
|
||||
}
|
||||
|
||||
static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
|
||||
{
|
||||
adapter_no3d_destroy,
|
||||
|
@ -2593,6 +2607,8 @@ static const struct wined3d_adapter_ops wined3d_adapter_no3d_ops =
|
|||
adapter_no3d_destroy_unordered_access_view,
|
||||
adapter_no3d_create_sampler,
|
||||
adapter_no3d_destroy_sampler,
|
||||
adapter_no3d_create_query,
|
||||
adapter_no3d_destroy_query,
|
||||
};
|
||||
|
||||
static void wined3d_adapter_no3d_init_d3d_info(struct wined3d_adapter *adapter, unsigned int wined3d_creation_flags)
|
||||
|
|
|
@ -54,7 +54,7 @@ static void wined3d_query_create_buffer_object(struct wined3d_context_gl *contex
|
|||
query->buffer_object = buffer_object;
|
||||
}
|
||||
|
||||
static void wined3d_query_destroy_buffer_object(struct wined3d_context_gl *context_gl, struct wined3d_query *query)
|
||||
void wined3d_query_gl_destroy_buffer_object(struct wined3d_context_gl *context_gl, struct wined3d_query *query)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
||||
|
||||
|
@ -93,7 +93,7 @@ static BOOL wined3d_query_buffer_queue_result(struct wined3d_context_gl *context
|
|||
if (wined3d_query_buffer_is_valid(query))
|
||||
wined3d_query_buffer_invalidate(query);
|
||||
else
|
||||
wined3d_query_destroy_buffer_object(context_gl, query);
|
||||
wined3d_query_gl_destroy_buffer_object(context_gl, query);
|
||||
}
|
||||
|
||||
if (!query->buffer_object)
|
||||
|
@ -430,21 +430,6 @@ static void wined3d_query_destroy_object(void *object)
|
|||
|
||||
if (!list_empty(&query->poll_list_entry))
|
||||
list_remove(&query->poll_list_entry);
|
||||
|
||||
if (query->buffer_object)
|
||||
{
|
||||
struct wined3d_context *context;
|
||||
|
||||
context = context_acquire(query->device, NULL, 0);
|
||||
wined3d_query_destroy_buffer_object(wined3d_context_gl(context), query);
|
||||
context_release(context);
|
||||
}
|
||||
|
||||
/* Queries are specific to the GL context that created them. Not
|
||||
* deleting the query will obviously leak it, but that's still better
|
||||
* than potentially deleting a different query with the same id in this
|
||||
* context, and (still) leaking the actual query. */
|
||||
query->query_ops->query_destroy(query);
|
||||
}
|
||||
|
||||
ULONG CDECL wined3d_query_decref(struct wined3d_query *query)
|
||||
|
@ -455,8 +440,11 @@ ULONG CDECL wined3d_query_decref(struct wined3d_query *query)
|
|||
|
||||
if (!refcount)
|
||||
{
|
||||
struct wined3d_device *device = query->device;
|
||||
|
||||
query->parent_ops->wined3d_object_destroyed(query->parent);
|
||||
wined3d_cs_destroy_object(query->device->cs, wined3d_query_destroy_object, query);
|
||||
wined3d_cs_destroy_object(device->cs, wined3d_query_destroy_object, query);
|
||||
device->adapter->adapter_ops->adapter_destroy_query(query);
|
||||
}
|
||||
|
||||
return refcount;
|
||||
|
@ -1332,7 +1320,7 @@ static HRESULT wined3d_pipeline_query_create(struct wined3d_device *device,
|
|||
return WINED3D_OK;
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_query_create(struct wined3d_device *device, enum wined3d_query_type type,
|
||||
HRESULT wined3d_query_gl_create(struct wined3d_device *device, enum wined3d_query_type type,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
|
||||
{
|
||||
TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
|
||||
|
@ -1368,3 +1356,12 @@ HRESULT CDECL wined3d_query_create(struct wined3d_device *device, enum wined3d_q
|
|||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT CDECL wined3d_query_create(struct wined3d_device *device, enum wined3d_query_type type,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
|
||||
{
|
||||
TRACE("device %p, type %#x, parent %p, parent_ops %p, query %p.\n",
|
||||
device, type, parent, parent_ops, query);
|
||||
|
||||
return device->adapter->adapter_ops->adapter_create_query(device, type, parent, parent_ops, query);
|
||||
}
|
||||
|
|
|
@ -1785,6 +1785,11 @@ struct wined3d_query
|
|||
UINT64 *map_ptr;
|
||||
};
|
||||
|
||||
HRESULT wined3d_query_gl_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent,
|
||||
const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query) DECLSPEC_HIDDEN;
|
||||
void wined3d_query_gl_destroy_buffer_object(struct wined3d_context_gl *context_gl,
|
||||
struct wined3d_query *query) DECLSPEC_HIDDEN;
|
||||
|
||||
struct wined3d_event_query
|
||||
{
|
||||
struct wined3d_query query;
|
||||
|
@ -2808,6 +2813,9 @@ struct wined3d_adapter_ops
|
|||
HRESULT (*adapter_create_sampler)(struct wined3d_device *device, const struct wined3d_sampler_desc *desc,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_sampler **sampler);
|
||||
void (*adapter_destroy_sampler)(struct wined3d_sampler *sampler);
|
||||
HRESULT (*adapter_create_query)(struct wined3d_device *device, enum wined3d_query_type type,
|
||||
void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query);
|
||||
void (*adapter_destroy_query)(struct wined3d_query *query);
|
||||
};
|
||||
|
||||
/* The adapter structure */
|
||||
|
|
Loading…
Reference in New Issue