[3/3] wined3d: Allow async occlusion queries
H. Verbeet
hverbeet at gmail.com
Mon Aug 7 12:25:17 CDT 2006
This allows the application to check if the query is done yet, instead
of always waiting for it.
-------------- next part --------------
dlls/wined3d/query.c | 26 ++++++++++++++++++++------
include/wine/wined3d_gl.h | 1 +
2 files changed, 21 insertions(+), 6 deletions(-)
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index a4f0b9d..8cbe3f3 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -94,6 +94,7 @@ static HRESULT WINAPI IWineD3DQueryImpl
static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags){
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
+ HRESULT res = S_OK;
TRACE("(%p) : type %#x, pData %p, dwSize %#lx, dwGetDataFlags %#lx\n", This, This->type, pData, dwSize, dwGetDataFlags);
@@ -157,14 +158,27 @@ static HRESULT WINAPI IWineD3DQueryImpl
{
DWORD* data = pData;
if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
- GLint samples;
- GL_EXTCALL(glGetQueryObjectivARB(((WineQueryOcclusionData *)This->extendedData)->queryId, GL_QUERY_RESULT_ARB, &samples));
- checkGLcall("glGetQueryObjectiv()\n");
- TRACE("(%p) : Returning %d samples.\n", This, samples);
- *data = samples;
+ GLint available;
+ GLuint samples;
+ GLuint queryId = ((WineQueryOcclusionData *)This->extendedData)->queryId;
+
+ GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_AVAILABLE_ARB, &available));
+ checkGLcall("glGetQueryObjectiv(GL_QUERY_RESULT_AVAILABLE)\n");
+ TRACE("(%p) : available %d.\n", This, available);
+
+ if (available || dwGetDataFlags & WINED3DGETDATA_FLUSH) {
+ GL_EXTCALL(glGetQueryObjectuivARB(queryId, GL_QUERY_RESULT_ARB, &samples));
+ checkGLcall("glGetQueryObjectuiv(GL_QUERY_RESULT)\n");
+ TRACE("(%p) : Returning %d samples.\n", This, samples);
+ *data = samples;
+ res = S_OK;
+ } else {
+ res = S_FALSE;
+ }
} else {
FIXME("(%p) : Occlusion queries not supported. Returning 1.\n", This);
*data = 1;
+ res = S_OK;
}
}
break;
@@ -252,7 +266,7 @@ static HRESULT WINAPI IWineD3DQueryImpl
D3DGETDATA_FLUSH may return WINED3DERR_DEVICELOST if the device is lost
*/
FIXME("(%p) : type %#x, Partial stub\n", This, This->type);
- return S_OK; /* S_OK if the query data is available*/
+ return res; /* S_OK if the query data is available*/
}
diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h
index 5af463e..d50be65 100644
--- a/include/wine/wined3d_gl.h
+++ b/include/wine/wined3d_gl.h
@@ -1439,6 +1439,7 @@ #define GL_EXT_FUNCS_GEN \
USE_GL_FUNC(PGLFNBEGINQUERYARBPROC, glBeginQueryARB); \
USE_GL_FUNC(PGLFNENDQUERYARBPROC, glEndQueryARB); \
USE_GL_FUNC(PGLFNGETQUERYOBJECTIVARBPROC, glGetQueryObjectivARB); \
+ USE_GL_FUNC(PGLFNGETQUERYOBJECTUIVARBPROC, glGetQueryObjectuivARB); \
/* GL_ARB_point_parameters */ \
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFARBPROC, glPointParameterfARB); \
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFVARBPROC, glPointParameterfvARB); \
More information about the wine-patches
mailing list