mirror of
https://github.com/reactos/wine.git
synced 2025-02-03 18:53:17 +00:00
wined3d: Support event queries using GL_NV_fence.
This commit is contained in:
parent
be8e9e17bc
commit
76b60b0516
@ -1075,10 +1075,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case WINED3DQUERYTYPE_EVENT:
|
case WINED3DQUERYTYPE_EVENT:
|
||||||
/* Half-Life 2 needs this query. It does not render the main menu correctly otherwise
|
if(!GL_SUPPORT(NV_FENCE)) {
|
||||||
* Pretend to support it, faking this query does not do much harm except potentially lowering performance
|
/* Half-Life 2 needs this query. It does not render the main menu correctly otherwise
|
||||||
*/
|
* Pretend to support it, faking this query does not do much harm except potentially lowering performance
|
||||||
FIXME("(%p) Event query: Unimplemented, but pretending to be supported\n", This);
|
*/
|
||||||
|
FIXME("(%p) Event query: Unimplemented, but pretending to be supported\n", This);
|
||||||
|
}
|
||||||
hr = WINED3D_OK;
|
hr = WINED3D_OK;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1112,10 +1114,18 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateQuery(IWineD3DDevice *iface, WINE
|
|||||||
GL_EXTCALL(glGenQueriesARB(1, &((WineQueryOcclusionData *)(object->extendedData))->queryId));
|
GL_EXTCALL(glGenQueriesARB(1, &((WineQueryOcclusionData *)(object->extendedData))->queryId));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case WINED3DQUERYTYPE_EVENT:
|
||||||
|
/* TODO: GL_APPLE_fence */
|
||||||
|
if(GL_SUPPORT(NV_FENCE)) {
|
||||||
|
object->extendedData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WineQueryEventData));
|
||||||
|
GL_EXTCALL(glGenFencesNV(1, &((WineQueryEventData *)(object->extendedData))->fenceId));
|
||||||
|
checkGLcall("glGenFencesNV");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case WINED3DQUERYTYPE_VCACHE:
|
case WINED3DQUERYTYPE_VCACHE:
|
||||||
case WINED3DQUERYTYPE_RESOURCEMANAGER:
|
case WINED3DQUERYTYPE_RESOURCEMANAGER:
|
||||||
case WINED3DQUERYTYPE_VERTEXSTATS:
|
case WINED3DQUERYTYPE_VERTEXSTATS:
|
||||||
case WINED3DQUERYTYPE_EVENT:
|
|
||||||
case WINED3DQUERYTYPE_TIMESTAMP:
|
case WINED3DQUERYTYPE_TIMESTAMP:
|
||||||
case WINED3DQUERYTYPE_TIMESTAMPDISJOINT:
|
case WINED3DQUERYTYPE_TIMESTAMPDISJOINT:
|
||||||
case WINED3DQUERYTYPE_TIMESTAMPFREQ:
|
case WINED3DQUERYTYPE_TIMESTAMPFREQ:
|
||||||
|
@ -65,6 +65,14 @@ static ULONG WINAPI IWineD3DQueryImpl_Release(IWineD3DQuery *iface) {
|
|||||||
TRACE("(%p) : Releasing from %d\n", This, This->ref);
|
TRACE("(%p) : Releasing from %d\n", This, This->ref);
|
||||||
ref = InterlockedDecrement(&This->ref);
|
ref = InterlockedDecrement(&This->ref);
|
||||||
if (ref == 0) {
|
if (ref == 0) {
|
||||||
|
if(This->type == WINED3DQUERYTYPE_EVENT && GL_SUPPORT(NV_FENCE)) {
|
||||||
|
GL_EXTCALL(glDeleteFencesNV(1, &((WineQueryEventData *)(This->extendedData))->fenceId));
|
||||||
|
checkGLcall("glDeleteFencesNV");
|
||||||
|
} else if(This->type == WINED3DQUERYTYPE_OCCLUSION && GL_SUPPORT(ARB_OCCLUSION_QUERY)) {
|
||||||
|
GL_EXTCALL(glDeleteQueriesARB(1, &((WineQueryOcclusionData *)(This->extendedData))->queryId));
|
||||||
|
checkGLcall("glDeleteQueriesARB");
|
||||||
|
}
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, This->extendedData);
|
HeapFree(GetProcessHeap(), 0, This->extendedData);
|
||||||
HeapFree(GetProcessHeap(), 0, This);
|
HeapFree(GetProcessHeap(), 0, This);
|
||||||
}
|
}
|
||||||
@ -154,8 +162,13 @@ static HRESULT WINAPI IWineD3DQueryImpl_GetData(IWineD3DQuery* iface, void* pDa
|
|||||||
case WINED3DQUERYTYPE_EVENT:
|
case WINED3DQUERYTYPE_EVENT:
|
||||||
{
|
{
|
||||||
BOOL* data = pData;
|
BOOL* data = pData;
|
||||||
FIXME("(%p): Unimplemented query WINED3DQUERYTYPE_EVENT\n", This);
|
if(GL_SUPPORT(NV_FENCE)) {
|
||||||
*data = TRUE; /*Don't know what this is supposed to be*/
|
*data = GL_EXTCALL(glTestFenceNV(((WineQueryEventData *)This->extendedData)->fenceId));
|
||||||
|
checkGLcall("glTestFenceNV");
|
||||||
|
} else {
|
||||||
|
WARN("(%p): reporting GPU idle\n", This);
|
||||||
|
*data = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WINED3DQUERYTYPE_OCCLUSION:
|
case WINED3DQUERYTYPE_OCCLUSION:
|
||||||
@ -367,6 +380,17 @@ static HRESULT WINAPI IWineD3DQueryImpl_Issue(IWineD3DQuery* iface, DWORD dwIs
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WINED3DQUERYTYPE_EVENT: {
|
||||||
|
if (GL_SUPPORT(GL_NV_fence)) {
|
||||||
|
if (dwIssueFlags & WINED3DISSUE_END) {
|
||||||
|
GL_EXTCALL(glSetFenceNV(((WineQueryEventData *)This->extendedData)->fenceId, GL_ALL_COMPLETED_NV));
|
||||||
|
} else if(dwIssueFlags & WINED3DISSUE_BEGIN) {
|
||||||
|
/* Started implicitly at device creation */
|
||||||
|
ERR("Event query issued with START flag - what to do?\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/* The fixme is printed when the app asks for the resulting data */
|
/* The fixme is printed when the app asks for the resulting data */
|
||||||
WARN("(%p) : Unhandled query type %#x\n", This, This->type);
|
WARN("(%p) : Unhandled query type %#x\n", This, This->type);
|
||||||
|
@ -1339,6 +1339,9 @@ typedef struct WineQueryOcclusionData {
|
|||||||
GLuint queryId;
|
GLuint queryId;
|
||||||
} WineQueryOcclusionData;
|
} WineQueryOcclusionData;
|
||||||
|
|
||||||
|
typedef struct WineQueryEventData {
|
||||||
|
GLuint fenceId;
|
||||||
|
} WineQueryEventData;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
* IWineD3DSwapChainImpl implementation structure (extends IUnknown)
|
* IWineD3DSwapChainImpl implementation structure (extends IUnknown)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user