Implemented occlusion queries using either GL_ARB_occlusion_query or
GL_NV_occlusion_query.
This commit is contained in:
parent
f7eb64ce97
commit
5ea96a851f
|
@ -991,7 +991,6 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINED3DQUER
|
|||
case WINED3DQUERYTYPE_RESOURCEMANAGER:
|
||||
case WINED3DQUERYTYPE_VERTEXSTATS:
|
||||
case WINED3DQUERYTYPE_EVENT:
|
||||
case WINED3DQUERYTYPE_OCCLUSION:
|
||||
case WINED3DQUERYTYPE_TIMESTAMP:
|
||||
case WINED3DQUERYTYPE_TIMESTAMPDISJOINT:
|
||||
case WINED3DQUERYTYPE_TIMESTAMPFREQ:
|
||||
|
@ -1001,7 +1000,11 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINED3DQUER
|
|||
case WINED3DQUERYTYPE_PIXELTIMINGS:
|
||||
case WINED3DQUERYTYPE_BANDWIDTHTIMINGS:
|
||||
case WINED3DQUERYTYPE_CACHEUTILIZATION:
|
||||
hr = D3D_OK;
|
||||
break;
|
||||
case WINED3DQUERYTYPE_OCCLUSION:
|
||||
TRACE("(%p) occlusion query\n", This);
|
||||
if (GL_SUPPORT(ARB_OCCLUSION_QUERY) || GL_SUPPORT(NV_OCCLUSION_QUERY))
|
||||
hr = D3D_OK;
|
||||
break;
|
||||
default:
|
||||
FIXME("(%p) Unhandled query type %d\n",This , Type);
|
||||
|
@ -1012,7 +1015,31 @@ HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINED3DQUER
|
|||
|
||||
D3DCREATEOBJECTINSTANCE(object, Query)
|
||||
object->type = Type;
|
||||
object->extendedData = 0;
|
||||
/* 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)) {
|
||||
TRACE("(%p) Allocating data for an occlusion query\n", This);
|
||||
object->extendedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WineQueryOcclusionData));
|
||||
break;
|
||||
}
|
||||
case D3DQUERYTYPE_VCACHE:
|
||||
case D3DQUERYTYPE_RESOURCEMANAGER:
|
||||
case D3DQUERYTYPE_VERTEXSTATS:
|
||||
case D3DQUERYTYPE_EVENT:
|
||||
case D3DQUERYTYPE_TIMESTAMP:
|
||||
case D3DQUERYTYPE_TIMESTAMPDISJOINT:
|
||||
case D3DQUERYTYPE_TIMESTAMPFREQ:
|
||||
case D3DQUERYTYPE_PIPELINETIMINGS:
|
||||
case D3DQUERYTYPE_INTERFACETIMINGS:
|
||||
case D3DQUERYTYPE_VERTEXTIMINGS:
|
||||
case D3DQUERYTYPE_PIXELTIMINGS:
|
||||
case D3DQUERYTYPE_BANDWIDTHTIMINGS:
|
||||
case D3DQUERYTYPE_CACHEUTILIZATION:
|
||||
default:
|
||||
object->extendedData = 0;
|
||||
FIXME("(%p) Unhandled query type %d\n",This , Type);
|
||||
}
|
||||
TRACE("(%p) : Created Query %p\n", This, object);
|
||||
return D3D_OK;
|
||||
}
|
||||
|
|
|
@ -470,6 +470,9 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
|
|||
} else if (strcmp(ThisExtn, "GL_ARB_vertex_buffer_object") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: ARB Vertex Buffer support\n");
|
||||
gl_info->supported[ARB_VERTEX_BUFFER_OBJECT] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_ARB_occlusion_query") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: ARB Occlusion Query support\n");
|
||||
gl_info->supported[ARB_OCCLUSION_QUERY] = TRUE;
|
||||
/**
|
||||
* EXT
|
||||
*/
|
||||
|
@ -545,6 +548,9 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info, Display* display)
|
|||
} else if (strcmp(ThisExtn, "GL_NV_texture_shader3") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Texture Shader (3) support\n");
|
||||
gl_info->supported[NV_TEXTURE_SHADER3] = TRUE;
|
||||
} else if (strcmp(ThisExtn, "GL_NV_occlusion_query") == 0) {
|
||||
TRACE_(d3d_caps)(" FOUND: NVIDIA (NV) Occlusion Query (3) support\n");
|
||||
gl_info->supported[NV_OCCLUSION_QUERY] = TRUE;
|
||||
} else if (strstr(ThisExtn, "GL_NV_vertex_program")) {
|
||||
gl_info->vs_nv_version = max(gl_info->vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program1_1")) ? VS_VERSION_11 : VS_VERSION_10);
|
||||
gl_info->vs_nv_version = max(gl_info->vs_nv_version, (0 == strcmp(ThisExtn, "GL_NV_vertex_program2")) ? VS_VERSION_20 : VS_VERSION_10);
|
||||
|
|
|
@ -971,6 +971,7 @@ typedef struct IWineD3DQueryImpl
|
|||
/* IWineD3DQuery fields */
|
||||
|
||||
D3DQUERYTYPE type;
|
||||
/* TODO: Think about using a IUnknown instead of a void* */
|
||||
void *extendedData;
|
||||
|
||||
|
||||
|
@ -978,6 +979,12 @@ typedef struct IWineD3DQueryImpl
|
|||
|
||||
extern const IWineD3DQueryVtbl IWineD3DQuery_Vtbl;
|
||||
|
||||
/* Datastructures for IWineD3DQueryImpl.extendedData */
|
||||
typedef struct WineQueryOcclusionData {
|
||||
unsigned int queryId;
|
||||
} WineQueryOcclusionData;
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* IWineD3DSwapChainImpl implementation structure (extends IUnknown)
|
||||
*/
|
||||
|
|
|
@ -666,6 +666,54 @@ typedef void (APIENTRY * PGLFNGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage,
|
|||
#define GL_COORD_REPLACE_ARB 0x8862
|
||||
#endif
|
||||
|
||||
/* TODO: GL_NV_point_sprite */
|
||||
|
||||
/* Occlusion Queries */
|
||||
|
||||
typedef void (APIENTRY * PGLFNGENQUERIESARBPROC) (GLsizei n, GLuint *queries);
|
||||
typedef void (APIENTRY * PGLFNDELETEQUERIESARBPROC) (GLsizei n, const GLuint *queries);
|
||||
typedef GLboolean (APIENTRY * PGLFNISQUERYARBPROC) (GLuint query);
|
||||
typedef void (APIENTRY * PGLFNBEGINQUERYARBPROC) (GLenum target, GLuint query);
|
||||
typedef void (APIENTRY * PGLFNENDQUERYARBPROC) (GLenum target);
|
||||
typedef void (APIENTRY * PGLFNGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * PGLFNGETQUERYOBJECTIVARBPROC) (GLuint query, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * PGLFNGETQUERYOBJECTUIVARBPROC) (GLuint query, GLenum pname, GLuint *params);
|
||||
|
||||
#ifndef GL_ARB_occlusion_query
|
||||
#define GL_ARB_occlusion_query 1
|
||||
|
||||
#define GL_SAMPLES_PASSED_ARB 0x8914
|
||||
#define GL_QUERY_COUNTER_BITS_ARB 0x8864
|
||||
#define GL_CURRENT_QUERY_ARB 0x8865
|
||||
#define GL_QUERY_RESULT_ARB 0x8866
|
||||
#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
|
||||
#endif
|
||||
|
||||
typedef void (APIENTRY * PGLFNGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);
|
||||
typedef void (APIENTRY * PGLFNDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);
|
||||
typedef GLboolean (APIENTRY * PGLFNISOCCLUSIONQUERYNVPROC) (GLuint id);
|
||||
typedef void (APIENTRY * PGLFNBEGINOCCLUSIONQUERYNVPROC) (GLuint id);
|
||||
typedef void (APIENTRY * PGLFNENDOCCLUSIONQUERYNVPROC) (void);
|
||||
typedef void (APIENTRY * PGLFNGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params);
|
||||
typedef void (APIENTRY * PGLFNGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params);
|
||||
|
||||
/* GL_HP_occlusion_test isn't complete, but it's constants are used by GL_NV_occlusion_query */
|
||||
#ifndef GL_HP_occlusion_test
|
||||
#define GL_HP_occlusion_test 1
|
||||
#define GL_OCCLUSION_TEST_HP 0x8165
|
||||
#define GL_OCCLUSION_TEST_RESULT_HP 0x8165
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef GL_NV_occlusion_query
|
||||
#define GL_NV_occlusion_query 1
|
||||
#define GL_PIXEL_COUNTER_BITS_NV 0x8864
|
||||
#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865
|
||||
#define GL_PIXEL_COUNT_NV 0x8866
|
||||
#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/****************************************************
|
||||
* OpenGL Official Version
|
||||
|
@ -762,6 +810,7 @@ typedef enum _GL_SupportedExt {
|
|||
ARB_FRAGMENT_PROGRAM,
|
||||
ARB_MULTISAMPLE,
|
||||
ARB_MULTITEXTURE,
|
||||
ARB_OCCLUSION_QUERY,
|
||||
ARB_POINT_PARAMETERS,
|
||||
ARB_POINT_SPRITE,
|
||||
ARB_TEXTURE_COMPRESSION,
|
||||
|
@ -792,6 +841,7 @@ typedef enum _GL_SupportedExt {
|
|||
/* NVIDIA */
|
||||
NV_FOG_DISTANCE,
|
||||
NV_FRAGMENT_PROGRAM,
|
||||
NV_OCCLUSION_QUERY,
|
||||
NV_REGISTER_COMBINERS,
|
||||
NV_REGISTER_COMBINERS2,
|
||||
NV_TEXGEN_REFLECTION,
|
||||
|
|
Loading…
Reference in New Issue