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

Adam Martinson amartinson at codeweavers.com
Tue May 17 13:42:26 CDT 2011


---
 dlls/wined3d/query.c     |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 include/wine/wined3d.idl |    2 ++
 2 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index b853ed7..88531e8 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -582,6 +582,23 @@ 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 *data, DWORD size, DWORD flags)
+{
+    UINT64 *freq = data;
+
+    TRACE("(%p) : type D3DQUERY_TIMESTAMPFREQ, data %p, size %#x, flags %#x.\n", query, data, size, flags);
+
+    if (query->state != QUERY_SIGNALLED)
+        return S_FALSE;
+
+    if (freq)
+        *freq = WINED3DQUERY_TIMESTAMP_FREQ;
+
+    return S_OK;
+}
+
 WINED3DQUERYTYPE CDECL wined3d_query_get_type(const struct wined3d_query *query)
 {
     TRACE("query %p.\n", query);
@@ -815,6 +832,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,
@@ -839,6 +867,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,
+};
+
 static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *device, WINED3DQUERYTYPE type)
 {
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
@@ -926,6 +960,18 @@ static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *de
             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:
diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl
index ddc9a59..d98d675 100644
--- a/include/wine/wined3d.idl
+++ b/include/wine/wined3d.idl
@@ -759,6 +759,8 @@ typedef enum _WINED3DQUERYTYPE
     WINED3DQUERYTYPE_CACHEUTILIZATION       = 18
 } WINED3DQUERYTYPE;
 
+const UINT64 WINED3DQUERY_TIMESTAMP_FREQ    = 1000000000; /* nanoseconds */
+
 const UINT WINED3DISSUE_BEGIN               = (1 << 1);
 const UINT WINED3DISSUE_END                 = (1 << 0);
 const UINT WINED3DGETDATA_FLUSH             = (1 << 0);
-- 
1.7.1


--------------060507020707010706000101--



More information about the wine-devel mailing list