ReactOS  0.4.15-dev-3163-gf17c2c0
d3dx9tex.h File Reference
#include <d3dx9.h>
Include dependency graph for d3dx9tex.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _D3DXIMAGE_INFO
 

Macros

#define D3DX_FILTER_NONE   0x00000001
 
#define D3DX_FILTER_POINT   0x00000002
 
#define D3DX_FILTER_LINEAR   0x00000003
 
#define D3DX_FILTER_TRIANGLE   0x00000004
 
#define D3DX_FILTER_BOX   0x00000005
 
#define D3DX_FILTER_MIRROR_U   0x00010000
 
#define D3DX_FILTER_MIRROR_V   0x00020000
 
#define D3DX_FILTER_MIRROR_W   0x00040000
 
#define D3DX_FILTER_MIRROR   0x00070000
 
#define D3DX_FILTER_DITHER   0x00080000
 
#define D3DX_FILTER_DITHER_DIFFUSION   0x00100000
 
#define D3DX_FILTER_SRGB_IN   0x00200000
 
#define D3DX_FILTER_SRGB_OUT   0x00400000
 
#define D3DX_FILTER_SRGB   0x00600000
 
#define D3DX_SKIP_DDS_MIP_LEVELS_MASK   0x1f
 
#define D3DX_SKIP_DDS_MIP_LEVELS_SHIFT   26
 
#define D3DX_SKIP_DDS_MIP_LEVELS(l, f)
 
#define D3DX_NORMALMAP_MIRROR_U   0x00010000
 
#define D3DX_NORMALMAP_MIRROR_V   0x00020000
 
#define D3DX_NORMALMAP_MIRROR   0x00030000
 
#define D3DX_NORMALMAP_INVERTSIGN   0x00080000
 
#define D3DX_NORMALMAP_COMPUTE_OCCLUSION   0x00100000
 
#define D3DX_CHANNEL_RED   0x00000001
 
#define D3DX_CHANNEL_BLUE   0x00000002
 
#define D3DX_CHANNEL_GREEN   0x00000004
 
#define D3DX_CHANNEL_ALPHA   0x00000008
 
#define D3DX_CHANNEL_LUMINANCE   0x00000010
 
#define D3DXGetImageInfoFromFile   WINELIB_NAME_AW(D3DXGetImageInfoFromFile)
 
#define D3DXGetImageInfoFromResource   WINELIB_NAME_AW(D3DXGetImageInfoFromResource)
 
#define D3DXLoadSurfaceFromFile   WINELIB_NAME_AW(D3DXLoadSurfaceFromFile)
 
#define D3DXLoadSurfaceFromResource   WINELIB_NAME_AW(D3DXLoadSurfaceFromResource)
 
#define D3DXSaveSurfaceToFile   WINELIB_NAME_AW(D3DXSaveSurfaceToFile)
 
#define D3DXLoadVolumeFromFile   WINELIB_NAME_AW(D3DXLoadVolumeFromFile)
 
#define D3DXLoadVolumeFromResource   WINELIB_NAME_AW(D3DXLoadVolumeFromResource)
 
#define D3DXSaveVolumeToFile   WINELIB_NAME_AW(D3DXSaveVolumeToFile)
 
#define D3DXCreateTextureFromFile   WINELIB_NAME_AW(D3DXCreateTextureFromFile)
 
#define D3DXCreateCubeTextureFromFile   WINELIB_NAME_AW(D3DXCreateCubeTextureFromFile)
 
#define D3DXCreateVolumeTextureFromFile   WINELIB_NAME_AW(D3DXCreateVolumeTextureFromFile)
 
#define D3DXCreateTextureFromResource   WINELIB_NAME_AW(D3DXCreateTextureFromResource)
 
#define D3DXCreateCubeTextureFromResource   WINELIB_NAME_AW(D3DXCreateCubeTextureFromResource)
 
#define D3DXCreateVolumeTextureFromResource   WINELIB_NAME_AW(D3DXCreateVolumeTextureFromResource)
 
#define D3DXCreateTextureFromFileEx   WINELIB_NAME_AW(D3DXCreateTextureFromFileEx)
 
#define D3DXCreateCubeTextureFromFileEx   WINELIB_NAME_AW(D3DXCreateCubeTextureFromFileEx)
 
#define D3DXCreateVolumeTextureFromFileEx   WINELIB_NAME_AW(D3DXCreateVolumeTextureFromFileEx)
 
#define D3DXCreateTextureFromResourceEx   WINELIB_NAME_AW(D3DXCreateTextureFromResourceEx)
 
#define D3DXCreateCubeTextureFromResourceEx   WINELIB_NAME_AW(D3DXCreateCubeTextureFromResourceEx)
 
#define D3DXCreateVolumeTextureFromResourceEx   WINELIB_NAME_AW(D3DXCreateVolumeTextureFromResourceEx)
 
#define D3DXSaveTextureToFile   WINELIB_NAME_AW(D3DXSaveTextureToFile)
 
#define D3DXFilterCubeTexture   D3DXFilterTexture
 
#define D3DXFilterVolumeTexture   D3DXFilterTexture
 

Typedefs

typedef enum _D3DXIMAGE_FILEFORMAT D3DXIMAGE_FILEFORMAT
 
typedef struct _D3DXIMAGE_INFO D3DXIMAGE_INFO
 
typedef void(WINAPILPD3DXFILL2D) (D3DXVECTOR4 *out, const D3DXVECTOR2 *texcoord, const D3DXVECTOR2 *texelsize, void *data)
 
typedef void(WINAPILPD3DXFILL3D) (D3DXVECTOR4 *out, const D3DXVECTOR3 *texcoord, const D3DXVECTOR3 *texelsize, void *data)
 

Enumerations

enum  _D3DXIMAGE_FILEFORMAT {
  D3DXIFF_BMP, D3DXIFF_JPG, D3DXIFF_TGA, D3DXIFF_PNG,
  D3DXIFF_DDS, D3DXIFF_PPM, D3DXIFF_DIB, D3DXIFF_HDR,
  D3DXIFF_PFM, D3DXIFF_FORCE_DWORD = 0x7fffffff
}
 

Functions

HRESULT WINAPI D3DXGetImageInfoFromFileA (const char *file, D3DXIMAGE_INFO *info)
 
HRESULT WINAPI D3DXGetImageInfoFromFileW (const WCHAR *file, D3DXIMAGE_INFO *info)
 
HRESULT WINAPI D3DXGetImageInfoFromResourceA (HMODULE module, const char *resource, D3DXIMAGE_INFO *info)
 
HRESULT WINAPI D3DXGetImageInfoFromResourceW (HMODULE module, const WCHAR *resource, D3DXIMAGE_INFO *info)
 
HRESULT WINAPI D3DXGetImageInfoFromFileInMemory (const void *data, UINT data_size, D3DXIMAGE_INFO *info)
 
HRESULT WINAPI D3DXLoadSurfaceFromFileA (struct IDirect3DSurface9 *destsurface, const PALETTEENTRY *destpalette, const RECT *destrect, const char *srcfile, const RECT *srcrect, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadSurfaceFromFileW (struct IDirect3DSurface9 *destsurface, const PALETTEENTRY *destpalette, const RECT *destrect, const WCHAR *srcfile, const RECT *srcrect, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadSurfaceFromResourceA (struct IDirect3DSurface9 *destsurface, const PALETTEENTRY *destpalette, const RECT *destrect, HMODULE srcmodule, const char *resource, const RECT *srcrect, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadSurfaceFromResourceW (struct IDirect3DSurface9 *destsurface, const PALETTEENTRY *destpalette, const RECT *destrect, HMODULE srcmodule, const WCHAR *resource, const RECT *srcrect, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory (struct IDirect3DSurface9 *destsurface, const PALETTEENTRY *destpalette, const RECT *destrect, const void *srcdata, UINT srcdatasize, const RECT *srcrect, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadSurfaceFromSurface (struct IDirect3DSurface9 *destsurface, const PALETTEENTRY *destpalette, const RECT *destrect, struct IDirect3DSurface9 *srcsurface, const PALETTEENTRY *srcpalette, const RECT *srcrect, DWORD filter, D3DCOLOR colorkey)
 
HRESULT WINAPI D3DXLoadSurfaceFromMemory (IDirect3DSurface9 *dst_surface, const PALETTEENTRY *dst_palette, const RECT *dst_rect, const void *src_memory, D3DFORMAT src_format, UINT src_pitch, const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3DCOLOR color_key)
 
HRESULT WINAPI D3DXSaveSurfaceToFileInMemory (struct ID3DXBuffer **destbuffer, D3DXIMAGE_FILEFORMAT destformat, struct IDirect3DSurface9 *srcsurface, const PALETTEENTRY *srcpalette, const RECT *srcrect)
 
HRESULT WINAPI D3DXSaveSurfaceToFileA (const char *destfile, D3DXIMAGE_FILEFORMAT destformat, struct IDirect3DSurface9 *srcsurface, const PALETTEENTRY *srcpalette, const RECT *srcrect)
 
HRESULT WINAPI D3DXSaveSurfaceToFileW (const WCHAR *destfile, D3DXIMAGE_FILEFORMAT destformat, struct IDirect3DSurface9 *srcsurface, const PALETTEENTRY *srcpalette, const RECT *srcrect)
 
HRESULT WINAPI D3DXLoadVolumeFromFileA (struct IDirect3DVolume9 *destvolume, const PALETTEENTRY *destpalette, const D3DBOX *destbox, const char *srcfile, const D3DBOX *srcbox, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadVolumeFromFileW (struct IDirect3DVolume9 *destvolume, const PALETTEENTRY *destpalette, const D3DBOX *destbox, const WCHAR *srcfile, const D3DBOX *srcbox, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadVolumeFromResourceA (struct IDirect3DVolume9 *destvolume, const PALETTEENTRY *destpalette, const D3DBOX *destbox, HMODULE srcmodule, const char *resource, const D3DBOX *srcbox, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadVolumeFromResourceW (struct IDirect3DVolume9 *destvolume, const PALETTEENTRY *destpalette, const D3DBOX *destbox, HMODULE srcmodule, const WCHAR *resource, const D3DBOX *srcbox, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadVolumeFromFileInMemory (struct IDirect3DVolume9 *destvolume, const PALETTEENTRY *destpalette, const D3DBOX *destbox, const void *srcdata, UINT srcdatasize, const D3DBOX *srcbox, DWORD filter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo)
 
HRESULT WINAPI D3DXLoadVolumeFromVolume (struct IDirect3DVolume9 *destvolume, const PALETTEENTRY *destpalette, const D3DBOX *destbox, struct IDirect3DVolume9 *srcvolume, const PALETTEENTRY *srcpalette, const D3DBOX *srcbox, DWORD filter, D3DCOLOR colorkey)
 
HRESULT WINAPI D3DXLoadVolumeFromMemory (struct IDirect3DVolume9 *destvolume, const PALETTEENTRY *destpalette, const D3DBOX *destbox, const void *srcmemory, D3DFORMAT srcformat, UINT srcrowpitch, UINT srcslicepitch, const PALETTEENTRY *srcpalette, const D3DBOX *srcbox, DWORD filter, D3DCOLOR colorkey)
 
HRESULT WINAPI D3DXSaveVolumeToFileA (const char *destfile, D3DXIMAGE_FILEFORMAT destformat, struct IDirect3DVolume9 *srcvolume, const PALETTEENTRY *srcpalette, const D3DBOX *srcbox)
 
HRESULT WINAPI D3DXSaveVolumeToFileW (const WCHAR *destfile, D3DXIMAGE_FILEFORMAT destformat, struct IDirect3DVolume9 *srcvolume, const PALETTEENTRY *srcpalette, const D3DBOX *srcbox)
 
HRESULT WINAPI D3DXCheckTextureRequirements (struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
 
HRESULT WINAPI D3DXCheckCubeTextureRequirements (struct IDirect3DDevice9 *device, UINT *size, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
 
HRESULT WINAPI D3DXCheckVolumeTextureRequirements (struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *depth, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
 
HRESULT WINAPI D3DXCreateTexture (struct IDirect3DDevice9 *device, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateCubeTexture (struct IDirect3DDevice9 *device, UINT size, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateVolumeTexture (struct IDirect3DDevice9 *device, UINT width, UINT height, UINT depth, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateTextureFromFileA (struct IDirect3DDevice9 *device, const char *srcfile, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateTextureFromFileW (struct IDirect3DDevice9 *device, const WCHAR *srcfile, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateCubeTextureFromFileA (struct IDirect3DDevice9 *device, const char *srcfile, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateCubeTextureFromFileW (struct IDirect3DDevice9 *device, const WCHAR *srcfile, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromFileA (struct IDirect3DDevice9 *device, const char *srcfile, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromFileW (struct IDirect3DDevice9 *device, const WCHAR *srcfile, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateTextureFromResourceA (struct IDirect3DDevice9 *device, HMODULE srcmodule, const char *resource, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateTextureFromResourceW (struct IDirect3DDevice9 *device, HMODULE srcmodule, const WCHAR *resource, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateCubeTextureFromResourceA (struct IDirect3DDevice9 *device, HMODULE srcmodule, const char *resource, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateCubeTextureFromResourceW (struct IDirect3DDevice9 *device, HMODULE srcmodule, const WCHAR *resource, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromResourceA (struct IDirect3DDevice9 *device, HMODULE srcmodule, const char *resource, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromResourceW (struct IDirect3DDevice9 *device, HMODULE srcmodule, const WCHAR *resource, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateTextureFromFileExA (struct IDirect3DDevice9 *device, const char *srcfile, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateTextureFromFileExW (struct IDirect3DDevice9 *device, const WCHAR *srcfile, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateCubeTextureFromFileExA (struct IDirect3DDevice9 *device, const char *srcfile, UINT size, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateCubeTextureFromFileExW (struct IDirect3DDevice9 *device, const WCHAR *srcfile, UINT size, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromFileExA (struct IDirect3DDevice9 *device, const char *srcfile, UINT width, UINT height, UINT depth, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromFileExW (struct IDirect3DDevice9 *device, const WCHAR *srcfile, UINT width, UINT height, UINT depth, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateTextureFromResourceExA (struct IDirect3DDevice9 *device, HMODULE srcmodule, const char *resource, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateTextureFromResourceExW (struct IDirect3DDevice9 *device, HMODULE srcmodule, const WCHAR *resource, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateCubeTextureFromResourceExA (struct IDirect3DDevice9 *device, HMODULE srcmodule, const char *resource, UINT size, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateCubeTextureFromResourceExW (struct IDirect3DDevice9 *device, HMODULE srcmodule, const WCHAR *resource, UINT size, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromResourceExA (struct IDirect3DDevice9 *device, HMODULE srcmodule, const char *resource, UINT width, UINT height, UINT depth, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromResourceExW (struct IDirect3DDevice9 *device, HMODULE srcmodule, const WCHAR *resource, UINT width, UINT height, UINT depth, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateTextureFromFileInMemory (struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemory (struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemory (struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx (struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
 
HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemoryEx (struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, UINT size, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DCubeTexture9 **cube)
 
HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemoryEx (struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, UINT width, UINT height, UINT depth, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DVolumeTexture9 **volume)
 
HRESULT WINAPI D3DXSaveTextureToFileInMemory (struct ID3DXBuffer **destbuffer, D3DXIMAGE_FILEFORMAT destformat, struct IDirect3DBaseTexture9 *srctexture, const PALETTEENTRY *srcpalette)
 
HRESULT WINAPI D3DXSaveTextureToFileA (const char *destfile, D3DXIMAGE_FILEFORMAT destformat, struct IDirect3DBaseTexture9 *srctexture, const PALETTEENTRY *srcpalette)
 
HRESULT WINAPI D3DXSaveTextureToFileW (const WCHAR *destfile, D3DXIMAGE_FILEFORMAT destformat, struct IDirect3DBaseTexture9 *srctexture, const PALETTEENTRY *srcpalette)
 
HRESULT WINAPI D3DXFilterTexture (struct IDirect3DBaseTexture9 *texture, const PALETTEENTRY *palette, UINT srclevel, DWORD filter)
 
HRESULT WINAPI D3DXFillTexture (struct IDirect3DTexture9 *texture, LPD3DXFILL2D function, void *data)
 
HRESULT WINAPI D3DXFillCubeTexture (struct IDirect3DCubeTexture9 *cube, LPD3DXFILL3D function, void *data)
 
HRESULT WINAPI D3DXFillVolumeTexture (struct IDirect3DVolumeTexture9 *volume, LPD3DXFILL3D function, void *data)
 
HRESULT WINAPI D3DXFillTextureTX (struct IDirect3DTexture9 *texture, ID3DXTextureShader *texture_shader)
 
HRESULT WINAPI D3DXFillCubeTextureTX (struct IDirect3DCubeTexture9 *cube, ID3DXTextureShader *texture_shader)
 
HRESULT WINAPI D3DXFillVolumeTextureTX (struct IDirect3DVolumeTexture9 *volume, ID3DXTextureShader *texture_shader)
 
HRESULT WINAPI D3DXComputeNormalMap (IDirect3DTexture9 *texture, IDirect3DTexture9 *srctexture, const PALETTEENTRY *srcpalette, DWORD flags, DWORD channel, float amplitude)
 

Macro Definition Documentation

◆ D3DX_CHANNEL_ALPHA

#define D3DX_CHANNEL_ALPHA   0x00000008

Definition at line 56 of file d3dx9tex.h.

◆ D3DX_CHANNEL_BLUE

#define D3DX_CHANNEL_BLUE   0x00000002

Definition at line 54 of file d3dx9tex.h.

◆ D3DX_CHANNEL_GREEN

#define D3DX_CHANNEL_GREEN   0x00000004

Definition at line 55 of file d3dx9tex.h.

◆ D3DX_CHANNEL_LUMINANCE

#define D3DX_CHANNEL_LUMINANCE   0x00000010

Definition at line 57 of file d3dx9tex.h.

◆ D3DX_CHANNEL_RED

#define D3DX_CHANNEL_RED   0x00000001

Definition at line 53 of file d3dx9tex.h.

◆ D3DX_FILTER_BOX

#define D3DX_FILTER_BOX   0x00000005

Definition at line 31 of file d3dx9tex.h.

◆ D3DX_FILTER_DITHER

#define D3DX_FILTER_DITHER   0x00080000

Definition at line 36 of file d3dx9tex.h.

◆ D3DX_FILTER_DITHER_DIFFUSION

#define D3DX_FILTER_DITHER_DIFFUSION   0x00100000

Definition at line 37 of file d3dx9tex.h.

◆ D3DX_FILTER_LINEAR

#define D3DX_FILTER_LINEAR   0x00000003

Definition at line 29 of file d3dx9tex.h.

◆ D3DX_FILTER_MIRROR

#define D3DX_FILTER_MIRROR   0x00070000

Definition at line 35 of file d3dx9tex.h.

◆ D3DX_FILTER_MIRROR_U

#define D3DX_FILTER_MIRROR_U   0x00010000

Definition at line 32 of file d3dx9tex.h.

◆ D3DX_FILTER_MIRROR_V

#define D3DX_FILTER_MIRROR_V   0x00020000

Definition at line 33 of file d3dx9tex.h.

◆ D3DX_FILTER_MIRROR_W

#define D3DX_FILTER_MIRROR_W   0x00040000

Definition at line 34 of file d3dx9tex.h.

◆ D3DX_FILTER_NONE

#define D3DX_FILTER_NONE   0x00000001

Definition at line 27 of file d3dx9tex.h.

◆ D3DX_FILTER_POINT

#define D3DX_FILTER_POINT   0x00000002

Definition at line 28 of file d3dx9tex.h.

◆ D3DX_FILTER_SRGB

#define D3DX_FILTER_SRGB   0x00600000

Definition at line 40 of file d3dx9tex.h.

◆ D3DX_FILTER_SRGB_IN

#define D3DX_FILTER_SRGB_IN   0x00200000

Definition at line 38 of file d3dx9tex.h.

◆ D3DX_FILTER_SRGB_OUT

#define D3DX_FILTER_SRGB_OUT   0x00400000

Definition at line 39 of file d3dx9tex.h.

◆ D3DX_FILTER_TRIANGLE

#define D3DX_FILTER_TRIANGLE   0x00000004

Definition at line 30 of file d3dx9tex.h.

◆ D3DX_NORMALMAP_COMPUTE_OCCLUSION

#define D3DX_NORMALMAP_COMPUTE_OCCLUSION   0x00100000

Definition at line 51 of file d3dx9tex.h.

◆ D3DX_NORMALMAP_INVERTSIGN

#define D3DX_NORMALMAP_INVERTSIGN   0x00080000

Definition at line 50 of file d3dx9tex.h.

◆ D3DX_NORMALMAP_MIRROR

#define D3DX_NORMALMAP_MIRROR   0x00030000

Definition at line 49 of file d3dx9tex.h.

◆ D3DX_NORMALMAP_MIRROR_U

#define D3DX_NORMALMAP_MIRROR_U   0x00010000

Definition at line 47 of file d3dx9tex.h.

◆ D3DX_NORMALMAP_MIRROR_V

#define D3DX_NORMALMAP_MIRROR_V   0x00020000

Definition at line 48 of file d3dx9tex.h.

◆ D3DX_SKIP_DDS_MIP_LEVELS

#define D3DX_SKIP_DDS_MIP_LEVELS (   l,
  f 
)
Value:
#define D3DX_SKIP_DDS_MIP_LEVELS_MASK
Definition: d3dx9tex.h:42
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define D3DX_FILTER_BOX
Definition: d3dx9tex.h:31
r l[0]
Definition: byte_order.h:167
#define D3DX_SKIP_DDS_MIP_LEVELS_SHIFT
Definition: d3dx9tex.h:43
GLfloat f
Definition: glext.h:7540
#define f
Definition: ke_i.h:83

Definition at line 44 of file d3dx9tex.h.

◆ D3DX_SKIP_DDS_MIP_LEVELS_MASK

#define D3DX_SKIP_DDS_MIP_LEVELS_MASK   0x1f

Definition at line 42 of file d3dx9tex.h.

◆ D3DX_SKIP_DDS_MIP_LEVELS_SHIFT

#define D3DX_SKIP_DDS_MIP_LEVELS_SHIFT   26

Definition at line 43 of file d3dx9tex.h.

◆ D3DXCreateCubeTextureFromFile

#define D3DXCreateCubeTextureFromFile   WINELIB_NAME_AW(D3DXCreateCubeTextureFromFile)

Definition at line 216 of file d3dx9tex.h.

◆ D3DXCreateCubeTextureFromFileEx

#define D3DXCreateCubeTextureFromFileEx   WINELIB_NAME_AW(D3DXCreateCubeTextureFromFileEx)

Definition at line 260 of file d3dx9tex.h.

◆ D3DXCreateCubeTextureFromResource

#define D3DXCreateCubeTextureFromResource   WINELIB_NAME_AW(D3DXCreateCubeTextureFromResource)

Definition at line 234 of file d3dx9tex.h.

◆ D3DXCreateCubeTextureFromResourceEx

#define D3DXCreateCubeTextureFromResourceEx   WINELIB_NAME_AW(D3DXCreateCubeTextureFromResourceEx)

Definition at line 290 of file d3dx9tex.h.

◆ D3DXCreateTextureFromFile

#define D3DXCreateTextureFromFile   WINELIB_NAME_AW(D3DXCreateTextureFromFile)

Definition at line 210 of file d3dx9tex.h.

◆ D3DXCreateTextureFromFileEx

#define D3DXCreateTextureFromFileEx   WINELIB_NAME_AW(D3DXCreateTextureFromFileEx)

Definition at line 250 of file d3dx9tex.h.

◆ D3DXCreateTextureFromResource

#define D3DXCreateTextureFromResource   WINELIB_NAME_AW(D3DXCreateTextureFromResource)

Definition at line 228 of file d3dx9tex.h.

◆ D3DXCreateTextureFromResourceEx

#define D3DXCreateTextureFromResourceEx   WINELIB_NAME_AW(D3DXCreateTextureFromResourceEx)

Definition at line 280 of file d3dx9tex.h.

◆ D3DXCreateVolumeTextureFromFile

#define D3DXCreateVolumeTextureFromFile   WINELIB_NAME_AW(D3DXCreateVolumeTextureFromFile)

Definition at line 222 of file d3dx9tex.h.

◆ D3DXCreateVolumeTextureFromFileEx

#define D3DXCreateVolumeTextureFromFileEx   WINELIB_NAME_AW(D3DXCreateVolumeTextureFromFileEx)

Definition at line 270 of file d3dx9tex.h.

◆ D3DXCreateVolumeTextureFromResource

#define D3DXCreateVolumeTextureFromResource   WINELIB_NAME_AW(D3DXCreateVolumeTextureFromResource)

Definition at line 240 of file d3dx9tex.h.

◆ D3DXCreateVolumeTextureFromResourceEx

#define D3DXCreateVolumeTextureFromResourceEx   WINELIB_NAME_AW(D3DXCreateVolumeTextureFromResourceEx)

Definition at line 300 of file d3dx9tex.h.

◆ D3DXFilterCubeTexture

#define D3DXFilterCubeTexture   D3DXFilterTexture

Definition at line 333 of file d3dx9tex.h.

◆ D3DXFilterVolumeTexture

#define D3DXFilterVolumeTexture   D3DXFilterTexture

Definition at line 334 of file d3dx9tex.h.

◆ D3DXGetImageInfoFromFile

#define D3DXGetImageInfoFromFile   WINELIB_NAME_AW(D3DXGetImageInfoFromFile)

Definition at line 104 of file d3dx9tex.h.

◆ D3DXGetImageInfoFromResource

#define D3DXGetImageInfoFromResource   WINELIB_NAME_AW(D3DXGetImageInfoFromResource)

Definition at line 108 of file d3dx9tex.h.

◆ D3DXLoadSurfaceFromFile

#define D3DXLoadSurfaceFromFile   WINELIB_NAME_AW(D3DXLoadSurfaceFromFile)

Definition at line 120 of file d3dx9tex.h.

◆ D3DXLoadSurfaceFromResource

#define D3DXLoadSurfaceFromResource   WINELIB_NAME_AW(D3DXLoadSurfaceFromResource)

Definition at line 128 of file d3dx9tex.h.

◆ D3DXLoadVolumeFromFile

#define D3DXLoadVolumeFromFile   WINELIB_NAME_AW(D3DXLoadVolumeFromFile)

Definition at line 161 of file d3dx9tex.h.

◆ D3DXLoadVolumeFromResource

#define D3DXLoadVolumeFromResource   WINELIB_NAME_AW(D3DXLoadVolumeFromResource)

Definition at line 169 of file d3dx9tex.h.

◆ D3DXSaveSurfaceToFile

#define D3DXSaveSurfaceToFile   WINELIB_NAME_AW(D3DXSaveSurfaceToFile)

Definition at line 151 of file d3dx9tex.h.

◆ D3DXSaveTextureToFile

#define D3DXSaveTextureToFile   WINELIB_NAME_AW(D3DXSaveTextureToFile)

Definition at line 328 of file d3dx9tex.h.

◆ D3DXSaveVolumeToFile

#define D3DXSaveVolumeToFile   WINELIB_NAME_AW(D3DXSaveVolumeToFile)

Definition at line 188 of file d3dx9tex.h.

Typedef Documentation

◆ D3DXIMAGE_FILEFORMAT

◆ D3DXIMAGE_INFO

◆ LPD3DXFILL2D

typedef void(WINAPI * LPD3DXFILL2D) (D3DXVECTOR4 *out, const D3DXVECTOR2 *texcoord, const D3DXVECTOR2 *texelsize, void *data)

Definition at line 91 of file d3dx9tex.h.

◆ LPD3DXFILL3D

typedef void(WINAPI * LPD3DXFILL3D) (D3DXVECTOR4 *out, const D3DXVECTOR3 *texcoord, const D3DXVECTOR3 *texelsize, void *data)

Definition at line 93 of file d3dx9tex.h.

Enumeration Type Documentation

◆ _D3DXIMAGE_FILEFORMAT

Enumerator
D3DXIFF_BMP 
D3DXIFF_JPG 
D3DXIFF_TGA 
D3DXIFF_PNG 
D3DXIFF_DDS 
D3DXIFF_PPM 
D3DXIFF_DIB 
D3DXIFF_HDR 
D3DXIFF_PFM 
D3DXIFF_FORCE_DWORD 

Definition at line 62 of file d3dx9tex.h.

63 {
73  D3DXIFF_FORCE_DWORD = 0x7fffffff
enum _D3DXIMAGE_FILEFORMAT D3DXIMAGE_FILEFORMAT

Function Documentation

◆ D3DXCheckCubeTextureRequirements()

HRESULT WINAPI D3DXCheckCubeTextureRequirements ( struct IDirect3DDevice9 *  device,
UINT size,
UINT miplevels,
DWORD  usage,
D3DFORMAT format,
D3DPOOL  pool 
)

Definition at line 421 of file texture.c.

423 {
424  D3DCAPS9 caps;
425  UINT s = (size && *size) ? *size : 256;
426  HRESULT hr;
427 
428  TRACE("(%p, %p, %p, %u, %p, %u)\n", device, size, miplevels, usage, format, pool);
429 
430  if (s == D3DX_DEFAULT)
431  s = 256;
432 
434  return D3DERR_INVALIDCALL;
435 
436  if (!(caps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP))
437  return D3DERR_NOTAVAILABLE;
438 
440  s = make_pow2(s);
441 
443 
445  {
446  if(miplevels)
447  *miplevels = 1;
448  }
449 
450  if (size)
451  *size = s;
452 
453  return hr;
454 }
DWORD TextureCaps
Definition: d3d9caps.h:279
HRESULT hr
Definition: shlfolder.c:183
#define D3DPTEXTURECAPS_CUBEMAP_POW2
Definition: d3d8caps.h:126
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
static HRESULT check_texture_requirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool, D3DRESOURCETYPE resource_type)
Definition: texture.c:202
#define D3DPTEXTURECAPS_CUBEMAP
Definition: d3d8caps.h:121
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:79
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLdouble s
Definition: gl.h:2039
static uint32_t make_pow2(uint32_t num)
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
unsigned int UINT
Definition: ndis.h:50
#define D3DPTEXTURECAPS_MIPCUBEMAP
Definition: d3d8caps.h:125
static BOOL is_pow2(UINT num)
Definition: texture.c:32

Referenced by D3DXCreateCubeTexture(), D3DXCreateCubeTextureFromFileInMemoryEx(), and test_D3DXCheckCubeTextureRequirements().

◆ D3DXCheckTextureRequirements()

HRESULT WINAPI D3DXCheckTextureRequirements ( struct IDirect3DDevice9 *  device,
UINT width,
UINT height,
UINT miplevels,
DWORD  usage,
D3DFORMAT format,
D3DPOOL  pool 
)

Definition at line 412 of file texture.c.

414 {
415  TRACE("device %p, width %p, height %p, miplevels %p, usage %u, format %p, pool %u.\n",
416  device, width, height, miplevels, usage, format, pool);
417 
419 }
GLint GLint GLsizei width
Definition: gl.h:1546
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
static HRESULT check_texture_requirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool, D3DRESOURCETYPE resource_type)
Definition: texture.c:202
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546

Referenced by D3DXCreateRenderToEnvMap(), D3DXCreateTexture(), D3DXCreateTextureFromFileInMemoryEx(), and test_D3DXCheckTextureRequirements().

◆ D3DXCheckVolumeTextureRequirements()

HRESULT WINAPI D3DXCheckVolumeTextureRequirements ( struct IDirect3DDevice9 *  device,
UINT width,
UINT height,
UINT depth,
UINT miplevels,
DWORD  usage,
D3DFORMAT format,
D3DPOOL  pool 
)

Definition at line 456 of file texture.c.

458 {
459  D3DCAPS9 caps;
460  UINT w = width ? *width : D3DX_DEFAULT;
462  UINT d = (depth && *depth) ? *depth : 1;
463  HRESULT hr;
464 
465  TRACE("(%p, %p, %p, %p, %p, %u, %p, %u)\n", device, width, height, depth, miplevels,
466  usage, format, pool);
467 
469  return D3DERR_INVALIDCALL;
470 
472  return D3DERR_NOTAVAILABLE;
473 
475  if (d == D3DX_DEFAULT)
476  d = 1;
477 
479  (!is_pow2(w) || !is_pow2(h) || !is_pow2(d)))
480  {
481  w = make_pow2(w);
482  h = make_pow2(h);
483  d = make_pow2(d);
484  }
485 
486  if (w > caps.MaxVolumeExtent)
487  w = caps.MaxVolumeExtent;
488  if (h > caps.MaxVolumeExtent)
489  h = caps.MaxVolumeExtent;
490  if (d > caps.MaxVolumeExtent)
491  d = caps.MaxVolumeExtent;
492 
493  if (miplevels)
494  {
496  *miplevels = 1;
497  else if ((usage & D3DUSAGE_AUTOGENMIPMAP))
498  {
499  if (*miplevels > 1)
500  *miplevels = 0;
501  }
502  else
503  {
504  UINT max_mipmaps = 1;
505  UINT max_dimen = max(max(w, h), d);
506 
507  while (max_dimen > 1)
508  {
509  max_dimen >>= 1;
510  max_mipmaps++;
511  }
512 
513  if (*miplevels == 0 || *miplevels > max_mipmaps)
514  *miplevels = max_mipmaps;
515  }
516  }
517 
518  if (width)
519  *width = w;
520  if (height)
521  *height = h;
522  if (depth)
523  *depth = d;
524 
525  return hr;
526 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define max(a, b)
Definition: svc.c:63
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
DWORD TextureCaps
Definition: d3d9caps.h:279
HRESULT hr
Definition: shlfolder.c:183
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
#define D3DERR_INVALIDCALL
#define D3DPTEXTURECAPS_MIPVOLUMEMAP
Definition: d3d8caps.h:124
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
DWORD MaxVolumeExtent
Definition: d3d9caps.h:288
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
static HRESULT check_texture_requirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool, D3DRESOURCETYPE resource_type)
Definition: texture.c:202
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static uint32_t make_pow2(uint32_t num)
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define D3DPTEXTURECAPS_VOLUMEMAP_POW2
Definition: d3d8caps.h:127
static BOOL is_pow2(UINT num)
Definition: texture.c:32
#define D3DPTEXTURECAPS_VOLUMEMAP
Definition: d3d8caps.h:122
#define d
Definition: ke_i.h:81

Referenced by D3DXCreateVolumeTexture(), D3DXCreateVolumeTextureFromFileInMemoryEx(), and test_D3DXCheckVolumeTextureRequirements().

◆ D3DXComputeNormalMap()

HRESULT WINAPI D3DXComputeNormalMap ( IDirect3DTexture9 *  texture,
IDirect3DTexture9 *  srctexture,
const PALETTEENTRY srcpalette,
DWORD  flags,
DWORD  channel,
float  amplitude 
)

Definition at line 1927 of file texture.c.

1929 {
1930  FIXME("texture %p, src_texture %p, src_palette %p, flags %#x, channel %u, amplitude %.8e stub.\n",
1931  texture, src_texture, src_palette, flags, channel, amplitude);
1932 
1933  return D3D_OK;
1934 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLenum GLuint texture
Definition: glext.h:6295
GLbitfield flags
Definition: glext.h:7161
#define D3D_OK
Definition: d3d.h:106

◆ D3DXCreateCubeTexture()

HRESULT WINAPI D3DXCreateCubeTexture ( struct IDirect3DDevice9 *  device,
UINT  size,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
struct IDirect3DCubeTexture9 **  cube 
)

Definition at line 913 of file texture.c.

915 {
916  HRESULT hr;
917 
918  TRACE("(%p, %u, %u, %#x, %#x, %#x, %p)\n", device, size, miplevels, usage, format,
919  pool, texture);
920 
921  if (!device || !texture)
922  return D3DERR_INVALIDCALL;
923 
925 
926  if (FAILED(hr))
927  {
928  TRACE("D3DXCheckCubeTextureRequirements failed\n");
929  return hr;
930  }
931 
933 }
HRESULT WINAPI D3DXCheckCubeTextureRequirements(struct IDirect3DDevice9 *device, UINT *size, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:421
HRESULT hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
#define NULL
Definition: types.h:112
#define IDirect3DDevice9_CreateCubeTexture(p, a, b, c, d, e, f, g)
Definition: d3d9.h:1532

Referenced by D3DXCreateCubeTextureFromFileInMemoryEx().

◆ D3DXCreateCubeTextureFromFileA()

HRESULT WINAPI D3DXCreateCubeTextureFromFileA ( struct IDirect3DDevice9 *  device,
const char srcfile,
struct IDirect3DCubeTexture9 **  cube 
)

Definition at line 1531 of file texture.c.

1534 {
1535  int len;
1536  HRESULT hr;
1537  WCHAR *filename;
1538  void *data;
1539  DWORD data_size;
1540 
1541  TRACE("(%p, %s, %p): relay\n", device, wine_dbgstr_a(src_filename), cube_texture);
1542 
1543  if (!src_filename) return D3DERR_INVALIDCALL;
1544 
1545  len = MultiByteToWideChar(CP_ACP, 0, src_filename, -1, NULL, 0);
1546  filename = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1547  if (!filename) return E_OUTOFMEMORY;
1548  MultiByteToWideChar(CP_ACP, 0, src_filename, -1, filename, len);
1549 
1550  hr = map_view_of_file(filename, &data, &data_size);
1551  if (FAILED(hr))
1552  {
1554  return D3DXERR_INVALIDDATA;
1555  }
1556 
1559 
1562  return hr;
1563 }
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:186
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
#define D3DERR_INVALIDCALL
const char * filename
Definition: ioapi.h:135
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *src_data, UINT src_data_size, UINT size, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *src_info, PALETTEENTRY *palette, IDirect3DCubeTexture9 **cube_texture)
Definition: texture.c:1400
#define UnmapViewOfFile
Definition: compat.h:605
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ D3DXCreateCubeTextureFromFileExA()

HRESULT WINAPI D3DXCreateCubeTextureFromFileExA ( struct IDirect3DDevice9 *  device,
const char srcfile,
UINT  size,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DCubeTexture9 **  cube 
)

Definition at line 1585 of file texture.c.

1598 {
1599  int len;
1600  HRESULT hr;
1601  WCHAR *filename;
1602  void *data;
1603  DWORD data_size;
1604 
1605  TRACE("(%p, %s, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p): relay\n",
1606  device, wine_dbgstr_a(src_filename), size, mip_levels, usage, format,
1607  pool, filter, mip_filter, color_key, image_info, palette, cube_texture);
1608 
1609  if (!src_filename) return D3DERR_INVALIDCALL;
1610 
1611  len = MultiByteToWideChar(CP_ACP, 0, src_filename, -1, NULL, 0);
1612  filename = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1613  if (!filename) return E_OUTOFMEMORY;
1614  MultiByteToWideChar(CP_ACP, 0, src_filename, -1, filename, len);
1615 
1616  hr = map_view_of_file(filename, &data, &data_size);
1617  if (FAILED(hr))
1618  {
1620  return D3DXERR_INVALIDDATA;
1621  }
1622 
1623  hr = D3DXCreateCubeTextureFromFileInMemoryEx(device, data, data_size, size, mip_levels,
1624  usage, format, pool, filter, mip_filter, color_key, image_info, palette, cube_texture);
1625 
1628  return hr;
1629 }
const char int int int static __inline const char * wine_dbgstr_a(const char *s)
Definition: debug.h:186
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
#define D3DERR_INVALIDCALL
const char * filename
Definition: ioapi.h:135
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
static HPALETTE palette
Definition: clipboard.c:1345
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *src_data, UINT src_data_size, UINT size, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *src_info, PALETTEENTRY *palette, IDirect3DCubeTexture9 **cube_texture)
Definition: texture.c:1400
#define UnmapViewOfFile
Definition: compat.h:605
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ D3DXCreateCubeTextureFromFileExW()

HRESULT WINAPI D3DXCreateCubeTextureFromFileExW ( struct IDirect3DDevice9 *  device,
const WCHAR srcfile,
UINT  size,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DCubeTexture9 **  cube 
)

Definition at line 1631 of file texture.c.

1644 {
1645  HRESULT hr;
1646  void *data;
1647  DWORD data_size;
1648 
1649  TRACE("(%p, %s, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p): relay\n",
1650  device, wine_dbgstr_w(src_filename), size, mip_levels, usage, format,
1651  pool, filter, mip_filter, color_key, image_info, palette, cube_texture);
1652 
1653  hr = map_view_of_file(src_filename, &data, &data_size);
1654  if (FAILED(hr)) return D3DXERR_INVALIDDATA;
1655 
1656  hr = D3DXCreateCubeTextureFromFileInMemoryEx(device, data, data_size, size, mip_levels,
1657  usage, format, pool, filter, mip_filter, color_key, image_info, palette, cube_texture);
1658 
1660  return hr;
1661 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static HPALETTE palette
Definition: clipboard.c:1345
HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *src_data, UINT src_data_size, UINT size, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *src_info, PALETTEENTRY *palette, IDirect3DCubeTexture9 **cube_texture)
Definition: texture.c:1400
#define UnmapViewOfFile
Definition: compat.h:605
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

◆ D3DXCreateCubeTextureFromFileInMemory()

HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemory ( struct IDirect3DDevice9 *  device,
const void srcdata,
UINT  srcdatasize,
struct IDirect3DCubeTexture9 **  cube 
)

Definition at line 935 of file texture.c.

937 {
938  TRACE("(%p, %p, %u, %p)\n", device, data, datasize, texture);
939 
942 }
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
static SIZE_T datasize
Definition: asm.c:30
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define NULL
Definition: types.h:112
HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *src_data, UINT src_data_size, UINT size, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *src_info, PALETTEENTRY *palette, IDirect3DCubeTexture9 **cube_texture)
Definition: texture.c:1400

Referenced by test_D3DXCreateCubeTextureFromFileInMemory().

◆ D3DXCreateCubeTextureFromFileInMemoryEx()

HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemoryEx ( struct IDirect3DDevice9 *  device,
const void srcdata,
UINT  srcdatasize,
UINT  size,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DCubeTexture9 **  cube 
)

Definition at line 1400 of file texture.c.

1414 {
1415  HRESULT hr;
1416  D3DCAPS9 caps;
1417  UINT loaded_miplevels;
1418  D3DXIMAGE_INFO img_info;
1419  BOOL dynamic_texture;
1420  BOOL file_size = FALSE;
1421  BOOL file_format = FALSE;
1422  BOOL file_mip_levels = FALSE;
1423  IDirect3DCubeTexture9 *tex, *buftex;
1424 
1425  TRACE("(%p, %p, %u, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p)\n", device,
1426  src_data, src_data_size, size, mip_levels, usage, format, pool, filter, mip_filter,
1427  color_key, src_info, palette, cube_texture);
1428 
1429  if (!device || !cube_texture || !src_data || !src_data_size)
1430  return D3DERR_INVALIDCALL;
1431 
1432  hr = D3DXGetImageInfoFromFileInMemory(src_data, src_data_size, &img_info);
1433  if (FAILED(hr))
1434  return hr;
1435 
1436  if (img_info.ImageFileFormat != D3DXIFF_DDS)
1437  return D3DXERR_INVALIDDATA;
1438 
1439  if (img_info.Width != img_info.Height)
1440  return D3DXERR_INVALIDDATA;
1441 
1442  if (size == 0 || size == D3DX_DEFAULT_NONPOW2)
1443  size = img_info.Width;
1444  if (size == D3DX_DEFAULT)
1445  size = make_pow2(img_info.Width);
1446 
1448  format = img_info.Format;
1449 
1450  if (size == D3DX_FROM_FILE)
1451  {
1452  file_size = TRUE;
1453  size = img_info.Width;
1454  }
1455 
1456  if (format == D3DFMT_FROM_FILE)
1457  {
1458  file_format = TRUE;
1459  format = img_info.Format;
1460  }
1461 
1462  if (mip_levels == D3DX_FROM_FILE)
1463  {
1464  file_mip_levels = TRUE;
1465  mip_levels = img_info.MipLevels;
1466  }
1467 
1469  if (FAILED(hr))
1470  return hr;
1471 
1472  if ((file_size && size != img_info.Width)
1473  || (file_format && format != img_info.Format)
1474  || (file_mip_levels && mip_levels != img_info.MipLevels))
1475  return D3DERR_NOTAVAILABLE;
1476 
1478  if (FAILED(hr))
1479  return D3DERR_INVALIDCALL;
1480 
1481  dynamic_texture = (caps.Caps2 & D3DCAPS2_DYNAMICTEXTURES) && (usage & D3DUSAGE_DYNAMIC);
1482  if (pool == D3DPOOL_DEFAULT && !dynamic_texture)
1483  {
1484  hr = D3DXCreateCubeTexture(device, size, mip_levels, 0, format, D3DPOOL_SYSTEMMEM, &buftex);
1485  tex = buftex;
1486  }
1487  else
1488  {
1489  hr = D3DXCreateCubeTexture(device, size, mip_levels, usage, format, pool, &tex);
1490  buftex = NULL;
1491  }
1492  if (FAILED(hr))
1493  return hr;
1494 
1495  hr = load_cube_texture_from_dds(tex, src_data, palette, filter, color_key, &img_info);
1496  if (FAILED(hr))
1497  {
1499  return hr;
1500  }
1501 
1502  loaded_miplevels = min(IDirect3DCubeTexture9_GetLevelCount(tex), img_info.MipLevels);
1503  hr = D3DXFilterTexture((IDirect3DBaseTexture9*) tex, palette, loaded_miplevels - 1, mip_filter);
1504  if (FAILED(hr))
1505  {
1507  return hr;
1508  }
1509 
1510  if (buftex)
1511  {
1512  hr = D3DXCreateCubeTexture(device, size, mip_levels, usage, format, pool, &tex);
1513  if (FAILED(hr))
1514  {
1516  return hr;
1517  }
1518 
1519  IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)buftex, (IDirect3DBaseTexture9 *)tex);
1521  }
1522 
1523  if (src_info)
1524  *src_info = img_info;
1525 
1526  *cube_texture = tex;
1527  return D3D_OK;
1528 }
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
HRESULT WINAPI D3DXCheckCubeTextureRequirements(struct IDirect3DDevice9 *device, UINT *size, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:421
static unsigned int file_size
Definition: regtests2xml.c:47
HRESULT hr
Definition: shlfolder.c:183
#define IDirect3DCubeTexture9_GetLevelCount(p)
Definition: d3d9.h:932
#define TRUE
Definition: types.h:120
#define D3DFMT_FROM_FILE
Definition: d3dx9.h:28
#define D3DX_FROM_FILE
Definition: d3dx9.h:27
#define D3DERR_INVALIDCALL
#define IDirect3DCubeTexture9_Release(p)
Definition: d3d9.h:919
HRESULT load_cube_texture_from_dds(IDirect3DCubeTexture9 *cube_texture, const void *src_data, const PALETTEENTRY *palette, DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
UINT MipLevels
Definition: d3dx9tex.h:81
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
#define IDirect3DDevice9_UpdateTexture(p, a, b)
Definition: d3d9.h:1538
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
HRESULT WINAPI D3DXFilterTexture(IDirect3DBaseTexture9 *texture, const PALETTEENTRY *palette, UINT srclevel, DWORD filter)
Definition: texture.c:52
DWORD Caps2
Definition: d3d9caps.h:267
D3DXIMAGE_FILEFORMAT ImageFileFormat
Definition: d3dx9tex.h:84
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
D3DFORMAT Format
Definition: d3dx9tex.h:82
LONG HRESULT
Definition: typedefs.h:79
#define D3DX_DEFAULT_NONPOW2
Definition: d3dx9.h:25
HRESULT WINAPI D3DXCreateCubeTexture(struct IDirect3DDevice9 *device, UINT size, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, struct IDirect3DCubeTexture9 **texture)
Definition: texture.c:913
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static uint32_t make_pow2(uint32_t num)
static HPALETTE palette
Definition: clipboard.c:1345
#define D3D_OK
Definition: d3d.h:106
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize, D3DXIMAGE_INFO *info)
Definition: surface.c:985
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define D3DCAPS2_DYNAMICTEXTURES
Definition: d3d8caps.h:25

Referenced by D3DXCreateCubeTextureFromFileA(), D3DXCreateCubeTextureFromFileExA(), D3DXCreateCubeTextureFromFileExW(), D3DXCreateCubeTextureFromFileInMemory(), D3DXCreateCubeTextureFromFileW(), and test_D3DXCreateCubeTextureFromFileInMemoryEx().

◆ D3DXCreateCubeTextureFromFileW()

HRESULT WINAPI D3DXCreateCubeTextureFromFileW ( struct IDirect3DDevice9 *  device,
const WCHAR srcfile,
struct IDirect3DCubeTexture9 **  cube 
)

Definition at line 1565 of file texture.c.

1568 {
1569  HRESULT hr;
1570  void *data;
1571  DWORD data_size;
1572 
1573  TRACE("(%p, %s, %p): relay\n", device, wine_dbgstr_w(src_filename), cube_texture);
1574 
1575  hr = map_view_of_file(src_filename, &data, &data_size);
1576  if (FAILED(hr)) return D3DXERR_INVALIDDATA;
1577 
1580 
1582  return hr;
1583 }
HRESULT hr
Definition: shlfolder.c:183
char * wine_dbgstr_w(const wchar_t *wstr)
Definition: atltest.h:87
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
#define NULL
Definition: types.h:112
HRESULT WINAPI D3DXCreateCubeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *src_data, UINT src_data_size, UINT size, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *src_info, PALETTEENTRY *palette, IDirect3DCubeTexture9 **cube_texture)
Definition: texture.c:1400
#define UnmapViewOfFile
Definition: compat.h:605

◆ D3DXCreateCubeTextureFromResourceA()

HRESULT WINAPI D3DXCreateCubeTextureFromResourceA ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const char resource,
struct IDirect3DCubeTexture9 **  cube 
)

◆ D3DXCreateCubeTextureFromResourceExA()

HRESULT WINAPI D3DXCreateCubeTextureFromResourceExA ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const char resource,
UINT  size,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DCubeTexture9 **  cube 
)

◆ D3DXCreateCubeTextureFromResourceExW()

HRESULT WINAPI D3DXCreateCubeTextureFromResourceExW ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const WCHAR resource,
UINT  size,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DCubeTexture9 **  cube 
)

◆ D3DXCreateCubeTextureFromResourceW()

HRESULT WINAPI D3DXCreateCubeTextureFromResourceW ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const WCHAR resource,
struct IDirect3DCubeTexture9 **  cube 
)

◆ D3DXCreateTexture()

HRESULT WINAPI D3DXCreateTexture ( struct IDirect3DDevice9 *  device,
UINT  width,
UINT  height,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
struct IDirect3DTexture9 **  texture 
)

Definition at line 528 of file texture.c.

530 {
531  HRESULT hr;
532 
533  TRACE("device %p, width %u, height %u, miplevels %u, usage %#x, format %#x, pool %#x, texture %p.\n",
534  device, width, height, miplevels, usage, format, pool, texture);
535 
536  if (!device || !texture)
537  return D3DERR_INVALIDCALL;
538 
540  return hr;
541 
543 }
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define IDirect3DDevice9_CreateTexture(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1530
#define NULL
Definition: types.h:112
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:412

Referenced by D3DXCreateTextureFromFileInMemoryEx(), test_D3DXCreateTexture(), test_effect_parameter_block(), and test_effect_setvalue_object().

◆ D3DXCreateTextureFromFileA()

HRESULT WINAPI D3DXCreateTextureFromFileA ( struct IDirect3DDevice9 *  device,
const char srcfile,
struct IDirect3DTexture9 **  texture 
)

Definition at line 818 of file texture.c.

820 {
821  TRACE("(%p, %s, %p)\n", device, debugstr_a(srcfile), texture);
822 
825 }
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
GLenum GLuint texture
Definition: glext.h:6295
HRESULT WINAPI D3DXCreateTextureFromFileExA(struct IDirect3DDevice9 *device, const char *srcfile, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
Definition: texture.c:789
#define NULL
Definition: types.h:112

◆ D3DXCreateTextureFromFileExA()

HRESULT WINAPI D3DXCreateTextureFromFileExA ( struct IDirect3DDevice9 *  device,
const char srcfile,
UINT  width,
UINT  height,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DTexture9 **  texture 
)

Definition at line 789 of file texture.c.

793 {
794  WCHAR *widename;
795  HRESULT hr;
796  DWORD len;
797 
798  TRACE("device %p, srcfile %s, width %u, height %u, miplevels %u, usage %#x, format %#x, "
799  "pool %#x, filter %#x, mipfilter %#x, colorkey 0x%08x, srcinfo %p, palette %p, texture %p.\n",
800  device, debugstr_a(srcfile), width, height, miplevels, usage, format,
801  pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
802 
803  if (!device || !srcfile || !texture)
804  return D3DERR_INVALIDCALL;
805 
806  len = MultiByteToWideChar(CP_ACP, 0, srcfile, -1, NULL, 0);
807  widename = HeapAlloc(GetProcessHeap(), 0, len * sizeof(*widename));
808  MultiByteToWideChar(CP_ACP, 0, srcfile, -1, widename, len);
809 
810  hr = D3DXCreateTextureFromFileExW(device, widename, width, height, miplevels,
811  usage, format, pool, filter, mipfilter,
812  colorkey, srcinfo, palette, texture);
813 
814  HeapFree(GetProcessHeap(), 0, widename);
815  return hr;
816 }
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
HRESULT WINAPI D3DXCreateTextureFromFileExW(struct IDirect3DDevice9 *device, const WCHAR *srcfile, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
Definition: texture.c:757
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by D3DXCreateTextureFromFileA().

◆ D3DXCreateTextureFromFileExW()

HRESULT WINAPI D3DXCreateTextureFromFileExW ( struct IDirect3DDevice9 *  device,
const WCHAR srcfile,
UINT  width,
UINT  height,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DTexture9 **  texture 
)

Definition at line 757 of file texture.c.

761 {
762  void *buffer;
763  HRESULT hr;
764  DWORD size;
765 
766  TRACE("device %p, srcfile %s, width %u, height %u, miplevels %u, usage %#x, format %#x, "
767  "pool %#x, filter %#x, mipfilter %#x, colorkey 0x%08x, srcinfo %p, palette %p, texture %p.\n",
768  device, debugstr_w(srcfile), width, height, miplevels, usage, format,
769  pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
770 
771  if (!srcfile)
772  return D3DERR_INVALIDCALL;
773 
774  hr = map_view_of_file(srcfile, &buffer, &size);
775  if (FAILED(hr))
776  {
777  WARN("Failed to open file.\n");
778  return D3DXERR_INVALIDDATA;
779  }
780 
782  filter, mipfilter, colorkey, srcinfo, palette, texture);
783 
785 
786  return hr;
787 }
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:112
HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
Definition: texture.c:568
#define D3DERR_INVALIDCALL
GLuint buffer
Definition: glext.h:5915
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define UnmapViewOfFile
Definition: compat.h:605
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

Referenced by D3DXCreateTextureFromFileExA(), and D3DXCreateTextureFromFileW().

◆ D3DXCreateTextureFromFileInMemory()

HRESULT WINAPI D3DXCreateTextureFromFileInMemory ( struct IDirect3DDevice9 *  device,
const void srcdata,
UINT  srcdatasize,
struct IDirect3DTexture9 **  texture 
)

Definition at line 748 of file texture.c.

750 {
751  TRACE("(%p, %p, %d, %p)\n", device, srcdata, srcdatasize, texture);
752 
755 }
HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
Definition: texture.c:568
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
#define NULL
Definition: types.h:112

Referenced by test_D3DXCreateTextureFromFileInMemory().

◆ D3DXCreateTextureFromFileInMemoryEx()

HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx ( struct IDirect3DDevice9 *  device,
const void srcdata,
UINT  srcdatasize,
UINT  width,
UINT  height,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DTexture9 **  texture 
)

Definition at line 568 of file texture.c.

572 {
573  BOOL dynamic_texture, format_specified = FALSE;
574  unsigned int loaded_miplevels, skip_levels;
575  IDirect3DSurface9 *surface;
576  IDirect3DTexture9 **texptr;
577  IDirect3DTexture9 *buftex;
578  D3DXIMAGE_INFO imginfo;
579  D3DCAPS9 caps;
580  HRESULT hr;
581 
582  TRACE("device %p, srcdata %p, srcdatasize %u, width %u, height %u, miplevels %u,"
583  " usage %#x, format %#x, pool %#x, filter %#x, mipfilter %#x, colorkey %#x,"
584  " srcinfo %p, palette %p, texture %p.\n",
585  device, srcdata, srcdatasize, width, height, miplevels, usage, format, pool,
586  filter, mipfilter, colorkey, srcinfo, palette, texture);
587 
588  /* check for invalid parameters */
589  if (!device || !texture || !srcdata || !srcdatasize)
590  return D3DERR_INVALIDCALL;
591 
592  hr = D3DXGetImageInfoFromFileInMemory(srcdata, srcdatasize, &imginfo);
593  if (FAILED(hr))
594  {
595  FIXME("Unrecognized file format, returning failure.\n");
596  *texture = NULL;
597  return hr;
598  }
599 
600  /* handle default values */
601  if (width == 0 || width == D3DX_DEFAULT_NONPOW2)
602  width = imginfo.Width;
603 
604  if (height == 0 || height == D3DX_DEFAULT_NONPOW2)
605  height = imginfo.Height;
606 
607  if (width == D3DX_DEFAULT)
608  width = make_pow2(imginfo.Width);
609 
610  if (height == D3DX_DEFAULT)
611  height = make_pow2(imginfo.Height);
612 
614  format = imginfo.Format;
615  else
616  format_specified = TRUE;
617 
618  if (width == D3DX_FROM_FILE)
619  {
620  width = imginfo.Width;
621  }
622 
623  if (height == D3DX_FROM_FILE)
624  {
625  height = imginfo.Height;
626  }
627 
628  if (format == D3DFMT_FROM_FILE)
629  {
630  format = imginfo.Format;
631  }
632 
633  if (miplevels == D3DX_FROM_FILE)
634  {
635  miplevels = imginfo.MipLevels;
636  }
637 
638  skip_levels = mipfilter != D3DX_DEFAULT ? mipfilter >> D3DX_SKIP_DDS_MIP_LEVELS_SHIFT : 0;
639  if (skip_levels && imginfo.MipLevels > skip_levels)
640  {
641  TRACE("Skipping the first %u (of %u) levels of a DDS mipmapped texture.\n",
642  skip_levels, imginfo.MipLevels);
643  TRACE("Texture level 0 dimensions are %ux%u.\n", imginfo.Width, imginfo.Height);
644  width >>= skip_levels;
645  height >>= skip_levels;
646  miplevels -= skip_levels;
647  }
648  else
649  {
650  skip_levels = 0;
651  }
652 
653  /* Fix up texture creation parameters. */
655  if (FAILED(hr))
656  {
657  FIXME("Couldn't find suitable texture parameters.\n");
658  *texture = NULL;
659  return hr;
660  }
661 
662  if (colorkey && !format_specified)
664 
665  if (imginfo.ResourceType == D3DRTYPE_VOLUMETEXTURE
666  && D3DFMT_DXT1 <= imginfo.Format && imginfo.Format <= D3DFMT_DXT5 && miplevels > 1)
667  {
668  FIXME("Generation of mipmaps for compressed volume textures is not implemented yet.\n");
669  miplevels = 1;
670  }
671 
673  return D3DERR_INVALIDCALL;
674 
675  /* Create the to-be-filled texture */
676  dynamic_texture = (caps.Caps2 & D3DCAPS2_DYNAMICTEXTURES) && (usage & D3DUSAGE_DYNAMIC);
677  if (pool == D3DPOOL_DEFAULT && !dynamic_texture)
678  {
679  hr = D3DXCreateTexture(device, width, height, miplevels, 0, format, D3DPOOL_SYSTEMMEM, &buftex);
680  texptr = &buftex;
681  }
682  else
683  {
685  texptr = texture;
686  }
687 
688  if (FAILED(hr))
689  {
690  FIXME("Texture creation failed.\n");
691  *texture = NULL;
692  return hr;
693  }
694 
695  TRACE("Texture created correctly. Now loading the texture data into it.\n");
696  if (imginfo.ImageFileFormat != D3DXIFF_DDS)
697  {
698  IDirect3DTexture9_GetSurfaceLevel(*texptr, 0, &surface);
699  hr = D3DXLoadSurfaceFromFileInMemory(surface, palette, NULL, srcdata, srcdatasize, NULL, filter, colorkey, NULL);
700  IDirect3DSurface9_Release(surface);
701  loaded_miplevels = min(IDirect3DTexture9_GetLevelCount(*texptr), imginfo.MipLevels);
702  }
703  else
704  {
705  hr = load_texture_from_dds(*texptr, srcdata, palette, filter, colorkey, &imginfo, skip_levels,
706  &loaded_miplevels);
707  }
708 
709  if (FAILED(hr))
710  {
711  FIXME("Texture loading failed.\n");
712  IDirect3DTexture9_Release(*texptr);
713  *texture = NULL;
714  return hr;
715  }
716 
717  hr = D3DXFilterTexture((IDirect3DBaseTexture9*) *texptr, palette, loaded_miplevels - 1, mipfilter);
718  if (FAILED(hr))
719  {
720  FIXME("Texture filtering failed.\n");
721  IDirect3DTexture9_Release(*texptr);
722  *texture = NULL;
723  return hr;
724  }
725 
726  /* Move the data to the actual texture if necessary */
727  if (texptr == &buftex)
728  {
730 
731  if (FAILED(hr))
732  {
734  *texture = NULL;
735  return hr;
736  }
737 
738  IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9*)buftex, (IDirect3DBaseTexture9*)(*texture));
740  }
741 
742  if (srcinfo)
743  *srcinfo = imginfo;
744 
745  return D3D_OK;
746 }
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
#define IDirect3DTexture9_GetSurfaceLevel(p, a, b)
Definition: d3d9.h:1033
HRESULT WINAPI D3DXCreateTexture(struct IDirect3DDevice9 *device, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, struct IDirect3DTexture9 **texture)
Definition: texture.c:528
#define D3DFMT_FROM_FILE
Definition: d3dx9.h:28
#define IDirect3DTexture9_Release(p)
Definition: d3d9.h:1014
#define D3DX_FROM_FILE
Definition: d3dx9.h:27
#define D3DERR_INVALIDCALL
#define IDirect3DTexture9_GetLevelCount(p)
Definition: d3d9.h:1027
static D3DFORMAT get_alpha_replacement_format(D3DFORMAT format)
Definition: texture.c:545
D3DRESOURCETYPE ResourceType
Definition: d3dx9tex.h:83
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
UINT MipLevels
Definition: d3dx9tex.h:81
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
#define IDirect3DDevice9_UpdateTexture(p, a, b)
Definition: d3d9.h:1538
#define FIXME(fmt,...)
Definition: debug.h:111
#define D3DX_DEFAULT
Definition: d3dx9.h:24
HRESULT WINAPI D3DXFilterTexture(IDirect3DBaseTexture9 *texture, const PALETTEENTRY *palette, UINT srclevel, DWORD filter)
Definition: texture.c:52
DWORD Caps2
Definition: d3d9caps.h:267
#define D3DX_SKIP_DDS_MIP_LEVELS_SHIFT
Definition: d3dx9tex.h:43
D3DXIMAGE_FILEFORMAT ImageFileFormat
Definition: d3dx9tex.h:84
#define TRACE(s)
Definition: solgame.cpp:4
D3DFORMAT Format
Definition: d3dx9tex.h:82
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
#define D3DX_DEFAULT_NONPOW2
Definition: d3dx9.h:25
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static uint32_t make_pow2(uint32_t num)
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define D3D_OK
Definition: d3d.h:106
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:412
HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize, D3DXIMAGE_INFO *info)
Definition: surface.c:985
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
HRESULT WINAPI D3DXLoadSurfaceFromFileInMemory(IDirect3DSurface9 *pDestSurface, const PALETTEENTRY *pDestPalette, const RECT *pDestRect, const void *pSrcData, UINT SrcDataSize, const RECT *pSrcRect, DWORD dwFilter, D3DCOLOR Colorkey, D3DXIMAGE_INFO *pSrcInfo)
Definition: surface.c:1245
HRESULT load_texture_from_dds(IDirect3DTexture9 *texture, const void *src_data, const PALETTEENTRY *palette, DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info, unsigned int skip_levels, unsigned int *loaded_miplevels) DECLSPEC_HIDDEN
Definition: surface.c:737
#define D3DCAPS2_DYNAMICTEXTURES
Definition: d3d8caps.h:25

Referenced by D3DXCreateTextureFromFileExW(), D3DXCreateTextureFromFileInMemory(), D3DXCreateTextureFromResourceExA(), D3DXCreateTextureFromResourceExW(), and test_D3DXCreateTextureFromFileInMemoryEx().

◆ D3DXCreateTextureFromFileW()

HRESULT WINAPI D3DXCreateTextureFromFileW ( struct IDirect3DDevice9 *  device,
const WCHAR srcfile,
struct IDirect3DTexture9 **  texture 
)

Definition at line 827 of file texture.c.

829 {
830  TRACE("(%p, %s, %p)\n", device, debugstr_w(srcfile), texture);
831 
834 }
Definition: devices.h:37
#define debugstr_w
Definition: kernel32.h:32
#define D3DX_DEFAULT
Definition: d3dx9.h:24
HRESULT WINAPI D3DXCreateTextureFromFileExW(struct IDirect3DDevice9 *device, const WCHAR *srcfile, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
Definition: texture.c:757
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
#define NULL
Definition: types.h:112

◆ D3DXCreateTextureFromResourceA()

HRESULT WINAPI D3DXCreateTextureFromResourceA ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const char resource,
struct IDirect3DTexture9 **  texture 
)

Definition at line 837 of file texture.c.

839 {
840  TRACE("(%p, %s): relay\n", srcmodule, debugstr_a(resource));
841 
844 }
HRESULT WINAPI D3DXCreateTextureFromResourceExA(struct IDirect3DDevice9 *device, HMODULE srcmodule, const char *resource, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
Definition: texture.c:855
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
GLenum GLuint texture
Definition: glext.h:6295
#define NULL
Definition: types.h:112

Referenced by test_D3DXCreateTexture().

◆ D3DXCreateTextureFromResourceExA()

HRESULT WINAPI D3DXCreateTextureFromResourceExA ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const char resource,
UINT  width,
UINT  height,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DTexture9 **  texture 
)

Definition at line 855 of file texture.c.

859 {
860  HRSRC resinfo;
861  void *buffer;
862  DWORD size;
863 
864  TRACE("device %p, srcmodule %p, resource %s, width %u, height %u, miplevels %u, usage %#x, format %#x, "
865  "pool %#x, filter %#x, mipfilter %#x, colorkey 0x%08x, srcinfo %p, palette %p, texture %p.\n",
866  device, srcmodule, debugstr_a(resource), width, height, miplevels, usage, format,
867  pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
868 
869  if (!device || !texture)
870  return D3DERR_INVALIDCALL;
871 
872  if (!(resinfo = FindResourceA(srcmodule, resource, (const char *)RT_RCDATA))
873  /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
874  && !(resinfo = FindResourceA(srcmodule, resource, (const char *)RT_BITMAP)))
875  return D3DXERR_INVALIDDATA;
876 
877  if (FAILED(load_resource_into_memory(srcmodule, resinfo, &buffer, &size)))
878  return D3DXERR_INVALIDDATA;
879 
881  usage, format, pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
882 }
GLint GLint GLsizei width
Definition: gl.h:1546
HRSRC WINAPI FindResourceA(HMODULE hModule, LPCSTR name, LPCSTR type)
Definition: res.c:155
HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
Definition: texture.c:568
#define D3DERR_INVALIDCALL
GLuint buffer
Definition: glext.h:5915
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:170
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define debugstr_a
Definition: kernel32.h:31
GLenum GLuint texture
Definition: glext.h:6295
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RT_RCDATA
Definition: pedump.c:372
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define RT_BITMAP
Definition: pedump.c:364
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

Referenced by D3DXCreateTextureFromResourceA(), and test_D3DXCreateTexture().

◆ D3DXCreateTextureFromResourceExW()

HRESULT WINAPI D3DXCreateTextureFromResourceExW ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const WCHAR resource,
UINT  width,
UINT  height,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DTexture9 **  texture 
)

Definition at line 884 of file texture.c.

888 {
889  HRSRC resinfo;
890  void *buffer;
891  DWORD size;
892 
893  TRACE("device %p, srcmodule %p, resource %s, width %u, height %u, miplevels %u, usage %#x, format %#x, "
894  "pool %#x, filter %#x, mipfilter %#x, colorkey 0x%08x, srcinfo %p, palette %p, texture %p.\n",
895  device, srcmodule, debugstr_w(resource), width, height, miplevels, usage, format,
896  pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
897 
898  if (!device || !texture)
899  return D3DERR_INVALIDCALL;
900 
901  if (!(resinfo = FindResourceW(srcmodule, resource, (const WCHAR *)RT_RCDATA))
902  /* Try loading the resource as bitmap data (which is in DIB format D3DXIFF_DIB) */
903  && !(resinfo = FindResourceW(srcmodule, resource, (const WCHAR *)RT_BITMAP)))
904  return D3DXERR_INVALIDDATA;
905 
906  if (FAILED(load_resource_into_memory(srcmodule, resinfo, &buffer, &size)))
907  return D3DXERR_INVALIDDATA;
908 
910  usage, format, pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
911 }
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT WINAPI D3DXCreateTextureFromFileInMemoryEx(struct IDirect3DDevice9 *device, const void *srcdata, UINT srcdatasize, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
Definition: texture.c:568
#define D3DERR_INVALIDCALL
GLuint buffer
Definition: glext.h:5915
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
Definition: res.c:176
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
#define debugstr_w
Definition: kernel32.h:32
HRESULT load_resource_into_memory(HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:170
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLuint texture
Definition: glext.h:6295
unsigned long DWORD
Definition: ntddk_ex.h:95
#define RT_RCDATA
Definition: pedump.c:372
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define RT_BITMAP
Definition: pedump.c:364
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

Referenced by D3DXCreateTextureFromResourceW().

◆ D3DXCreateTextureFromResourceW()

HRESULT WINAPI D3DXCreateTextureFromResourceW ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const WCHAR resource,
struct IDirect3DTexture9 **  texture 
)

Definition at line 846 of file texture.c.

848 {
849  TRACE("(%p, %s): relay\n", srcmodule, debugstr_w(resource));
850 
853 }
Definition: devices.h:37
#define debugstr_w
Definition: kernel32.h:32
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
#define NULL
Definition: types.h:112
HRESULT WINAPI D3DXCreateTextureFromResourceExW(struct IDirect3DDevice9 *device, HMODULE srcmodule, const WCHAR *resource, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mipfilter, D3DCOLOR colorkey, D3DXIMAGE_INFO *srcinfo, PALETTEENTRY *palette, struct IDirect3DTexture9 **texture)
Definition: texture.c:884

◆ D3DXCreateVolumeTexture()

HRESULT WINAPI D3DXCreateVolumeTexture ( struct IDirect3DDevice9 *  device,
UINT  width,
UINT  height,
UINT  depth,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
struct IDirect3DVolumeTexture9 **  volume 
)

Definition at line 944 of file texture.c.

946 {
947  HRESULT hr;
948 
949  TRACE("(%p, %u, %u, %u, %u, %#x, %#x, %#x, %p)\n", device, width, height, depth,
950  miplevels, usage, format, pool, texture);
951 
952  if (!device || !texture)
953  return D3DERR_INVALIDCALL;
954 
956  &miplevels, usage, &format, pool);
957 
958  if (FAILED(hr))
959  {
960  TRACE("D3DXCheckVolumeTextureRequirements failed\n");
961  return hr;
962  }
963 
966 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define IDirect3DDevice9_CreateVolumeTexture(p, a, b, c, d, e, f, g, h, i)
Definition: d3d9.h:1531
HRESULT hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
HRESULT WINAPI D3DXCheckVolumeTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *depth, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:456
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define NULL
Definition: types.h:112

Referenced by D3DXCreateVolumeTextureFromFileInMemoryEx().

◆ D3DXCreateVolumeTextureFromFileA()

HRESULT WINAPI D3DXCreateVolumeTextureFromFileA ( struct IDirect3DDevice9 *  device,
const char srcfile,
struct IDirect3DVolumeTexture9 **  volume 
)

Definition at line 968 of file texture.c.

971 {
972  int len;
973  HRESULT hr;
974  void *data;
975  DWORD data_size;
976  WCHAR *filenameW;
977 
978  TRACE("(%p, %s, %p): relay\n",
979  device, debugstr_a(filename), volume_texture);
980 
981  if (!filename) return D3DERR_INVALIDCALL;
982 
983  len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0);
984  filenameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
985  if (!filenameW) return E_OUTOFMEMORY;
987 
988  hr = map_view_of_file(filenameW, &data, &data_size);
990  if (FAILED(hr)) return D3DXERR_INVALIDDATA;
991 
994 
996  return hr;
997 }
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
#define D3DERR_INVALIDCALL
const char * filename
Definition: ioapi.h:135
static const WCHAR filenameW[]
Definition: amstream.c:41
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
GLenum GLsizei len
Definition: glext.h:6722
HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *data, UINT data_size, UINT width, UINT height, UINT depth, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *info, PALETTEENTRY *palette, IDirect3DVolumeTexture9 **volume_texture)
Definition: texture.c:1118
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
#define UnmapViewOfFile
Definition: compat.h:605
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ D3DXCreateVolumeTextureFromFileExA()

HRESULT WINAPI D3DXCreateVolumeTextureFromFileExA ( struct IDirect3DDevice9 *  device,
const char srcfile,
UINT  width,
UINT  height,
UINT  depth,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DVolumeTexture9 **  volume 
)

Definition at line 1022 of file texture.c.

1037 {
1038  int len;
1039  HRESULT hr;
1040  WCHAR *filenameW;
1041  void *data;
1042  DWORD data_size;
1043 
1044  TRACE("(%p, %s, %u, %u, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p): relay\n",
1045  device, debugstr_a(filename), width, height, depth, mip_levels,
1046  usage, format, pool, filter, mip_filter, color_key, src_info,
1047  palette, volume_texture);
1048 
1049  if (!filename) return D3DERR_INVALIDCALL;
1050 
1051  len = MultiByteToWideChar(CP_ACP, 0, filename, -1, NULL, 0);
1052  filenameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1053  if (!filenameW) return E_OUTOFMEMORY;
1055 
1056  hr = map_view_of_file(filenameW, &data, &data_size);
1058  if (FAILED(hr)) return D3DXERR_INVALIDDATA;
1059 
1061  mip_levels, usage, format, pool, filter, mip_filter, color_key, src_info, palette,
1062  volume_texture);
1063 
1065  return hr;
1066 }
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
#define D3DERR_INVALIDCALL
const char * filename
Definition: ioapi.h:135
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
static const WCHAR filenameW[]
Definition: amstream.c:41
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
Definition: devices.h:37
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *data, UINT data_size, UINT width, UINT height, UINT depth, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *info, PALETTEENTRY *palette, IDirect3DVolumeTexture9 **volume_texture)
Definition: texture.c:1118
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
#define UnmapViewOfFile
Definition: compat.h:605
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define HeapFree(x, y, z)
Definition: compat.h:594

◆ D3DXCreateVolumeTextureFromFileExW()

HRESULT WINAPI D3DXCreateVolumeTextureFromFileExW ( struct IDirect3DDevice9 *  device,
const WCHAR srcfile,
UINT  width,
UINT  height,
UINT  depth,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DVolumeTexture9 **  volume 
)

Definition at line 1068 of file texture.c.

1083 {
1084  HRESULT hr;
1085  void *data;
1086  DWORD data_size;
1087 
1088  TRACE("(%p, %s, %u, %u, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p): relay\n",
1089  device, debugstr_w(filename), width, height, depth, mip_levels,
1090  usage, format, pool, filter, mip_filter, color_key, src_info,
1091  palette, volume_texture);
1092 
1093  if (!filename) return D3DERR_INVALIDCALL;
1094 
1095  hr = map_view_of_file(filename, &data, &data_size);
1096  if (FAILED(hr)) return D3DXERR_INVALIDDATA;
1097 
1099  mip_levels, usage, format, pool, filter, mip_filter, color_key, src_info, palette,
1100  volume_texture);
1101 
1103  return hr;
1104 }
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
const char * filename
Definition: ioapi.h:135
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *data, UINT data_size, UINT width, UINT height, UINT depth, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *info, PALETTEENTRY *palette, IDirect3DVolumeTexture9 **volume_texture)
Definition: texture.c:1118
#define UnmapViewOfFile
Definition: compat.h:605
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

◆ D3DXCreateVolumeTextureFromFileInMemory()

HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemory ( struct IDirect3DDevice9 *  device,
const void srcdata,
UINT  srcdatasize,
struct IDirect3DVolumeTexture9 **  volume 
)

Definition at line 1106 of file texture.c.

1110 {
1111  TRACE("(%p, %p, %u, %p): relay\n", device, data, data_size, volume_texture);
1112 
1115  0, NULL, NULL, volume_texture);
1116 }
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define TRACE(s)
Definition: solgame.cpp:4
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *data, UINT data_size, UINT width, UINT height, UINT depth, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *info, PALETTEENTRY *palette, IDirect3DVolumeTexture9 **volume_texture)
Definition: texture.c:1118
#define NULL
Definition: types.h:112

Referenced by test_D3DXCreateVolumeTextureFromFileInMemory().

◆ D3DXCreateVolumeTextureFromFileInMemoryEx()

HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemoryEx ( struct IDirect3DDevice9 *  device,
const void srcdata,
UINT  srcdatasize,
UINT  width,
UINT  height,
UINT  depth,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DVolumeTexture9 **  volume 
)

Definition at line 1118 of file texture.c.

1134 {
1135  HRESULT hr;
1136  D3DCAPS9 caps;
1137  D3DXIMAGE_INFO image_info;
1138  BOOL dynamic_texture;
1139  BOOL file_width = FALSE;
1140  BOOL file_height = FALSE;
1141  BOOL file_depth = FALSE;
1142  BOOL file_format = FALSE;
1143  BOOL file_mip_levels = FALSE;
1144  IDirect3DVolumeTexture9 *tex, *buftex;
1145 
1146  TRACE("(%p, %p, %u, %u, %u, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p)\n",
1147  device, data, data_size, width, height, depth, mip_levels, usage, format, pool,
1148  filter, mip_filter, color_key, info, palette, volume_texture);
1149 
1150  if (!device || !data || !data_size || !volume_texture)
1151  return D3DERR_INVALIDCALL;
1152 
1153  hr = D3DXGetImageInfoFromFileInMemory(data, data_size, &image_info);
1154  if (FAILED(hr)) return hr;
1155 
1156  if (image_info.ImageFileFormat != D3DXIFF_DDS)
1157  return D3DXERR_INVALIDDATA;
1158 
1159  if (width == 0 || width == D3DX_DEFAULT_NONPOW2)
1160  width = image_info.Width;
1161  if (width == D3DX_DEFAULT)
1162  width = make_pow2(image_info.Width);
1163 
1164  if (height == 0 || height == D3DX_DEFAULT_NONPOW2)
1165  height = image_info.Height;
1166  if (height == D3DX_DEFAULT)
1167  height = make_pow2(image_info.Height);
1168 
1169  if (depth == 0 || depth == D3DX_DEFAULT_NONPOW2)
1170  depth = image_info.Depth;
1171  if (depth == D3DX_DEFAULT)
1172  depth = make_pow2(image_info.Depth);
1173 
1175  format = image_info.Format;
1176 
1177  if (width == D3DX_FROM_FILE)
1178  {
1179  file_width = TRUE;
1180  width = image_info.Width;
1181  }
1182 
1183  if (height == D3DX_FROM_FILE)
1184  {
1185  file_height = TRUE;
1186  height = image_info.Height;
1187  }
1188 
1189  if (depth == D3DX_FROM_FILE)
1190  {
1191  file_depth = TRUE;
1192  depth = image_info.Depth;
1193  }
1194 
1195  if (format == D3DFMT_FROM_FILE)
1196  {
1197  file_format = TRUE;
1198  format = image_info.Format;
1199  }
1200 
1201  if (mip_levels == D3DX_FROM_FILE)
1202  {
1203  file_mip_levels = TRUE;
1204  mip_levels = image_info.MipLevels;
1205  }
1206 
1208  if (FAILED(hr)) return hr;
1209 
1210  if ((file_width && width != image_info.Width)
1211  || (file_height && height != image_info.Height)
1212  || (file_depth && depth != image_info.Depth)
1213  || (file_format && format != image_info.Format)
1214  || (file_mip_levels && mip_levels != image_info.MipLevels))
1215  return D3DERR_NOTAVAILABLE;
1216 
1218  if (FAILED(hr))
1219  return D3DERR_INVALIDCALL;
1220 
1221  if (mip_levels > image_info.MipLevels)
1222  {
1223  FIXME("Generation of mipmaps for volume textures is not implemented yet.\n");
1224  mip_levels = image_info.MipLevels;
1225  }
1226 
1227  dynamic_texture = (caps.Caps2 & D3DCAPS2_DYNAMICTEXTURES) && (usage & D3DUSAGE_DYNAMIC);
1228  if (pool == D3DPOOL_DEFAULT && !dynamic_texture)
1229  {
1230  hr = D3DXCreateVolumeTexture(device, width, height, depth, mip_levels, 0, format, D3DPOOL_SYSTEMMEM, &buftex);
1231  tex = buftex;
1232  }
1233  else
1234  {
1235  hr = D3DXCreateVolumeTexture(device, width, height, depth, mip_levels, usage, format, pool, &tex);
1236  buftex = NULL;
1237  }
1238  if (FAILED(hr)) return hr;
1239 
1240  hr = load_volume_texture_from_dds(tex, data, palette, filter, color_key, &image_info);
1241  if (FAILED(hr))
1242  {
1244  return hr;
1245  }
1246 
1247  if (buftex)
1248  {
1249  hr = D3DXCreateVolumeTexture(device, width, height, depth, mip_levels, usage, format, pool, &tex);
1250  if (FAILED(hr))
1251  {
1253  return hr;
1254  }
1255 
1256  IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)buftex, (IDirect3DBaseTexture9 *)tex);
1258  }
1259 
1260  if (info)
1261  *info = image_info;
1262 
1263  *volume_texture = tex;
1264  return D3D_OK;
1265 }
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
#define D3DFMT_FROM_FILE
Definition: d3dx9.h:28
#define D3DX_FROM_FILE
Definition: d3dx9.h:27
#define D3DERR_INVALIDCALL
#define IDirect3DVolumeTexture9_Release(p)
Definition: d3d9.h:1109
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
UINT MipLevels
Definition: d3dx9tex.h:81
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
#define IDirect3DDevice9_UpdateTexture(p, a, b)
Definition: d3d9.h:1538
#define FIXME(fmt,...)
Definition: debug.h:111
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
DWORD Caps2
Definition: d3d9caps.h:267
D3DXIMAGE_FILEFORMAT ImageFileFormat
Definition: d3dx9tex.h:84
#define TRACE(s)
Definition: solgame.cpp:4
D3DFORMAT Format
Definition: d3dx9tex.h:82
LONG HRESULT
Definition: typedefs.h:79
#define D3DX_DEFAULT_NONPOW2
Definition: d3dx9.h:25
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
HRESULT WINAPI D3DXCreateVolumeTexture(struct IDirect3DDevice9 *device, UINT width, UINT height, UINT depth, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, struct IDirect3DVolumeTexture9 **texture)
Definition: texture.c:944
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
HRESULT load_volume_texture_from_dds(IDirect3DVolumeTexture9 *volume_texture, const void *src_data, const PALETTEENTRY *palette, DWORD filter, DWORD color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN
Definition: surface.c:847
HRESULT WINAPI D3DXCheckVolumeTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *depth, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:456
static uint32_t make_pow2(uint32_t num)
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define D3D_OK
Definition: d3d.h:106
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
#define NULL
Definition: types.h:112
HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize, D3DXIMAGE_INFO *info)
Definition: surface.c:985
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define D3DCAPS2_DYNAMICTEXTURES
Definition: d3d8caps.h:25

Referenced by D3DXCreateVolumeTextureFromFileA(), D3DXCreateVolumeTextureFromFileExA(), D3DXCreateVolumeTextureFromFileExW(), D3DXCreateVolumeTextureFromFileInMemory(), D3DXCreateVolumeTextureFromFileW(), and test_D3DXCreateVolumeTextureFromFileInMemoryEx().

◆ D3DXCreateVolumeTextureFromFileW()

HRESULT WINAPI D3DXCreateVolumeTextureFromFileW ( struct IDirect3DDevice9 *  device,
const WCHAR srcfile,
struct IDirect3DVolumeTexture9 **  volume 
)

Definition at line 999 of file texture.c.

1002 {
1003  HRESULT hr;
1004  void *data;
1005  DWORD data_size;
1006 
1007  TRACE("(%p, %s, %p): relay\n",
1008  device, debugstr_w(filename), volume_texture);
1009 
1010  if (!filename) return D3DERR_INVALIDCALL;
1011 
1012  hr = map_view_of_file(filename, &data, &data_size);
1013  if (FAILED(hr)) return D3DXERR_INVALIDDATA;
1014 
1017 
1019  return hr;
1020 }
HRESULT hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
const char * filename
Definition: ioapi.h:135
Definition: devices.h:37
#define debugstr_w
Definition: kernel32.h:32
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
HRESULT map_view_of_file(const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
Definition: util.c:120
HRESULT WINAPI D3DXCreateVolumeTextureFromFileInMemoryEx(IDirect3DDevice9 *device, const void *data, UINT data_size, UINT width, UINT height, UINT depth, UINT mip_levels, DWORD usage, D3DFORMAT format, D3DPOOL pool, DWORD filter, DWORD mip_filter, D3DCOLOR color_key, D3DXIMAGE_INFO *info, PALETTEENTRY *palette, IDirect3DVolumeTexture9 **volume_texture)
Definition: texture.c:1118
#define NULL
Definition: types.h:112
#define UnmapViewOfFile
Definition: compat.h:605

◆ D3DXCreateVolumeTextureFromResourceA()

HRESULT WINAPI D3DXCreateVolumeTextureFromResourceA ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const char resource,
struct IDirect3DVolumeTexture9 **  volume 
)

◆ D3DXCreateVolumeTextureFromResourceExA()

HRESULT WINAPI D3DXCreateVolumeTextureFromResourceExA ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const char resource,
UINT  width,
UINT  height,
UINT  depth,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DVolumeTexture9 **  volume 
)

◆ D3DXCreateVolumeTextureFromResourceExW()

HRESULT WINAPI D3DXCreateVolumeTextureFromResourceExW ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const WCHAR resource,
UINT  width,
UINT  height,
UINT  depth,
UINT  miplevels,
DWORD  usage,
D3DFORMAT  format,
D3DPOOL  pool,
DWORD  filter,
DWORD  mipfilter,
D3DCOLOR  colorkey,
D3DXIMAGE_INFO srcinfo,
PALETTEENTRY palette,
struct IDirect3DVolumeTexture9 **  volume 
)

◆ D3DXCreateVolumeTextureFromResourceW()

HRESULT WINAPI D3DXCreateVolumeTextureFromResourceW ( struct IDirect3DDevice9 *  device,
HMODULE  srcmodule,
const WCHAR resource,
struct IDirect3DVolumeTexture9 **  volume 
)

◆ D3DXFillCubeTexture()

HRESULT WINAPI D3DXFillCubeTexture ( struct IDirect3DCubeTexture9 *  cube,
LPD3DXFILL3D  function,
void data 
)

Definition at line 1695 of file texture.c.

1696 {
1697  DWORD miplevels;
1698  DWORD m, x, y, f;
1700  D3DLOCKED_RECT lock_rect;
1703  const struct pixel_format_desc *format;
1704  BYTE *data;
1705  static const enum cube_coord coordmap[6][3] =
1706  {
1707  {ONE, YCOORDINV, XCOORDINV},
1708  {ZERO, YCOORDINV, XCOORD},
1709  {XCOORD, ONE, YCOORD},
1710  {XCOORD, ZERO, YCOORDINV},
1711  {XCOORD, YCOORDINV, ONE},
1713  };
1714 
1715  if (texture == NULL || function == NULL)
1716  return D3DERR_INVALIDCALL;
1717 
1719 
1720  for (m = 0; m < miplevels; m++)
1721  {
1723  return D3DERR_INVALIDCALL;
1724 
1725  format = get_format_info(desc.Format);
1726  if (format->type != FORMAT_ARGB && format->type != FORMAT_ARGBF16 && format->type != FORMAT_ARGBF)
1727  {
1728  FIXME("Unsupported texture format %#x\n", desc.Format);
1729  return D3DERR_INVALIDCALL;
1730  }
1731 
1732  for (f = 0; f < 6; f++)
1733  {
1735  return D3DERR_INVALIDCALL;
1736 
1737  size.x = (f == 0) || (f == 1) ? 0.0f : 2.0f / desc.Width;
1738  size.y = (f == 2) || (f == 3) ? 0.0f : 2.0f / desc.Width;
1739  size.z = (f == 4) || (f == 5) ? 0.0f : 2.0f / desc.Width;
1740 
1741  data = lock_rect.pBits;
1742 
1743  for (y = 0; y < desc.Height; y++)
1744  {
1745  for (x = 0; x < desc.Width; x++)
1746  {
1747  coord.x = get_cube_coord(coordmap[f][0], x, y, desc.Width) / desc.Width * 2.0f - 1.0f;
1748  coord.y = get_cube_coord(coordmap[f][1], x, y, desc.Width) / desc.Width * 2.0f - 1.0f;
1749  coord.z = get_cube_coord(coordmap[f][2], x, y, desc.Width) / desc.Width * 2.0f - 1.0f;
1750 
1751  function(&value, &coord, &size, funcdata);
1752 
1753  fill_texture(format, data + y * lock_rect.Pitch + x * format->bytes_per_pixel, &value);
1754  }
1755  }
1757  }
1758  }
1759 
1760  return D3D_OK;
1761 }
Definition: pdh_main.c:93
#define IDirect3DCubeTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:937
Definition: texture.c:1670
static float get_cube_coord(enum cube_coord coord, unsigned int x, unsigned int y, unsigned int size)
Definition: texture.c:1673
#define D3DLOCK_DISCARD
Definition: d3d8types.h:72
#define D3DERR_INVALIDCALL
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
Definition: texture.c:1669
const GLfloat * m
Definition: glext.h:10848
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLuint coord
Definition: glext.h:9511
#define IDirect3DCubeTexture9_LockRect(p, a, b, c, d, e)
Definition: d3d9.h:939
static const WCHAR desc[]
Definition: protectdata.c:36
#define FIXME(fmt,...)
Definition: debug.h:111
cube_coord
Definition: texture.c:1663
GLfloat f
Definition: glext.h:7540
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint texture
Definition: glext.h:6295
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei const GLfloat * value
Definition: glext.h:6069
unsigned char BYTE
Definition: xxhash.c:193
#define D3D_OK
Definition: d3d.h:106
#define f
Definition: ke_i.h:83
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define IDirect3DCubeTexture9_UnlockRect(p, a, b)
Definition: d3d9.h:940
static void fill_texture(const struct pixel_format_desc *format, BYTE *pos, const D3DXVECTOR4 *value)
Definition: texture.c:1267
const struct pixel_format_desc * get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: util.c:217
#define IDirect3DBaseTexture9_GetLevelCount(p)
Definition: d3d9.h:848

Referenced by test_D3DXFillCubeTexture(), and test_D3DXSaveTextureToFileInMemory().

◆ D3DXFillCubeTextureTX()

HRESULT WINAPI D3DXFillCubeTextureTX ( struct IDirect3DCubeTexture9 *  cube,
ID3DXTextureShader *  texture_shader 
)

Definition at line 1763 of file texture.c.

1764 {
1765  FIXME("texture %p, texture_shader %p stub.\n", texture, texture_shader);
1766  return E_NOTIMPL;
1767 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLenum GLuint texture
Definition: glext.h:6295
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by test_texture_shader().

◆ D3DXFillTexture()

HRESULT WINAPI D3DXFillTexture ( struct IDirect3DTexture9 *  texture,
LPD3DXFILL2D  function,
void data 
)

Definition at line 1323 of file texture.c.

1324 {
1325  IDirect3DSurface9 *surface, *temp_surface;
1326  DWORD miplevels;
1327  DWORD m, x, y;
1329  D3DLOCKED_RECT lock_rect;
1332  const struct pixel_format_desc *format;
1333  BYTE *data;
1334  HRESULT hr;
1335 
1336  TRACE("texture %p, function %p, funcdata %p.\n", texture, function, funcdata);
1337 
1338  if (!texture || !function)
1339  return D3DERR_INVALIDCALL;
1340 
1342 
1343  for (m = 0; m < miplevels; m++)
1344  {
1346  return hr;
1347 
1348  format = get_format_info(desc.Format);
1349  if (format->type != FORMAT_ARGB && format->type != FORMAT_ARGBF16 && format->type != FORMAT_ARGBF)
1350  {
1351  FIXME("Unsupported texture format %#x.\n", desc.Format);
1352  return D3DERR_INVALIDCALL;
1353  }
1354 
1356  return hr;
1357  if (FAILED(hr = lock_surface(surface, NULL, &lock_rect, &temp_surface, TRUE)))
1358  {
1359  IDirect3DSurface9_Release(surface);
1360  return hr;
1361  }
1362 
1363  size.x = 1.0f / desc.Width;
1364  size.y = 1.0f / desc.Height;
1365 
1366  data = lock_rect.pBits;
1367 
1368  for (y = 0; y < desc.Height; y++)
1369  {
1370  /* The callback function expects the coordinates of the center
1371  of the texel */
1372  coord.y = (y + 0.5f) / desc.Height;
1373 
1374  for (x = 0; x < desc.Width; x++)
1375  {
1376  coord.x = (x + 0.5f) / desc.Width;
1377 
1378  function(&value, &coord, &size, funcdata);
1379 
1380  fill_texture(format, data + y * lock_rect.Pitch + x * format->bytes_per_pixel, &value);
1381  }
1382  }
1383  if (FAILED(hr = unlock_surface(surface, NULL, temp_surface, TRUE)))
1384  {
1385  IDirect3DSurface9_Release(surface);
1386  return hr;
1387  }
1388  IDirect3DSurface9_Release(surface);
1389  }
1390 
1391  return D3D_OK;
1392 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
Definition: pdh_main.c:93
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
#define IDirect3DTexture9_GetSurfaceLevel(p, a, b)
Definition: d3d9.h:1033
#define D3DERR_INVALIDCALL
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLfloat * m
Definition: glext.h:10848
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define IDirect3DTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:1032
GLuint coord
Definition: glext.h:9511
static const WCHAR desc[]
Definition: protectdata.c:36
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei const GLfloat * value
Definition: glext.h:6069
unsigned char BYTE
Definition: xxhash.c:193
#define D3D_OK
Definition: d3d.h:106
HRESULT unlock_surface(IDirect3DSurface9 *surface, const RECT *surface_rect, IDirect3DSurface9 *temp_surface, BOOL update) DECLSPEC_HIDDEN
Definition: surface.c:267
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static void fill_texture(const struct pixel_format_desc *format, BYTE *pos, const D3DXVECTOR4 *value)
Definition: texture.c:1267
HRESULT lock_surface(IDirect3DSurface9 *surface, const RECT *surface_rect, D3DLOCKED_RECT *lock, IDirect3DSurface9 **temp_surface, BOOL write) DECLSPEC_HIDDEN
Definition: surface.c:209
const struct pixel_format_desc * get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: util.c:217
#define IDirect3DBaseTexture9_GetLevelCount(p)
Definition: d3d9.h:848

Referenced by test_D3DXFillTexture().

◆ D3DXFillTextureTX()

HRESULT WINAPI D3DXFillTextureTX ( struct IDirect3DTexture9 *  texture,
ID3DXTextureShader *  texture_shader 
)

Definition at line 1394 of file texture.c.

1395 {
1396  FIXME("texture %p, texture_shader %p stub.\n", texture, texture_shader);
1397  return E_NOTIMPL;
1398 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLenum GLuint texture
Definition: glext.h:6295
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by test_texture_shader().

◆ D3DXFillVolumeTexture()

HRESULT WINAPI D3DXFillVolumeTexture ( struct IDirect3DVolumeTexture9 *  volume,
LPD3DXFILL3D  function,
void data 
)

Definition at line 1769 of file texture.c.

1770 {
1771  DWORD miplevels;
1772  DWORD m, x, y, z;
1774  D3DLOCKED_BOX lock_box;
1777  const struct pixel_format_desc *format;
1778  BYTE *data;
1779 
1780  if (texture == NULL || function == NULL)
1781  return D3DERR_INVALIDCALL;
1782 
1784 
1785  for (m = 0; m < miplevels; m++)
1786  {
1788  return D3DERR_INVALIDCALL;
1789 
1790  format = get_format_info(desc.Format);
1791  if (format->type != FORMAT_ARGB && format->type != FORMAT_ARGBF16 && format->type != FORMAT_ARGBF)
1792  {
1793  FIXME("Unsupported texture format %#x\n", desc.Format);
1794  return D3DERR_INVALIDCALL;
1795  }
1796 
1798  return D3DERR_INVALIDCALL;
1799 
1800  size.x = 1.0f / desc.Width;
1801  size.y = 1.0f / desc.Height;
1802  size.z = 1.0f / desc.Depth;
1803 
1804  data = lock_box.pBits;
1805 
1806  for (z = 0; z < desc.Depth; z++)
1807  {
1808  /* The callback function expects the coordinates of the center
1809  of the texel */
1810  coord.z = (z + 0.5f) / desc.Depth;
1811 
1812  for (y = 0; y < desc.Height; y++)
1813  {
1814  coord.y = (y + 0.5f) / desc.Height;
1815 
1816  for (x = 0; x < desc.Width; x++)
1817  {
1818  coord.x = (x + 0.5f) / desc.Width;
1819 
1820  function(&value, &coord, &size, funcdata);
1821 
1822  fill_texture(format, data + z * lock_box.SlicePitch + y * lock_box.RowPitch
1823  + x * format->bytes_per_pixel, &value);
1824  }
1825  }
1826  }
1828  }
1829 
1830  return D3D_OK;
1831 }
Definition: pdh_main.c:93
#define IDirect3DVolumeTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:1127
#define D3DLOCK_DISCARD
Definition: d3d8types.h:72
#define D3DERR_INVALIDCALL
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
const GLfloat * m
Definition: glext.h:10848
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define IDirect3DVolumeTexture9_UnlockBox(p, a)
Definition: d3d9.h:1130
GLuint coord
Definition: glext.h:9511
static const WCHAR desc[]
Definition: protectdata.c:36
#define FIXME(fmt,...)
Definition: debug.h:111
GLdouble GLdouble z
Definition: glext.h:5874
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint texture
Definition: glext.h:6295
#define for
Definition: utility.h:88
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLsizei const GLfloat * value
Definition: glext.h:6069
unsigned char BYTE
Definition: xxhash.c:193
#define IDirect3DVolumeTexture9_LockBox(p, a, b, c, d)
Definition: d3d9.h:1129
#define D3D_OK
Definition: d3d.h:106
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static void fill_texture(const struct pixel_format_desc *format, BYTE *pos, const D3DXVECTOR4 *value)
Definition: texture.c:1267
const struct pixel_format_desc * get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: util.c:217
#define IDirect3DBaseTexture9_GetLevelCount(p)
Definition: d3d9.h:848

Referenced by test_D3DXFillVolumeTexture().

◆ D3DXFillVolumeTextureTX()

HRESULT WINAPI D3DXFillVolumeTextureTX ( struct IDirect3DVolumeTexture9 *  volume,
ID3DXTextureShader *  texture_shader 
)

Definition at line 1833 of file texture.c.

1834 {
1835  FIXME("texture %p, texture_shader %p stub.\n", texture, texture_shader);
1836  return E_NOTIMPL;
1837 }
#define FIXME(fmt,...)
Definition: debug.h:111
GLenum GLuint texture
Definition: glext.h:6295
#define E_NOTIMPL
Definition: ddrawi.h:99

Referenced by test_texture_shader().

◆ D3DXFilterTexture()

HRESULT WINAPI D3DXFilterTexture ( struct IDirect3DBaseTexture9 *  texture,
const PALETTEENTRY palette,
UINT  srclevel,
DWORD  filter 
)

Definition at line 52 of file texture.c.

56 {
57  UINT level;
58  HRESULT hr;
60 
61  TRACE("(%p, %p, %u, %#x)\n", texture, palette, srclevel, filter);
62 
63  if (!texture)
64  return D3DERR_INVALIDCALL;
65 
66  if ((filter & 0xFFFF) > D3DX_FILTER_BOX && filter != D3DX_DEFAULT)
67  return D3DERR_INVALIDCALL;
68 
69  if (srclevel == D3DX_DEFAULT)
70  srclevel = 0;
71  else if (srclevel >= IDirect3DBaseTexture9_GetLevelCount(texture))
72  return D3DERR_INVALIDCALL;
73 
75  {
76  case D3DRTYPE_TEXTURE:
78  {
79  IDirect3DSurface9 *topsurf, *mipsurf;
81  int i, numfaces;
82 
83  if (type == D3DRTYPE_TEXTURE)
84  {
85  numfaces = 1;
86  IDirect3DTexture9_GetLevelDesc((IDirect3DTexture9*) texture, srclevel, &desc);
87  }
88  else
89  {
90  numfaces = 6;
91  IDirect3DCubeTexture9_GetLevelDesc((IDirect3DTexture9*) texture, srclevel, &desc);
92  }
93 
94  if (filter == D3DX_DEFAULT)
95  {
96  if (is_pow2(desc.Width) && is_pow2(desc.Height))
98  else
100  }
101 
102  for (i = 0; i < numfaces; i++)
103  {
104  level = srclevel + 1;
105  hr = get_surface(type, texture, i, srclevel, &topsurf);
106 
107  if (FAILED(hr))
108  return D3DERR_INVALIDCALL;
109 
110  while (get_surface(type, texture, i, level, &mipsurf) == D3D_OK)
111  {
112  hr = D3DXLoadSurfaceFromSurface(mipsurf, palette, NULL, topsurf, palette, NULL, filter, 0);
113  IDirect3DSurface9_Release(topsurf);
114  topsurf = mipsurf;
115 
116  if (FAILED(hr))
117  break;
118 
119  level++;
120  }
121 
122  IDirect3DSurface9_Release(topsurf);
123  if (FAILED(hr))
124  return hr;
125  }
126 
127  return D3D_OK;
128  }
129 
131  {
133  int level, level_count;
134  IDirect3DVolume9 *top_volume, *mip_volume;
135  IDirect3DVolumeTexture9 *volume_texture = (IDirect3DVolumeTexture9*) texture;
136 
137  IDirect3DVolumeTexture9_GetLevelDesc(volume_texture, srclevel, &desc);
138 
139  if (filter == D3DX_DEFAULT)
140  {
141  if (is_pow2(desc.Width) && is_pow2(desc.Height) && is_pow2(desc.Depth))
143  else
145  }
146 
147  hr = IDirect3DVolumeTexture9_GetVolumeLevel(volume_texture, srclevel, &top_volume);
148  if (FAILED(hr))
149  return hr;
150 
151  level_count = IDirect3DVolumeTexture9_GetLevelCount(volume_texture);
152  for (level = srclevel + 1; level < level_count; level++)
153  {
154  IDirect3DVolumeTexture9_GetVolumeLevel(volume_texture, level, &mip_volume);
155  hr = D3DXLoadVolumeFromVolume(mip_volume, palette, NULL, top_volume, palette, NULL, filter, 0);
156  IDirect3DVolume9_Release(top_volume);
157  top_volume = mip_volume;
158 
159  if (FAILED(hr))
160  break;
161  }
162 
163  IDirect3DVolume9_Release(top_volume);
164  if (FAILED(hr))
165  return hr;
166 
167  return D3D_OK;
168  }
169 
170  default:
171  return D3DERR_INVALIDCALL;
172  }
173 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
GLint level
Definition: gl.h:1546
#define IDirect3DVolumeTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:1127
#define IDirect3DCubeTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:937
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI D3DXLoadSurfaceFromSurface(IDirect3DSurface9 *dst_surface, const PALETTEENTRY *dst_palette, const RECT *dst_rect, IDirect3DSurface9 *src_surface, const PALETTEENTRY *src_palette, const RECT *src_rect, DWORD filter, D3DCOLOR color_key)
Definition: surface.c:2233
#define IDirect3DVolumeTexture9_GetLevelCount(p)
Definition: d3d9.h:1122
#define D3DERR_INVALIDCALL
#define IDirect3DTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:1032
static const WCHAR desc[]
Definition: protectdata.c:36
HRESULT WINAPI D3DXLoadVolumeFromVolume(IDirect3DVolume9 *dst_volume, const PALETTEENTRY *dst_palette, const D3DBOX *dst_box, IDirect3DVolume9 *src_volume, const PALETTEENTRY *src_palette, const D3DBOX *src_box, DWORD filter, D3DCOLOR color_key)
Definition: volume.c:291
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define D3DX_FILTER_BOX
Definition: d3dx9tex.h:31
#define IDirect3DBaseTexture9_GetType(p)
Definition: d3d9.h:844
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
#define IDirect3DVolume9_Release(p)
Definition: d3d9.h:383
static HRESULT get_surface(D3DRESOURCETYPE type, struct IDirect3DBaseTexture9 *tex, int face, UINT level, struct IDirect3DSurface9 **surf)
Definition: texture.c:37
static HPALETTE palette
Definition: clipboard.c:1345
#define D3D_OK
Definition: d3d.h:106
#define D3DX_FILTER_DITHER
Definition: d3dx9tex.h:36
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define IDirect3DVolumeTexture9_GetVolumeLevel(p, a, b)
Definition: d3d9.h:1128
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static BOOL is_pow2(UINT num)
Definition: texture.c:32
#define IDirect3DBaseTexture9_GetLevelCount(p)
Definition: d3d9.h:848
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
enum _D3DRESOURCETYPE D3DRESOURCETYPE

Referenced by D3DXCreateCubeTextureFromFileInMemoryEx(), D3DXCreateTextureFromFileInMemoryEx(), D3DXRenderToEnvMap_End(), and test_D3DXFilterTexture().

◆ D3DXGetImageInfoFromFileA()

HRESULT WINAPI D3DXGetImageInfoFromFileA ( const char file,
D3DXIMAGE_INFO info 
)

Definition at line 1135 of file surface.c.

1136 {
1137  WCHAR *widename;
1138  HRESULT hr;
1139  int strlength;
1140 
1141  TRACE("file %s, info %p.\n", debugstr_a(file), info);
1142 
1143  if( !file ) return D3DERR_INVALIDCALL;
1144 
1145  strlength = MultiByteToWideChar(CP_ACP, 0, file, -1, NULL, 0);
1146  widename = HeapAlloc(GetProcessHeap(), 0, strlength * sizeof(*widename));
1147  MultiByteToWideChar(CP_ACP, 0, file, -1, widename, strlength);
1148 
1149  hr = D3DXGetImageInfoFromFileW(widename, info);
1150  HeapFree(GetProcessHeap(), 0, widename);
1151 
1152  return hr;
1153 }
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:109
#define D3DERR_INVALIDCALL
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI D3DXGetImageInfoFromFileW(const WCHAR *file, D3DXIMAGE_INFO *info)
Definition: surface.c:1155
#define NULL
Definition: types.h:112
#define MultiByteToWideChar
Definition: compat.h:110
#define HeapFree(x, y, z)
Definition: compat.h:594
Definition: fci.c:126

Referenced by test_D3DXGetImageInfo().

◆ D3DXGetImageInfoFromFileInMemory()

HRESULT WINAPI D3DXGetImageInfoFromFileInMemory ( const void data,
UINT  data_size,
D3DXIMAGE_INFO info 
)

Definition at line 985 of file surface.c.

986 {
988  IWICBitmapDecoder *decoder = NULL;
990  HRESULT hr;
991  BOOL dib;
992 
993  TRACE("(%p, %d, %p)\n", data, datasize, info);
994 
995  if (!data || !datasize)
996  return D3DERR_INVALIDCALL;
997 
998  if (!info)
999  return D3D_OK;
1000 
1001  if ((datasize >= 4) && !strncmp(data, "DDS ", 4)) {
1002  TRACE("File type is DDS\n");
1004  }
1005 
1006  /* In case of DIB file, convert it to BMP */
1008 
1009  hr = WICCreateImagingFactory_Proxy(WINCODEC_SDK_VERSION, &factory);
1010 
1011  if (SUCCEEDED(hr)) {
1012  IWICImagingFactory_CreateStream(factory, &stream);
1013  IWICStream_InitializeFromMemory(stream, (BYTE*)data, datasize);
1014  hr = IWICImagingFactory_CreateDecoderFromStream(factory, (