20#ifndef __VKD3D_SHADER_HLSL_H
21#define __VKD3D_SHADER_HLSL_H
24#include "wine/rbtree.h"
26#include "d3dx9shader.h"
54#define HLSL_SWIZZLE_X (0u)
55#define HLSL_SWIZZLE_Y (1u)
56#define HLSL_SWIZZLE_Z (2u)
57#define HLSL_SWIZZLE_W (3u)
59#define HLSL_SWIZZLE(x, y, z, w) \
60 (((HLSL_SWIZZLE_ ## x) << 0) \
61 | ((HLSL_SWIZZLE_ ## y) << 2) \
62 | ((HLSL_SWIZZLE_ ## z) << 4) \
63 | ((HLSL_SWIZZLE_ ## w) << 6))
65#define HLSL_SWIZZLE_MASK (0x3u)
66#define HLSL_SWIZZLE_SHIFT(idx) (2u * (idx))
397#define HLSL_STORAGE_EXTERN 0x00000001
398#define HLSL_STORAGE_NOINTERPOLATION 0x00000002
399#define HLSL_MODIFIER_PRECISE 0x00000004
400#define HLSL_STORAGE_SHARED 0x00000008
401#define HLSL_STORAGE_GROUPSHARED 0x00000010
402#define HLSL_STORAGE_STATIC 0x00000020
403#define HLSL_STORAGE_UNIFORM 0x00000040
404#define HLSL_MODIFIER_VOLATILE 0x00000080
405#define HLSL_MODIFIER_CONST 0x00000100
406#define HLSL_MODIFIER_ROW_MAJOR 0x00000200
407#define HLSL_MODIFIER_COLUMN_MAJOR 0x00000400
408#define HLSL_STORAGE_IN 0x00000800
409#define HLSL_STORAGE_OUT 0x00001000
410#define HLSL_MODIFIER_INLINE 0x00002000
411#define HLSL_STORAGE_CENTROID 0x00004000
412#define HLSL_STORAGE_NOPERSPECTIVE 0x00008000
413#define HLSL_STORAGE_LINEAR 0x00010000
414#define HLSL_MODIFIER_SINGLE 0x00020000
415#define HLSL_MODIFIER_EXPORT 0x00040000
416#define HLSL_STORAGE_ANNOTATION 0x00080000
417#define HLSL_MODIFIER_UNORM 0x00100000
418#define HLSL_MODIFIER_SNORM 0x00200000
420#define HLSL_TYPE_MODIFIERS_MASK (HLSL_MODIFIER_PRECISE | HLSL_MODIFIER_VOLATILE | \
421 HLSL_MODIFIER_CONST | HLSL_MODIFIER_ROW_MAJOR | \
422 HLSL_MODIFIER_COLUMN_MAJOR | HLSL_MODIFIER_UNORM | HLSL_MODIFIER_SNORM)
424#define HLSL_INTERPOLATION_MODIFIERS_MASK (HLSL_STORAGE_NOINTERPOLATION | HLSL_STORAGE_CENTROID | \
425 HLSL_STORAGE_NOPERSPECTIVE | HLSL_STORAGE_LINEAR)
427#define HLSL_MODIFIERS_MAJORITY_MASK (HLSL_MODIFIER_ROW_MAJOR | HLSL_MODIFIER_COLUMN_MAJOR)
429#define HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT 0
750#define HLSL_MAX_OPERANDS 3
1143 return ctx->profile->major_version >
major || (
ctx->profile->major_version ==
major &&
ctx->profile->minor_version >=
minor);
1283 block->value = add->value;
1362 return ctx->builtin_types.scalar[base_type];
1368 return ctx->builtin_types.vector[base_type][
dimx - 1];
1372 unsigned int dimx,
unsigned int dimy)
1374 return ctx->builtin_types.matrix[base_type][
dimx - 1][
dimy - 1];
1420 return var->reg_reservation.reg_type ==
'c' &&
var->buffer ==
ctx->globals_buffer;
1432 unsigned int index);
1453 unsigned int lhs_index,
bool single_arg,
unsigned int arg_index);
1613 unsigned int index);
1665 unsigned int storage_modifiers);
static void list_remove(struct list_entry *entry)
static void list_add_tail(struct list_entry *head, struct list_entry *entry)
static void list_init(struct list_entry *head)
size_t const element_size
static void list_move_tail(struct list_head *list, struct list_head *head)
GLuint GLuint GLsizei count
GLuint GLuint GLsizei GLenum type
GLenum GLenum GLuint components
GLuint GLuint GLuint GLuint arg1
GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg3
GLuint GLuint GLuint GLuint GLuint GLuint GLuint arg2
GLboolean GLboolean GLboolean b
GLenum const GLfloat * params
enum wined3d_data_type data_type
unsigned int hlsl_type_get_array_element_reg_size(const struct hlsl_type *type, enum hlsl_regset regset)
static void * hlsl_realloc(struct hlsl_ctx *ctx, void *ptr, size_t size)
static void hlsl_src_from_node(struct hlsl_src *src, struct hlsl_ir_node *node)
static bool hlsl_array_reserve(struct hlsl_ctx *ctx, void **elements, size_t *capacity, size_t element_count, size_t element_size)
struct hlsl_ir_var * hlsl_get_var(struct hlsl_scope *scope, const char *name)
void hlsl_lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_block *body)
bool hlsl_scope_add_type(struct hlsl_scope *scope, struct hlsl_type *type)
void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *buffer)
void void hlsl_fixme(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc, const char *fmt,...) VKD3D_PRINTF_FUNC(3
@ HLSL_CLASS_COMPUTE_SHADER
@ HLSL_CLASS_RASTERIZER_STATE
@ HLSL_CLASS_RENDER_TARGET_VIEW
@ HLSL_CLASS_VERTEX_SHADER
@ HLSL_CLASS_GEOMETRY_SHADER
@ HLSL_CLASS_DEPTH_STENCIL_VIEW
@ HLSL_CLASS_LAST_NUMERIC
@ HLSL_CLASS_CONSTANT_BUFFER
@ HLSL_CLASS_EFFECT_GROUP
@ HLSL_CLASS_PIXEL_SHADER
@ HLSL_CLASS_DOMAIN_SHADER
@ HLSL_CLASS_DEPTH_STENCIL_STATE
static char * hlsl_strdup(struct hlsl_ctx *ctx, const char *string)
@ HLSL_IR_LOOP_FORCE_UNROLL
@ HLSL_IR_LOOP_FORCE_LOOP
bool hlsl_clone_block(struct hlsl_ctx *ctx, struct hlsl_block *dst_block, const struct hlsl_block *src_block)
struct vkd3d_string_buffer * hlsl_type_to_string(struct hlsl_ctx *ctx, const struct hlsl_type *type)
static struct hlsl_type * hlsl_get_vector_type(const struct hlsl_ctx *ctx, enum hlsl_base_type base_type, unsigned int dimx)
bool hlsl_component_index_range_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, unsigned int *start, unsigned int *count)
void hlsl_dump_var_default_values(const struct hlsl_ir_var *var)
void hlsl_dump_function(struct hlsl_ctx *ctx, const struct hlsl_ir_function_decl *func)
bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2)
static void * hlsl_calloc(struct hlsl_ctx *ctx, size_t count, size_t size)
char * hlsl_sprintf_alloc(struct hlsl_ctx *ctx, const char *fmt,...) VKD3D_PRINTF_FUNC(2
struct hlsl_ir_node * hlsl_new_float_constant(struct hlsl_ctx *ctx, float f, const struct vkd3d_shader_location *loc)
bool hlsl_copy_deref(struct hlsl_ctx *ctx, struct hlsl_deref *deref, const struct hlsl_deref *other)
unsigned int hlsl_type_get_sm4_offset(const struct hlsl_type *type, unsigned int offset)
struct hlsl_ir_node * hlsl_new_sampler_state(struct hlsl_ctx *ctx, const struct hlsl_state_block *state_block, struct vkd3d_shader_location *loc)
@ HLSL_REGSET_LAST_OBJECT
static void hlsl_block_init(struct hlsl_block *block)
bool hlsl_add_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *decl, bool local_var)
@ HLSL_IR_STATEBLOCK_CONSTANT
@ HLSL_IR_VSIR_INSTRUCTION_REF
@ HLSL_IR_STRING_CONSTANT
struct hlsl_ir_function_decl * hlsl_get_first_func_decl(struct hlsl_ctx *ctx, const char *name)
bool hlsl_type_is_resource(const struct hlsl_type *type)
struct hlsl_type * hlsl_new_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format, bool rasteriser_ordered)
void hlsl_block_cleanup(struct hlsl_block *block)
bool hlsl_index_chain_has_resource_access(struct hlsl_ir_index *index)
const char * hlsl_jump_type_to_string(enum hlsl_ir_jump_type type)
struct hlsl_ir_var * hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *template, struct hlsl_type *type, const struct vkd3d_shader_location *loc)
void hlsl_add_function(struct hlsl_ctx *ctx, char *name, struct hlsl_ir_function_decl *decl)
static unsigned int hlsl_sampler_dim_count(enum hlsl_sampler_dim dim)
struct hlsl_ir_node * hlsl_new_stateblock_constant(struct hlsl_ctx *ctx, const char *name, struct vkd3d_shader_location *loc)
void void void hlsl_warning(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc, enum vkd3d_shader_error error, const char *fmt,...) VKD3D_PRINTF_FUNC(4
struct hlsl_ir_node * hlsl_new_loop(struct hlsl_ctx *ctx, struct hlsl_block *block, enum hlsl_ir_loop_unroll_type unroll_type, unsigned int unroll_limit, const struct vkd3d_shader_location *loc)
struct hlsl_ir_node * hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_type *type, const struct hlsl_constant_value *value, const struct vkd3d_shader_location *loc)
void hlsl_pop_scope(struct hlsl_ctx *ctx)
void hlsl_free_var(struct hlsl_ir_var *decl)
unsigned int hlsl_type_component_count(const struct hlsl_type *type)
struct hlsl_type * hlsl_get_type(struct hlsl_scope *scope, const char *name, bool recursive, bool case_insensitive)
bool hlsl_regset_index_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, enum hlsl_regset regset, unsigned int *index)
bool hlsl_type_is_row_major(const struct hlsl_type *type)
static struct vkd3d_string_buffer * hlsl_get_string_buffer(struct hlsl_ctx *ctx)
struct hlsl_ir_var * hlsl_new_synthetic_var_named(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type, const struct vkd3d_shader_location *loc, bool dummy_scope)
void hlsl_free_state_block_entry(struct hlsl_state_block_entry *state_block_entry)
void hlsl_free_ir_switch_case(struct hlsl_ir_switch_case *c)
struct hlsl_ir_node * hlsl_new_switch(struct hlsl_ctx *ctx, struct hlsl_ir_node *selector, struct list *cases, const struct vkd3d_shader_location *loc)
void hlsl_init_simple_deref_from_var(struct hlsl_deref *deref, struct hlsl_ir_var *var)
bool hlsl_index_is_noncontiguous(struct hlsl_ir_index *index)
static struct hlsl_type * hlsl_get_scalar_type(const struct hlsl_ctx *ctx, enum hlsl_base_type base_type)
struct hlsl_ir_node * hlsl_new_store_index(struct hlsl_ctx *ctx, const struct hlsl_deref *lhs, struct hlsl_ir_node *idx, struct hlsl_ir_node *rhs, unsigned int writemask, const struct vkd3d_shader_location *loc)
struct hlsl_ir_node * hlsl_new_int_constant(struct hlsl_ctx *ctx, int32_t n, const struct vkd3d_shader_location *loc)
bool hlsl_clone_semantic(struct hlsl_ctx *ctx, struct hlsl_semantic *dst, const struct hlsl_semantic *src)
struct hlsl_ir_node * hlsl_add_conditional(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_node *condition, struct hlsl_ir_node *if_true, struct hlsl_ir_node *if_false)
bool hlsl_offset_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, unsigned int *offset)
struct hlsl_ir_node * hlsl_new_cast(struct hlsl_ctx *ctx, struct hlsl_ir_node *node, struct hlsl_type *type, const struct vkd3d_shader_location *loc)
bool hlsl_index_is_resource_access(struct hlsl_ir_index *index)
const char * debug_hlsl_type(struct hlsl_ctx *ctx, const struct hlsl_type *type)
struct hlsl_type * hlsl_new_cb_type(struct hlsl_ctx *ctx, struct hlsl_type *format)
bool hlsl_new_store_component(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *lhs, unsigned int comp, struct hlsl_ir_node *rhs)
void hlsl_free_instr_list(struct list *list)
struct hlsl_ir_function_decl * hlsl_get_func_decl(struct hlsl_ctx *ctx, const char *name, const struct hlsl_func_parameters *parameters)
bool hlsl_validate_state_block_entry(struct hlsl_ctx *ctx, struct hlsl_state_block_entry *entry, const struct vkd3d_shader_location *loc)
uint32_t hlsl_map_swizzle(uint32_t swizzle, unsigned int writemask)
void hlsl_calculate_buffer_offsets(struct hlsl_ctx *ctx)
bool hlsl_copy_propagation_execute(struct hlsl_ctx *ctx, struct hlsl_block *block)
struct hlsl_ir_node * hlsl_new_swizzle(struct hlsl_ctx *ctx, uint32_t s, unsigned int components, struct hlsl_ir_node *val, const struct vkd3d_shader_location *loc)
#define HLSL_SWIZZLE_SHIFT(idx)
static struct hlsl_type * hlsl_get_numeric_type(const struct hlsl_ctx *ctx, enum hlsl_type_class type, enum hlsl_base_type base_type, unsigned int dimx, unsigned int dimy)
static void hlsl_block_add_instr(struct hlsl_block *block, struct hlsl_ir_node *instr)
void void void void void hlsl_push_scope(struct hlsl_ctx *ctx)
struct hlsl_ir_node * hlsl_new_unary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg, const struct vkd3d_shader_location *loc)
enum vkd3d_shader_interpolation_mode sm4_get_interpolation_mode(struct hlsl_type *type, unsigned int storage_modifiers)
bool hlsl_fold_constant_swizzles(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
void hlsl_cleanup_deref(struct hlsl_deref *deref)
static bool hlsl_var_has_buffer_offset_register_reservation(struct hlsl_ctx *ctx, const struct hlsl_ir_var *var)
void hlsl_cleanup_semantic(struct hlsl_semantic *semantic)
struct hlsl_ir_load * hlsl_new_var_load(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, const struct vkd3d_shader_location *loc)
@ HLSL_RESOURCE_GATHER_BLUE
@ HLSL_RESOURCE_SAMPLE_GRAD
@ HLSL_RESOURCE_SAMPLE_CMP
@ HLSL_RESOURCE_SAMPLE_CMP_LZ
@ HLSL_RESOURCE_SAMPLE_LOD_BIAS
@ HLSL_RESOURCE_SAMPLE_PROJ
@ HLSL_RESOURCE_SAMPLE_INFO
@ HLSL_RESOURCE_GATHER_GREEN
@ HLSL_RESOURCE_GATHER_RED
@ HLSL_RESOURCE_SAMPLE_LOD
@ HLSL_RESOURCE_GATHER_ALPHA
int tpf_compile(struct vsir_program *program, uint64_t config_flags, struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context, struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func)
struct hlsl_type * hlsl_new_struct_type(struct hlsl_ctx *ctx, const char *name, struct hlsl_struct_field *fields, size_t field_count)
void hlsl_error(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc, enum vkd3d_shader_error error, const char *fmt,...) VKD3D_PRINTF_FUNC(4
struct hlsl_buffer * hlsl_new_buffer(struct hlsl_ctx *ctx, enum hlsl_buffer_type type, const char *name, uint32_t modifiers, const struct hlsl_reg_reservation *reservation, struct hlsl_scope *annotations, const struct vkd3d_shader_location *loc)
bool hlsl_transform_ir(struct hlsl_ctx *ctx, bool(*func)(struct hlsl_ctx *ctx, struct hlsl_ir_node *, void *), struct hlsl_block *block, void *context)
struct vkd3d_string_buffer * hlsl_modifiers_to_string(struct hlsl_ctx *ctx, unsigned int modifiers)
struct hlsl_ir_node * hlsl_new_load_component(struct hlsl_ctx *ctx, struct hlsl_block *block, const struct hlsl_deref *deref, unsigned int comp, const struct vkd3d_shader_location *loc)
struct hlsl_ir_node * hlsl_new_compile(struct hlsl_ctx *ctx, enum hlsl_compile_type compile_type, const char *profile_name, struct hlsl_ir_node **args, unsigned int args_count, struct hlsl_block *args_instrs, const struct vkd3d_shader_location *loc)
unsigned int hlsl_type_element_count(const struct hlsl_type *type)
uint32_t hlsl_swizzle_from_writemask(unsigned int writemask)
struct hlsl_ir_node * hlsl_new_null_constant(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc)
struct hlsl_type * hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old, unsigned int default_majority, uint32_t modifiers)
unsigned int hlsl_type_get_component_offset(struct hlsl_ctx *ctx, struct hlsl_type *type, unsigned int index, enum hlsl_regset *regset)
struct hlsl_reg hlsl_reg_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
struct hlsl_ir_node * hlsl_new_copy(struct hlsl_ctx *ctx, struct hlsl_ir_node *node)
struct hlsl_type * hlsl_type_get_component_type(struct hlsl_ctx *ctx, struct hlsl_type *type, unsigned int index)
struct hlsl_ir_node * hlsl_new_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *operands[HLSL_MAX_OPERANDS], struct hlsl_type *data_type, const struct vkd3d_shader_location *loc)
uint32_t hlsl_combine_swizzles(uint32_t first, uint32_t second, unsigned int dim)
const struct hlsl_type * hlsl_get_multiarray_element_type(const struct hlsl_type *type)
static void * hlsl_alloc(struct hlsl_ctx *ctx, size_t size)
static bool hlsl_is_numeric_type(const struct hlsl_type *type)
static void hlsl_block_add_block(struct hlsl_block *block, struct hlsl_block *add)
char const char * debug_hlsl_expr_op(enum hlsl_ir_expr_op op)
unsigned int hlsl_get_multiarray_size(const struct hlsl_type *type)
static bool hlsl_version_ge(const struct hlsl_ctx *ctx, unsigned int major, unsigned int minor)
bool hlsl_type_is_shader(const struct hlsl_type *type)
void void void void hlsl_note(struct hlsl_ctx *ctx, const struct vkd3d_shader_location *loc, enum vkd3d_shader_log_level level, const char *fmt,...) VKD3D_PRINTF_FUNC(4
struct hlsl_ir_node * hlsl_new_ternary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg1, struct hlsl_ir_node *arg2, struct hlsl_ir_node *arg3)
bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
struct hlsl_ir_node * hlsl_new_uint_constant(struct hlsl_ctx *ctx, unsigned int n, const struct vkd3d_shader_location *loc)
struct vkd3d_string_buffer * hlsl_component_to_string(struct hlsl_ctx *ctx, const struct hlsl_ir_var *var, unsigned int index)
D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type)
struct hlsl_ir_node * hlsl_add_load_component(struct hlsl_ctx *ctx, struct hlsl_block *block, struct hlsl_ir_node *var_instr, unsigned int comp, const struct vkd3d_shader_location *loc)
@ HLSL_SAMPLER_DIM_GENERIC
@ HLSL_SAMPLER_DIM_1DARRAY
@ HLSL_SAMPLER_DIM_CUBEARRAY
@ HLSL_SAMPLER_DIM_2DMSARRAY
@ HLSL_SAMPLER_DIM_BUFFER
@ HLSL_SAMPLER_DIM_LAST_SAMPLER
@ HLSL_SAMPLER_DIM_2DARRAY
@ HLSL_SAMPLER_DIM_RAW_BUFFER
@ HLSL_SAMPLER_DIM_COMPARISON
@ HLSL_SAMPLER_DIM_STRUCTURED_BUFFER
const char * debug_hlsl_swizzle(unsigned int swizzle, unsigned int count)
struct hlsl_type * hlsl_get_element_type_from_path_index(struct hlsl_ctx *ctx, const struct hlsl_type *type, struct hlsl_ir_node *idx)
struct hlsl_ir_node * hlsl_new_index(struct hlsl_ctx *ctx, struct hlsl_ir_node *val, struct hlsl_ir_node *idx, const struct vkd3d_shader_location *loc)
struct hlsl_type * hlsl_deref_get_type(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
void hlsl_replace_node(struct hlsl_ir_node *old, struct hlsl_ir_node *new)
struct hlsl_ir_node * hlsl_new_resource_store(struct hlsl_ctx *ctx, const struct hlsl_deref *resource, struct hlsl_ir_node *coords, struct hlsl_ir_node *value, const struct vkd3d_shader_location *loc)
const char * debug_hlsl_writemask(unsigned int writemask)
int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry_func, enum vkd3d_shader_target_type target_type, struct vkd3d_shader_code *out)
int hlsl_lexer_compile(struct hlsl_ctx *ctx, const struct vkd3d_shader_code *hlsl)
unsigned int hlsl_type_major_size(const struct hlsl_type *type)
struct hlsl_ir_node * hlsl_new_resource_load(struct hlsl_ctx *ctx, const struct hlsl_resource_load_params *params, const struct vkd3d_shader_location *loc)
const char * hlsl_node_type_to_string(enum hlsl_ir_node_type type)
unsigned int hlsl_offset_from_deref_safe(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
static bool hlsl_deref_is_lowered(const struct hlsl_deref *deref)
unsigned int hlsl_combine_writemasks(unsigned int first, unsigned int second)
struct hlsl_ir_function_decl * hlsl_new_func_decl(struct hlsl_ctx *ctx, struct hlsl_type *return_type, const struct hlsl_func_parameters *parameters, const struct hlsl_semantic *semantic, const struct vkd3d_shader_location *loc)
struct hlsl_type * hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim dim, struct hlsl_type *format, unsigned int sample_count)
static void hlsl_src_remove(struct hlsl_src *src)
struct hlsl_type * hlsl_new_array_type(struct hlsl_ctx *ctx, struct hlsl_type *basic_type, unsigned int array_size)
const struct hlsl_profile_info * hlsl_get_target_info(const char *target)
struct hlsl_ir_node * hlsl_new_binary_expr(struct hlsl_ctx *ctx, enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg1, struct hlsl_ir_node *arg2)
struct hlsl_ir_switch_case * hlsl_new_switch_case(struct hlsl_ctx *ctx, unsigned int value, bool is_default, struct hlsl_block *body, const struct vkd3d_shader_location *loc)
void hlsl_free_state_block(struct hlsl_state_block *state_block)
struct hlsl_ir_load * hlsl_new_load_index(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, struct hlsl_ir_node *idx, const struct vkd3d_shader_location *loc)
#define HLSL_MAX_OPERANDS
bool hlsl_state_block_add_entry(struct hlsl_state_block *state_block, struct hlsl_state_block_entry *entry)
struct hlsl_ir_node * hlsl_new_call(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *decl, const struct vkd3d_shader_location *loc)
static bool hlsl_version_lt(const struct hlsl_ctx *ctx, unsigned int major, unsigned int minor)
@ HLSL_OP0_RASTERIZER_SAMPLE_COUNT
static uint32_t vsir_swizzle_from_hlsl(uint32_t swizzle)
bool hlsl_init_deref_from_index_chain(struct hlsl_ctx *ctx, struct hlsl_deref *deref, struct hlsl_ir_node *chain)
unsigned int hlsl_type_minor_size(const struct hlsl_type *type)
struct hlsl_ir_var * hlsl_new_var(struct hlsl_ctx *ctx, const char *name, struct hlsl_type *type, const struct vkd3d_shader_location *loc, const struct hlsl_semantic *semantic, uint32_t modifiers, const struct hlsl_reg_reservation *reg_reservation)
void hlsl_free_type(struct hlsl_type *type)
void hlsl_free_attribute(struct hlsl_attribute *attr)
int d3dbc_compile(struct vsir_program *program, uint64_t config_flags, const struct vkd3d_shader_compile_info *compile_info, const struct vkd3d_shader_code *ctab, struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context)
struct hlsl_ir_node * hlsl_new_vsir_instruction_ref(struct hlsl_ctx *ctx, unsigned int vsir_instr_idx, struct hlsl_type *type, const struct hlsl_reg *reg, const struct vkd3d_shader_location *loc)
static unsigned int hlsl_swizzle_get_component(uint32_t swizzle, unsigned int idx)
D3DXPARAMETER_CLASS hlsl_sm1_class(const struct hlsl_type *type)
@ HLSL_IR_JUMP_DISCARD_NZ
@ HLSL_IR_JUMP_UNRESOLVED_CONTINUE
@ HLSL_IR_JUMP_DISCARD_NEG
static void hlsl_release_string_buffer(struct hlsl_ctx *ctx, struct vkd3d_string_buffer *buffer)
enum hlsl_regset hlsl_deref_get_regset(struct hlsl_ctx *ctx, const struct hlsl_deref *deref)
struct hlsl_ir_function * hlsl_get_function(struct hlsl_ctx *ctx, const char *name)
struct hlsl_ir_node * hlsl_new_jump(struct hlsl_ctx *ctx, enum hlsl_ir_jump_type type, struct hlsl_ir_node *condition, const struct vkd3d_shader_location *loc)
int hlsl_emit_effect_binary(struct hlsl_ctx *ctx, struct vkd3d_shader_code *out)
void hlsl_run_const_passes(struct hlsl_ctx *ctx, struct hlsl_block *body)
void hlsl_free_instr(struct hlsl_ir_node *node)
#define HLSL_SWIZZLE_MASK
struct hlsl_ir_function_decl * hlsl_compile_internal_function(struct hlsl_ctx *ctx, const char *name, const char *hlsl)
struct hlsl_ir_node * hlsl_new_if(struct hlsl_ctx *ctx, struct hlsl_ir_node *condition, struct hlsl_block *then_block, struct hlsl_block *else_block, const struct vkd3d_shader_location *loc)
static struct hlsl_type * hlsl_get_matrix_type(const struct hlsl_ctx *ctx, enum hlsl_base_type base_type, unsigned int dimx, unsigned int dimy)
struct hlsl_ir_node * hlsl_new_string_constant(struct hlsl_ctx *ctx, const char *str, const struct vkd3d_shader_location *loc)
bool hlsl_fold_constant_identities(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
void hlsl_cleanup_ir_switch_cases(struct list *cases)
struct hlsl_state_block_entry * clone_stateblock_entry(struct hlsl_ctx *ctx, const struct hlsl_state_block_entry *src, const char *name, bool lhs_has_index, unsigned int lhs_index, bool single_arg, unsigned int arg_index)
struct hlsl_ir_node * hlsl_new_bool_constant(struct hlsl_ctx *ctx, bool b, const struct vkd3d_shader_location *loc)
struct hlsl_ir_node * hlsl_new_simple_store(struct hlsl_ctx *ctx, struct hlsl_ir_var *lhs, struct hlsl_ir_node *rhs)
struct hlsl_ir_load * hlsl_new_load_parent(struct hlsl_ctx *ctx, const struct hlsl_deref *deref, const struct vkd3d_shader_location *loc)
#define cmp(status, error)
static ULONG ** element_count
static const char * target_type(DWORD dwType)
static const void * body(MD5_CTX *ctx, const void *data, unsigned long size)
struct vkd3d_shader_location loc
struct hlsl_ir_node * value
struct hlsl_reg_reservation reservation
enum hlsl_buffer_type type
bool manually_packed_elements
bool automatically_packed_elements
struct vkd3d_shader_location loc
struct hlsl_scope * annotations
struct vkd3d_shader_location loc
struct hlsl_ctx::hlsl_constant_defs::hlsl_constant_register * regs
struct hlsl_scope * globals
struct hlsl_ir_node * error_instr
struct hlsl_type * scalar[HLSL_TYPE_LAST_SCALAR+1]
unsigned int source_files_count
struct hlsl_scope * dummy_scope
struct hlsl_reg d3dsincosconst1 d3dsincosconst2
struct hlsl_ir_function_decl * patch_constant_func
enum vkd3d_shader_tessellator_output_primitive output_primitive
bool double_as_float_alias
struct hlsl_type * string
enum vkd3d_tessellator_domain domain
const struct hlsl_ir_function_decl * cur_function
struct vkd3d_shader_message_context * message_context
const char ** source_files
unsigned int matrix_majority
bool warn_implicit_truncation
bool include_empty_buffers
struct hlsl_ctx::hlsl_constant_defs constant_defs
unsigned int internal_name_counter
const struct hlsl_profile_info * profile
bool semantic_compat_mapping
enum vkd3d_shader_tessellator_partitioning partitioning
struct hlsl_buffer * globals_buffer
uint32_t found_numthreads
struct hlsl_ctx::@6003 builtin_types
struct hlsl_buffer * params_buffer
const char * internal_func_name
struct hlsl_block static_initializers
struct vkd3d_string_buffer_cache string_buffers
struct hlsl_scope * cur_scope
unsigned int output_control_point_count
struct hlsl_buffer * cur_buffer
struct hlsl_type * data_type
struct hlsl_src rel_offset
unsigned int const_offset
struct hlsl_ir_var ** vars
struct hlsl_ir_function_decl * decl
@ HLSL_COMPILE_TYPE_CONSTRUCTGSWITHSO
@ HLSL_COMPILE_TYPE_COMPILE
const struct hlsl_profile_info * profile
enum hlsl_ir_compile::hlsl_compile_type compile_type
union hlsl_constant_value_component u[4]
struct hlsl_ir_constant::hlsl_constant_value value
struct hlsl_src operands[HLSL_MAX_OPERANDS]
const struct hlsl_attribute *const * attrs
struct hlsl_func_parameters parameters
struct hlsl_ir_function * func
struct hlsl_ir_var * return_var
struct hlsl_ir_var * early_return_var
struct vkd3d_shader_location loc
struct hlsl_type * return_type
struct hlsl_block then_block
struct hlsl_block else_block
enum hlsl_ir_jump_type type
enum hlsl_ir_loop_unroll_type unroll_type
unsigned int unroll_limit
enum hlsl_ir_node_type type
struct hlsl_type * data_type
struct vkd3d_shader_location loc
struct hlsl_src coords lod ddx ddy cmp sample_index texel_offset
enum hlsl_sampler_dim sampling_dim
enum hlsl_resource_load_type load_type
struct hlsl_state_block * state_block
struct vkd3d_shader_location loc
union hlsl_constant_value_component number
unsigned int buffer_offset
uint32_t is_output_semantic
struct hlsl_ir_var::hlsl_default_value * default_values
uint32_t has_explicit_bind_point
struct hlsl_scope * scope
struct hlsl_semantic semantic
struct vkd3d_shader_location first_sampler_dim_loc
struct hlsl_reg_reservation reg_reservation
unsigned int bind_count[HLSL_REGSET_LAST+1]
struct hlsl_ir_var::@6002 * objects_usage[HLSL_REGSET_LAST_OBJECT+1]
struct hlsl_type * data_type
uint32_t storage_modifiers
struct vkd3d_shader_location loc
enum hlsl_sampler_dim sampler_dim
unsigned int state_block_count
struct hlsl_buffer * buffer
struct hlsl_scope * annotations
struct hlsl_state_block ** state_blocks
struct hlsl_reg regs[HLSL_REGSET_LAST+1]
size_t state_block_capacity
uint32_t is_input_semantic
uint32_t is_separated_resource
unsigned int vsir_instr_idx
unsigned int minor_version
unsigned int major_version
enum vkd3d_shader_type type
unsigned int offset_index
struct hlsl_ir_node * sample_index
struct hlsl_ir_node * ddx
struct hlsl_ir_node * lod
enum hlsl_sampler_dim sampling_dim
struct hlsl_ir_node * resource
enum hlsl_resource_load_type type
struct hlsl_ir_node * texel_offset
struct hlsl_ir_node * ddy
struct hlsl_ir_node * coords
struct hlsl_ir_node * sampler
struct hlsl_type * format
struct hlsl_ir_node * cmp
struct hlsl_scope * upper
uint32_t reported_duplicated_output_next_index
uint32_t reported_duplicated_input_incompatible_next_index
struct hlsl_ir_node * node
struct hlsl_block * instrs
struct hlsl_state_block_entry ** entries
uint32_t storage_modifiers
struct hlsl_semantic semantic
size_t name_bytecode_offset
struct vkd3d_shader_location loc
unsigned int reg_offset[HLSL_REGSET_LAST+1]
uint32_t is_minimum_precision
struct rb_entry scope_entry
unsigned int elements_count
struct hlsl_type * format
struct hlsl_type::@5997::@5998 numeric
enum hlsl_sampler_dim sampler_dim
struct hlsl_type::@5997::@6000 array
unsigned int sample_count
struct hlsl_type::@5997::@6001 resource
unsigned int reg_size[HLSL_REGSET_LAST+1]
struct hlsl_struct_field * fields
struct hlsl_type::@5997::@5999 record
#define new(TYPE, numElems)
#define CONTAINING_RECORD(address, type, field)
#define VKD3D_PRINTF_FUNC(fmt, args)
#define vkd3d_unreachable()
#define VKD3D_ASSERT(cond)
static void * vkd3d_calloc(size_t count, size_t size)
static char * vkd3d_strdup(const char *string)
static void * vkd3d_realloc(void *ptr, size_t size)
bool vkd3d_array_reserve(void **elements, size_t *capacity, size_t element_count, size_t element_size)
static uint32_t vkd3d_shader_create_swizzle(enum vkd3d_shader_swizzle_component x, enum vkd3d_shader_swizzle_component y, enum vkd3d_shader_swizzle_component z, enum vkd3d_shader_swizzle_component w)
vkd3d_shader_tessellator_output_primitive
vkd3d_shader_tessellator_partitioning
struct vkd3d_string_buffer * vkd3d_string_buffer_get(struct vkd3d_string_buffer_cache *cache)
void vkd3d_string_buffer_release(struct vkd3d_string_buffer_cache *cache, struct vkd3d_string_buffer *buffer)
vkd3d_shader_interpolation_mode
@ VKD3D_ERROR_OUT_OF_MEMORY
wchar_t tm const _CrtWcstime_Writes_and_advances_ptr_ count wchar_t ** out
static unsigned int block