[PATCH 3/5] d3dx9: Allow implicit conversions in D3DXCreateTextureFromFileInMemoryEx.

Matteo Bruni mbruni at codeweavers.com
Wed Aug 27 11:40:50 CDT 2014


They should be generally supported by the existing code.
Specific missing format conversions are caught and reported by
D3DXLoadSurfaceFromMemory(), which is called directly or indirectly
from here.

This should fix bug 30880 (with thanks to Józef Kucia for the debugging
effort).
---
 dlls/d3dx9_36/texture.c | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/dlls/d3dx9_36/texture.c b/dlls/d3dx9_36/texture.c
index 47c3c1d..7ebe264 100644
--- a/dlls/d3dx9_36/texture.c
+++ b/dlls/d3dx9_36/texture.c
@@ -546,8 +546,6 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi
     IDirect3DTexture9 **texptr;
     IDirect3DTexture9 *buftex;
     IDirect3DSurface9 *surface;
-    BOOL file_width = FALSE, file_height = FALSE;
-    BOOL file_format = FALSE, file_miplevels = FALSE;
     BOOL dynamic_texture;
     D3DXIMAGE_INFO imginfo;
     UINT loaded_miplevels, skip_levels;
@@ -590,25 +588,21 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi
 
     if (width == D3DX_FROM_FILE)
     {
-        file_width = TRUE;
         width = imginfo.Width;
     }
 
     if (height == D3DX_FROM_FILE)
     {
-        file_height = TRUE;
         height = imginfo.Height;
     }
 
     if (format == D3DFMT_FROM_FILE)
     {
-        file_format = TRUE;
         format = imginfo.Format;
     }
 
     if (miplevels == D3DX_FROM_FILE)
     {
-        file_miplevels = TRUE;
         miplevels = imginfo.MipLevels;
     }
 
@@ -648,14 +642,6 @@ HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *devi
         miplevels = 1;
     }
 
-    if (((file_width) && (width != imginfo.Width))    ||
-        ((file_height) && (height != imginfo.Height)) ||
-        ((file_format) && (format != imginfo.Format)) ||
-        ((file_miplevels) && (miplevels != imginfo.MipLevels)))
-    {
-        return D3DERR_NOTAVAILABLE;
-    }
-
     if (FAILED(IDirect3DDevice9_GetDeviceCaps(device, &caps)))
         return D3DERR_INVALIDCALL;
 
-- 
1.8.5.5




More information about the wine-patches mailing list