[PATCH 5/5] d3d10core: Implement d3d10_device_VSGetConstantBuffers().

Henri Verbeet hverbeet at codeweavers.com
Thu Nov 29 15:44:46 CST 2012


---
 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 6c25e7b..25439b0 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -500,8 +500,27 @@ static void STDMETHODCALLTYPE d3d10_device_ResolveSubresource(ID3D10Device *ifac
 static void STDMETHODCALLTYPE d3d10_device_VSGetConstantBuffers(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_vs_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_PSGetShaderResources(ID3D10Device *iface,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 1aecff8..57e1de9 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2571,6 +2571,19 @@ void CDECL wined3d_device_set_vs_cb(struct wined3d_device *device, UINT idx, str
     }
 }
 
+struct wined3d_buffer * CDECL wined3d_device_get_vs_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.vs_cb[idx];
+}
+
 HRESULT CDECL wined3d_device_set_vs_consts_b(struct wined3d_device *device,
         UINT start_register, const BOOL *constants, UINT bool_count)
 {
diff --git a/dlls/wined3d/wined3d.spec b/dlls/wined3d/wined3d.spec
index 66dc056..b7b04df 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -94,6 +94,7 @@
 @ cdecl wined3d_device_get_vertex_declaration(ptr)
 @ cdecl wined3d_device_get_vertex_shader(ptr)
 @ cdecl wined3d_device_get_viewport(ptr ptr)
+@ cdecl wined3d_device_get_vs_cb(ptr long)
 @ cdecl wined3d_device_get_vs_consts_b(ptr long ptr long)
 @ cdecl wined3d_device_get_vs_consts_f(ptr long ptr long)
 @ cdecl wined3d_device_get_vs_consts_i(ptr long ptr long)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 9506f81..7b1e043 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2170,6 +2170,7 @@ void __cdecl wined3d_device_get_transform(const struct wined3d_device *device,
 struct wined3d_vertex_declaration * __cdecl wined3d_device_get_vertex_declaration(const struct wined3d_device *device);
 struct wined3d_shader * __cdecl wined3d_device_get_vertex_shader(const struct wined3d_device *device);
 void __cdecl wined3d_device_get_viewport(const struct wined3d_device *device, struct wined3d_viewport *viewport);
+struct wined3d_buffer * __cdecl wined3d_device_get_vs_cb(const struct wined3d_device *device, UINT idx);
 HRESULT __cdecl wined3d_device_get_vs_consts_b(const struct wined3d_device *device,
         UINT start_register, BOOL *constants, UINT bool_count);
 HRESULT __cdecl wined3d_device_get_vs_consts_f(const struct wined3d_device *device,
-- 
1.7.8.6




More information about the wine-patches mailing list