Henri Verbeet : d3d10core: Implement d3d10_device_GSGetSamplers().

Alexandre Julliard julliard at winehq.org
Fri Dec 7 11:06:43 CST 2012


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Fri Dec  7 00:07:08 2012 +0100

d3d10core: Implement d3d10_device_GSGetSamplers().

---

 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 0aa5f47..138f3e4 100644
--- a/dlls/d3d10core/device.c
+++ b/dlls/d3d10core/device.c
@@ -822,8 +822,27 @@ static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device *if
 static void STDMETHODCALLTYPE d3d10_device_GSGetSamplers(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_gs_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_OMGetRenderTargets(ID3D10Device *iface,
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index ed243cc..f9cd280 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3288,6 +3288,19 @@ void CDECL wined3d_device_set_gs_sampler(struct wined3d_device *device, UINT idx
         wined3d_sampler_decref(prev);
 }
 
+struct wined3d_sampler * CDECL wined3d_device_get_gs_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.gs_sampler[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 1ac4bf5..8c58563 100644
--- a/dlls/wined3d/wined3d.spec
+++ b/dlls/wined3d/wined3d.spec
@@ -67,6 +67,7 @@
 @ 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_gs_sampler(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 eb48ceb..0e955ce 100644
--- a/include/wine/wined3d.h
+++ b/include/wine/wined3d.h
@@ -2129,6 +2129,7 @@ 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_sampler * __cdecl wined3d_device_get_gs_sampler(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