ReactOS  0.4.15-dev-1384-g878186b
d3dx9_private.h File Reference
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/rbtree.h"
#include "d3dx9.h"
Include dependency graph for d3dx9_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  vec4
 
struct  volume
 
struct  pixel_format_desc
 
struct  d3dx_include_from_file
 
struct  d3dx_const_param_eval_output
 
struct  d3dx_const_tab
 
struct  d3dx_regstore
 
struct  d3dx_preshader
 
struct  d3dx_param_eval
 
struct  param_rb_entry
 
struct  d3dx_parameter
 
struct  d3dx_top_level_parameter
 
struct  d3dx_shared_data
 
struct  ctab_constant
 

Macros

#define NONAMELESSUNION
 
#define COBJMACROS
 
#define ULONG64_MAX   (~(ULONG64)0)
 
#define SET_D3D_STATE_(manager, device, method, args...)
 
#define SET_D3D_STATE(base_effect, args...)   SET_D3D_STATE_(base_effect->manager, base_effect->device, args)
 

Enumerations

enum  format_type {
  FORMAT_ARGB, FORMAT_ARGBF16, FORMAT_ARGBF, FORMAT_DXT,
  FORMAT_INDEX, FORMAT_UNKNOWN
}
 
enum  pres_reg_tables {
  PRES_REGTAB_IMMED, PRES_REGTAB_CONST, PRES_REGTAB_OCONST, PRES_REGTAB_OBCONST,
  PRES_REGTAB_OICONST, PRES_REGTAB_TEMP, PRES_REGTAB_COUNT, PRES_REGTAB_FIRST_SHADER = PRES_REGTAB_CONST
}
 

Functions

static BOOL is_conversion_from_supported (const struct pixel_format_desc *format)
 
static BOOL is_conversion_to_supported (const struct pixel_format_desc *format)
 
HRESULT map_view_of_file (const WCHAR *filename, void **buffer, DWORD *length) DECLSPEC_HIDDEN
 
HRESULT load_resource_into_memory (HMODULE module, HRSRC resinfo, void **buffer, DWORD *length) DECLSPEC_HIDDEN
 
HRESULT write_buffer_to_file (const WCHAR *filename, ID3DXBuffer *buffer) DECLSPEC_HIDDEN
 
const struct pixel_format_descget_format_info (D3DFORMAT format) DECLSPEC_HIDDEN
 
const struct pixel_format_descget_format_info_idx (int idx) DECLSPEC_HIDDEN
 
void copy_pixels (const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, const struct volume *size, const struct pixel_format_desc *format) DECLSPEC_HIDDEN
 
void convert_argb_pixels (const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, const struct volume *src_size, const struct pixel_format_desc *src_format, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, const struct volume *dst_size, const struct pixel_format_desc *dst_format, D3DCOLOR color_key, const PALETTEENTRY *palette) DECLSPEC_HIDDEN
 
void point_filter_argb_pixels (const BYTE *src, UINT src_row_pitch, UINT src_slice_pitch, const struct volume *src_size, const struct pixel_format_desc *src_format, BYTE *dst, UINT dst_row_pitch, UINT dst_slice_pitch, const struct volume *dst_size, const struct pixel_format_desc *dst_format, D3DCOLOR color_key, const PALETTEENTRY *palette) DECLSPEC_HIDDEN
 
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
 
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
 
HRESULT load_volume_from_dds (IDirect3DVolume9 *dst_volume, const PALETTEENTRY *dst_palette, const D3DBOX *dst_box, const void *src_data, const D3DBOX *src_box, DWORD filter, D3DCOLOR color_key, const D3DXIMAGE_INFO *src_info) DECLSPEC_HIDDEN
 
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
 
HRESULT lock_surface (IDirect3DSurface9 *surface, D3DLOCKED_RECT *lock, IDirect3DSurface9 **temp_surface, BOOL write) DECLSPEC_HIDDEN
 
HRESULT unlock_surface (IDirect3DSurface9 *surface, D3DLOCKED_RECT *lock, IDirect3DSurface9 *temp_surface, BOOL update) DECLSPEC_HIDDEN
 
HRESULT save_dds_texture_to_memory (ID3DXBuffer **dst_buffer, IDirect3DBaseTexture9 *src_texture, const PALETTEENTRY *src_palette) DECLSPEC_HIDDEN
 
unsigned short float_32_to_16 (const float in) DECLSPEC_HIDDEN
 
float float_16_to_32 (const unsigned short in) DECLSPEC_HIDDEN
 
const chardebug_d3dxparameter_class (D3DXPARAMETER_CLASS c) DECLSPEC_HIDDEN
 
const chardebug_d3dxparameter_type (D3DXPARAMETER_TYPE t) DECLSPEC_HIDDEN
 
const chardebug_d3dxparameter_registerset (D3DXREGISTER_SET r) DECLSPEC_HIDDEN
 
static BOOL get_bool (D3DXPARAMETER_TYPE type, const void *data)
 
static int get_int (D3DXPARAMETER_TYPE type, const void *data)
 
static float get_float (D3DXPARAMETER_TYPE type, const void *data)
 
static void set_number (void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
 
static BOOL is_param_type_sampler (D3DXPARAMETER_TYPE type)
 
static BOOL is_top_level_parameter (struct d3dx_parameter *param)
 
static struct d3dx_top_level_parametertop_level_parameter_from_parameter (struct d3dx_parameter *param)
 
static ULONG64 next_update_version (ULONG64 *version_counter)
 
static BOOL is_top_level_param_dirty (struct d3dx_top_level_parameter *param, ULONG64 update_version)
 
static BOOL is_param_dirty (struct d3dx_parameter *param, ULONG64 update_version)
 
struct d3dx_parameterget_parameter_by_name (struct d3dx9_base_effect *base, struct d3dx_parameter *parameter, const char *name) DECLSPEC_HIDDEN
 
HRESULT d3dx_create_param_eval (struct d3dx9_base_effect *base_effect, void *byte_code, unsigned int byte_code_size, D3DXPARAMETER_TYPE type, struct d3dx_param_eval **peval, ULONG64 *version_counter, const char **skip_constants, unsigned int skip_constants_count) DECLSPEC_HIDDEN
 
void d3dx_free_param_eval (struct d3dx_param_eval *peval) DECLSPEC_HIDDEN
 
HRESULT d3dx_evaluate_parameter (struct d3dx_param_eval *peval, const struct d3dx_parameter *param, void *param_value) DECLSPEC_HIDDEN
 
HRESULT d3dx_param_eval_set_shader_constants (ID3DXEffectStateManager *manager, struct IDirect3DDevice9 *device, struct d3dx_param_eval *peval, BOOL update_all) DECLSPEC_HIDDEN
 
BOOL is_param_eval_input_dirty (struct d3dx_param_eval *peval, ULONG64 update_version) DECLSPEC_HIDDEN
 
const struct ctab_constantd3dx_shader_get_ctab_constant (ID3DXConstantTable *iface, D3DXHANDLE constant) DECLSPEC_HIDDEN
 
HRESULT create_dummy_skin (ID3DXSkinInfo **iface) DECLSPEC_HIDDEN
 

Variables

CRITICAL_SECTION from_file_mutex DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 30 of file d3dx9_private.h.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 25 of file d3dx9_private.h.

◆ SET_D3D_STATE

#define SET_D3D_STATE (   base_effect,
  args... 
)    SET_D3D_STATE_(base_effect->manager, base_effect->device, args)

Definition at line 390 of file d3dx9_private.h.

◆ SET_D3D_STATE_

#define SET_D3D_STATE_ (   manager,
  device,
  method,
  args... 
)
Value:
(manager ? manager->lpVtbl->method(manager, args) \
: device->lpVtbl->method(device, args))
Definition: match.c:390
Definition: devices.h:37

Definition at line 388 of file d3dx9_private.h.

◆ ULONG64_MAX

#define ULONG64_MAX   (~(ULONG64)0)

Definition at line 33 of file d3dx9_private.h.

Enumeration Type Documentation

◆ format_type

Enumerator
FORMAT_ARGB 
FORMAT_ARGBF16 
FORMAT_ARGBF 
FORMAT_DXT 
FORMAT_INDEX 
FORMAT_UNKNOWN 

Definition at line 48 of file d3dx9_private.h.

48  {
49  FORMAT_ARGB, /* unsigned */
50  FORMAT_ARGBF16,/* float 16 */
51  FORMAT_ARGBF, /* float */
52  FORMAT_DXT,
55 };

◆ pres_reg_tables

Enumerator
PRES_REGTAB_IMMED 
PRES_REGTAB_CONST 
PRES_REGTAB_OCONST 
PRES_REGTAB_OBCONST 
PRES_REGTAB_OICONST 
PRES_REGTAB_TEMP 
PRES_REGTAB_COUNT 
PRES_REGTAB_FIRST_SHADER 

Definition at line 232 of file d3dx9_private.h.

Function Documentation

◆ convert_argb_pixels()

void convert_argb_pixels ( const BYTE src,
UINT  src_row_pitch,
UINT  src_slice_pitch,
const struct volume src_size,
const struct pixel_format_desc src_format,
BYTE dst,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
const struct volume dst_size,
const struct pixel_format_desc dst_format,
D3DCOLOR  color_key,
const PALETTEENTRY palette 
)

Definition at line 1691 of file surface.c.

1695 {
1696  struct argb_conversion_info conv_info, ck_conv_info;
1697  const struct pixel_format_desc *ck_format = NULL;
1698  DWORD channels[4];
1699  UINT min_width, min_height, min_depth;
1700  UINT x, y, z;
1701 
1702  ZeroMemory(channels, sizeof(channels));
1703  init_argb_conversion_info(src_format, dst_format, &conv_info);
1704 
1705  min_width = min(src_size->width, dst_size->width);
1706  min_height = min(src_size->height, dst_size->height);
1707  min_depth = min(src_size->depth, dst_size->depth);
1708 
1709  if (color_key)
1710  {
1711  /* Color keys are always represented in D3DFMT_A8R8G8B8 format. */
1712  ck_format = get_format_info(D3DFMT_A8R8G8B8);
1713  init_argb_conversion_info(src_format, ck_format, &ck_conv_info);
1714  }
1715 
1716  for (z = 0; z < min_depth; z++) {
1717  const BYTE *src_slice_ptr = src + z * src_slice_pitch;
1718  BYTE *dst_slice_ptr = dst + z * dst_slice_pitch;
1719 
1720  for (y = 0; y < min_height; y++) {
1721  const BYTE *src_ptr = src_slice_ptr + y * src_row_pitch;
1722  BYTE *dst_ptr = dst_slice_ptr + y * dst_row_pitch;
1723 
1724  for (x = 0; x < min_width; x++) {
1725  if (!src_format->to_rgba && !dst_format->from_rgba
1726  && src_format->type == dst_format->type
1727  && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4)
1728  {
1729  DWORD val;
1730 
1731  get_relevant_argb_components(&conv_info, src_ptr, channels);
1732  val = make_argb_color(&conv_info, channels);
1733 
1734  if (color_key)
1735  {
1736  DWORD ck_pixel;
1737 
1738  get_relevant_argb_components(&ck_conv_info, src_ptr, channels);
1739  ck_pixel = make_argb_color(&ck_conv_info, channels);
1740  if (ck_pixel == color_key)
1741  val &= ~conv_info.destmask[0];
1742  }
1743  memcpy(dst_ptr, &val, dst_format->bytes_per_pixel);
1744  }
1745  else
1746  {
1747  struct vec4 color, tmp;
1748 
1749  format_to_vec4(src_format, src_ptr, &color);
1750  if (src_format->to_rgba)
1751  src_format->to_rgba(&color, &tmp, palette);
1752  else
1753  tmp = color;
1754 
1755  if (ck_format)
1756  {
1757  DWORD ck_pixel;
1758 
1759  format_from_vec4(ck_format, &tmp, (BYTE *)&ck_pixel);
1760  if (ck_pixel == color_key)
1761  tmp.w = 0.0f;
1762  }
1763 
1764  if (dst_format->from_rgba)
1765  dst_format->from_rgba(&tmp, &color);
1766  else
1767  color = tmp;
1768 
1769  format_from_vec4(dst_format, &color, dst_ptr);
1770  }
1771 
1772  src_ptr += src_format->bytes_per_pixel;
1773  dst_ptr += dst_format->bytes_per_pixel;
1774  }
1775 
1776  if (src_size->width < dst_size->width) /* black out remaining pixels */
1777  memset(dst_ptr, 0, dst_format->bytes_per_pixel * (dst_size->width - src_size->width));
1778  }
1779 
1780  if (src_size->height < dst_size->height) /* black out remaining pixels */
1781  memset(dst + src_size->height * dst_row_pitch, 0, dst_row_pitch * (dst_size->height - src_size->height));
1782  }
1783  if (src_size->depth < dst_size->depth) /* black out remaining pixels */
1784  memset(dst + src_size->depth * dst_slice_pitch, 0, dst_slice_pitch * (dst_size->depth - src_size->depth));
1785 }
UINT width
Definition: d3dx9_private.h:42
static const char * dst_format
Definition: dib.c:1133
#define ZeroMemory
Definition: winbase.h:1648
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int This channels
Definition: rdpsnd_libao.c:37
void(* to_rgba)(const struct vec4 *src, struct vec4 *dst, const PALETTEENTRY *palette)
Definition: d3dx9_private.h:67
GLuint color
Definition: glext.h:6243
GLdouble GLdouble z
Definition: glext.h:5874
UINT height
Definition: d3dx9_private.h:43
GLuint GLfloat * val
Definition: glext.h:7180
UINT depth
Definition: d3dx9_private.h:44
enum format_type type
Definition: d3dx9_private.h:65
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
unsigned char BYTE
Definition: xxhash.c:193
static HPALETTE palette
Definition: clipboard.c:1345
static void format_from_vec4(const struct pixel_format_desc *format, const struct vec4 *src, BYTE *dst)
Definition: surface.c:1610
static void init_argb_conversion_info(const struct pixel_format_desc *srcformat, const struct pixel_format_desc *destformat, struct argb_conversion_info *info)
Definition: surface.c:1499
GLenum GLenum dst
Definition: glext.h:6340
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static void get_relevant_argb_components(const struct argb_conversion_info *info, const BYTE *col, DWORD *out)
Definition: surface.c:1532
const struct pixel_format_desc * get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: util.c:213
static void format_to_vec4(const struct pixel_format_desc *format, const BYTE *src, struct vec4 *dst)
Definition: surface.c:1580
#define memset(x, y, z)
Definition: compat.h:39
static DWORD make_argb_color(const struct argb_conversion_info *info, const DWORD *in)
Definition: surface.c:1562

Referenced by D3DXLoadSurfaceFromMemory(), D3DXLoadVolumeFromMemory(), and D3DXSaveSurfaceToFileInMemory().

◆ copy_pixels()

void copy_pixels ( const BYTE src,
UINT  src_row_pitch,
UINT  src_slice_pitch,
BYTE dst,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
const struct volume size,
const struct pixel_format_desc format 
)

Definition at line 1660 of file surface.c.

1663 {
1664  UINT row, slice;
1665  BYTE *dst_addr;
1666  const BYTE *src_addr;
1667  UINT row_block_count = (size->width + format->block_width - 1) / format->block_width;
1668  UINT row_count = (size->height + format->block_height - 1) / format->block_height;
1669 
1670  for (slice = 0; slice < size->depth; slice++)
1671  {
1672  src_addr = src + slice * src_slice_pitch;
1673  dst_addr = dst + slice * dst_slice_pitch;
1674 
1675  for (row = 0; row < row_count; row++)
1676  {
1677  memcpy(dst_addr, src_addr, row_block_count * format->block_byte_count);
1678  src_addr += src_row_pitch;
1679  dst_addr += dst_row_pitch;
1680  }
1681  }
1682 }
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
unsigned char BYTE
Definition: xxhash.c:193
GLenum GLenum dst
Definition: glext.h:6340
unsigned int UINT
Definition: ndis.h:50
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
Definition: typeof.h:78

Referenced by BitmapImpl_CopyPixels(), BmpFrameDecode_CopyPixels(), D3DXLoadSurfaceFromMemory(), D3DXLoadVolumeFromMemory(), GifFrameDecode_CopyPixels(), IcoFrameDecode_CopyPixels(), save_dds_surface_to_memory(), and TgaDecoder_Frame_CopyPixels().

◆ create_dummy_skin()

HRESULT create_dummy_skin ( ID3DXSkinInfo **  iface)

Definition at line 579 of file skin.c.

580 {
581  static const D3DVERTEXELEMENT9 empty_declaration = D3DDECL_END();
582  struct d3dx9_skin_info *object = NULL;
583 
584  object = HeapAlloc(GetProcessHeap(), 0, sizeof(*object));
585  if (!object) return E_OUTOFMEMORY;
586 
587  object->ID3DXSkinInfo_iface.lpVtbl = &d3dx9_skin_info_vtbl;
588  object->ref = 1;
589  object->num_vertices = 0;
590  object->num_bones = 0;
591  object->vertex_declaration[0] = empty_declaration;
592  object->fvf = 0;
593  object->bones = NULL;
594 
595  *iface = &object->ID3DXSkinInfo_iface;
596  return D3D_OK;
597 }
static const struct ID3DXSkinInfoVtbl d3dx9_skin_info_vtbl
Definition: skin.c:492
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define D3DDECL_END()
Definition: d3d9types.h:311
#define D3D_OK
Definition: d3d.h:106
#define NULL
Definition: types.h:112

Referenced by parse_mesh().

◆ d3dx_create_param_eval()

HRESULT d3dx_create_param_eval ( struct d3dx9_base_effect base_effect,
void byte_code,
unsigned int  byte_code_size,
D3DXPARAMETER_TYPE  type,
struct d3dx_param_eval **  peval,
ULONG64 version_counter,
const char **  skip_constants,
unsigned int  skip_constants_count 
)

Definition at line 1234 of file preshader.c.

1237 {
1238  struct d3dx_param_eval *peval;
1239  unsigned int *ptr, *shader_ptr = NULL;
1240  unsigned int i;
1241  BOOL shader;
1242  unsigned int count, pres_size;
1243  HRESULT ret;
1244 
1245  TRACE("base_effect %p, byte_code %p, byte_code_size %u, type %u, peval_out %p.\n",
1246  base_effect, byte_code, byte_code_size, type, peval_out);
1247 
1248  count = byte_code_size / sizeof(unsigned int);
1249  if (!byte_code || !count)
1250  {
1251  *peval_out = NULL;
1252  return D3D_OK;
1253  }
1254 
1255  peval = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*peval));
1256  if (!peval)
1257  {
1258  ret = E_OUTOFMEMORY;
1259  goto err_out;
1260  }
1262 
1263  peval->param_type = type;
1264  switch (type)
1265  {
1266  case D3DXPT_VERTEXSHADER:
1267  case D3DXPT_PIXELSHADER:
1268  shader = TRUE;
1269  break;
1270  default:
1271  shader = FALSE;
1272  break;
1273  }
1274  peval->shader_inputs.regset2table = shad_regset2table;
1275 
1276  ptr = (unsigned int *)byte_code;
1277  if (shader)
1278  {
1279  if ((*ptr & 0xfffe0000) != 0xfffe0000)
1280  {
1281  FIXME("Invalid shader signature %#x.\n", *ptr);
1283  goto err_out;
1284  }
1285  TRACE("Shader version %#x.\n", *ptr & 0xffff);
1286  shader_ptr = ptr;
1287  ptr = find_bytecode_comment(ptr + 1, count - 1, FOURCC_PRES, &pres_size);
1288  if (!ptr)
1289  TRACE("No preshader found.\n");
1290  }
1291  else
1292  {
1293  pres_size = count;
1294  }
1295 
1296  if (ptr && FAILED(ret = parse_preshader(&peval->pres, ptr, pres_size, base_effect)))
1297  {
1298  FIXME("Failed parsing preshader, byte code for analysis follows.\n");
1299  dump_bytecode(byte_code, byte_code_size);
1300  goto err_out;
1301  }
1302 
1303  if (shader)
1304  {
1305  if (FAILED(ret = get_constants_desc(shader_ptr, &peval->shader_inputs, base_effect,
1306  skip_constants, skip_constants_count, &peval->pres)))
1307  {
1308  TRACE("Could not get shader constant table, hr %#x.\n", ret);
1309  goto err_out;
1310  }
1311  update_table_sizes_consts(peval->pres.regs.table_sizes, &peval->shader_inputs);
1312  }
1313 
1315  {
1316  if (FAILED(ret = regstore_alloc_table(&peval->pres.regs, i)))
1317  goto err_out;
1318  }
1319 
1320  if (TRACE_ON(d3dx))
1321  {
1322  dump_bytecode(byte_code, byte_code_size);
1323  dump_preshader(&peval->pres);
1324  if (shader)
1325  {
1326  TRACE("// Shader registers:\n");
1327  dump_registers(&peval->shader_inputs);
1328  }
1329  }
1330  *peval_out = peval;
1331  TRACE("Created parameter evaluator %p.\n", *peval_out);
1332  return D3D_OK;
1333 
1334 err_out:
1335  WARN("Error creating parameter evaluator.\n");
1336  if (TRACE_ON(d3dx))
1337  dump_bytecode(byte_code, byte_code_size);
1338 
1339  d3dx_free_param_eval(peval);
1340  *peval_out = NULL;
1341  return ret;
1342 }
static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, unsigned int count, struct d3dx9_base_effect *base)
Definition: preshader.c:1114
#define TRUE
Definition: types.h:120
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:112
enum pres_value_type type
Definition: preshader.c:210
static void dump_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1090
void d3dx_free_param_eval(struct d3dx_param_eval *peval)
Definition: preshader.c:1359
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
static PVOID ptr
Definition: dispmode.c:27
GLuint shader
Definition: glext.h:6030
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
static enum pres_reg_tables shad_regset2table[]
Definition: preshader.c:236
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG HRESULT
Definition: typedefs.h:79
static void dump_registers(struct d3dx_const_tab *ctab)
Definition: preshader.c:1064
int ret
struct d3dx_const_tab shader_inputs
#define FOURCC_PRES
Definition: preshader.c:154
#define D3D_OK
Definition: d3d.h:106
static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab *out, struct d3dx9_base_effect *base, const char **skip_constants, unsigned int skip_constants_count, struct d3dx_preshader *pres)
Definition: preshader.c:863
struct d3dx_preshader pres
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
static HRESULT regstore_alloc_table(struct d3dx_regstore *rs, unsigned int table)
Definition: preshader.c:314
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static void update_table_sizes_consts(unsigned int *table_sizes, struct d3dx_const_tab *ctab)
Definition: preshader.c:1016
ULONG64 * version_counter
D3DXPARAMETER_TYPE param_type
static void dump_bytecode(void *data, unsigned int size)
Definition: preshader.c:385
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define TRACE_ON(x)
Definition: compat.h:75
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
static unsigned int * find_bytecode_comment(unsigned int *ptr, unsigned int count, unsigned int fourcc, unsigned int *size)
Definition: preshader.c:402

Referenced by d3dx9_parse_array_selector(), and d3dx9_parse_resource().

◆ d3dx_evaluate_parameter()

HRESULT d3dx_evaluate_parameter ( struct d3dx_param_eval peval,
const struct d3dx_parameter param,
void param_value 
)

Definition at line 1724 of file preshader.c.

1726 {
1727  HRESULT hr;
1728  unsigned int i;
1729  unsigned int elements, elements_param, elements_table;
1730  float *oc;
1731 
1732  TRACE("peval %p, param %p, param_value %p.\n", peval, param, param_value);
1733 
1734  if (is_const_tab_input_dirty(&peval->pres.inputs, ULONG64_MAX))
1735  {
1736  set_constants(&peval->pres.regs, &peval->pres.inputs,
1738  NULL, NULL, peval->param_type, FALSE, FALSE);
1739 
1740  if (FAILED(hr = execute_preshader(&peval->pres)))
1741  return hr;
1742  }
1743 
1744  elements_table = get_offset_reg(PRES_REGTAB_OCONST, peval->pres.regs.table_sizes[PRES_REGTAB_OCONST]);
1745  elements_param = param->bytes / sizeof(unsigned int);
1746  elements = min(elements_table, elements_param);
1747  oc = (float *)peval->pres.regs.tables[PRES_REGTAB_OCONST];
1748  for (i = 0; i < elements; ++i)
1749  set_number((unsigned int *)param_value + i, param->type, oc + i, D3DXPT_FLOAT);
1750  return D3D_OK;
1751 }
static HRESULT set_constants(struct d3dx_regstore *rs, struct d3dx_const_tab *const_tab, ULONG64 new_update_version, ID3DXEffectStateManager *manager, struct IDirect3DDevice9 *device, D3DXPARAMETER_TYPE type, BOOL device_update_all, BOOL pres_dirty)
Definition: preshader.c:1484
HRESULT hr
Definition: shlfolder.c:183
static void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
static BOOL is_const_tab_input_dirty(struct d3dx_const_tab *ctab, ULONG64 update_version)
Definition: preshader.c:1703
#define FALSE
Definition: types.h:117
static HRESULT execute_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1660
#define TRACE(s)
Definition: solgame.cpp:4
static unsigned int get_offset_reg(unsigned int table, unsigned int reg_idx)
Definition: preshader.c:302
static ULONG64 next_update_version(ULONG64 *version_counter)
LONG HRESULT
Definition: typedefs.h:79
GLfloat param
Definition: glext.h:5796
#define for
Definition: utility.h:88
#define ULONG64_MAX
Definition: d3dx9_private.h:33
#define D3D_OK
Definition: d3d.h:106
struct d3dx_preshader pres
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
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
ULONG64 * version_counter
D3DXPARAMETER_TYPE param_type
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by d3dx9_get_param_value_ptr().

◆ d3dx_free_param_eval()

void d3dx_free_param_eval ( struct d3dx_param_eval peval)

Definition at line 1359 of file preshader.c.

1360 {
1361  TRACE("peval %p.\n", peval);
1362 
1363  if (!peval)
1364  return;
1365 
1366  d3dx_free_preshader(&peval->pres);
1368  HeapFree(GetProcessHeap(), 0, peval);
1369 }
static void d3dx_free_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1351
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:595
struct d3dx_const_tab shader_inputs
struct d3dx_preshader pres
static void d3dx_free_const_tab(struct d3dx_const_tab *ctab)
Definition: preshader.c:1344
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by d3dx_create_param_eval(), and free_parameter().

◆ d3dx_param_eval_set_shader_constants()

HRESULT d3dx_param_eval_set_shader_constants ( ID3DXEffectStateManager *  manager,
struct IDirect3DDevice9 *  device,
struct d3dx_param_eval peval,
BOOL  update_all 
)

Definition at line 1753 of file preshader.c.

1755 {
1756  HRESULT hr;
1757  struct d3dx_preshader *pres = &peval->pres;
1758  struct d3dx_regstore *rs = &pres->regs;
1759  ULONG64 new_update_version = next_update_version(peval->version_counter);
1760  BOOL pres_dirty = FALSE;
1761 
1762  TRACE("device %p, peval %p, param_type %u.\n", device, peval, peval->param_type);
1763 
1765  {
1766  set_constants(rs, &pres->inputs, new_update_version,
1767  NULL, NULL, peval->param_type, FALSE, FALSE);
1768  if (FAILED(hr = execute_preshader(pres)))
1769  return hr;
1770  pres_dirty = TRUE;
1771  }
1772 
1773  return set_constants(rs, &peval->shader_inputs, new_update_version,
1774  manager, device, peval->param_type, update_all, pres_dirty);
1775 }
static HRESULT set_constants(struct d3dx_regstore *rs, struct d3dx_const_tab *const_tab, ULONG64 new_update_version, ID3DXEffectStateManager *manager, struct IDirect3DDevice9 *device, D3DXPARAMETER_TYPE type, BOOL device_update_all, BOOL pres_dirty)
Definition: preshader.c:1484
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
static BOOL is_const_tab_input_dirty(struct d3dx_const_tab *ctab, ULONG64 update_version)
Definition: preshader.c:1703
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
static HRESULT execute_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1660
#define TRACE(s)
Definition: solgame.cpp:4
static ULONG64 next_update_version(ULONG64 *version_counter)
LONG HRESULT
Definition: typedefs.h:79
#define ULONG64_MAX
Definition: d3dx9_private.h:33
unsigned __int64 ULONG64
Definition: imports.h:198
struct d3dx_const_tab shader_inputs
struct d3dx_preshader pres
#define NULL
Definition: types.h:112
ULONG64 * version_counter
D3DXPARAMETER_TYPE param_type
struct d3dx_regstore regs
struct d3dx_const_tab inputs

Referenced by d3dx_set_shader_constants().

◆ d3dx_shader_get_ctab_constant()

const struct ctab_constant* d3dx_shader_get_ctab_constant ( ID3DXConstantTable *  iface,
D3DXHANDLE  constant 
)

Definition at line 977 of file shader.c.

978 {
980 
982 }
static struct ID3DXConstantTableImpl * impl_from_ID3DXConstantTable(ID3DXConstantTable *iface)
Definition: shader.c:755
static struct ctab_constant * get_valid_constant(struct ID3DXConstantTableImpl *table, D3DXHANDLE handle)
Definition: shader.c:880

Referenced by get_ctab_constant_desc().

◆ debug_d3dxparameter_class()

const char* debug_d3dxparameter_class ( D3DXPARAMETER_CLASS  c)

Definition at line 233 of file util.c.

234 {
235  switch (c)
236  {
243  default:
244  FIXME("Unrecognized D3DXPARAMETER_CLASS %#x.\n", c);
245  return "unrecognized";
246  }
247 }
#define FIXME(fmt,...)
Definition: debug.h:111
const GLubyte * c
Definition: glext.h:8905
#define WINE_D3DX_TO_STR(x)
Definition: util.c:231

Referenced by d3dx9_base_effect_get_matrix(), d3dx9_base_effect_get_matrix_array(), d3dx9_base_effect_get_matrix_pointer_array(), d3dx9_base_effect_get_matrix_transpose(), d3dx9_base_effect_get_matrix_transpose_array(), d3dx9_base_effect_get_matrix_transpose_pointer_array(), d3dx9_base_effect_get_vector(), d3dx9_base_effect_get_vector_array(), d3dx9_base_effect_set_bool_array(), d3dx9_base_effect_set_float_array(), d3dx9_base_effect_set_int_array(), d3dx9_base_effect_set_matrix(), d3dx9_base_effect_set_matrix_array(), d3dx9_base_effect_set_matrix_pointer_array(), d3dx9_base_effect_set_matrix_transpose(), d3dx9_base_effect_set_matrix_transpose_array(), d3dx9_base_effect_set_matrix_transpose_pointer_array(), d3dx9_base_effect_set_vector(), d3dx9_base_effect_set_vector_array(), d3dx9_parse_effect_typedef(), d3dx9_parse_init_value(), d3dx9_parse_resource(), d3dx9_parse_value(), ID3DXConstantTableImpl_SetValue(), parse_ctab_constant_type(), set(), set_matrix_array(), set_matrix_pointer_array(), set_scalar(), set_scalar_array(), set_vector(), and set_vector_array().

◆ debug_d3dxparameter_registerset()

const char* debug_d3dxparameter_registerset ( D3DXREGISTER_SET  r)

Definition at line 279 of file util.c.

280 {
281  switch (r)
282  {
287  default:
288  FIXME("Unrecognized D3DXREGISTER_SET %#x.\n", r);
289  return "unrecognized";
290  }
291 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define FIXME(fmt,...)
Definition: debug.h:111
#define WINE_D3DX_TO_STR(x)
Definition: util.c:231

Referenced by ID3DXConstantTableImpl_SetDefaults(), parse_ctab_constant_type(), and set().

◆ debug_d3dxparameter_type()

const char* debug_d3dxparameter_type ( D3DXPARAMETER_TYPE  t)

Definition at line 249 of file util.c.

250 {
251  switch (t)
252  {
273  default:
274  FIXME("Unrecognized D3DXPARAMETER_TYP %#x.\n", t);
275  return "unrecognized";
276  }
277 }
GLdouble GLdouble t
Definition: gl.h:2047
#define FIXME(fmt,...)
Definition: debug.h:111
#define WINE_D3DX_TO_STR(x)
Definition: util.c:231

Referenced by d3dx9_base_effect_get_value(), d3dx9_base_effect_set_value(), d3dx9_parse_effect_typedef(), d3dx9_parse_resource(), d3dx9_parse_value(), free_parameter(), free_parameter_data(), and parse_ctab_constant_type().

◆ float_16_to_32()

float float_16_to_32 ( const unsigned short  in)

Definition at line 2199 of file math.c.

2200 {
2201  const unsigned short s = (in & 0x8000);
2202  const unsigned short e = (in & 0x7C00) >> 10;
2203  const unsigned short m = in & 0x3FF;
2204  const float sgn = (s ? -1.0f : 1.0f);
2205 
2206  if (e == 0)
2207  {
2208  if (m == 0) return sgn * 0.0f; /* +0.0 or -0.0 */
2209  else return sgn * powf(2, -14.0f) * (m / 1024.0f);
2210  }
2211  else
2212  {
2213  return sgn * powf(2, e - 15.0f) * (1.0f + (m / 1024.0f));
2214  }
2215 }
long sgn(REAL x)
Definition: varray.cc:48
const GLfloat * m
Definition: glext.h:10848
#define e
Definition: ke_i.h:82
_Check_return_ __CRT_INLINE float powf(_In_ float x, _In_ float y)
Definition: math.h:216
GLfloat f
Definition: glext.h:7540
GLdouble s
Definition: gl.h:2039
GLuint in
Definition: glext.h:9616

Referenced by D3DXFloat16To32Array(), format_to_vec4(), generic_float16_2(), generic_float16_4(), and load_numbered_arrays().

◆ float_32_to_16()

unsigned short float_32_to_16 ( const float  in)

Definition at line 2098 of file math.c.

2099 {
2100  int exp = 0, origexp;
2101  float tmp = fabsf(in);
2102  int sign = (copysignf(1, in) < 0);
2103  unsigned int mantissa;
2104  unsigned short ret;
2105 
2106  /* Deal with special numbers */
2107  if (isinf(in)) return (sign ? 0xffff : 0x7fff);
2108  if (isnan(in)) return (sign ? 0xffff : 0x7fff);
2109  if (in == 0.0f) return (sign ? 0x8000 : 0x0000);
2110 
2111  if (tmp < (float)(1u << 10))
2112  {
2113  do
2114  {
2115  tmp *= 2.0f;
2116  exp--;
2117  } while (tmp < (float)(1u << 10));
2118  }
2119  else if (tmp >= (float)(1u << 11))
2120  {
2121  do
2122  {
2123  tmp /= 2.0f;
2124  exp++;
2125  } while (tmp >= (float)(1u << 11));
2126  }
2127 
2128  exp += 10; /* Normalize the mantissa */
2129  exp += 15; /* Exponent is encoded with excess 15 */
2130 
2131  origexp = exp;
2132 
2133  mantissa = (unsigned int) tmp;
2134  if ((tmp - mantissa == 0.5f && mantissa % 2 == 1) || /* round half to even */
2135  (tmp - mantissa > 0.5f))
2136  {
2137  mantissa++; /* round to nearest, away from zero */
2138  }
2139  if (mantissa == 2048)
2140  {
2141  mantissa = 1024;
2142  exp++;
2143  }
2144 
2145  if (exp > 31)
2146  {
2147  /* too big */
2148  ret = 0x7fff; /* INF */
2149  }
2150  else if (exp <= 0)
2151  {
2152  unsigned int rounding = 0;
2153 
2154  /* Denormalized half float */
2155 
2156  /* return 0x0000 (=0.0) for numbers too small to represent in half floats */
2157  if (exp < -11)
2158  return (sign ? 0x8000 : 0x0000);
2159 
2160  exp = origexp;
2161 
2162  /* the 13 extra bits from single precision are used for rounding */
2163  mantissa = (unsigned int)(tmp * (1u << 13));
2164  mantissa >>= 1 - exp; /* denormalize */
2165 
2166  mantissa -= ~(mantissa >> 13) & 1; /* round half to even */
2167  /* remove 13 least significant bits to get half float precision */
2168  mantissa >>= 12;
2169  rounding = mantissa & 1;
2170  mantissa >>= 1;
2171 
2172  ret = mantissa + rounding;
2173  }
2174  else
2175  {
2176  ret = (exp << 10) | (mantissa & 0x3ff);
2177  }
2178 
2179  ret |= ((sign ? 1 : 0) << 15); /* Add the sign */
2180  return ret;
2181 }
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 * u
Definition: glfuncs.h:240
static size_t double int int int * sign
Definition: printf.c:69
float __cdecl copysignf(float, float)
GLfloat f
Definition: glext.h:7540
int isinf(double x)
int ret
int isnan(double x)
GLuint in
Definition: glext.h:9616
DWORD exp
Definition: msg.c:16033
_Check_return_ __CRT_INLINE float __CRTDECL fabsf(_In_ float x)
Definition: math.h:164
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31

Referenced by D3DXFloat32To16Array(), and fill_texture().

◆ get_bool()

static BOOL get_bool ( D3DXPARAMETER_TYPE  type,
const void data 
)
inlinestatic

Definition at line 140 of file d3dx9_private.h.

141 {
142  switch (type)
143  {
144  case D3DXPT_FLOAT:
145  case D3DXPT_INT:
146  case D3DXPT_BOOL:
147  return !!*(DWORD *)data;
148 
149  case D3DXPT_VOID:
150  return *(BOOL *)data;
151 
152  default:
153  return FALSE;
154  }
155 }
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by debugstr_jsval(), equal_values(), get_float(), get_int(), interp_end_finally(), jsval_strict_equal(), jsval_to_variant(), set_number(), stringify(), to_boolean(), to_number(), to_object(), and to_string().

◆ get_float()

static float get_float ( D3DXPARAMETER_TYPE  type,
const void data 
)
inlinestatic

Definition at line 176 of file d3dx9_private.h.

177 {
178  switch (type)
179  {
180  case D3DXPT_FLOAT:
181  case D3DXPT_VOID:
182  return *(float *)data;
183 
184  case D3DXPT_INT:
185  return (float)(*(int *)data);
186 
187  case D3DXPT_BOOL:
188  return (float)get_bool(type, data);
189 
190  default:
191  return 0.0f;
192  }
193 }
static BOOL get_bool(D3DXPARAMETER_TYPE type, const void *data)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by set_number().

◆ get_format_info()

const struct pixel_format_desc* get_format_info ( D3DFORMAT  format)

Definition at line 213 of file util.c.

214 {
215  unsigned int i = 0;
216  while(formats[i].format != format && formats[i].format != D3DFMT_UNKNOWN) i++;
217  if (formats[i].format == D3DFMT_UNKNOWN)
218  FIXME("Unknown format %#x (as FOURCC %s).\n", format, debugstr_an((const char *)&format, 4));
219  return &formats[i];
220 }
static const struct pixel_format_desc formats[]
Definition: util.c:57
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
#define FIXME(fmt,...)
Definition: debug.h:111
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:55
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

Referenced by calculate_dds_surface_size(), convert_argb_pixels(), D3DXCheckTextureRequirements(), D3DXFillCubeTexture(), D3DXFillTexture(), D3DXFillVolumeTexture(), D3DXLoadSurfaceFromFileInMemory(), D3DXLoadSurfaceFromMemory(), D3DXLoadVolumeFromMemory(), D3DXSaveSurfaceToFileInMemory(), point_filter_argb_pixels(), and save_dds_surface_to_memory().

◆ get_format_info_idx()

const struct pixel_format_desc* get_format_info_idx ( int  idx)

Definition at line 222 of file util.c.

223 {
224  if(idx >= ARRAY_SIZE(formats))
225  return NULL;
227  return NULL;
228  return &formats[idx];
229 }
static const struct pixel_format_desc formats[]
Definition: util.c:57
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546
unsigned int idx
Definition: utils.c:41
#define ARRAY_SIZE(a)
Definition: main.h:24
#define NULL
Definition: types.h:112

Referenced by D3DXCheckTextureRequirements().

◆ get_int()

static int get_int ( D3DXPARAMETER_TYPE  type,
const void data 
)
inlinestatic

Definition at line 157 of file d3dx9_private.h.

158 {
159  switch (type)
160  {
161  case D3DXPT_FLOAT:
162  return (int)(*(float *)data);
163 
164  case D3DXPT_INT:
165  case D3DXPT_VOID:
166  return *(int *)data;
167 
168  case D3DXPT_BOOL:
169  return get_bool(type, data);
170 
171  default:
172  return 0;
173  }
174 }
static BOOL get_bool(D3DXPARAMETER_TYPE type, const void *data)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by set_number().

◆ get_parameter_by_name()

struct d3dx_parameter* get_parameter_by_name ( struct d3dx9_base_effect base,
struct d3dx_parameter parameter,
const char name 
)

Definition at line 899 of file effect.c.

901 {
902  struct d3dx_parameter *temp_parameter;
903  unsigned int name_len, param_name_len;
904  unsigned int i, count, length;
905  struct wine_rb_entry *entry;
906  unsigned int full_name_size;
907  const char *part;
908  char *full_name;
909 
910  TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
911 
912  if (!name || !*name) return NULL;
913 
914  if (!parameter)
915  {
916  if ((entry = wine_rb_get(&base->param_tree, name)))
918  return NULL;
919  }
920 
921  /* Pass / technique annotations are not in the parameters tree. */
922  if (parameter->full_name)
923  {
924  name_len = strlen(name);
925  param_name_len = strlen(parameter->full_name);
926  full_name_size = name_len + param_name_len + 2;
927  if (base->full_name_tmp_size < full_name_size)
928  {
929  if (!(full_name = heap_realloc(base->full_name_tmp, full_name_size)))
930  {
931  ERR("Out of memory.\n");
932  return NULL;
933  }
934  base->full_name_tmp = full_name;
935  base->full_name_tmp_size = full_name_size;
936  }
937  else
938  {
939  full_name = base->full_name_tmp;
940  }
941  memcpy(full_name, parameter->full_name, param_name_len);
942  full_name[param_name_len] = '.';
943  memcpy(full_name + param_name_len + 1, name, name_len);
944  full_name[param_name_len + 1 + name_len] = 0;
945 
946  if ((entry = wine_rb_get(&base->param_tree, full_name)))
948  return NULL;
949  }
950 
951  count = parameter ? parameter->member_count : base->parameter_count;
952 
953  length = strcspn( name, "[.@" );
954  part = name + length;
955 
956  for (i = 0; i < count; i++)
957  {
958  temp_parameter = !parameter ? &base->parameters[i].param
959  : &parameter->members[i];
960 
961  if (!strcmp(temp_parameter->name, name))
962  {
963  TRACE("Returning parameter %p\n", temp_parameter);
964  return temp_parameter;
965  }
966  else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
967  {
968  switch (*part++)
969  {
970  case '.':
971  return get_parameter_by_name(base, temp_parameter, part);
972 
973  case '@':
974  {
975  struct d3dx_top_level_parameter *top_param
976  = top_level_parameter_from_parameter(temp_parameter);
977 
978  return parameter ? NULL : get_annotation_by_name(base, top_param->annotation_count,
979  top_param->annotations, part);
980  }
981  case '[':
982  return get_parameter_element_by_name(base, temp_parameter, part);
983 
984  default:
985  FIXME("Unhandled case \"%c\"\n", *--part);
986  break;
987  }
988  }
989  }
990 
991  TRACE("Parameter not found\n");
992  return NULL;
993 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static struct d3dx_parameter * get_annotation_by_name(struct d3dx9_base_effect *base, unsigned int count, struct d3dx_parameter *parameters, const char *name)
Definition: effect.c:855
_Check_return_ _CRTIMP size_t __cdecl strcspn(_In_z_ const char *_Str, _In_z_ const char *_Control)
GLuint GLuint GLsizei count
Definition: gl.h:1545
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
struct d3dx_parameter * get_parameter_by_name(struct d3dx9_base_effect *base, struct d3dx_parameter *parameter, const char *name)
Definition: effect.c:899
#define FIXME(fmt,...)
Definition: debug.h:111
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
struct d3dx_parameter * members
struct d3dx_parameter * annotations
static struct d3dx_parameter * get_parameter_element_by_name(struct d3dx9_base_effect *base, struct d3dx_parameter *parameter, const char *name)
Definition: effect.c:817
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
int strncmp(const char *String1, const char *String2, ACPI_SIZE Count)
Definition: utclib.c:534
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERR(fmt,...)
Definition: debug.h:110
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
static struct d3dx_top_level_parameter * top_level_parameter_from_parameter(struct d3dx_parameter *param)
Definition: rbtree.h:35
#define NULL
Definition: types.h:112
#define rb_entry(ptr, type, member)
Definition: rbtree.h:130
Definition: name.c:38
static struct wine_rb_entry * wine_rb_get(const struct wine_rb_tree *tree, const void *key)
Definition: rbtree.h:203
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

Referenced by d3dx9_base_effect_get_parameter_by_name(), d3dx9_base_effect_init(), d3dx9_parse_array_selector(), d3dx9_parse_resource(), get_annotation_by_name(), get_constants_desc(), get_parameter_element_by_name(), and get_valid_parameter().

◆ is_conversion_from_supported()

static BOOL is_conversion_from_supported ( const struct pixel_format_desc format)
inlinestatic

Definition at line 78 of file d3dx9_private.h.

79 {
80  if (format->type == FORMAT_ARGB || format->type == FORMAT_ARGBF16
81  || format->type == FORMAT_ARGBF)
82  return TRUE;
83  return !!format->to_rgba;
84 }
#define TRUE
Definition: types.h:120
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546

Referenced by D3DXLoadSurfaceFromMemory(), D3DXLoadVolumeFromMemory(), and D3DXSaveSurfaceToFileInMemory().

◆ is_conversion_to_supported()

static BOOL is_conversion_to_supported ( const struct pixel_format_desc format)
inlinestatic

Definition at line 86 of file d3dx9_private.h.

87 {
88  if (format->type == FORMAT_ARGB || format->type == FORMAT_ARGBF16
89  || format->type == FORMAT_ARGBF)
90  return TRUE;
91  return !!format->from_rgba;
92 }
#define TRUE
Definition: types.h:120
GLint GLint GLsizei GLsizei GLsizei GLint GLenum format
Definition: gl.h:1546

Referenced by D3DXLoadSurfaceFromMemory(), D3DXLoadVolumeFromMemory(), and D3DXSaveSurfaceToFileInMemory().

◆ is_param_dirty()

static BOOL is_param_dirty ( struct d3dx_parameter param,
ULONG64  update_version 
)
inlinestatic

Definition at line 375 of file d3dx9_private.h.

376 {
377  return is_top_level_param_dirty(param->top_level_param, update_version);
378 }
static BOOL is_top_level_param_dirty(struct d3dx_top_level_parameter *param, ULONG64 update_version)
GLfloat param
Definition: glext.h:5796

Referenced by d3dx9_get_param_value_ptr(), and set_constants().

◆ is_param_eval_input_dirty()

BOOL is_param_eval_input_dirty ( struct d3dx_param_eval peval,
ULONG64  update_version 
)

Definition at line 1718 of file preshader.c.

1719 {
1720  return is_const_tab_input_dirty(&peval->pres.inputs, update_version)
1722 }
static BOOL is_const_tab_input_dirty(struct d3dx_const_tab *ctab, ULONG64 update_version)
Definition: preshader.c:1703
struct d3dx_const_tab shader_inputs
struct d3dx_preshader pres

Referenced by d3dx9_get_param_value_ptr().

◆ is_param_type_sampler()

◆ is_top_level_param_dirty()

static BOOL is_top_level_param_dirty ( struct d3dx_top_level_parameter param,
ULONG64  update_version 
)
inlinestatic

Definition at line 365 of file d3dx9_private.h.

366 {
367  struct d3dx_shared_data *shared_data;
368 
369  if ((shared_data = param->shared_data))
370  return update_version < shared_data->update_version;
371  else
372  return update_version < param->update_version;
373 }
ULONG64 update_version
GLfloat param
Definition: glext.h:5796

Referenced by is_const_tab_input_dirty(), and is_param_dirty().

◆ is_top_level_parameter()

static BOOL is_top_level_parameter ( struct d3dx_parameter param)
inlinestatic

Definition at line 349 of file d3dx9_private.h.

350 {
351  return &param->top_level_param->param == param;
352 }
GLfloat param
Definition: glext.h:5796

Referenced by add_param_to_tree(), d3dx9_base_effect_get_parameter_desc(), get_annotation_from_object(), and get_constants_desc().

◆ load_cube_texture_from_dds()

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 
)

◆ load_resource_into_memory()

HRESULT load_resource_into_memory ( HMODULE  module,
HRSRC  resinfo,
void **  buffer,
DWORD length 
)

Definition at line 166 of file util.c.

167 {
169 
170  *length = SizeofResource(module, resinfo);
171  if(*length == 0) return HRESULT_FROM_WIN32(GetLastError());
172 
173  resource = LoadResource(module, resinfo);
174  if( !resource ) return HRESULT_FROM_WIN32(GetLastError());
175 
177  if(*buffer == NULL) return HRESULT_FROM_WIN32(GetLastError());
178 
179  return S_OK;
180 }
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
GLuint buffer
Definition: glext.h:5915
int resource
Definition: rdpsnd_sgi.c:44
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568

Referenced by D3DXAssembleShaderFromResourceA(), D3DXAssembleShaderFromResourceW(), D3DXCompileShaderFromResourceA(), D3DXCompileShaderFromResourceW(), D3DXCreateEffectCompilerFromResourceA(), D3DXCreateEffectCompilerFromResourceW(), D3DXCreateEffectFromResourceExA(), D3DXCreateEffectFromResourceExW(), D3DXCreateTextureFromResourceExA(), D3DXCreateTextureFromResourceExW(), D3DXGetImageInfoFromResourceA(), D3DXGetImageInfoFromResourceW(), D3DXLoadMeshFromXResource(), D3DXLoadSurfaceFromResourceA(), D3DXLoadSurfaceFromResourceW(), D3DXPreprocessShaderFromResourceA(), and D3DXPreprocessShaderFromResourceW().

◆ load_texture_from_dds()

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 
)

Definition at line 697 of file surface.c.

700 {
701  HRESULT hr;
702  RECT src_rect;
703  UINT src_pitch;
704  UINT mip_level;
705  UINT mip_levels;
706  UINT mip_level_size;
707  UINT width, height;
708  IDirect3DSurface9 *surface;
709  const struct dds_header *header = src_data;
710  const BYTE *pixels = (BYTE *)(header + 1);
711 
712  /* Loading a cube texture as a simple texture is also supported
713  * (only first face texture is taken). Same with volume textures. */
714  if ((src_info->ResourceType != D3DRTYPE_TEXTURE)
715  && (src_info->ResourceType != D3DRTYPE_CUBETEXTURE)
716  && (src_info->ResourceType != D3DRTYPE_VOLUMETEXTURE))
717  {
718  WARN("Trying to load a %u resource as a 2D texture, returning failure.\n", src_info->ResourceType);
719  return D3DXERR_INVALIDDATA;
720  }
721 
722  width = src_info->Width;
723  height = src_info->Height;
724  mip_levels = min(src_info->MipLevels, IDirect3DTexture9_GetLevelCount(texture));
725  if (src_info->ResourceType == D3DRTYPE_VOLUMETEXTURE)
726  mip_levels = 1;
727  for (mip_level = 0; mip_level < mip_levels + skip_levels; ++mip_level)
728  {
729  hr = calculate_dds_surface_size(src_info->Format, width, height, &src_pitch, &mip_level_size);
730  if (FAILED(hr)) return hr;
731 
732  if (mip_level >= skip_levels)
733  {
734  SetRect(&src_rect, 0, 0, width, height);
735 
736  IDirect3DTexture9_GetSurfaceLevel(texture, mip_level - skip_levels, &surface);
737  hr = D3DXLoadSurfaceFromMemory(surface, palette, NULL, pixels, src_info->Format, src_pitch,
738  NULL, &src_rect, filter, color_key);
739  IDirect3DSurface9_Release(surface);
740  if (FAILED(hr))
741  return hr;
742  }
743 
744  pixels += mip_level_size;
745  width = max(1, width / 2);
746  height = max(1, height / 2);
747  }
748 
749  *loaded_miplevels = mip_levels - skip_levels;
750 
751  return D3D_OK;
752 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
GLint GLint GLsizei width
Definition: gl.h:1546
#define max(a, b)
Definition: svc.c:63
HRESULT hr
Definition: shlfolder.c:183
#define IDirect3DTexture9_GetSurfaceLevel(p, a, b)
Definition: d3d9.h:1033
#define WARN(fmt,...)
Definition: debug.h:112
#define IDirect3DTexture9_GetLevelCount(p)
Definition: d3d9.h:1027
D3DRESOURCETYPE ResourceType
Definition: d3dx9tex.h:83
UINT MipLevels
Definition: d3dx9tex.h:81
D3DFORMAT Format
Definition: d3dx9tex.h:82
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:79
static HRESULT calculate_dds_surface_size(D3DFORMAT format, UINT width, UINT height, UINT *pitch, UINT *size)
Definition: surface.c:412
unsigned char BYTE
Definition: xxhash.c:193
static HPALETTE palette
Definition: clipboard.c:1345
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
#define D3D_OK
Definition: d3d.h:106
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)
Definition: surface.c:1931
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

Referenced by D3DXCreateTextureFromFileInMemoryEx().

◆ load_volume_from_dds()

HRESULT load_volume_from_dds ( IDirect3DVolume9 *  dst_volume,
const PALETTEENTRY dst_palette,
const D3DBOX dst_box,
const void src_data,
const D3DBOX src_box,
DWORD  filter,
D3DCOLOR  color_key,
const D3DXIMAGE_INFO src_info 
)

Definition at line 679 of file surface.c.

682 {
683  UINT row_pitch, slice_pitch;
684  const struct dds_header *header = src_data;
685  const BYTE *pixels = (BYTE *)(header + 1);
686 
687  if (src_info->ResourceType != D3DRTYPE_VOLUMETEXTURE)
688  return D3DXERR_INVALIDDATA;
689 
690  if (FAILED(calculate_dds_surface_size(src_info->Format, src_info->Width, src_info->Height, &row_pitch, &slice_pitch)))
691  return E_NOTIMPL;
692 
693  return D3DXLoadVolumeFromMemory(dst_volume, dst_palette, dst_box, pixels, src_info->Format,
694  row_pitch, slice_pitch, NULL, src_box, filter, color_key);
695 }
D3DRESOURCETYPE ResourceType
Definition: d3dx9tex.h:83
D3DFORMAT Format
Definition: d3dx9tex.h:82
static HRESULT calculate_dds_surface_size(D3DFORMAT format, UINT width, UINT height, UINT *pitch, UINT *size)
Definition: surface.c:412
unsigned char BYTE
Definition: xxhash.c:193
HRESULT WINAPI D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume, const PALETTEENTRY *dst_palette, const D3DBOX *dst_box, const void *src_memory, D3DFORMAT src_format, UINT src_row_pitch, UINT src_slice_pitch, const PALETTEENTRY *src_palette, const D3DBOX *src_box, DWORD filter, D3DCOLOR color_key)
Definition: volume.c:85
#define E_NOTIMPL
Definition: ddrawi.h:99
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

Referenced by D3DXLoadVolumeFromFileInMemory().

◆ load_volume_texture_from_dds()

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 
)

Definition at line 807 of file surface.c.

809 {
810  HRESULT hr;
811  UINT mip_level;
812  UINT mip_levels;
813  UINT src_slice_pitch;
814  UINT src_row_pitch;
815  D3DBOX src_box;
817  IDirect3DVolume9 *volume;
818  const struct dds_header *header = src_data;
819  const BYTE *pixels = (BYTE *)(header + 1);
820 
821  if (src_info->ResourceType != D3DRTYPE_VOLUMETEXTURE)
822  return D3DXERR_INVALIDDATA;
823 
824  width = src_info->Width;
825  height = src_info->Height;
826  depth = src_info->Depth;
827  mip_levels = min(src_info->MipLevels, IDirect3DVolumeTexture9_GetLevelCount(volume_texture));
828 
829  for (mip_level = 0; mip_level < mip_levels; mip_level++)
830  {
831  hr = calculate_dds_surface_size(src_info->Format, width, height, &src_row_pitch, &src_slice_pitch);
832  if (FAILED(hr)) return hr;
833 
834  hr = IDirect3DVolumeTexture9_GetVolumeLevel(volume_texture, mip_level, &volume);
835  if (FAILED(hr)) return hr;
836 
837  src_box.Left = 0;
838  src_box.Top = 0;
839  src_box.Right = width;
840  src_box.Bottom = height;
841  src_box.Front = 0;
842  src_box.Back = depth;
843 
845  src_row_pitch, src_slice_pitch, NULL, &src_box, filter, color_key);
846 
848  if (FAILED(hr)) return hr;
849 
850  pixels += depth * src_slice_pitch;
851  width = max(1, width / 2);
852  height = max(1, height / 2);
853  depth = max(1, depth / 2);
854  }
855 
856  return D3D_OK;
857 }
GLint GLint GLsizei width
Definition: gl.h:1546
#define max(a, b)
Definition: svc.c:63
HRESULT hr
Definition: shlfolder.c:183
#define IDirect3DVolumeTexture9_GetLevelCount(p)
Definition: d3d9.h:1122
D3DRESOURCETYPE ResourceType
Definition: d3dx9tex.h:83
UINT MipLevels
Definition: d3dx9tex.h:81
UINT Back
Definition: d3d8types.h:1016
UINT Bottom
Definition: d3d8types.h:1014
D3DFORMAT Format
Definition: d3dx9tex.h:82
UINT Top
Definition: d3d8types.h:1012
LONG HRESULT
Definition: typedefs.h:79
UINT Left
Definition: d3d8types.h:1011
static HRESULT calculate_dds_surface_size(D3DFORMAT format, UINT width, UINT height, UINT *pitch, UINT *size)
Definition: surface.c:412
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define IDirect3DVolume9_Release(p)
Definition: d3d9.h:383
unsigned char BYTE
Definition: xxhash.c:193
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 D3DXLoadVolumeFromMemory(IDirect3DVolume9 *dst_volume, const PALETTEENTRY *dst_palette, const D3DBOX *dst_box, const void *src_memory, D3DFORMAT src_format, UINT src_row_pitch, UINT src_slice_pitch, const PALETTEENTRY *src_palette, const D3DBOX *src_box, DWORD filter, D3DCOLOR color_key)
Definition: volume.c:85
UINT Front
Definition: d3d8types.h:1015
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
#define IDirect3DVolumeTexture9_GetVolumeLevel(p, a, b)
Definition: d3d9.h:1128
UINT Right
Definition: d3d8types.h:1013
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005

Referenced by D3DXCreateVolumeTextureFromFileInMemoryEx().

◆ lock_surface()

HRESULT lock_surface ( IDirect3DSurface9 *  surface,
D3DLOCKED_RECT lock,
IDirect3DSurface9 **  temp_surface,
BOOL  write 
)

Definition at line 206 of file surface.c.

208 {
209  IDirect3DDevice9 *device;
211  DWORD lock_flag;
212  HRESULT hr;
213 
214  lock_flag = write ? D3DLOCK_DISCARD : D3DLOCK_READONLY;
215  *temp_surface = NULL;
216  if (FAILED(hr = IDirect3DSurface9_LockRect(surface, lock, NULL, lock_flag)))
217  {
219  IDirect3DSurface9_GetDesc(surface, &desc);
220 
222  desc.Format, D3DPOOL_SYSTEMMEM, temp_surface, NULL)
224  desc.Format, D3DMULTISAMPLE_NONE, 0, TRUE, temp_surface, NULL);
225  if (FAILED(hr))
226  {
227  WARN("Failed to create temporary surface, surface %p, format %#x,"
228  " usage %#x, pool %#x, write %#x, width %u, height %u.\n",
229  surface, desc.Format, desc.Usage, desc.Pool, write, desc.Width, desc.Height);
231  return hr;
232  }
233 
235  *temp_surface, NULL, D3DTEXF_NONE)))
236  hr = IDirect3DSurface9_LockRect(*temp_surface, lock, NULL, lock_flag);
237 
239  if (FAILED(hr))
240  {
241  WARN("Failed to lock surface %p, write %#x, usage %#x, pool %#x.\n",
242  surface, write, desc.Usage, desc.Pool);
243  IDirect3DSurface9_Release(*temp_surface);
244  *temp_surface = NULL;
245  return hr;
246  }
247  TRACE("Created temporary surface %p.\n", surface);
248  }
249  return hr;
250 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
rwlock_t lock
Definition: tcpcore.h:1163
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
#define D3DLOCK_DISCARD
Definition: d3d8types.h:72
#define IDirect3DSurface9_GetDevice(p, a)
Definition: d3d9.h:624
#define IDirect3DDevice9_CreateRenderTarget(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1535
FxDevice * device
#define IDirect3DDevice9_CreateOffscreenPlainSurface(p, a, b, c, d, e, f)
Definition: d3d9.h:1543
#define write
Definition: acwin.h:97
Definition: devices.h:37
static const WCHAR desc[]
Definition: protectdata.c:36
if SUCCEEDED(hr)
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1508
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define IDirect3DSurface9_GetDesc(p, a)
Definition: d3d9.h:634
#define NULL
Definition: types.h:112
#define IDirect3DSurface9_LockRect(p, a, b, c)
Definition: d3d9.h:635
#define D3DLOCK_READONLY
Definition: d3d8types.h:69
#define IDirect3DDevice9_StretchRect(p, a, b, c, d, e)
Definition: d3d9.h:1541

Referenced by D3DXFillTexture(), D3DXLoadSurfaceFromMemory(), D3DXLoadSurfaceFromSurface(), D3DXSaveSurfaceToFileInMemory(), and save_dds_surface_to_memory().

◆ map_view_of_file()

HRESULT map_view_of_file ( const WCHAR filename,
void **  buffer,
DWORD length 
)

Definition at line 118 of file util.c.

119 {
120  HANDLE hfile, hmapping = NULL;
121 
123  if(hfile == INVALID_HANDLE_VALUE) goto error;
124 
125  *length = GetFileSize(hfile, NULL);
126  if(*length == INVALID_FILE_SIZE) goto error;
127 
128  hmapping = CreateFileMappingW(hfile, NULL, PAGE_READONLY, 0, 0, NULL);
129  if(!hmapping) goto error;
130 
131  *buffer = MapViewOfFile(hmapping, FILE_MAP_READ, 0, 0, 0);
132  if(*buffer == NULL) goto error;
133 
134  CloseHandle(hmapping);
135  CloseHandle(hfile);
136 
137  return S_OK;
138 
139 error:
140  CloseHandle(hmapping);
141  CloseHandle(hfile);
143 }
#define CloseHandle
Definition: compat.h:598
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define MapViewOfFile
Definition: compat.h:604
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
GLuint buffer
Definition: glext.h:5915
#define INVALID_FILE_SIZE
Definition: winbase.h:529
const char * filename
Definition: ioapi.h:135
#define FILE_SHARE_READ
Definition: compat.h:136
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define FILE_MAP_READ
Definition: compat.h:635
#define OPEN_EXISTING
Definition: compat.h:634
void error(char *format,...)
Definition: util.c:72
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:603
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
#define GENERIC_READ
Definition: compat.h:135
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
#define PAGE_READONLY
Definition: compat.h:138
#define CreateFileW
Definition: compat.h:600

Referenced by D3DXCreateCubeTextureFromFileA(), D3DXCreateCubeTextureFromFileExA(), D3DXCreateCubeTextureFromFileExW(), D3DXCreateCubeTextureFromFileW(), D3DXCreateEffectCompilerFromFileW(), D3DXCreateTextureFromFileExW(), D3DXCreateVolumeTextureFromFileA(), D3DXCreateVolumeTextureFromFileExA(), D3DXCreateVolumeTextureFromFileExW(), D3DXCreateVolumeTextureFromFileW(), D3DXGetImageInfoFromFileW(), D3DXLoadMeshFromXW(), D3DXLoadMeshHierarchyFromXW(), D3DXLoadSurfaceFromFileW(), and D3DXLoadVolumeFromFileW().

◆ next_update_version()

static ULONG64 next_update_version ( ULONG64 version_counter)
inlinestatic

Definition at line 360 of file d3dx9_private.h.

361 {
362  return ++*version_counter;
363 }

Referenced by d3dx_evaluate_parameter(), d3dx_param_eval_set_shader_constants(), next_effect_update_version(), and set_dirty().

◆ point_filter_argb_pixels()

void point_filter_argb_pixels ( const BYTE src,
UINT  src_row_pitch,
UINT  src_slice_pitch,
const struct volume src_size,
const struct pixel_format_desc src_format,
BYTE dst,
UINT  dst_row_pitch,
UINT  dst_slice_pitch,
const struct volume dst_size,
const struct pixel_format_desc dst_format,
D3DCOLOR  color_key,
const PALETTEENTRY palette 
)

Definition at line 1794 of file surface.c.

1798 {
1799  struct argb_conversion_info conv_info, ck_conv_info;
1800  const struct pixel_format_desc *ck_format = NULL;
1801  DWORD channels[4];
1802  UINT x, y, z;
1803 
1804  ZeroMemory(channels, sizeof(channels));
1805  init_argb_conversion_info(src_format, dst_format, &conv_info);
1806 
1807  if (color_key)
1808  {
1809  /* Color keys are always represented in D3DFMT_A8R8G8B8 format. */
1810  ck_format = get_format_info(D3DFMT_A8R8G8B8);
1811  init_argb_conversion_info(src_format, ck_format, &ck_conv_info);
1812  }
1813 
1814  for (z = 0; z < dst_size->depth; z++)
1815  {
1816  BYTE *dst_slice_ptr = dst + z * dst_slice_pitch;
1817  const BYTE *src_slice_ptr = src + src_slice_pitch * (z * src_size->depth / dst_size->depth);
1818 
1819  for (y = 0; y < dst_size->height; y++)
1820  {
1821  BYTE *dst_ptr = dst_slice_ptr + y * dst_row_pitch;
1822  const BYTE *src_row_ptr = src_slice_ptr + src_row_pitch * (y * src_size->height / dst_size->height);
1823 
1824  for (x = 0; x < dst_size->width; x++)
1825  {
1826  const BYTE *src_ptr = src_row_ptr + (x * src_size->width / dst_size->width) * src_format->bytes_per_pixel;
1827 
1828  if (!src_format->to_rgba && !dst_format->from_rgba
1829  && src_format->type == dst_format->type
1830  && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4)
1831  {
1832  DWORD val;
1833 
1834  get_relevant_argb_components(&conv_info, src_ptr, channels);
1835  val = make_argb_color(&conv_info, channels);
1836 
1837  if (color_key)
1838  {
1839  DWORD ck_pixel;
1840 
1841  get_relevant_argb_components(&ck_conv_info, src_ptr, channels);
1842  ck_pixel = make_argb_color(&ck_conv_info, channels);
1843  if (ck_pixel == color_key)
1844  val &= ~conv_info.destmask[0];
1845  }
1846  memcpy(dst_ptr, &val, dst_format->bytes_per_pixel);
1847  }
1848  else
1849  {
1850  struct vec4 color, tmp;
1851 
1852  format_to_vec4(src_format, src_ptr, &color);
1853  if (src_format->to_rgba)
1854  src_format->to_rgba(&color, &tmp, palette);
1855  else
1856  tmp = color;
1857 
1858  if (ck_format)
1859  {
1860  DWORD ck_pixel;
1861 
1862  format_from_vec4(ck_format, &tmp, (BYTE *)&ck_pixel);
1863  if (ck_pixel == color_key)
1864  tmp.w = 0.0f;
1865  }
1866 
1867  if (dst_format->from_rgba)
1868  dst_format->from_rgba(&tmp, &color);
1869  else
1870  color = tmp;
1871 
1872  format_from_vec4(dst_format, &color, dst_ptr);
1873  }
1874 
1875  dst_ptr += dst_format->bytes_per_pixel;
1876  }
1877  }
1878  }
1879 }
UINT width
Definition: d3dx9_private.h:42
static const char * dst_format
Definition: dib.c:1133
#define ZeroMemory
Definition: winbase.h:1648
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
int This channels
Definition: rdpsnd_libao.c:37
void(* to_rgba)(const struct vec4 *src, struct vec4 *dst, const PALETTEENTRY *palette)
Definition: d3dx9_private.h:67
GLuint color
Definition: glext.h:6243
GLdouble GLdouble z
Definition: glext.h:5874
UINT height
Definition: d3dx9_private.h:43
GLuint GLfloat * val
Definition: glext.h:7180
UINT depth
Definition: d3dx9_private.h:44
if(!(yy_init))
Definition: macro.lex.yy.c:714
enum format_type type
Definition: d3dx9_private.h:65
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum src
Definition: glext.h:6340
unsigned char BYTE
Definition: xxhash.c:193
static HPALETTE palette
Definition: clipboard.c:1345
static void format_from_vec4(const struct pixel_format_desc *format, const struct vec4 *src, BYTE *dst)
Definition: surface.c:1610
static void init_argb_conversion_info(const struct pixel_format_desc *srcformat, const struct pixel_format_desc *destformat, struct argb_conversion_info *info)
Definition: surface.c:1499
GLenum GLenum dst
Definition: glext.h:6340
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
static void get_relevant_argb_components(const struct argb_conversion_info *info, const BYTE *col, DWORD *out)
Definition: surface.c:1532
const struct pixel_format_desc * get_format_info(D3DFORMAT format) DECLSPEC_HIDDEN
Definition: util.c:213
static void format_to_vec4(const struct pixel_format_desc *format, const BYTE *src, struct vec4 *dst)
Definition: surface.c:1580
static DWORD make_argb_color(const struct argb_conversion_info *info, const DWORD *in)
Definition: surface.c:1562

Referenced by D3DXLoadSurfaceFromMemory(), and D3DXLoadVolumeFromMemory().

◆ save_dds_texture_to_memory()

HRESULT save_dds_texture_to_memory ( ID3DXBuffer **  dst_buffer,
IDirect3DBaseTexture9 *  src_texture,
const PALETTEENTRY src_palette 
)

Definition at line 632 of file surface.c.

633 {
634  HRESULT hr;
636  UINT mip_levels;
637  IDirect3DSurface9 *surface;
638 
639  type = IDirect3DBaseTexture9_GetType(src_texture);
640 
642  return D3DERR_INVALIDCALL;
643 
644  if (type == D3DRTYPE_CUBETEXTURE)
645  {
646  FIXME("Cube texture not supported yet\n");
647  return E_NOTIMPL;
648  }
649  else if (type == D3DRTYPE_VOLUMETEXTURE)
650  {
651  FIXME("Volume texture not supported yet\n");
652  return E_NOTIMPL;
653  }
654 
655  mip_levels = IDirect3DTexture9_GetLevelCount(src_texture);
656 
657  if (mip_levels > 1)
658  {
659  FIXME("Mipmap not supported yet\n");
660  return E_NOTIMPL;
661  }
662 
663  if (src_palette)
664  {
665  FIXME("Saving surfaces with palettized pixel formats not implemented yet\n");
666  return E_NOTIMPL;
667  }
668 
669  hr = get_surface(type, src_texture, D3DCUBEMAP_FACE_POSITIVE_X, 0, &surface);
670 
671  if (SUCCEEDED(hr))
672  {
673  hr = save_dds_surface_to_memory(dst_buffer, surface, NULL);
674  IDirect3DSurface9_Release(surface);
675  }
676 
677  return hr;
678 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
HRESULT hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
#define IDirect3DTexture9_GetLevelCount(p)
Definition: d3d9.h:1027
static HRESULT get_surface(D3DRESOURCETYPE type, struct IDirect3DBaseTexture9 *tex, int face, UINT level, struct IDirect3DSurface9 **surf)
Definition: surface.c:617
if SUCCEEDED(hr)
#define FIXME(fmt,...)
Definition: debug.h:111
#define IDirect3DBaseTexture9_GetType(p)
Definition: d3d9.h:844
LONG HRESULT
Definition: typedefs.h:79
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSurface9 *src_surface, const RECT *src_rect)
Definition: surface.c:547
enum _D3DRESOURCETYPE D3DRESOURCETYPE

Referenced by D3DXSaveTextureToFileInMemory().

◆ set_number()

static void set_number ( void outdata,
D3DXPARAMETER_TYPE  outtype,
const void indata,
D3DXPARAMETER_TYPE  intype 
)
inlinestatic

Definition at line 195 of file d3dx9_private.h.

196 {
197  if (outtype == intype)
198  {
199  *(DWORD *)outdata = *(DWORD *)indata;
200  return;
201  }
202 
203  switch (outtype)
204  {
205  case D3DXPT_FLOAT:
206  *(float *)outdata = get_float(intype, indata);
207  break;
208 
209  case D3DXPT_BOOL:
210  *(BOOL *)outdata = get_bool(intype, indata);
211  break;
212 
213  case D3DXPT_INT:
214  *(int *)outdata = get_int(intype, indata);
215  break;
216 
217  default:
218  *(DWORD *)outdata = 0;
219  break;
220  }
221 }
static int get_int(D3DXPARAMETER_TYPE type, const void *data)
static float get_float(D3DXPARAMETER_TYPE type, const void *data)
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL get_bool(D3DXPARAMETER_TYPE type, const void *data)
unsigned long DWORD
Definition: ntddk_ex.h:95

Referenced by d3dx_evaluate_parameter(), and set().

◆ top_level_parameter_from_parameter()

static struct d3dx_top_level_parameter* top_level_parameter_from_parameter ( struct d3dx_parameter param)
inlinestatic

Definition at line 355 of file d3dx9_private.h.

356 {
358 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
GLfloat param
Definition: glext.h:5796

Referenced by d3dx9_base_effect_get_parameter_desc(), get_annotation_from_object(), get_parameter_by_name(), and is_const_tab_input_dirty().

◆ unlock_surface()

HRESULT unlock_surface ( IDirect3DSurface9 *  surface,
D3DLOCKED_RECT lock,
IDirect3DSurface9 *  temp_surface,
BOOL  update 
)

Definition at line 252 of file surface.c.

254 {
255  IDirect3DDevice9 *device;
256  HRESULT hr;
257 
258  if (!temp_surface)
259  return IDirect3DSurface9_UnlockRect(surface);
260 
261  hr = IDirect3DSurface9_UnlockRect(temp_surface);
262  if (update)
263  {
265  if (FAILED(hr = IDirect3DDevice9_UpdateSurface(device, temp_surface, NULL, surface, NULL)))
266  WARN("Updating surface failed, hr %#x, surface %p, temp_surface %p.\n",
267  hr, surface, temp_surface);
269  }
270  IDirect3DSurface9_Release(temp_surface);
271  return hr;
272 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:112
#define IDirect3DSurface9_GetDevice(p, a)
Definition: d3d9.h:624
FxDevice * device
Definition: devices.h:37
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1508
LONG HRESULT
Definition: typedefs.h:79
#define IDirect3DDevice9_UpdateSurface(p, a, b, c, d)
Definition: d3d9.h:1537
#define NULL
Definition: types.h:112
#define IDirect3DSurface9_UnlockRect(p)
Definition: d3d9.h:636

Referenced by D3DXFillTexture(), D3DXLoadSurfaceFromMemory(), D3DXLoadSurfaceFromSurface(), D3DXSaveSurfaceToFileInMemory(), and save_dds_surface_to_memory().

◆ write_buffer_to_file()

HRESULT write_buffer_to_file ( const WCHAR filename,
ID3DXBuffer buffer 
)

Definition at line 182 of file util.c.

183 {
184  HRESULT hr = S_OK;
185  void *buffer_pointer;
187  DWORD bytes_written;
189  if (file == INVALID_HANDLE_VALUE)
191 
192  buffer_pointer = ID3DXBuffer_GetBufferPointer(buffer);
194 
195  if (!WriteFile(file, buffer_pointer, buffer_size, &bytes_written, NULL))
197 
198  CloseHandle(file);
199  return hr;
200 }
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
#define CloseHandle
Definition: compat.h:598
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
GLuint buffer
Definition: glext.h:5915
#define GENERIC_WRITE
Definition: nt_native.h:90
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
#define ID3DXBuffer_GetBufferSize(p)
Definition: d3dx9core.h:86
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define S_OK
Definition: intsafe.h:51
#define CREATE_ALWAYS
Definition: disk.h:72
#define NULL
Definition: types.h:112
#define CreateFileW
Definition: compat.h:600
#define ID3DXBuffer_GetBufferPointer(p)
Definition: d3dx9core.h:85
Definition: fci.c:126

Referenced by D3DXSaveSurfaceToFileA(), D3DXSaveSurfaceToFileW(), D3DXSaveTextureToFileA(), and D3DXSaveTextureToFileW().

Variable Documentation

◆ DECLSPEC_HIDDEN

const struct ID3DXIncludeVtbl d3dx_include_from_file_vtbl DECLSPEC_HIDDEN

Definition at line 76 of file d3dx9_private.h.