Zebediah Figura : d3d8: Retrieve textures from the primary stateblock.

Alexandre Julliard julliard at winehq.org
Mon Feb 24 15:23:53 CST 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Fri Feb 21 17:04:47 2020 -0600

d3d8: Retrieve textures 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/d3d8/device.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index 19dc844ee2..481f4f3846 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2165,8 +2165,18 @@ static HRESULT WINAPI d3d8_device_GetTexture(IDirect3DDevice8 *iface, DWORD stag
     if (!texture)
         return D3DERR_INVALIDCALL;
 
+    if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3)
+        stage -= (WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS);
+
+    if (stage >= WINED3D_MAX_COMBINED_SAMPLERS)
+    {
+        WARN("Ignoring invalid stage %u.\n", stage);
+        *texture = NULL;
+        return D3D_OK;
+    }
+
     wined3d_mutex_lock();
-    if ((wined3d_texture = wined3d_device_get_texture(device->wined3d_device, stage)))
+    if ((wined3d_texture = wined3d_stateblock_get_state(device->state)->textures[stage]))
     {
         texture_impl = wined3d_texture_get_parent(wined3d_texture);
         *texture = &texture_impl->IDirect3DBaseTexture8_iface;




More information about the wine-cvs mailing list