Commit 5aeb834d authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3dx9: Allow implicit conversions in D3DXCreateTextureFromFileInMemoryEx.

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.
parent 807c0172
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment