wined3d: Move the pipeline statistics query fields from struct wined3d_context to struct wined3d_context_gl.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
cc5e38e1bf
commit
776b84e6a5
|
@ -996,14 +996,14 @@ void wined3d_context_gl_free_so_statistics_query(struct wined3d_so_statistics_qu
|
||||||
context_gl->free_so_statistics_queries[context_gl->free_so_statistics_query_count++] = query->u;
|
context_gl->free_so_statistics_queries[context_gl->free_so_statistics_query_count++] = query->u;
|
||||||
}
|
}
|
||||||
|
|
||||||
void context_alloc_pipeline_statistics_query(struct wined3d_context *context,
|
void wined3d_context_gl_alloc_pipeline_statistics_query(struct wined3d_context_gl *context_gl,
|
||||||
struct wined3d_pipeline_statistics_query *query)
|
struct wined3d_pipeline_statistics_query *query)
|
||||||
{
|
{
|
||||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
const struct wined3d_gl_info *gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
if (context->free_pipeline_statistics_query_count)
|
if (context_gl->free_pipeline_statistics_query_count)
|
||||||
{
|
{
|
||||||
query->u = context->free_pipeline_statistics_queries[--context->free_pipeline_statistics_query_count];
|
query->u = context_gl->free_pipeline_statistics_queries[--context_gl->free_pipeline_statistics_query_count];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1011,26 +1011,26 @@ void context_alloc_pipeline_statistics_query(struct wined3d_context *context,
|
||||||
checkGLcall("glGenQueries");
|
checkGLcall("glGenQueries");
|
||||||
}
|
}
|
||||||
|
|
||||||
query->context = context;
|
query->context_gl = context_gl;
|
||||||
list_add_head(&context->pipeline_statistics_queries, &query->entry);
|
list_add_head(&context_gl->pipeline_statistics_queries, &query->entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
void context_free_pipeline_statistics_query(struct wined3d_pipeline_statistics_query *query)
|
void wined3d_context_gl_free_pipeline_statistics_query(struct wined3d_pipeline_statistics_query *query)
|
||||||
{
|
{
|
||||||
struct wined3d_context *context = query->context;
|
struct wined3d_context_gl *context_gl = query->context_gl;
|
||||||
|
|
||||||
list_remove(&query->entry);
|
list_remove(&query->entry);
|
||||||
query->context = NULL;
|
query->context_gl = NULL;
|
||||||
|
|
||||||
if (!wined3d_array_reserve((void **)&context->free_pipeline_statistics_queries,
|
if (!wined3d_array_reserve((void **)&context_gl->free_pipeline_statistics_queries,
|
||||||
&context->free_pipeline_statistics_query_size, context->free_pipeline_statistics_query_count + 1,
|
&context_gl->free_pipeline_statistics_query_size, context_gl->free_pipeline_statistics_query_count + 1,
|
||||||
sizeof(*context->free_pipeline_statistics_queries)))
|
sizeof(*context_gl->free_pipeline_statistics_queries)))
|
||||||
{
|
{
|
||||||
ERR("Failed to grow free list, leaking GL queries in context %p.\n", context);
|
ERR("Failed to grow free list, leaking GL queries in context %p.\n", context_gl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
context->free_pipeline_statistics_queries[context->free_pipeline_statistics_query_count++] = query->u;
|
context_gl->free_pipeline_statistics_queries[context_gl->free_pipeline_statistics_query_count++] = query->u;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef void (context_fbo_entry_func_t)(struct wined3d_context *context, struct fbo_entry *entry);
|
typedef void (context_fbo_entry_func_t)(struct wined3d_context *context, struct fbo_entry *entry);
|
||||||
|
@ -1316,12 +1316,10 @@ static void context_update_window(struct wined3d_context *context)
|
||||||
|
|
||||||
void wined3d_context_cleanup(struct wined3d_context *context)
|
void wined3d_context_cleanup(struct wined3d_context *context)
|
||||||
{
|
{
|
||||||
struct wined3d_pipeline_statistics_query *pipeline_statistics_query;
|
|
||||||
const struct wined3d_gl_info *gl_info = context->gl_info;
|
const struct wined3d_gl_info *gl_info = context->gl_info;
|
||||||
struct fbo_entry *entry, *entry2;
|
struct fbo_entry *entry, *entry2;
|
||||||
HGLRC restore_ctx;
|
HGLRC restore_ctx;
|
||||||
HDC restore_dc;
|
HDC restore_dc;
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
restore_ctx = wglGetCurrentContext();
|
restore_ctx = wglGetCurrentContext();
|
||||||
restore_dc = wglGetCurrentDC();
|
restore_dc = wglGetCurrentDC();
|
||||||
|
@ -1331,14 +1329,6 @@ void wined3d_context_cleanup(struct wined3d_context *context)
|
||||||
else if (context->valid)
|
else if (context->valid)
|
||||||
context_set_gl_context(context);
|
context_set_gl_context(context);
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(pipeline_statistics_query, &context->pipeline_statistics_queries,
|
|
||||||
struct wined3d_pipeline_statistics_query, entry)
|
|
||||||
{
|
|
||||||
if (context->valid)
|
|
||||||
GL_EXTCALL(glDeleteQueries(ARRAY_SIZE(pipeline_statistics_query->u.id), pipeline_statistics_query->u.id));
|
|
||||||
pipeline_statistics_query->context = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &context->fbo_destroy_list, struct fbo_entry, entry)
|
LIST_FOR_EACH_ENTRY_SAFE(entry, entry2, &context->fbo_destroy_list, struct fbo_entry, entry)
|
||||||
{
|
{
|
||||||
if (!context->valid) entry->id = 0;
|
if (!context->valid) entry->id = 0;
|
||||||
|
@ -1351,22 +1341,6 @@ void wined3d_context_cleanup(struct wined3d_context *context)
|
||||||
context_destroy_fbo_entry(context, entry);
|
context_destroy_fbo_entry(context, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (context->valid)
|
|
||||||
{
|
|
||||||
if (gl_info->supported[ARB_PIPELINE_STATISTICS_QUERY])
|
|
||||||
{
|
|
||||||
for (i = 0; i < context->free_pipeline_statistics_query_count; ++i)
|
|
||||||
{
|
|
||||||
union wined3d_gl_pipeline_statistics_query *q = &context->free_pipeline_statistics_queries[i];
|
|
||||||
GL_EXTCALL(glDeleteQueries(ARRAY_SIZE(q->id), q->id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkGLcall("context cleanup");
|
|
||||||
}
|
|
||||||
|
|
||||||
heap_free(context->free_pipeline_statistics_queries);
|
|
||||||
|
|
||||||
context_restore_pixel_format(context);
|
context_restore_pixel_format(context);
|
||||||
if (restore_ctx)
|
if (restore_ctx)
|
||||||
{
|
{
|
||||||
|
@ -1388,6 +1362,7 @@ void wined3d_context_cleanup(struct wined3d_context *context)
|
||||||
|
|
||||||
void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
|
void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
|
||||||
{
|
{
|
||||||
|
struct wined3d_pipeline_statistics_query *pipeline_statistics_query;
|
||||||
const struct wined3d_gl_info *gl_info = context_gl->c.gl_info;
|
const struct wined3d_gl_info *gl_info = context_gl->c.gl_info;
|
||||||
struct wined3d_so_statistics_query *so_statistics_query;
|
struct wined3d_so_statistics_query *so_statistics_query;
|
||||||
struct wined3d_timestamp_query *timestamp_query;
|
struct wined3d_timestamp_query *timestamp_query;
|
||||||
|
@ -1413,6 +1388,12 @@ void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
|
||||||
if (context_gl->blit_vbo)
|
if (context_gl->blit_vbo)
|
||||||
GL_EXTCALL(glDeleteBuffers(1, &context_gl->blit_vbo));
|
GL_EXTCALL(glDeleteBuffers(1, &context_gl->blit_vbo));
|
||||||
|
|
||||||
|
for (i = 0; i < context_gl->free_pipeline_statistics_query_count; ++i)
|
||||||
|
{
|
||||||
|
union wined3d_gl_pipeline_statistics_query *q = &context_gl->free_pipeline_statistics_queries[i];
|
||||||
|
GL_EXTCALL(glDeleteQueries(ARRAY_SIZE(q->id), q->id));
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < context_gl->free_so_statistics_query_count; ++i)
|
for (i = 0; i < context_gl->free_so_statistics_query_count; ++i)
|
||||||
{
|
{
|
||||||
union wined3d_gl_so_statistics_query *q = &context_gl->free_so_statistics_queries[i];
|
union wined3d_gl_so_statistics_query *q = &context_gl->free_so_statistics_queries[i];
|
||||||
|
@ -1449,11 +1430,20 @@ void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl)
|
||||||
|
|
||||||
checkGLcall("context cleanup");
|
checkGLcall("context cleanup");
|
||||||
}
|
}
|
||||||
|
heap_free(context_gl->free_pipeline_statistics_queries);
|
||||||
heap_free(context_gl->free_so_statistics_queries);
|
heap_free(context_gl->free_so_statistics_queries);
|
||||||
heap_free(context_gl->free_timestamp_queries);
|
heap_free(context_gl->free_timestamp_queries);
|
||||||
heap_free(context_gl->free_fences);
|
heap_free(context_gl->free_fences);
|
||||||
heap_free(context_gl->free_occlusion_queries);
|
heap_free(context_gl->free_occlusion_queries);
|
||||||
|
|
||||||
|
LIST_FOR_EACH_ENTRY(pipeline_statistics_query, &context_gl->pipeline_statistics_queries,
|
||||||
|
struct wined3d_pipeline_statistics_query, entry)
|
||||||
|
{
|
||||||
|
if (context_gl->c.valid)
|
||||||
|
GL_EXTCALL(glDeleteQueries(ARRAY_SIZE(pipeline_statistics_query->u.id), pipeline_statistics_query->u.id));
|
||||||
|
pipeline_statistics_query->context_gl = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
LIST_FOR_EACH_ENTRY(so_statistics_query, &context_gl->so_statistics_queries,
|
LIST_FOR_EACH_ENTRY(so_statistics_query, &context_gl->so_statistics_queries,
|
||||||
struct wined3d_so_statistics_query, entry)
|
struct wined3d_so_statistics_query, entry)
|
||||||
{
|
{
|
||||||
|
@ -1913,8 +1903,6 @@ static BOOL wined3d_context_init(struct wined3d_context *context, struct wined3d
|
||||||
struct wined3d_device *device = swapchain->device;
|
struct wined3d_device *device = swapchain->device;
|
||||||
DWORD state;
|
DWORD state;
|
||||||
|
|
||||||
list_init(&context->pipeline_statistics_queries);
|
|
||||||
|
|
||||||
list_init(&context->fbo_list);
|
list_init(&context->fbo_list);
|
||||||
list_init(&context->fbo_destroy_list);
|
list_init(&context->fbo_destroy_list);
|
||||||
|
|
||||||
|
@ -1994,6 +1982,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl, struct wi
|
||||||
list_init(&context_gl->fences);
|
list_init(&context_gl->fences);
|
||||||
list_init(&context_gl->timestamp_queries);
|
list_init(&context_gl->timestamp_queries);
|
||||||
list_init(&context_gl->so_statistics_queries);
|
list_init(&context_gl->so_statistics_queries);
|
||||||
|
list_init(&context_gl->pipeline_statistics_queries);
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(context_gl->tex_unit_map); ++i)
|
for (i = 0; i < ARRAY_SIZE(context_gl->tex_unit_map); ++i)
|
||||||
context_gl->tex_unit_map[i] = WINED3D_UNMAPPED_STAGE;
|
context_gl->tex_unit_map[i] = WINED3D_UNMAPPED_STAGE;
|
||||||
|
|
|
@ -922,7 +922,7 @@ static BOOL wined3d_pipeline_query_ops_poll(struct wined3d_query *query, DWORD f
|
||||||
|
|
||||||
TRACE("query %p, flags %#x.\n", query, flags);
|
TRACE("query %p, flags %#x.\n", query, flags);
|
||||||
|
|
||||||
if (!(context = context_reacquire(device, pq->context)))
|
if (!(context = context_reacquire(device, &pq->context_gl->c)))
|
||||||
{
|
{
|
||||||
FIXME("%p Wrong thread.\n", query);
|
FIXME("%p Wrong thread.\n", query);
|
||||||
memset(&pq->statistics, 0, sizeof(pq->statistics));
|
memset(&pq->statistics, 0, sizeof(pq->statistics));
|
||||||
|
@ -990,24 +990,24 @@ static BOOL wined3d_pipeline_query_ops_issue(struct wined3d_query *query, DWORD
|
||||||
{
|
{
|
||||||
if (pq->started)
|
if (pq->started)
|
||||||
{
|
{
|
||||||
if ((context = context_reacquire(device, pq->context)))
|
if ((context = context_reacquire(device, &pq->context_gl->c)))
|
||||||
{
|
{
|
||||||
wined3d_pipeline_statistics_query_end(pq, context);
|
wined3d_pipeline_statistics_query_end(pq, context);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FIXME("Wrong thread, can't restart query.\n");
|
FIXME("Wrong thread, can't restart query.\n");
|
||||||
context_free_pipeline_statistics_query(pq);
|
wined3d_context_gl_free_pipeline_statistics_query(pq);
|
||||||
context = context_acquire(device, NULL, 0);
|
context = context_acquire(device, NULL, 0);
|
||||||
context_alloc_pipeline_statistics_query(context, pq);
|
wined3d_context_gl_alloc_pipeline_statistics_query(wined3d_context_gl(context), pq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pq->context)
|
if (pq->context_gl)
|
||||||
context_free_pipeline_statistics_query(pq);
|
wined3d_context_gl_free_pipeline_statistics_query(pq);
|
||||||
context = context_acquire(device, NULL, 0);
|
context = context_acquire(device, NULL, 0);
|
||||||
context_alloc_pipeline_statistics_query(context, pq);
|
wined3d_context_gl_alloc_pipeline_statistics_query(wined3d_context_gl(context), pq);
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context->gl_info;
|
||||||
|
|
||||||
|
@ -1031,7 +1031,7 @@ static BOOL wined3d_pipeline_query_ops_issue(struct wined3d_query *query, DWORD
|
||||||
{
|
{
|
||||||
if (pq->started)
|
if (pq->started)
|
||||||
{
|
{
|
||||||
if ((context = context_reacquire(device, pq->context)))
|
if ((context = context_reacquire(device, &pq->context_gl->c)))
|
||||||
{
|
{
|
||||||
wined3d_pipeline_statistics_query_end(pq, context);
|
wined3d_pipeline_statistics_query_end(pq, context);
|
||||||
context_release(context);
|
context_release(context);
|
||||||
|
@ -1294,8 +1294,8 @@ static HRESULT wined3d_so_statistics_query_create(struct wined3d_device *device,
|
||||||
static void wined3d_pipeline_query_ops_destroy(struct wined3d_query *query)
|
static void wined3d_pipeline_query_ops_destroy(struct wined3d_query *query)
|
||||||
{
|
{
|
||||||
struct wined3d_pipeline_statistics_query *pq = wined3d_pipeline_statistics_query_from_query(query);
|
struct wined3d_pipeline_statistics_query *pq = wined3d_pipeline_statistics_query_from_query(query);
|
||||||
if (pq->context)
|
if (pq->context_gl)
|
||||||
context_free_pipeline_statistics_query(pq);
|
wined3d_context_gl_free_pipeline_statistics_query(pq);
|
||||||
heap_free(pq);
|
heap_free(pq);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1848,15 +1848,11 @@ struct wined3d_pipeline_statistics_query
|
||||||
|
|
||||||
struct list entry;
|
struct list entry;
|
||||||
union wined3d_gl_pipeline_statistics_query u;
|
union wined3d_gl_pipeline_statistics_query u;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
struct wined3d_query_data_pipeline_statistics statistics;
|
struct wined3d_query_data_pipeline_statistics statistics;
|
||||||
BOOL started;
|
BOOL started;
|
||||||
};
|
};
|
||||||
|
|
||||||
void context_alloc_pipeline_statistics_query(struct wined3d_context *context,
|
|
||||||
struct wined3d_pipeline_statistics_query *query) DECLSPEC_HIDDEN;
|
|
||||||
void context_free_pipeline_statistics_query(struct wined3d_pipeline_statistics_query *query) DECLSPEC_HIDDEN;
|
|
||||||
|
|
||||||
struct wined3d_gl_view
|
struct wined3d_gl_view
|
||||||
{
|
{
|
||||||
GLenum target;
|
GLenum target;
|
||||||
|
@ -1974,12 +1970,6 @@ struct wined3d_context
|
||||||
struct wined3d_rendertarget_info blit_targets[MAX_RENDER_TARGET_VIEWS];
|
struct wined3d_rendertarget_info blit_targets[MAX_RENDER_TARGET_VIEWS];
|
||||||
DWORD draw_buffers_mask; /* Enabled draw buffers, 31 max. */
|
DWORD draw_buffers_mask; /* Enabled draw buffers, 31 max. */
|
||||||
|
|
||||||
/* Queries */
|
|
||||||
union wined3d_gl_pipeline_statistics_query *free_pipeline_statistics_queries;
|
|
||||||
SIZE_T free_pipeline_statistics_query_size;
|
|
||||||
unsigned int free_pipeline_statistics_query_count;
|
|
||||||
struct list pipeline_statistics_queries;
|
|
||||||
|
|
||||||
struct wined3d_stream_info stream_info;
|
struct wined3d_stream_info stream_info;
|
||||||
|
|
||||||
/* Fences for GL_APPLE_flush_buffer_range */
|
/* Fences for GL_APPLE_flush_buffer_range */
|
||||||
|
@ -2009,6 +1999,7 @@ struct wined3d_context_gl
|
||||||
struct list fences;
|
struct list fences;
|
||||||
struct list timestamp_queries;
|
struct list timestamp_queries;
|
||||||
struct list so_statistics_queries;
|
struct list so_statistics_queries;
|
||||||
|
struct list pipeline_statistics_queries;
|
||||||
|
|
||||||
GLuint *free_occlusion_queries;
|
GLuint *free_occlusion_queries;
|
||||||
SIZE_T free_occlusion_query_size;
|
SIZE_T free_occlusion_query_size;
|
||||||
|
@ -2026,6 +2017,10 @@ struct wined3d_context_gl
|
||||||
SIZE_T free_so_statistics_query_size;
|
SIZE_T free_so_statistics_query_size;
|
||||||
unsigned int free_so_statistics_query_count;
|
unsigned int free_so_statistics_query_count;
|
||||||
|
|
||||||
|
union wined3d_gl_pipeline_statistics_query *free_pipeline_statistics_queries;
|
||||||
|
SIZE_T free_pipeline_statistics_query_size;
|
||||||
|
unsigned int free_pipeline_statistics_query_count;
|
||||||
|
|
||||||
GLuint blit_vbo;
|
GLuint blit_vbo;
|
||||||
|
|
||||||
unsigned int tex_unit_map[WINED3D_MAX_COMBINED_SAMPLERS];
|
unsigned int tex_unit_map[WINED3D_MAX_COMBINED_SAMPLERS];
|
||||||
|
@ -2053,6 +2048,8 @@ void wined3d_context_gl_alloc_fence(struct wined3d_context_gl *context_gl,
|
||||||
struct wined3d_fence *fence) DECLSPEC_HIDDEN;
|
struct wined3d_fence *fence) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_alloc_occlusion_query(struct wined3d_context_gl *context_gl,
|
void wined3d_context_gl_alloc_occlusion_query(struct wined3d_context_gl *context_gl,
|
||||||
struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
|
struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
|
||||||
|
void wined3d_context_gl_alloc_pipeline_statistics_query(struct wined3d_context_gl *context_gl,
|
||||||
|
struct wined3d_pipeline_statistics_query *query) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_alloc_so_statistics_query(struct wined3d_context_gl *context_gl,
|
void wined3d_context_gl_alloc_so_statistics_query(struct wined3d_context_gl *context_gl,
|
||||||
struct wined3d_so_statistics_query *query) DECLSPEC_HIDDEN;
|
struct wined3d_so_statistics_query *query) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_alloc_timestamp_query(struct wined3d_context_gl *context_gl,
|
void wined3d_context_gl_alloc_timestamp_query(struct wined3d_context_gl *context_gl,
|
||||||
|
@ -2066,6 +2063,7 @@ void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl,
|
||||||
void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
|
void wined3d_context_gl_cleanup(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_free_fence(struct wined3d_fence *fence) DECLSPEC_HIDDEN;
|
void wined3d_context_gl_free_fence(struct wined3d_fence *fence) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_free_occlusion_query(struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
|
void wined3d_context_gl_free_occlusion_query(struct wined3d_occlusion_query *query) DECLSPEC_HIDDEN;
|
||||||
|
void wined3d_context_gl_free_pipeline_statistics_query(struct wined3d_pipeline_statistics_query *query) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_free_so_statistics_query(struct wined3d_so_statistics_query *query) DECLSPEC_HIDDEN;
|
void wined3d_context_gl_free_so_statistics_query(struct wined3d_so_statistics_query *query) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
|
void wined3d_context_gl_free_timestamp_query(struct wined3d_timestamp_query *query) DECLSPEC_HIDDEN;
|
||||||
const unsigned int *wined3d_context_gl_get_tex_unit_mapping(const struct wined3d_context_gl *context_gl,
|
const unsigned int *wined3d_context_gl_get_tex_unit_mapping(const struct wined3d_context_gl *context_gl,
|
||||||
|
|
Loading…
Reference in New Issue