ReactOS  0.4.12-dev-712-ge6be187
d3dcompiler_private.h File Reference
#include "wine/debug.h"
#include "wine/list.h"
#include "wine/rbtree.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_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_VAR = 0, HLSL_IR_ASSIGNMENT, HLSL_IR_CONSTANT, HLSL_IR_CONSTRUCTOR,
  HLSL_IR_DEREF, HLSL_IR_EXPR, HLSL_IR_FUNCTION_DECL, 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, va_list args) DECLSPEC_HIDDEN
 
void 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 hlsl_message (const char *fmt,...) PRINTF_ATTR(1
 
void 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_varvar_from_node (const struct hlsl_ir_node *node)
 
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_exprhlsl_mul (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_div (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_mod (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_add (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_sub (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_lt (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_gt (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_le (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_ge (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_eq (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, struct source_location *loc) DECLSPEC_HIDDEN
 
struct hlsl_ir_exprhlsl_ne (struct hlsl_ir_node *op1, struct hlsl_ir_node *op2, 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
 
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 536 of file d3dcompiler_private.h.

◆ BWRITER_SM1_VS

#define BWRITER_SM1_VS   0xfffeu

Definition at line 535 of file d3dcompiler_private.h.

◆ BWRITERPS_VERSION

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

Definition at line 538 of file d3dcompiler_private.h.

◆ BWRITERSI_TEXLD_BIAS

#define BWRITERSI_TEXLD_BIAS   2

Definition at line 515 of file d3dcompiler_private.h.

◆ BWRITERSI_TEXLD_PROJECT

#define BWRITERSI_TEXLD_PROJECT   1

Definition at line 514 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_0

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

Definition at line 491 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_1

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

Definition at line 492 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_2

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

Definition at line 493 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_3

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

Definition at line 494 of file d3dcompiler_private.h.

◆ BWRITERSP_WRITEMASK_ALL

#define BWRITERSP_WRITEMASK_ALL   0xf /* all */

Definition at line 495 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 564 of file d3dcompiler_private.h.

◆ BWRITERVS_SWIZZLE_MASK

#define BWRITERVS_SWIZZLE_MASK   (0xFF << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 542 of file d3dcompiler_private.h.

◆ BWRITERVS_SWIZZLE_SHIFT

#define BWRITERVS_SWIZZLE_SHIFT   16

Definition at line 541 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 569 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 566 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 567 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 568 of file d3dcompiler_private.h.

◆ BWRITERVS_VERSION

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

Definition at line 539 of file d3dcompiler_private.h.

◆ BWRITERVS_W_W

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

Definition at line 562 of file d3dcompiler_private.h.

◆ BWRITERVS_W_X

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

Definition at line 559 of file d3dcompiler_private.h.

◆ BWRITERVS_W_Y

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

Definition at line 560 of file d3dcompiler_private.h.

◆ BWRITERVS_W_Z

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

Definition at line 561 of file d3dcompiler_private.h.

◆ BWRITERVS_X_W

#define BWRITERVS_X_W   (3 << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 547 of file d3dcompiler_private.h.

◆ BWRITERVS_X_X

#define BWRITERVS_X_X   (0 << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 544 of file d3dcompiler_private.h.

◆ BWRITERVS_X_Y

#define BWRITERVS_X_Y   (1 << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 545 of file d3dcompiler_private.h.

◆ BWRITERVS_X_Z

#define BWRITERVS_X_Z   (2 << BWRITERVS_SWIZZLE_SHIFT)

Definition at line 546 of file d3dcompiler_private.h.

◆ BWRITERVS_Y_W

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

Definition at line 552 of file d3dcompiler_private.h.

◆ BWRITERVS_Y_X

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

Definition at line 549 of file d3dcompiler_private.h.

◆ BWRITERVS_Y_Y

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

Definition at line 550 of file d3dcompiler_private.h.

◆ BWRITERVS_Y_Z

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

Definition at line 551 of file d3dcompiler_private.h.

◆ BWRITERVS_Z_W

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

Definition at line 557 of file d3dcompiler_private.h.

◆ BWRITERVS_Z_X

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

Definition at line 554 of file d3dcompiler_private.h.

◆ BWRITERVS_Z_Y

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

Definition at line 555 of file d3dcompiler_private.h.

◆ BWRITERVS_Z_Z

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

Definition at line 556 of file d3dcompiler_private.h.

◆ BYTECODEBUFFER_INITIAL_SIZE

#define BYTECODEBUFFER_INITIAL_SIZE   32

Definition at line 298 of file d3dcompiler_private.h.

◆ COBJMACROS

#define COBJMACROS

Definition at line 29 of file d3dcompiler_private.h.

◆ D3DERR_INVALIDCALL

#define D3DERR_INVALIDCALL   0x8876086c

Definition at line 43 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_COLUMN_MAJOR

#define HLSL_MODIFIER_COLUMN_MAJOR   0x00000400

Definition at line 740 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_CONST

#define HLSL_MODIFIER_CONST   0x00000100

Definition at line 738 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_IN

#define HLSL_MODIFIER_IN   0x00000800

Definition at line 741 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_OUT

#define HLSL_MODIFIER_OUT   0x00001000

Definition at line 742 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_PRECISE

#define HLSL_MODIFIER_PRECISE   0x00000004

Definition at line 732 of file d3dcompiler_private.h.

◆ HLSL_MODIFIER_ROW_MAJOR

#define HLSL_MODIFIER_ROW_MAJOR   0x00000200

Definition at line 739 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 748 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_EXTERN

#define HLSL_STORAGE_EXTERN   0x00000001

Definition at line 730 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_GROUPSHARED

#define HLSL_STORAGE_GROUPSHARED   0x00000010

Definition at line 734 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_NOINTERPOLATION

#define HLSL_STORAGE_NOINTERPOLATION   0x00000002

Definition at line 731 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_SHARED

#define HLSL_STORAGE_SHARED   0x00000008

Definition at line 733 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_STATIC

#define HLSL_STORAGE_STATIC   0x00000020

Definition at line 735 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_UNIFORM

#define HLSL_STORAGE_UNIFORM   0x00000040

Definition at line 736 of file d3dcompiler_private.h.

◆ HLSL_STORAGE_VOLATILE

#define HLSL_STORAGE_VOLATILE   0x00000080

Definition at line 737 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 744 of file d3dcompiler_private.h.

◆ INSTRARRAY_INITIAL_SIZE

#define INSTRARRAY_INITIAL_SIZE   8

Definition at line 117 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: msvc.h:34
unsigned long DWORD
Definition: ntddk_ex.h:95

Definition at line 1182 of file d3dcompiler_private.h.

◆ MAX_SRC_REGS

#define MAX_SRC_REGS   4

Definition at line 189 of file d3dcompiler_private.h.

◆ MESSAGEBUFFER_INITIAL_SIZE

#define MESSAGEBUFFER_INITIAL_SIZE   256

Definition at line 233 of file d3dcompiler_private.h.

◆ PRINTF_ATTR

#define PRINTF_ATTR (   fmt,
  args 
)

Definition at line 284 of file d3dcompiler_private.h.

◆ SWIZZLE_ERR

#define SWIZZLE_ERR   ~0U

Definition at line 366 of file d3dcompiler_private.h.

◆ T0_REG

#define T0_REG   2

Definition at line 590 of file d3dcompiler_private.h.

◆ T1_REG

#define T1_REG   3

Definition at line 591 of file d3dcompiler_private.h.

◆ T2_REG

#define T2_REG   4

Definition at line 592 of file d3dcompiler_private.h.

◆ T3_REG

#define T3_REG   5

Definition at line 593 of file d3dcompiler_private.h.

◆ TAG_Aon9

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

Definition at line 1185 of file d3dcompiler_private.h.

◆ TAG_DXBC

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

Definition at line 1186 of file d3dcompiler_private.h.

◆ TAG_ISGN

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

Definition at line 1187 of file d3dcompiler_private.h.

◆ TAG_OSG5

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

Definition at line 1189 of file d3dcompiler_private.h.

◆ TAG_OSGN

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

Definition at line 1188 of file d3dcompiler_private.h.

◆ TAG_PCSG

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

Definition at line 1190 of file d3dcompiler_private.h.

◆ TAG_RDEF

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

Definition at line 1191 of file d3dcompiler_private.h.

◆ TAG_SDBG

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

Definition at line 1192 of file d3dcompiler_private.h.

◆ TAG_SHDR

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

Definition at line 1193 of file d3dcompiler_private.h.

◆ TAG_SHEX

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

Definition at line 1194 of file d3dcompiler_private.h.

◆ TAG_STAT

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

Definition at line 1195 of file d3dcompiler_private.h.

◆ TAG_XNAP

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

Definition at line 1196 of file d3dcompiler_private.h.

◆ TAG_XNAS

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

Definition at line 1197 of file d3dcompiler_private.h.

Typedef Documentation

◆ instr_writer

Definition at line 311 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 57 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 571 of file d3dcompiler_private.h.

◆ bwritersampler_texture_type

Enumerator
BWRITERSTT_UNKNOWN 
BWRITERSTT_1D 
BWRITERSTT_2D 
BWRITERSTT_CUBE 
BWRITERSTT_VOLUME 

Definition at line 505 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 370 of file d3dcompiler_private.h.

371 {
421 
456 
460 };

◆ bwritershader_param_dstmod_type

Enumerator
BWRITERSPDM_NONE 
BWRITERSPDM_SATURATE 
BWRITERSPDM_PARTIALPRECISION 
BWRITERSPDM_MSAMPCENTROID 

Definition at line 497 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 462 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 517 of file d3dcompiler_private.h.

◆ bwritervs_rastout_offsets

Enumerator
BWRITERSRO_POSITION 
BWRITERSRO_FOG 
BWRITERSRO_POINT_SIZE 

Definition at line 484 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 636 of file d3dcompiler_private.h.

◆ hlsl_error_level

Enumerator
HLSL_LEVEL_ERROR 
HLSL_LEVEL_WARNING 
HLSL_LEVEL_NOTE 

Definition at line 1050 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 906 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 809 of file d3dcompiler_private.h.

809  {
821 
823 
825 
828  HLSL_IR_UNOP_SIN_REDUCED, /* Reduced range [-pi, pi] */
829  HLSL_IR_UNOP_COS_REDUCED, /* Reduced range [-pi, pi] */
830 
833 
835 
840 
845 
847 
854 
857 
863 
868 
870 
872 
874 };

◆ hlsl_ir_jump_type

Enumerator
HLSL_IR_JUMP_BREAK 
HLSL_IR_JUMP_CONTINUE 
HLSL_IR_JUMP_DISCARD 
HLSL_IR_JUMP_RETURN 

Definition at line 884 of file d3dcompiler_private.h.

◆ hlsl_ir_node_type

Enumerator
HLSL_IR_VAR 
HLSL_IR_ASSIGNMENT 
HLSL_IR_CONSTANT 
HLSL_IR_CONSTRUCTOR 
HLSL_IR_DEREF 
HLSL_IR_EXPR 
HLSL_IR_FUNCTION_DECL 
HLSL_IR_IF 
HLSL_IR_LOOP 
HLSL_IR_JUMP 
HLSL_IR_SWIZZLE 

Definition at line 706 of file d3dcompiler_private.h.

◆ hlsl_matrix_majority

Enumerator
HLSL_COLUMN_MAJOR 
HLSL_ROW_MAJOR 

Definition at line 662 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 653 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 625 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 1013 of file d3dcompiler_private.h.

◆ parse_status

Enumerator
PARSE_SUCCESS 
PARSE_WARN 
PARSE_ERR 

Definition at line 235 of file d3dcompiler_private.h.

◆ parse_unary_op

Enumerator
UNARY_OP_PLUS 
UNARY_OP_MINUS 
UNARY_OP_LOGICNOT 
UNARY_OP_BITNOT 

Definition at line 1005 of file d3dcompiler_private.h.

◆ shader_type

Enumerator
ST_UNKNOWN 
ST_VERTEX 
ST_PIXEL 

Definition at line 50 of file d3dcompiler_private.h.

Function Documentation

◆ add_constB()

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

Definition at line 180 of file bytecodewriter.c.

180  {
181  struct constant *newconst;
182 
183  if(shader->num_cb) {
184  struct constant **newarray;
185  newarray = d3dcompiler_realloc(shader->constB,
186  sizeof(*shader->constB) * (shader->num_cb + 1));
187  if(!newarray) {
188  ERR("Failed to grow the constants array\n");
189  return FALSE;
190  }
191  shader->constB = newarray;
192  } else {
193  shader->constB = d3dcompiler_alloc(sizeof(*shader->constB));
194  if(!shader->constB) {
195  ERR("Failed to allocate the constants array\n");
196  return FALSE;
197  }
198  }
199 
200  newconst = d3dcompiler_alloc(sizeof(*newconst));
201  if(!newconst) {
202  ERR("Failed to allocate a new constant\n");
203  return FALSE;
204  }
205  newconst->regnum = reg;
206  newconst->value[0].b = x;
207  shader->constB[shader->num_cb] = newconst;
208 
209  shader->num_cb++;
210  return TRUE;
211 }
#define TRUE
Definition: types.h:120
static void * d3dcompiler_realloc(void *ptr, SIZE_T size)
union constant::@229 value[4]
static void * d3dcompiler_alloc(SIZE_T size)
GLuint shader
Definition: glext.h:6030
#define ERR(fmt,...)
Definition: debug.h:109
INT x
Definition: msvc.h:62
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 108 of file bytecodewriter.c.

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

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 144 of file bytecodewriter.c.

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

Referenced by asmparser_constI().

◆ add_declaration()

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

Definition at line 764 of file utils.c.

765 {
766  struct hlsl_ir_var *var;
767 
768  LIST_FOR_EACH_ENTRY(var, &scope->vars, struct hlsl_ir_var, scope_entry)
769  {
770  if (!strcmp(decl->name, var->name))
771  return FALSE;
772  }
773  if (local_var && scope->upper->upper == hlsl_ctx.globals)
774  {
775  /* Check whether the variable redefines a function parameter. */
776  LIST_FOR_EACH_ENTRY(var, &scope->upper->vars, struct hlsl_ir_var, scope_entry)
777  {
778  if (!strcmp(decl->name, var->name))
779  return FALSE;
780  }
781  }
782 
783  list_add_tail(&scope->vars, &decl->scope_entry);
784  return TRUE;
785 }
#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:87
struct list scope_entry
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 2456 of file utils.c.

2457 {
2458  struct hlsl_ir_function *func;
2459  struct wine_rb_entry *func_entry, *old_entry;
2460 
2461  func_entry = wine_rb_get(funcs, name);
2462  if (func_entry)
2463  {
2464  func = WINE_RB_ENTRY_VALUE(func_entry, struct hlsl_ir_function, entry);
2465  if (intrinsic != func->intrinsic)
2466  {
2467  if (intrinsic)
2468  {
2469  ERR("Redeclaring a user defined function as an intrinsic.\n");
2470  return;
2471  }
2472  TRACE("Function %s redeclared as a user defined function.\n", debugstr_a(name));
2473  func->intrinsic = intrinsic;
2476  }
2477  decl->func = func;
2478  if ((old_entry = wine_rb_get(&func->overloads, decl->parameters)))
2479  {
2480  struct hlsl_ir_function_decl *old_decl =
2481  WINE_RB_ENTRY_VALUE(old_entry, struct hlsl_ir_function_decl, entry);
2482 
2483  if (!decl->body)
2484  {
2485  free_function_decl(decl);
2487  return;
2488  }
2489  wine_rb_remove(&func->overloads, old_entry);
2490  free_function_decl(old_decl);
2491  }
2492  wine_rb_put(&func->overloads, decl->parameters, &decl->entry);
2494  return;
2495  }
2496  func = d3dcompiler_alloc(sizeof(*func));
2497  func->name = name;
2499  decl->func = func;
2500  wine_rb_put(&func->overloads, decl->parameters, &decl->entry);
2501  func->intrinsic = intrinsic;
2502  wine_rb_put(funcs, func->name, &func->entry);
2503 }
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:1798
uint8_t entry
Definition: isohybrid.c:63
static BOOL d3dcompiler_free(void *ptr)
static void free_function_decl(struct hlsl_ir_function_decl *decl)
Definition: utils.c:2431
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
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:109
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:36
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:2439
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 77 of file bytecodewriter.c.

77  {
78  struct instruction **new_instructions;
79 
80  if(!shader) return FALSE;
81 
82  if(shader->instr_alloc_size == 0) {
83  shader->instr = d3dcompiler_alloc(sizeof(*shader->instr) * INSTRARRAY_INITIAL_SIZE);
84  if(!shader->instr) {
85  ERR("Failed to allocate the shader instruction array\n");
86  return FALSE;
87  }
88  shader->instr_alloc_size = INSTRARRAY_INITIAL_SIZE;
89  } else if(shader->instr_alloc_size == shader->num_instrs) {
90  new_instructions = d3dcompiler_realloc(shader->instr,
91  sizeof(*shader->instr) * (shader->instr_alloc_size) * 2);
92  if(!new_instructions) {
93  ERR("Failed to grow the shader instruction array\n");
94  return FALSE;
95  }
96  shader->instr = new_instructions;
97  shader->instr_alloc_size = shader->instr_alloc_size * 2;
98  } else if(shader->num_instrs > shader->instr_alloc_size) {
99  ERR("More instructions than allocated. This should not happen\n");
100  return FALSE;
101  }
102 
103  shader->instr[shader->num_instrs] = instr;
104  shader->num_instrs++;
105  return TRUE;
106 }
#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:109
#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 46 of file bytecodewriter.c.

46  {
47  struct instruction *ret = d3dcompiler_alloc(sizeof(*ret));
48  if(!ret) {
49  ERR("Failed to allocate memory for an instruction structure\n");
50  return NULL;
51  }
52 
53  if(srcs) {
54  ret->src = d3dcompiler_alloc(srcs * sizeof(*ret->src));
55  if(!ret->src) {
56  ERR("Failed to allocate memory for instruction registers\n");
58  return NULL;
59  }
60  ret->num_srcs = srcs;
61  }
62  return ret;
63 }
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:109

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

◆ asmparser_message()

void 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 1091 of file d3dcompiler_private.h.

1092 {
1093  assert(node->type == HLSL_IR_ASSIGNMENT);
1094  return CONTAINING_RECORD(node, struct hlsl_ir_assignment, node);
1095 }
#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 932 of file utils.c.

933 {
934  struct hlsl_type *type;
935  struct hlsl_struct_field *old_field, *field;
936 
937  type = d3dcompiler_alloc(sizeof(*type));
938  if (!type)
939  {
940  ERR("Out of memory\n");
941  return NULL;
942  }
943  if (old->name)
944  {
945  type->name = d3dcompiler_strdup(old->name);
946  if (!type->name)
947  {
949  return NULL;
950  }
951  }
952  type->type = old->type;
953  type->base_type = old->base_type;
954  type->dimx = old->dimx;
955  type->dimy = old->dimy;
956  type->modifiers = old->modifiers;
957  type->sampler_dim = old->sampler_dim;
958  switch (old->type)
959  {
960  case HLSL_CLASS_ARRAY:
961  type->e.array.type = old->e.array.type;
962  type->e.array.elements_count = old->e.array.elements_count;
963  break;
964  case HLSL_CLASS_STRUCT:
965  type->e.elements = d3dcompiler_alloc(sizeof(*type->e.elements));
966  if (!type->e.elements)
967  {
968  d3dcompiler_free((void *)type->name);
970  return NULL;
971  }
972  list_init(type->e.elements);
973  LIST_FOR_EACH_ENTRY(old_field, old->e.elements, struct hlsl_struct_field, entry)
974  {
975  field = d3dcompiler_alloc(sizeof(*field));
976  if (!field)
977  {
978  LIST_FOR_EACH_ENTRY_SAFE(field, old_field, type->e.elements, struct hlsl_struct_field, entry)
979  {
980  d3dcompiler_free((void *)field->semantic);
981  d3dcompiler_free((void *)field->name);
983  }
984  d3dcompiler_free(type->e.elements);
985  d3dcompiler_free((void *)type->name);
987  return NULL;
988  }
989  field->type = clone_hlsl_type(old_field->type);
990  field->name = d3dcompiler_strdup(old_field->name);
991  if (old_field->semantic)
992  field->semantic = d3dcompiler_strdup(old_field->semantic);
993  field->modifiers = old_field->modifiers;
994  list_add_tail(type->e.elements, &field->entry);
995  }
996  break;
997  default:
998  break;
999  }
1000 
1001  list_add_tail(&hlsl_ctx.types, &type->entry);
1002  return type;
1003 }
unsigned int dimx
enum hlsl_type_class type
enum hlsl_sampler_dim sampler_dim
uint8_t entry
Definition: isohybrid.c:63
static BOOL d3dcompiler_free(void *ptr)
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
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
union hlsl_type::@231 e
#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:87
unsigned int modifiers
#define ERR(fmt,...)
Definition: debug.h:109
#define LIST_FOR_EACH_ENTRY_SAFE(cursor, cursor2, list, type, field)
Definition: list.h:204
struct hlsl_type::@231::@232 array
struct hlsl_type * clone_hlsl_type(struct hlsl_type *old)
Definition: utils.c:932
__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 886 of file utils.c.

887 {
888  if (t1 == t2)
889  return TRUE;
890 
891  if (t1->type != t2->type)
892  return FALSE;
893  if (t1->base_type != t2->base_type)
894  return FALSE;
895  if (t1->base_type == HLSL_TYPE_SAMPLER && t1->sampler_dim != t2->sampler_dim)
896  return FALSE;
899  return FALSE;
900  if (t1->dimx != t2->dimx)
901  return FALSE;
902  if (t1->dimy != t2->dimy)
903  return FALSE;
904  if (t1->type == HLSL_CLASS_STRUCT)
905  {
906  struct list *t1cur, *t2cur;
907  struct hlsl_struct_field *t1field, *t2field;
908 
909  t1cur = list_head(t1->e.elements);
910  t2cur = list_head(t2->e.elements);
911  while (t1cur && t2cur)
912  {
913  t1field = LIST_ENTRY(t1cur, struct hlsl_struct_field, entry);
914  t2field = LIST_ENTRY(t2cur, struct hlsl_struct_field, entry);
915  if (!compare_hlsl_types(t1field->type, t2field->type))
916  return FALSE;
917  if (strcmp(t1field->name, t2field->name))
918  return FALSE;
919  t1cur = list_next(t1->e.elements, t1cur);
920  t2cur = list_next(t2->e.elements, t2cur);
921  }
922  if (t1cur != t2cur)
923  return FALSE;
924  }
925  if (t1->type == HLSL_CLASS_ARRAY)
926  return t1->e.array.elements_count == t2->e.array.elements_count
927  && compare_hlsl_types(t1->e.array.type, t2->e.array.type);
928 
929  return TRUE;
930 }
unsigned int dimx
#define TRUE
Definition: types.h:120
enum hlsl_type_class type
enum hlsl_sampler_dim sampler_dim
uint8_t entry
Definition: isohybrid.c:63
#define HLSL_MODIFIERS_COMPARISON_MASK
__WINE_SERVER_LIST_INLINE struct list * list_head(const struct list *list)
Definition: list.h:131
union hlsl_type::@231 e
struct hlsl_type * type
BOOL compare_hlsl_types(const struct hlsl_type *t1, const struct hlsl_type *t2)
Definition: utils.c:886
enum hlsl_base_type base_type
struct list * elements
Definition: _list.h:228
unsigned int modifiers
struct hlsl_type::@231::@232 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 1010 of file utils.c.

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

Referenced by yyparse().

◆ compilation_message()

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

Definition at line 722 of file utils.c.

723 {
724  char* buffer;
725  int rc, size;
726 
727  if (msg->capacity == 0)
728  {
730  if (msg->string == NULL)
731  {
732  ERR("Error allocating memory for parser messages\n");
733  return;
734  }
735  msg->capacity = MESSAGEBUFFER_INITIAL_SIZE;
736  }
737 
738  while (1)
739  {
740  rc = vsnprintf(msg->string + msg->size,
741  msg->capacity - msg->size, fmt, args);
742 
743  if (rc < 0 || rc >= msg->capacity - msg->size)
744  {
745  size = msg->capacity * 2;
746  buffer = d3dcompiler_realloc(msg->string, size);
747  if (buffer == NULL)
748  {
749  ERR("Error reallocating memory for parser messages\n");
750  return;
751  }
752  msg->string = buffer;
753  msg->capacity = size;
754  }
755  else
756  {
757  TRACE("%s", msg->string + msg->size);
758  msg->size += rc;
759  return;
760  }
761  }
762 }
#define vsnprintf
Definition: tif_win32.c:408
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
UINT msg
Definition: msvc.h:92
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:109
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 860 of file utils.c.

861 {
862  unsigned int count = 0;
863  struct hlsl_struct_field *field;
864 
865  if (type->type <= HLSL_CLASS_LAST_NUMERIC)
866  {
867  return type->dimx * type->dimy;
868  }
869  if (type->type == HLSL_CLASS_ARRAY)
870  {
871  return components_count_type(type->e.array.type) * type->e.array.elements_count;
872  }
873  if (type->type != HLSL_CLASS_STRUCT)
874  {
875  ERR("Unexpected data type %s.\n", debug_hlsl_type(type));
876  return 0;
877  }
878 
879  LIST_FOR_EACH_ENTRY(field, type->e.elements, struct hlsl_struct_field, entry)
880  {
882  }
883  return count;
884 }
GLuint GLuint GLsizei count
Definition: gl.h:1545
uint8_t entry
Definition: isohybrid.c:63
const char * debug_hlsl_type(const struct hlsl_type *type)
Definition: utils.c:1866
unsigned int components_count_type(struct hlsl_type *type)
Definition: utils.c:860
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
#define ERR(fmt,...)
Definition: debug.h:109

Referenced by compatible_data_types(), components_count_expr_list(), 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 1079 of file d3dcompiler_private.h.

1080 {
1081  assert(node->type == HLSL_IR_CONSTANT);
1082  return CONTAINING_RECORD(node, struct hlsl_ir_constant, node);
1083 }
#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 1103 of file d3dcompiler_private.h.

1104 {
1105  assert(node->type == HLSL_IR_CONSTRUCTOR);
1107 }
#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 1428 of file asmparser.c.

1428  {
1429  TRACE_(parsed_shader)("ps_1_0\n");
1430 
1431  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1432  if(!ret->shader) {
1433  ERR("Failed to allocate memory for the shader\n");
1434  set_parse_status(&ret->status, PARSE_ERR);
1435  return;
1436  }
1437 
1438  ret->shader->type = ST_PIXEL;
1439  ret->shader->version = BWRITERPS_VERSION(1, 0);
1440  ret->funcs = &parser_ps_1_0123;
1441  gen_oldps_input(ret->shader, 4);
1442 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1327
static const struct asmparser_backend parser_ps_1_0123
Definition: asmparser.c:1211
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:109
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps11_parser()

void create_ps11_parser ( struct asm_parser ret)

Definition at line 1444 of file asmparser.c.

1444  {
1445  TRACE_(parsed_shader)("ps_1_1\n");
1446 
1447  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1448  if(!ret->shader) {
1449  ERR("Failed to allocate memory for the shader\n");
1450  set_parse_status(&ret->status, PARSE_ERR);
1451  return;
1452  }
1453 
1454  ret->shader->type = ST_PIXEL;
1455  ret->shader->version = BWRITERPS_VERSION(1, 1);
1456  ret->funcs = &parser_ps_1_0123;
1457  gen_oldps_input(ret->shader, 4);
1458 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1327
static const struct asmparser_backend parser_ps_1_0123
Definition: asmparser.c:1211
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:109
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps12_parser()

void create_ps12_parser ( struct asm_parser ret)

Definition at line 1460 of file asmparser.c.

1460  {
1461  TRACE_(parsed_shader)("ps_1_2\n");
1462 
1463  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1464  if(!ret->shader) {
1465  ERR("Failed to allocate memory for the shader\n");
1466  set_parse_status(&ret->status, PARSE_ERR);
1467  return;
1468  }
1469 
1470  ret->shader->type = ST_PIXEL;
1471  ret->shader->version = BWRITERPS_VERSION(1, 2);
1472  ret->funcs = &parser_ps_1_0123;
1473  gen_oldps_input(ret->shader, 4);
1474 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1327
static const struct asmparser_backend parser_ps_1_0123
Definition: asmparser.c:1211
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:109
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps13_parser()

void create_ps13_parser ( struct asm_parser ret)

Definition at line 1476 of file asmparser.c.

1476  {
1477  TRACE_(parsed_shader)("ps_1_3\n");
1478 
1479  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1480  if(!ret->shader) {
1481  ERR("Failed to allocate memory for the shader\n");
1482  set_parse_status(&ret->status, PARSE_ERR);
1483  return;
1484  }
1485 
1486  ret->shader->type = ST_PIXEL;
1487  ret->shader->version = BWRITERPS_VERSION(1, 3);
1488  ret->funcs = &parser_ps_1_0123;
1489  gen_oldps_input(ret->shader, 4);
1490 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1327
static const struct asmparser_backend parser_ps_1_0123
Definition: asmparser.c:1211
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:109
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps14_parser()

void create_ps14_parser ( struct asm_parser ret)

Definition at line 1492 of file asmparser.c.

1492  {
1493  TRACE_(parsed_shader)("ps_1_4\n");
1494 
1495  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1496  if(!ret->shader) {
1497  ERR("Failed to allocate memory for the shader\n");
1498  set_parse_status(&ret->status, PARSE_ERR);
1499  return;
1500  }
1501 
1502  ret->shader->type = ST_PIXEL;
1503  ret->shader->version = BWRITERPS_VERSION(1, 4);
1504  ret->funcs = &parser_ps_1_4;
1505  gen_oldps_input(ret->shader, 6);
1506 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1327
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:1231
#define ERR(fmt,...)
Definition: debug.h:109
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps20_parser()

void create_ps20_parser ( struct asm_parser ret)

Definition at line 1508 of file asmparser.c.

1508  {
1509  TRACE_(parsed_shader)("ps_2_0\n");
1510 
1511  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1512  if(!ret->shader) {
1513  ERR("Failed to allocate memory for the shader\n");
1514  set_parse_status(&ret->status, PARSE_ERR);
1515  return;
1516  }
1517 
1518  ret->shader->type = ST_PIXEL;
1519  ret->shader->version = BWRITERPS_VERSION(2, 0);
1520  ret->funcs = &parser_ps_2;
1521  gen_oldps_input(ret->shader, 8);
1522 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1327
static void * d3dcompiler_alloc(SIZE_T size)
static const struct asmparser_backend parser_ps_2
Definition: asmparser.c:1251
#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:109
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps2x_parser()

void create_ps2x_parser ( struct asm_parser ret)

Definition at line 1524 of file asmparser.c.

1524  {
1525  TRACE_(parsed_shader)("ps_2_x\n");
1526 
1527  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1528  if(!ret->shader) {
1529  ERR("Failed to allocate memory for the shader\n");
1530  set_parse_status(&ret->status, PARSE_ERR);
1531  return;
1532  }
1533 
1534  ret->shader->type = ST_PIXEL;
1535  ret->shader->version = BWRITERPS_VERSION(2, 1);
1536  ret->funcs = &parser_ps_2_x;
1537  gen_oldps_input(ret->shader, 8);
1538 }
static void gen_oldps_input(struct bwriter_shader *shader, DWORD texcoords)
Definition: asmparser.c:1327
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:109
static const struct asmparser_backend parser_ps_2_x
Definition: asmparser.c:1271
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_ps30_parser()

void create_ps30_parser ( struct asm_parser ret)

Definition at line 1540 of file asmparser.c.

1540  {
1541  TRACE_(parsed_shader)("ps_3_0\n");
1542 
1543  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1544  if(!ret->shader) {
1545  ERR("Failed to allocate memory for the shader\n");
1546  set_parse_status(&ret->status, PARSE_ERR);
1547  return;
1548  }
1549 
1550  ret->shader->type = ST_PIXEL;
1551  ret->shader->version = BWRITERPS_VERSION(3, 0);
1552  ret->funcs = &parser_ps_3;
1553 }
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:109
static const struct asmparser_backend parser_ps_3
Definition: asmparser.c:1291
#define BWRITERPS_VERSION(major, minor)

Referenced by yyparse().

◆ create_vs10_parser()

void create_vs10_parser ( struct asm_parser ret)

Definition at line 1349 of file asmparser.c.

1349  {
1350  TRACE_(parsed_shader)("vs_1_0\n");
1351 
1352  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1353  if(!ret->shader) {
1354  ERR("Failed to allocate memory for the shader\n");
1355  set_parse_status(&ret->status, PARSE_ERR);
1356  return;
1357  }
1358 
1359  ret->shader->type = ST_VERTEX;
1360  ret->shader->version = BWRITERVS_VERSION(1, 0);
1361  ret->funcs = &parser_vs_1;
1362  gen_oldvs_output(ret->shader);
1363 }
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:1311
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:109
#define BWRITERVS_VERSION(major, minor)
static const struct asmparser_backend parser_vs_1
Definition: asmparser.c:1151

Referenced by yyparse().

◆ create_vs11_parser()

void create_vs11_parser ( struct asm_parser ret)

Definition at line 1365 of file asmparser.c.

1365  {
1366  TRACE_(parsed_shader)("vs_1_1\n");
1367 
1368  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1369  if(!ret->shader) {
1370  ERR("Failed to allocate memory for the shader\n");
1371  set_parse_status(&ret->status, PARSE_ERR);
1372  return;
1373  }
1374 
1375  ret->shader->type = ST_VERTEX;
1376  ret->shader->version = BWRITERVS_VERSION(1, 1);
1377  ret->funcs = &parser_vs_1;
1378  gen_oldvs_output(ret->shader);
1379 }
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:1311
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:109
#define BWRITERVS_VERSION(major, minor)
static const struct asmparser_backend parser_vs_1
Definition: asmparser.c:1151

Referenced by yyparse().

◆ create_vs20_parser()

void create_vs20_parser ( struct asm_parser ret)

Definition at line 1381 of file asmparser.c.

1381  {
1382  TRACE_(parsed_shader)("vs_2_0\n");
1383 
1384  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1385  if(!ret->shader) {
1386  ERR("Failed to allocate memory for the shader\n");
1387  set_parse_status(&ret->status, PARSE_ERR);
1388  return;
1389  }
1390 
1391  ret->shader->type = ST_VERTEX;
1392  ret->shader->version = BWRITERVS_VERSION(2, 0);
1393  ret->funcs = &parser_vs_2;
1394  gen_oldvs_output(ret->shader);
1395 }
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:1171
static void gen_oldvs_output(struct bwriter_shader *shader)
Definition: asmparser.c:1311
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:109
#define BWRITERVS_VERSION(major, minor)

Referenced by yyparse().

◆ create_vs2x_parser()

void create_vs2x_parser ( struct asm_parser ret)

Definition at line 1397 of file asmparser.c.

1397  {
1398  TRACE_(parsed_shader)("vs_2_x\n");
1399 
1400  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1401  if(!ret->shader) {
1402  ERR("Failed to allocate memory for the shader\n");
1403  set_parse_status(&ret->status, PARSE_ERR);
1404  return;
1405  }
1406 
1407  ret->shader->type = ST_VERTEX;
1408  ret->shader->version = BWRITERVS_VERSION(2, 1);
1409  ret->funcs = &parser_vs_2;
1410  gen_oldvs_output(ret->shader);
1411 }
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:1171
static void gen_oldvs_output(struct bwriter_shader *shader)
Definition: asmparser.c:1311
int ret
static void set_parse_status(enum parse_status *current, enum parse_status update)
#define ERR(fmt,...)
Definition: debug.h:109
#define BWRITERVS_VERSION(major, minor)

Referenced by yyparse().

◆ create_vs30_parser()

void create_vs30_parser ( struct asm_parser ret)

Definition at line 1413 of file asmparser.c.

1413  {
1414  TRACE_(parsed_shader)("vs_3_0\n");
1415 
1416  ret->shader = d3dcompiler_alloc(sizeof(*ret->shader));
1417  if(!ret->shader) {
1418  ERR("Failed to allocate memory for the shader\n");
1419  set_parse_status(&ret->status, PARSE_ERR);
1420  return;
1421  }
1422 
1423  ret->shader->type = ST_VERTEX;
1424  ret->shader->version = BWRITERVS_VERSION(3, 0);
1425  ret->funcs = &parser_vs_3;
1426 }
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:109
static const struct asmparser_backend parser_vs_3
Definition: asmparser.c:1191
#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 151 of file d3dcompiler_private.h.

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

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 161 of file d3dcompiler_private.h.

162 {
163  char *copy;
164  SIZE_T len;
165 
166  if (!string)
167  return NULL;
168 
169  len = strlen(string);
170  copy = d3dcompiler_alloc(len + 1);
171  if (copy)
172  memcpy(copy, string, len + 1);
173  return copy;
174 }
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:78
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(), while(), and yyparse().

◆ debug_d3dcompiler_d3d_blob_part()

const char* debug_d3dcompiler_d3d_blob_part ( D3D_BLOB_PART  part)

Definition at line 109 of file utils.c.

110 {
111  switch(part)
112  {
125  default:
126  FIXME("Unrecognized D3D_BLOB_PART %#x\n", part);
127  return "unrecognized";
128  }
129 }
#define WINE_D3DCOMPILER_TO_STR(x)
Definition: utils.c:33
#define FIXME(fmt,...)
Definition: debug.h:110

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 35 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 53 of file utils.c.

54 {
55  switch (t)
56  {
103  default:
104  FIXME("Unrecognized D3D_SHADER_VARIABLE_TYPE %#x.\n", t);
105  return "unrecognized";
106  }
107 }
GLdouble GLdouble t
Definition: gl.h:2047
#define WINE_D3DCOMPILER_TO_STR(x)
Definition: utils.c:33
#define FIXME(fmt,...)
Definition: debug.h:110

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 2259 of file utils.c.

2260 {
2261  struct hlsl_ir_var *param;
2262 
2263  TRACE("Dumping function %s.\n", debugstr_a(func->func->name));
2264  TRACE("Function parameters:\n");
2265  LIST_FOR_EACH_ENTRY(param, func->parameters, struct hlsl_ir_var, node.entry)
2266  {
2268  TRACE("\n");
2269  }
2270  if (func->semantic)
2271  TRACE("Function semantic: %s\n", debugstr_a(func->semantic));
2272  if (func->body)
2273  {
2274  debug_dump_instr_list(func->body);
2275  }
2276 }
GLenum func
Definition: glext.h:6028
#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:1953
static void debug_dump_ir_var(const struct hlsl_ir_var *var)
Definition: utils.c:1964
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
GLfloat param
Definition: glext.h:5796
Definition: dlist.c:348

Referenced by dump_function_decl().

◆ debug_hlsl_type()

const char* debug_hlsl_type ( const struct hlsl_type type)

Definition at line 1866 of file utils.c.

1867 {
1868  const char *name;
1869 
1870  if (type->name)
1871  return debugstr_a(type->name);
1872 
1873  if (type->type == HLSL_CLASS_STRUCT)
1874  return "<anonymous struct>";
1875 
1876  if (type->type == HLSL_CLASS_ARRAY)
1877  {
1878  name = debug_base_type(type->e.array.type);
1879  return wine_dbg_sprintf("%s[%u]", name, type->e.array.elements_count);
1880  }
1881 
1883 
1884  if (type->type == HLSL_CLASS_SCALAR)
1885  return wine_dbg_sprintf("%s", name);
1886  if (type->type == HLSL_CLASS_VECTOR)
1887  return wine_dbg_sprintf("%s%u", name, type->dimx);
1888  if (type->type == HLSL_CLASS_MATRIX)
1889  return wine_dbg_sprintf("%s%ux%u", name, type->dimx, type->dimy);
1890  return "unexpected_type";
1891 }
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:1838
#define debugstr_a
Definition: kernel32.h:31
Definition: name.c:36
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 1893 of file utils.c.

1894 {
1895  char string[110];
1896 
1897  string[0] = 0;
1899  strcat(string, " extern"); /* 7 */
1901  strcat(string, " nointerpolation"); /* 16 */
1903  strcat(string, " precise"); /* 8 */
1905  strcat(string, " shared"); /* 7 */
1907  strcat(string, " groupshared"); /* 12 */
1909  strcat(string, " static"); /* 7 */
1911  strcat(string, " uniform"); /* 8 */
1913  strcat(string, " volatile"); /* 9 */
1915  strcat(string, " const"); /* 6 */
1917  strcat(string, " row_major"); /* 10 */
1919  strcat(string, " column_major"); /* 13 */
1921  strcat(string, " inout"); /* 6 */
1922  else if (modifiers & HLSL_MODIFIER_IN)
1923  strcat(string, " in"); /* 3 */
1924  else if (modifiers & HLSL_MODIFIER_OUT)
1925  strcat(string, " out"); /* 4 */
1926 
1927  return wine_dbg_sprintf("%s", string[0] ? string + 1 : "");
1928 }
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 404 of file utils.c.

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

Referenced by asmparser_instr().

◆ debug_print_dstmod()

const char* debug_print_dstmod ( DWORD  mod)

Definition at line 156 of file utils.c.

157 {
158  switch (mod)
159  {
160  case 0:
161  return "";
163  return "_sat";
165  return "_pp";
167  return "_centroid";
169  return "_sat_pp";
171  return "_sat_centroid";
173  return "_pp_centroid";
175  return "_sat_pp_centroid";
176  default:
177  return "Unexpected modifier\n";
178  }
179 }
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 333 of file utils.c.

334 {
335  return wine_dbg_sprintf("%s%s%s", get_regname(reg),
337  debug_print_writemask(reg->u.writemask));
338 }
static const char * debug_print_relarg(const struct shader_reg *reg)
Definition: utils.c:318
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:271
static const char * debug_print_writemask(DWORD mask)
Definition: utils.c:261
static const char * get_regname(const struct shader_reg *reg)
Definition: utils.c:205
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 419 of file utils.c.

420 {
421  switch (opcode)
422  {
423  case BWRITERSIO_NOP: return "nop";
424  case BWRITERSIO_MOV: return "mov";
425  case BWRITERSIO_ADD: return "add";
426  case BWRITERSIO_SUB: return "sub";
427  case BWRITERSIO_MAD: return "mad";
428  case BWRITERSIO_MUL: