[PATCH 10/12] wined3d/query: Add support for D3DQUERY_TIMESTAMPFREQ queries.

Adam Martinson amartinson at codeweavers.com
Wed May 4 13:02:15 CDT 2011


---
 dlls/wined3d/query.c |   51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 51 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index bea91f5..b1b522d 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -632,6 +632,28 @@ static HRESULT wined3d_timestampdisjoint_query_ops_get_data(struct wined3d_query
     return res;
 }
 
+/* Only called when GL_ARB_timer_query is supported. */
+static HRESULT wined3d_timestampfreq_query_ops_get_data(struct wined3d_query *query,
+                                                        void *pData, DWORD dwSize, DWORD flags)
+{
+    UINT64 *data = pData;
+
+    TRACE("(%p) : type D3DQUERY_TIMESTAMPFREQ, pData %p, dwSize %#x, flags %#x.\n", query, pData, dwSize, flags);
+
+    if (query->state != QUERY_SIGNALLED)
+        return S_FALSE;
+
+    if (dwSize != sizeof(UINT64))
+        data = NULL;
+
+    if (data)
+    {
+        *data = ARB_TIMER_QUERY_FREQ;
+    }
+
+    return S_OK;
+}
+
 WINED3DQUERYTYPE CDECL wined3d_query_get_type(const struct wined3d_query *query)
 {
     TRACE("query %p.\n", query);
@@ -865,6 +887,17 @@ static HRESULT wined3d_timestampdisjoint_query_ops_issue(struct wined3d_query *q
     return WINED3D_OK; /* can be WINED3DERR_INVALIDCALL.    */
 }
 
+/* Only called when GL_ARB_timer_query is supported. */
+static HRESULT wined3d_timestampfreq_query_ops_issue(struct wined3d_query *query, DWORD flags)
+{
+    TRACE("query %p, flags %#x.\n", query, flags);
+
+    /* MSDN: WINED3DISSUE_BEGIN not supported */
+
+    query->state = QUERY_SIGNALLED;
+    return WINED3D_OK;
+}
+
 static const struct wined3d_query_ops event_query_ops =
 {
     wined3d_event_query_ops_get_data,
@@ -889,6 +922,12 @@ static const struct wined3d_query_ops timestampdisjoint_query_ops =
     wined3d_timestampdisjoint_query_ops_issue,
 };
 
+static const struct wined3d_query_ops timestampfreq_query_ops =
+{
+    wined3d_timestampfreq_query_ops_get_data,
+    wined3d_timestampfreq_query_ops_issue,
+};
+
 HRESULT query_init(struct wined3d_query *query, IWineD3DDeviceImpl *device, WINED3DQUERYTYPE type)
 {
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -976,6 +1015,18 @@ HRESULT query_init(struct wined3d_query *query, IWineD3DDeviceImpl *device, WINE
             break;
 
         case WINED3DQUERYTYPE_TIMESTAMPFREQ:
+            TRACE("Timestamp Freqency query.\n");
+            if (!gl_info->supported[ARB_TIMER_QUERY])
+            {
+                WARN("GL_ARB_timer_query not supported, returning WINED3DERR_NOTAVAILABLE.\n");
+                return WINED3DERR_NOTAVAILABLE;
+            }
+
+            query->data_size = sizeof(UINT64);
+            query->query_ops = &timestampfreq_query_ops;
+            query->extendedData = NULL;
+            break;
+
         case WINED3DQUERYTYPE_VCACHE:
         case WINED3DQUERYTYPE_RESOURCEMANAGER:
         case WINED3DQUERYTYPE_VERTEXSTATS:
-- 
1.7.1


--------------020407030507000107030307--



More information about the wine-devel mailing list