wined3d: Add real occlusion query support.
This commit is contained in:
parent
8c981140a2
commit
536638918d
|
@ -1390,7 +1390,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
|
|||
switch(Type) {
|
||||
case WINED3DQUERYTYPE_OCCLUSION:
|
||||
TRACE("(%p) occlusion query\n", This);
|
||||
if (GL_SUPPORT(ARB_OCCLUSION_QUERY) || GL_SUPPORT(NV_OCCLUSION_QUERY))
|
||||
if (GL_SUPPORT(ARB_OCCLUSION_QUERY))
|
||||
hr = WINED3D_OK;
|
||||
else
|
||||
WARN("Unsupported in local OpenGL implementation: ARB_OCCLUSION_QUERY/NV_OCCLUSION_QUERY\n");
|
||||
|
@ -1419,9 +1419,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
|
|||
/* allocated the 'extended' data based on the type of query requested */
|
||||
switch(Type){
|
||||
case D3DQUERYTYPE_OCCLUSION:
|
||||
if(GL_SUPPORT(ARB_OCCLUSION_QUERY) || GL_SUPPORT(NV_OCCLUSION_QUERY)) {
|
||||
if(GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
|
||||
TRACE("(%p) Allocating data for an occlusion query\n", This);
|
||||
object->extendedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WineQueryOcclusionData));
|
||||
GL_EXTCALL(glGenQueriesARB(1, &((WineQueryOcclusionData *)(object->extendedData))->queryId));
|
||||
break;
|
||||
}
|
||||
case D3DQUERYTYPE_VCACHE:
|
||||
|
|
|
@ -25,10 +25,15 @@
|
|||
#include "wined3d_private.h"
|
||||
|
||||
/*
|
||||
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/advancedtopics/Queries.asp
|
||||
*/
|
||||
* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/programmingguide/advancedtopics/Queries.asp
|
||||
*
|
||||
* Occlusion Queries:
|
||||
* http://www.gris.uni-tuebingen.de/~bartz/Publications/paper/hww98.pdf
|
||||
* http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
|
||||
*/
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
|
||||
#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->wineD3DDevice)->wineD3D))->gl_info
|
||||
|
||||
/* *******************************************
|
||||
IWineD3DQuery IUnknown parts follow
|
||||
|
@ -89,6 +94,9 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetDevice(IWineD3DQuery* iface, IWineD3
|
|||
|
||||
static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pData, DWORD dwSize, DWORD dwGetDataFlags){
|
||||
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
|
||||
|
||||
TRACE("(%p) : type %#x, pData %p, dwSize %#lx, dwGetDataFlags %#lx\n", This, This->type, pData, dwSize, dwGetDataFlags);
|
||||
|
||||
if(dwSize == 0){
|
||||
/*you can use this method to poll the resource for the query status*/
|
||||
/*We return success(S_OK) if we support a feature, and faikure(S_FALSE) if we don't, just return success and fluff it for now*/
|
||||
|
@ -148,12 +156,15 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
|||
case WINED3DQUERYTYPE_OCCLUSION:
|
||||
{
|
||||
DWORD* data = pData;
|
||||
*data = 1;
|
||||
/* TODO: opengl occlusion queries
|
||||
http://www.gris.uni-tuebingen.de/~bartz/Publications/paper/hww98.pdf
|
||||
http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
|
||||
http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
|
||||
*/
|
||||
if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
|
||||
GLint samples;
|
||||
GL_EXTCALL(glGetQueryObjectivARB(((WineQueryOcclusionData *)This->extendedData)->queryId, GL_QUERY_RESULT_ARB, &samples));
|
||||
TRACE("(%p) : Returning %d samples.\n", This, samples);
|
||||
*data = samples;
|
||||
} else {
|
||||
FIXME("(%p) : Occlusion queries not supported. Returning 1.\n", This);
|
||||
*data = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case WINED3DQUERYTYPE_TIMESTAMP:
|
||||
|
@ -263,11 +274,6 @@ static DWORD WINAPI IWineD3DQueryImpl_GetDataSize(IWineD3DQuery* iface){
|
|||
break;
|
||||
case WINED3DQUERYTYPE_OCCLUSION:
|
||||
dataSize = sizeof(DWORD);
|
||||
/*
|
||||
http://www.gris.uni-tuebingen.de/~bartz/Publications/paper/hww98.pdf
|
||||
http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
|
||||
http://oss.sgi.com/projects/ogl-sample/registry/ARB/occlusion_query.txt
|
||||
*/
|
||||
break;
|
||||
case WINED3DQUERYTYPE_TIMESTAMP:
|
||||
dataSize = sizeof(UINT64);
|
||||
|
@ -312,7 +318,28 @@ static WINED3DQUERYTYPE WINAPI IWineD3DQueryImpl_GetType(IWineD3DQuery* iface){
|
|||
|
||||
static HRESULT WINAPI IWineD3DQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIssueFlags){
|
||||
IWineD3DQueryImpl *This = (IWineD3DQueryImpl *)iface;
|
||||
FIXME("(%p) : stub\n", This);
|
||||
|
||||
TRACE("(%p) : dwIssueFlags %#lx, type %#x\n", This, dwIssueFlags, This->type);
|
||||
|
||||
switch (This->type) {
|
||||
case WINED3DQUERYTYPE_OCCLUSION:
|
||||
if (GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
|
||||
if (dwIssueFlags & D3DISSUE_BEGIN) {
|
||||
GL_EXTCALL(glBeginQueryARB(GL_SAMPLES_PASSED_ARB, ((WineQueryOcclusionData *)This->extendedData)->queryId));
|
||||
}
|
||||
if (dwIssueFlags & D3DISSUE_END) {
|
||||
GL_EXTCALL(glEndQueryARB(GL_SAMPLES_PASSED_ARB));
|
||||
}
|
||||
} else {
|
||||
FIXME("(%p) : Occlusion queries not supported\n", This);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
FIXME("(%p) : Unhandled query type %#x\n", This, This->type);
|
||||
break;
|
||||
}
|
||||
|
||||
return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL. */
|
||||
}
|
||||
|
||||
|
|
|
@ -1160,7 +1160,7 @@ extern const IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
|
|||
|
||||
/* Datastructures for IWineD3DQueryImpl.extendedData */
|
||||
typedef struct WineQueryOcclusionData {
|
||||
unsigned int queryId;
|
||||
GLuint queryId;
|
||||
} WineQueryOcclusionData;
|
||||
|
||||
|
||||
|
|
|
@ -1417,6 +1417,12 @@ typedef enum _GL_SupportedExt {
|
|||
USE_GL_FUNC(WINED3D_PFNGLMULTITEXCOORD2FARBPROC, glMultiTexCoord2fARB); \
|
||||
USE_GL_FUNC(WINED3D_PFNGLMULTITEXCOORD3FARBPROC, glMultiTexCoord3fARB); \
|
||||
USE_GL_FUNC(WINED3D_PFNGLMULTITEXCOORD4FARBPROC, glMultiTexCoord4fARB); \
|
||||
/* GL_ARB_occlusion_query */ \
|
||||
USE_GL_FUNC(PGLFNGENQUERIESARBPROC, glGenQueriesARB); \
|
||||
USE_GL_FUNC(PGLFNDELETEQUERIESARBPROC, glDeleteQueriesARB); \
|
||||
USE_GL_FUNC(PGLFNBEGINQUERYARBPROC, glBeginQueryARB); \
|
||||
USE_GL_FUNC(PGLFNENDQUERYARBPROC, glEndQueryARB); \
|
||||
USE_GL_FUNC(PGLFNGETQUERYOBJECTIVARBPROC, glGetQueryObjectivARB); \
|
||||
/* GL_ARB_point_parameters */ \
|
||||
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFARBPROC, glPointParameterfARB); \
|
||||
USE_GL_FUNC(PGLFNGLPOINTPARAMETERFVARBPROC, glPointParameterfvARB); \
|
||||
|
|
Loading…
Reference in New Issue