Henri Verbeet : d3d10core: Implement d3d10_device_GetPredication().

Alexandre Julliard julliard at wine.codeweavers.com
Fri Sep 19 13:18:31 CDT 2014


Module: wine
Branch: master
Commit: a3daed9604fe80836eba2de8b453002eec7b0aab
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a3daed9604fe80836eba2de8b453002eec7b0aab

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Sep 19 10:41:47 2014 +0200

d3d10core: Implement d3d10_device_GetPredication().

---

 dlls/d3d10core/async.c         |  2 +-
 dlls/d3d10core/device.c        | 16 +++++++++++++++-
 dlls/d3d9/query.c              |  2 +-
 dlls/wined3d/device.c          |  8 ++++++++
 dlls/wined3d/query.c           | 17 +++++++++++++----
 dlls/wined3d/wined3d.spec      |  4 +++-
 dlls/wined3d/wined3d_private.h |  2 ++
 include/wine/wined3d.h         |  4 +++-
 8 files changed, 46 insertions(+), 9 deletions(-)

diff --git a/dlls/d3d10core/async.c b/dlls/d3d10core/async.c
index 058b7bc..830b2b4 100644
--- a/dlls/d3d10core/async.c
+++ b/dlls/d3d10core/async.c
@@ -209,7 +209,7 @@ HRESULT d3d10_query_init(struct d3d10_query *query, struct d3d10_device *device,
     query->refcount = 1;
 
     if (FAILED(hr = wined3d_query_create(device->wined3d_device,
-            query_type_map[desc->Query], &query->wined3d_query)))
+            query_type_map[desc->Query], query, &query->wined3d_query)))
     {
         WARN("Failed to create wined3d query, hr %#x.\n", hr);
         return hr;
diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index 7dc6543..aac53dd 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -980,7 +980,21 @@ static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device1 *iface,
 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device1 *iface,
         ID3D10Predicate **predicate, BOOL *value)
 {
-    FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
+    struct d3d10_device *device = impl_from_ID3D10Device(iface);
+    struct wined3d_query *wined3d_predicate;
+    struct d3d10_query *predicate_impl;
+
+    TRACE("iface %p, predicate %p, value %p.\n", iface, predicate, value);
+
+    if (!(wined3d_predicate = wined3d_device_get_predication(device->wined3d_device, value)))
+    {
+        *predicate = NULL;
+        return;
+    }
+
+    predicate_impl = wined3d_query_get_parent(wined3d_predicate);
+    *predicate = (ID3D10Predicate *)&predicate_impl->ID3D10Query_iface;
+    ID3D10Predicate_AddRef(*predicate);
 }
 
 static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device1 *iface,
diff --git a/dlls/d3d9/query.c b/dlls/d3d9/query.c
index 6af89f6..42b476c 100644
--- a/dlls/d3d9/query.c
+++ b/dlls/d3d9/query.c
@@ -189,7 +189,7 @@ HRESULT query_init(struct d3d9_query *query, struct d3d9_device *device, D3DQUER
     query->refcount = 1;
 
     wined3d_mutex_lock();
-    hr = wined3d_query_create(device->wined3d_device, type, &query->wined3d_query);
+    hr = wined3d_query_create(device->wined3d_device, type, query, &query->wined3d_query);
     wined3d_mutex_unlock();
     if (FAILED(hr))
     {
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index cfe3b4c..a214442 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3354,6 +3354,14 @@ void CDECL wined3d_device_set_predication(struct wined3d_device *device,
         wined3d_query_decref(prev);
 }
 
+struct wined3d_query * CDECL wined3d_device_get_predication(struct wined3d_device *device, BOOL *value)
+{
+    TRACE("device %p, value %p.\n", device, value);
+
+    *value = device->state.predicate_value;
+    return device->state.predicate;
+}
+
 void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
         enum wined3d_primitive_type primitive_type)
 {
diff --git a/dlls/wined3d/query.c b/dlls/wined3d/query.c
index b01e124..e755764 100644
--- a/dlls/wined3d/query.c
+++ b/dlls/wined3d/query.c
@@ -421,6 +421,13 @@ static HRESULT wined3d_event_query_ops_get_data(struct wined3d_query *query,
     return S_OK;
 }
 
+void * CDECL wined3d_query_get_parent(const struct wined3d_query *query)
+{
+    TRACE("query %p.\n", query);
+
+    return query->parent;
+}
+
 enum wined3d_query_type CDECL wined3d_query_get_type(const struct wined3d_query *query)
 {
     TRACE("query %p.\n", query);
@@ -698,10 +705,13 @@ static const struct wined3d_query_ops timestamp_disjoint_query_ops =
     wined3d_timestamp_disjoint_query_ops_issue,
 };
 
-static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *device, enum wined3d_query_type type)
+static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *device,
+        enum wined3d_query_type type, void *parent)
 {
     const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
 
+    query->parent = parent;
+
     switch (type)
     {
         case WINED3D_QUERY_TYPE_OCCLUSION:
@@ -797,7 +807,7 @@ static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *de
 }
 
 HRESULT CDECL wined3d_query_create(struct wined3d_device *device,
-        enum wined3d_query_type type, struct wined3d_query **query)
+        enum wined3d_query_type type, void *parent, struct wined3d_query **query)
 {
     struct wined3d_query *object;
     HRESULT hr;
@@ -808,8 +818,7 @@ HRESULT CDECL wined3d_query_create(struct wined3d_device *device,
     if (!object)
         return E_OUTOFMEMORY;
 
-    hr = query_init(object, device, type);
-    if (FAILED(hr))
+    if (FAILED(hr = query_init(object, device, type, parent)))
     {
         WARN("Failed to initialize query, hr %#x.\n", hr);
         HeapFree(GetProcessHeap(), 0, object);
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index e0f9ebc..615a85d 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -67,6 +67,7 @@
 @ cdecl wined3d_device_get_material(ptr ptr)
 @ cdecl wined3d_device_get_npatch_mode(ptr)
 @ cdecl wined3d_device_get_pixel_shader(ptr)
+@ cdecl wined3d_device_get_predication(ptr ptr)
 @ cdecl wined3d_device_get_primitive_type(ptr ptr)
 @ cdecl wined3d_device_get_ps_cb(ptr long)
 @ cdecl wined3d_device_get_ps_consts_b(ptr long ptr long)
@@ -169,10 +170,11 @@
 @ cdecl wined3d_palette_incref(ptr)
 @ cdecl wined3d_palette_set_entries(ptr long long long ptr)
 
-@ cdecl wined3d_query_create(ptr long ptr)
+@ cdecl wined3d_query_create(ptr long ptr ptr)
 @ cdecl wined3d_query_decref(ptr)
 @ cdecl wined3d_query_get_data(ptr ptr long long)
 @ cdecl wined3d_query_get_data_size(ptr)
+@ cdecl wined3d_query_get_parent(ptr)
 @ cdecl wined3d_query_get_type(ptr)
 @ cdecl wined3d_query_incref(ptr)
 @ cdecl wined3d_query_issue(ptr long)
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 330fadd..30a3321 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2559,6 +2559,8 @@ struct wined3d_query_ops
 struct wined3d_query
 {
     LONG ref;
+
+    void *parent;
     const struct wined3d_query_ops *query_ops;
     struct wined3d_device *device;
     enum query_state         state;
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 01f8e2a..bd41106 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2145,6 +2145,7 @@ HRESULT __cdecl wined3d_device_get_light_enable(const struct wined3d_device *dev
 void __cdecl wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material);
 float __cdecl wined3d_device_get_npatch_mode(const struct wined3d_device *device);
 struct wined3d_shader * __cdecl wined3d_device_get_pixel_shader(const struct wined3d_device *device);
+struct wined3d_query * __cdecl wined3d_device_get_predication(struct wined3d_device *device, BOOL *value);
 void __cdecl wined3d_device_get_primitive_type(const struct wined3d_device *device,
         enum wined3d_primitive_type *primitive_topology);
 struct wined3d_buffer * __cdecl wined3d_device_get_ps_cb(const struct wined3d_device *device, UINT idx);
@@ -2304,10 +2305,11 @@ HRESULT __cdecl wined3d_palette_set_entries(struct wined3d_palette *palette,
         DWORD flags, DWORD start, DWORD count, const PALETTEENTRY *entries);
 
 HRESULT __cdecl wined3d_query_create(struct wined3d_device *device,
-        enum wined3d_query_type type, struct wined3d_query **query);
+        enum wined3d_query_type type, void *parent, struct wined3d_query **query);
 ULONG __cdecl wined3d_query_decref(struct wined3d_query *query);
 HRESULT __cdecl wined3d_query_get_data(struct wined3d_query *query, void *data, UINT data_size, DWORD flags);
 UINT __cdecl wined3d_query_get_data_size(const struct wined3d_query *query);
+void * __cdecl wined3d_query_get_parent(const struct wined3d_query *query);
 enum wined3d_query_type __cdecl wined3d_query_get_type(const struct wined3d_query *query);
 ULONG __cdecl wined3d_query_incref(struct wined3d_query *query);
 HRESULT __cdecl wined3d_query_issue(struct wined3d_query *query, DWORD flags);




More information about the wine-cvs mailing list