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

Alexandre Julliard julliard at winehq.org
Thu Feb 27 17:15:10 CST 2020


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

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed Feb 26 16:39:25 2020 -0600

ddraw: 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/ddraw/ddraw_private.h |  1 +
 dlls/ddraw/device.c        | 13 ++++++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h
index 4ecd83d006..088092830c 100644
--- a/dlls/ddraw/ddraw_private.h
+++ b/dlls/ddraw/ddraw_private.h
@@ -68,6 +68,7 @@ struct FvfToDecl
         | WINED3D_LEGACY_CUBEMAP_FILTERING)
 
 #define DDRAW_MAX_ACTIVE_LIGHTS 32
+#define DDRAW_MAX_TEXTURES 8
 
 enum ddraw_device_state
 {
diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index e18c2c7853..575050acd2 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -2462,7 +2462,7 @@ static HRESULT WINAPI d3d_device3_GetRenderState(IDirect3DDevice3 *iface,
             *value = 0;
 
             wined3d_mutex_lock();
-            if ((tex = wined3d_device_get_texture(device->wined3d_device, 0)))
+            if ((tex = wined3d_stateblock_get_state(device->state)->textures[0]))
             {
                 /* The parent of the texture is the IDirectDrawSurface7
                  * interface of the ddraw surface. */
@@ -2699,7 +2699,7 @@ static void fixup_texture_alpha_op(struct d3d_device *device)
     if (!(device->legacyTextureBlending && device->texture_map_blend == D3DTBLEND_MODULATE))
         return;
 
-    if ((tex = wined3d_device_get_texture(device->wined3d_device, 0)))
+    if ((tex = wined3d_stateblock_get_state(device->state)->textures[0]))
     {
         struct wined3d_resource_desc desc;
 
@@ -4759,8 +4759,15 @@ static HRESULT d3d_device7_GetTexture(IDirect3DDevice7 *iface,
     if (!texture)
         return DDERR_INVALIDPARAMS;
 
+    if (stage >= DDRAW_MAX_TEXTURES)
+    {
+        WARN("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 = NULL;
         wined3d_mutex_unlock();




More information about the wine-cvs mailing list