ReactOS  0.4.14-dev-98-gb0d4763
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 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 386 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 384 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 228 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 1632 of file surface.c.

1636 {
1637  struct argb_conversion_info conv_info, ck_conv_info;
1638  const struct pixel_format_desc *ck_format = NULL;
1639  DWORD channels[4];
1640  UINT min_width, min_height, min_depth;
1641  UINT x, y, z;
1642 
1643  ZeroMemory(channels, sizeof(channels));
1644  init_argb_conversion_info(src_format, dst_format, &conv_info);
1645 
1646  min_width = min(src_size->width, dst_size->width);
1647  min_height = min(src_size->height, dst_size->height);
1648  min_depth = min(src_size->depth, dst_size->depth);
1649 
1650  if (color_key)
1651  {
1652  /* Color keys are always represented in D3DFMT_A8R8G8B8 format. */
1653  ck_format = get_format_info(D3DFMT_A8R8G8B8);
1654  init_argb_conversion_info(src_format, ck_format, &ck_conv_info);
1655  }
1656 
1657  for (z = 0; z < min_depth; z++) {
1658  const BYTE *src_slice_ptr = src + z * src_slice_pitch;
1659  BYTE *dst_slice_ptr = dst + z * dst_slice_pitch;
1660 
1661  for (y = 0; y < min_height; y++) {
1662  const BYTE *src_ptr = src_slice_ptr + y * src_row_pitch;
1663  BYTE *dst_ptr = dst_slice_ptr + y * dst_row_pitch;
1664 
1665  for (x = 0; x < min_width; x++) {
1666  if (!src_format->to_rgba && !dst_format->from_rgba
1667  && src_format->type == dst_format->type
1668  && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4)
1669  {
1670  DWORD val;
1671 
1672  get_relevant_argb_components(&conv_info, src_ptr, channels);
1673  val = make_argb_color(&conv_info, channels);
1674 
1675  if (color_key)
1676  {
1677  DWORD ck_pixel;
1678 
1679  get_relevant_argb_components(&ck_conv_info, src_ptr, channels);
1680  ck_pixel = make_argb_color(&ck_conv_info, channels);
1681  if (ck_pixel == color_key)
1682  val &= ~conv_info.destmask[0];
1683  }
1684  memcpy(dst_ptr, &val, dst_format->bytes_per_pixel);
1685  }
1686  else
1687  {
1688  struct vec4 color, tmp;
1689 
1690  format_to_vec4(src_format, src_ptr, &color);
1691  if (src_format->to_rgba)
1692  src_format->to_rgba(&color, &tmp, palette);
1693  else
1694  tmp = color;
1695 
1696  if (ck_format)
1697  {
1698  DWORD ck_pixel;
1699 
1700  format_from_vec4(ck_format, &tmp, (BYTE *)&ck_pixel);
1701  if (ck_pixel == color_key)
1702  tmp.w = 0.0f;
1703  }
1704 
1705  if (dst_format->from_rgba)
1706  dst_format->from_rgba(&tmp, &color);
1707  else
1708  color = tmp;
1709 
1710  format_from_vec4(dst_format, &color, dst_ptr);
1711  }
1712 
1713  src_ptr += src_format->bytes_per_pixel;
1714  dst_ptr += dst_format->bytes_per_pixel;
1715  }
1716 
1717  if (src_size->width < dst_size->width) /* black out remaining pixels */
1718  memset(dst_ptr, 0, dst_format->bytes_per_pixel * (dst_size->width - src_size->width));
1719  }
1720 
1721  if (src_size->height < dst_size->height) /* black out remaining pixels */
1722  memset(dst + src_size->height * dst_row_pitch, 0, dst_row_pitch * (dst_size->height - src_size->height));
1723  }
1724  if (src_size->depth < dst_size->depth) /* black out remaining pixels */
1725  memset(dst + src_size->depth * dst_slice_pitch, 0, dst_slice_pitch * (dst_size->depth - src_size->depth));
1726 }
UINT width
Definition: d3dx9_private.h:42
static const char * dst_format
Definition: dib.c:1133
#define ZeroMemory
Definition: winbase.h:1642
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
smooth NULL
Definition: ftsmooth.c:416
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
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
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:1551
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:1440
GLenum GLenum dst
Definition: glext.h:6340
#define min(a, b)
Definition: monoChain.cc:55
unsigned int UINT
Definition: ndis.h:50
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:1473
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:1521
#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:1503

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 1601 of file surface.c.

1604 {
1605  UINT row, slice;
1606  BYTE *dst_addr;
1607  const BYTE *src_addr;
1608  UINT row_block_count = (size->width + format->block_width - 1) / format->block_width;
1609  UINT row_count = (size->height + format->block_height - 1) / format->block_height;
1610 
1611  for (slice = 0; slice < size->depth; slice++)
1612  {
1613  src_addr = src + slice * src_slice_pitch;
1614  dst_addr = dst + slice * dst_slice_pitch;
1615 
1616  for (row = 0; row < row_count; row++)
1617  {
1618  memcpy(dst_addr, src_addr, row_block_count * format->block_byte_count);
1619  src_addr += src_row_pitch;
1620  dst_addr += dst_row_pitch;
1621  }
1622  }
1623 }
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
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
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
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define D3DDECL_END()
Definition: d3d9types.h:311
#define D3D_OK
Definition: d3d.h:106

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 1232 of file preshader.c.

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

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 1722 of file preshader.c.

1724 {
1725  HRESULT hr;
1726  unsigned int i;
1727  unsigned int elements, elements_param, elements_table;
1728  float *oc;
1729 
1730  TRACE("peval %p, param %p, param_value %p.\n", peval, param, param_value);
1731 
1732  if (is_const_tab_input_dirty(&peval->pres.inputs, ULONG64_MAX))
1733  {
1734  set_constants(&peval->pres.regs, &peval->pres.inputs,
1736  NULL, NULL, peval->param_type, FALSE, FALSE);
1737 
1738  if (FAILED(hr = execute_preshader(&peval->pres)))
1739  return hr;
1740  }
1741 
1742  elements_table = get_offset_reg(PRES_REGTAB_OCONST, peval->pres.regs.table_sizes[PRES_REGTAB_OCONST]);
1743  elements_param = param->bytes / sizeof(unsigned int);
1744  elements = min(elements_table, elements_param);
1745  oc = (float *)peval->pres.regs.tables[PRES_REGTAB_OCONST];
1746  for (i = 0; i < elements; ++i)
1747  set_number((unsigned int *)param_value + i, param->type, oc + i, D3DXPT_FLOAT);
1748  return D3D_OK;
1749 }
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:1482
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:1701
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
smooth NULL
Definition: ftsmooth.c:416
static HRESULT execute_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1658
#define TRACE(s)
Definition: solgame.cpp:4
static unsigned int get_offset_reg(unsigned int table, unsigned int reg_idx)
Definition: preshader.c:300
static ULONG64 next_update_version(ULONG64 *version_counter)
LONG HRESULT
Definition: typedefs.h:77
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
#define min(a, b)
Definition: monoChain.cc:55
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 1357 of file preshader.c.

1358 {
1359  TRACE("peval %p.\n", peval);
1360 
1361  if (!peval)
1362  return;
1363 
1364  d3dx_free_preshader(&peval->pres);
1366  HeapFree(GetProcessHeap(), 0, peval);
1367 }
static void d3dx_free_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1349
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
struct d3dx_const_tab shader_inputs
struct d3dx_preshader pres
static void d3dx_free_const_tab(struct d3dx_const_tab *ctab)
Definition: preshader.c:1342
#define HeapFree(x, y, z)
Definition: compat.h:394

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 1751 of file preshader.c.

1753 {
1754  HRESULT hr;
1755  struct d3dx_preshader *pres = &peval->pres;
1756  struct d3dx_regstore *rs = &pres->regs;
1757  ULONG64 new_update_version = next_update_version(peval->version_counter);
1758  BOOL pres_dirty = FALSE;
1759 
1760  TRACE("device %p, peval %p, param_type %u.\n", device, peval, peval->param_type);
1761 
1763  {
1764  set_constants(rs, &pres->inputs, new_update_version,
1765  NULL, NULL, peval->param_type, FALSE, FALSE);
1766  if (FAILED(hr = execute_preshader(pres)))
1767  return hr;
1768  pres_dirty = TRUE;
1769  }
1770 
1771  return set_constants(rs, &peval->shader_inputs, new_update_version,
1772  manager, device, peval->param_type, update_all, pres_dirty);
1773 }
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:1482
#define TRUE
Definition: types.h:120
HRESULT hr
Definition: shlfolder.c:183
static BOOL is_const_tab_input_dirty(struct d3dx_const_tab *ctab, ULONG64 update_version)
Definition: preshader.c:1701
unsigned int BOOL
Definition: ntddk_ex.h:94
Definition: devices.h:37
smooth NULL
Definition: ftsmooth.c:416
static HRESULT execute_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1658
#define TRACE(s)
Definition: solgame.cpp:4
static ULONG64 next_update_version(ULONG64 *version_counter)
LONG HRESULT
Definition: typedefs.h:77
#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
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 ctab_constant * get_valid_constant(struct ID3DXConstantTableImpl *table, D3DXHANDLE handle)
Definition: shader.c:880
static struct ID3DXConstantTableImpl * impl_from_ID3DXConstantTable(ID3DXConstantTable *iface)
Definition: shader.c:755

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:110
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:110
#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:110
#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 2247 of file math.c.

2248 {
2249  const unsigned short s = (in & 0x8000);
2250  const unsigned short e = (in & 0x7C00) >> 10;
2251  const unsigned short m = in & 0x3FF;
2252  const float sgn = (s ? -1.0f : 1.0f);
2253 
2254  if (e == 0)
2255  {
2256  if (m == 0) return sgn * 0.0f; /* +0.0 or -0.0 */
2257  else return sgn * powf(2, -14.0f) * (m / 1024.0f);
2258  }
2259  else
2260  {
2261  return sgn * powf(2, e - 15.0f) * (1.0f + (m / 1024.0f));
2262  }
2263 }
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 2146 of file math.c.

2147 {
2148  int exp = 0, origexp;
2149  float tmp = fabsf(in);
2150  int sign = (copysignf(1, in) < 0);
2151  unsigned int mantissa;
2152  unsigned short ret;
2153 
2154  /* Deal with special numbers */
2155  if (isinf(in)) return (sign ? 0xffff : 0x7fff);
2156  if (isnan(in)) return (sign ? 0xffff : 0x7fff);
2157  if (in == 0.0f) return (sign ? 0x8000 : 0x0000);
2158 
2159  if (tmp < (float)(1u << 10))
2160  {
2161  do
2162  {
2163  tmp *= 2.0f;
2164  exp--;
2165  } while (tmp < (float)(1u << 10));
2166  }
2167  else if (tmp >= (float)(1u << 11))
2168  {
2169  do
2170  {
2171  tmp /= 2.0f;
2172  exp++;
2173  } while (tmp >= (float)(1u << 11));
2174  }
2175 
2176  exp += 10; /* Normalize the mantissa */
2177  exp += 15; /* Exponent is encoded with excess 15 */
2178 
2179  origexp = exp;
2180 
2181  mantissa = (unsigned int) tmp;
2182  if ((tmp - mantissa == 0.5f && mantissa % 2 == 1) || /* round half to even */
2183  (tmp - mantissa > 0.5f))
2184  {
2185  mantissa++; /* round to nearest, away from zero */
2186  }
2187  if (mantissa == 2048)
2188  {
2189  mantissa = 1024;
2190  exp++;
2191  }
2192 
2193  if (exp > 31)
2194  {
2195  /* too big */
2196  ret = 0x7fff; /* INF */
2197  }
2198  else if (exp <= 0)
2199  {
2200  unsigned int rounding = 0;
2201 
2202  /* Denormalized half float */
2203 
2204  /* return 0x0000 (=0.0) for numbers too small to represent in half floats */
2205  if (exp < -11)
2206  return (sign ? 0x8000 : 0x0000);
2207 
2208  exp = origexp;
2209 
2210  /* the 13 extra bits from single precision are used for rounding */
2211  mantissa = (unsigned int)(tmp * (1u << 13));
2212  mantissa >>= 1 - exp; /* denormalize */
2213 
2214  mantissa -= ~(mantissa >> 13) & 1; /* round half to even */
2215  /* remove 13 least significant bits to get half float precision */
2216  mantissa >>= 12;
2217  rounding = mantissa & 1;
2218  mantissa >>= 1;
2219 
2220  ret = mantissa + rounding;
2221  }
2222  else
2223  {
2224  ret = (exp << 10) | (mantissa & 0x3ff);
2225  }
2226 
2227  ret |= ((sign ? 1 : 0) << 15); /* Add the sign */
2228  return ret;
2229 }
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:64
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:15681
_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 136 of file d3dx9_private.h.

137 {
138  switch (type)
139  {
140  case D3DXPT_FLOAT:
141  case D3DXPT_INT:
142  case D3DXPT_BOOL:
143  return !!*(DWORD *)data;
144 
145  case D3DXPT_VOID:
146  return *(BOOL *)data;
147 
148  default:
149  return FALSE;
150  }
151 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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

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 172 of file d3dx9_private.h.

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

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
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 FIXME(fmt,...)
Definition: debug.h:110
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:47

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
smooth NULL
Definition: ftsmooth.c:416
#define ARRAY_SIZE(a)
Definition: main.h:24

Referenced by D3DXCheckTextureRequirements().

◆ get_int()

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

Definition at line 153 of file d3dx9_private.h.

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

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 898 of file effect.c.

900 {
901  struct d3dx_parameter *temp_parameter;
902  unsigned int name_len, param_name_len;
903  unsigned int i, count, length;
904  struct wine_rb_entry *entry;
905  unsigned int full_name_size;
906  const char *part;
907  char *full_name;
908 
909  TRACE("base %p, parameter %p, name %s\n", base, parameter, debugstr_a(name));
910 
911  if (!name || !*name) return NULL;
912 
913  if (!parameter)
914  {
915  if ((entry = wine_rb_get(&base->param_tree, name)))
917  return NULL;
918  }
919 
920  /* Pass / technique annotations are not in the parameters tree. */
921  if (parameter->full_name)
922  {
923  name_len = strlen(name);
924  param_name_len = strlen(parameter->full_name);
925  full_name_size = name_len + param_name_len + 2;
926  if (base->full_name_tmp_size < full_name_size)
927  {
928  if (!(full_name = heap_realloc(base->full_name_tmp, full_name_size)))
929  {
930  ERR("Out of memory.\n");
931  return NULL;
932  }
933  base->full_name_tmp = full_name;
934  base->full_name_tmp_size = full_name_size;
935  }
936  else
937  {
938  full_name = base->full_name_tmp;
939  }
940  memcpy(full_name, parameter->full_name, param_name_len);
941  full_name[param_name_len] = '.';
942  memcpy(full_name + param_name_len + 1, name, name_len);
943  full_name[param_name_len + 1 + name_len] = 0;
944 
945  if ((entry = wine_rb_get(&base->param_tree, full_name)))
947  return NULL;
948  }
949 
950  count = parameter ? parameter->member_count : base->parameter_count;
951 
952  length = strcspn( name, "[.@" );
953  part = name + length;
954 
955  for (i = 0; i < count; i++)
956  {
957  temp_parameter = !parameter ? &base->parameters[i].param
958  : &parameter->members[i];
959 
960  if (!strcmp(temp_parameter->name, name))
961  {
962  TRACE("Returning parameter %p\n", temp_parameter);
963  return temp_parameter;
964  }
965  else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
966  {
967  switch (*part++)
968  {
969  case '.':
970  return get_parameter_by_name(base, temp_parameter, part);
971 
972  case '@':
973  {
974  struct d3dx_top_level_parameter *top_param
975  = top_level_parameter_from_parameter(temp_parameter);
976 
977  return parameter ? NULL : get_annotation_by_name(base, top_param->annotation_count,
978  top_param->annotations, part);
979  }
980  case '[':
981  return get_parameter_element_by_name(base, temp_parameter, part);
982 
983  default:
984  FIXME("Unhandled case \"%c\"\n", *--part);
985  break;
986  }
987  }
988  }
989 
990  TRACE("Parameter not found\n");
991  return NULL;
992 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
_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
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 FIXME(fmt,...)
Definition: debug.h:110
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:854
struct d3dx_parameter * members
smooth NULL
Definition: ftsmooth.c:416
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:816
#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
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
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:109
struct d3dx_parameter * get_parameter_by_name(struct d3dx9_base_effect *base, struct d3dx_parameter *parameter, const char *name)
Definition: effect.c:898
static struct d3dx_top_level_parameter * top_level_parameter_from_parameter(struct d3dx_parameter *param)
Definition: rbtree.h:35
#define rb_entry(ptr, type, member)
Definition: rbtree.h:130
Definition: name.c:36
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 371 of file d3dx9_private.h.

372 {
373  return is_top_level_param_dirty(param->top_level_param, update_version);
374 }
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 1716 of file preshader.c.

1717 {
1718  return is_const_tab_input_dirty(&peval->pres.inputs, update_version)
1720 }
static BOOL is_const_tab_input_dirty(struct d3dx_const_tab *ctab, ULONG64 update_version)
Definition: preshader.c:1701
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 361 of file d3dx9_private.h.

362 {
363  struct d3dx_shared_data *shared_data;
364 
365  if ((shared_data = param->shared_data))
366  return update_version < shared_data->update_version;
367  else
368  return update_version < param->update_version;
369 }
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 345 of file d3dx9_private.h.

346 {
347  return &param->top_level_param->param == param;
348 }
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:1059
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
GLuint buffer
Definition: glext.h:5915
int resource
Definition: rdpsnd_sgi.c:44
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
smooth NULL
Definition: ftsmooth.c:416
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define S_OK
Definition: intsafe.h:59
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 627 of file surface.c.

630 {
631  HRESULT hr;
632  RECT src_rect;
633  UINT src_pitch;
634  UINT mip_level;
635  UINT mip_levels;
636  UINT mip_level_size;
637  UINT width, height;
638  IDirect3DSurface9 *surface;
639  const struct dds_header *header = src_data;
640  const BYTE *pixels = (BYTE *)(header + 1);
641 
642  /* Loading a cube texture as a simple texture is also supported
643  * (only first face texture is taken). Same with volume textures. */
644  if ((src_info->ResourceType != D3DRTYPE_TEXTURE)
645  && (src_info->ResourceType != D3DRTYPE_CUBETEXTURE)
646  && (src_info->ResourceType != D3DRTYPE_VOLUMETEXTURE))
647  {
648  WARN("Trying to load a %u resource as a 2D texture, returning failure.\n", src_info->ResourceType);
649  return D3DXERR_INVALIDDATA;
650  }
651 
652  width = src_info->Width;
653  height = src_info->Height;
654  mip_levels = min(src_info->MipLevels, IDirect3DTexture9_GetLevelCount(texture));
655  if (src_info->ResourceType == D3DRTYPE_VOLUMETEXTURE)
656  mip_levels = 1;
657  for (mip_level = 0; mip_level < mip_levels + skip_levels; ++mip_level)
658  {
659  hr = calculate_dds_surface_size(src_info->Format, width, height, &src_pitch, &mip_level_size);
660  if (FAILED(hr)) return hr;
661 
662  if (mip_level >= skip_levels)
663  {
664  SetRect(&src_rect, 0, 0, width, height);
665 
666  IDirect3DTexture9_GetSurfaceLevel(texture, mip_level - skip_levels, &surface);
667  hr = D3DXLoadSurfaceFromMemory(surface, palette, NULL, pixels, src_info->Format, src_pitch,
668  NULL, &src_rect, filter, color_key);
669  IDirect3DSurface9_Release(surface);
670  if (FAILED(hr))
671  return hr;
672  }
673 
674  pixels += mip_level_size;
675  width = max(1, width / 2);
676  height = max(1, height / 2);
677  }
678 
679  *loaded_miplevels = mip_levels - skip_levels;
680 
681  return D3D_OK;
682 }
#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:111
#define IDirect3DTexture9_GetLevelCount(p)
Definition: d3d9.h:1027
D3DRESOURCETYPE ResourceType
Definition: d3dx9tex.h:83
UINT MipLevels
Definition: d3dx9tex.h:81
smooth NULL
Definition: ftsmooth.c:416
D3DFORMAT Format
Definition: d3dx9tex.h:82
GLenum GLuint texture
Definition: glext.h:6295
LONG HRESULT
Definition: typedefs.h:77
static HRESULT calculate_dds_surface_size(D3DFORMAT format, UINT width, UINT height, UINT *pitch, UINT *size)
Definition: surface.c:343
unsigned char BYTE
Definition: mem.h:68
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:1872
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
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
struct CFHEADER header
Definition: fdi.c:109

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 609 of file surface.c.

612 {
613  UINT row_pitch, slice_pitch;
614  const struct dds_header *header = src_data;
615  const BYTE *pixels = (BYTE *)(header + 1);
616 
617  if (src_info->ResourceType != D3DRTYPE_VOLUMETEXTURE)
618  return D3DXERR_INVALIDDATA;
619 
620  if (FAILED(calculate_dds_surface_size(src_info->Format, src_info->Width, src_info->Height, &row_pitch, &slice_pitch)))
621  return E_NOTIMPL;
622 
623  return D3DXLoadVolumeFromMemory(dst_volume, dst_palette, dst_box, pixels, src_info->Format,
624  row_pitch, slice_pitch, NULL, src_box, filter, color_key);
625 }
D3DRESOURCETYPE ResourceType
Definition: d3dx9tex.h:83
smooth NULL
Definition: ftsmooth.c:416
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:343
unsigned char BYTE
Definition: mem.h:68
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
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: glext.h:7005
struct CFHEADER header
Definition: fdi.c:109

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 737 of file surface.c.

739 {
740  HRESULT hr;
741  UINT mip_level;
742  UINT mip_levels;
743  UINT src_slice_pitch;
744  UINT src_row_pitch;
745  D3DBOX src_box;
747  IDirect3DVolume9 *volume;
748  const struct dds_header *header = src_data;
749  const BYTE *pixels = (BYTE *)(header + 1);
750 
751  if (src_info->ResourceType != D3DRTYPE_VOLUMETEXTURE)
752  return D3DXERR_INVALIDDATA;
753 
754  width = src_info->Width;
755  height = src_info->Height;
756  depth = src_info->Depth;
757  mip_levels = min(src_info->MipLevels, IDirect3DVolumeTexture9_GetLevelCount(volume_texture));
758 
759  for (mip_level = 0; mip_level < mip_levels; mip_level++)
760  {
761  hr = calculate_dds_surface_size(src_info->Format, width, height, &src_row_pitch, &src_slice_pitch);
762  if (FAILED(hr)) return hr;
763 
764  hr = IDirect3DVolumeTexture9_GetVolumeLevel(volume_texture, mip_level, &volume);
765  if (FAILED(hr)) return hr;
766 
767  src_box.Left = 0;
768  src_box.Top = 0;
769  src_box.Right = width;
770  src_box.Bottom = height;
771  src_box.Front = 0;
772  src_box.Back = depth;
773 
775  src_row_pitch, src_slice_pitch, NULL, &src_box, filter, color_key);
776 
778  if (FAILED(hr)) return hr;
779 
780  pixels += depth * src_slice_pitch;
781  width = max(1, width / 2);
782  height = max(1, height / 2);
783  depth = max(1, depth / 2);
784  }
785 
786  return D3D_OK;
787 }
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
smooth NULL
Definition: ftsmooth.c:416
UINT Bottom
Definition: d3d8types.h:1014
D3DFORMAT Format
Definition: d3dx9tex.h:82
UINT Top
Definition: d3d8types.h:1012
LONG HRESULT
Definition: typedefs.h:77
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:343
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546
#define IDirect3DVolume9_Release(p)
Definition: d3d9.h:383
unsigned char BYTE
Definition: mem.h:68
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 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
struct CFHEADER header
Definition: fdi.c:109

Referenced by D3DXCreateVolumeTextureFromFileInMemoryEx().

◆ 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:398
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
#define MapViewOfFile
Definition: compat.h:402
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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:125
smooth NULL
Definition: ftsmooth.c:416
#define FILE_MAP_READ
Definition: compat.h:427
#define OPEN_EXISTING
Definition: compat.h:426
void error(char *format,...)
Definition: util.c:72
GLenum GLuint GLenum GLsizei length
Definition: glext.h:5579
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:401
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:481
#define GENERIC_READ
Definition: compat.h:124
#define S_OK
Definition: intsafe.h:59
#define PAGE_READONLY
Definition: compat.h:127
#define CreateFileW
Definition: compat.h:400

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 356 of file d3dx9_private.h.

357 {
358  return ++*version_counter;
359 }

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 1735 of file surface.c.

1739 {
1740  struct argb_conversion_info conv_info, ck_conv_info;
1741  const struct pixel_format_desc *ck_format = NULL;
1742  DWORD channels[4];
1743  UINT x, y, z;
1744 
1745  ZeroMemory(channels, sizeof(channels));
1746  init_argb_conversion_info(src_format, dst_format, &conv_info);
1747 
1748  if (color_key)
1749  {
1750  /* Color keys are always represented in D3DFMT_A8R8G8B8 format. */
1751  ck_format = get_format_info(D3DFMT_A8R8G8B8);
1752  init_argb_conversion_info(src_format, ck_format, &ck_conv_info);
1753  }
1754 
1755  for (z = 0; z < dst_size->depth; z++)
1756  {
1757  BYTE *dst_slice_ptr = dst + z * dst_slice_pitch;
1758  const BYTE *src_slice_ptr = src + src_slice_pitch * (z * src_size->depth / dst_size->depth);
1759 
1760  for (y = 0; y < dst_size->height; y++)
1761  {
1762  BYTE *dst_ptr = dst_slice_ptr + y * dst_row_pitch;
1763  const BYTE *src_row_ptr = src_slice_ptr + src_row_pitch * (y * src_size->height / dst_size->height);
1764 
1765  for (x = 0; x < dst_size->width; x++)
1766  {
1767  const BYTE *src_ptr = src_row_ptr + (x * src_size->width / dst_size->width) * src_format->bytes_per_pixel;
1768 
1769  if (!src_format->to_rgba && !dst_format->from_rgba
1770  && src_format->type == dst_format->type
1771  && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4)
1772  {
1773  DWORD val;
1774 
1775  get_relevant_argb_components(&conv_info, src_ptr, channels);
1776  val = make_argb_color(&conv_info, channels);
1777 
1778  if (color_key)
1779  {
1780  DWORD ck_pixel;
1781 
1782  get_relevant_argb_components(&ck_conv_info, src_ptr, channels);
1783  ck_pixel = make_argb_color(&ck_conv_info, channels);
1784  if (ck_pixel == color_key)
1785  val &= ~conv_info.destmask[0];
1786  }
1787  memcpy(dst_ptr, &val, dst_format->bytes_per_pixel);
1788  }
1789  else
1790  {
1791  struct vec4 color, tmp;
1792 
1793  format_to_vec4(src_format, src_ptr, &color);
1794  if (src_format->to_rgba)
1795  src_format->to_rgba(&color, &tmp, palette);
1796  else
1797  tmp = color;
1798 
1799  if (ck_format)
1800  {
1801  DWORD ck_pixel;
1802 
1803  format_from_vec4(ck_format, &tmp, (BYTE *)&ck_pixel);
1804  if (ck_pixel == color_key)
1805  tmp.w = 0.0f;
1806  }
1807 
1808  if (dst_format->from_rgba)
1809  dst_format->from_rgba(&tmp, &color);
1810  else
1811  color = tmp;
1812 
1813  format_from_vec4(dst_format, &color, dst_ptr);
1814  }
1815 
1816  dst_ptr += dst_format->bytes_per_pixel;
1817  }
1818  }
1819  }
1820 }
UINT width
Definition: d3dx9_private.h:42
static const char * dst_format
Definition: dib.c:1133
#define ZeroMemory
Definition: winbase.h:1642
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
smooth NULL
Definition: ftsmooth.c:416
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
unsigned char BYTE
Definition: mem.h:68
GLenum src
Definition: glext.h:6340
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:1551
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:1440
GLenum GLenum dst
Definition: glext.h:6340
unsigned int UINT
Definition: ndis.h:50
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:1473
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:1521
static DWORD make_argb_color(const struct argb_conversion_info *info, const DWORD *in)
Definition: surface.c:1503

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 562 of file surface.c.

563 {
564  HRESULT hr;
566  UINT mip_levels;
567  IDirect3DSurface9 *surface;
568 
569  type = IDirect3DBaseTexture9_GetType(src_texture);
570 
572  return D3DERR_INVALIDCALL;
573 
574  if (type == D3DRTYPE_CUBETEXTURE)
575  {
576  FIXME("Cube texture not supported yet\n");
577  return E_NOTIMPL;
578  }
579  else if (type == D3DRTYPE_VOLUMETEXTURE)
580  {
581  FIXME("Volume texture not supported yet\n");
582  return E_NOTIMPL;
583  }
584 
585  mip_levels = IDirect3DTexture9_GetLevelCount(src_texture);
586 
587  if (mip_levels > 1)
588  {
589  FIXME("Mipmap not supported yet\n");
590  return E_NOTIMPL;
591  }
592 
593  if (src_palette)
594  {
595  FIXME("Saving surfaces with palettized pixel formats not implemented yet\n");
596  return E_NOTIMPL;
597  }
598 
599  hr = get_surface(type, src_texture, D3DCUBEMAP_FACE_POSITIVE_X, 0, &surface);
600 
601  if (SUCCEEDED(hr))
602  {
603  hr = save_dds_surface_to_memory(dst_buffer, surface, NULL);
604  IDirect3DSurface9_Release(surface);
605  }
606 
607  return hr;
608 }
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:622
HRESULT hr
Definition: shlfolder.c:183
#define D3DERR_INVALIDCALL
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#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:547
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
#define IDirect3DBaseTexture9_GetType(p)
Definition: d3d9.h:844
LONG HRESULT
Definition: typedefs.h:77
#define E_NOTIMPL
Definition: ddrawi.h:99
unsigned int UINT
Definition: ndis.h:50
static HRESULT save_dds_surface_to_memory(ID3DXBuffer **dst_buffer, IDirect3DSurface9 *src_surface, const RECT *src_rect)
Definition: surface.c:478
enum _D3DRESOURCETYPE D3DRESOURCETYPE
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by D3DXSaveTextureToFileInMemory().

◆ set_number()

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

Definition at line 191 of file d3dx9_private.h.

192 {
193  if (outtype == intype)
194  {
195  *(DWORD *)outdata = *(DWORD *)indata;
196  return;
197  }
198 
199  switch (outtype)
200  {
201  case D3DXPT_FLOAT:
202  *(float *)outdata = get_float(intype, indata);
203  break;
204 
205  case D3DXPT_BOOL:
206  *(BOOL *)outdata = get_bool(intype, indata);
207  break;
208 
209  case D3DXPT_INT:
210  *(int *)outdata = get_int(intype, indata);
211  break;
212 
213  default:
214  *(DWORD *)outdata = 0;
215  break;
216  }
217 }
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 d3dx9_base_effect_get_bool(), d3dx9_base_effect_get_bool_array(), d3dx9_base_effect_get_float(), d3dx9_base_effect_get_float_array(), d3dx9_base_effect_get_int(), d3dx9_base_effect_get_int_array(), d3dx9_base_effect_set_bool(), d3dx9_base_effect_set_bool_array(), d3dx9_base_effect_set_float(), d3dx9_base_effect_set_float_array(), d3dx9_base_effect_set_int(), d3dx9_base_effect_set_int_array(), d3dx_evaluate_parameter(), get_matrix(), get_vector(), set(), set_matrix(), set_matrix_transpose(), and set_vector().

◆ top_level_parameter_from_parameter()

static struct d3dx_top_level_parameter* top_level_parameter_from_parameter ( struct d3dx_parameter param)
inlinestatic

Definition at line 351 of file d3dx9_private.h.

352 {
354 }
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().

◆ 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:398
#define HRESULT_FROM_WIN32(x)
Definition: winerror.h:92
HRESULT hr
Definition: shlfolder.c:183
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
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:927
smooth NULL
Definition: ftsmooth.c:416
#define ID3DXBuffer_GetBufferSize(p)
Definition: d3dx9core.h:86
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:126
#define S_OK
Definition: intsafe.h:59
#define CREATE_ALWAYS
Definition: disk.h:72
#define CreateFileW
Definition: compat.h:400
#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.