wined3d: Pass a wined3d_context_gl structure to context_reacquire().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
e0d9bc3a87
commit
bfbc5f56b1
|
@ -4259,27 +4259,28 @@ struct wined3d_context *wined3d_context_gl_acquire(const struct wined3d_device *
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wined3d_context *context_reacquire(struct wined3d_device *device,
|
struct wined3d_context_gl *wined3d_context_gl_reacquire(struct wined3d_context_gl *context_gl)
|
||||||
struct wined3d_context *context)
|
|
||||||
{
|
{
|
||||||
struct wined3d_context *acquired_context;
|
struct wined3d_context *acquired_context;
|
||||||
|
struct wined3d_device *device;
|
||||||
|
|
||||||
wined3d_from_cs(device->cs);
|
if (!context_gl || context_gl->c.tid != GetCurrentThreadId())
|
||||||
|
|
||||||
if (!context || context->tid != GetCurrentThreadId())
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (context->current_rt.texture)
|
device = context_gl->c.device;
|
||||||
|
wined3d_from_cs(device->cs);
|
||||||
|
|
||||||
|
if (context_gl->c.current_rt.texture)
|
||||||
{
|
{
|
||||||
wined3d_context_gl_activate(wined3d_context_gl(context),
|
wined3d_context_gl_activate(context_gl, context_gl->c.current_rt.texture,
|
||||||
context->current_rt.texture, context->current_rt.sub_resource_idx);
|
context_gl->c.current_rt.sub_resource_idx);
|
||||||
return context;
|
return context_gl;
|
||||||
}
|
}
|
||||||
|
|
||||||
acquired_context = context_acquire(device, NULL, 0);
|
acquired_context = context_acquire(device, NULL, 0);
|
||||||
if (acquired_context != context)
|
if (acquired_context != &context_gl->c)
|
||||||
ERR("Acquired context %p instead of %p.\n", acquired_context, context);
|
ERR("Acquired context %p instead of %p.\n", acquired_context, &context_gl->c);
|
||||||
return acquired_context;
|
return wined3d_context_gl(acquired_context);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dispatch_compute(struct wined3d_device *device, const struct wined3d_state *state,
|
void dispatch_compute(struct wined3d_device *device, const struct wined3d_state *state,
|
||||||
|
|
|
@ -183,7 +183,7 @@ static enum wined3d_fence_result wined3d_fence_test(const struct wined3d_fence *
|
||||||
struct wined3d_device *device, DWORD flags)
|
struct wined3d_device *device, DWORD flags)
|
||||||
{
|
{
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
enum wined3d_fence_result ret;
|
enum wined3d_fence_result ret;
|
||||||
BOOL fence_result;
|
BOOL fence_result;
|
||||||
|
|
||||||
|
@ -195,16 +195,16 @@ static enum wined3d_fence_result wined3d_fence_test(const struct wined3d_fence *
|
||||||
return WINED3D_FENCE_NOT_STARTED;
|
return WINED3D_FENCE_NOT_STARTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(context = context_reacquire(device, &fence->context_gl->c)))
|
if (!(context_gl = wined3d_context_gl_reacquire(fence->context_gl)))
|
||||||
{
|
{
|
||||||
if (!fence->context_gl->c.gl_info->supported[ARB_SYNC])
|
if (!fence->context_gl->c.gl_info->supported[ARB_SYNC])
|
||||||
{
|
{
|
||||||
WARN("Fence tested from wrong thread.\n");
|
WARN("Fence tested from wrong thread.\n");
|
||||||
return WINED3D_FENCE_WRONG_THREAD;
|
return WINED3D_FENCE_WRONG_THREAD;
|
||||||
}
|
}
|
||||||
context = context_acquire(device, NULL, 0);
|
context_gl = wined3d_context_gl(context_acquire(device, NULL, 0));
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
if (gl_info->supported[ARB_SYNC])
|
if (gl_info->supported[ARB_SYNC])
|
||||||
{
|
{
|
||||||
|
@ -253,7 +253,7 @@ static enum wined3d_fence_result wined3d_fence_test(const struct wined3d_fence *
|
||||||
ret = WINED3D_FENCE_ERROR;
|
ret = WINED3D_FENCE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,7 +261,7 @@ enum wined3d_fence_result wined3d_fence_wait(const struct wined3d_fence *fence,
|
||||||
struct wined3d_device *device)
|
struct wined3d_device *device)
|
||||||
{
|
{
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
enum wined3d_fence_result ret;
|
enum wined3d_fence_result ret;
|
||||||
|
|
||||||
TRACE("fence %p, device %p.\n", fence, device);
|
TRACE("fence %p, device %p.\n", fence, device);
|
||||||
|
@ -273,7 +273,7 @@ enum wined3d_fence_result wined3d_fence_wait(const struct wined3d_fence *fence,
|
||||||
}
|
}
|
||||||
gl_info = fence->context_gl->c.gl_info;
|
gl_info = fence->context_gl->c.gl_info;
|
||||||
|
|
||||||
if (!(context = context_reacquire(device, &fence->context_gl->c)))
|
if (!(context_gl = wined3d_context_gl_reacquire(fence->context_gl)))
|
||||||
{
|
{
|
||||||
/* A glFinish does not reliably wait for draws in other contexts. The caller has
|
/* A glFinish does not reliably wait for draws in other contexts. The caller has
|
||||||
* to find its own way to cope with the thread switch
|
* to find its own way to cope with the thread switch
|
||||||
|
@ -283,9 +283,9 @@ enum wined3d_fence_result wined3d_fence_wait(const struct wined3d_fence *fence,
|
||||||
WARN("Fence finished from wrong thread.\n");
|
WARN("Fence finished from wrong thread.\n");
|
||||||
return WINED3D_FENCE_WRONG_THREAD;
|
return WINED3D_FENCE_WRONG_THREAD;
|
||||||
}
|
}
|
||||||
context = context_acquire(device, NULL, 0);
|
context_gl = wined3d_context_gl(context_acquire(device, NULL, 0));
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
if (gl_info->supported[ARB_SYNC])
|
if (gl_info->supported[ARB_SYNC])
|
||||||
{
|
{
|
||||||
|
@ -310,13 +310,13 @@ enum wined3d_fence_result wined3d_fence_wait(const struct wined3d_fence *fence,
|
||||||
ret = WINED3D_FENCE_ERROR;
|
ret = WINED3D_FENCE_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (context->gl_info->supported[APPLE_FENCE])
|
else if (gl_info->supported[APPLE_FENCE])
|
||||||
{
|
{
|
||||||
GL_EXTCALL(glFinishFenceAPPLE(fence->object.id));
|
GL_EXTCALL(glFinishFenceAPPLE(fence->object.id));
|
||||||
checkGLcall("glFinishFenceAPPLE");
|
checkGLcall("glFinishFenceAPPLE");
|
||||||
ret = WINED3D_FENCE_OK;
|
ret = WINED3D_FENCE_OK;
|
||||||
}
|
}
|
||||||
else if (context->gl_info->supported[NV_FENCE])
|
else if (gl_info->supported[NV_FENCE])
|
||||||
{
|
{
|
||||||
GL_EXTCALL(glFinishFenceNV(fence->object.id));
|
GL_EXTCALL(glFinishFenceNV(fence->object.id));
|
||||||
checkGLcall("glFinishFenceNV");
|
checkGLcall("glFinishFenceNV");
|
||||||
|
@ -328,23 +328,23 @@ enum wined3d_fence_result wined3d_fence_wait(const struct wined3d_fence *fence,
|
||||||
ret = WINED3D_FENCE_ERROR;
|
ret = WINED3D_FENCE_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wined3d_fence_issue(struct wined3d_fence *fence, struct wined3d_device *device)
|
void wined3d_fence_issue(struct wined3d_fence *fence, struct wined3d_device *device)
|
||||||
{
|
{
|
||||||
struct wined3d_context *context = NULL;
|
struct wined3d_context_gl *context_gl = NULL;
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
|
|
||||||
if (fence->context_gl && !(context = context_reacquire(device, &fence->context_gl->c))
|
if (fence->context_gl && !(context_gl = wined3d_context_gl_reacquire(fence->context_gl))
|
||||||
&& !fence->context_gl->c.gl_info->supported[ARB_SYNC])
|
&& !fence->context_gl->c.gl_info->supported[ARB_SYNC])
|
||||||
wined3d_context_gl_free_fence(fence);
|
wined3d_context_gl_free_fence(fence);
|
||||||
if (!context)
|
if (!context_gl)
|
||||||
context = context_acquire(device, NULL, 0);
|
context_gl = wined3d_context_gl(context_acquire(device, NULL, 0));
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
if (!fence->context_gl)
|
if (!fence->context_gl)
|
||||||
wined3d_context_gl_alloc_fence(wined3d_context_gl(context), fence);
|
wined3d_context_gl_alloc_fence(context_gl, fence);
|
||||||
|
|
||||||
if (gl_info->supported[ARB_SYNC])
|
if (gl_info->supported[ARB_SYNC])
|
||||||
{
|
{
|
||||||
|
@ -365,7 +365,7 @@ void wined3d_fence_issue(struct wined3d_fence *fence, struct wined3d_device *dev
|
||||||
checkGLcall("glSetFenceNV");
|
checkGLcall("glSetFenceNV");
|
||||||
}
|
}
|
||||||
|
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wined3d_fence_free(struct wined3d_fence *fence)
|
static void wined3d_fence_free(struct wined3d_fence *fence)
|
||||||
|
@ -531,20 +531,19 @@ HRESULT CDECL wined3d_query_issue(struct wined3d_query *query, DWORD flags)
|
||||||
static BOOL wined3d_occlusion_query_ops_poll(struct wined3d_query *query, DWORD flags)
|
static BOOL wined3d_occlusion_query_ops_poll(struct wined3d_query *query, DWORD flags)
|
||||||
{
|
{
|
||||||
struct wined3d_occlusion_query *oq = wined3d_occlusion_query_from_query(query);
|
struct wined3d_occlusion_query *oq = wined3d_occlusion_query_from_query(query);
|
||||||
struct wined3d_device *device = query->device;
|
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
GLuint available;
|
GLuint available;
|
||||||
|
|
||||||
TRACE("query %p, flags %#x.\n", query, flags);
|
TRACE("query %p, flags %#x.\n", query, flags);
|
||||||
|
|
||||||
if (!(context = context_reacquire(device, &oq->context_gl->c)))
|
if (!(context_gl = wined3d_context_gl_reacquire(oq->context_gl)))
|
||||||
{
|
{
|
||||||
FIXME("%p Wrong thread, returning 1.\n", query);
|
FIXME("%p Wrong thread, returning 1.\n", query);
|
||||||
oq->samples = 1;
|
oq->samples = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
GL_EXTCALL(glGetQueryObjectuiv(oq->id, GL_QUERY_RESULT_AVAILABLE, &available));
|
GL_EXTCALL(glGetQueryObjectuiv(oq->id, GL_QUERY_RESULT_AVAILABLE, &available));
|
||||||
TRACE("Available %#x.\n", available);
|
TRACE("Available %#x.\n", available);
|
||||||
|
@ -556,7 +555,7 @@ static BOOL wined3d_occlusion_query_ops_poll(struct wined3d_query *query, DWORD
|
||||||
}
|
}
|
||||||
|
|
||||||
checkGLcall("poll occlusion query");
|
checkGLcall("poll occlusion query");
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
|
|
||||||
return available;
|
return available;
|
||||||
}
|
}
|
||||||
|
@ -631,7 +630,7 @@ static BOOL wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
||||||
struct wined3d_occlusion_query *oq = wined3d_occlusion_query_from_query(query);
|
struct wined3d_occlusion_query *oq = wined3d_occlusion_query_from_query(query);
|
||||||
struct wined3d_device *device = query->device;
|
struct wined3d_device *device = query->device;
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
BOOL poll = FALSE;
|
BOOL poll = FALSE;
|
||||||
|
|
||||||
TRACE("query %p, flags %#x.\n", query, flags);
|
TRACE("query %p, flags %#x.\n", query, flags);
|
||||||
|
@ -642,9 +641,9 @@ static BOOL wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
||||||
{
|
{
|
||||||
if (oq->started)
|
if (oq->started)
|
||||||
{
|
{
|
||||||
if ((context = context_reacquire(device, &oq->context_gl->c)))
|
if ((context_gl = wined3d_context_gl_reacquire(oq->context_gl)))
|
||||||
{
|
{
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
GL_EXTCALL(glEndQuery(GL_SAMPLES_PASSED));
|
GL_EXTCALL(glEndQuery(GL_SAMPLES_PASSED));
|
||||||
checkGLcall("glEndQuery()");
|
checkGLcall("glEndQuery()");
|
||||||
}
|
}
|
||||||
|
@ -652,23 +651,23 @@ static BOOL wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
||||||
{
|
{
|
||||||
FIXME("Wrong thread, can't restart query.\n");
|
FIXME("Wrong thread, can't restart query.\n");
|
||||||
wined3d_context_gl_free_occlusion_query(oq);
|
wined3d_context_gl_free_occlusion_query(oq);
|
||||||
context = context_acquire(device, NULL, 0);
|
context_gl = wined3d_context_gl(context_acquire(device, NULL, 0));
|
||||||
wined3d_context_gl_alloc_occlusion_query(wined3d_context_gl(context), oq);
|
wined3d_context_gl_alloc_occlusion_query(context_gl, oq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (oq->context_gl)
|
if (oq->context_gl)
|
||||||
wined3d_context_gl_free_occlusion_query(oq);
|
wined3d_context_gl_free_occlusion_query(oq);
|
||||||
context = context_acquire(device, NULL, 0);
|
context_gl = wined3d_context_gl(context_acquire(device, NULL, 0));
|
||||||
wined3d_context_gl_alloc_occlusion_query(wined3d_context_gl(context), oq);
|
wined3d_context_gl_alloc_occlusion_query(context_gl, oq);
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
GL_EXTCALL(glBeginQuery(GL_SAMPLES_PASSED, oq->id));
|
GL_EXTCALL(glBeginQuery(GL_SAMPLES_PASSED, oq->id));
|
||||||
checkGLcall("glBeginQuery()");
|
checkGLcall("glBeginQuery()");
|
||||||
|
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
oq->started = TRUE;
|
oq->started = TRUE;
|
||||||
}
|
}
|
||||||
if (flags & WINED3DISSUE_END)
|
if (flags & WINED3DISSUE_END)
|
||||||
|
@ -678,14 +677,14 @@ static BOOL wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
||||||
* so avoid generating an error. */
|
* so avoid generating an error. */
|
||||||
if (oq->started)
|
if (oq->started)
|
||||||
{
|
{
|
||||||
if ((context = context_reacquire(device, &oq->context_gl->c)))
|
if ((context_gl = wined3d_context_gl_reacquire(oq->context_gl)))
|
||||||
{
|
{
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
GL_EXTCALL(glEndQuery(GL_SAMPLES_PASSED));
|
GL_EXTCALL(glEndQuery(GL_SAMPLES_PASSED));
|
||||||
checkGLcall("glEndQuery()");
|
checkGLcall("glEndQuery()");
|
||||||
wined3d_query_buffer_queue_result(context, query, oq->id);
|
wined3d_query_buffer_queue_result(&context_gl->c, query, oq->id);
|
||||||
|
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
poll = TRUE;
|
poll = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -702,21 +701,20 @@ static BOOL wined3d_occlusion_query_ops_issue(struct wined3d_query *query, DWORD
|
||||||
static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query, DWORD flags)
|
static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query, DWORD flags)
|
||||||
{
|
{
|
||||||
struct wined3d_timestamp_query *tq = wined3d_timestamp_query_from_query(query);
|
struct wined3d_timestamp_query *tq = wined3d_timestamp_query_from_query(query);
|
||||||
struct wined3d_device *device = query->device;
|
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
GLuint64 timestamp;
|
GLuint64 timestamp;
|
||||||
GLuint available;
|
GLuint available;
|
||||||
|
|
||||||
TRACE("query %p, flags %#x.\n", query, flags);
|
TRACE("query %p, flags %#x.\n", query, flags);
|
||||||
|
|
||||||
if (!(context = context_reacquire(device, &tq->context_gl->c)))
|
if (!(context_gl = wined3d_context_gl_reacquire(tq->context_gl)))
|
||||||
{
|
{
|
||||||
FIXME("%p Wrong thread, returning 1.\n", query);
|
FIXME("%p Wrong thread, returning 1.\n", query);
|
||||||
tq->timestamp = 1;
|
tq->timestamp = 1;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
GL_EXTCALL(glGetQueryObjectuiv(tq->id, GL_QUERY_RESULT_AVAILABLE, &available));
|
GL_EXTCALL(glGetQueryObjectuiv(tq->id, GL_QUERY_RESULT_AVAILABLE, &available));
|
||||||
checkGLcall("glGetQueryObjectuiv(GL_QUERY_RESULT_AVAILABLE)");
|
checkGLcall("glGetQueryObjectuiv(GL_QUERY_RESULT_AVAILABLE)");
|
||||||
|
@ -730,7 +728,7 @@ static BOOL wined3d_timestamp_query_ops_poll(struct wined3d_query *query, DWORD
|
||||||
tq->timestamp = timestamp;
|
tq->timestamp = timestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
|
|
||||||
return available;
|
return available;
|
||||||
}
|
}
|
||||||
|
@ -781,20 +779,19 @@ static BOOL wined3d_timestamp_disjoint_query_ops_issue(struct wined3d_query *que
|
||||||
static BOOL wined3d_so_statistics_query_ops_poll(struct wined3d_query *query, DWORD flags)
|
static BOOL wined3d_so_statistics_query_ops_poll(struct wined3d_query *query, DWORD flags)
|
||||||
{
|
{
|
||||||
struct wined3d_so_statistics_query *pq = wined3d_so_statistics_query_from_query(query);
|
struct wined3d_so_statistics_query *pq = wined3d_so_statistics_query_from_query(query);
|
||||||
struct wined3d_device *device = query->device;
|
|
||||||
GLuint written_available, generated_available;
|
GLuint written_available, generated_available;
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
|
|
||||||
TRACE("query %p, flags %#x.\n", query, flags);
|
TRACE("query %p, flags %#x.\n", query, flags);
|
||||||
|
|
||||||
if (!(context = context_reacquire(device, &pq->context_gl->c)))
|
if (!(context_gl = wined3d_context_gl_reacquire(pq->context_gl)))
|
||||||
{
|
{
|
||||||
FIXME("%p Wrong thread, returning 0 primitives.\n", query);
|
FIXME("%p Wrong thread, returning 0 primitives.\n", query);
|
||||||
memset(&pq->statistics, 0, sizeof(pq->statistics));
|
memset(&pq->statistics, 0, sizeof(pq->statistics));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
GL_EXTCALL(glGetQueryObjectuiv(pq->u.query.written,
|
GL_EXTCALL(glGetQueryObjectuiv(pq->u.query.written,
|
||||||
GL_QUERY_RESULT_AVAILABLE, &written_available));
|
GL_QUERY_RESULT_AVAILABLE, &written_available));
|
||||||
|
@ -812,7 +809,7 @@ static BOOL wined3d_so_statistics_query_ops_poll(struct wined3d_query *query, DW
|
||||||
}
|
}
|
||||||
|
|
||||||
checkGLcall("poll SO statistics query");
|
checkGLcall("poll SO statistics query");
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
|
|
||||||
return written_available && generated_available;
|
return written_available && generated_available;
|
||||||
}
|
}
|
||||||
|
@ -840,7 +837,7 @@ static BOOL wined3d_so_statistics_query_ops_issue(struct wined3d_query *query, D
|
||||||
struct wined3d_so_statistics_query *pq = wined3d_so_statistics_query_from_query(query);
|
struct wined3d_so_statistics_query *pq = wined3d_so_statistics_query_from_query(query);
|
||||||
struct wined3d_device *device = query->device;
|
struct wined3d_device *device = query->device;
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
BOOL poll = FALSE;
|
BOOL poll = FALSE;
|
||||||
|
|
||||||
TRACE("query %p, flags %#x.\n", query, flags);
|
TRACE("query %p, flags %#x.\n", query, flags);
|
||||||
|
@ -849,26 +846,26 @@ static BOOL wined3d_so_statistics_query_ops_issue(struct wined3d_query *query, D
|
||||||
{
|
{
|
||||||
if (pq->started)
|
if (pq->started)
|
||||||
{
|
{
|
||||||
if ((context = context_reacquire(device, &pq->context_gl->c)))
|
if ((context_gl = wined3d_context_gl_reacquire(pq->context_gl)))
|
||||||
{
|
{
|
||||||
wined3d_so_statistics_query_end(pq, context);
|
wined3d_so_statistics_query_end(pq, &context_gl->c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FIXME("Wrong thread, can't restart query.\n");
|
FIXME("Wrong thread, can't restart query.\n");
|
||||||
wined3d_context_gl_free_so_statistics_query(pq);
|
wined3d_context_gl_free_so_statistics_query(pq);
|
||||||
context = context_acquire(device, NULL, 0);
|
context_gl = wined3d_context_gl(context_acquire(device, NULL, 0));
|
||||||
wined3d_context_gl_alloc_so_statistics_query(wined3d_context_gl(context), pq);
|
wined3d_context_gl_alloc_so_statistics_query(context_gl, pq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pq->context_gl)
|
if (pq->context_gl)
|
||||||
wined3d_context_gl_free_so_statistics_query(pq);
|
wined3d_context_gl_free_so_statistics_query(pq);
|
||||||
context = context_acquire(device, NULL, 0);
|
context_gl = wined3d_context_gl(context_acquire(device, NULL, 0));
|
||||||
wined3d_context_gl_alloc_so_statistics_query(wined3d_context_gl(context), pq);
|
wined3d_context_gl_alloc_so_statistics_query(context_gl, pq);
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
if (gl_info->supported[ARB_TRANSFORM_FEEDBACK3])
|
if (gl_info->supported[ARB_TRANSFORM_FEEDBACK3])
|
||||||
{
|
{
|
||||||
|
@ -886,18 +883,18 @@ static BOOL wined3d_so_statistics_query_ops_issue(struct wined3d_query *query, D
|
||||||
}
|
}
|
||||||
checkGLcall("begin query");
|
checkGLcall("begin query");
|
||||||
|
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
pq->started = TRUE;
|
pq->started = TRUE;
|
||||||
}
|
}
|
||||||
if (flags & WINED3DISSUE_END)
|
if (flags & WINED3DISSUE_END)
|
||||||
{
|
{
|
||||||
if (pq->started)
|
if (pq->started)
|
||||||
{
|
{
|
||||||
if ((context = context_reacquire(device, &pq->context_gl->c)))
|
if ((context_gl = wined3d_context_gl_reacquire(pq->context_gl)))
|
||||||
{
|
{
|
||||||
wined3d_so_statistics_query_end(pq, context);
|
wined3d_so_statistics_query_end(pq, &context_gl->c);
|
||||||
|
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
poll = TRUE;
|
poll = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -914,21 +911,20 @@ static BOOL wined3d_so_statistics_query_ops_issue(struct wined3d_query *query, D
|
||||||
static BOOL wined3d_pipeline_query_ops_poll(struct wined3d_query *query, DWORD flags)
|
static BOOL wined3d_pipeline_query_ops_poll(struct wined3d_query *query, DWORD flags)
|
||||||
{
|
{
|
||||||
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);
|
||||||
struct wined3d_device *device = query->device;
|
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
GLuint available;
|
GLuint available;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
TRACE("query %p, flags %#x.\n", query, flags);
|
TRACE("query %p, flags %#x.\n", query, flags);
|
||||||
|
|
||||||
if (!(context = context_reacquire(device, &pq->context_gl->c)))
|
if (!(context_gl = wined3d_context_gl_reacquire(pq->context_gl)))
|
||||||
{
|
{
|
||||||
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));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_SIZE(pq->u.id); ++i)
|
for (i = 0; i < ARRAY_SIZE(pq->u.id); ++i)
|
||||||
{
|
{
|
||||||
|
@ -953,7 +949,7 @@ static BOOL wined3d_pipeline_query_ops_poll(struct wined3d_query *query, DWORD f
|
||||||
}
|
}
|
||||||
|
|
||||||
checkGLcall("poll pipeline statistics query");
|
checkGLcall("poll pipeline statistics query");
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
return available;
|
return available;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -981,7 +977,7 @@ static BOOL wined3d_pipeline_query_ops_issue(struct wined3d_query *query, DWORD
|
||||||
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);
|
||||||
struct wined3d_device *device = query->device;
|
struct wined3d_device *device = query->device;
|
||||||
const struct wined3d_gl_info *gl_info;
|
const struct wined3d_gl_info *gl_info;
|
||||||
struct wined3d_context *context;
|
struct wined3d_context_gl *context_gl;
|
||||||
BOOL poll = FALSE;
|
BOOL poll = FALSE;
|
||||||
|
|
||||||
TRACE("query %p, flags %#x.\n", query, flags);
|
TRACE("query %p, flags %#x.\n", query, flags);
|
||||||
|
@ -990,26 +986,26 @@ 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_gl->c)))
|
if ((context_gl = wined3d_context_gl_reacquire(pq->context_gl)))
|
||||||
{
|
{
|
||||||
wined3d_pipeline_statistics_query_end(pq, context);
|
wined3d_pipeline_statistics_query_end(pq, &context_gl->c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FIXME("Wrong thread, can't restart query.\n");
|
FIXME("Wrong thread, can't restart query.\n");
|
||||||
wined3d_context_gl_free_pipeline_statistics_query(pq);
|
wined3d_context_gl_free_pipeline_statistics_query(pq);
|
||||||
context = context_acquire(device, NULL, 0);
|
context_gl = wined3d_context_gl(context_acquire(device, NULL, 0));
|
||||||
wined3d_context_gl_alloc_pipeline_statistics_query(wined3d_context_gl(context), pq);
|
wined3d_context_gl_alloc_pipeline_statistics_query(context_gl, pq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (pq->context_gl)
|
if (pq->context_gl)
|
||||||
wined3d_context_gl_free_pipeline_statistics_query(pq);
|
wined3d_context_gl_free_pipeline_statistics_query(pq);
|
||||||
context = context_acquire(device, NULL, 0);
|
context_gl = wined3d_context_gl(context_acquire(device, NULL, 0));
|
||||||
wined3d_context_gl_alloc_pipeline_statistics_query(wined3d_context_gl(context), pq);
|
wined3d_context_gl_alloc_pipeline_statistics_query(context_gl, pq);
|
||||||
}
|
}
|
||||||
gl_info = context->gl_info;
|
gl_info = context_gl->c.gl_info;
|
||||||
|
|
||||||
GL_EXTCALL(glBeginQuery(GL_VERTICES_SUBMITTED_ARB, pq->u.query.vertices));
|
GL_EXTCALL(glBeginQuery(GL_VERTICES_SUBMITTED_ARB, pq->u.query.vertices));
|
||||||
GL_EXTCALL(glBeginQuery(GL_PRIMITIVES_SUBMITTED_ARB, pq->u.query.primitives));
|
GL_EXTCALL(glBeginQuery(GL_PRIMITIVES_SUBMITTED_ARB, pq->u.query.primitives));
|
||||||
|
@ -1024,17 +1020,17 @@ static BOOL wined3d_pipeline_query_ops_issue(struct wined3d_query *query, DWORD
|
||||||
GL_EXTCALL(glBeginQuery(GL_CLIPPING_OUTPUT_PRIMITIVES_ARB, pq->u.query.clipping_output));
|
GL_EXTCALL(glBeginQuery(GL_CLIPPING_OUTPUT_PRIMITIVES_ARB, pq->u.query.clipping_output));
|
||||||
checkGLcall("begin query");
|
checkGLcall("begin query");
|
||||||
|
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
pq->started = TRUE;
|
pq->started = TRUE;
|
||||||
}
|
}
|
||||||
if (flags & WINED3DISSUE_END)
|
if (flags & WINED3DISSUE_END)
|
||||||
{
|
{
|
||||||
if (pq->started)
|
if (pq->started)
|
||||||
{
|
{
|
||||||
if ((context = context_reacquire(device, &pq->context_gl->c)))
|
if ((context_gl = wined3d_context_gl_reacquire(pq->context_gl)))
|
||||||
{
|
{
|
||||||
wined3d_pipeline_statistics_query_end(pq, context);
|
wined3d_pipeline_statistics_query_end(pq, &context_gl->c);
|
||||||
context_release(context);
|
context_release(&context_gl->c);
|
||||||
poll = TRUE;
|
poll = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -2096,6 +2096,7 @@ HRESULT wined3d_context_gl_init(struct wined3d_context_gl *context_gl,
|
||||||
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
struct wined3d_swapchain *swapchain) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl *context_gl,
|
void wined3d_context_gl_load_tex_coords(const struct wined3d_context_gl *context_gl,
|
||||||
const struct wined3d_stream_info *si, GLuint *current_bo, const struct wined3d_state *state) DECLSPEC_HIDDEN;
|
const struct wined3d_stream_info *si, GLuint *current_bo, const struct wined3d_state *state) DECLSPEC_HIDDEN;
|
||||||
|
struct wined3d_context_gl *wined3d_context_gl_reacquire(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_release(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
|
void wined3d_context_gl_release(struct wined3d_context_gl *context_gl) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_set_draw_buffer(struct wined3d_context_gl *context_gl, GLenum buffer) DECLSPEC_HIDDEN;
|
void wined3d_context_gl_set_draw_buffer(struct wined3d_context_gl *context_gl, GLenum buffer) DECLSPEC_HIDDEN;
|
||||||
void wined3d_context_gl_texture_update(struct wined3d_context_gl *context_gl,
|
void wined3d_context_gl_texture_update(struct wined3d_context_gl *context_gl,
|
||||||
|
@ -2257,8 +2258,6 @@ void context_invalidate_compute_state(struct wined3d_context *context, DWORD sta
|
||||||
void context_invalidate_state(struct wined3d_context *context, DWORD state_id) DECLSPEC_HIDDEN;
|
void context_invalidate_state(struct wined3d_context *context, DWORD state_id) DECLSPEC_HIDDEN;
|
||||||
void *context_map_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data,
|
void *context_map_bo_address(struct wined3d_context *context, const struct wined3d_bo_address *data,
|
||||||
size_t size, GLenum binding, DWORD flags) DECLSPEC_HIDDEN;
|
size_t size, GLenum binding, DWORD flags) DECLSPEC_HIDDEN;
|
||||||
struct wined3d_context *context_reacquire(struct wined3d_device *device,
|
|
||||||
struct wined3d_context *context) DECLSPEC_HIDDEN;
|
|
||||||
void context_resource_released(const struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
|
void context_resource_released(const struct wined3d_device *device, struct wined3d_resource *resource) DECLSPEC_HIDDEN;
|
||||||
void context_restore(struct wined3d_context *context, struct wined3d_texture *texture,
|
void context_restore(struct wined3d_context *context, struct wined3d_texture *texture,
|
||||||
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
|
unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue