Re: [5/8] d3dx9: Add DDS support in D3DXCreateTextureFromFile functions.
2012/5/9 Józef Kucia joseph.ku...@gmail.com: --- +HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, UINT srd_data_size, + const PALETTEENTRY *palette, DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN; ... +HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, UINT srd_data_size, + const PALETTEENTRY *palette, DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) I guess that was meant to be called src_data_size. More to the point, anyway, you're not using that value right now, you should probably add a check against it or remove the parameter altogether.
Re: [5/8] d3dx9: Add DDS support in D3DXCreateTextureFromFile functions.
On Thu, May 10, 2012 at 4:29 PM, Matteo Bruni matteo.myst...@gmail.com wrote: 2012/5/9 Józef Kucia joseph.ku...@gmail.com: --- +HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, UINT srd_data_size, + const PALETTEENTRY *palette, DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN; ... +HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, UINT srd_data_size, + const PALETTEENTRY *palette, DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) I guess that was meant to be called src_data_size. More to the point, anyway, you're not using that value right now, you should probably add a check against it or remove the parameter altogether. It should be removed. The size of data is checked in D3DXGetImageInfoFromFileInMemory, and at this point it can be assumed that data is long enough.
Re: [5/8] d3dx9: Add DDS support in D3DXCreateTextureFromFile functions.
On Wed, May 9, 2012 at 11:32 PM, Józef Kucia joseph.ku...@gmail.com wrote: diff --git a/dlls/d3dx9_36/tests/surface.c b/dlls/d3dx9_36/tests/surface.c index ab56593..3d5a50f 100644 --- a/dlls/d3dx9_36/tests/surface.c +++ b/dlls/d3dx9_36/tests/surface.c @@ -917,6 +917,20 @@ static void test_D3DXCreateVolumeTexture(IDirect3DDevice9 *device) } } +static void test_D3DXCreateTextureFromFileInMemory(IDirect3DDevice9 *device) +{ + HRESULT hr; + IDirect3DTexture9 *texture; + + hr = D3DXCreateTextureFromFileInMemory(device, dds_16bit, sizeof(dds_16bit), texture); + ok(hr == D3D_OK, D3DCreateTextureFromFileInMemory returned %#x, expected %#x\n, hr, D3D_OK); + if (SUCCEEDED(hr)) IDirect3DTexture9_Release(texture); + + hr = D3DXCreateTextureFromFileInMemory(device, dds_24bit, sizeof(dds_24bit), texture); + ok(hr == D3D_OK, D3DXCreateTextureFromFileInMemory returned %#x, expected %#x\n, hr, D3D_OK); + if (SUCCEEDED(hr)) IDirect3DTexture9_Release(texture); +} + I noticed that I put more and more texture functions tests in tests/surface.c, because these tests needs the dds files which are in tests/surface.c. I wonder if it would be better to copy needed dds files to tests/texture.c and move texture function tests to their proper place. I think the dds files could be used to tests other texture functions, e.g. D3DXCreateTextureFromFileInMemoryEx doesn't seem to have any tests.
Re: [5/8] d3dx9: Add DDS support in D3DXCreateTextureFromFile functions.
2012/5/10 Józef Kucia joseph.ku...@gmail.com: I noticed that I put more and more texture functions tests in tests/surface.c, because these tests needs the dds files which are in tests/surface.c. I wonder if it would be better to copy needed dds files to tests/texture.c and move texture function tests to their proper place. I think the dds files could be used to tests other texture functions, e.g. D3DXCreateTextureFromFileInMemoryEx doesn't seem to have any tests. I think that's a good idea, yes.