ReactOS  0.4.13-dev-259-g5ca9c9c
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 417 of file texture.c.

419 {
420  D3DCAPS9 caps;
421  UINT s = (size && *size) ? *size : 256;
422  HRESULT hr;
423 
424  TRACE("(%p, %p, %p, %u, %p, %u)\n", device, size, miplevels, usage, format, pool);
425 
426  if (s == D3DX_DEFAULT)
427  s = 256;
428 
430  return D3DERR_INVALIDCALL;
431 
432  if (!(caps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP))
433  return D3DERR_NOTAVAILABLE;
434 
435  /* ensure width/height is power of 2 */
437  s = make_pow2(s);
438 
439  hr = D3DXCheckTextureRequirements(device, &s, &s, miplevels, usage, format, pool);
440 
442  {
443  if(miplevels)
444  *miplevels = 1;
445  }
446 
447  if (size)
448  *size = s;
449 
450  return hr;
451 }
DWORD TextureCaps
Definition: d3d9caps.h:279
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:209
#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 BOOL is_pow2(UINT num)
Definition: texture.c:30
#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:77
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLdouble s
Definition: gl.h:2039
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
unsigned int UINT
Definition: ndis.h:50
static UINT make_pow2(UINT num)
Definition: texture.c:36
#define D3DPTEXTURECAPS_MIPCUBEMAP
Definition: d3d8caps.h:125

Referenced by D3DXCreateCubeTexture(), and D3DXCreateCubeTextureFromFileInMemoryEx().

◆ D3DXCheckTextureRequirements()

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

Definition at line 209 of file texture.c.

211 {
212  UINT w = (width && *width) ? *width : 1;
213  UINT h = (height && *height) ? *height : 1;
214  D3DCAPS9 caps;
216  IDirect3D9 *d3d = NULL;
218  HRESULT hr;
219  D3DFORMAT usedformat = D3DFMT_UNKNOWN;
220  const struct pixel_format_desc *fmt;
221 
222  TRACE("(%p, %p, %p, %p, %u, %p, %u)\n", device, width, height, miplevels, usage, format, pool);
223 
224  if (!device)
225  return D3DERR_INVALIDCALL;
226 
227  /* usage */
228  if (usage == D3DX_DEFAULT)
229  usage = 0;
231  return D3DERR_INVALIDCALL;
232 
233  /* pool */
235  return D3DERR_INVALIDCALL;
236 
237  /* format */
238  if (format)
239  {
240  TRACE("Requested format %x\n", *format);
241  usedformat = *format;
242  }
243 
245 
246  if (FAILED(hr))
247  goto cleanup;
248 
250 
251  if (FAILED(hr))
252  goto cleanup;
253 
255 
256  if (FAILED(hr))
257  goto cleanup;
258 
259  if ((usedformat == D3DFMT_UNKNOWN) || (usedformat == D3DX_DEFAULT))
260  usedformat = D3DFMT_A8R8G8B8;
261 
262  fmt = get_format_info(usedformat);
263 
264  hr = IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType, mode.Format,
265  usage, D3DRTYPE_TEXTURE, usedformat);
266  if (FAILED(hr))
267  {
268  BOOL allow_24bits;
269  int bestscore = INT_MIN, i = 0, j;
270  unsigned int channels;
271  const struct pixel_format_desc *curfmt, *bestfmt = NULL;
272 
273  TRACE("Requested format is not supported, looking for a fallback.\n");
274 
275  if (!fmt)
276  {
277  FIXME("Pixel format %x not handled\n", usedformat);
278  goto cleanup;
279  }
281 
282  allow_24bits = fmt->bytes_per_pixel == 3;
283  channels = !!fmt->bits[0] + !!fmt->bits[1] + !!fmt->bits[2] + !!fmt->bits[3];
284  usedformat = D3DFMT_UNKNOWN;
285 
286  while ((curfmt = get_format_info_idx(i)))
287  {
288  unsigned int curchannels = !!curfmt->bits[0] + !!curfmt->bits[1]
289  + !!curfmt->bits[2] + !!curfmt->bits[3];
290  int score;
291 
292  i++;
293 
294  if (curchannels < channels)
295  continue;
296  if (curfmt->bytes_per_pixel == 3 && !allow_24bits)
297  continue;
298 
299  hr = IDirect3D9_CheckDeviceFormat(d3d, params.AdapterOrdinal, params.DeviceType,
300  mode.Format, usage, D3DRTYPE_TEXTURE, curfmt->format);
301  if (FAILED(hr))
302  continue;
303 
304  /* This format can be used, let's evaluate it.
305  Weights chosen quite arbitrarily... */
306  score = 512 * (curfmt->type == fmt->type);
307  score -= 32 * (curchannels - channels);
308 
309  for (j = 0; j < 4; j++)
310  {
311  int diff = curfmt->bits[j] - fmt->bits[j];
312  score -= (diff < 0 ? -diff * 8 : diff) * (j == 0 ? 1 : 2);
313  }
314 
315  if (score > bestscore)
316  {
317  bestscore = score;
318  usedformat = curfmt->format;
319  bestfmt = curfmt;
320  }
321  }
322  fmt = bestfmt;
323  hr = D3D_OK;
324  }
325 
327  return D3DERR_INVALIDCALL;
328 
329  if ((w == D3DX_DEFAULT) && (h == D3DX_DEFAULT))
330  w = h = 256;
331  else if (w == D3DX_DEFAULT)
332  w = (height ? h : 256);
333  else if (h == D3DX_DEFAULT)
334  h = (width ? w : 256);
335 
336  if (fmt->block_width != 1 || fmt->block_height != 1)
337  {
338  if (w % fmt->block_width)
339  w += fmt->block_width - w % fmt->block_width;
340  if (h % fmt->block_height)
341  h += fmt->block_height - h % fmt->block_height;
342  }
343 
344  if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(w)))
345  w = make_pow2(w);
346 
347  if (w > caps.MaxTextureWidth)
348  w = caps.MaxTextureWidth;
349 
350  if ((caps.TextureCaps & D3DPTEXTURECAPS_POW2) && (!is_pow2(h)))
351  h = make_pow2(h);
352 
353  if (h > caps.MaxTextureHeight)
354  h = caps.MaxTextureHeight;
355 
357  {
358  if (w > h)
359  h = w;
360  else
361  w = h;
362  }
363 
364  if (width)
365  *width = w;
366 
367  if (height)
368  *height = h;
369 
370  if (miplevels && (usage & D3DUSAGE_AUTOGENMIPMAP))
371  {
372  if (*miplevels > 1)
373  *miplevels = 0;
374  }
375  else if (miplevels)
376  {
377  UINT max_mipmaps = 1;
378 
379  if (!width && !height)
380  max_mipmaps = 9; /* number of mipmaps in a 256x256 texture */
381  else
382  {
383  UINT max_dimen = max(w, h);
384 
385  while (max_dimen > 1)
386  {
387  max_dimen >>= 1;
388  max_mipmaps++;
389  }
390  }
391 
392  if (*miplevels == 0 || *miplevels > max_mipmaps)
393  *miplevels = max_mipmaps;
394  }
395 
396 cleanup:
397 
398  if (d3d)
399  IDirect3D9_Release(d3d);
400 
401  if (FAILED(hr))
402  return hr;
403 
404  if (usedformat == D3DFMT_UNKNOWN)
405  {
406  WARN("Couldn't find a suitable pixel format\n");
407  return D3DERR_NOTAVAILABLE;
408  }
409 
410  TRACE("Format chosen: %x\n", usedformat);
411  if (format)
412  *format = usedformat;
413 
414  return D3D_OK;
415 }
#define IDirect3D9_CheckDeviceFormat(p, a, b, c, d, e, f)
Definition: d3d9.h:229
static D3DFORMAT get_luminance_replacement_format(D3DFORMAT format)
Definition: texture.c:188
GLint GLint GLsizei width
Definition: gl.h:1546
#define max(a, b)
Definition: svc.c:63
#define D3DPTEXTURECAPS_POW2
Definition: d3d8caps.h:114
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
DWORD TextureCaps
Definition: d3d9caps.h:279
HRESULT hr
Definition: shlfolder.c:183
#define IDirect3DDevice9_GetCreationParameters(p, a)
Definition: d3d9.h:1516
#define D3DUSAGE_AUTOGENMIPMAP
Definition: d3d9types.h:113
#define WARN(fmt,...)
Definition: debug.h:111
int bits
Definition: dsound.c:944
#define D3DUSAGE_POINTS
Definition: d3d8types.h:96
const char * fmt
Definition: wsprintf.c:30
DWORD MaxTextureHeight
Definition: d3d9caps.h:287
#define D3DUSAGE_DONOTCLIP
Definition: d3d8types.h:95
#define D3DERR_INVALIDCALL
int This channels
Definition: rdpsnd_libao.c:37
#define D3DUSAGE_WRITEONLY
Definition: d3d8types.h:93
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define IDirect3D9_Release(p)
Definition: d3d9.h:220
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
GLenum const GLfloat * params
Definition: glext.h:5645
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
DWORD MaxTextureWidth
Definition: d3d9caps.h:286
#define FIXME(fmt,...)
Definition: debug.h:110
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
static BOOL is_pow2(UINT num)
Definition: texture.c:30
#define D3DPTEXTURECAPS_SQUAREONLY
Definition: d3d8caps.h:116
const struct pixel_format_desc * get_format_info_idx(int idx) DECLSPEC_HIDDEN
Definition: util.c:222
smooth NULL
Definition: ftsmooth.c:416
enum _D3DFORMAT D3DFORMAT
#define IDirect3DDevice9_GetDisplayMode(p, a, b)
Definition: d3d9.h:1515
#define D3DUSAGE_NPATCHES
Definition: d3d8types.h:98
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 GLint GLint j
Definition: glfuncs.h:250
#define IDirect3DDevice9_GetDirect3D(p, a)
Definition: d3d9.h:1513
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
enum format_type type
Definition: d3dx9_private.h:65
#define D3DUSAGE_RTPATCHES
Definition: d3d8types.h:97
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLenum mode
Definition: glext.h:6217
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define INT_MIN
Definition: limits.h:39
#define D3D_OK
Definition: d3d.h:106
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
unsigned int UINT
Definition: ndis.h:50
static UINT make_pow2(UINT num)
Definition: texture.c:36
char * cleanup(char *str)
Definition: wpickclick.c:99
const struct pixel_format_desc * get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: util.c:213
Definition: dsound.c:943

Referenced by D3DXCheckCubeTextureRequirements(), D3DXCheckVolumeTextureRequirements(), D3DXCreateRenderToEnvMap(), D3DXCreateTexture(), and D3DXCreateTextureFromFileInMemoryEx().

◆ D3DXCheckVolumeTextureRequirements()

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

Definition at line 453 of file texture.c.

455 {
456  D3DCAPS9 caps;
457  UINT w = width ? *width : D3DX_DEFAULT;
459  UINT d = (depth && *depth) ? *depth : 1;
460  HRESULT hr;
461 
462  TRACE("(%p, %p, %p, %p, %p, %u, %p, %u)\n", device, width, height, depth, miplevels,
463  usage, format, pool);
464 
466  return D3DERR_INVALIDCALL;
467 
469  return D3DERR_NOTAVAILABLE;
470 
472  if (d == D3DX_DEFAULT)
473  d = 1;
474 
475  /* ensure width/height is power of 2 */
477  (!is_pow2(w) || !is_pow2(h) || !is_pow2(d)))
478  {
479  w = make_pow2(w);
480  h = make_pow2(h);
481  d = make_pow2(d);
482  }
483 
484  if (w > caps.MaxVolumeExtent)
485  w = caps.MaxVolumeExtent;
486  if (h > caps.MaxVolumeExtent)
487  h = caps.MaxVolumeExtent;
488  if (d > caps.MaxVolumeExtent)
489  d = caps.MaxVolumeExtent;
490 
491  if (miplevels)
492  {
494  *miplevels = 1;
495  else if ((usage & D3DUSAGE_AUTOGENMIPMAP))
496  {
497  if (*miplevels > 1)
498  *miplevels = 0;
499  }
500  else
501  {
502  UINT max_mipmaps = 1;
503  UINT max_dimen = max(max(w, h), d);
504 
505  while (max_dimen > 1)
506  {
507  max_dimen >>= 1;
508  max_mipmaps++;
509  }
510 
511  if (*miplevels == 0 || *miplevels > max_mipmaps)
512  *miplevels = max_mipmaps;
513  }
514  }
515 
516  if (width)
517  *width = w;
518  if (height)
519  *height = h;
520  if (depth)
521  *depth = d;
522 
523  return hr;
524 }
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
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:209
#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 BOOL is_pow2(UINT num)
Definition: texture.c:30
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define d
Definition: ke_i.h:81
LONG HRESULT
Definition: typedefs.h:77
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
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
static UINT make_pow2(UINT num)
Definition: texture.c:36
#define D3DPTEXTURECAPS_VOLUMEMAP_POW2
Definition: d3d8caps.h:127
#define D3DPTEXTURECAPS_VOLUMEMAP
Definition: d3d8caps.h:122

Referenced by D3DXCreateVolumeTexture(), and D3DXCreateVolumeTextureFromFileInMemoryEx().

◆ D3DXComputeNormalMap()

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

Definition at line 1920 of file texture.c.

1922 {
1923  FIXME("texture %p, src_texture %p, src_palette %p, flags %#x, channel %u, amplitude %.8e stub.\n",
1924  texture, src_texture, src_palette, flags, channel, amplitude);
1925 
1926  return D3D_OK;
1927 }
#define FIXME(fmt,...)
Definition: debug.h:110
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 hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#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:77
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
HRESULT WINAPI D3DXCheckCubeTextureRequirements(struct IDirect3DDevice9 *device, UINT *size, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:417
#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 1524 of file texture.c.

1527 {
1528  int len;
1529  HRESULT hr;
1530  WCHAR *filename;
1531  void *data;
1532  DWORD data_size;
1533 
1534  TRACE("(%p, %s, %p): relay\n", device, wine_dbgstr_a(src_filename), cube_texture);
1535 
1536  if (!src_filename) return D3DERR_INVALIDCALL;
1537 
1538  len = MultiByteToWideChar(CP_ACP, 0, src_filename, -1, NULL, 0);
1539  filename = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1540  if (!filename) return E_OUTOFMEMORY;
1541  MultiByteToWideChar(CP_ACP, 0, src_filename, -1, filename, len);
1542 
1543  hr = map_view_of_file(filename, &data, &data_size);
1544  if (FAILED(hr))
1545  {
1547  return D3DXERR_INVALIDDATA;
1548  }
1549 
1552 
1555  return hr;
1556 }
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:99
#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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
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:1387
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:118
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
#define UnmapViewOfFile
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ 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 1578 of file texture.c.

1591 {
1592  int len;
1593  HRESULT hr;
1594  WCHAR *filename;
1595  void *data;
1596  DWORD data_size;
1597 
1598  TRACE("(%p, %s, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p): relay\n",
1599  device, wine_dbgstr_a(src_filename), size, mip_levels, usage, format,
1600  pool, filter, mip_filter, color_key, image_info, palette, cube_texture);
1601 
1602  if (!src_filename) return D3DERR_INVALIDCALL;
1603 
1604  len = MultiByteToWideChar(CP_ACP, 0, src_filename, -1, NULL, 0);
1605  filename = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
1606  if (!filename) return E_OUTOFMEMORY;
1607  MultiByteToWideChar(CP_ACP, 0, src_filename, -1, filename, len);
1608 
1609  hr = map_view_of_file(filename, &data, &data_size);
1610  if (FAILED(hr))
1611  {
1613  return D3DXERR_INVALIDDATA;
1614  }
1615 
1616  hr = D3DXCreateCubeTextureFromFileInMemoryEx(device, data, data_size, size, mip_levels,
1617  usage, format, pool, filter, mip_filter, color_key, image_info, palette, cube_texture);
1618 
1621  return hr;
1622 }
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:99
#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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
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:1387
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:118
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLenum GLsizei len
Definition: glext.h:6722
static HPALETTE palette
Definition: clipboard.c:1345
#define MultiByteToWideChar
Definition: compat.h:100
#define UnmapViewOfFile
Definition: compat.h:403
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ 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 1624 of file texture.c.

1637 {
1638  HRESULT hr;
1639  void *data;
1640  DWORD data_size;
1641 
1642  TRACE("(%p, %s, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p): relay\n",
1643  device, wine_dbgstr_w(src_filename), size, mip_levels, usage, format,
1644  pool, filter, mip_filter, color_key, image_info, palette, cube_texture);
1645 
1646  hr = map_view_of_file(src_filename, &data, &data_size);
1647  if (FAILED(hr)) return D3DXERR_INVALIDDATA;
1648 
1649  hr = D3DXCreateCubeTextureFromFileInMemoryEx(device, data, data_size, size, mip_levels,
1650  usage, format, pool, filter, mip_filter, color_key, image_info, palette, cube_texture);
1651 
1653  return hr;
1654 }
HRESULT hr
Definition: shlfolder.c:183
#define wine_dbgstr_w
Definition: kernel32.h:34
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:77
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:1387
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:118
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
static HPALETTE palette
Definition: clipboard.c:1345
#define UnmapViewOfFile
Definition: compat.h:403
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
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:1387
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ 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 1387 of file texture.c.

1401 {
1402  HRESULT hr;
1403  D3DCAPS9 caps;
1404  UINT loaded_miplevels;
1405  D3DXIMAGE_INFO img_info;
1406  BOOL dynamic_texture;
1407  BOOL file_size = FALSE;
1408  BOOL file_format = FALSE;
1409  BOOL file_mip_levels = FALSE;
1410  IDirect3DCubeTexture9 *tex, *buftex;
1411 
1412  TRACE("(%p, %p, %u, %u, %u, %#x, %#x, %#x, %#x, %#x, %#x, %p, %p, %p)\n", device,
1413  src_data, src_data_size, size, mip_levels, usage, format, pool, filter, mip_filter,
1414  color_key, src_info, palette, cube_texture);
1415 
1416  if (!device || !cube_texture || !src_data || !src_data_size)
1417  return D3DERR_INVALIDCALL;
1418 
1419  hr = D3DXGetImageInfoFromFileInMemory(src_data, src_data_size, &img_info);
1420  if (FAILED(hr))
1421  return hr;
1422 
1423  if (img_info.ImageFileFormat != D3DXIFF_DDS)
1424  return D3DXERR_INVALIDDATA;
1425 
1426  if (img_info.Width != img_info.Height)
1427  return D3DXERR_INVALIDDATA;
1428 
1429  if (size == 0 || size == D3DX_DEFAULT_NONPOW2)
1430  size = img_info.Width;
1431  if (size == D3DX_DEFAULT)
1432  size = make_pow2(img_info.Width);
1433 
1435  format = img_info.Format;
1436 
1437  if (size == D3DX_FROM_FILE)
1438  {
1439  file_size = TRUE;
1440  size = img_info.Width;
1441  }
1442 
1443  if (format == D3DFMT_FROM_FILE)
1444  {
1445  file_format = TRUE;
1446  format = img_info.Format;
1447  }
1448 
1449  if (mip_levels == D3DX_FROM_FILE)
1450  {
1451  file_mip_levels = TRUE;
1452  mip_levels = img_info.MipLevels;
1453  }
1454 
1456  if (FAILED(hr))
1457  return hr;
1458 
1459  if ((file_size && size != img_info.Width)
1460  || (file_format && format != img_info.Format)
1461  || (file_mip_levels && mip_levels != img_info.MipLevels))
1462  return D3DERR_NOTAVAILABLE;
1463 
1465  if (FAILED(hr))
1466  return D3DERR_INVALIDCALL;
1467 
1468  if (mip_levels > img_info.MipLevels && (D3DFMT_DXT1 <= img_info.Format && img_info.Format <= D3DFMT_DXT5))
1469  {
1470  FIXME("Generation of mipmaps for compressed pixel formats is not supported yet.\n");
1471  mip_levels = img_info.MipLevels;
1472  }
1473 
1474  dynamic_texture = (caps.Caps2 & D3DCAPS2_DYNAMICTEXTURES) && (usage & D3DUSAGE_DYNAMIC);
1475  if (pool == D3DPOOL_DEFAULT && !dynamic_texture)
1476  {
1477  hr = D3DXCreateCubeTexture(device, size, mip_levels, usage, format, D3DPOOL_SYSTEMMEM, &buftex);
1478  tex = buftex;
1479  }
1480  else
1481  {
1482  hr = D3DXCreateCubeTexture(device, size, mip_levels, usage, format, pool, &tex);
1483  buftex = NULL;
1484  }
1485  if (FAILED(hr))
1486  return hr;
1487 
1488  hr = load_cube_texture_from_dds(tex, src_data, palette, filter, color_key, &img_info);
1489  if (FAILED(hr))
1490  {
1492  return hr;
1493  }
1494 
1495  loaded_miplevels = min(IDirect3DCubeTexture9_GetLevelCount(tex), img_info.MipLevels);
1496  hr = D3DXFilterTexture((IDirect3DBaseTexture9*) tex, palette, loaded_miplevels - 1, mip_filter);
1497  if (FAILED(hr))
1498  {
1500  return hr;
1501  }
1502 
1503  if (buftex)
1504  {
1505  hr = D3DXCreateCubeTexture(device, size, mip_levels, usage, format, pool, &tex);
1506  if (FAILED(hr))
1507  {
1509  return hr;
1510  }
1511 
1512  IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)buftex, (IDirect3DBaseTexture9 *)tex);
1514  }
1515 
1516  if (src_info)
1517  *src_info = img_info;
1518 
1519  *cube_texture = tex;
1520  return D3D_OK;
1521 }
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
#define IDirect3DCubeTexture9_GetLevelCount(p)
Definition: d3d9.h:932
#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
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:110
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
smooth NULL
Definition: ftsmooth.c:416
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
HRESULT WINAPI D3DXCreateCubeTexture(struct IDirect3DDevice9 *device, UINT size, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, struct IDirect3DCubeTexture9 **texture)
Definition: texture.c:913
D3DFORMAT Format
Definition: d3dx9tex.h:82
LONG HRESULT
Definition: typedefs.h:77
#define D3DX_DEFAULT_NONPOW2
Definition: d3dx9.h:25
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
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
HRESULT WINAPI D3DXCheckCubeTextureRequirements(struct IDirect3DDevice9 *device, UINT *size, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:417
static UINT make_pow2(UINT num)
Definition: texture.c:36
HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize, D3DXIMAGE_INFO *info)
Definition: surface.c:875
HRESULT WINAPI D3DXFilterTexture(IDirect3DBaseTexture9 *texture, const PALETTEENTRY *palette, UINT srclevel, DWORD filter)
Definition: texture.c:65
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define file_size(inode)
Definition: reiserfs_fs.h:1869
#define D3DCAPS2_DYNAMICTEXTURES
Definition: d3d8caps.h:25

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

◆ D3DXCreateCubeTextureFromFileW()

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

Definition at line 1558 of file texture.c.

1561 {
1562  HRESULT hr;
1563  void *data;
1564  DWORD data_size;
1565 
1566  TRACE("(%p, %s, %p): relay\n", device, wine_dbgstr_w(src_filename), cube_texture);
1567 
1568  hr = map_view_of_file(src_filename, &data, &data_size);
1569  if (FAILED(hr)) return D3DXERR_INVALIDDATA;
1570 
1573 
1575  return hr;
1576 }
HRESULT hr
Definition: shlfolder.c:183
#define wine_dbgstr_w
Definition: kernel32.h:34
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
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:1387
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:118
#define UnmapViewOfFile
Definition: compat.h:403

◆ 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 526 of file texture.c.

528 {
529  HRESULT hr;
530 
531  TRACE("device %p, width %u, height %u, miplevels %u, usage %#x, format %#x, pool %#x, texture %p.\n",
532  device, width, height, miplevels, usage, format, pool, texture);
533 
534  if (!device || !texture)
535  return D3DERR_INVALIDCALL;
536 
538  return hr;
539 
541 }
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:209
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:77
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

Referenced by D3DXCreateTextureFromFileInMemoryEx(), and ID3DXFontImpl_DrawTextW().

◆ 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
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
GLenum GLuint texture
Definition: glext.h:6295

◆ 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 }
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:760
GLint GLint GLsizei width
Definition: gl.h:1546
HRESULT hr
Definition: shlfolder.c:183
#define CP_ACP
Definition: compat.h:99
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
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:77
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 MultiByteToWideChar
Definition: compat.h:100
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define HeapFree(x, y, z)
Definition: compat.h:394

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 760 of file texture.c.

764 {
765  void *buffer;
766  HRESULT hr;
767  DWORD size;
768 
769  TRACE("device %p, srcfile %s, width %u, height %u, miplevels %u, usage %#x, format %#x, "
770  "pool %#x, filter %#x, mipfilter %#x, colorkey 0x%08x, srcinfo %p, palette %p, texture %p.\n",
771  device, debugstr_w(srcfile), width, height, miplevels, usage, format,
772  pool, filter, mipfilter, colorkey, srcinfo, palette, texture);
773 
774  if (!srcfile)
775  return D3DERR_INVALIDCALL;
776 
777  hr = map_view_of_file(srcfile, &buffer, &size);
778  if (FAILED(hr))
779  return D3DXERR_INVALIDDATA;
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 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:77
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:118
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 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:566
#define UnmapViewOfFile
Definition: compat.h:403
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 751 of file texture.c.

753 {
754  TRACE("(%p, %p, %d, %p)\n", device, srcdata, srcdatasize, texture);
755 
758 }
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
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:566

◆ 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 566 of file texture.c.

570 {
571  IDirect3DTexture9 **texptr;
572  IDirect3DTexture9 *buftex;
573  IDirect3DSurface9 *surface;
574  BOOL dynamic_texture, format_specified = FALSE;
575  D3DXIMAGE_INFO imginfo;
576  UINT loaded_miplevels, skip_levels;
577  D3DCAPS9 caps;
578  HRESULT hr;
579 
580  TRACE("device %p, srcdata %p, srcdatasize %u, width %u, height %u, miplevels %u,"
581  " usage %#x, format %#x, pool %#x, filter %#x, mipfilter %#x, colorkey %#x,"
582  " srcinfo %p, palette %p, texture %p.\n",
583  device, srcdata, srcdatasize, width, height, miplevels, usage, format, pool,
584  filter, mipfilter, colorkey, srcinfo, palette, texture);
585 
586  /* check for invalid parameters */
587  if (!device || !texture || !srcdata || !srcdatasize)
588  return D3DERR_INVALIDCALL;
589 
590  hr = D3DXGetImageInfoFromFileInMemory(srcdata, srcdatasize, &imginfo);
591  if (FAILED(hr))
592  {
593  FIXME("Unrecognized file format, returning failure.\n");
594  *texture = NULL;
595  return hr;
596  }
597 
598  /* handle default values */
599  if (width == 0 || width == D3DX_DEFAULT_NONPOW2)
600  width = imginfo.Width;
601 
602  if (height == 0 || height == D3DX_DEFAULT_NONPOW2)
603  height = imginfo.Height;
604 
605  if (width == D3DX_DEFAULT)
606  width = make_pow2(imginfo.Width);
607 
608  if (height == D3DX_DEFAULT)
609  height = make_pow2(imginfo.Height);
610 
612  format = imginfo.Format;
613  else
614  format_specified = TRUE;
615 
616  if (width == D3DX_FROM_FILE)
617  {
618  width = imginfo.Width;
619  }
620 
621  if (height == D3DX_FROM_FILE)
622  {
623  height = imginfo.Height;
624  }
625 
626  if (format == D3DFMT_FROM_FILE)
627  {
628  format = imginfo.Format;
629  }
630 
631  if (miplevels == D3DX_FROM_FILE)
632  {
633  miplevels = imginfo.MipLevels;
634  }
635 
636  skip_levels = mipfilter != D3DX_DEFAULT ? mipfilter >> D3DX_SKIP_DDS_MIP_LEVELS_SHIFT : 0;
637  if (skip_levels && imginfo.MipLevels > skip_levels)
638  {
639  TRACE("Skipping the first %u (of %u) levels of a DDS mipmapped texture.\n",
640  skip_levels, imginfo.MipLevels);
641  TRACE("Texture level 0 dimensions are %ux%u.\n", imginfo.Width, imginfo.Height);
642  width >>= skip_levels;
643  height >>= skip_levels;
644  miplevels -= skip_levels;
645  }
646  else
647  {
648  skip_levels = 0;
649  }
650 
651  /* fix texture creation parameters */
653  if (FAILED(hr))
654  {
655  FIXME("Couldn't find suitable texture parameters.\n");
656  *texture = NULL;
657  return hr;
658  }
659 
660  if (colorkey && !format_specified)
662 
663  if (imginfo.MipLevels < miplevels && (D3DFMT_DXT1 <= imginfo.Format && imginfo.Format <= D3DFMT_DXT5))
664  {
665  FIXME("Generation of mipmaps for compressed pixel formats is not implemented yet.\n");
666  miplevels = imginfo.MipLevels;
667  }
668  if (imginfo.ResourceType == D3DRTYPE_VOLUMETEXTURE
669  && D3DFMT_DXT1 <= imginfo.Format && imginfo.Format <= D3DFMT_DXT5 && miplevels > 1)
670  {
671  FIXME("Generation of mipmaps for compressed pixel formats is not implemented yet.\n");
672  miplevels = 1;
673  }
674 
676  return D3DERR_INVALIDCALL;
677 
678  /* Create the to-be-filled texture */
679  dynamic_texture = (caps.Caps2 & D3DCAPS2_DYNAMICTEXTURES) && (usage & D3DUSAGE_DYNAMIC);
680  if (pool == D3DPOOL_DEFAULT && !dynamic_texture)
681  {
682  hr = D3DXCreateTexture(device, width, height, miplevels, 0, format, D3DPOOL_SYSTEMMEM, &buftex);
683  texptr = &buftex;
684  }
685  else
686  {
688  texptr = texture;
689  }
690 
691  if (FAILED(hr))
692  {
693  FIXME("Texture creation failed.\n");
694  *texture = NULL;
695  return hr;
696  }
697 
698  TRACE("Texture created correctly. Now loading the texture data into it.\n");
699  if (imginfo.ImageFileFormat != D3DXIFF_DDS)
700  {
701  IDirect3DTexture9_GetSurfaceLevel(*texptr, 0, &surface);
702  hr = D3DXLoadSurfaceFromFileInMemory(surface, palette, NULL, srcdata, srcdatasize, NULL, filter, colorkey, NULL);
703  IDirect3DSurface9_Release(surface);
704  loaded_miplevels = min(IDirect3DTexture9_GetLevelCount(*texptr), imginfo.MipLevels);
705  }
706  else
707  {
708  hr = load_texture_from_dds(*texptr, srcdata, palette, filter, colorkey, &imginfo, skip_levels,
709  &loaded_miplevels);
710  }
711 
712  if (FAILED(hr))
713  {
714  FIXME("Texture loading failed.\n");
715  IDirect3DTexture9_Release(*texptr);
716  *texture = NULL;
717  return hr;
718  }
719 
720  hr = D3DXFilterTexture((IDirect3DBaseTexture9*) *texptr, palette, loaded_miplevels - 1, mipfilter);
721  if (FAILED(hr))
722  {
723  FIXME("Texture filtering failed.\n");
724  IDirect3DTexture9_Release(*texptr);
725  *texture = NULL;
726  return hr;
727  }
728 
729  /* Move the data to the actual texture if necessary */
730  if (texptr == &buftex)
731  {
733 
734  if (FAILED(hr))
735  {
737  *texture = NULL;
738  return hr;
739  }
740 
741  IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9*)buftex, (IDirect3DBaseTexture9*)(*texture));
743  }
744 
745  if (srcinfo)
746  *srcinfo = imginfo;
747 
748  return D3D_OK;
749 }
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI D3DXCheckTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:209
#define IDirect3DTexture9_GetSurfaceLevel(p, a, b)
Definition: d3d9.h:1033
#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
D3DRESOURCETYPE ResourceType
Definition: d3dx9tex.h:83
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
UINT MipLevels
Definition: d3dx9tex.h:81
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:110
#define D3DX_DEFAULT
Definition: d3dx9.h:24
smooth NULL
Definition: ftsmooth.c:416
static D3DFORMAT get_alpha_replacement_format(D3DFORMAT format)
Definition: texture.c:543
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:77
#define D3DX_DEFAULT_NONPOW2
Definition: d3dx9.h:25
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 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
static UINT make_pow2(UINT num)
Definition: texture.c:36
HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize, D3DXIMAGE_INFO *info)
Definition: surface.c:875
HRESULT WINAPI D3DXCreateTexture(struct IDirect3DDevice9 *device, UINT width, UINT height, UINT miplevels, DWORD usage, D3DFORMAT format, D3DPOOL pool, struct IDirect3DTexture9 **texture)
Definition: texture.c:526
HRESULT WINAPI D3DXFilterTexture(IDirect3DBaseTexture9 *texture, const PALETTEENTRY *palette, UINT srclevel, DWORD filter)
Definition: texture.c:65
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:1141
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:627
#define D3DCAPS2_DYNAMICTEXTURES
Definition: d3d8caps.h:25

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

◆ 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 }
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:760
Definition: devices.h:37
#define debugstr_w
Definition: kernel32.h:32
#define D3DX_DEFAULT
Definition: d3dx9.h:24
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295

◆ 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 }
Definition: devices.h:37
#define D3DX_DEFAULT
Definition: d3dx9.h:24
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
GLenum GLuint texture
Definition: glext.h:6295

◆ 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
#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:166
#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
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:566
#define RT_BITMAP
Definition: pedump.c:364
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

Referenced by D3DXCreateTextureFromResourceA().

◆ 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
#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:166
#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
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:566
#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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
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
HRESULT WINAPI D3DXCheckVolumeTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *depth, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:453
#define D3DERR_INVALIDCALL
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:77
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546

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:99
#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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
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:77
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
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:118
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
#define UnmapViewOfFile
Definition: compat.h:403
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ 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:99
#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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
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:77
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
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:118
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
#define MultiByteToWideChar
Definition: compat.h:100
#define UnmapViewOfFile
Definition: compat.h:403
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
#define HeapFree(x, y, z)
Definition: compat.h:394

◆ 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:77
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
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:118
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
#define UnmapViewOfFile
Definition: compat.h:403
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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
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
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

◆ 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  {
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 
1239  if (FAILED(hr)) return hr;
1240 
1241  hr = load_volume_texture_from_dds(tex, data, palette, filter, color_key, &image_info);
1242  if (FAILED(hr))
1243  {
1245  return hr;
1246  }
1247 
1248  if (buftex)
1249  {
1250  hr = D3DXCreateVolumeTexture(device, width, height, depth, mip_levels, usage, format, pool, &tex);
1251  if (FAILED(hr))
1252  {
1254  return hr;
1255  }
1256 
1257  IDirect3DDevice9_UpdateTexture(device, (IDirect3DBaseTexture9 *)buftex, (IDirect3DBaseTexture9 *)tex);
1259  }
1260 
1261  if (info)
1262  *info = image_info;
1263 
1264  *volume_texture = tex;
1265  return D3D_OK;
1266 }
#define D3DUSAGE_DYNAMIC
Definition: d3d8types.h:99
GLint GLint GLsizei width
Definition: gl.h:1546
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
HRESULT WINAPI D3DXCheckVolumeTextureRequirements(struct IDirect3DDevice9 *device, UINT *width, UINT *height, UINT *depth, UINT *miplevels, DWORD usage, D3DFORMAT *format, D3DPOOL pool)
Definition: texture.c:453
#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
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:110
#define D3DX_DEFAULT
Definition: d3dx9.h:24
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
smooth NULL
Definition: ftsmooth.c:416
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:77
#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
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:737
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
#define D3D_OK
Definition: d3d.h:106
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
#define IDirect3DDevice9_GetDeviceCaps(p, a)
Definition: d3d9.h:1514
static UINT make_pow2(UINT num)
Definition: texture.c:36
HRESULT WINAPI D3DXGetImageInfoFromFileInMemory(const void *data, UINT datasize, D3DXIMAGE_INFO *info)
Definition: surface.c:875
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(), and D3DXCreateVolumeTextureFromFileW().

◆ 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
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:77
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
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:118
#define UnmapViewOfFile
Definition: compat.h:403

◆ 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 1688 of file texture.c.

1689 {
1690  DWORD miplevels;
1691  DWORD m, x, y, f;
1693  D3DLOCKED_RECT lock_rect;
1696  const struct pixel_format_desc *format;
1697  BYTE *data;
1698  static const enum cube_coord coordmap[6][3] =
1699  {
1700  {ONE, YCOORDINV, XCOORDINV},
1701  {ZERO, YCOORDINV, XCOORD},
1702  {XCOORD, ONE, YCOORD},
1703  {XCOORD, ZERO, YCOORDINV},
1704  {XCOORD, YCOORDINV, ONE},
1706  };
1707 
1708  if (texture == NULL || function == NULL)
1709  return D3DERR_INVALIDCALL;
1710 
1712 
1713  for (m = 0; m < miplevels; m++)
1714  {
1716  return D3DERR_INVALIDCALL;
1717 
1718  format = get_format_info(desc.Format);
1719  if (format->type != FORMAT_ARGB && format->type != FORMAT_ARGBF16 && format->type != FORMAT_ARGBF)
1720  {
1721  FIXME("Unsupported texture format %#x\n", desc.Format);
1722  return D3DERR_INVALIDCALL;
1723  }
1724 
1725  for (f = 0; f < 6; f++)
1726  {
1728  return D3DERR_INVALIDCALL;
1729 
1730  size.x = (f == 0) || (f == 1) ? 0.0f : 2.0f / desc.Width;
1731  size.y = (f == 2) || (f == 3) ? 0.0f : 2.0f / desc.Width;
1732  size.z = (f == 4) || (f == 5) ? 0.0f : 2.0f / desc.Width;
1733 
1734  data = lock_rect.pBits;
1735 
1736  for (y = 0; y < desc.Height; y++)
1737  {
1738  for (x = 0; x < desc.Width; x++)
1739  {
1740  coord.x = get_cube_coord(coordmap[f][0], x, y, desc.Width) / desc.Width * 2.0f - 1.0f;
1741  coord.y = get_cube_coord(coordmap[f][1], x, y, desc.Width) / desc.Width * 2.0f - 1.0f;
1742  coord.z = get_cube_coord(coordmap[f][2], x, y, desc.Width) / desc.Width * 2.0f - 1.0f;
1743 
1744  function(&value, &coord, &size, funcdata);
1745 
1746  fill_texture(format, data + y * lock_rect.Pitch + x * format->bytes_per_pixel, &value);
1747  }
1748  }
1750  }
1751  }
1752 
1753  return D3D_OK;
1754 }
#define IDirect3DCubeTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:937
#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
GLuint coord
Definition: glext.h:9511
#define IDirect3DCubeTexture9_LockRect(p, a, b, c, d, e)
Definition: d3d9.h:939
Definition: texture.c:1663
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
static float get_cube_coord(enum cube_coord coord, unsigned int x, unsigned int y, unsigned int size)
Definition: texture.c:1666
GLfloat f
Definition: glext.h:7540
GLsizeiptr size
Definition: glext.h:5919
static void fill_texture(const struct pixel_format_desc *format, BYTE *pos, const D3DXVECTOR4 *value)
Definition: texture.c:1268
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
Definition: texture.c:1662
unsigned char BYTE
Definition: mem.h:68
GLsizei const GLfloat * value
Definition: glext.h:6069
#define D3D_OK
Definition: d3d.h:106
#define f
Definition: ke_i.h:83
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define IDirect3DCubeTexture9_UnlockRect(p, a, b)
Definition: d3d9.h:940
const struct pixel_format_desc * get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: util.c:213
cube_coord
Definition: texture.c:1656
#define IDirect3DBaseTexture9_GetLevelCount(p)
Definition: d3d9.h:848

◆ D3DXFillCubeTextureTX()

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

Definition at line 1756 of file texture.c.

1757 {
1758  FIXME("texture %p, texture_shader %p stub.\n", texture, texture_shader);
1759  return E_NOTIMPL;
1760 }
#define FIXME(fmt,...)
Definition: debug.h:110
GLenum GLuint texture
Definition: glext.h:6295
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ D3DXFillTexture()

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

Definition at line 1324 of file texture.c.

1325 {
1326  DWORD miplevels;
1327  DWORD m, x, y;
1329  D3DLOCKED_RECT lock_rect;
1332  const struct pixel_format_desc *format;
1333  BYTE *data;
1334 
1335  if (texture == NULL || function == NULL)
1336  return D3DERR_INVALIDCALL;
1337 
1339 
1340  for (m = 0; m < miplevels; m++)
1341  {
1343  return D3DERR_INVALIDCALL;
1344 
1345  format = get_format_info(desc.Format);
1346  if (format->type != FORMAT_ARGB && format->type != FORMAT_ARGBF16 && format->type != FORMAT_ARGBF)
1347  {
1348  FIXME("Unsupported texture format %#x\n", desc.Format);
1349  return D3DERR_INVALIDCALL;
1350  }
1351 
1353  return D3DERR_INVALIDCALL;
1354 
1355  size.x = 1.0f / desc.Width;
1356  size.y = 1.0f / desc.Height;
1357 
1358  data = lock_rect.pBits;
1359 
1360  for (y = 0; y < desc.Height; y++)
1361  {
1362  /* The callback function expects the coordinates of the center
1363  of the texel */
1364  coord.y = (y + 0.5f) / desc.Height;
1365 
1366  for (x = 0; x < desc.Width; x++)
1367  {
1368  coord.x = (x + 0.5f) / desc.Width;
1369 
1370  function(&value, &coord, &size, funcdata);
1371 
1372  fill_texture(format, data + y * lock_rect.Pitch + x * format->bytes_per_pixel, &value);
1373  }
1374  }
1376  }
1377 
1378  return D3D_OK;
1379 }
#define IDirect3DTexture9_UnlockRect(p, a)
Definition: d3d9.h:1035
#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 IDirect3DTexture9_GetLevelDesc(p, a, b)
Definition: d3d9.h:1032
GLuint coord
Definition: glext.h:9511
#define FIXME(fmt,...)
Definition: debug.h:110
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
static void fill_texture(const struct pixel_format_desc *format, BYTE *pos, const D3DXVECTOR4 *value)
Definition: texture.c:1268
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
unsigned char BYTE
Definition: mem.h:68
GLsizei const GLfloat * value
Definition: glext.h:6069
#define D3D_OK
Definition: d3d.h:106
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define IDirect3DTexture9_LockRect(p, a, b, c, d)
Definition: d3d9.h:1034
const struct pixel_format_desc * get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: util.c:213
#define IDirect3DBaseTexture9_GetLevelCount(p)
Definition: d3d9.h:848

◆ D3DXFillTextureTX()

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

Definition at line 1381 of file texture.c.

1382 {
1383  FIXME("texture %p, texture_shader %p stub.\n", texture, texture_shader);
1384  return E_NOTIMPL;
1385 }
#define FIXME(fmt,...)
Definition: debug.h:110
GLenum GLuint texture
Definition: glext.h:6295
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ D3DXFillVolumeTexture()

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

Definition at line 1762 of file texture.c.

1763 {
1764  DWORD miplevels;
1765  DWORD m, x, y, z;
1767  D3DLOCKED_BOX lock_box;
1770  const struct pixel_format_desc *format;
1771  BYTE *data;
1772 
1773  if (texture == NULL || function == NULL)
1774  return D3DERR_INVALIDCALL;
1775 
1777 
1778  for (m = 0; m < miplevels; m++)
1779  {
1781  return D3DERR_INVALIDCALL;
1782 
1783  format = get_format_info(desc.Format);
1784  if (format->type != FORMAT_ARGB && format->type != FORMAT_ARGBF16 && format->type != FORMAT_ARGBF)
1785  {
1786  FIXME("Unsupported texture format %#x\n", desc.Format);
1787  return D3DERR_INVALIDCALL;
1788  }
1789 
1791  return D3DERR_INVALIDCALL;
1792 
1793  size.x = 1.0f / desc.Width;
1794  size.y = 1.0f / desc.Height;
1795  size.z = 1.0f / desc.Depth;
1796 
1797  data = lock_box.pBits;
1798 
1799  for (z = 0; z < desc.Depth; z++)
1800  {
1801  /* The callback function expects the coordinates of the center
1802  of the texel */
1803  coord.z = (z + 0.5f) / desc.Depth;
1804 
1805  for (y = 0; y < desc.Height; y++)
1806  {
1807  coord.y = (y + 0.5f) / desc.Height;
1808 
1809  for (x = 0; x < desc.Width; x++)
1810  {
1811  coord.x = (x + 0.5f) / desc.Width;
1812 
1813  function(&value, &coord, &size, funcdata);
1814 
1815  fill_texture(format, data + z * lock_box.SlicePitch + y * lock_box.RowPitch
1816  + x * format->bytes_per_pixel, &value);
1817  }
1818  }
1819  }
1821  }
1822 
1823  return D3D_OK;
1824 }
#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
#define FIXME(fmt,...)
Definition: debug.h:110
GLdouble GLdouble z
Definition: glext.h:5874
const struct builtin_class_descr * desc
Definition: regcontrol.c:48
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
static void fill_texture(const struct pixel_format_desc *format, BYTE *pos, const D3DXVECTOR4 *value)
Definition: texture.c:1268
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
unsigned char BYTE
Definition: mem.h:68
GLsizei const GLfloat * value
Definition: glext.h:6069
#define IDirect3DVolumeTexture9_LockBox(p, a, b, c, d)
Definition: d3d9.h:1129
#define D3D_OK
Definition: d3d.h:106
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
const struct pixel_format_desc * get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: util.c:213
#define IDirect3DBaseTexture9_GetLevelCount(p)
Definition: d3d9.h:848

◆ D3DXFillVolumeTextureTX()

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

Definition at line 1826 of file texture.c.

1827 {
1828  FIXME("texture %p, texture_shader %p stub.\n", texture, texture_shader);
1829  return E_NOTIMPL;
1830 }
#define FIXME(fmt,...)
Definition: debug.h:110
GLenum GLuint texture
Definition: glext.h:6295
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ D3DXFilterTexture()

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

Definition at line 65 of file texture.c.

69 {
70  UINT level;
71  HRESULT hr;
73 
74  TRACE("(%p, %p, %u, %#x)\n", texture, palette, srclevel, filter);
75 
76  if (!texture)
77  return D3DERR_INVALIDCALL;
78 
79  if ((filter & 0xFFFF) > D3DX_FILTER_BOX && filter != D3DX_DEFAULT)
80  return D3DERR_INVALIDCALL;
81 
82  if (srclevel == D3DX_DEFAULT)
83  srclevel = 0;
84  else if (srclevel >= IDirect3DBaseTexture9_GetLevelCount(texture))
85  return D3DERR_INVALIDCALL;
86 
88  {
89  case D3DRTYPE_TEXTURE:
91  {
92  IDirect3DSurface9 *topsurf, *mipsurf;
94  int i, numfaces;
95 
96  if (type == D3DRTYPE_TEXTURE)
97  {
98  numfaces = 1;
99  IDirect3DTexture9_GetLevelDesc((IDirect3DTexture9*) texture, srclevel, &