ReactOS  0.4.15-dev-449-g64abd9f
d3dcompiler_private.h File Reference
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/rbtree.h"
#include "wine/heap.h"
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "d3dcompiler.h"
#include <assert.h>
Include dependency graph for d3dcompiler_private.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  constant
 
struct  shader_reg
 
struct  instruction
 
struct  declaration
 
struct  samplerdecl
 
struct  bwriter_shader
 
struct  rel_reg
 
struct  src_regs
 
struct  asmparser_backend
 
struct  compilation_messages
 
struct  asm_parser
 
struct  bytecode_buffer
 
struct  bytecode_backend
 
struct  bytecode_backend::instr_handler_table
 
struct  bc_writer
 
struct  hlsl_type
 
struct  hlsl_struct_field
 
struct  source_location
 
struct  hlsl_ir_node
 
struct  reg_reservation
 
struct  hlsl_ir_var
 
struct  hlsl_ir_function
 
struct  hlsl_ir_function_decl
 
struct  hlsl_ir_if
 
struct  hlsl_ir_loop
 
struct  hlsl_ir_assignment
 
struct  hlsl_ir_expr
 
struct  hlsl_ir_jump
 
struct  hlsl_ir_swizzle
 
struct  hlsl_ir_deref
 
struct  hlsl_ir_constant
 
struct  hlsl_ir_constructor
 
struct  hlsl_scope
 
struct  parse_parameter
 
struct  parse_colon_attribute
 
struct  parse_initializer
 
struct  parse_variable_def
 
struct  parse_function
 
struct  parse_if_body
 
struct  hlsl_parse_ctx
 
struct  dxbc_section
 
struct  dxbc
 

Macros

#define COBJMACROS
 
#define D3DERR_INVALIDCALL   0x8876086c
 
#define INSTRARRAY_INITIAL_SIZE   8
 
#define MAX_SRC_REGS   4
 
#define MESSAGEBUFFER_INITIAL_SIZE   256
 
#define PRINTF_ATTR(fmt, args)
 
#define BYTECODEBUFFER_INITIAL_SIZE   32
 
#define SWIZZLE_ERR   ~0U
 
#define BWRITERSP_WRITEMASK_0   0x1 /* .x r */
 
#define BWRITERSP_WRITEMASK_1   0x2 /* .y g */
 
#define BWRITERSP_WRITEMASK_2   0x4 /* .z b */
 
#define BWRITERSP_WRITEMASK_3   0x8 /* .w a */
 
#define BWRITERSP_WRITEMASK_ALL   0xf /* all */
 
#define BWRITERSI_TEXLD_PROJECT   1
 
#define BWRITERSI_TEXLD_BIAS   2
 
#define BWRITER_SM1_VS   0xfffeu
 
#define BWRITER_SM1_PS   0xffffu
 
#define BWRITERPS_VERSION(major, minor)   ((BWRITER_SM1_PS << 16) | ((major) << 8) | (minor))
 
#define BWRITERVS_VERSION(major, minor)   ((BWRITER_SM1_VS << 16) | ((major) << 8) | (minor))
 
#define BWRITERVS_SWIZZLE_SHIFT   16
 
#define BWRITERVS_SWIZZLE_MASK   (0xFF << BWRITERVS_SWIZZLE_SHIFT)
 
#define BWRITERVS_X_X   (0 << BWRITERVS_SWIZZLE_SHIFT)
 
#define BWRITERVS_X_Y   (1 << BWRITERVS_SWIZZLE_SHIFT)
 
#define BWRITERVS_X_Z   (2 << BWRITERVS_SWIZZLE_SHIFT)
 
#define BWRITERVS_X_W   (3 << BWRITERVS_SWIZZLE_SHIFT)
 
#define BWRITERVS_Y_X   (0 << (BWRITERVS_SWIZZLE_SHIFT + 2))
 
#define BWRITERVS_Y_Y   (1 << (BWRITERVS_SWIZZLE_SHIFT + 2))
 
#define BWRITERVS_Y_Z   (2 << (BWRITERVS_SWIZZLE_SHIFT + 2))
 
#define BWRITERVS_Y_W   (3 << (BWRITERVS_SWIZZLE_SHIFT + 2))
 
#define BWRITERVS_Z_X   (0 << (BWRITERVS_SWIZZLE_SHIFT + 4))
 
#define BWRITERVS_Z_Y   (1 << (BWRITERVS_SWIZZLE_SHIFT + 4))
 
#define BWRITERVS_Z_Z   (2 << (BWRITERVS_SWIZZLE_SHIFT + 4))
 
#define BWRITERVS_Z_W   (3 << (BWRITERVS_SWIZZLE_SHIFT + 4))
 
#define BWRITERVS_W_X   (0 << (BWRITERVS_SWIZZLE_SHIFT + 6))
 
#define BWRITERVS_W_Y   (1 << (BWRITERVS_SWIZZLE_SHIFT + 6))
 
#define BWRITERVS_W_Z   (2 << (BWRITERVS_SWIZZLE_SHIFT + 6))
 
#define BWRITERVS_W_W   (3 << (BWRITERVS_SWIZZLE_SHIFT + 6))
 
#define BWRITERVS_NOSWIZZLE   (BWRITERVS_X_X | BWRITERVS_Y_Y | BWRITERVS_Z_Z | BWRITERVS_W_W)
 
#define BWRITERVS_SWIZZLE_X   (BWRITERVS_X_X | BWRITERVS_Y_X | BWRITERVS_Z_X | BWRITERVS_W_X)
 
#define BWRITERVS_SWIZZLE_Y   (BWRITERVS_X_Y | BWRITERVS_Y_Y | BWRITERVS_Z_Y | BWRITERVS_W_Y)
 
#define BWRITERVS_SWIZZLE_Z   (BWRITERVS_X_Z | BWRITERVS_Y_Z | BWRITERVS_Z_Z | BWRITERVS_W_Z)
 
#define BWRITERVS_SWIZZLE_W   (BWRITERVS_X_W | BWRITERVS_Y_W | BWRITERVS_Z_W | BWRITERVS_W_W)
 
#define T0_REG   2
 
#define T1_REG   3
 
#define T2_REG   4
 
#define T3_REG   5
 
#define HLSL_STORAGE_EXTERN   0x00000001
 
#define HLSL_STORAGE_NOINTERPOLATION   0x00000002
 
#define HLSL_MODIFIER_PRECISE   0x00000004
 
#define HLSL_STORAGE_SHARED   0x00000008
 
#define HLSL_STORAGE_GROUPSHARED   0x00000010
 
#define HLSL_STORAGE_STATIC   0x00000020
 
#define HLSL_STORAGE_UNIFORM   0x00000040
 
#define HLSL_STORAGE_VOLATILE   0x00000080
 
#define HLSL_MODIFIER_CONST   0x00000100
 
#define HLSL_MODIFIER_ROW_MAJOR   0x00000200
 
#define HLSL_MODIFIER_COLUMN_MAJOR   0x00000400
 
#define HLSL_MODIFIER_IN   0x00000800
 
#define HLSL_MODIFIER_OUT   0x00001000
 
#define HLSL_TYPE_MODIFIERS_MASK
 
#define HLSL_MODIFIERS_COMPARISON_MASK   (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR)
 
#define MAKE_TAG(ch0, ch1, ch2, ch3)
 
#define TAG_Aon9   MAKE_TAG('A', 'o', 'n', '9')
 
#define TAG_DXBC   MAKE_TAG('D', 'X', 'B', 'C')
 
#define TAG_ISGN   MAKE_TAG('I', 'S', 'G', 'N')
 
#define TAG_OSGN   MAKE_TAG('O', 'S', 'G', 'N')
 
#define TAG_OSG5   MAKE_TAG('O', 'S', 'G', '5')
 
#define TAG_PCSG   MAKE_TAG('P', 'C', 'S', 'G')
 
#define TAG_RDEF   MAKE_TAG('R', 'D', 'E', 'F')
 
#define TAG_SDBG   MAKE_TAG('S', 'D', 'B', 'G')
 
#define TAG_SHDR   MAKE_TAG('S', 'H', 'D', 'R')
 
#define TAG_SHEX   MAKE_TAG('S', 'H', 'E', 'X')
 
#define TAG_STAT   MAKE_TAG('S', 'T', 'A', 'T')
 
#define TAG_XNAP   MAKE_TAG('X', 'N', 'A', 'P')
 
#define TAG_XNAS   MAKE_TAG('X', 'N', 'A', 'S')
 

Typedefs

typedef void(* instr_writer) (struct bc_writer *This, const struct instruction *instr, struct bytecode_buffer *buffer)
 

Enumerations

enum  shader_type { ST_UNKNOWN, ST_VERTEX, ST_PIXEL }
 
enum  bwriter_comparison_type {
  BWRITER_COMPARISON_NONE, BWRITER_COMPARISON_GT, BWRITER_COMPARISON_EQ, BWRITER_COMPARISON_GE,
  BWRITER_COMPARISON_LT, BWRITER_COMPARISON_NE, BWRITER_COMPARISON_LE
}
 
enum  parse_status { PARSE_SUCCESS = 0, PARSE_WARN = 1, PARSE_ERR = 2 }
 
enum  bwritershader_instruction_opcode_type {
  BWRITERSIO_NOP, BWRITERSIO_MOV, BWRITERSIO_ADD, BWRITERSIO_SUB,
  BWRITERSIO_MAD, BWRITERSIO_MUL, BWRITERSIO_RCP, BWRITERSIO_RSQ,
  BWRITERSIO_DP3, BWRITERSIO_DP4, BWRITERSIO_MIN, BWRITERSIO_MAX,
  BWRITERSIO_SLT, BWRITERSIO_SGE, BWRITERSIO_EXP, BWRITERSIO_LOG,
  BWRITERSIO_LIT, BWRITERSIO_DST, BWRITERSIO_LRP, BWRITERSIO_FRC,
  BWRITERSIO_M4x4, BWRITERSIO_M4x3, BWRITERSIO_M3x4, BWRITERSIO_M3x3,
  BWRITERSIO_M3x2, BWRITERSIO_CALL, BWRITERSIO_CALLNZ, BWRITERSIO_LOOP,
  BWRITERSIO_RET, BWRITERSIO_ENDLOOP, BWRITERSIO_LABEL, BWRITERSIO_DCL,
  BWRITERSIO_POW, BWRITERSIO_CRS, BWRITERSIO_SGN, BWRITERSIO_ABS,
  BWRITERSIO_NRM, BWRITERSIO_SINCOS, BWRITERSIO_REP, BWRITERSIO_ENDREP,
  BWRITERSIO_IF, BWRITERSIO_IFC, BWRITERSIO_ELSE, BWRITERSIO_ENDIF,
  BWRITERSIO_BREAK, BWRITERSIO_BREAKC, BWRITERSIO_MOVA, BWRITERSIO_DEFB,
  BWRITERSIO_DEFI, BWRITERSIO_TEXCOORD, BWRITERSIO_TEXKILL, BWRITERSIO_TEX,
  BWRITERSIO_TEXBEM, BWRITERSIO_TEXBEML, BWRITERSIO_TEXREG2AR, BWRITERSIO_TEXREG2GB,
  BWRITERSIO_TEXM3x2PAD, BWRITERSIO_TEXM3x2TEX, BWRITERSIO_TEXM3x3PAD, BWRITERSIO_TEXM3x3TEX,
  BWRITERSIO_TEXM3x3SPEC, BWRITERSIO_TEXM3x3VSPEC, BWRITERSIO_EXPP, BWRITERSIO_LOGP,
  BWRITERSIO_CND, BWRITERSIO_DEF, BWRITERSIO_TEXREG2RGB, BWRITERSIO_TEXDP3TEX,
  BWRITERSIO_TEXM3x2DEPTH, BWRITERSIO_TEXDP3, BWRITERSIO_TEXM3x3, BWRITERSIO_TEXDEPTH,
  BWRITERSIO_CMP, BWRITERSIO_BEM, BWRITERSIO_DP2ADD, BWRITERSIO_DSX,
  BWRITERSIO_DSY, BWRITERSIO_TEXLDD, BWRITERSIO_SETP, BWRITERSIO_TEXLDL,
  BWRITERSIO_BREAKP, BWRITERSIO_TEXLDP, BWRITERSIO_TEXLDB, BWRITERSIO_PHASE,
  BWRITERSIO_COMMENT, BWRITERSIO_END
}
 
enum  bwritershader_param_register_type {
  BWRITERSPR_TEMP, BWRITERSPR_INPUT, BWRITERSPR_CONST, BWRITERSPR_ADDR,
  BWRITERSPR_TEXTURE, BWRITERSPR_RASTOUT, BWRITERSPR_ATTROUT, BWRITERSPR_TEXCRDOUT,
  BWRITERSPR_OUTPUT, BWRITERSPR_CONSTINT, BWRITERSPR_COLOROUT, BWRITERSPR_DEPTHOUT,
  BWRITERSPR_SAMPLER, BWRITERSPR_CONSTBOOL, BWRITERSPR_LOOP, BWRITERSPR_MISCTYPE,
  BWRITERSPR_LABEL, BWRITERSPR_PREDICATE
}
 
enum  bwritervs_rastout_offsets { BWRITERSRO_POSITION, BWRITERSRO_FOG, BWRITERSRO_POINT_SIZE }
 
enum  bwritershader_param_dstmod_type { BWRITERSPDM_NONE = 0, BWRITERSPDM_SATURATE = 1, BWRITERSPDM_PARTIALPRECISION = 2, BWRITERSPDM_MSAMPCENTROID = 4 }
 
enum  bwritersampler_texture_type {
  BWRITERSTT_UNKNOWN = 0, BWRITERSTT_1D = 1, BWRITERSTT_2D = 2, BWRITERSTT_CUBE = 3,
  BWRITERSTT_VOLUME = 4
}
 
enum  bwritershader_param_srcmod_type {
  BWRITERSPSM_NONE = 0, BWRITERSPSM_NEG, BWRITERSPSM_BIAS, BWRITERSPSM_BIASNEG,
  BWRITERSPSM_SIGN, BWRITERSPSM_SIGNNEG, BWRITERSPSM_COMP, BWRITERSPSM_X2,
  BWRITERSPSM_X2NEG, BWRITERSPSM_DZ, BWRITERSPSM_DW, BWRITERSPSM_ABS,
  BWRITERSPSM_ABSNEG, BWRITERSPSM_NOT
}
 
enum  bwriterdeclusage {
  BWRITERDECLUSAGE_POSITION, BWRITERDECLUSAGE_BLENDWEIGHT, BWRITERDECLUSAGE_BLENDINDICES, BWRITERDECLUSAGE_NORMAL,
  BWRITERDECLUSAGE_PSIZE, BWRITERDECLUSAGE_TEXCOORD, BWRITERDECLUSAGE_TANGENT, BWRITERDECLUSAGE_BINORMAL,
  BWRITERDECLUSAGE_TESSFACTOR, BWRITERDECLUSAGE_POSITIONT, BWRITERDECLUSAGE_COLOR, BWRITERDECLUSAGE_FOG,
  BWRITERDECLUSAGE_DEPTH, BWRITERDECLUSAGE_SAMPLE
}
 
enum  hlsl_type_class {
  HLSL_CLASS_SCALAR, HLSL_CLASS_VECTOR, HLSL_CLASS_MATRIX, HLSL_CLASS_LAST_NUMERIC = HLSL_CLASS_MATRIX,
  HLSL_CLASS_STRUCT, HLSL_CLASS_ARRAY, HLSL_CLASS_OBJECT
}
 
enum  hlsl_base_type {
  HLSL_TYPE_FLOAT, HLSL_TYPE_HALF, HLSL_TYPE_DOUBLE, HLSL_TYPE_INT,
  HLSL_TYPE_UINT, HLSL_TYPE_BOOL, HLSL_TYPE_LAST_SCALAR = HLSL_TYPE_BOOL, HLSL_TYPE_SAMPLER,
  HLSL_TYPE_TEXTURE, HLSL_TYPE_PIXELSHADER, HLSL_TYPE_VERTEXSHADER, HLSL_TYPE_STRING,
  HLSL_TYPE_VOID
}
 
enum  hlsl_sampler_dim {
  HLSL_SAMPLER_DIM_GENERIC, HLSL_SAMPLER_DIM_1D, HLSL_SAMPLER_DIM_2D, HLSL_SAMPLER_DIM_3D,
  HLSL_SAMPLER_DIM_CUBE
}
 
enum  hlsl_matrix_majority { HLSL_COLUMN_MAJOR, HLSL_ROW_MAJOR }
 
enum  hlsl_ir_node_type {
  HLSL_IR_ASSIGNMENT = 0, HLSL_IR_CONSTANT, HLSL_IR_CONSTRUCTOR, HLSL_IR_DEREF,
  HLSL_IR_EXPR, HLSL_IR_IF, HLSL_IR_LOOP, HLSL_IR_JUMP,
  HLSL_IR_SWIZZLE
}
 
enum  hlsl_ir_expr_op {
  HLSL_IR_UNOP_BIT_NOT = 0, HLSL_IR_UNOP_LOGIC_NOT, HLSL_IR_UNOP_NEG, HLSL_IR_UNOP_ABS,
  HLSL_IR_UNOP_SIGN, HLSL_IR_UNOP_RCP, HLSL_IR_UNOP_RSQ, HLSL_IR_UNOP_SQRT,
  HLSL_IR_UNOP_NRM, HLSL_IR_UNOP_EXP2, HLSL_IR_UNOP_LOG2, HLSL_IR_UNOP_CAST,
  HLSL_IR_UNOP_FRACT, HLSL_IR_UNOP_SIN, HLSL_IR_UNOP_COS, HLSL_IR_UNOP_SIN_REDUCED,
  HLSL_IR_UNOP_COS_REDUCED, HLSL_IR_UNOP_DSX, HLSL_IR_UNOP_DSY, HLSL_IR_UNOP_SAT,
  HLSL_IR_UNOP_PREINC, HLSL_IR_UNOP_PREDEC, HLSL_IR_UNOP_POSTINC, HLSL_IR_UNOP_POSTDEC,
  HLSL_IR_BINOP_ADD, HLSL_IR_BINOP_SUB, HLSL_IR_BINOP_MUL, HLSL_IR_BINOP_DIV,
  HLSL_IR_BINOP_MOD, HLSL_IR_BINOP_LESS, HLSL_IR_BINOP_GREATER, HLSL_IR_BINOP_LEQUAL,
  HLSL_IR_BINOP_GEQUAL, HLSL_IR_BINOP_EQUAL, HLSL_IR_BINOP_NEQUAL, HLSL_IR_BINOP_LOGIC_AND,
  HLSL_IR_BINOP_LOGIC_OR, HLSL_IR_BINOP_LSHIFT, HLSL_IR_BINOP_RSHIFT, HLSL_IR_BINOP_BIT_AND,
  HLSL_IR_BINOP_BIT_OR, HLSL_IR_BINOP_BIT_XOR, HLSL_IR_BINOP_DOT, HLSL_IR_BINOP_CRS,
  HLSL_IR_BINOP_MIN, HLSL_IR_BINOP_MAX, HLSL_IR_BINOP_POW, HLSL_IR_TEROP_LERP,
  HLSL_IR_SEQUENCE
}
 
enum  hlsl_ir_jump_type { HLSL_IR_JUMP_BREAK, HLSL_IR_JUMP_CONTINUE, HLSL_IR_JUMP_DISCARD, HLSL_IR_JUMP_RETURN }
 
enum  hlsl_ir_deref_type { HLSL_IR_DEREF_VAR, HLSL_IR_DEREF_ARRAY, HLSL_IR_DEREF_RECORD }
 
enum  parse_unary_op { UNARY_OP_PLUS, UNARY_OP_MINUS, UNARY_OP_LOGICNOT, UNARY_OP_BITNOT }
 
enum  parse_assign_op {
  ASSIGN_OP_ASSIGN, ASSIGN_OP_ADD, ASSIGN_OP_SUB, ASSIGN_OP_MUL,
  ASSIGN_OP_DIV, ASSIGN_OP_MOD, ASSIGN_OP_LSHIFT, ASSIGN_OP_RSHIFT,
  ASSIGN_OP_AND, ASSIGN_OP_OR, ASSIGN_OP_XOR
}
 
enum  hlsl_error_level { HLSL_LEVEL_ERROR = 0, HLSL_LEVEL_WARNING, HLSL_LEVEL_NOTE }
 

Functions

const chardebug_d3dcompiler_d3d_blob_part (D3D_BLOB_PART part) DECLSPEC_HIDDEN
 
const chardebug_d3dcompiler_shader_variable_class (D3D_SHADER_VARIABLE_CLASS c) DECLSPEC_HIDDEN
 
const chardebug_d3dcompiler_shader_variable_type (D3D_SHADER_VARIABLE_TYPE t) DECLSPEC_HIDDEN
 
static voidd3dcompiler_alloc (SIZE_T size)
 
static voidd3dcompiler_realloc (void *ptr, SIZE_T size)
 
static BOOL d3dcompiler_free (void *ptr)
 
static chard3dcompiler_strdup (const char *string)
 
struct instructionalloc_instr (unsigned int srcs) DECLSPEC_HIDDEN
 
BOOL add_instruction (struct bwriter_shader *shader, struct instruction *instr) DECLSPEC_HIDDEN
 
BOOL add_constF (struct bwriter_shader *shader, DWORD reg, float x, float y, float z, float w) DECLSPEC_HIDDEN
 
BOOL add_constI (struct bwriter_shader *shader, DWORD reg, INT x, INT y, INT z, INT w) DECLSPEC_HIDDEN
 
BOOL add_constB (struct bwriter_shader *shader, DWORD reg, BOOL x) DECLSPEC_HIDDEN
 
BOOL record_declaration (struct bwriter_shader *shader, DWORD usage, DWORD usage_idx, DWORD mod, BOOL output, DWORD regnum, DWORD writemask, BOOL builtin) DECLSPEC_HIDDEN
 
BOOL record_sampler (struct bwriter_shader *shader, DWORD samptype, DWORD mod, DWORD regnum) DECLSPEC_HIDDEN
 
void create_vs10_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_vs11_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_vs20_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_vs2x_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_vs30_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_ps10_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_ps11_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_ps12_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_ps13_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_ps14_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_ps20_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_ps2x_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
void create_ps30_parser (struct asm_parser *ret) DECLSPEC_HIDDEN
 
struct bwriter_shaderparse_asm_shader (char **messages) DECLSPEC_HIDDEN
 
void compilation_message (struct compilation_messages *msg, const char *fmt, __ms_va_list args) DECLSPEC_HIDDEN
 
void WINAPIV asmparser_message (struct asm_parser *ctx, const char *fmt,...) PRINTF_ATTR(2
 
static void set_parse_status (enum parse_status *current, enum parse_status update)
 
const chardebug_print_srcmod (DWORD mod) DECLSPEC_HIDDEN
 
const chardebug_print_dstmod (DWORD mod) DECLSPEC_HIDDEN
 
const chardebug_print_shift (DWORD shift) DECLSPEC_HIDDEN
 
const chardebug_print_dstreg (const struct shader_reg *reg) DECLSPEC_HIDDEN
 
const chardebug_print_srcreg (const struct shader_reg *reg) DECLSPEC_HIDDEN
 
const chardebug_print_comp (DWORD comp) DECLSPEC_HIDDEN
 
const chardebug_print_opcode (DWORD opcode) DECLSPEC_HIDDEN
 
struct bwriter_shaderSlAssembleShader (const char *text, char **messages) DECLSPEC_HIDDEN
 
HRESULT SlWriteBytecode (const struct bwriter_shader *shader, int dxversion, DWORD **result, DWORD *size) DECLSPEC_HIDDEN
 
void SlDeleteShader (struct bwriter_shader *shader) DECLSPEC_HIDDEN
 
void WINAPIV hlsl_message (const char *fmt,...) PRINTF_ATTR(1
 
void WINAPIV hlsl_report_message (const char *filename, DWORD line, DWORD column, enum hlsl_error_level level, const char *fmt,...) PRINTF_ATTR(5
 
static struct hlsl_ir_exprexpr_from_node (const struct hlsl_ir_node *node)
 
static struct hlsl_ir_derefderef_from_node (const struct hlsl_ir_node *node)
 
static struct hlsl_ir_constantconstant_from_node (const struct hlsl_ir_node *node)
 
static struct hlsl_ir_jumpjump_from_node (const struct hlsl_ir_node *node)
 
static struct hlsl_ir_assignmentassignment_from_node (const struct hlsl_ir_node *node)
 
static struct hlsl_ir_swizzleswizzle_from_node (const struct hlsl_ir_node *node)
 
static struct hlsl_ir_constructorconstructor_from_node (const struct hlsl_ir_node *node)
 
static struct hlsl_ir_ifif_from_node (const struct hlsl_ir_node *node)
 
static struct hlsl_ir_looploop_from_node (const struct hlsl_ir_node *node)
 
BOOL add_declaration (struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var) DECLSPEC_HIDDEN
 
struct hlsl_ir_varget_variable (struct hlsl_scope *scope, const char *name) DECLSPEC_HIDDEN
 
void free_declaration (struct hlsl_ir_var *decl) DECLSPEC_HIDDEN
 
struct hlsl_typenew_hlsl_type (const char *name, enum hlsl_type_class type_class, enum hlsl_base_type base_type, unsigned dimx, unsigned dimy) DECLSPEC_HIDDEN
 
struct hlsl_typenew_array_type (struct hlsl_type *basic_type, unsigned int array_size) DECLSPEC_HIDDEN
 
struct hlsl_typeclone_hlsl_type (struct hlsl_type *old) DECLSPEC_HIDDEN
 
struct hlsl_typeget_type (struct hlsl_scope *scope, const char *name, BOOL recursive) DECLSPEC_HIDDEN
 
BOOL find_function (const char *name) DECLSPEC_HIDDEN
 
unsigned int components_count_type (struct hlsl_type *type) DECLSPEC_HIDDEN
 
BOOL compare_hlsl_types (const struct hlsl_type *t1, const struct hlsl_type *t2) DECLSPEC_HIDDEN
 
BOOL compatible_data_types (struct hlsl_type *s1, struct hlsl_type *s2) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprnew_expr (enum hlsl_ir_expr_op op, struct hlsl_ir_node **operands, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprnew_cast (struct hlsl_ir_node *node, struct hlsl_type *type, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_derefnew_var_deref (struct hlsl_ir_var *var) DECLSPEC_HIDDEN
 
struct hlsl_ir_derefnew_record_deref (struct hlsl_ir_node *record, struct hlsl_struct_field *field) DECLSPEC_HIDDEN
 
struct hlsl_ir_nodemake_assignment (struct hlsl_ir_node *left, enum parse_assign_op assign_op, DWORD writemask, struct hlsl_ir_node *right) DECLSPEC_HIDDEN
 
void push_scope (struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN
 
BOOL pop_scope (struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN
 
struct hlsl_ir_function_declnew_func_decl (struct hlsl_type *return_type, struct list *parameters) DECLSPEC_HIDDEN
 
void init_functions_tree (struct wine_rb_tree *funcs) DECLSPEC_HIDDEN
 
void add_function_decl (struct wine_rb_tree *funcs, char *name, struct hlsl_ir_function_decl *decl, BOOL intrinsic) DECLSPEC_HIDDEN
 
struct bwriter_shaderparse_hlsl_shader (const char *text, enum shader_type type, DWORD major, DWORD minor, const char *entrypoint, char **messages) DECLSPEC_HIDDEN
 
const chardebug_hlsl_type (const struct hlsl_type *type) DECLSPEC_HIDDEN
 
const chardebug_modifiers (DWORD modifiers) DECLSPEC_HIDDEN
 
void debug_dump_ir_function_decl (const struct hlsl_ir_function_decl *func) DECLSPEC_HIDDEN
 
void free_hlsl_type (struct hlsl_type *type) DECLSPEC_HIDDEN
 
void free_instr (struct hlsl_ir_node *node) DECLSPEC_HIDDEN
 
void free_instr_list (struct list *list) DECLSPEC_HIDDEN
 
void free_function_rb (struct wine_rb_entry *entry, void *context) DECLSPEC_HIDDEN
 
static struct hlsl_ir_nodenew_unary_expr (enum hlsl_ir_expr_op op, struct hlsl_ir_node *op1, struct source_location loc)
 
static struct hlsl_ir_nodenew_binary_expr (enum hlsl_ir_expr_op op, struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location loc)
 
HRESULT dxbc_write_blob (struct dxbc *dxbc, ID3DBlob **blob) DECLSPEC_HIDDEN
 
void dxbc_destroy (struct dxbc *dxbc) DECLSPEC_HIDDEN
 
HRESULT dxbc_parse (const char *data, SIZE_T data_size, struct dxbc *dxbc) DECLSPEC_HIDDEN
 
HRESULT dxbc_add_section (struct dxbc *dxbc, DWORD tag, const char *data, DWORD data_size) DECLSPEC_HIDDEN
 
HRESULT dxbc_init (struct dxbc *dxbc, unsigned int size) DECLSPEC_HIDDEN
 
static void read_dword (const char **ptr, DWORD *d)
 
static void write_dword (char **ptr, DWORD d)
 
void skip_dword_unknown (const char **ptr, unsigned int count) DECLSPEC_HIDDEN
 

Variables

struct asm_parser asm_ctx DECLSPEC_HIDDEN
 

Macro Definition Documentation

◆ BWRITER_SM1_PS

#define BWRITER_SM1_PS   0xffffu

Definition at line 537 of file d3dcompiler_private.h.

◆ BWRITER_SM1_VS

#define BWRITER_SM1_VS   0xfffeu

Definition at line 536 of file d3dcompiler_private.h.

◆ BWRITERPS_VERSION

#define BWRITERPS_VERSION (   major,
  minor 
)    ((BWRITER_SM1_PS << 16) | ((major) << 8) | (minor))

Definition at line 539 of file d3dcompiler_private.h.

◆ BWRITERSI_TEXLD_BIAS

#define BWRITERSI_TEXLD_BIAS   2

Definition at line 516 of file d3dcompiler_private.h.

◆ BWRITERSI_TEXLD_PROJECT

#define BWRITERSI_TEXLD_PROJECT   1

Definition at line 515 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_0

#define BWRITERSP_WRITEMASK_0   0x1 /* .x r */

Definition at line 492 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_1

#define BWRITERSP_WRITEMASK_1   0x2 /* .y g */

Definition at line 493 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_2

#define BWRITERSP_WRITEMASK_2   0x4 /* .z b */

Definition at line 494 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_3

#define BWRITERSP_WRITEMASK_3   0x8 /* .w a */

Definition at line 495 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_ALL

#define BWRITERSP_WRITEMASK_ALL   0xf /* all */

Definition at line 496 of file d3dcompiler_private.h.

◆ BWRITERVS_NOSWIZZLE

#define BWRITERVS_NOSWIZZLE   (BWRITERVS_X_X | BWRITERVS_Y_Y | BWRITERVS_Z_Z | BWRITERVS_W_W)

Definition at line 565 of file d3dcompiler_private.h.

◆ BWRITERVS_SWIZZLE_MASK

#define BWRITERVS_SWIZZLE_MASK   (0xFF << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 543 of file d3dcompiler_private.h.

◆ BWRITERVS_SWIZZLE_SHIFT

#define BWRITERVS_SWIZZLE_SHIFT   16

Definition at line 542 of file d3dcompiler_private.h.

◆ BWRITERVS_SWIZZLE_W

#define BWRITERVS_SWIZZLE_W   (BWRITERVS_X_W | BWRITERVS_Y_W | BWRITERVS_Z_W | BWRITERVS_W_W)

Definition at line 570 of file d3dcompiler_private.h.

◆ BWRITERVS_SWIZZLE_X

#define BWRITERVS_SWIZZLE_X   (BWRITERVS_X_X | BWRITERVS_Y_X | BWRITERVS_Z_X | BWRITERVS_W_X)

Definition at line 567 of file d3dcompiler_private.h.

◆ BWRITERVS_SWIZZLE_Y

#define BWRITERVS_SWIZZLE_Y   (BWRITERVS_X_Y | BWRITERVS_Y_Y | BWRITERVS_Z_Y | BWRITERVS_W_Y)

Definition at line 568 of file d3dcompiler_private.h.

◆ BWRITERVS_SWIZZLE_Z

#define BWRITERVS_SWIZZLE_Z   (BWRITERVS_X_Z | BWRITERVS_Y_Z | BWRITERVS_Z_Z | BWRITERVS_W_Z)

Definition at line 569 of file d3dcompiler_private.h.

◆ BWRITERVS_VERSION

#define BWRITERVS_VERSION (   major,
  minor 
)    ((BWRITER_SM1_VS << 16) | ((major) << 8) | (minor))

Definition at line 540 of file d3dcompiler_private.h.

◆ BWRITERVS_W_W

#define BWRITERVS_W_W   (3 << (BWRITERVS_SWIZZLE_SHIFT + 6))

Definition at line 563 of file d3dcompiler_private.h.

◆ BWRITERVS_W_X

#define BWRITERVS_W_X   (0 << (BWRITERVS_SWIZZLE_SHIFT + 6))

Definition at line 560 of file d3dcompiler_private.h.

◆ BWRITERVS_W_Y

#define BWRITERVS_W_Y   (1 << (BWRITERVS_SWIZZLE_SHIFT + 6))

Definition at line 561 of file d3dcompiler_private.h.

◆ BWRITERVS_W_Z

#define BWRITERVS_W_Z   (2 << (BWRITERVS_SWIZZLE_SHIFT + 6))

Definition at line 562 of file d3dcompiler_private.h.

◆ BWRITERVS_X_W

#define BWRITERVS_X_W   (3 << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 548 of file d3dcompiler_private.h.

◆ BWRITERVS_X_X

#define BWRITERVS_X_X   (0 << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 545 of file d3dcompiler_private.h.

◆ BWRITERVS_X_Y

#define BWRITERVS_X_Y   (1 << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 546 of file d3dcompiler_private.h.

◆ BWRITERVS_X_Z

#define BWRITERVS_X_Z   (2 << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 547 of file d3dcompiler_private.h.

◆ BWRITERVS_Y_W

#define BWRITERVS_Y_W   (3 << (BWRITERVS_SWIZZLE_SHIFT + 2))

Definition at line 553 of file d3dcompiler_private.h.

◆ BWRITERVS_Y_X

#define BWRITERVS_Y_X   (0 << (BWRITERVS_SWIZZLE_SHIFT + 2))

Definition at line 550 of file d3dcompiler_private.h.

◆ BWRITERVS_Y_Y

#define BWRITERVS_Y_Y   (1 << (BWRITERVS_SWIZZLE_SHIFT + 2))

Definition at line 551 of file d3dcompiler_private.h.

◆ BWRITERVS_Y_Z

#define BWRITERVS_Y_Z   (2 << (BWRITERVS_SWIZZLE_SHIFT + 2))

Definition at line 552 of file d3dcompiler_private.h.

◆ BWRITERVS_Z_W

#define BWRITERVS_Z_W   (3 << (BWRITERVS_SWIZZLE_SHIFT + 4))

Definition at line 558 of file d3dcompiler_private.h.

◆ BWRITERVS_Z_X

#define BWRITERVS_Z_X   (0 << (BWRITERVS_SWIZZLE_SHIFT + 4))

Definition at line 555 of file d3dcompiler_private.h.

◆ BWRITERVS_Z_Y

#define BWRITERVS_Z_Y   (1 << (BWRITERVS_SWIZZLE_SHIFT + 4))

Definition at line 556 of file d3dcompiler_private.h.

◆ BWRITERVS_Z_Z

#define BWRITERVS_Z_Z   (2 << (BWRITERVS_SWIZZLE_SHIFT + 4))

Definition at line 557 of file d3dcompiler_private.h.

◆ BYTECODEBUFFER_INITIAL_SIZE

#define BYTECODEBUFFER_INITIAL_SIZE   32

Definition at line 299 of file d3dcompiler_private.h.

◆ COBJMACROS

#define COBJMACROS

Definition at line 30 of file d3dcompiler_private.h.

◆ D3DERR_INVALIDCALL

#define D3DERR_INVALIDCALL   0x8876086c

Definition at line 44 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_COLUMN_MAJOR

#define HLSL_MODIFIER_COLUMN_MAJOR   0x00000400

Definition at line 739 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_CONST

#define HLSL_MODIFIER_CONST   0x00000100

Definition at line 737 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_IN

#define HLSL_MODIFIER_IN   0x00000800

Definition at line 740 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_OUT

#define HLSL_MODIFIER_OUT   0x00001000

Definition at line 741 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_PRECISE

#define HLSL_MODIFIER_PRECISE   0x00000004

Definition at line 731 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_ROW_MAJOR

#define HLSL_MODIFIER_ROW_MAJOR   0x00000200

Definition at line 738 of file d3dcompiler_private.h.

◆ HLSL_MODIFIERS_COMPARISON_MASK

#define HLSL_MODIFIERS_COMPARISON_MASK   (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR)

Definition at line 747 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_EXTERN

#define HLSL_STORAGE_EXTERN   0x00000001

Definition at line 729 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_GROUPSHARED

#define HLSL_STORAGE_GROUPSHARED   0x00000010

Definition at line 733 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_NOINTERPOLATION

#define HLSL_STORAGE_NOINTERPOLATION   0x00000002

Definition at line 730 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_SHARED

#define HLSL_STORAGE_SHARED   0x00000008

Definition at line 732 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_STATIC

#define HLSL_STORAGE_STATIC   0x00000020

Definition at line 734 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_UNIFORM

#define HLSL_STORAGE_UNIFORM   0x00000040

Definition at line 735 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_VOLATILE

#define HLSL_STORAGE_VOLATILE   0x00000080

Definition at line 736 of file d3dcompiler_private.h.

◆ HLSL_TYPE_MODIFIERS_MASK

#define HLSL_TYPE_MODIFIERS_MASK
Value:
HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \
HLSL_MODIFIER_COLUMN_MAJOR)
#define HLSL_MODIFIER_PRECISE
#define HLSL_MODIFIER_ROW_MAJOR
#define HLSL_STORAGE_VOLATILE

Definition at line 743 of file d3dcompiler_private.h.

◆ INSTRARRAY_INITIAL_SIZE

#define INSTRARRAY_INITIAL_SIZE   8

Definition at line 118 of file d3dcompiler_private.h.

◆ MAKE_TAG

#define MAKE_TAG (   ch0,
  ch1,
  ch2,
  ch3 
)
Value:
((DWORD)(ch0) | ((DWORD)(ch1) << 8) | \
((DWORD)(ch2) << 16) | ((DWORD)(ch3) << 24 ))
#define DWORD
Definition: nt_native.h:44
unsigned long DWORD
Definition: ntddk_ex.h:95

Definition at line 1175 of file d3dcompiler_private.h.

◆ MAX_SRC_REGS

#define MAX_SRC_REGS   4

Definition at line 190 of file d3dcompiler_private.h.

◆ MESSAGEBUFFER_INITIAL_SIZE

#define MESSAGEBUFFER_INITIAL_SIZE   256

Definition at line 234 of file d3dcompiler_private.h.

◆ PRINTF_ATTR

#define PRINTF_ATTR (   fmt,
  args 
)

Definition at line 285 of file d3dcompiler_private.h.

◆ SWIZZLE_ERR

#define SWIZZLE_ERR   ~0U

Definition at line 367 of file d3dcompiler_private.h.

◆ T0_REG

#define T0_REG   2

Definition at line 591 of file d3dcompiler_private.h.

◆ T1_REG

#define T1_REG   3

Definition at line 592 of file d3dcompiler_private.h.

◆ T2_REG

#define T2_REG   4

Definition at line 593 of file d3dcompiler_private.h.

◆ T3_REG

#define T3_REG   5

Definition at line 594 of file d3dcompiler_private.h.

◆ TAG_Aon9

#define TAG_Aon9   MAKE_TAG('A', 'o', 'n', '9')

Definition at line 1178 of file d3dcompiler_private.h.

◆ TAG_DXBC

#define TAG_DXBC   MAKE_TAG('D', 'X', 'B', 'C')

Definition at line 1179 of file d3dcompiler_private.h.

◆ TAG_ISGN

#define TAG_ISGN   MAKE_TAG('I', 'S', 'G', 'N')

Definition at line 1180 of file d3dcompiler_private.h.

◆ TAG_OSG5

#define TAG_OSG5   MAKE_TAG('O', 'S', 'G', '5')

Definition at line 1182 of file d3dcompiler_private.h.

◆ TAG_OSGN

#define TAG_OSGN   MAKE_TAG('O', 'S', 'G', 'N')

Definition at line 1181 of file d3dcompiler_private.h.

◆ TAG_PCSG

#define TAG_PCSG   MAKE_TAG('P', 'C', 'S', 'G')

Definition at line 1183 of file d3dcompiler_private.h.

◆ TAG_RDEF

#define TAG_RDEF   MAKE_TAG('R', 'D', 'E', 'F')

Definition at line 1184 of file d3dcompiler_private.h.

◆ TAG_SDBG

#define TAG_SDBG   MAKE_TAG('S', 'D', 'B', 'G')

Definition at line 1185 of file d3dcompiler_private.h.

◆ TAG_SHDR

#define TAG_SHDR   MAKE_TAG('S', 'H', 'D', 'R')

Definition at line 1186 of file d3dcompiler_private.h.

◆ TAG_SHEX

#define TAG_SHEX   MAKE_TAG('S', 'H', 'E', 'X')

Definition at line 1187 of file d3dcompiler_private.h.

◆ TAG_STAT

#define TAG_STAT   MAKE_TAG('S', 'T', 'A', 'T')

Definition at line 1188 of file d3dcompiler_private.h.

◆ TAG_XNAP

#define TAG_XNAP   MAKE_TAG('X', 'N', 'A', 'P')

Definition at line 1189 of file d3dcompiler_private.h.

◆ TAG_XNAS

#define TAG_XNAS   MAKE_TAG('X', 'N', 'A', 'S')

Definition at line 1190 of file d3dcompiler_private.h.

Typedef Documentation

◆ instr_writer

Definition at line 312 of file d3dcompiler_private.h.

Enumeration Type Documentation

◆ bwriter_comparison_type

Enumerator
BWRITER_COMPARISON_NONE 
BWRITER_COMPARISON_GT 
BWRITER_COMPARISON_EQ 
BWRITER_COMPARISON_GE 
BWRITER_COMPARISON_LT 
BWRITER_COMPARISON_NE 
BWRITER_COMPARISON_LE 

Definition at line 58 of file d3dcompiler_private.h.

◆ bwriterdeclusage

Enumerator
BWRITERDECLUSAGE_POSITION 
BWRITERDECLUSAGE_BLENDWEIGHT 
BWRITERDECLUSAGE_BLENDINDICES 
BWRITERDECLUSAGE_NORMAL 
BWRITERDECLUSAGE_PSIZE 
BWRITERDECLUSAGE_TEXCOORD 
BWRITERDECLUSAGE_TANGENT 
BWRITERDECLUSAGE_BINORMAL 
BWRITERDECLUSAGE_TESSFACTOR 
BWRITERDECLUSAGE_POSITIONT 
BWRITERDECLUSAGE_COLOR 
BWRITERDECLUSAGE_FOG 
BWRITERDECLUSAGE_DEPTH 
BWRITERDECLUSAGE_SAMPLE 

Definition at line 572 of file d3dcompiler_private.h.

◆ bwritersampler_texture_type

Enumerator
BWRITERSTT_UNKNOWN 
BWRITERSTT_1D 
BWRITERSTT_2D 
BWRITERSTT_CUBE 
BWRITERSTT_VOLUME 

Definition at line 506 of file d3dcompiler_private.h.

◆ bwritershader_instruction_opcode_type

Enumerator
BWRITERSIO_NOP 
BWRITERSIO_MOV 
BWRITERSIO_ADD 
BWRITERSIO_SUB 
BWRITERSIO_MAD 
BWRITERSIO_MUL 
BWRITERSIO_RCP 
BWRITERSIO_RSQ 
BWRITERSIO_DP3 
BWRITERSIO_DP4 
BWRITERSIO_MIN 
BWRITERSIO_MAX 
BWRITERSIO_SLT 
BWRITERSIO_SGE 
BWRITERSIO_EXP 
BWRITERSIO_LOG 
BWRITERSIO_LIT 
BWRITERSIO_DST 
BWRITERSIO_LRP 
BWRITERSIO_FRC 
BWRITERSIO_M4x4 
BWRITERSIO_M4x3 
BWRITERSIO_M3x4 
BWRITERSIO_M3x3 
BWRITERSIO_M3x2 
BWRITERSIO_CALL 
BWRITERSIO_CALLNZ 
BWRITERSIO_LOOP 
BWRITERSIO_RET 
BWRITERSIO_ENDLOOP 
BWRITERSIO_LABEL 
BWRITERSIO_DCL 
BWRITERSIO_POW 
BWRITERSIO_CRS 
BWRITERSIO_SGN 
BWRITERSIO_ABS 
BWRITERSIO_NRM 
BWRITERSIO_SINCOS 
BWRITERSIO_REP 
BWRITERSIO_ENDREP 
BWRITERSIO_IF 
BWRITERSIO_IFC 
BWRITERSIO_ELSE 
BWRITERSIO_ENDIF 
BWRITERSIO_BREAK 
BWRITERSIO_BREAKC 
BWRITERSIO_MOVA 
BWRITERSIO_DEFB 
BWRITERSIO_DEFI 
BWRITERSIO_TEXCOORD 
BWRITERSIO_TEXKILL 
BWRITERSIO_TEX 
BWRITERSIO_TEXBEM 
BWRITERSIO_TEXBEML 
BWRITERSIO_TEXREG2AR 
BWRITERSIO_TEXREG2GB 
BWRITERSIO_TEXM3x2PAD 
BWRITERSIO_TEXM3x2TEX 
BWRITERSIO_TEXM3x3PAD 
BWRITERSIO_TEXM3x3TEX 
BWRITERSIO_TEXM3x3SPEC 
BWRITERSIO_TEXM3x3VSPEC 
BWRITERSIO_EXPP 
BWRITERSIO_LOGP 
BWRITERSIO_CND 
BWRITERSIO_DEF 
BWRITERSIO_TEXREG2RGB 
BWRITERSIO_TEXDP3TEX 
BWRITERSIO_TEXM3x2DEPTH 
BWRITERSIO_TEXDP3 
BWRITERSIO_TEXM3x3 
BWRITERSIO_TEXDEPTH 
BWRITERSIO_CMP 
BWRITERSIO_BEM 
BWRITERSIO_DP2ADD 
BWRITERSIO_DSX 
BWRITERSIO_DSY 
BWRITERSIO_TEXLDD 
BWRITERSIO_SETP 
BWRITERSIO_TEXLDL 
BWRITERSIO_BREAKP 
BWRITERSIO_TEXLDP 
BWRITERSIO_TEXLDB 
BWRITERSIO_PHASE 
BWRITERSIO_COMMENT 
BWRITERSIO_END 

Definition at line 371 of file d3dcompiler_private.h.

372 {
422 
457 
461 };

◆ bwritershader_param_dstmod_type

Enumerator
BWRITERSPDM_NONE 
BWRITERSPDM_SATURATE 
BWRITERSPDM_PARTIALPRECISION 
BWRITERSPDM_MSAMPCENTROID 

Definition at line 498 of file d3dcompiler_private.h.

◆ bwritershader_param_register_type

Enumerator
BWRITERSPR_TEMP 
BWRITERSPR_INPUT 
BWRITERSPR_CONST 
BWRITERSPR_ADDR 
BWRITERSPR_TEXTURE 
BWRITERSPR_RASTOUT 
BWRITERSPR_ATTROUT 
BWRITERSPR_TEXCRDOUT 
BWRITERSPR_OUTPUT 
BWRITERSPR_CONSTINT 
BWRITERSPR_COLOROUT 
BWRITERSPR_DEPTHOUT 
BWRITERSPR_SAMPLER 
BWRITERSPR_CONSTBOOL 
BWRITERSPR_LOOP 
BWRITERSPR_MISCTYPE 
BWRITERSPR_LABEL 
BWRITERSPR_PREDICATE 

Definition at line 463 of file d3dcompiler_private.h.

◆ bwritershader_param_srcmod_type

Enumerator
BWRITERSPSM_NONE 
BWRITERSPSM_NEG 
BWRITERSPSM_BIAS 
BWRITERSPSM_BIASNEG 
BWRITERSPSM_SIGN 
BWRITERSPSM_SIGNNEG 
BWRITERSPSM_COMP 
BWRITERSPSM_X2 
BWRITERSPSM_X2NEG 
BWRITERSPSM_DZ 
BWRITERSPSM_DW 
BWRITERSPSM_ABS 
BWRITERSPSM_ABSNEG 
BWRITERSPSM_NOT 

Definition at line 518 of file d3dcompiler_private.h.

◆ bwritervs_rastout_offsets

Enumerator
BWRITERSRO_POSITION 
BWRITERSRO_FOG 
BWRITERSRO_POINT_SIZE 

Definition at line 485 of file d3dcompiler_private.h.

◆ hlsl_base_type

Enumerator
HLSL_TYPE_FLOAT 
HLSL_TYPE_HALF 
HLSL_TYPE_DOUBLE 
HLSL_TYPE_INT 
HLSL_TYPE_UINT 
HLSL_TYPE_BOOL 
HLSL_TYPE_LAST_SCALAR 
HLSL_TYPE_SAMPLER 
HLSL_TYPE_TEXTURE 
HLSL_TYPE_PIXELSHADER 
HLSL_TYPE_VERTEXSHADER 
HLSL_TYPE_STRING 
HLSL_TYPE_VOID 

Definition at line 637 of file d3dcompiler_private.h.

◆ hlsl_error_level

Enumerator
HLSL_LEVEL_ERROR 
HLSL_LEVEL_WARNING 
HLSL_LEVEL_NOTE 

Definition at line 1058 of file d3dcompiler_private.h.

◆ hlsl_ir_deref_type

Enumerator
HLSL_IR_DEREF_VAR 
HLSL_IR_DEREF_ARRAY 
HLSL_IR_DEREF_RECORD 

Definition at line 907 of file d3dcompiler_private.h.

◆ hlsl_ir_expr_op

Enumerator
HLSL_IR_UNOP_BIT_NOT 
HLSL_IR_UNOP_LOGIC_NOT 
HLSL_IR_UNOP_NEG 
HLSL_IR_UNOP_ABS 
HLSL_IR_UNOP_SIGN 
HLSL_IR_UNOP_RCP 
HLSL_IR_UNOP_RSQ 
HLSL_IR_UNOP_SQRT 
HLSL_IR_UNOP_NRM 
HLSL_IR_UNOP_EXP2 
HLSL_IR_UNOP_LOG2 
HLSL_IR_UNOP_CAST 
HLSL_IR_UNOP_FRACT 
HLSL_IR_UNOP_SIN 
HLSL_IR_UNOP_COS 
HLSL_IR_UNOP_SIN_REDUCED 
HLSL_IR_UNOP_COS_REDUCED 
HLSL_IR_UNOP_DSX 
HLSL_IR_UNOP_DSY 
HLSL_IR_UNOP_SAT 
HLSL_IR_UNOP_PREINC 
HLSL_IR_UNOP_PREDEC 
HLSL_IR_UNOP_POSTINC 
HLSL_IR_UNOP_POSTDEC 
HLSL_IR_BINOP_ADD 
HLSL_IR_BINOP_SUB 
HLSL_IR_BINOP_MUL 
HLSL_IR_BINOP_DIV 
HLSL_IR_BINOP_MOD 
HLSL_IR_BINOP_LESS 
HLSL_IR_BINOP_GREATER 
HLSL_IR_BINOP_LEQUAL 
HLSL_IR_BINOP_GEQUAL 
HLSL_IR_BINOP_EQUAL 
HLSL_IR_BINOP_NEQUAL 
HLSL_IR_BINOP_LOGIC_AND 
HLSL_IR_BINOP_LOGIC_OR 
HLSL_IR_BINOP_LSHIFT 
HLSL_IR_BINOP_RSHIFT 
HLSL_IR_BINOP_BIT_AND 
HLSL_IR_BINOP_BIT_OR 
HLSL_IR_BINOP_BIT_XOR 
HLSL_IR_BINOP_DOT 
HLSL_IR_BINOP_CRS 
HLSL_IR_BINOP_MIN 
HLSL_IR_BINOP_MAX 
HLSL_IR_BINOP_POW 
HLSL_IR_TEROP_LERP 
HLSL_IR_SEQUENCE 

Definition at line 810 of file d3dcompiler_private.h.

810  {
822 
824 
826 
829  HLSL_IR_UNOP_SIN_REDUCED, /* Reduced range [-pi, pi] */
830  HLSL_IR_UNOP_COS_REDUCED, /* Reduced range [-pi, pi] */
831 
834 
836 
841 
846 
848 
855 
858 
864 
869 
871 
873 
875 };

◆ hlsl_ir_jump_type

Enumerator
HLSL_IR_JUMP_BREAK 
HLSL_IR_JUMP_CONTINUE 
HLSL_IR_JUMP_DISCARD 
HLSL_IR_JUMP_RETURN 

Definition at line 885 of file d3dcompiler_private.h.

◆ hlsl_ir_node_type

Enumerator
HLSL_IR_ASSIGNMENT 
HLSL_IR_CONSTANT 
HLSL_IR_CONSTRUCTOR 
HLSL_IR_DEREF 
HLSL_IR_EXPR 
HLSL_IR_IF 
HLSL_IR_LOOP 
HLSL_IR_JUMP 
HLSL_IR_SWIZZLE 

Definition at line 707 of file d3dcompiler_private.h.

◆ hlsl_matrix_majority

Enumerator
HLSL_COLUMN_MAJOR 
HLSL_ROW_MAJOR 

Definition at line 663 of file d3dcompiler_private.h.

◆ hlsl_sampler_dim

Enumerator
HLSL_SAMPLER_DIM_GENERIC 
HLSL_SAMPLER_DIM_1D 
HLSL_SAMPLER_DIM_2D 
HLSL_SAMPLER_DIM_3D 
HLSL_SAMPLER_DIM_CUBE 

Definition at line 654 of file d3dcompiler_private.h.

◆ hlsl_type_class

Enumerator
HLSL_CLASS_SCALAR 
HLSL_CLASS_VECTOR 
HLSL_CLASS_MATRIX 
HLSL_CLASS_LAST_NUMERIC 
HLSL_CLASS_STRUCT 
HLSL_CLASS_ARRAY 
HLSL_CLASS_OBJECT 

Definition at line 626 of file d3dcompiler_private.h.

◆ parse_assign_op

Enumerator
ASSIGN_OP_ASSIGN 
ASSIGN_OP_ADD 
ASSIGN_OP_SUB 
ASSIGN_OP_MUL 
ASSIGN_OP_DIV 
ASSIGN_OP_MOD 
ASSIGN_OP_LSHIFT 
ASSIGN_OP_RSHIFT 
ASSIGN_OP_AND 
ASSIGN_OP_OR 
ASSIGN_OP_XOR 

Definition at line 1021 of file d3dcompiler_private.h.

◆ parse_status

Enumerator
PARSE_SUCCESS 
PARSE_WARN 
PARSE_ERR 

Definition at line 236 of file d3dcompiler_private.h.

◆ parse_unary_op

Enumerator
UNARY_OP_PLUS 
UNARY_OP_MINUS 
UNARY_OP_LOGICNOT 
UNARY_OP_BITNOT 

Definition at line 1013 of file d3dcompiler_private.h.

◆ shader_type

Enumerator
ST_UNKNOWN 
ST_VERTEX 
ST_PIXEL 

Definition at line 51 of file d3dcompiler_private.h.

Function Documentation

◆ add_constB()

BOOL add_constB ( struct bwriter_shader shader,
DWORD  reg,
BOOL  x 
)

Definition at line 178 of file bytecodewriter.c.

178  {
179  struct constant *newconst;
180 
181  if(shader->num_cb) {
182  struct constant **newarray;
183  newarray = d3dcompiler_realloc(shader->constB,
184  sizeof(*shader->constB) * (shader->num_cb + 1));
185  if(!newarray) {
186  ERR("Failed to grow the constants array\n");
187  return FALSE;
188  }
189  shader->constB = newarray;
190  } else {
191  shader->constB = d3dcompiler_alloc(sizeof(*shader->constB));
192  if(!shader->constB) {
193  ERR("Failed to allocate the constants array\n");
194  return FALSE;
195  }
196  }
197 
198  newconst = d3dcompiler_alloc(sizeof(*newconst));
199  if(!newconst) {
200  ERR("Failed to allocate a new constant\n");
201  return FALSE;
202  }
203  newconst->regnum = reg;
204  newconst->value[0].b = x;
205  shader->constB[shader->num_cb] = newconst;
206 
207  shader->num_cb++;
208  return TRUE;
209 }
#define TRUE
Definition: types.h:120
static void * d3dcompiler_realloc(void *ptr, SIZE_T size)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static void * d3dcompiler_alloc(SIZE_T size)
GLuint shader
Definition: glext.h:6030
#define ERR(fmt,...)
Definition: debug.h:110
union constant::@231 value[4]
static int reg
Definition: i386-dis.c:1275

Referenced by asmparser_constB().

◆ add_constF()

BOOL add_constF ( struct bwriter_shader shader,
DWORD  reg,
float  x,
float  y,
float  z,
float  w 
)

Definition at line 106 of file bytecodewriter.c.

106  {
107  struct constant *newconst;
108 
109  if(shader->num_cf) {
110  struct constant **newarray;
111  newarray = d3dcompiler_realloc(shader->constF,
112  sizeof(*shader->constF) * (shader->num_cf + 1));
113  if(!newarray) {
114  ERR("Failed to grow the constants array\n");
115  return FALSE;
116  }
117  shader->constF = newarray;
118  } else {
119  shader->constF = d3dcompiler_alloc(sizeof(*shader->constF));
120  if(!shader->constF) {
121  ERR("Failed to allocate the constants array\n");
122  return FALSE;
123  }
124  }
125 
126  newconst = d3dcompiler_alloc(sizeof(*newconst));
127  if(!newconst) {
128  ERR("Failed to allocate a new constant\n");
129  return FALSE;
130  }
131  newconst->regnum = reg;
132  newconst->value[0].f = x;
133  newconst->value[1].f = y;
134  newconst->value[2].f = z;
135  newconst->value[3].f = w;
136  shader->constF[shader->num_cf] = newconst;
137 
138  shader->num_cf++;
139  return TRUE;
140 }
#define TRUE
Definition: types.h:120
static void * d3dcompiler_realloc(void *ptr, SIZE_T size)
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static void * d3dcompiler_alloc(SIZE_T size)
GLdouble GLdouble z
Definition: glext.h:5874
GLuint shader
Definition: glext.h:6030
#define ERR(fmt,...)
Definition: debug.h:110
union constant::@231 value[4]
static int reg
Definition: i386-dis.c:1275
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by asmparser_constF().

◆ add_constI()

BOOL add_constI ( struct bwriter_shader shader,
DWORD  reg,
INT  x,
INT  y,
INT  z,
INT  w 
)

Definition at line 142 of file bytecodewriter.c.

142  {
143  struct constant *newconst;
144 
145  if(shader->num_ci) {
146  struct constant **newarray;
147  newarray = d3dcompiler_realloc(shader->constI,
148  sizeof(*shader->constI) * (shader->num_ci + 1));
149  if(!newarray) {
150  ERR("Failed to grow the constants array\n");
151  return FALSE;
152  }
153  shader->constI = newarray;
154  } else {
155  shader->constI = d3dcompiler_alloc(sizeof(*shader->constI));
156  if(!shader->constI) {
157  ERR("Failed to allocate the constants array\n");
158  return FALSE;
159  }
160  }
161 
162  newconst = d3dcompiler_alloc(sizeof(*newconst));
163  if(!newconst) {
164  ERR("Failed to allocate a new constant\n");
165  return FALSE;
166  }
167  newconst->regnum = reg;
168  newconst->value[0].i = x;
169  newconst->value[1].i = y;
170  newconst->value[2].i = z;
171  newconst->value[3].i = w;
172  shader->constI[shader->num_ci] = newconst;
173 
174  shader->num_ci++;
175  return TRUE;
176 }
#define TRUE
Definition: types.h:120
static void * d3dcompiler_realloc(void *ptr, SIZE_T size)
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static void * d3dcompiler_alloc(SIZE_T size)
GLdouble GLdouble z
Definition: glext.h:5874
GLuint shader
Definition: glext.h:6030
#define ERR(fmt,...)
Definition: debug.h:110
union constant::@231 value[4]
static int reg
Definition: i386-dis.c:1275
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548

Referenced by asmparser_constI().

◆ add_declaration()

BOOL add_declaration ( struct hlsl_scope scope,
struct hlsl_ir_var decl,
BOOL  local_var 
)

Definition at line 761 of file utils.c.

762 {
763  struct hlsl_ir_var *var;
764 
765  LIST_FOR_EACH_ENTRY(var, &scope->vars, struct hlsl_ir_var, scope_entry)
766  {
767  if (!strcmp(decl->name, var->name))
768  return FALSE;
769  }
770  if (local_var && scope->upper->upper == hlsl_ctx.globals)
771  {
772  /* Check whether the variable redefines a function parameter. */
773  LIST_FOR_EACH_ENTRY(var, &scope->upper->vars, struct hlsl_ir_var, scope_entry)
774  {
775  if (!strcmp(decl->name, var->name))
776  return FALSE;
777  }
778  }
779 
780  list_add_tail(&scope->vars, &decl->scope_entry);
781  return TRUE;
782 }
const char * var
Definition: shader.c:5666
#define TRUE
Definition: types.h:120
struct list vars
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
struct hlsl_scope * upper
struct hlsl_parse_ctx hlsl_ctx
Definition: hlsl.tab.c:90
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
const char * name

Referenced by add_func_parameter(), and declare_variable().

◆ add_function_decl()

void add_function_decl ( struct wine_rb_tree funcs,
char name,
struct hlsl_ir_function_decl decl,
BOOL  intrinsic 
)

Definition at line 2282 of file utils.c.

2283 {
2284  struct hlsl_ir_function *func;
2285  struct wine_rb_entry *func_entry, *old_entry;
2286 
2287  func_entry = wine_rb_get(funcs, name);
2288  if (func_entry)
2289  {
2290  func = WINE_RB_ENTRY_VALUE(func_entry, struct hlsl_ir_function, entry);
2291  if (intrinsic != func->intrinsic)
2292  {
2293  if (intrinsic)
2294  {
2295  ERR("Redeclaring a user defined function as an intrinsic.\n");
2296  return;
2297  }
2298  TRACE("Function %s redeclared as a user defined function.\n", debugstr_a(name));
2299  func->intrinsic = intrinsic;
2302  }
2303  decl->func = func;
2304  if ((old_entry = wine_rb_get(&func->overloads, decl->parameters)))
2305  {
2306  struct hlsl_ir_function_decl *old_decl =
2307  WINE_RB_ENTRY_VALUE(old_entry, struct hlsl_ir_function_decl, entry);
2308 
2309  if (!decl->body)
2310  {
2311  free_function_decl(decl);
2313  return;
2314  }
2315  wine_rb_remove(&func->overloads, old_entry);
2316  free_function_decl(old_decl);
2317  }
2318  wine_rb_put(&func->overloads, decl->parameters, &decl->entry);
2320  return;
2321  }
2322  func = d3dcompiler_alloc(sizeof(*func));
2323  func->name = name;
2325  decl->func = func;
2326  wine_rb_put(&func->overloads, decl->parameters, &decl->entry);
2327  func->intrinsic = intrinsic;
2328  wine_rb_put(funcs, func->name, &func->entry);
2329 }
struct wine_rb_entry entry
GLenum func
Definition: glext.h:6028
static int compare_function_decl_rb(const void *key, const struct wine_rb_entry *entry)
Definition: utils.c:1627
static BOOL d3dcompiler_free(void *ptr)
static void free_function_decl(struct hlsl_ir_function_decl *decl)
Definition: utils.c:2257
static void * d3dcompiler_alloc(SIZE_T size)
smooth NULL
Definition: ftsmooth.c:416
static void wine_rb_init(struct wine_rb_tree *tree, wine_rb_compare_func_t compare)
Definition: rbtree.h:179
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define WINE_RB_ENTRY_VALUE(element, type, field)
Definition: rbtree.h:31
static struct __wine_debug_functions funcs
Definition: debug.c:59
static void wine_rb_destroy(struct wine_rb_tree *tree, wine_rb_traverse_func_t *callback, void *context)
Definition: rbtree.h:198
uint32_t entry
Definition: isohybrid.c:63
static void wine_rb_remove(struct wine_rb_tree *tree, struct wine_rb_entry *entry)
Definition: rbtree.h:283
#define ERR(fmt,...)
Definition: debug.h:110
Definition: rbtree.h:35
static int wine_rb_put(struct wine_rb_tree *tree, const void *key, struct wine_rb_entry *entry)
Definition: rbtree.h:215
Definition: name.c:38
static struct wine_rb_entry * wine_rb_get(const struct wine_rb_tree *tree, const void *key)
Definition: rbtree.h:203
struct hlsl_ir_function * func
static void free_function_decl_rb(struct wine_rb_entry *entry, void *context)
Definition: utils.c:2265
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by yyparse().

◆ add_instruction()

BOOL add_instruction ( struct bwriter_shader shader,
struct instruction instr 
)

Definition at line 75 of file bytecodewriter.c.

75  {
76  struct instruction **new_instructions;
77 
78  if(!shader) return FALSE;
79 
80  if(shader->instr_alloc_size == 0) {
81  shader->instr = d3dcompiler_alloc(sizeof(*shader->instr) * INSTRARRAY_INITIAL_SIZE);
82  if(!shader->instr) {
83  ERR("Failed to allocate the shader instruction array\n");
84  return FALSE;
85  }
86  shader->instr_alloc_size = INSTRARRAY_INITIAL_SIZE;
87  } else if(shader->instr_alloc_size == shader->num_instrs) {
88  new_instructions = d3dcompiler_realloc(shader->instr,
89  sizeof(*shader->instr) * (shader->instr_alloc_size) * 2);
90  if(!new_instructions) {
91  ERR("Failed to grow the shader instruction array\n");
92  return FALSE;
93  }
94  shader->instr = new_instructions;
95  shader->instr_alloc_size = shader->instr_alloc_size * 2;
96  } else if(shader->num_instrs > shader->instr_alloc_size) {
97  ERR("More instructions than allocated. This should not happen\n");
98  return FALSE;
99  }
100 
101  shader->instr[shader->num_instrs] = instr;
102  shader->num_instrs++;
103  return TRUE;
104 }
#define TRUE
Definition: types.h:120
static void * d3dcompiler_realloc(void *ptr, SIZE_T size)
struct x86_inst instr
static void * d3dcompiler_alloc(SIZE_T size)
GLuint shader
Definition: glext.h:6030
#define ERR(fmt,...)
Definition: debug.h:110
#define INSTRARRAY_INITIAL_SIZE

Referenced by asmparser_instr(), asmparser_sincos(), asmparser_texcoord(), asmparser_texcrd(), asmparser_texhelper(), asmparser_texkill(), and asmparser_texld14().

◆ alloc_instr()

struct instruction* alloc_instr ( unsigned int  srcs)

Definition at line 44 of file bytecodewriter.c.

44  {
45  struct instruction *ret = d3dcompiler_alloc(sizeof(*ret));
46  if(!ret) {
47  ERR("Failed to allocate memory for an instruction structure\n");
48  return NULL;
49  }
50 
51  if(srcs) {
52  ret->src = d3dcompiler_alloc(srcs * sizeof(*ret->src));
53  if(!ret->src) {
54  ERR("Failed to allocate memory for instruction registers\n");
56  return NULL;
57  }
58  ret->num_srcs = srcs;
59  }
60  return ret;
61 }
static BOOL d3dcompiler_free(void *ptr)
static void * d3dcompiler_alloc(SIZE_T size)
smooth NULL
Definition: ftsmooth.c:416
int ret
#define ERR(fmt,...)
Definition: debug.h:110

Referenced by asmparser_instr(), asmparser_sincos(), asmparser_texcoord(), asmparser_texcrd(), asmparser_texhelper(), asmparser_texkill(), and asmparser_texld14().

◆ asmparser_message()

void WINAPIV asmparser_message ( struct asm_parser ctx,
const char fmt,
  ... 
)

◆ assignment_from_node()

static struct hlsl_ir_assignment* assignment_from_node ( const struct hlsl_ir_node node)
inlinestatic

Definition at line 1093 of file d3dcompiler_private.h.

1094 {
1095  assert(node->type == HLSL_IR_ASSIGNMENT);
1096  return CONTAINING_RECORD(node, struct hlsl_ir_assignment, node);
1097 }
#define assert(x)
Definition: debug.h:53
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: dlist.c:348

Referenced by debug_dump_instr(), and free_instr().

◆ clone_hlsl_type()

struct hlsl_type* clone_hlsl_type ( struct hlsl_type old)

Definition at line 929 of file utils.c.

930 {
931  struct hlsl_type *type;
932  struct hlsl_struct_field *old_field, *field;
933 
934  type = d3dcompiler_alloc(sizeof(*type));
935  if (!type)
936  {
937  ERR("Out of memory\n");
938  return NULL;
939  }
940  if (old->name)
941  {
942  type->name = d3dcompiler_strdup(old->name);
943  if (!type->name)
944  {
946  return NULL;
947  }
948  }
949  type->type = old->type;
950  type->base_type = old->base_type;
951  type->dimx = old->dimx;
952  type->dimy = old->dimy;
953  type->modifiers = old->modifiers;
954  type->sampler_dim = old->sampler_dim;
955  switch (old->type)
956  {
957  case HLSL_CLASS_ARRAY:
958  type->e.array.type = old->e.array.type;
959  type->e.array.elements_count = old->e.array.elements_count;
960  break;
961  case HLSL_CLASS_STRUCT:
962  type->e.elements = d3dcompiler_alloc(sizeof(*type->e.elements));
963  if (!type->e.elements)
964  {
965  d3dcompiler_free((void *)type->name);
967  return NULL;
968  }
969  list_init(type->e.elements);
970  LIST_FOR_EACH_ENTRY(old_field, old->e.elements, struct hlsl_struct_field, entry)
971  {
972  field = d3dcompiler_alloc(sizeof(*field));
973  if (!field)
974  {
975  LIST_FOR_EACH_ENTRY_SAFE(field, old_field, type->e.elements, struct hlsl_struct_field, entry)
976  {
977  d3dcompiler_free((void *)field->semantic);
978  d3dcompiler_free((void *)field->name);
980  }
981  d3dcompiler_free(type->e.elements);
982  d3dcompiler_free((void *)type->name);
984  return NULL;
985  }
986  field->type = clone_hlsl_type(old_field->type);
987  field->name = d3dcompiler_strdup(old_field->name);
988  if (old_field->semantic)
989  field->semantic = d3dcompiler_strdup(old_field->semantic);
990  field->modifiers = old_field->modifiers;
991  list_add_tail(type->e.elements, &field->entry);
992  }
993  break;
994  default:
995  break;
996  }
997 
998  list_add_tail(&hlsl_ctx.types, &type->entry);
999  return type;
1000 }
unsigned int dimx
enum hlsl_type_class type
enum hlsl_sampler_dim sampler_dim
static BOOL d3dcompiler_free(void *ptr)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
union hlsl_type::@233 e
static void * d3dcompiler_alloc(SIZE_T size)
__WINE_SERVER_LIST_INLINE void list_add_tail(struct list *list, struct list *elem)
Definition: list.h:102
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
smooth NULL
Definition: ftsmooth.c:416
static char * d3dcompiler_strdup(const char *string)
Definition: parser.c:43
struct hlsl_type * type
enum hlsl_base_type base_type
const char * name
struct list * elements
struct hlsl_parse_ctx hlsl_ctx
Definition: hlsl.tab.c:90
uint32_t entry
Definition: isohybrid.c:63
unsigned int modifiers
#define ERR(fmt,...)
Definition: debug.h:110
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct hlsl_type::@233::@234 array
struct hlsl_type * clone_hlsl_type(struct hlsl_type *old)
Definition: utils.c:929
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
unsigned int dimy

Referenced by add_typedef(), and yyparse().

◆ compare_hlsl_types()

BOOL compare_hlsl_types ( const struct hlsl_type t1,
const struct hlsl_type t2 
)

Definition at line 883 of file utils.c.

884 {
885  if (t1 == t2)
886  return TRUE;
887 
888  if (t1->type != t2->type)
889  return FALSE;
890  if (t1->base_type != t2->base_type)
891  return FALSE;
892  if (t1->base_type == HLSL_TYPE_SAMPLER && t1->sampler_dim != t2->sampler_dim)
893  return FALSE;
896  return FALSE;
897  if (t1->dimx != t2->dimx)
898  return FALSE;
899  if (t1->dimy != t2->dimy)
900  return FALSE;
901  if (t1->type == HLSL_CLASS_STRUCT)
902  {
903  struct list *t1cur, *t2cur;
904  struct hlsl_struct_field *t1field, *t2field;
905 
906  t1cur = list_head(t1->e.elements);
907  t2cur = list_head(t2->e.elements);
908  while (t1cur && t2cur)
909  {
910  t1field = LIST_ENTRY(t1cur, struct hlsl_struct_field, entry);
911  t2field = LIST_ENTRY(t2cur, struct hlsl_struct_field, entry);
912  if (!compare_hlsl_types(t1field->type, t2field->type))
913  return FALSE;
914  if (strcmp(t1field->name, t2field->name))
915  return FALSE;
916  t1cur = list_next(t1->e.elements, t1cur);
917  t2cur = list_next(t2->e.elements, t2cur);
918  }
919  if (t1cur != t2cur)
920  return FALSE;
921  }
922  if (t1->type == HLSL_CLASS_ARRAY)
923  return t1->e.array.elements_count == t2->e.array.elements_count
924  && compare_hlsl_types(t1->e.array.type, t2->e.array.type);
925 
926  return TRUE;
927 }
unsigned int dimx
#define TRUE
Definition: types.h:120
enum hlsl_type_class type
enum hlsl_sampler_dim sampler_dim
#define HLSL_MODIFIERS_COMPARISON_MASK
union hlsl_type::@233 e
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
struct hlsl_type * type
BOOL compare_hlsl_types(const struct hlsl_type *t1, const struct hlsl_type *t2)
Definition: utils.c:883
enum hlsl_base_type base_type
struct list * elements
uint32_t entry
Definition: isohybrid.c:63
Definition: _list.h:228
unsigned int modifiers
struct hlsl_type::@233::@234 array
__WINE_SERVER_LIST_INLINE struct list * list_next(const struct list *list, const struct list *elem)
Definition: list.h:115
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
#define LIST_ENTRY(type)
Definition: queue.h:175
unsigned int dimy

Referenced by compatible_data_types(), expr_common_type(), implicit_compatible_data_types(), implicit_conversion(), make_assignment(), new_expr(), and yyparse().

◆ compatible_data_types()

BOOL compatible_data_types ( struct hlsl_type s1,
struct hlsl_type s2 
)

Definition at line 1007 of file utils.c.

1008 {
1010  return FALSE;
1011 
1012  if (t1->type <= HLSL_CLASS_LAST_NUMERIC)
1013  {
1014  /* Scalar vars can be cast to pretty much everything */
1015  if (t1->dimx == 1 && t1->dimy == 1)
1016  return TRUE;
1017 
1018  if (t1->type == HLSL_CLASS_VECTOR && t2->type == HLSL_CLASS_VECTOR)
1019  return t1->dimx >= t2->dimx;
1020  }
1021 
1022  /* The other way around is true too i.e. whatever to scalar */
1023  if (t2->type <= HLSL_CLASS_LAST_NUMERIC && t2->dimx == 1 && t2->dimy == 1)
1024  return TRUE;
1025 
1026  if (t1->type == HLSL_CLASS_ARRAY)
1027  {
1028  if (compare_hlsl_types(t1->e.array.type, t2))
1029  /* e.g. float4[3] to float4 is allowed */
1030  return TRUE;
1031 
1032  if (t2->type == HLSL_CLASS_ARRAY || t2->type == HLSL_CLASS_STRUCT)
1033  return components_count_type(t1) >= components_count_type(t2);
1034  else
1035  return components_count_type(t1) == components_count_type(t2);
1036  }
1037 
1038  if (t1->type == HLSL_CLASS_STRUCT)
1039  return components_count_type(t1) >= components_count_type(t2);
1040 
1041  if (t2->type == HLSL_CLASS_ARRAY || t2->type == HLSL_CLASS_STRUCT)
1042  return components_count_type(t1) == components_count_type(t2);
1043 
1044  if (t1->type == HLSL_CLASS_MATRIX || t2->type == HLSL_CLASS_MATRIX)
1045  {
1046  if (t1->type == HLSL_CLASS_MATRIX && t2->type == HLSL_CLASS_MATRIX && t1->dimx >= t2->dimx && t1->dimy >= t2->dimy)
1047  return TRUE;
1048 
1049  /* Matrix-vector conversion is apparently allowed if they have the same components count */
1050  if ((t1->type == HLSL_CLASS_VECTOR || t2->type == HLSL_CLASS_VECTOR)
1052  return TRUE;
1053  return FALSE;
1054  }
1055 
1057  return TRUE;
1058  return FALSE;
1059 }
#define TRUE
Definition: types.h:120
unsigned int components_count_type(struct hlsl_type *type)
Definition: utils.c:857
static BOOL convertible_data_type(struct hlsl_type *type)
Definition: utils.c:1002
BOOL compare_hlsl_types(const struct hlsl_type *t1, const struct hlsl_type *t2)
Definition: utils.c:883

Referenced by yyparse().

◆ compilation_message()

void compilation_message ( struct compilation_messages msg,
const char fmt,
__ms_va_list  args 
)

Definition at line 719 of file utils.c.

720 {
721  char* buffer;
722  int rc, size;
723 
724  if (msg->capacity == 0)
725  {
727  if (msg->string == NULL)
728  {
729  ERR("Error allocating memory for parser messages\n");
730  return;
731  }
732  msg->capacity = MESSAGEBUFFER_INITIAL_SIZE;
733  }
734 
735  while (1)
736  {
737  rc = vsnprintf(msg->string + msg->size,
738  msg->capacity - msg->size, fmt, args);
739 
740  if (rc < 0 || rc >= msg->capacity - msg->size)
741  {
742  size = msg->capacity * 2;
743  buffer = d3dcompiler_realloc(msg->string, size);
744  if (buffer == NULL)
745  {
746  ERR("Error reallocating memory for parser messages\n");
747  return;
748  }
749  msg->string = buffer;
750  msg->capacity = size;
751  }
752  else
753  {
754  TRACE("%s", msg->string + msg->size);
755  msg->size += rc;
756  return;
757  }
758  }
759 }
#define vsnprintf
Definition: tif_win32.c:406
static void * d3dcompiler_realloc(void *ptr, SIZE_T size)
GLuint buffer
Definition: glext.h:5915
Definition: match.c:390
static void * d3dcompiler_alloc(SIZE_T size)
#define MESSAGEBUFFER_INITIAL_SIZE
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define ERR(fmt,...)
Definition: debug.h:110
#define msg(x)
Definition: auth_time.c:54
Definition: dsound.c:943

Referenced by asmparser_message(), and hlsl_message().

◆ components_count_type()

unsigned int components_count_type ( struct hlsl_type type)

Definition at line 857 of file utils.c.

858 {
859  unsigned int count = 0;
860  struct hlsl_struct_field *field;
861 
862  if (type->type <= HLSL_CLASS_LAST_NUMERIC)
863  {
864  return type->dimx * type->dimy;
865  }
866  if (type->type == HLSL_CLASS_ARRAY)
867  {
868  return components_count_type(type->e.array.type) * type->e.array.elements_count;
869  }
870  if (type->type != HLSL_CLASS_STRUCT)
871  {
872  ERR("Unexpected data type %s.\n", debug_hlsl_type(type));
873  return 0;
874  }
875 
876  LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry)
877  {
879  }
880  return count;
881 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
const char * debug_hlsl_type(const struct hlsl_type *type)
Definition: utils.c:1695
unsigned int components_count_type(struct hlsl_type *type)
Definition: utils.c:857
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
Definition: parser.c:43
uint32_t entry
Definition: isohybrid.c:63
#define ERR(fmt,...)
Definition: debug.h:110

Referenced by compatible_data_types(), declare_vars(), expr_compatible_data_types(), implicit_compatible_data_types(), initializer_size(), and struct_var_initializer().

◆ constant_from_node()

static struct hlsl_ir_constant* constant_from_node ( const struct hlsl_ir_node node)
inlinestatic

Definition at line 1081 of file d3dcompiler_private.h.

1082 {
1083  assert(node->type == HLSL_IR_CONSTANT);
1084  return CONTAINING_RECORD(node, struct hlsl_ir_constant, node);
1085 }
#define assert(x)
Definition: debug.h:53
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: dlist.c:348

Referenced by debug_dump_instr(), and free_instr().

◆ constructor_from_node()

static struct hlsl_ir_constructor* constructor_from_node ( const struct hlsl_ir_node node)
inlinestatic

Definition at line 1105 of file d3dcompiler_private.h.

1106 {
1107  assert(node->type == HLSL_IR_CONSTRUCTOR);
1109 }
#define assert(x)
Definition: debug.h:53
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
Definition: dlist.c:348

Referenced by debug_dump_instr(), and free_instr().

◆ create_ps10_parser()

void create_ps10_parser ( struct asm_parser ret)

Definition at line 1426 of file asmparser.c.

1426  {
1427  TRACE_(parsed_shader)("ps_1_0\n");
1428 
1429  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1430  if(!ret->shader) {
1431  ERR("Failed to allocate memory for the shader\n");
1432  set_parse_status(&ret->status, PARSE_ERR);
1433  return;
1434  }
1435 
1436  ret->shader->type = ST_PIXEL;
1437  ret->shader->version = BWRITERPS_VERSION(1, 0);
1438  ret->funcs = &parser_ps_1_0123;
1439  gen_oldps_input(ret->shader, 4);
1440 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1325
static const struct asmparser_backend parser_ps_1_0123
Definition: asmparser.c:1209
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps11_parser()

void create_ps11_parser ( struct asm_parser ret)

Definition at line 1442 of file asmparser.c.

1442  {
1443  TRACE_(parsed_shader)("ps_1_1\n");
1444 
1445  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1446  if(!ret->shader) {
1447  ERR("Failed to allocate memory for the shader\n");
1448  set_parse_status(&ret->status, PARSE_ERR);
1449  return;
1450  }
1451 
1452  ret->shader->type = ST_PIXEL;
1453  ret->shader->version = BWRITERPS_VERSION(1, 1);
1454  ret->funcs = &parser_ps_1_0123;
1455  gen_oldps_input(ret->shader, 4);
1456 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1325
static const struct asmparser_backend parser_ps_1_0123
Definition: asmparser.c:1209
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps12_parser()

void create_ps12_parser ( struct asm_parser ret)

Definition at line 1458 of file asmparser.c.

1458  {
1459  TRACE_(parsed_shader)("ps_1_2\n");
1460 
1461  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1462  if(!ret->shader) {
1463  ERR("Failed to allocate memory for the shader\n");
1464  set_parse_status(&ret->status, PARSE_ERR);
1465  return;
1466  }
1467 
1468  ret->shader->type = ST_PIXEL;
1469  ret->shader->version = BWRITERPS_VERSION(1, 2);
1470  ret->funcs = &parser_ps_1_0123;
1471  gen_oldps_input(ret->shader, 4);
1472 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1325
static const struct asmparser_backend parser_ps_1_0123
Definition: asmparser.c:1209
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps13_parser()

void create_ps13_parser ( struct asm_parser ret)

Definition at line 1474 of file asmparser.c.

1474  {
1475  TRACE_(parsed_shader)("ps_1_3\n");
1476 
1477  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1478  if(!ret->shader) {
1479  ERR("Failed to allocate memory for the shader\n");
1480  set_parse_status(&ret->status, PARSE_ERR);
1481  return;
1482  }
1483 
1484  ret->shader->type = ST_PIXEL;
1485  ret->shader->version = BWRITERPS_VERSION(1, 3);
1486  ret->funcs = &parser_ps_1_0123;
1487  gen_oldps_input(ret->shader, 4);
1488 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1325
static const struct asmparser_backend parser_ps_1_0123
Definition: asmparser.c:1209
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps14_parser()

void create_ps14_parser ( struct asm_parser ret)

Definition at line 1490 of file asmparser.c.

1490  {
1491  TRACE_(parsed_shader)("ps_1_4\n");
1492 
1493  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1494  if(!ret->shader) {
1495  ERR("Failed to allocate memory for the shader\n");
1496  set_parse_status(&ret->status, PARSE_ERR);
1497  return;
1498  }
1499 
1500  ret->shader->type = ST_PIXEL;
1501  ret->shader->version = BWRITERPS_VERSION(1, 4);
1502  ret->funcs = &parser_ps_1_4;
1503  gen_oldps_input(ret->shader, 6);
1504 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1325
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
static const struct asmparser_backend parser_ps_1_4
Definition: asmparser.c:1229
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps20_parser()

void create_ps20_parser ( struct asm_parser ret)

Definition at line 1506 of file asmparser.c.

1506  {
1507  TRACE_(parsed_shader)("ps_2_0\n");
1508 
1509  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1510  if(!ret->shader) {
1511  ERR("Failed to allocate memory for the shader\n");
1512  set_parse_status(&ret->status, PARSE_ERR);
1513  return;
1514  }
1515 
1516  ret->shader->type = ST_PIXEL;
1517  ret->shader->version = BWRITERPS_VERSION(2, 0);
1518  ret->funcs = &parser_ps_2;
1519  gen_oldps_input(ret->shader, 8);
1520 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1325
static void * d3dcompiler_alloc(SIZE_T size)
static const struct asmparser_backend parser_ps_2
Definition: asmparser.c:1249
#define TRACE_(x)
Definition: compat.h:66
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps2x_parser()

void create_ps2x_parser ( struct asm_parser ret)

Definition at line 1522 of file asmparser.c.

1522  {
1523  TRACE_(parsed_shader)("ps_2_x\n");
1524 
1525  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1526  if(!ret->shader) {
1527  ERR("Failed to allocate memory for the shader\n");
1528  set_parse_status(&ret->status, PARSE_ERR);
1529  return;
1530  }
1531 
1532  ret->shader->type = ST_PIXEL;
1533  ret->shader->version = BWRITERPS_VERSION(2, 1);
1534  ret->funcs = &parser_ps_2_x;
1535  gen_oldps_input(ret->shader, 8);
1536 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1325
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
static const struct asmparser_backend parser_ps_2_x
Definition: asmparser.c:1269
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps30_parser()

void create_ps30_parser ( struct asm_parser ret)

Definition at line 1538 of file asmparser.c.

1538  {
1539  TRACE_(parsed_shader)("ps_3_0\n");
1540 
1541  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1542  if(!ret->shader) {
1543  ERR("Failed to allocate memory for the shader\n");
1544  set_parse_status(&ret->status, PARSE_ERR);
1545  return;
1546  }
1547 
1548  ret->shader->type = ST_PIXEL;
1549  ret->shader->version = BWRITERPS_VERSION(3, 0);
1550  ret->funcs = &parser_ps_3;
1551 }
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
static const struct asmparser_backend parser_ps_3
Definition: asmparser.c:1289
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_vs10_parser()

void create_vs10_parser ( struct asm_parser ret)

Definition at line 1347 of file asmparser.c.

1347  {
1348  TRACE_(parsed_shader)("vs_1_0\n");
1349 
1350  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1351  if(!ret->shader) {
1352  ERR("Failed to allocate memory for the shader\n");
1353  set_parse_status(&ret->status, PARSE_ERR);
1354  return;
1355  }
1356 
1357  ret->shader->type = ST_VERTEX;
1358  ret->shader->version = BWRITERVS_VERSION(1, 0);
1359  ret->funcs = &parser_vs_1;
1360  gen_oldvs_output(ret->shader);
1361 }
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
static void gen_oldvs_output(struct bwriter_shader *shader)
Definition: asmparser.c:1309
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERVS_VERSION(major, minor)
static const struct asmparser_backend parser_vs_1
Definition: asmparser.c:1149

Referenced by yyparse().

◆ create_vs11_parser()

void create_vs11_parser ( struct asm_parser ret)

Definition at line 1363 of file asmparser.c.

1363  {
1364  TRACE_(parsed_shader)("vs_1_1\n");
1365 
1366  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1367  if(!ret->shader) {
1368  ERR("Failed to allocate memory for the shader\n");
1369  set_parse_status(&ret->status, PARSE_ERR);
1370  return;
1371  }
1372 
1373  ret->shader->type = ST_VERTEX;
1374  ret->shader->version = BWRITERVS_VERSION(1, 1);
1375  ret->funcs = &parser_vs_1;
1376  gen_oldvs_output(ret->shader);
1377 }
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
static void gen_oldvs_output(struct bwriter_shader *shader)
Definition: asmparser.c:1309
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERVS_VERSION(major, minor)
static const struct asmparser_backend parser_vs_1
Definition: asmparser.c:1149

Referenced by yyparse().

◆ create_vs20_parser()

void create_vs20_parser ( struct asm_parser ret)

Definition at line 1379 of file asmparser.c.

1379  {
1380  TRACE_(parsed_shader)("vs_2_0\n");
1381 
1382  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1383  if(!ret->shader) {
1384  ERR("Failed to allocate memory for the shader\n");
1385  set_parse_status(&ret->status, PARSE_ERR);
1386  return;
1387  }
1388 
1389  ret->shader->type = ST_VERTEX;
1390  ret->shader->version = BWRITERVS_VERSION(2, 0);
1391  ret->funcs = &parser_vs_2;
1392  gen_oldvs_output(ret->shader);
1393 }
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
static const struct asmparser_backend parser_vs_2
Definition: asmparser.c:1169
static void gen_oldvs_output(struct bwriter_shader *shader)
Definition: asmparser.c:1309
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERVS_VERSION(major, minor)

Referenced by yyparse().

◆ create_vs2x_parser()

void create_vs2x_parser ( struct asm_parser ret)

Definition at line 1395 of file asmparser.c.

1395  {
1396  TRACE_(parsed_shader)("vs_2_x\n");
1397 
1398  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1399  if(!ret->shader) {
1400  ERR("Failed to allocate memory for the shader\n");
1401  set_parse_status(&ret->status, PARSE_ERR);
1402  return;
1403  }
1404 
1405  ret->shader->type = ST_VERTEX;
1406  ret->shader->version = BWRITERVS_VERSION(2, 1);
1407  ret->funcs = &parser_vs_2;
1408  gen_oldvs_output(ret->shader);
1409 }
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
static const struct asmparser_backend parser_vs_2
Definition: asmparser.c:1169
static void gen_oldvs_output(struct bwriter_shader *shader)
Definition: asmparser.c:1309
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
#define BWRITERVS_VERSION(major, minor)

Referenced by yyparse().

◆ create_vs30_parser()

void create_vs30_parser ( struct asm_parser ret)

Definition at line 1411 of file asmparser.c.

1411  {
1412  TRACE_(parsed_shader)("vs_3_0\n");
1413 
1414  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1415  if(!ret->shader) {
1416  ERR("Failed to allocate memory for the shader\n");
1417  set_parse_status(&ret->status, PARSE_ERR);
1418  return;
1419  }
1420 
1421  ret->shader->type = ST_VERTEX;
1422  ret->shader->version = BWRITERVS_VERSION(3, 0);
1423  ret->funcs = &parser_vs_3;
1424 }
static void * d3dcompiler_alloc(SIZE_T size)
#define TRACE_(x)
Definition: compat.h:66
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:110
static const struct asmparser_backend parser_vs_3
Definition: asmparser.c:1189
#define BWRITERVS_VERSION(major, minor)

Referenced by yyparse().

◆ d3dcompiler_alloc()

◆ d3dcompiler_free()

◆ d3dcompiler_realloc()

static void* d3dcompiler_realloc ( void ptr,
SIZE_T  size 
)
inlinestatic

Definition at line 152 of file d3dcompiler_private.h.

153 {
154  return HeapReAlloc(GetProcessHeap(), 0, ptr, size);
155 }
static PVOID ptr
Definition: dispmode.c:27
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:404
#define HeapReAlloc
Definition: compat.h:402

Referenced by add_constB(), add_constF(), add_constI(), add_instruction(), compilation_message(), hlsl_report_message(), parse_asm_shader(), put_dword(), record_declaration(), record_sampler(), and yyparse().

◆ d3dcompiler_strdup()

static char* d3dcompiler_strdup ( const char string)
inlinestatic

Definition at line 162 of file d3dcompiler_private.h.

163 {
164  char *copy;
165  SIZE_T len;
166 
167  if (!string)
168  return NULL;
169 
170  len = strlen(string);
171  copy = d3dcompiler_alloc(len + 1);
172  if (copy)
173  memcpy(copy, string, len + 1);
174  return copy;
175 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void * d3dcompiler_alloc(SIZE_T size)
smooth NULL
Definition: ftsmooth.c:416
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
ULONG_PTR SIZE_T
Definition: typedefs.h:79
INT copy(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], INT append, DWORD lpdwFlags, BOOL bTouch)
Definition: copy.c:51

Referenced by clone_hlsl_type(), declare_predefined_types(), parse_hlsl(), and yyparse().

◆ debug_d3dcompiler_d3d_blob_part()

const char* debug_d3dcompiler_d3d_blob_part ( D3D_BLOB_PART  part)

Definition at line 106 of file utils.c.

107 {
108  switch(part)
109  {
122  default:
123  FIXME("Unrecognized D3D_BLOB_PART %#x\n", part);
124  return "unrecognized";
125  }
126 }
#define WINE_D3DCOMPILER_TO_STR(x)
Definition: utils.c:30
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by check_blob_part(), d3dcompiler_get_blob_part(), and D3DGetBlobPart().

◆ debug_d3dcompiler_shader_variable_class()

const char* debug_d3dcompiler_shader_variable_class ( D3D_SHADER_VARIABLE_CLASS  c)

Definition at line 32 of file utils.c.

Referenced by d3dcompiler_parse_type().

◆ debug_d3dcompiler_shader_variable_type()

const char* debug_d3dcompiler_shader_variable_type ( D3D_SHADER_VARIABLE_TYPE  t)

Definition at line 50 of file utils.c.

51 {
52  switch (t)
53  {
100  default:
101  FIXME("Unrecognized D3D_SHADER_VARIABLE_TYPE %#x.\n", t);
102  return "unrecognized";
103  }
104 }
GLdouble GLdouble t
Definition: gl.h:2047
#define WINE_D3DCOMPILER_TO_STR(x)
Definition: utils.c:30
#define FIXME(fmt,...)
Definition: debug.h:111

Referenced by d3dcompiler_parse_type().

◆ debug_dump_ir_function_decl()

void debug_dump_ir_function_decl ( const struct hlsl_ir_function_decl func)

Definition at line 2086 of file utils.c.

2087 {
2088  struct hlsl_ir_var *param;
2089 
2090  TRACE("Dumping function %s.\n", debugstr_a(func->func->name));
2091  TRACE("Function parameters:\n");
2092  LIST_FOR_EACH_ENTRY(param, func->parameters, struct hlsl_ir_var, param_entry)
2093  {
2095  TRACE("\n");
2096  }
2097  if (func->semantic)
2098  TRACE("Function semantic: %s\n", debugstr_a(func->semantic));
2099  if (func->body)
2100  {
2101  debug_dump_instr_list(func->body);
2102  }
2103 }
GLenum func
Definition: glext.h:6028
struct list scope_entry param_entry
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
static void debug_dump_instr_list(const struct list *list)
Definition: utils.c:1780
static void debug_dump_ir_var(const struct hlsl_ir_var *var)
Definition: utils.c:1791
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
GLfloat param
Definition: glext.h:5796

Referenced by dump_function_decl().

◆ debug_hlsl_type()

const char* debug_hlsl_type ( const struct hlsl_type type)

Definition at line 1695 of file utils.c.

1696 {
1697  const char *name;
1698 
1699  if (type->name)
1700  return debugstr_a(type->name);
1701 
1702  if (type->type == HLSL_CLASS_STRUCT)
1703  return "<anonymous struct>";
1704 
1705  if (type->type == HLSL_CLASS_ARRAY)
1706  {
1707  name = debug_base_type(type->e.array.type);
1708  return wine_dbg_sprintf("%s[%u]", name, type->e.array.elements_count);
1709  }
1710 
1712 
1713  if (type->type == HLSL_CLASS_SCALAR)
1714  return wine_dbg_sprintf("%s", name);
1715  if (type->type == HLSL_CLASS_VECTOR)
1716  return wine_dbg_sprintf("%s%u", name, type->dimx);
1717  if (type->type == HLSL_CLASS_MATRIX)
1718  return wine_dbg_sprintf("%s%ux%u", name, type->dimx, type->dimy);
1719  return "unexpected_type";
1720 }
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
static const char * debug_base_type(const struct hlsl_type *type)
Definition: utils.c:1667
#define debugstr_a
Definition: kernel32.h:31
Definition: name.c:38
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by components_count_type(), debug_dump_decl(), debug_dump_ir_constructor(), debug_dump_ir_var(), debug_expr_op(), implicit_conversion(), make_assignment(), new_expr(), and yyparse().

◆ debug_modifiers()

const char* debug_modifiers ( DWORD  modifiers)

Definition at line 1722 of file utils.c.

1723 {
1724  char string[110];
1725 
1726  string[0] = 0;
1728  strcat(string, " extern"); /* 7 */
1730  strcat(string, " nointerpolation"); /* 16 */
1732  strcat(string, " precise"); /* 8 */
1734  strcat(string, " shared"); /* 7 */
1736  strcat(string, " groupshared"); /* 12 */
1738  strcat(string, " static"); /* 7 */
1740  strcat(string, " uniform"); /* 8 */
1742  strcat(string, " volatile"); /* 9 */
1744  strcat(string, " const"); /* 6 */
1746  strcat(string, " row_major"); /* 10 */
1748  strcat(string, " column_major"); /* 13 */
1750  strcat(string, " inout"); /* 6 */
1751  else if (modifiers & HLSL_MODIFIER_IN)
1752  strcat(string, " in"); /* 3 */
1753  else if (modifiers & HLSL_MODIFIER_OUT)
1754  strcat(string, " out"); /* 4 */
1755 
1756  return wine_dbg_sprintf("%s", string[0] ? string + 1 : "");
1757 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
#define HLSL_MODIFIER_CONST
#define HLSL_MODIFIER_PRECISE
#define HLSL_MODIFIER_OUT
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
#define HLSL_STORAGE_STATIC
#define HLSL_STORAGE_GROUPSHARED
#define HLSL_MODIFIER_ROW_MAJOR
#define HLSL_STORAGE_SHARED
#define HLSL_STORAGE_EXTERN
#define HLSL_MODIFIER_IN
#define HLSL_STORAGE_UNIFORM
#define HLSL_STORAGE_NOINTERPOLATION
#define HLSL_STORAGE_VOLATILE
unsigned int modifiers
#define HLSL_MODIFIER_COLUMN_MAJOR

Referenced by add_modifier(), debug_dump_decl(), debug_dump_ir_var(), and declare_variable().

◆ debug_print_comp()

const char* debug_print_comp ( DWORD  comp)

Definition at line 401 of file utils.c.

402 {
403  switch (comp)
404  {
405  case BWRITER_COMPARISON_NONE: return "";
406  case BWRITER_COMPARISON_GT: return "_gt";
407  case BWRITER_COMPARISON_EQ: return "_eq";
408  case BWRITER_COMPARISON_GE: return "_ge";
409  case BWRITER_COMPARISON_LT: return "_lt";
410  case BWRITER_COMPARISON_NE: return "_ne";
411  case BWRITER_COMPARISON_LE: return "_le";
412  default: return "_unknown";
413  }
414 }

Referenced by asmparser_instr().

◆ debug_print_dstmod()

const char* debug_print_dstmod ( DWORD  mod)

Definition at line 153 of file utils.c.

154 {
155  switch (mod)
156  {
157  case 0:
158  return "";
160  return "_sat";
162  return "_pp";
164  return "_centroid";
166  return "_sat_pp";
168  return "_sat_centroid";
170  return "_pp_centroid";
172  return "_sat_pp_centroid";
173  default:
174  return "Unexpected modifier\n";
175  }
176 }
static int mod
Definition: i386-dis.c:1273

Referenced by asmparser_instr(), and check_ps_dstmod().

◆ debug_print_dstreg()

const char* debug_print_dstreg ( const struct shader_reg reg)

Definition at line 330 of file utils.c.

331 {
332  return wine_dbg_sprintf("%s%s%s", get_regname(reg),
334  debug_print_writemask(reg->u.writemask));
335 }
static const char * debug_print_relarg(const struct shader_reg *reg)
Definition: utils.c:315
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
static const char * debug_print_writemask(DWORD mask)
Definition: utils.c:258
static const char * get_regname(const struct shader_reg *reg)
Definition: utils.c:202
static int reg
Definition: i386-dis.c:1275

Referenced by asmparser_dstreg_ps_1_0123(), asmparser_dstreg_ps_1_4(), asmparser_dstreg_ps_2(), asmparser_dstreg_ps_2_x(), asmparser_dstreg_ps_3(), asmparser_dstreg_vs_1(), asmparser_dstreg_vs_2(), asmparser_dstreg_vs_3(), and asmparser_instr().

◆ debug_print_opcode()

const char* debug_print_opcode ( DWORD  opcode)

Definition at line 416 of file utils.c.

417 {
418  switch (opcode)
419  {
420  case BWRITERSIO_NOP: return "nop";
421  case BWRITERSIO_MOV: return "mov";
422  case BWRITERSIO_ADD: return "add";
423  case BWRITERSIO_SUB: return "sub";
424  case BWRITERSIO_MAD: return "mad";
425  case BWRITERSIO_MUL: return "mul";
426  case BWRITERSIO_RCP: return "rcp";
427  case BWRITERSIO_RSQ: return "rsq";
428  case BWRITERSIO_DP3: return "dp3";
429  case BWRITERSIO_DP4: return "dp4";
430  case BWRITERSIO_MIN: return "min";
431  case BWRITERSIO_MAX: return "max";
432  case BWRITERSIO_SLT: return "slt";
433  case BWRITERSIO_SGE: return "sge";
434  case BWRITERSIO_EXP: return "exp";
435  case BWRITERSIO_LOG: return "log";
436  case BWRITERSIO_LIT: return "lit";
437  case BWRITERSIO_DST: return "dst";
438  case BWRITERSIO_LRP: return "lrp";
439  case BWRITERSIO_FRC: return "frc";
440  case BWRITERSIO_M4x4: return "m4x4";
441  case BWRITERSIO_M4x3: return "m4x3";
442  case BWRITERSIO_M3x4: return "m3x4";
443  case BWRITERSIO_M3x3: return "m3x3";
444  case BWRITERSIO_M3x2: return "m3x2";
445  case BWRITERSIO_CALL: return "call";
446  case BWRITERSIO_CALLNZ: return "callnz";
447  case BWRITERSIO_LOOP: return "loop";
448  case BWRITERSIO_RET: return "ret";
449  case