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.
This commit is contained in:
parent
691894d1ab
commit
ab275ab487
|
@ -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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
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 {
|
||||
res = S_FALSE;
|
||||
}
|
||||
LEAVE_GL();
|
||||
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;
|
||||
}
|
||||
res = S_OK;
|
||||
} else {
|
||||
res = S_FALSE;
|
||||
}
|
||||
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 */
|
||||
|
|
Loading…
Reference in New Issue