Module: wine Branch: master Commit: ab275ab48700013e57441e9bca6f5c96c2ceb6d2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=ab275ab48700013e57441e9bca...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Jan 7 09:00:55 2009 +0100
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.
---
dlls/wined3d/query.c | 60 ++++++++++++++++++++++++++++++-------------------- 1 files changed, 36 insertions(+), 24 deletions(-)
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c index 7826325..c9989f2 100644 --- a/dlls/wined3d/query.c +++ b/dlls/wined3d/query.c @@ -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 */ TRACE("Query is building, returning S_FALSE\n"); res = S_FALSE; - } else if (GL_SUPPORT(ARB_OCCLUSION_QUERY) && - ((WineQueryOcclusionData *)This->extendedData)->ctx == This->wineD3DDevice->activeContext && - This->wineD3DDevice->activeContext->tid == GetCurrentThreadId()) { - GLuint available; - GLuint samples; - GLuint queryId = ((WineQueryOcclusionData *)This->extendedData)->queryId; + } + else if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) + { + if (((WineQueryOcclusionData *)This->extendedData)->ctx != This->wineD3DDevice->activeContext + || This->wineD3DDevice->activeContext->tid != GetCurrentThreadId()) + { + 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(); - GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_AVAILABLE_ARB, &available)); - checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)\n"); - TRACE("(%p) : available %d.\n", This, available); - - if (available) { - if(data) { - GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_ARB, &samples)); - checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT)\n"); - TRACE("(%p) : Returning %d samples.\n", This, samples); - *data = samples; + ENTER_GL(); + GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_AVAILABLE_ARB, &available)); + checkGLcall("glGetQueryObjectuivARB(GL_QUERY_RESULT_AVAILABLE)\n"); + TRACE("(%p) : available %d.\n", This, available); + + if (available) + { + if (data) + { + GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_ARB, &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; - } else { - res = S_FALSE; + LEAVE_GL(); } - LEAVE_GL(); } 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; res = S_OK; } @@ -324,7 +336,7 @@ static HRESULT WINAPI IWineD3DEventQueryImpl_GetData(IWineD3DQuery* iface, void return S_OK; } if(ctx != This->wineD3DDevice->activeContext || ctx->tid != GetCurrentThreadId()) { /* 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; } else if(GL_SUPPORT(APPLE_FENCE)) { ENTER_GL(); @@ -460,7 +472,7 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_Issue(IWineD3DQuery* iface, D WineD3DContext *ctx = ((WineQueryOcclusionData *)This->extendedData)->ctx;
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 { ENTER_GL(); /* This is allowed according to msdn and our tests. Reset the query and restart */