Commit 0e8ed9be authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Simplify IWineD3DOcclusionQueryImpl_GetData().

parent ab275ab4
...@@ -268,36 +268,46 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa ...@@ -268,36 +268,46 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) { static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags) {
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface; IWineD3DQueryImpl *This = (IWineD3DQueryImpl *) iface;
GLuint queryId = ((WineQueryOcclusionData *)This->extendedData)->queryId;
DWORD* data = pData; DWORD* data = pData;
GLuint available;
GLuint samples;
HRESULT res; HRESULT res;
TRACE("(%p) : type D3DQUERY_OCCLUSION, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags); TRACE("(%p) : type D3DQUERY_OCCLUSION, pData %p, dwSize %#x, dwGetDataFlags %#x\n", This, pData, dwSize, dwGetDataFlags);
if(This->state == QUERY_CREATED) { if (This->state == QUERY_CREATED)
{
/* D3D allows GetData on a new query, OpenGL doesn't. So just invent the data ourselves */ /* D3D allows GetData on a new query, OpenGL doesn't. So just invent the data ourselves */
TRACE("Query wasn't yet started, returning S_OK\n"); TRACE("Query wasn't yet started, returning S_OK\n");
res = S_OK;
if(data) *data = 0; if(data) *data = 0;
} else if(This->state == QUERY_BUILDING) { return S_OK;
}
if (This->state == QUERY_BUILDING)
{
/* 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; return S_FALSE;
} }
else if (GL_SUPPORT(ARB_OCCLUSION_QUERY))
if (!GL_SUPPORT(ARB_OCCLUSION_QUERY))
{ {
WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This);
*data = 1;
return S_OK;
}
if (((WineQueryOcclusionData *)This->extendedData)->ctx != This->wineD3DDevice->activeContext if (((WineQueryOcclusionData *)This->extendedData)->ctx != This->wineD3DDevice->activeContext
|| This->wineD3DDevice->activeContext->tid != GetCurrentThreadId()) || This->wineD3DDevice->activeContext->tid != GetCurrentThreadId())
{ {
FIXME("%p Wrong context, returning 1.\n", This); FIXME("%p Wrong context, returning 1.\n", This);
*data = 1; *data = 1;
res = S_OK; return 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);
...@@ -312,16 +322,14 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface, ...@@ -312,16 +322,14 @@ static HRESULT WINAPI IWineD3DOcclusionQueryImpl_GetData(IWineD3DQuery* iface,
*data = samples; *data = samples;
} }
res = S_OK; res = S_OK;
} else { }
else
{
res = S_FALSE; res = S_FALSE;
} }
LEAVE_GL(); LEAVE_GL();
}
} else {
WARN("(%p) : Occlusion queries not supported. Returning 1.\n", This);
*data = 1;
res = S_OK;
}
return res; return res;
} }
......
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