ReactOS 0.4.17-dev-966-gf06eace
d3dx9_private.h File Reference
#include <stdint.h>
#include "wine/debug.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  d3dx_color
 
struct  volume
 
struct  pixel_format_desc
 
struct  d3dx_pixels
 
struct  d3dx_image
 
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  d3dx_parameters_store
 
struct  ctab_constant
 

Macros

#define COBJMACROS
 
#define ULONG64_MAX   (~(ULONG64)0)
 
#define FOURCC_TX_1   0x54580100
 
#define D3DX9_FILTER_INVALID_BITS   0xff80fff8
 
#define D3DX_IMAGE_INFO_ONLY   1
 
#define SET_D3D_STATE_(manager, device, method, ...)
 
#define SET_D3D_STATE(base_effect, ...)   SET_D3D_STATE_(base_effect->manager, base_effect->device, __VA_ARGS__)
 

Enumerations

enum  range { RANGE_FULL = 0 , RANGE_UNORM = 1 , RANGE_SNORM = 2 }
 
enum  d3dx_pixel_format_id {
  D3DX_PIXEL_FORMAT_B8G8R8_UNORM , D3DX_PIXEL_FORMAT_B8G8R8A8_UNORM , D3DX_PIXEL_FORMAT_B8G8R8X8_UNORM , D3DX_PIXEL_FORMAT_R8G8B8A8_UNORM ,
  D3DX_PIXEL_FORMAT_R8G8B8X8_UNORM , D3DX_PIXEL_FORMAT_B5G6R5_UNORM , D3DX_PIXEL_FORMAT_B5G5R5X1_UNORM , D3DX_PIXEL_FORMAT_B5G5R5A1_UNORM ,
  D3DX_PIXEL_FORMAT_B2G3R3_UNORM , D3DX_PIXEL_FORMAT_B2G3R3A8_UNORM , D3DX_PIXEL_FORMAT_B4G4R4A4_UNORM , D3DX_PIXEL_FORMAT_B4G4R4X4_UNORM ,
  D3DX_PIXEL_FORMAT_B10G10R10A2_UNORM , D3DX_PIXEL_FORMAT_R10G10B10A2_UNORM , D3DX_PIXEL_FORMAT_R16G16B16_UNORM , D3DX_PIXEL_FORMAT_R16G16B16A16_UNORM ,
  D3DX_PIXEL_FORMAT_R16G16_UNORM , D3DX_PIXEL_FORMAT_A8_UNORM , D3DX_PIXEL_FORMAT_L8A8_UNORM , D3DX_PIXEL_FORMAT_L4A4_UNORM ,
  D3DX_PIXEL_FORMAT_L8_UNORM , D3DX_PIXEL_FORMAT_L16_UNORM , D3DX_PIXEL_FORMAT_DXT1_UNORM , D3DX_PIXEL_FORMAT_DXT2_UNORM ,
  D3DX_PIXEL_FORMAT_DXT3_UNORM , D3DX_PIXEL_FORMAT_DXT4_UNORM , D3DX_PIXEL_FORMAT_DXT5_UNORM , D3DX_PIXEL_FORMAT_R16_FLOAT ,
  D3DX_PIXEL_FORMAT_R16G16_FLOAT , D3DX_PIXEL_FORMAT_R16G16B16A16_FLOAT , D3DX_PIXEL_FORMAT_R32_FLOAT , D3DX_PIXEL_FORMAT_R32G32_FLOAT ,
  D3DX_PIXEL_FORMAT_R32G32B32A32_FLOAT , D3DX_PIXEL_FORMAT_P8_UINT , D3DX_PIXEL_FORMAT_P8_UINT_A8_UNORM , D3DX_PIXEL_FORMAT_U8V8W8Q8_SNORM ,
  D3DX_PIXEL_FORMAT_U16V16W16Q16_SNORM , D3DX_PIXEL_FORMAT_U8V8_SNORM , D3DX_PIXEL_FORMAT_U16V16_SNORM , D3DX_PIXEL_FORMAT_U8V8_SNORM_L8X8_UNORM ,
  D3DX_PIXEL_FORMAT_U10V10W10_SNORM_A2_UNORM , D3DX_PIXEL_FORMAT_R8G8_B8G8_UNORM , D3DX_PIXEL_FORMAT_G8R8_G8B8_UNORM , D3DX_PIXEL_FORMAT_UYVY ,
  D3DX_PIXEL_FORMAT_YUY2 , D3DX_PIXEL_FORMAT_COUNT
}
 
enum  component_type {
  CTYPE_EMPTY , CTYPE_UNORM , CTYPE_SNORM , CTYPE_FLOAT ,
  CTYPE_LUMA , CTYPE_INDEX
}
 
enum  format_flag { FMT_FLAG_DXT = 0x01 , FMT_FLAG_PACKED = 0x02 , FMT_FLAG_INTERNAL = 0x04 }
 
enum  pres_reg_tables {
  PRES_REGTAB_IMMED , PRES_REGTAB_CONST , PRES_REGTAB_INPUT , PRES_REGTAB_OCONST ,
  PRES_REGTAB_OBCONST , PRES_REGTAB_OICONST , PRES_REGTAB_TEMP , PRES_REGTAB_COUNT ,
  PRES_REGTAB_FIRST_SHADER = PRES_REGTAB_CONST
}
 

Functions

static HRESULT d3dx9_validate_filter (uint32_t filter)
 
static HRESULT d3dx9_handle_load_filter (DWORD *filter)
 
static void set_d3dx_color (struct d3dx_color *color, const struct vec4 *value, enum range rgb_range, enum range a_range)
 
static void set_volume_struct (struct volume *volume, uint32_t width, uint32_t height, uint32_t depth)
 
static void set_d3dx_pixels (struct d3dx_pixels *pixels, const void *data, uint32_t row_pitch, uint32_t slice_pitch, const PALETTEENTRY *palette, uint32_t width, uint32_t height, uint32_t depth, const RECT *unaligned_rect)
 
HRESULT d3dx_image_init (const void *src_data, uint32_t src_data_size, struct d3dx_image *image, uint32_t starting_mip_level, uint32_t flags)
 
void d3dx_image_cleanup (struct d3dx_image *image)
 
HRESULT d3dx_image_get_pixels (struct d3dx_image *image, uint32_t layer, uint32_t mip_level, struct d3dx_pixels *pixels)
 
void d3dximage_info_from_d3dx_image (D3DXIMAGE_INFO *info, struct d3dx_image *image)
 
static BOOL is_unknown_format (const struct pixel_format_desc *format)
 
static BOOL is_index_format (const struct pixel_format_desc *format)
 
static BOOL is_compressed_format (const struct pixel_format_desc *format)
 
static BOOL is_packed_format (const struct pixel_format_desc *format)
 
static BOOL format_types_match (const struct pixel_format_desc *src, const struct pixel_format_desc *dst)
 
static BOOL is_internal_format (const struct pixel_format_desc *format)
 
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)
 
HRESULT load_resource_into_memory (HMODULE module, HRSRC resinfo, void **buffer, DWORD *length)
 
HRESULT write_buffer_to_file (const WCHAR *filename, ID3DXBuffer *buffer)
 
D3DFORMAT d3dformat_from_d3dx_pixel_format_id (enum d3dx_pixel_format_id format)
 
enum d3dx_pixel_format_id d3dx_pixel_format_id_from_d3dformat (D3DFORMAT format)
 
const struct pixel_format_desc * get_d3dx_pixel_format_info (enum d3dx_pixel_format_id format)
 
const struct pixel_format_desc * get_format_info (D3DFORMAT format)
 
const struct pixel_format_desc * get_format_info_idx (int idx)
 
void format_to_d3dx_color (const struct pixel_format_desc *format, const BYTE *src, const PALETTEENTRY *palette, struct d3dx_color *dst)
 
void format_from_d3dx_color (const struct pixel_format_desc *format, const struct d3dx_color *src, BYTE *dst)
 
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)
 
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)
 
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)
 
HRESULT lock_surface (IDirect3DSurface9 *surface, const RECT *surface_rect, D3DLOCKED_RECT *lock, IDirect3DSurface9 **temp_surface, BOOL write)
 
HRESULT unlock_surface (IDirect3DSurface9 *surface, const RECT *surface_rect, IDirect3DSurface9 *temp_surface, BOOL update)
 
HRESULT d3dx_pixels_init (const void *data, uint32_t row_pitch, uint32_t slice_pitch, const PALETTEENTRY *palette, enum d3dx_pixel_format_id format, uint32_t left, uint32_t top, uint32_t right, uint32_t bottom, uint32_t front, uint32_t back, struct d3dx_pixels *pixels)
 
HRESULT d3dx_load_pixels_from_pixels (struct d3dx_pixels *dst_pixels, const struct pixel_format_desc *dst_desc, struct d3dx_pixels *src_pixels, const struct pixel_format_desc *src_desc, uint32_t filter_flags, uint32_t color_key)
 
void get_aligned_rect (uint32_t left, uint32_t top, uint32_t right, uint32_t bottom, uint32_t width, uint32_t height, const struct pixel_format_desc *fmt_desc, RECT *aligned_rect)
 
unsigned short float_32_to_16 (const float in)
 
float float_16_to_32 (const unsigned short in)
 
const char * debug_d3dxparameter_class (D3DXPARAMETER_CLASS c)
 
const char * debug_d3dxparameter_type (D3DXPARAMETER_TYPE t)
 
const char * debug_d3dxparameter_registerset (D3DXREGISTER_SET r)
 
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 uint32_t make_pow2 (uint32_t num)
 
static BOOL is_top_level_parameter (struct d3dx_parameter *param)
 
static struct d3dx_top_level_parameter * top_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)
 
HRESULT d3dx_init_parameters_store (struct d3dx_parameters_store *store, unsigned int count)
 
void d3dx_parameters_store_cleanup (struct d3dx_parameters_store *store)
 
struct d3dx_parameter * get_parameter_by_name (struct d3dx_parameters_store *store, struct d3dx_parameter *parameter, const char *name)
 
HRESULT d3dx_create_param_eval (struct d3dx_parameters_store *parameters, 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)
 
void d3dx_free_param_eval (struct d3dx_param_eval *peval)
 
HRESULT d3dx_evaluate_parameter (struct d3dx_param_eval *peval, const struct d3dx_parameter *param, void *param_value)
 
HRESULT d3dx_param_eval_set_shader_constants (ID3DXEffectStateManager *manager, struct IDirect3DDevice9 *device, struct d3dx_param_eval *peval, BOOL update_all)
 
BOOL is_param_eval_input_dirty (struct d3dx_param_eval *peval, ULONG64 update_version)
 
const struct ctab_constant * d3dx_shader_get_ctab_constant (ID3DXConstantTable *iface, D3DXHANDLE constant)
 

Variables

CRITICAL_SECTION from_file_mutex
 
const struct ID3DXIncludeVtbl d3dx_include_from_file_vtbl
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 29 of file d3dx9_private.h.

◆ D3DX9_FILTER_INVALID_BITS

#define D3DX9_FILTER_INVALID_BITS   0xff80fff8

Definition at line 36 of file d3dx9_private.h.

◆ D3DX_IMAGE_INFO_ONLY

#define D3DX_IMAGE_INFO_ONLY   1

Definition at line 199 of file d3dx9_private.h.

◆ FOURCC_TX_1

#define FOURCC_TX_1   0x54580100

Definition at line 34 of file d3dx9_private.h.

◆ SET_D3D_STATE

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

Definition at line 609 of file d3dx9_private.h.

◆ SET_D3D_STATE_

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

Definition at line 601 of file d3dx9_private.h.

◆ ULONG64_MAX

#define ULONG64_MAX   (~(ULONG64)0)

Definition at line 32 of file d3dx9_private.h.

Enumeration Type Documentation

◆ component_type

Enumerator
CTYPE_EMPTY 
CTYPE_UNORM 
CTYPE_SNORM 
CTYPE_FLOAT 
CTYPE_LUMA 
CTYPE_INDEX 

Definition at line 145 of file d3dx9_private.h.

146{
153};
@ CTYPE_INDEX
@ CTYPE_SNORM
@ CTYPE_FLOAT
@ CTYPE_LUMA
@ CTYPE_EMPTY
@ CTYPE_UNORM

◆ d3dx_pixel_format_id

Enumerator
D3DX_PIXEL_FORMAT_B8G8R8_UNORM 
D3DX_PIXEL_FORMAT_B8G8R8A8_UNORM 
D3DX_PIXEL_FORMAT_B8G8R8X8_UNORM 
D3DX_PIXEL_FORMAT_R8G8B8A8_UNORM 
D3DX_PIXEL_FORMAT_R8G8B8X8_UNORM 
D3DX_PIXEL_FORMAT_B5G6R5_UNORM 
D3DX_PIXEL_FORMAT_B5G5R5X1_UNORM 
D3DX_PIXEL_FORMAT_B5G5R5A1_UNORM 
D3DX_PIXEL_FORMAT_B2G3R3_UNORM 
D3DX_PIXEL_FORMAT_B2G3R3A8_UNORM 
D3DX_PIXEL_FORMAT_B4G4R4A4_UNORM 
D3DX_PIXEL_FORMAT_B4G4R4X4_UNORM 
D3DX_PIXEL_FORMAT_B10G10R10A2_UNORM 
D3DX_PIXEL_FORMAT_R10G10B10A2_UNORM 
D3DX_PIXEL_FORMAT_R16G16B16_UNORM 
D3DX_PIXEL_FORMAT_R16G16B16A16_UNORM 
D3DX_PIXEL_FORMAT_R16G16_UNORM 
D3DX_PIXEL_FORMAT_A8_UNORM 
D3DX_PIXEL_FORMAT_L8A8_UNORM 
D3DX_PIXEL_FORMAT_L4A4_UNORM 
D3DX_PIXEL_FORMAT_L8_UNORM 
D3DX_PIXEL_FORMAT_L16_UNORM 
D3DX_PIXEL_FORMAT_DXT1_UNORM 
D3DX_PIXEL_FORMAT_DXT2_UNORM 
D3DX_PIXEL_FORMAT_DXT3_UNORM 
D3DX_PIXEL_FORMAT_DXT4_UNORM 
D3DX_PIXEL_FORMAT_DXT5_UNORM 
D3DX_PIXEL_FORMAT_R16_FLOAT 
D3DX_PIXEL_FORMAT_R16G16_FLOAT 
D3DX_PIXEL_FORMAT_R16G16B16A16_FLOAT 
D3DX_PIXEL_FORMAT_R32_FLOAT 
D3DX_PIXEL_FORMAT_R32G32_FLOAT 
D3DX_PIXEL_FORMAT_R32G32B32A32_FLOAT 
D3DX_PIXEL_FORMAT_P8_UINT 
D3DX_PIXEL_FORMAT_P8_UINT_A8_UNORM 
D3DX_PIXEL_FORMAT_U8V8W8Q8_SNORM 
D3DX_PIXEL_FORMAT_U16V16W16Q16_SNORM 
D3DX_PIXEL_FORMAT_U8V8_SNORM 
D3DX_PIXEL_FORMAT_U16V16_SNORM 
D3DX_PIXEL_FORMAT_U8V8_SNORM_L8X8_UNORM 
D3DX_PIXEL_FORMAT_U10V10W10_SNORM_A2_UNORM 
D3DX_PIXEL_FORMAT_R8G8_B8G8_UNORM 
D3DX_PIXEL_FORMAT_G8R8_G8B8_UNORM 
D3DX_PIXEL_FORMAT_UYVY 
D3DX_PIXEL_FORMAT_YUY2 
D3DX_PIXEL_FORMAT_COUNT 

Definition at line 94 of file d3dx9_private.h.

95{
142};
@ D3DX_PIXEL_FORMAT_R16G16B16A16_UNORM
@ D3DX_PIXEL_FORMAT_R32G32_FLOAT
@ D3DX_PIXEL_FORMAT_U10V10W10_SNORM_A2_UNORM
@ D3DX_PIXEL_FORMAT_DXT4_UNORM
@ D3DX_PIXEL_FORMAT_B2G3R3_UNORM
@ D3DX_PIXEL_FORMAT_U8V8_SNORM_L8X8_UNORM
@ D3DX_PIXEL_FORMAT_B5G5R5A1_UNORM
@ D3DX_PIXEL_FORMAT_R32G32B32A32_FLOAT
@ D3DX_PIXEL_FORMAT_U8V8W8Q8_SNORM
@ D3DX_PIXEL_FORMAT_R16G16_UNORM
@ D3DX_PIXEL_FORMAT_B5G6R5_UNORM
@ D3DX_PIXEL_FORMAT_B10G10R10A2_UNORM
@ D3DX_PIXEL_FORMAT_A8_UNORM
@ D3DX_PIXEL_FORMAT_G8R8_G8B8_UNORM
@ D3DX_PIXEL_FORMAT_R16G16B16A16_FLOAT
@ D3DX_PIXEL_FORMAT_B8G8R8_UNORM
Definition: d3dx9_private.h:96
@ D3DX_PIXEL_FORMAT_R8G8B8X8_UNORM
@ D3DX_PIXEL_FORMAT_R16G16B16_UNORM
@ D3DX_PIXEL_FORMAT_B2G3R3A8_UNORM
@ D3DX_PIXEL_FORMAT_UYVY
@ D3DX_PIXEL_FORMAT_U16V16_SNORM
@ D3DX_PIXEL_FORMAT_U16V16W16Q16_SNORM
@ D3DX_PIXEL_FORMAT_R16_FLOAT
@ D3DX_PIXEL_FORMAT_P8_UINT_A8_UNORM
@ D3DX_PIXEL_FORMAT_B4G4R4A4_UNORM
@ D3DX_PIXEL_FORMAT_B5G5R5X1_UNORM
@ D3DX_PIXEL_FORMAT_U8V8_SNORM
@ D3DX_PIXEL_FORMAT_B8G8R8X8_UNORM
Definition: d3dx9_private.h:98
@ D3DX_PIXEL_FORMAT_R8G8B8A8_UNORM
Definition: d3dx9_private.h:99
@ D3DX_PIXEL_FORMAT_DXT3_UNORM
@ D3DX_PIXEL_FORMAT_DXT2_UNORM
@ D3DX_PIXEL_FORMAT_COUNT
@ D3DX_PIXEL_FORMAT_R10G10B10A2_UNORM
@ D3DX_PIXEL_FORMAT_R16G16_FLOAT
@ D3DX_PIXEL_FORMAT_L8_UNORM
@ D3DX_PIXEL_FORMAT_YUY2
@ D3DX_PIXEL_FORMAT_R32_FLOAT
@ D3DX_PIXEL_FORMAT_L4A4_UNORM
@ D3DX_PIXEL_FORMAT_P8_UINT
@ D3DX_PIXEL_FORMAT_DXT1_UNORM
@ D3DX_PIXEL_FORMAT_L8A8_UNORM
@ D3DX_PIXEL_FORMAT_DXT5_UNORM
@ D3DX_PIXEL_FORMAT_L16_UNORM
@ D3DX_PIXEL_FORMAT_B8G8R8A8_UNORM
Definition: d3dx9_private.h:97
@ D3DX_PIXEL_FORMAT_B4G4R4X4_UNORM
@ D3DX_PIXEL_FORMAT_R8G8_B8G8_UNORM

◆ format_flag

Enumerator
FMT_FLAG_DXT 
FMT_FLAG_PACKED 
FMT_FLAG_INTERNAL 

Definition at line 155 of file d3dx9_private.h.

156{
157 FMT_FLAG_DXT = 0x01,
158 FMT_FLAG_PACKED = 0x02,
159 /* Internal only format, has no exact D3DFORMAT equivalent. */
160 FMT_FLAG_INTERNAL = 0x04,
161};
@ FMT_FLAG_INTERNAL
@ FMT_FLAG_PACKED
@ FMT_FLAG_DXT

◆ pres_reg_tables

Enumerator
PRES_REGTAB_IMMED 
PRES_REGTAB_CONST 
PRES_REGTAB_INPUT 
PRES_REGTAB_OCONST 
PRES_REGTAB_OBCONST 
PRES_REGTAB_OICONST 
PRES_REGTAB_TEMP 
PRES_REGTAB_COUNT 
PRES_REGTAB_FIRST_SHADER 

Definition at line 437 of file d3dx9_private.h.

438{
448};
@ PRES_REGTAB_COUNT
@ PRES_REGTAB_FIRST_SHADER
@ PRES_REGTAB_OICONST
@ PRES_REGTAB_IMMED
@ PRES_REGTAB_TEMP
@ PRES_REGTAB_CONST
@ PRES_REGTAB_INPUT
@ PRES_REGTAB_OCONST
@ PRES_REGTAB_OBCONST

◆ range

enum typedef GLsizei range
Enumerator
RANGE_FULL 
RANGE_UNORM 
RANGE_SNORM 

Definition at line 58 of file d3dx9_private.h.

58 {
59 RANGE_FULL = 0,
60 RANGE_UNORM = 1,
61 RANGE_SNORM = 2,
62};
@ RANGE_SNORM
Definition: d3dx9_private.h:61
@ RANGE_FULL
Definition: d3dx9_private.h:59
@ RANGE_UNORM
Definition: d3dx9_private.h:60

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

2184{
2185 struct argb_conversion_info conv_info, ck_conv_info;
2186 const struct pixel_format_desc *ck_format;
2187 DWORD channels[4];
2188 UINT min_width, min_height, min_depth;
2189 UINT x, y, z;
2190
2191 TRACE("src %p, src_row_pitch %u, src_slice_pitch %u, src_size %p, src_format %p, dst %p, "
2192 "dst_row_pitch %u, dst_slice_pitch %u, dst_size %p, dst_format %p, color_key 0x%08lx, palette %p.\n",
2193 src, src_row_pitch, src_slice_pitch, src_size, src_format, dst, dst_row_pitch, dst_slice_pitch, dst_size,
2195
2196 ZeroMemory(channels, sizeof(channels));
2197 init_argb_conversion_info(src_format, dst_format, &conv_info);
2198
2199 min_width = min(src_size->width, dst_size->width);
2200 min_height = min(src_size->height, dst_size->height);
2201 min_depth = min(src_size->depth, dst_size->depth);
2202
2203 if (color_key)
2204 {
2205 /* Color keys are always represented in D3DFMT_A8R8G8B8 format. */
2206 ck_format = get_format_info(D3DFMT_A8R8G8B8);
2207 init_argb_conversion_info(src_format, ck_format, &ck_conv_info);
2208 }
2209
2210 for (z = 0; z < min_depth; z++) {
2211 const BYTE *src_slice_ptr = src + z * src_slice_pitch;
2212 BYTE *dst_slice_ptr = dst + z * dst_slice_pitch;
2213
2214 for (y = 0; y < min_height; y++) {
2215 const BYTE *src_ptr = src_slice_ptr + y * src_row_pitch;
2216 BYTE *dst_ptr = dst_slice_ptr + y * dst_row_pitch;
2217
2218 for (x = 0; x < min_width; x++) {
2219 if (format_types_match(src_format, dst_format)
2220 && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4)
2221 {
2222 DWORD val;
2223
2224 get_relevant_argb_components(&conv_info, src_ptr, channels);
2225 val = make_argb_color(&conv_info, channels);
2226
2227 if (color_key)
2228 {
2229 DWORD ck_pixel;
2230
2231 get_relevant_argb_components(&ck_conv_info, src_ptr, channels);
2232 ck_pixel = make_argb_color(&ck_conv_info, channels);
2233 if (ck_pixel == color_key)
2234 val &= ~conv_info.destmask[0];
2235 }
2236 memcpy(dst_ptr, &val, dst_format->bytes_per_pixel);
2237 }
2238 else
2239 {
2240 struct d3dx_color color, tmp;
2241
2242 format_to_d3dx_color(src_format, src_ptr, palette, &color);
2243 tmp = color;
2244
2245 if (color_key)
2246 {
2247 DWORD ck_pixel;
2248
2249 format_from_d3dx_color(ck_format, &tmp, (BYTE *)&ck_pixel);
2250 if (ck_pixel == color_key)
2251 tmp.value.w = 0.0f;
2252 }
2253
2254 color = tmp;
2256 }
2257
2258 src_ptr += src_format->bytes_per_pixel;
2259 dst_ptr += dst_format->bytes_per_pixel;
2260 }
2261
2262 if (src_size->width < dst_size->width) /* black out remaining pixels */
2263 memset(dst_ptr, 0, dst_format->bytes_per_pixel * (dst_size->width - src_size->width));
2264 }
2265
2266 if (src_size->height < dst_size->height) /* black out remaining pixels */
2267 memset(dst + src_size->height * dst_row_pitch, 0, dst_row_pitch * (dst_size->height - src_size->height));
2268 }
2269 if (src_size->depth < dst_size->depth) /* black out remaining pixels */
2270 memset(dst + src_size->depth * dst_slice_pitch, 0, dst_slice_pitch * (dst_size->depth - src_size->depth));
2271}
unsigned int channels
Definition: audiorecord.c:89
@ D3DFMT_A8R8G8B8
Definition: d3d8types.h:604
const struct pixel_format_desc * get_format_info(D3DFORMAT format)
Definition: util.c:312
static BOOL format_types_match(const struct pixel_format_desc *src, const struct pixel_format_desc *dst)
void format_from_d3dx_color(const struct pixel_format_desc *format, const struct d3dx_color *src, BYTE *dst)
Definition: surface.c:2051
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:1868
void format_to_d3dx_color(const struct pixel_format_desc *format, const BYTE *src, const PALETTEENTRY *palette, struct d3dx_color *dst)
Definition: surface.c:1978
static void get_relevant_argb_components(const struct argb_conversion_info *info, const BYTE *col, DWORD *out)
Definition: surface.c:1901
static DWORD make_argb_color(const struct argb_conversion_info *info, const DWORD *in)
Definition: surface.c:1938
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLenum src
Definition: glext.h:6340
GLuint color
Definition: glext.h:6243
GLenum GLenum dst
Definition: glext.h:6340
GLuint GLfloat * val
Definition: glext.h:7180
GLdouble GLdouble z
Definition: glext.h:5874
unsigned int UINT
Definition: sysinfo.c:13
#define ZeroMemory
Definition: minwinbase.h:31
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static const char * dst_format
Definition: dib.c:1339
static HPALETTE palette
Definition: clipboard.c:1457
#define min(a, b)
Definition: monoChain.cc:55
#define memset(x, y, z)
Definition: compat.h:39
#define TRACE(s)
Definition: solgame.cpp:4
UINT depth
Definition: d3dx9_private.h:83
UINT height
Definition: d3dx9_private.h:82
UINT width
Definition: d3dx9_private.h:81
unsigned char BYTE
Definition: xxhash.c:193

Referenced by d3dx_image_tga_decode(), d3dx_load_pixels_from_pixels(), 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 2149 of file surface.c.

2152{
2153 UINT row, slice;
2154 BYTE *dst_addr;
2155 const BYTE *src_addr;
2156 UINT row_block_count = (size->width + format->block_width - 1) / format->block_width;
2157 UINT row_count = (size->height + format->block_height - 1) / format->block_height;
2158
2159 for (slice = 0; slice < size->depth; slice++)
2160 {
2161 src_addr = src + slice * src_slice_pitch;
2162 dst_addr = dst + slice * dst_slice_pitch;
2163
2164 for (row = 0; row < row_count; row++)
2165 {
2166 memcpy(dst_addr, src_addr, row_block_count * format->block_byte_count);
2167 src_addr += src_row_pitch;
2168 dst_addr += dst_row_pitch;
2169 }
2170 }
2171}
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
GLsizeiptr size
Definition: glext.h:5919

Referenced by BitmapImpl_CopyPixels(), BmpFrameDecode_CopyPixels(), d3dx_load_pixels_from_pixels(), DdsFrameDecode_CopyPixels(), DdsFrameDecode_Dds_CopyBlocks(), GifFrameDecode_CopyPixels(), IcoFrameDecode_CopyPixels(), jpeg_decoder_copy_pixels(), png_decoder_copy_pixels(), test_dds_decoder_frame_data(), TgaDecoder_Frame_CopyPixels(), and tiff_decoder_copy_pixels().

◆ d3dformat_from_d3dx_pixel_format_id()

D3DFORMAT d3dformat_from_d3dx_pixel_format_id ( enum d3dx_pixel_format_id  format)

Definition at line 83 of file util.c.

84{
85 switch (format)
86 {
131 default:
133 FIXME("Unknown d3dx_pixel_format_id %u.\n", format);
134 return D3DFMT_UNKNOWN;
135 }
136}
#define FIXME(fmt,...)
Definition: precomp.h:53
@ D3DFMT_DXT5
Definition: d3d8types.h:638
@ D3DFMT_A1R5G5B5
Definition: d3d8types.h:608
@ D3DFMT_UYVY
Definition: d3d8types.h:632
@ D3DFMT_YUY2
Definition: d3d8types.h:633
@ D3DFMT_A8P8
Definition: d3d8types.h:617
@ D3DFMT_X1R5G5B5
Definition: d3d8types.h:607
@ D3DFMT_DXT2
Definition: d3d8types.h:635
@ D3DFMT_R8G8B8
Definition: d3d8types.h:603
@ D3DFMT_R3G3B2
Definition: d3d8types.h:610
@ D3DFMT_A8L8
Definition: d3d8types.h:621
@ D3DFMT_V16U16
Definition: d3d8types.h:628
@ D3DFMT_A2B10G10R10
Definition: d3d8types.h:614
@ D3DFMT_X8L8V8U8
Definition: d3d8types.h:626
@ D3DFMT_A8
Definition: d3d8types.h:611
@ D3DFMT_DXT1
Definition: d3d8types.h:634
@ D3DFMT_X4R4G4B4
Definition: d3d8types.h:613
@ D3DFMT_R5G6B5
Definition: d3d8types.h:606
@ D3DFMT_A8R3G3B2
Definition: d3d8types.h:612
@ D3DFMT_V8U8
Definition: d3d8types.h:624
@ D3DFMT_DXT4
Definition: d3d8types.h:637
@ D3DFMT_A4R4G4B4
Definition: d3d8types.h:609
@ D3DFMT_P8
Definition: d3d8types.h:618
@ D3DFMT_UNKNOWN
Definition: d3d8types.h:601
@ D3DFMT_DXT3
Definition: d3d8types.h:636
@ D3DFMT_X8R8G8B8
Definition: d3d8types.h:605
@ D3DFMT_L8
Definition: d3d8types.h:620
@ D3DFMT_G16R16
Definition: d3d8types.h:615
@ D3DFMT_A2W10V10U10
Definition: d3d8types.h:630
@ D3DFMT_Q8W8V8U8
Definition: d3d8types.h:627
@ D3DFMT_A4L4
Definition: d3d8types.h:622
@ D3DFMT_A32B32G32R32F
Definition: d3d9types.h:861
@ D3DFMT_G8R8_G8B8
Definition: d3d9types.h:831
@ D3DFMT_A16B16G16R16F
Definition: d3d9types.h:856
@ D3DFMT_R8G8_B8G8
Definition: d3d9types.h:832
@ D3DFMT_R32F
Definition: d3d9types.h:859
@ D3DFMT_X8B8G8R8
Definition: d3d9types.h:803
@ D3DFMT_Q16W16V16U16
Definition: d3d9types.h:852
@ D3DFMT_A2R10G10B10
Definition: d3d9types.h:805
@ D3DFMT_G32R32F
Definition: d3d9types.h:860
@ D3DFMT_A8B8G8R8
Definition: d3d9types.h:802
@ D3DFMT_A16B16G16R16
Definition: d3d9types.h:806
@ D3DFMT_L16
Definition: d3d9types.h:841
@ D3DFMT_G16R16F
Definition: d3d9types.h:855
@ D3DFMT_R16F
Definition: d3d9types.h:854
static BOOL is_internal_format(const struct pixel_format_desc *format)
const struct pixel_format_desc * get_d3dx_pixel_format_info(enum d3dx_pixel_format_id format)
Definition: util.c:297

Referenced by check_texture_requirements(), d3dximage_info_from_d3dx_image(), and D3DXSaveSurfaceToFileInMemory().

◆ d3dx9_handle_load_filter()

static HRESULT d3dx9_handle_load_filter ( DWORD *  filter)
inlinestatic

◆ d3dx9_validate_filter()

static HRESULT d3dx9_validate_filter ( uint32_t  filter)
inlinestatic

Definition at line 37 of file d3dx9_private.h.

38{
39 if ((filter & D3DX9_FILTER_INVALID_BITS) || !(filter & 0x7) || ((filter & 0x7) > D3DX_FILTER_BOX))
40 return D3DERR_INVALIDCALL;
41
42 return D3D_OK;
43}
#define D3DERR_INVALIDCALL
Definition: d3d10_private.h:42
#define D3D_OK
Definition: d3d.h:106
#define D3DX9_FILTER_INVALID_BITS
Definition: d3dx9_private.h:36
#define D3DX_FILTER_BOX
Definition: d3dx9tex.h:31

Referenced by d3dx9_handle_load_filter(), and D3DXFilterTexture().

◆ d3dx_create_param_eval()

HRESULT d3dx_create_param_eval ( struct d3dx_parameters_store *  parameters,
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("parameters %p, byte_code %p, byte_code_size %u, type %u, peval_out %p.\n",
1244 parameters, 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 = calloc(1, sizeof(*peval));
1254 if (!peval)
1255 {
1257 goto err_out;
1258 }
1260
1261 peval->param_type = type;
1262 switch (type)
1263 {
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, parameters)))
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, parameters,
1304 skip_constants, skip_constants_count, &peval->pres)))
1305 {
1306 TRACE("Could not get shader constant table, hr %#lx.\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");
1326 }
1327 }
1328 *peval_out = peval;
1329 TRACE("Created parameter evaluator %p.\n", *peval_out);
1330 return D3D_OK;
1331
1332err_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}
#define WARN(fmt,...)
Definition: precomp.h:61
#define D3DXERR_INVALIDDATA
Definition: compiler.c:53
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define TRACE_ON(x)
Definition: compat.h:75
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
return ret
Definition: mutex.c:147
@ D3DXPT_VERTEXSHADER
Definition: d3dx9shader.h:89
@ D3DXPT_PIXELSHADER
Definition: d3dx9shader.h:88
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint shader
Definition: glext.h:6030
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 FAILED(hr)
Definition: intsafe.h:51
static PVOID ptr
Definition: dispmode.c:27
static BYTE parameters[]
Definition: asn.c:558
static HRESULT parse_preshader(struct d3dx_preshader *pres, unsigned int *ptr, unsigned int count, struct d3dx_parameters_store *parameters)
Definition: preshader.c:1107
static void dump_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1083
#define FOURCC_PRES
Definition: preshader.c:143
static unsigned int * find_bytecode_comment(unsigned int *ptr, unsigned int count, unsigned int fourcc, unsigned int *size)
Definition: preshader.c:392
static void dump_registers(struct d3dx_const_tab *ctab)
Definition: preshader.c:1057
static void update_table_sizes_consts(unsigned int *table_sizes, struct d3dx_const_tab *ctab)
Definition: preshader.c:1004
static enum pres_reg_tables shad_regset2table[]
Definition: preshader.c:226
static HRESULT get_constants_desc(unsigned int *byte_code, struct d3dx_const_tab *out, struct d3dx_parameters_store *parameters, const char **skip_constants, unsigned int skip_constants_count, struct d3dx_preshader *pres)
Definition: preshader.c:852
enum pres_value_type type
Definition: preshader.c:199
void d3dx_free_param_eval(struct d3dx_param_eval *peval)
Definition: preshader.c:1357
static HRESULT regstore_alloc_table(struct d3dx_regstore *rs, unsigned int table)
Definition: preshader.c:304
static void dump_bytecode(void *data, unsigned int size)
Definition: preshader.c:375
#define calloc
Definition: rosglue.h:14
struct d3dx_const_tab shader_inputs
struct d3dx_preshader pres
ULONG64 * version_counter
D3DXPARAMETER_TYPE param_type

Referenced by d3dx_parse_array_selector(), d3dx_parse_resource(), and D3DXCreateTextureShader().

◆ 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 BOOL is_dirty;
1729 float *oc;
1730
1731 TRACE("peval %p, param %p, param_value %p.\n", peval, param, param_value);
1732
1733 if ((is_dirty = is_const_tab_input_dirty(&peval->pres.inputs, ULONG64_MAX)))
1734 {
1735 set_constants(&peval->pres.regs, &peval->pres.inputs,
1737 peval->param_type, FALSE, FALSE);
1738 }
1739
1740 if (is_dirty || peval->pres.regs.table_sizes[PRES_REGTAB_INPUT])
1741 {
1742 if (FAILED(hr = execute_preshader(&peval->pres)))
1743 return hr;
1744 }
1745
1746 elements_table = get_offset_reg(PRES_REGTAB_OCONST, peval->pres.regs.table_sizes[PRES_REGTAB_OCONST]);
1747 elements_param = param->bytes / sizeof(unsigned int);
1748 elements = min(elements_table, elements_param);
1749 oc = (float *)peval->pres.regs.tables[PRES_REGTAB_OCONST];
1750 for (i = 0; i < elements; ++i)
1751 set_number((unsigned int *)param_value + i, param->type, oc + i, D3DXPT_FLOAT);
1752 return D3D_OK;
1753}
static ULONG64 next_update_version(ULONG64 *version_counter)
static void set_number(void *outdata, D3DXPARAMETER_TYPE outtype, const void *indata, D3DXPARAMETER_TYPE intype)
#define ULONG64_MAX
Definition: d3dx9_private.h:32
HRESULT hr
Definition: delayimp.cpp:582
@ D3DXPT_FLOAT
Definition: d3dx9shader.h:76
GLfloat param
Definition: glext.h:5796
static BOOL is_const_tab_input_dirty(struct d3dx_const_tab *ctab, ULONG64 update_version)
Definition: preshader.c:1701
static HRESULT execute_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1658
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
static unsigned int get_offset_reg(unsigned int table, unsigned int reg_idx)
Definition: preshader.c:292
for(i=0;i< sizeof(testsuite)/sizeof(testsuite[0]);++i) ok(call_test(testsuite[i].func)

Referenced by d3dx9_get_param_value_ptr(), texture_shader_fill_2d(), and texture_shader_fill_3d().

◆ 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 free(peval);
1367}
#define free
Definition: debug_ros.c:5
static void d3dx_free_preshader(struct d3dx_preshader *pres)
Definition: preshader.c:1349
static void d3dx_free_const_tab(struct d3dx_const_tab *ctab)
Definition: preshader.c:1342

Referenced by d3dx9_texture_shader_Release(), d3dx_create_param_eval(), and free_parameter().

◆ d3dx_image_cleanup()

◆ d3dx_image_get_pixels()

HRESULT d3dx_image_get_pixels ( struct d3dx_image *  image,
uint32_t  layer,
uint32_t  mip_level,
struct d3dx_pixels *  pixels 
)

Definition at line 1398 of file surface.c.

1400{
1401 struct volume mip_level_size = image->size;
1402 const BYTE *pixels_ptr = image->pixels;
1403 uint32_t row_pitch, slice_pitch, i;
1404 RECT unaligned_rect;
1405 HRESULT hr = S_OK;
1406
1407 if (mip_level >= image->mip_levels)
1408 {
1409 ERR("Tried to retrieve mip level %u, but image only has %u mip levels.\n", mip_level, image->mip_levels);
1410 return E_FAIL;
1411 }
1412
1413 if (layer >= image->layer_count)
1414 {
1415 ERR("Tried to retrieve layer %u, but image only has %u layers.\n", layer, image->layer_count);
1416 return E_FAIL;
1417 }
1418
1419 slice_pitch = row_pitch = 0;
1420 for (i = 0; i < image->mip_levels; i++)
1421 {
1422 hr = d3dx_calculate_pixels_size(image->format, mip_level_size.width, mip_level_size.height, &row_pitch, &slice_pitch);
1423 if (FAILED(hr))
1424 return hr;
1425
1426 if (i == mip_level)
1427 break;
1428
1429 pixels_ptr += slice_pitch * mip_level_size.depth;
1430 d3dx_get_next_mip_level_size(&mip_level_size);
1431 }
1432
1433 pixels_ptr += (layer * image->layer_pitch);
1434 SetRect(&unaligned_rect, 0, 0, mip_level_size.width, mip_level_size.height);
1435 set_d3dx_pixels(pixels, pixels_ptr, row_pitch, slice_pitch, image->palette, mip_level_size.width,
1436 mip_level_size.height, mip_level_size.depth, &unaligned_rect);
1437
1438 return D3D_OK;
1439}
#define ERR(fmt,...)
Definition: precomp.h:57
static void set_d3dx_pixels(struct d3dx_pixels *pixels, const void *data, uint32_t row_pitch, uint32_t slice_pitch, const PALETTEENTRY *palette, uint32_t width, uint32_t height, uint32_t depth, const RECT *unaligned_rect)
#define E_FAIL
Definition: ddrawi.h:102
UINT32 uint32_t
Definition: types.h:75
static void d3dx_get_next_mip_level_size(struct volume *size)
Definition: surface.c:412
static HRESULT d3dx_calculate_pixels_size(enum d3dx_pixel_format_id format, uint32_t width, uint32_t height, uint32_t *pitch, uint32_t *size)
Definition: surface.c:426
GLint GLint GLsizei GLsizei GLsizei GLint GLenum GLenum const GLvoid * pixels
Definition: gl.h:1546
GLenum GLuint GLint GLint layer
Definition: glext.h:7007
#define S_OK
Definition: intsafe.h:52
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
Definition: dcommon.idl:28

Referenced by D3DXCreateCubeTextureFromFileInMemoryEx(), D3DXCreateTextureFromFileInMemoryEx(), D3DXCreateVolumeTextureFromFileInMemoryEx(), D3DXLoadSurfaceFromFileInMemory(), and D3DXLoadVolumeFromFileInMemory().

◆ d3dx_image_init()

HRESULT d3dx_image_init ( const void *  src_data,
uint32_t  src_data_size,
struct d3dx_image *  image,
uint32_t  starting_mip_level,
uint32_t  flags 
)

Definition at line 1332 of file surface.c.

1334{
1336 HRESULT hr;
1337
1338 if (!src_data || !src_data_size || !image)
1339 return D3DERR_INVALIDCALL;
1340
1341 memset(image, 0, sizeof(*image));
1342 if (!d3dx_get_image_file_format_from_file_signature(src_data, src_data_size, &iff))
1343 {
1344 uint32_t src_image_size = src_data_size;
1345 const void *src_image = src_data;
1346
1347 if (convert_dib_to_bmp(&src_image, &src_image_size))
1348 {
1349 hr = d3dx_image_init(src_image, src_image_size, image, starting_mip_level, flags);
1350 free((void *)src_image);
1351 if (SUCCEEDED(hr))
1352 image->image_file_format = D3DXIFF_DIB;
1353 return hr;
1354 }
1355
1356 /* Last resort, try TGA. */
1357 return d3dx_initialize_image_from_tga(src_data, src_data_size, image, flags);
1358 }
1359
1360 switch (iff)
1361 {
1362 case D3DXIFF_BMP:
1363 case D3DXIFF_JPG:
1364 case D3DXIFF_PNG:
1365 hr = d3dx_initialize_image_from_wic(src_data, src_data_size, image, iff, flags);
1366 break;
1367
1368 case D3DXIFF_DDS:
1369 hr = d3dx_initialize_image_from_dds(src_data, src_data_size, image, starting_mip_level);
1370 break;
1371
1372 case D3DXIFF_PPM:
1373 case D3DXIFF_HDR:
1374 case D3DXIFF_PFM:
1375 WARN("Unsupported file format %s.\n", debug_d3dx_image_file_format(iff));
1376 hr = E_NOTIMPL;
1377 break;
1378
1380 ERR("Unrecognized file format.\n");
1382 break;
1383
1384 default:
1385 assert(0);
1386 return E_FAIL;
1387 }
1388
1389 return hr;
1390}
#define E_NOTIMPL
Definition: ddrawi.h:99
static HRESULT d3dx_initialize_image_from_tga(const void *src_data, uint32_t src_data_size, struct d3dx_image *image, uint32_t flags)
Definition: surface.c:1279
static BOOL convert_dib_to_bmp(const void **data, unsigned int *size)
Definition: surface.c:768
static BOOL d3dx_get_image_file_format_from_file_signature(const void *src_data, uint32_t src_data_size, D3DXIMAGE_FILEFORMAT *out_iff)
Definition: surface.c:665
static const char * debug_d3dx_image_file_format(D3DXIMAGE_FILEFORMAT format)
Definition: surface.c:887
HRESULT d3dx_image_init(const void *src_data, uint32_t src_data_size, struct d3dx_image *image, uint32_t starting_mip_level, uint32_t flags)
Definition: surface.c:1332
static HRESULT d3dx_initialize_image_from_wic(const void *src_data, uint32_t src_data_size, struct d3dx_image *image, D3DXIMAGE_FILEFORMAT d3dx_file_format, uint32_t flags)
Definition: surface.c:987
static HRESULT d3dx_initialize_image_from_dds(const void *src_data, uint32_t src_data_size, struct d3dx_image *image, uint32_t starting_mip_level)
Definition: surface.c:685
#define assert(_expr)
Definition: assert.h:32
D3DXIMAGE_FILEFORMAT
Definition: dx8vb.idl:61
@ D3DXIFF_JPG
Definition: dx8vb.idl:63
@ D3DXIFF_DDS
Definition: dx8vb.idl:66
@ D3DXIFF_BMP
Definition: dx8vb.idl:62
@ D3DXIFF_DIB
Definition: dx8vb.idl:68
@ D3DXIFF_FORCE_DWORD
Definition: dx8vb.idl:69
@ D3DXIFF_PPM
Definition: dx8vb.idl:67
@ D3DXIFF_PNG
Definition: dx8vb.idl:65
@ D3DXIFF_HDR
Definition: d3dx9tex.h:71
@ D3DXIFF_PFM
Definition: d3dx9tex.h:72
GLbitfield flags
Definition: glext.h:7161
#define SUCCEEDED(hr)
Definition: intsafe.h:50

Referenced by d3dx_image_init(), D3DXCreateCubeTextureFromFileInMemoryEx(), D3DXCreateTextureFromFileInMemoryEx(), D3DXCreateVolumeTextureFromFileInMemoryEx(), D3DXGetImageInfoFromFileInMemory(), D3DXLoadSurfaceFromFileInMemory(), and D3DXLoadVolumeFromFileInMemory().

◆ d3dx_init_parameters_store()

HRESULT d3dx_init_parameters_store ( struct d3dx_parameters_store *  store,
unsigned int  count 
)

Definition at line 743 of file effect.c.

744{
745 store->count = count;
747
748 if (store->count && !(store->parameters = calloc(store->count, sizeof(*store->parameters))))
749 return E_OUTOFMEMORY;
750
751 return S_OK;
752}
static int param_rb_compare(const void *key, const struct wine_rb_entry *entry)
Definition: effect.c:735
#define wine_rb_init
Definition: rbtree.h:406
struct d3dx_top_level_parameter * parameters
struct wine_rb_tree tree

Referenced by d3dx_parse_effect(), and D3DXCreateTextureShader().

◆ d3dx_load_pixels_from_pixels()

HRESULT d3dx_load_pixels_from_pixels ( struct d3dx_pixels *  dst_pixels,
const struct pixel_format_desc *  dst_desc,
struct d3dx_pixels *  src_pixels,
const struct pixel_format_desc *  src_desc,
uint32_t  filter_flags,
uint32_t  color_key 
)

Definition at line 2498 of file surface.c.

2501{
2502 struct volume src_size, dst_size, dst_size_aligned;
2503 HRESULT hr = S_OK;
2504
2505 TRACE("dst_pixels %s, dst_desc %p, src_pixels %s, src_desc %p, filter_flags %#x, color_key %#x.\n",
2506 debug_d3dx_pixels(dst_pixels), dst_desc, debug_d3dx_pixels(src_pixels), src_desc,
2507 filter_flags, color_key);
2508
2509 if (is_compressed_format(src_desc))
2510 set_volume_struct(&src_size, (src_pixels->unaligned_rect.right - src_pixels->unaligned_rect.left),
2511 (src_pixels->unaligned_rect.bottom - src_pixels->unaligned_rect.top), src_pixels->size.depth);
2512 else
2513 src_size = src_pixels->size;
2514
2515 dst_size_aligned = dst_pixels->size;
2516 if (is_compressed_format(dst_desc))
2517 set_volume_struct(&dst_size, (dst_pixels->unaligned_rect.right - dst_pixels->unaligned_rect.left),
2518 (dst_pixels->unaligned_rect.bottom - dst_pixels->unaligned_rect.top), dst_pixels->size.depth);
2519 else
2520 dst_size = dst_size_aligned;
2521
2522 /* Everything matches, simply copy the pixels. */
2523 if (src_desc->format == dst_desc->format
2524 && (dst_size.width == src_size.width && !(dst_size.width % dst_desc->block_width))
2525 && (dst_size.height == src_size.height && !(dst_size.height % dst_desc->block_height))
2526 && (dst_size.depth == src_size.depth)
2527 && color_key == 0
2528 && !(src_pixels->unaligned_rect.left & (src_desc->block_width - 1))
2529 && !(src_pixels->unaligned_rect.top & (src_desc->block_height - 1))
2530 && !(dst_pixels->unaligned_rect.left & (dst_desc->block_width - 1))
2531 && !(dst_pixels->unaligned_rect.top & (dst_desc->block_height - 1)))
2532 {
2533 TRACE("Simple copy.\n");
2534 copy_pixels(src_pixels->data, src_pixels->row_pitch, src_pixels->slice_pitch, (void *)dst_pixels->data,
2535 dst_pixels->row_pitch, dst_pixels->slice_pitch, &src_size, src_desc);
2536 return S_OK;
2537 }
2538
2539 /* Stretching or format conversion. */
2540 if (!is_conversion_from_supported(src_desc)
2541 || !is_conversion_to_supported(dst_desc))
2542 {
2543 FIXME("Unsupported format conversion %#x -> %#x.\n", src_desc->format, dst_desc->format);
2544 return E_NOTIMPL;
2545 }
2546
2547 /*
2548 * If the source is a compressed image, we need to decompress it first
2549 * before doing any modifications.
2550 */
2551 if (is_compressed_format(src_desc))
2552 {
2553 uint32_t uncompressed_row_pitch, uncompressed_slice_pitch;
2554 const struct pixel_format_desc *uncompressed_desc;
2555 void *uncompressed_mem = NULL;
2556
2557 hr = d3dx_pixels_decompress(src_pixels, src_desc, FALSE, &uncompressed_mem, &uncompressed_row_pitch,
2558 &uncompressed_slice_pitch, &uncompressed_desc);
2559 if (SUCCEEDED(hr))
2560 {
2561 struct d3dx_pixels uncompressed_pixels;
2562
2563 d3dx_pixels_init(uncompressed_mem, uncompressed_row_pitch, uncompressed_slice_pitch, NULL,
2564 uncompressed_desc->format, 0, 0, src_pixels->size.width, src_pixels->size.height,
2565 0, src_pixels->size.depth, &uncompressed_pixels);
2566
2567 hr = d3dx_load_pixels_from_pixels(dst_pixels, dst_desc, &uncompressed_pixels, uncompressed_desc,
2568 filter_flags, color_key);
2569 }
2570 free(uncompressed_mem);
2571 goto exit;
2572 }
2573
2574 /* Same as the above, need to decompress the destination prior to modifying. */
2575 if (is_compressed_format(dst_desc))
2576 {
2577 uint32_t uncompressed_row_pitch, uncompressed_slice_pitch;
2578 const struct pixel_format_desc *uncompressed_desc;
2579 struct d3dx_pixels uncompressed_pixels;
2580 void *uncompressed_mem = NULL;
2581
2582 hr = d3dx_pixels_decompress(dst_pixels, dst_desc, TRUE, &uncompressed_mem, &uncompressed_row_pitch,
2583 &uncompressed_slice_pitch, &uncompressed_desc);
2584 if (FAILED(hr))
2585 goto exit;
2586
2587 d3dx_pixels_init(uncompressed_mem, uncompressed_row_pitch, uncompressed_slice_pitch, NULL,
2588 uncompressed_desc->format, dst_pixels->unaligned_rect.left, dst_pixels->unaligned_rect.top,
2589 dst_pixels->unaligned_rect.right, dst_pixels->unaligned_rect.bottom, 0, dst_pixels->size.depth,
2590 &uncompressed_pixels);
2591
2592 hr = d3dx_load_pixels_from_pixels(&uncompressed_pixels, uncompressed_desc, src_pixels, src_desc, filter_flags,
2593 color_key);
2594 if (SUCCEEDED(hr))
2595 {
2596 GLenum gl_format = 0;
2597 uint32_t i;
2598
2599 TRACE("Compressing DXTn surface.\n");
2600 switch (dst_desc->format)
2601 {
2604 break;
2608 break;
2612 break;
2613 default:
2614 ERR("Unexpected destination compressed format %u.\n", dst_desc->format);
2615 }
2616
2617 for (i = 0; i < dst_size_aligned.depth; ++i)
2618 {
2619 BYTE *uncompressed_mem_slice = (BYTE *)uncompressed_mem + (i * uncompressed_slice_pitch);
2620 BYTE *dst_memory_slice = ((BYTE *)dst_pixels->data) + (i * dst_pixels->slice_pitch);
2621
2622 tx_compress_dxtn(4, dst_size_aligned.width, dst_size_aligned.height, uncompressed_mem_slice, gl_format,
2623 dst_memory_slice, dst_pixels->row_pitch);
2624 }
2625 }
2626 free(uncompressed_mem);
2627 goto exit;
2628 }
2629
2630 if ((filter_flags & 0xf) == D3DX_FILTER_NONE)
2631 {
2632 convert_argb_pixels(src_pixels->data, src_pixels->row_pitch, src_pixels->slice_pitch, &src_size, src_desc,
2633 (BYTE *)dst_pixels->data, dst_pixels->row_pitch, dst_pixels->slice_pitch, &dst_size, dst_desc,
2634 color_key, src_pixels->palette);
2635 }
2636 else /* if ((filter & 0xf) == D3DX_FILTER_POINT) */
2637 {
2638 if ((filter_flags & 0xf) != D3DX_FILTER_POINT)
2639 FIXME("Unhandled filter %#x.\n", filter_flags);
2640
2641 /* Always apply a point filter until D3DX_FILTER_LINEAR,
2642 * D3DX_FILTER_TRIANGLE and D3DX_FILTER_BOX are implemented. */
2643 point_filter_argb_pixels(src_pixels->data, src_pixels->row_pitch, src_pixels->slice_pitch, &src_size,
2644 src_desc, (BYTE *)dst_pixels->data, dst_pixels->row_pitch, dst_pixels->slice_pitch, &dst_size,
2645 dst_desc, color_key, src_pixels->palette);
2646 }
2647
2648exit:
2649 if (FAILED(hr))
2650 WARN("Failed to load pixels, hr %#lx.\n", hr);
2651 return hr;
2652}
void tx_compress_dxtn(GLint srccomps, GLint width, GLint height, const GLubyte *srcPixData, GLenum destFormat, GLubyte *dest, GLint dstRowStride)
static BOOL is_conversion_to_supported(const struct pixel_format_desc *format)
static void set_volume_struct(struct volume *volume, uint32_t width, uint32_t height, uint32_t depth)
Definition: d3dx9_private.h:86
static BOOL is_conversion_from_supported(const struct pixel_format_desc *format)
static BOOL is_compressed_format(const struct pixel_format_desc *format)
HRESULT d3dx_load_pixels_from_pixels(struct d3dx_pixels *dst_pixels, const struct pixel_format_desc *dst_desc, struct d3dx_pixels *src_pixels, const struct pixel_format_desc *src_desc, uint32_t filter_flags, uint32_t color_key)
Definition: surface.c:2498
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: surface.c:2180
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: surface.c:2149
static HRESULT d3dx_pixels_decompress(struct d3dx_pixels *pixels, const struct pixel_format_desc *desc, BOOL is_dst, void **out_memory, uint32_t *out_row_pitch, uint32_t *out_slice_pitch, const struct pixel_format_desc **out_desc)
Definition: surface.c:2364
static const char * debug_d3dx_pixels(struct d3dx_pixels *pixels)
Definition: surface.c:2489
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: surface.c:2280
HRESULT d3dx_pixels_init(const void *data, uint32_t row_pitch, uint32_t slice_pitch, const PALETTEENTRY *palette, enum d3dx_pixel_format_id format, uint32_t left, uint32_t top, uint32_t right, uint32_t bottom, uint32_t front, uint32_t back, struct d3dx_pixels *pixels)
Definition: surface.c:2450
#define D3DX_FILTER_POINT
Definition: d3dx9tex.h:28
#define D3DX_FILTER_NONE
Definition: d3dx9tex.h:27
unsigned int GLenum
Definition: gl.h:150
#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT
Definition: glext.h:3492
#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT
Definition: glext.h:3491
#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT
Definition: glext.h:3490
#define exit(n)
Definition: config.h:202
long bottom
Definition: dcommon.idl:29
long right
Definition: dcommon.idl:29
long left
Definition: dcommon.idl:29
long top
Definition: dcommon.idl:29
const PALETTEENTRY * palette
uint32_t row_pitch
struct volume size
RECT unaligned_rect
const void * data
uint32_t slice_pitch
enum d3dx_pixel_format_id format

Referenced by d3dx_load_pixels_from_pixels(), d3dx_load_surface_from_memory(), d3dx_load_volume_from_memory(), d3dx_save_pixels_to_memory(), D3DXCreateCubeTextureFromFileInMemoryEx(), D3DXCreateTextureFromFileInMemoryEx(), and D3DXCreateVolumeTextureFromFileInMemoryEx().

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

1757{
1758 HRESULT hr;
1759 struct d3dx_preshader *pres = &peval->pres;
1760 struct d3dx_regstore *rs = &pres->regs;
1761 ULONG64 new_update_version = next_update_version(peval->version_counter);
1762 BOOL pres_dirty = FALSE;
1763
1764 TRACE("device %p, peval %p, param_type %u.\n", device, peval, peval->param_type);
1765
1767 {
1768 set_constants(rs, &pres->inputs, new_update_version,
1769 NULL, NULL, peval->param_type, FALSE, FALSE);
1770 if (FAILED(hr = execute_preshader(pres)))
1771 return hr;
1772 pres_dirty = TRUE;
1773 }
1774
1775 return set_constants(rs, &peval->shader_inputs, new_update_version,
1776 manager, device, peval->param_type, update_all, pres_dirty);
1777}
unsigned __int64 ULONG64
Definition: imports.h:198
struct d3dx_const_tab inputs
struct d3dx_regstore regs

Referenced by d3dx_set_shader_constants().

◆ d3dx_parameters_store_cleanup()

void d3dx_parameters_store_cleanup ( struct d3dx_parameters_store *  store)

Definition at line 754 of file effect.c.

755{
756 unsigned int i;
757
758 free(store->full_name_tmp);
759
760 if (store->parameters)
761 {
762 for (i = 0; i < store->count; ++i)
764 free(store->parameters);
765 store->parameters = NULL;
766 }
767}
static void free_top_level_parameter(struct d3dx_top_level_parameter *param)
Definition: effect.c:633

Referenced by d3dx9_texture_shader_Release(), d3dx_effect_cleanup(), and d3dx_parse_effect().

◆ d3dx_pixel_format_id_from_d3dformat()

enum d3dx_pixel_format_id d3dx_pixel_format_id_from_d3dformat ( D3DFORMAT  format)

Definition at line 138 of file util.c.

139{
140 switch (format)
141 {
186 default:
187 FIXME("No d3dx_pixel_format_id for D3DFORMAT %s.\n", debugstr_fourcc(format));
189 }
190}
static __inline const char * debugstr_fourcc(unsigned int cc)
Definition: debug.h:397

Referenced by get_format_info(), and wic_guid_from_d3dformat().

◆ d3dx_pixels_init()

HRESULT d3dx_pixels_init ( const void *  data,
uint32_t  row_pitch,
uint32_t  slice_pitch,
const PALETTEENTRY *  palette,
enum d3dx_pixel_format_id  format,
uint32_t  left,
uint32_t  top,
uint32_t  right,
uint32_t  bottom,
uint32_t  front,
uint32_t  back,
struct d3dx_pixels *  pixels 
)

Definition at line 2450 of file surface.c.

2453{
2454 const struct pixel_format_desc *fmt_desc = get_d3dx_pixel_format_info(format);
2455 const BYTE *ptr = data;
2456 RECT unaligned_rect;
2457
2458 memset(pixels, 0, sizeof(*pixels));
2459 if (is_unknown_format(fmt_desc))
2460 {
2461 FIXME("Unsupported format %#x.\n", format);
2462 return E_NOTIMPL;
2463 }
2464
2465 ptr += front * slice_pitch;
2466 ptr += (top / fmt_desc->block_height) * row_pitch;
2467 ptr += (left / fmt_desc->block_width) * fmt_desc->block_byte_count;
2468
2469 if (is_compressed_format(fmt_desc))
2470 {
2471 uint32_t left_aligned, top_aligned;
2472
2473 top_aligned = top & ~(fmt_desc->block_height - 1);
2474 left_aligned = left & ~(fmt_desc->block_width - 1);
2475 SetRect(&unaligned_rect, left, top, right, bottom);
2476 OffsetRect(&unaligned_rect, -left_aligned, -top_aligned);
2477 }
2478 else
2479 {
2480 SetRect(&unaligned_rect, 0, 0, (right - left), (bottom - top));
2481 }
2482
2483 set_d3dx_pixels(pixels, ptr, row_pitch, slice_pitch, palette, (right - left), (bottom - top), (back - front),
2484 &unaligned_rect);
2485
2486 return S_OK;
2487}
static BOOL is_unknown_format(const struct pixel_format_desc *format)
const struct pixel_format_desc * get_d3dx_pixel_format_info(enum d3dx_pixel_format_id format)
Definition: util.c:297
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLdouble GLdouble right
Definition: glext.h:10859
GLint left
Definition: glext.h:7726
GLint GLint bottom
Definition: glext.h:7726
if(dx< 0)
Definition: linetemp.h:194
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
static struct address_cache * front
Definition: rpcb_clnt.c:83

Referenced by d3dx_load_pixels_from_pixels(), d3dx_load_surface_from_memory(), d3dx_load_volume_from_memory(), and save_dds_surface_to_memory().

◆ d3dx_shader_get_ctab_constant()

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

Definition at line 969 of file shader.c.

970{
972
974}
static struct ctab_constant * get_valid_constant(struct ID3DXConstantTableImpl *table, D3DXHANDLE handle)
Definition: shader.c:868
static struct ID3DXConstantTableImpl * impl_from_ID3DXConstantTable(ID3DXConstantTable *iface)
Definition: shader.c:743

Referenced by get_ctab_constant_desc().

◆ d3dximage_info_from_d3dx_image()

void d3dximage_info_from_d3dx_image ( D3DXIMAGE_INFO *  info,
struct d3dx_image *  image 
)

Definition at line 1441 of file surface.c.

1442{
1443 info->ImageFileFormat = image->image_file_format;
1444 info->Width = image->size.width;
1445 info->Height = image->size.height;
1446 info->Depth = image->size.depth;
1447 info->MipLevels = image->mip_levels;
1448 switch (image->format)
1449 {
1451 info->Format = D3DFMT_A16B16G16R16;
1452 break;
1453
1455 if (info->ImageFileFormat == D3DXIFF_PNG || info->ImageFileFormat == D3DXIFF_JPG)
1456 info->Format = D3DFMT_X8R8G8B8;
1457 else
1459 break;
1460
1461 default:
1463 break;
1464 }
1465 info->ResourceType = image->resource_type;
1466}
D3DFORMAT d3dformat_from_d3dx_pixel_format_id(enum d3dx_pixel_format_id format)
Definition: util.c:83

Referenced by D3DXCreateCubeTextureFromFileInMemoryEx(), D3DXCreateTextureFromFileInMemoryEx(), D3DXCreateVolumeTextureFromFileInMemoryEx(), D3DXGetImageInfoFromFileInMemory(), D3DXLoadSurfaceFromFileInMemory(), and D3DXLoadVolumeFromFileInMemory().

◆ debug_d3dxparameter_class()

const char * debug_d3dxparameter_class ( D3DXPARAMETER_CLASS  c)

Definition at line 328 of file util.c.

329{
330 switch (c)
331 {
338 default:
339 FIXME("Unrecognized D3DXPARAMETER_CLASS %#x.\n", c);
340 return "unrecognized";
341 }
342}
#define WINE_D3DX_TO_STR(x)
Definition: util.c:326
@ D3DXPC_SCALAR
Definition: d3dx9shader.h:62
@ D3DXPC_MATRIX_COLUMNS
Definition: d3dx9shader.h:65
@ D3DXPC_STRUCT
Definition: d3dx9shader.h:67
@ D3DXPC_MATRIX_ROWS
Definition: d3dx9shader.h:64
@ D3DXPC_VECTOR
Definition: d3dx9shader.h:63
@ D3DXPC_OBJECT
Definition: d3dx9shader.h:66
const GLubyte * c
Definition: glext.h:8905

Referenced by d3dx_effect_GetMatrix(), d3dx_effect_GetMatrixArray(), d3dx_effect_GetMatrixPointerArray(), d3dx_effect_GetMatrixTranspose(), d3dx_effect_GetMatrixTransposeArray(), d3dx_effect_GetMatrixTransposePointerArray(), d3dx_effect_GetVector(), d3dx_effect_GetVectorArray(), d3dx_effect_SetBoolArray(), d3dx_effect_SetFloatArray(), d3dx_effect_SetIntArray(), d3dx_effect_SetMatrix(), d3dx_effect_SetMatrixArray(), d3dx_effect_SetMatrixPointerArray(), d3dx_effect_SetMatrixTranspose(), d3dx_effect_SetMatrixTransposeArray(), d3dx_effect_SetMatrixTransposePointerArray(), d3dx_effect_SetVector(), d3dx_effect_SetVectorArray(), d3dx_parse_effect_typedef(), d3dx_parse_init_value(), d3dx_parse_resource(), d3dx_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 374 of file util.c.

375{
376 switch (r)
377 {
382 default:
383 FIXME("Unrecognized D3DXREGISTER_SET %#x.\n", r);
384 return "unrecognized";
385 }
386}
@ D3DXRS_FLOAT4
Definition: d3dx9shader.h:55
@ D3DXRS_BOOL
Definition: d3dx9shader.h:53
@ D3DXRS_INT4
Definition: d3dx9shader.h:54
@ D3DXRS_SAMPLER
Definition: d3dx9shader.h:56
GLdouble GLdouble GLdouble r
Definition: gl.h:2055

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

◆ debug_d3dxparameter_type()

const char * debug_d3dxparameter_type ( D3DXPARAMETER_TYPE  t)

Definition at line 344 of file util.c.

345{
346 switch (t)
347 {
368 default:
369 FIXME("Unrecognized D3DXPARAMETER_TYP %#x.\n", t);
370 return "unrecognized";
371 }
372}
@ D3DXPT_STRING
Definition: d3dx9shader.h:77
@ D3DXPT_TEXTURE
Definition: d3dx9shader.h:78
@ D3DXPT_SAMPLER3D
Definition: d3dx9shader.h:86
@ D3DXPT_UNSUPPORTED
Definition: d3dx9shader.h:92
@ D3DXPT_VERTEXFRAGMENT
Definition: d3dx9shader.h:91
@ D3DXPT_TEXTURE1D
Definition: d3dx9shader.h:79
@ D3DXPT_SAMPLERCUBE
Definition: d3dx9shader.h:87
@ D3DXPT_TEXTURECUBE
Definition: d3dx9shader.h:82
@ D3DXPT_PIXELFRAGMENT
Definition: d3dx9shader.h:90
@ D3DXPT_BOOL
Definition: d3dx9shader.h:74
@ D3DXPT_INT
Definition: d3dx9shader.h:75
@ D3DXPT_VOID
Definition: d3dx9shader.h:73
@ D3DXPT_SAMPLER
Definition: d3dx9shader.h:83
@ D3DXPT_SAMPLER1D
Definition: d3dx9shader.h:84
@ D3DXPT_SAMPLER2D
Definition: d3dx9shader.h:85
@ D3DXPT_TEXTURE3D
Definition: d3dx9shader.h:81
@ D3DXPT_TEXTURE2D
Definition: d3dx9shader.h:80
GLdouble GLdouble t
Definition: gl.h:2047

Referenced by d3dx_effect_GetValue(), d3dx_parse_effect_typedef(), d3dx_parse_resource(), d3dx_parse_value(), free_parameter(), free_parameter_object_data(), parse_ctab_constant_type(), and set_value().

◆ float_16_to_32()

float float_16_to_32 ( const unsigned short  in)

Definition at line 2203 of file math.c.

2204{
2205 const unsigned short s = (in & 0x8000);
2206 const unsigned short e = (in & 0x7C00) >> 10;
2207 const unsigned short m = in & 0x3FF;
2208 const float sgn = (s ? -1.0f : 1.0f);
2209
2210 if (e == 0)
2211 {
2212 if (m == 0) return sgn * 0.0f; /* +0.0 or -0.0 */
2213 else return sgn * powf(2, -14.0f) * (m / 1024.0f);
2214 }
2215 else
2216 {
2217 return sgn * powf(2, e - 15.0f) * (1.0f + (m / 1024.0f));
2218 }
2219}
_ACRTIMP float __cdecl powf(float, float)
Definition: powf.c:14
GLdouble s
Definition: gl.h:2039
GLuint in
Definition: glext.h:9616
const GLfloat * m
Definition: glext.h:10848
#define e
Definition: ke_i.h:82
long sgn(REAL x)
Definition: varray.cc:48

Referenced by D3DXFloat16To32Array(), format_to_d3dx_color(), generic_float16_2(), generic_float16_4(), and wined3d_context_gl_load_numbered_arrays().

◆ float_32_to_16()

unsigned short float_32_to_16 ( const float  in)

Definition at line 2102 of file math.c.

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

Referenced by convert_r32_float_r16_float(), D3DXFloat32To16Array(), format_from_d3dx_color(), and wined3d_format_convert_from_float().

◆ format_from_d3dx_color()

void format_from_d3dx_color ( const struct pixel_format_desc *  format,
const struct d3dx_color *  src,
BYTE *  dst 
)

Definition at line 2051 of file surface.c.

2052{
2053 DWORD v, mask32;
2054 unsigned int c, i;
2055
2056 memset(dst, 0, format->bytes_per_pixel);
2057
2058 for (c = 0; c < 4; ++c)
2059 {
2060 const enum component_type dst_ctype = !c ? format->a_type : format->rgb_type;
2061 static const unsigned int component_offsets[4] = {3, 0, 1, 2};
2062 const float src_component = *(&src->value.x + component_offsets[c]);
2063 const enum range src_range = !c ? src->a_range : src->rgb_range;
2064
2065 if (!format->bits[c])
2066 continue;
2067
2068 mask32 = ~0u >> (32 - format->bits[c]);
2069
2070 switch (dst_ctype)
2071 {
2072 case CTYPE_FLOAT:
2073 if (format->bits[c] == 16)
2074 v = float_32_to_16(src_component);
2075 else
2076 v = *(DWORD *)&src_component;
2077 break;
2078
2079 case CTYPE_LUMA:
2080 {
2081 float val = src->value.x * 0.2125f + src->value.y * 0.7154f + src->value.z * 0.0721f;
2082
2083 if (src_range == RANGE_SNORM)
2084 val = (val + 1.0f) / 2.0f;
2085
2086 v = d3dx_clamp(val, 0.0f, 1.0f) * ((1u << format->bits[c]) - 1) + 0.5f;
2087 break;
2088 }
2089
2090 case CTYPE_UNORM:
2091 {
2092 float val = src_component;
2093
2094 if (src_range == RANGE_SNORM)
2095 val = (val + 1.0f) / 2.0f;
2096
2097 v = d3dx_clamp(val, 0.0f, 1.0f) * ((1u << format->bits[c]) - 1) + 0.5f;
2098 break;
2099 }
2100
2101 case CTYPE_SNORM:
2102 {
2103 const uint32_t max_value = (1u << (format->bits[c] - 1)) - 1;
2104 float val = src_component;
2105
2106 if (src_range == RANGE_UNORM)
2107 val = (val * 2.0f) - 1.0f;
2108
2109 v = d3dx_clamp(val, -1.0f, 1.0f) * max_value + 0.5f;
2110 break;
2111 }
2112
2113 /* We shouldn't be trying to output to CTYPE_INDEX. */
2114 case CTYPE_INDEX:
2115 assert(0);
2116 break;
2117
2118 default:
2119 v = 0;
2120 break;
2121 }
2122
2123 for (i = format->shift[c] / 8 * 8; i < format->shift[c] + format->bits[c]; i += 8)
2124 {
2125 BYTE mask, byte;
2126
2127 if (format->shift[c] > i)
2128 {
2129 mask = mask32 << (format->shift[c] - i);
2130 byte = (v << (format->shift[c] - i)) & mask;
2131 }
2132 else
2133 {
2134 mask = mask32 >> (i - format->shift[c]);
2135 byte = (v >> (i - format->shift[c])) & mask;
2136 }
2137 dst[i / 8] |= byte;
2138 }
2139 }
2140}
component_type
range
Definition: d3dx9_private.h:58
unsigned short float_32_to_16(const float in)
Definition: math.c:2102
static float d3dx_clamp(float value, float min_value, float max_value)
Definition: surface.c:1925
#define byte(x, n)
Definition: tomcrypt.h:118
const GLdouble * v
Definition: gl.h:2040
GLenum GLint GLuint mask
Definition: glext.h:6028
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
#define c
Definition: ke_i.h:80
#define shift
Definition: input.c:3280

Referenced by convert_argb_pixels(), D3DXFillCubeTexture(), D3DXFillTexture(), D3DXFillVolumeTexture(), and point_filter_argb_pixels().

◆ format_to_d3dx_color()

void format_to_d3dx_color ( const struct pixel_format_desc *  format,
const BYTE *  src,
const PALETTEENTRY *  palette,
struct d3dx_color *  dst 
)

Definition at line 1978 of file surface.c.

1980{
1981 DWORD mask, tmp;
1982 unsigned int c;
1983
1984 dst->rgb_range = get_range_for_component_type(format->rgb_type);
1985 dst->a_range = get_range_for_component_type(format->a_type);
1986 for (c = 0; c < 4; ++c)
1987 {
1988 const enum component_type dst_ctype = !c ? format->a_type : format->rgb_type;
1989 static const unsigned int component_offsets[4] = {3, 0, 1, 2};
1990 float *dst_component = &dst->value.x + component_offsets[c];
1991
1992 if (format->bits[c])
1993 {
1994 mask = ~0u >> (32 - format->bits[c]);
1995
1996 memcpy(&tmp, src + format->shift[c] / 8,
1997 min(sizeof(DWORD), (format->shift[c] % 8 + format->bits[c] + 7) / 8));
1998 tmp = (tmp >> (format->shift[c] % 8)) & mask;
1999
2000 switch (dst_ctype)
2001 {
2002 case CTYPE_FLOAT:
2003 if (format->bits[c] == 16)
2004 *dst_component = float_16_to_32(tmp);
2005 else
2006 *dst_component = *(float *)&tmp;
2007 break;
2008
2009 case CTYPE_INDEX:
2010 *dst_component = (&palette[tmp].peRed)[component_offsets[c]] / 255.0f;
2011 break;
2012
2013 case CTYPE_LUMA:
2014 case CTYPE_UNORM:
2015 *dst_component = (float)tmp / mask;
2016 break;
2017
2018 case CTYPE_SNORM:
2019 {
2020 const uint32_t sign_bit = (1u << (format->bits[c] - 1));
2021 uint32_t tmp_extended = (tmp & sign_bit) ? (tmp | ~(sign_bit - 1)) : tmp;
2022
2023 /*
2024 * In order to clamp to an even range, we need to ignore
2025 * the maximum negative value.
2026 */
2027 if (tmp == sign_bit)
2028 tmp_extended |= 1;
2029
2030 *dst_component = (float)(((int32_t)tmp_extended)) / (sign_bit - 1);
2031 break;
2032 }
2033
2034 default:
2035 break;
2036 }
2037 }
2038 else if (dst_ctype == CTYPE_LUMA)
2039 {
2040 assert(format->bits[1]);
2041 *dst_component = dst->value.x;
2042 }
2043 else
2044 {
2045 *dst_component = 1.0f;
2046 }
2047 }
2048}
float float_16_to_32(const unsigned short in)
Definition: math.c:2203
INT32 int32_t
Definition: types.h:71
static enum range get_range_for_component_type(enum component_type type)
Definition: surface.c:1955
static float(__cdecl *square_half_float)(float x

Referenced by convert_argb_pixels(), D3DXSHProjectCubeMap(), and point_filter_argb_pixels().

◆ format_types_match()

static BOOL format_types_match ( const struct pixel_format_desc *  src,
const struct pixel_format_desc *  dst 
)
inlinestatic

Definition at line 259 of file d3dx9_private.h.

260{
261 if ((src->a_type && dst->a_type) && (src->a_type != dst->a_type))
262 return FALSE;
263
264 if ((src->rgb_type && dst->rgb_type) && (src->rgb_type != dst->rgb_type))
265 return FALSE;
266
267 if (src->flags != dst->flags)
268 return FALSE;
269
270 return (src->rgb_type == dst->rgb_type || src->a_type == dst->a_type);
271}

Referenced by check_texture_requirements(), convert_argb_pixels(), and point_filter_argb_pixels().

◆ get_aligned_rect()

void get_aligned_rect ( uint32_t  left,
uint32_t  top,
uint32_t  right,
uint32_t  bottom,
uint32_t  width,
uint32_t  height,
const struct pixel_format_desc *  fmt_desc,
RECT *  aligned_rect 
)

Definition at line 2654 of file surface.c.

2656{
2657 SetRect(aligned_rect, left, top, right, bottom);
2658 if (aligned_rect->left & (fmt_desc->block_width - 1))
2659 aligned_rect->left = aligned_rect->left & ~(fmt_desc->block_width - 1);
2660 if (aligned_rect->top & (fmt_desc->block_height - 1))
2661 aligned_rect->top = aligned_rect->top & ~(fmt_desc->block_height - 1);
2662 if (aligned_rect->right & (fmt_desc->block_width - 1) && aligned_rect->right != width)
2663 aligned_rect->right = min((aligned_rect->right + fmt_desc->block_width - 1)
2664 & ~(fmt_desc->block_width - 1), width);
2665 if (aligned_rect->bottom & (fmt_desc->block_height - 1) && aligned_rect->bottom != height)
2666 aligned_rect->bottom = min((aligned_rect->bottom + fmt_desc->block_height - 1)
2667 & ~(fmt_desc->block_height - 1), height);
2668}
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546

Referenced by d3dx_load_surface_from_memory(), and d3dx_load_volume_from_memory().

◆ get_bool()

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

Definition at line 337 of file d3dx9_private.h.

338{
339 switch (type)
340 {
341 case D3DXPT_FLOAT:
342 case D3DXPT_INT:
343 case D3DXPT_BOOL:
344 return !!*(DWORD *)data;
345
346 case D3DXPT_VOID:
347 return *(BOOL *)data;
348
349 default:
350 return FALSE;
351 }
352}

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

◆ get_d3dx_pixel_format_info()

◆ get_float()

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

Definition at line 373 of file d3dx9_private.h.

374{
375 switch (type)
376 {
377 case D3DXPT_FLOAT:
378 case D3DXPT_VOID:
379 return *(float *)data;
380
381 case D3DXPT_INT:
382 return (float)(*(int *)data);
383
384 case D3DXPT_BOOL:
385 return (float)get_bool(type, data);
386
387 default:
388 return 0.0f;
389 }
390}
static BOOL get_bool(D3DXPARAMETER_TYPE type, const void *data)

Referenced by set_number().

◆ get_format_info()

◆ get_format_info_idx()

const struct pixel_format_desc * get_format_info_idx ( int  idx)

Definition at line 321 of file util.c.

322{
324}
unsigned int idx
Definition: utils.c:40

Referenced by check_texture_requirements().

◆ get_int()

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

Definition at line 354 of file d3dx9_private.h.

355{
356 switch (type)
357 {
358 case D3DXPT_FLOAT:
359 return (int)(*(float *)data);
360
361 case D3DXPT_INT:
362 case D3DXPT_VOID:
363 return *(int *)data;
364
365 case D3DXPT_BOOL:
366 return get_bool(type, data);
367
368 default:
369 return 0;
370 }
371}

Referenced by arg_clbk_type(), create_positional_ctx(), and set_number().

◆ get_parameter_by_name()

struct d3dx_parameter * get_parameter_by_name ( struct d3dx_parameters_store *  store,
struct d3dx_parameter *  parameter,
const char *  name 
)

Definition at line 1041 of file effect.c.

1043{
1044 struct d3dx_parameter *temp_parameter;
1045 unsigned int name_len, param_name_len;
1046 unsigned int i, count, length;
1047 struct wine_rb_entry *entry;
1048 unsigned int full_name_size;
1049 const char *part;
1050 char *full_name;
1051
1052 TRACE("store %p, parameter %p, name %s.\n", store, parameter, debugstr_a(name));
1053
1054 if (!name || !*name) return NULL;
1055
1056 if (!parameter)
1057 {
1058 if ((entry = wine_rb_get(&store->tree, name)))
1060 return NULL;
1061 }
1062
1063 if (parameter->full_name)
1064 {
1065 name_len = strlen(name);
1066 param_name_len = strlen(parameter->full_name);
1067 full_name_size = name_len + param_name_len + 2;
1068 if (store->full_name_tmp_size < full_name_size)
1069 {
1070 if (!(full_name = realloc(store->full_name_tmp, full_name_size)))
1071 {
1072 ERR("Out of memory.\n");
1073 return NULL;
1074 }
1075 store->full_name_tmp = full_name;
1076 store->full_name_tmp_size = full_name_size;
1077 }
1078 else
1079 {
1080 full_name = store->full_name_tmp;
1081 }
1082 memcpy(full_name, parameter->full_name, param_name_len);
1083 full_name[param_name_len] = '.';
1084 memcpy(full_name + param_name_len + 1, name, name_len);
1085 full_name[param_name_len + 1 + name_len] = 0;
1086
1087 if ((entry = wine_rb_get(&store->tree, full_name)))
1089 return NULL;
1090 }
1091
1092 /* Pass / technique annotations are not stored in the parameters tree,
1093 * do a linear search. */
1094 count = parameter->member_count;
1095
1096 length = strcspn( name, "[." );
1097 part = name + length;
1098
1099 for (i = 0; i < count; i++)
1100 {
1101 temp_parameter = &parameter->members[i];
1102
1103 if (!strcmp(temp_parameter->name, name))
1104 {
1105 TRACE("Returning parameter %p\n", temp_parameter);
1106 return temp_parameter;
1107 }
1108 else if (strlen(temp_parameter->name) == length && !strncmp(temp_parameter->name, name, length))
1109 {
1110 switch (*part++)
1111 {
1112 case '.':
1113 return get_parameter_by_name(store, temp_parameter, part);
1114
1115 case '[':
1116 return get_parameter_element_by_name(store, temp_parameter, part);
1117
1118 default:
1119 FIXME("Unhandled case \"%c\"\n", *--part);
1120 break;
1121 }
1122 }
1123 }
1124
1125 TRACE("Parameter not found\n");
1126 return NULL;
1127}
#define realloc
Definition: debug_ros.c:6
struct d3dx_parameter * get_parameter_by_name(struct d3dx_parameters_store *store, struct d3dx_parameter *parameter, const char *name)
Definition: effect.c:1041
static struct d3dx_parameter * get_parameter_element_by_name(struct d3dx_parameters_store *store, struct d3dx_parameter *parameter, const char *name)
Definition: effect.c:959
_ACRTIMP size_t __cdecl strlen(const char *)
Definition: string.c:1597
_ACRTIMP size_t __cdecl strcspn(const char *, const char *)
Definition: string.c:3498
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3324
_ACRTIMP int __cdecl strncmp(const char *, const char *, size_t)
Definition: string.c:3335
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
uint32_t entry
Definition: isohybrid.c:63
#define debugstr_a
Definition: kernel32.h:31
#define wine_rb_entry
Definition: rbtree.h:404
#define WINE_RB_ENTRY_VALUE
Definition: rbtree.h:414
#define wine_rb_get
Definition: rbtree.h:409
struct d3dx_parameter * members
unsigned int member_count
unsigned int full_name_tmp_size
Definition: name.c:39
Definition: rbtree.h:30

Referenced by d3dx9_effect_init_from_binary(), d3dx_effect_GetParameterByName(), d3dx_parse_array_selector(), d3dx_parse_resource(), get_annotation_by_name(), get_constants_desc(), get_parameter_by_name(), get_parameter_element_by_name(), and get_valid_parameter().

◆ is_compressed_format()

static BOOL is_compressed_format ( const struct pixel_format_desc *  format)
inlinestatic

◆ is_conversion_from_supported()

static BOOL is_conversion_from_supported ( const struct pixel_format_desc *  format)
inlinestatic

Definition at line 278 of file d3dx9_private.h.

279{
281}
static BOOL is_packed_format(const struct pixel_format_desc *format)

Referenced by d3dx_load_pixels_from_pixels(), and D3DXSaveSurfaceToFileInMemory().

◆ is_conversion_to_supported()

static BOOL is_conversion_to_supported ( const struct pixel_format_desc *  format)
inlinestatic

Definition at line 283 of file d3dx9_private.h.

284{
286}
static BOOL is_index_format(const struct pixel_format_desc *format)

Referenced by d3dx_load_pixels_from_pixels(), and D3DXSaveSurfaceToFileInMemory().

◆ is_index_format()

◆ is_internal_format()

static BOOL is_internal_format ( const struct pixel_format_desc *  format)
inlinestatic

Definition at line 273 of file d3dx9_private.h.

274{
275 return !!(format->flags & FMT_FLAG_INTERNAL);
276}

Referenced by d3dformat_from_d3dx_pixel_format_id().

◆ is_packed_format()

static BOOL is_packed_format ( const struct pixel_format_desc *  format)
inlinestatic

Definition at line 254 of file d3dx9_private.h.

255{
256 return !!(format->flags & FMT_FLAG_PACKED);
257}

Referenced by is_conversion_from_supported(), and is_conversion_to_supported().

◆ is_param_dirty()

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

Definition at line 581 of file d3dx9_private.h.

582{
583 return is_top_level_param_dirty(param->top_level_param, update_version);
584}
static BOOL is_top_level_param_dirty(struct d3dx_top_level_parameter *param, ULONG64 update_version)

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)
1719 || is_const_tab_input_dirty(&peval->shader_inputs, update_version);
1720}

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

572{
573 struct d3dx_shared_data *shared_data;
574
575 if ((shared_data = param->shared_data))
576 return update_version < shared_data->update_version;
577 else
578 return update_version < param->update_version;
579}
ULONG64 update_version

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

556{
557 return &param->top_level_param->param == param;
558}

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

◆ is_unknown_format()

◆ load_resource_into_memory()

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

Definition at line 261 of file util.c.

262{
264
265 *length = SizeofResource(module, resinfo);
266 if(*length == 0) return HRESULT_FROM_WIN32(GetLastError());
267
268 resource = LoadResource(module, resinfo);
270
272 if(*buffer == NULL) return HRESULT_FROM_WIN32(GetLastError());
273
274 return S_OK;
275}
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:568
LPVOID WINAPI LockResource(HGLOBAL handle)
Definition: res.c:550
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
Definition: res.c:532
GLuint buffer
Definition: glext.h:5915
#define resource
Definition: kernel32.h:9
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
static HRESULT HRESULT_FROM_WIN32(unsigned int x)
Definition: winerror.h:210

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

◆ lock_surface()

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

Definition at line 156 of file surface.c.

158{
159 unsigned int width, height;
162 DWORD lock_flag;
163 HRESULT hr;
164
165 lock_flag = write ? 0 : D3DLOCK_READONLY;
166 *temp_surface = NULL;
167 if (FAILED(hr = IDirect3DSurface9_LockRect(surface, lock, surface_rect, lock_flag)))
168 {
171
172 if (surface_rect)
173 {
174 width = surface_rect->right - surface_rect->left;
175 height = surface_rect->bottom - surface_rect->top;
176 }
177 else
178 {
179 width = desc.Width;
180 height = desc.Height;
181 }
182
184 desc.Format, D3DPOOL_SYSTEMMEM, temp_surface, NULL)
186 desc.Format, D3DMULTISAMPLE_NONE, 0, TRUE, temp_surface, NULL);
187 if (FAILED(hr))
188 {
189 WARN("Failed to create temporary surface, surface %p, format %#x, "
190 "usage %#lx, pool %#x, write %#x, width %u, height %u.\n",
191 surface, desc.Format, desc.Usage, desc.Pool, write, width, height);
193 return hr;
194 }
195
196 if (write || SUCCEEDED(hr = IDirect3DDevice9_StretchRect(device, surface, surface_rect,
197 *temp_surface, NULL, D3DTEXF_NONE)))
198 hr = IDirect3DSurface9_LockRect(*temp_surface, lock, NULL, lock_flag);
199
201 if (FAILED(hr))
202 {
203 WARN("Failed to lock surface %p, write %#x, usage %#lx, pool %#x.\n",
204 surface, write, desc.Usage, desc.Pool);
205 IDirect3DSurface9_Release(*temp_surface);
206 *temp_surface = NULL;
207 return hr;
208 }
209 TRACE("Created temporary surface %p.\n", surface);
210 }
211 return hr;
212}
#define write
Definition: acwin.h:98
@ D3DTEXF_NONE
Definition: d3d8types.h:870
@ D3DMULTISAMPLE_NONE
Definition: d3d8types.h:672
@ D3DPOOL_SYSTEMMEM
Definition: d3d8types.h:711
#define D3DLOCK_READONLY
Definition: d3d8types.h:69
#define IDirect3DSurface9_GetDevice(p, a)
Definition: d3d9.h:452
#define IDirect3DSurface9_LockRect(p, a, b, c)
Definition: d3d9.h:463
#define IDirect3DDevice9_StretchRect(p, a, b, c, d, e)
Definition: d3d9.h:1369
#define IDirect3DSurface9_GetDesc(p, a)
Definition: d3d9.h:462
#define IDirect3DDevice9_Release(p)
Definition: d3d9.h:1336
#define IDirect3DSurface9_Release(p)
Definition: d3d9.h:450
#define IDirect3DDevice9_CreateRenderTarget(p, a, b, c, d, e, f, g, h)
Definition: d3d9.h:1363
#define IDirect3DDevice9_CreateOffscreenPlainSurface(p, a, b, c, d, e, f)
Definition: d3d9.h:1371
DWORD IDirect3DDevice9
Definition: dxva2api.idl:22
D3D11_SHADER_VARIABLE_DESC desc
Definition: reflection.c:1683
rwlock_t lock
Definition: tcpcore.h:0

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

◆ make_pow2()

static uint32_t make_pow2 ( uint32_t  num)
inlinestatic

◆ map_view_of_file()

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

Definition at line 211 of file util.c.

212{
213 HANDLE hfile, hmapping = NULL;
214
216 if(hfile == INVALID_HANDLE_VALUE) goto error;
217
218 *length = GetFileSize(hfile, NULL);
219 if(*length == INVALID_FILE_SIZE) goto error;
220
221 hmapping = CreateFileMappingW(hfile, NULL, PAGE_READONLY, 0, 0, NULL);
222 if(!hmapping) goto error;
223
224 *buffer = MapViewOfFile(hmapping, FILE_MAP_READ, 0, 0, 0);
225 if(*buffer == NULL) goto error;
226
227 CloseHandle(hmapping);
228 CloseHandle(hfile);
229
230 return S_OK;
231
232error:
233 if (hmapping)
234 CloseHandle(hmapping);
235 if (hfile != INVALID_HANDLE_VALUE)
236 CloseHandle(hfile);
238}
#define CloseHandle
Definition: compat.h:739
#define PAGE_READONLY
Definition: compat.h:138
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
#define FILE_SHARE_READ
Definition: compat.h:136
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
const char * filename
Definition: ioapi.h:137
#define error(str)
Definition: mkdosfs.c:1605
#define INVALID_FILE_SIZE
Definition: winbase.h:528

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

567{
568 return ++*version_counter;
569}

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

2284{
2285 struct argb_conversion_info conv_info, ck_conv_info;
2286 const struct pixel_format_desc *ck_format;
2287 DWORD channels[4];
2288 UINT x, y, z;
2289
2290 TRACE("src %p, src_row_pitch %u, src_slice_pitch %u, src_size %p, src_format %p, dst %p, "
2291 "dst_row_pitch %u, dst_slice_pitch %u, dst_size %p, dst_format %p, color_key 0x%08lx, palette %p.\n",
2292 src, src_row_pitch, src_slice_pitch, src_size, src_format, dst, dst_row_pitch, dst_slice_pitch, dst_size,
2294
2295 ZeroMemory(channels, sizeof(channels));
2296 init_argb_conversion_info(src_format, dst_format, &conv_info);
2297
2298 if (color_key)
2299 {
2300 /* Color keys are always represented in D3DFMT_A8R8G8B8 format. */
2301 ck_format = get_format_info(D3DFMT_A8R8G8B8);
2302 init_argb_conversion_info(src_format, ck_format, &ck_conv_info);
2303 }
2304
2305 for (z = 0; z < dst_size->depth; z++)
2306 {
2307 BYTE *dst_slice_ptr = dst + z * dst_slice_pitch;
2308 const BYTE *src_slice_ptr = src + src_slice_pitch * (z * src_size->depth / dst_size->depth);
2309
2310 for (y = 0; y < dst_size->height; y++)
2311 {
2312 BYTE *dst_ptr = dst_slice_ptr + y * dst_row_pitch;
2313 const BYTE *src_row_ptr = src_slice_ptr + src_row_pitch * (y * src_size->height / dst_size->height);
2314
2315 for (x = 0; x < dst_size->width; x++)
2316 {
2317 const BYTE *src_ptr = src_row_ptr + (x * src_size->width / dst_size->width) * src_format->bytes_per_pixel;
2318
2319 if (format_types_match(src_format, dst_format)
2320 && src_format->bytes_per_pixel <= 4 && dst_format->bytes_per_pixel <= 4)
2321 {
2322 DWORD val;
2323
2324 get_relevant_argb_components(&conv_info, src_ptr, channels);
2325 val = make_argb_color(&conv_info, channels);
2326
2327 if (color_key)
2328 {
2329 DWORD ck_pixel;
2330
2331 get_relevant_argb_components(&ck_conv_info, src_ptr, channels);
2332 ck_pixel = make_argb_color(&ck_conv_info, channels);
2333 if (ck_pixel == color_key)
2334 val &= ~conv_info.destmask[0];
2335 }
2336 memcpy(dst_ptr, &val, dst_format->bytes_per_pixel);
2337 }
2338 else
2339 {
2340 struct d3dx_color color, tmp;
2341
2342 format_to_d3dx_color(src_format, src_ptr, palette, &color);
2343 tmp = color;
2344
2345 if (color_key)
2346 {
2347 DWORD ck_pixel;
2348
2349 format_from_d3dx_color(ck_format, &tmp, (BYTE *)&ck_pixel);
2350 if (ck_pixel == color_key)
2351 tmp.value.w = 0.0f;
2352 }
2353
2354 color = tmp;
2356 }
2357
2358 dst_ptr += dst_format->bytes_per_pixel;
2359 }
2360 }
2361 }
2362}

Referenced by d3dx_load_pixels_from_pixels().

◆ set_d3dx_color()

static void set_d3dx_color ( struct d3dx_color *  color,
const struct vec4 *  value,
enum range  rgb_range,
enum range  a_range 
)
inlinestatic

Definition at line 71 of file d3dx9_private.h.

73{
74 color->value = *value;
75 color->rgb_range = rgb_range;
76 color->a_range = a_range;
77}
Definition: pdh_main.c:64

Referenced by D3DXFillCubeTexture(), D3DXFillTexture(), and D3DXFillVolumeTexture().

◆ set_d3dx_pixels()

static void set_d3dx_pixels ( struct d3dx_pixels *  pixels,
const void *  data,
uint32_t  row_pitch,
uint32_t  slice_pitch,
const PALETTEENTRY *  palette,
uint32_t  width,
uint32_t  height,
uint32_t  depth,
const RECT *  unaligned_rect 
)
inlinestatic

Definition at line 187 of file d3dx9_private.h.

190{
191 pixels->data = data;
192 pixels->row_pitch = row_pitch;
193 pixels->slice_pitch = slice_pitch;
194 pixels->palette = palette;
196 pixels->unaligned_rect = *unaligned_rect;
197}
GLint GLint GLsizei GLsizei GLsizei depth
Definition: gl.h:1546

Referenced by d3dx_image_get_pixels(), d3dx_load_surface_from_memory(), d3dx_load_volume_from_memory(), d3dx_pixels_init(), d3dx_save_pixels_to_memory(), D3DXCreateCubeTextureFromFileInMemoryEx(), D3DXCreateTextureFromFileInMemoryEx(), and D3DXCreateVolumeTextureFromFileInMemoryEx().

◆ set_number()

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

Definition at line 392 of file d3dx9_private.h.

393{
394 if (outtype == intype)
395 {
396 *(DWORD *)outdata = *(DWORD *)indata;
397 return;
398 }
399
400 switch (outtype)
401 {
402 case D3DXPT_FLOAT:
403 *(float *)outdata = get_float(intype, indata);
404 break;
405
406 case D3DXPT_BOOL:
407 *(BOOL *)outdata = get_bool(intype, indata);
408 break;
409
410 case D3DXPT_INT:
411 *(int *)outdata = get_int(intype, indata);
412 break;
413
414 default:
415 *(DWORD *)outdata = 0;
416 break;
417 }
418}
static int get_int(D3DXPARAMETER_TYPE type, const void *data)
static float get_float(D3DXPARAMETER_TYPE type, const void *data)

Referenced by d3dx_effect_GetBool(), d3dx_effect_GetBoolArray(), d3dx_effect_GetFloat(), d3dx_effect_GetFloatArray(), d3dx_effect_GetInt(), d3dx_effect_GetIntArray(), d3dx_effect_SetBool(), d3dx_effect_SetBoolArray(), d3dx_effect_SetFloat(), d3dx_effect_SetFloatArray(), d3dx_effect_SetInt(), d3dx_effect_SetIntArray(), d3dx_evaluate_parameter(), get_matrix(), get_vector(), set(), set_matrix(), set_matrix_transpose(), set_vector(), and test_effect_parameter_value().

◆ set_volume_struct()

static void set_volume_struct ( struct volume *  volume,
uint32_t  width,
uint32_t  height,
uint32_t  depth 
)
inlinestatic

◆ top_level_parameter_from_parameter()

static struct d3dx_top_level_parameter * top_level_parameter_from_parameter ( struct d3dx_parameter *  param)
inlinestatic

Definition at line 561 of file d3dx9_private.h.

562{
564}
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260

Referenced by d3dx_effect_GetParameterDesc(), get_annotation_from_object(), and is_const_tab_input_dirty().

◆ unlock_surface()

HRESULT unlock_surface ( IDirect3DSurface9 *  surface,
const RECT *  surface_rect,
IDirect3DSurface9 *  temp_surface,
BOOL  update 
)

Definition at line 214 of file surface.c.

216{
218 POINT surface_point;
219 HRESULT hr;
220
221 if (!temp_surface)
222 {
224 return hr;
225 }
226
227 hr = IDirect3DSurface9_UnlockRect(temp_surface);
228 if (update)
229 {
230 if (surface_rect)
231 {
232 surface_point.x = surface_rect->left;
233 surface_point.y = surface_rect->top;
234 }
235 else
236 {
237 surface_point.x = 0;
238 surface_point.y = 0;
239 }
241 if (FAILED(hr = IDirect3DDevice9_UpdateSurface(device, temp_surface, NULL, surface, &surface_point)))
242 WARN("Updating surface failed, hr %#lx, surface %p, temp_surface %p.\n",
243 hr, surface, temp_surface);
245 }
246 IDirect3DSurface9_Release(temp_surface);
247 return hr;
248}
#define IDirect3DSurface9_UnlockRect(p)
Definition: d3d9.h:464
#define IDirect3DDevice9_UpdateSurface(p, a, b, c, d)
Definition: d3d9.h:1365
long y
Definition: dcommon.idl:24
long x
Definition: dcommon.idl:24

Referenced by d3dx_load_surface_from_memory(), D3DXFillTexture(), 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 277 of file util.c.

278{
279 HRESULT hr = S_OK;
280 void *buffer_pointer;
282 DWORD bytes_written;
286
287 buffer_pointer = ID3DXBuffer_GetBufferPointer(buffer);
289
290 if (!WriteFile(file, buffer_pointer, buffer_size, &bytes_written, NULL))
292
294 return hr;
295}
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
BOOL WINAPI WriteFile(_In_ HANDLE hFile, _In_reads_bytes_opt_(nNumberOfBytesToWrite) LPCVOID lpBuffer, _In_ DWORD nNumberOfBytesToWrite, _Out_opt_ LPDWORD lpNumberOfBytesWritten, _Inout_opt_ LPOVERLAPPED lpOverlapped)
Definition: rw.c:25
#define ID3DXBuffer_GetBufferSize(p)
Definition: d3dx9core.h:86
#define ID3DXBuffer_GetBufferPointer(p)
Definition: d3dx9core.h:85
#define CREATE_ALWAYS
Definition: disk.h:72
#define GENERIC_WRITE
Definition: nt_native.h:90
wchar_t const *const size_t const buffer_size
Definition: stat.cpp:95
Definition: fci.c:123

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

Variable Documentation

◆ d3dx_include_from_file_vtbl

const struct ID3DXIncludeVtbl d3dx_include_from_file_vtbl
extern

◆ from_file_mutex