Henri Verbeet : d3d10core: Implement d3d10_device_VSGetSamplers().

Alexandre Julliard julliard at winehq.org
Thu Dec 6 16:25:09 CST 2012


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Wed Dec  5 21:01:48 2012 +0100

d3d10core: Implement d3d10_device_VSGetSamplers().

---

 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 1a75ee5..ad07aee 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -772,8 +772,27 @@ static void STDMETHODCALLTYPE d3d10_device_VSGetShaderResources(ID3D10Device *if
 static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device *iface,
         UINT start_slot, UINT sampler_count, ID3D10SamplerState **samplers)
 {
-    FIXME("iface %p, start_slot %u, sampler_count %u, samplers %p stub!\n",
+    struct d3d10_device *device = impl_from_ID3D10Device(iface);
+    unsigned int i;
+
+    TRACE("iface %p, start_slot %u, sampler_count %u, samplers %p.\n",
             iface, start_slot, sampler_count, samplers);
+
+    for (i = 0; i < sampler_count; ++i)
+    {
+        struct d3d10_sampler_state *sampler_impl;
+        struct wined3d_sampler *wined3d_sampler;
+
+        if (!(wined3d_sampler = wined3d_device_get_vs_sampler(device->wined3d_device, start_slot + i)))
+        {
+            samplers[i] = NULL;
+            continue;
+        }
+
+        sampler_impl = wined3d_sampler_get_parent(wined3d_sampler);
+        samplers[i] = &sampler_impl->ID3D10SamplerState_iface;
+        ID3D10SamplerState_AddRef(samplers[i]);
+    }
 }
 
 static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device *iface,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d0c3638..24c6b4e 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -2605,6 +2605,19 @@ void CDECL wined3d_device_set_vs_sampler(struct wined3d_device *device, UINT idx
         wined3d_sampler_decref(prev);
 }
 
+struct wined3d_sampler * CDECL wined3d_device_get_vs_sampler(const struct wined3d_device *device, UINT idx)
+{
+    TRACE("device %p, idx %u.\n", device, idx);
+
+    if (idx >= MAX_SAMPLER_OBJECTS)
+    {
+        WARN("Invalid sampler index %u.\n", idx);
+        return NULL;
+    }
+
+    return device->stateBlock->state.vs_sampler[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 29d6740..0b87f10 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -100,6 +100,7 @@
 @ 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)
+@ cdecl wined3d_device_get_vs_sampler(ptr long)
 @ cdecl wined3d_device_incref(ptr)
 @ cdecl wined3d_device_init_3d(ptr ptr)
 @ cdecl wined3d_device_init_gdi(ptr ptr)
diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h
index 90fb8de..cc60893 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2180,6 +2180,7 @@ HRESULT __cdecl wined3d_device_get_vs_consts_f(const struct wined3d_device *devi
         UINT start_register, float *constants, UINT vector4f_count);
 HRESULT __cdecl wined3d_device_get_vs_consts_i(const struct wined3d_device *device,
         UINT start_register, int *constants, UINT vector4i_count);
+struct wined3d_sampler * __cdecl wined3d_device_get_vs_sampler(const struct wined3d_device *device, UINT idx);
 ULONG __cdecl wined3d_device_incref(struct wined3d_device *device);
 HRESULT __cdecl wined3d_device_init_3d(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc);
 HRESULT __cdecl wined3d_device_init_gdi(struct wined3d_device *device, struct wined3d_swapchain_desc *swapchain_desc);




More information about the wine-cvs mailing list