Henri Verbeet : d3d10core: Implement d3d10_device_GSGetConstantBuffers().

Alexandre Julliard julliard at winehq.org
Tue Dec 4 13:48:53 CST 2012


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Dec  3 21:16:34 2012 +0100

d3d10core: Implement d3d10_device_GSGetConstantBuffers().

---

 dlls/d3d10core/device.c   |   21 ++++++++++++++++++++-
 dlls/wined3d/device.c     |   13 +++++++++++++
 dlls/wined3d/wined3d.spec |    1 +
 include/wine/wined3d.h    |    1 +
 4 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/dlls/d3d10core/device.c b/dlls/d3d10core/device.c
index fbebf9e..438beb0 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -669,8 +669,27 @@ static void STDMETHODCALLTYPE d3d10_device_IAGetIndexBuffer(ID3D10Device *iface,
 static void STDMETHODCALLTYPE d3d10_device_GSGetConstantBuffers(ID3D10Device *iface,
         UINT start_slot, UINT buffer_count, ID3D10Buffer **buffers)
 {
-    FIXME("iface %p, start_slot %u, buffer_count %u, buffers %p stub!\n",
+    struct d3d10_device *device = impl_from_ID3D10Device(iface);
+    unsigned int i;
+
+    TRACE("iface %p, start_slot %u, buffer_count %u, buffers %p.\n",
             iface, start_slot, buffer_count, buffers);
+
+    for (i = 0; i < buffer_count; ++i)
+    {
+        struct wined3d_buffer *wined3d_buffer;
+        struct d3d10_buffer *buffer_impl;
+
+        if (!(wined3d_buffer = wined3d_device_get_gs_cb(device->wined3d_device, start_slot + i)))
+        {
+            buffers[i] = NULL;
+            continue;
+        }
+
+        buffer_impl = wined3d_buffer_get_parent(wined3d_buffer);
+        buffers[i] = &buffer_impl->ID3D10Buffer_iface;
+        ID3D10Buffer_AddRef(buffers[i]);
+    }
 }
 
 static void STDMETHODCALLTYPE d3d10_device_GSGetShader(ID3D10Device *iface, ID3D10GeometryShader **shader)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 6ea2f85..c293636 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3168,6 +3168,19 @@ void CDECL wined3d_device_set_gs_cb(struct wined3d_device *device, UINT idx, str
     }
 }
 
+struct wined3d_buffer * CDECL wined3d_device_get_gs_cb(const struct wined3d_device *device, UINT idx)
+{
+    TRACE("device %p, idx %u.\n", device, idx);
+
+    if (idx >= MAX_CONSTANT_BUFFERS)
+    {
+        WARN("Invalid constant buffer index %u.\n", idx);
+        return NULL;
+    }
+
+    return device->stateBlock->state.gs_cb[idx];
+}
+
 /* Context activation is done by the caller. */
 /* Do not call while under the GL lock. */
 #define copy_and_next(dest, src, size) memcpy(dest, src, size); dest += (size)
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index d08c33f..c97e7af 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -66,6 +66,7 @@
 @ cdecl wined3d_device_get_front_buffer_data(ptr long ptr)
 @ cdecl wined3d_device_get_gamma_ramp(ptr long ptr)
 @ cdecl wined3d_device_get_geometry_shader(ptr)
+@ cdecl wined3d_device_get_gs_cb(ptr long)
 @ cdecl wined3d_device_get_index_buffer(ptr ptr)
 @ cdecl wined3d_device_get_light(ptr long ptr)
 @ cdecl wined3d_device_get_light_enable(ptr long ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 206c8ef..82287df 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2127,6 +2127,7 @@ HRESULT __cdecl wined3d_device_get_front_buffer_data(const struct wined3d_device
 void __cdecl wined3d_device_get_gamma_ramp(const struct wined3d_device *device,
         UINT swapchain_idx, struct wined3d_gamma_ramp *ramp);
 struct wined3d_shader * __cdecl wined3d_device_get_geometry_shader(const struct wined3d_device *device);
+struct wined3d_buffer * __cdecl wined3d_device_get_gs_cb(const struct wined3d_device *device, UINT idx);
 struct wined3d_buffer * __cdecl wined3d_device_get_index_buffer(const struct wined3d_device *device,
         enum wined3d_format_id *format);
 HRESULT __cdecl wined3d_device_get_light(const struct wined3d_device *device,




More information about the wine-cvs mailing list