Zebediah Figura : d3d9: Retrieve sampler states from the primary stateblock.

Alexandre Julliard julliard at winehq.org
Thu Feb 13 15:36:31 CST 2020


Module: wine
Branch: master
Commit: 5898fcc6b7579053eaa146b480468f8b4d597b56
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=5898fcc6b7579053eaa146b480468f8b4d597b56

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Feb 12 09:21:51 2020 -0600

d3d9: Retrieve sampler states from the primary stateblock.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d9/device.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c
index 7a9e9400bb..4f1c602e1f 100644
--- a/dlls/d3d9/device.c
+++ b/dlls/d3d9/device.c
@@ -2661,14 +2661,26 @@ static HRESULT WINAPI d3d9_device_SetTextureStageState(IDirect3DDevice9Ex *iface
 }
 
 static HRESULT WINAPI d3d9_device_GetSamplerState(IDirect3DDevice9Ex *iface,
-        DWORD sampler, D3DSAMPLERSTATETYPE state, DWORD *value)
+        DWORD sampler_idx, D3DSAMPLERSTATETYPE state, DWORD *value)
 {
     struct d3d9_device *device = impl_from_IDirect3DDevice9Ex(iface);
+    const struct wined3d_stateblock_state *device_state;
+
+    TRACE("iface %p, sampler_idx %u, state %#x, value %p.\n", iface, sampler_idx, state, value);
 
-    TRACE("iface %p, sampler %u, state %#x, value %p.\n", iface, sampler, state, value);
+    if (sampler_idx >= WINED3DVERTEXTEXTURESAMPLER0 && sampler_idx <= WINED3DVERTEXTEXTURESAMPLER3)
+        sampler_idx -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
+
+    if (sampler_idx >= ARRAY_SIZE(device_state->sampler_states))
+    {
+        WARN("Invalid sampler %u.\n", sampler_idx);
+        *value = 0;
+        return D3D_OK;
+    }
 
     wined3d_mutex_lock();
-    *value = wined3d_device_get_sampler_state(device->wined3d_device, sampler, state);
+    device_state = wined3d_stateblock_get_state(device->state);
+    *value = device_state->sampler_states[sampler_idx][state];
     wined3d_mutex_unlock();
 
     return D3D_OK;




More information about the wine-cvs mailing list