Commit ab275ab4 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Make calling a query from the wrong context a FIXME.

We want to know if this happens a lot. If the query is always called from a different context than the one that created it, occlusion culling would effectively be disabled, which could have a significant performance impact, depending on the type of objects being culled.
parent 691894d1
...@@ -281,32 +281,44 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, ...@@ -281,32 +281,44 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface,
/* Msdn says this returns an error, but our tests show that S_FALSE is returned */ /* Msdn says this returns an error, but our tests show that S_FALSE is returned */
TRACE("Query is building, returning S_FALSE\n"); TRACE("Query is building, returning S_FALSE\n");
res = S_FALSE; res = S_FALSE;
} else if (GL_SUPPORT(ARB_OCCLUSION_QUERY) && }
((WineQueryOcclusionData *)This->extendedData)->ctx == This->wineD3DDevice->activeContext && else if (GL_SUPPORT(ARB_OCCLUSION_QUERY))
This->wineD3DDevice->activeContext->tid == GetCurrentThreadId()) { {
GLuint available; if (((WineQueryOcclusionData *)This->extendedData)->ctx != This->wineD3DDevice->activeContext
GLuint samples; || This->wineD3DDevice->activeContext->tid != GetCurrentThreadId())
GLuint queryId = ((WineQueryOcclusionData *)This->extendedData)->queryId; {
FIXME("%p Wrong context, returning 1.\n", This);
*data = 1;
res = S_OK;
}
else
{
GLuint available;
GLuint samples;
GLuint queryId = ((WineQueryOcclusionData *)This->extendedData)->queryId;
ENTER_GL(); ENTER_GL();
GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_AVAILABLE_ARB, &available)); GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_AVAILABLE_ARB, &available));
checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)\n"); checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)\n");
TRACE("(%p) : available %d.\n", This, available); TRACE("(%p) : available %d.\n", This, available);
if (available) { if (available)
if(data) { {
GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_ARB, &samples)); if (data)
checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)\n"); {
TRACE("(%p) : Returning %d samples.\n", This, samples); GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_ARB, &samples));
*data = samples; checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)\n");
TRACE("(%p) : Returning %d samples.\n", This, samples);
*data = samples;
}
res = S_OK;
} else {
res = S_FALSE;
} }
res = S_OK; LEAVE_GL();
} else {
res = S_FALSE;
} }
LEAVE_GL();
} else { } else {
WARN("(%p) : Occlusion queries not supported, or wrong context. Returning 1.\n", This); WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This);
*data = 1; *data = 1;
res = S_OK; res = S_OK;
} }
...@@ -324,7 +336,7 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void ...@@ -324,7 +336,7 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void
return S_OK; return S_OK;
} if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) { } if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
/* See comment in IWineD3DQuery::Issue, event query codeblock */ /* See comment in IWineD3DQuery::Issue, event query codeblock */
WARN("Query context not active, reporting GPU idle\n"); FIXME("Query context not active, reporting GPU idle\n");
*data = TRUE; *data = TRUE;
} else if(GL_SUPPORT(APPLE_FENCE)) { } else if(GL_SUPPORT(APPLE_FENCE)) {
ENTER_GL(); ENTER_GL();
...@@ -460,7 +472,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D ...@@ -460,7 +472,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D
WineD3DContext *ctx = ((WineQueryOcclusionData *)This->extendedData)->ctx; WineD3DContext *ctx = ((WineQueryOcclusionData *)This->extendedData)->ctx;
if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) { if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) {
WARN("Not the owning context, can't start query\n"); FIXME("Not the owning context, can't start query\n");
} else { } else {
ENTER_GL(); ENTER_GL();
/* This is allowed according to msdn and our tests. Reset the query and restart */ /* This is allowed according to msdn and our tests. Reset the query and restart */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment