diff --git a/libs/vkd3d-shader/d3dbc.c b/libs/vkd3d-shader/d3dbc.c index c653dd7f..24a95224 100644 --- a/libs/vkd3d-shader/d3dbc.c +++ b/libs/vkd3d-shader/d3dbc.c @@ -1540,7 +1540,7 @@ D3DXPARAMETER_TYPE hlsl_sm1_base_type(const struct hlsl_type *type) case HLSL_CLASS_SCALAR: case HLSL_CLASS_VECTOR: case HLSL_CLASS_MATRIX: - switch (type->base_type) + switch (type->e.numeric.type) { case HLSL_TYPE_BOOL: return D3DXPT_BOOL; @@ -2015,11 +2015,11 @@ static void write_sm1_cast(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b /* Narrowing casts were already lowered. */ assert(src_type->dimx == dst_type->dimx); - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_HALF: case HLSL_TYPE_FLOAT: - switch (src_type->base_type) + switch (src_type->e.numeric.type) { case HLSL_TYPE_INT: case HLSL_TYPE_UINT: @@ -2041,7 +2041,7 @@ static void write_sm1_cast(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b case HLSL_TYPE_INT: case HLSL_TYPE_UINT: - switch(src_type->base_type) + switch(src_type->e.numeric.type) { case HLSL_TYPE_HALF: case HLSL_TYPE_FLOAT: @@ -2303,7 +2303,7 @@ static void write_sm1_expr(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b return; } - if (instr->data_type->base_type != HLSL_TYPE_FLOAT) + if (instr->data_type->e.numeric.type != HLSL_TYPE_FLOAT) { /* These need to be lowered. */ hlsl_fixme(ctx, &instr->loc, "SM1 non-float expression."); diff --git a/libs/vkd3d-shader/fx.c b/libs/vkd3d-shader/fx.c index d7adb15f..fae9d791 100644 --- a/libs/vkd3d-shader/fx.c +++ b/libs/vkd3d-shader/fx.c @@ -326,16 +326,16 @@ static uint32_t get_fx_4_numeric_type_description(const struct hlsl_type *type, return 0; } - switch (type->base_type) + switch (type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_INT: case HLSL_TYPE_UINT: case HLSL_TYPE_BOOL: - value |= (numeric_base_type[type->base_type] << NUMERIC_BASE_TYPE_SHIFT); + value |= (numeric_base_type[type->e.numeric.type] << NUMERIC_BASE_TYPE_SHIFT); break; default: - hlsl_fixme(ctx, &ctx->location, "Not implemented for base type %u.", type->base_type); + hlsl_fixme(ctx, &ctx->location, "Not implemented for base type %u.", type->e.numeric.type); return 0; } @@ -1028,7 +1028,7 @@ static void write_fx_4_object_variable(struct hlsl_ir_var *var, struct fx_write_ default: hlsl_fixme(ctx, &ctx->location, "Writing initializer for object type %u is not implemented.", - type->base_type); + type->e.numeric.type); } put_u32(buffer, 0); /* Annotations count */ diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 97da23c1..bb25e0ea 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -417,7 +417,7 @@ static struct hlsl_type *hlsl_new_type(struct hlsl_ctx *ctx, const char *name, e return NULL; } type->class = type_class; - type->base_type = base_type; + type->e.numeric.type = base_type; type->dimx = dimx; type->dimy = dimy; hlsl_type_calculate_reg_size(ctx, type); @@ -477,7 +477,7 @@ static unsigned int traverse_path_from_component_index(struct hlsl_ctx *ctx, { case HLSL_CLASS_VECTOR: assert(index < type->dimx); - *type_ptr = hlsl_get_scalar_type(ctx, type->base_type); + *type_ptr = hlsl_get_scalar_type(ctx, type->e.numeric.type); *index_ptr = 0; return index; @@ -487,7 +487,7 @@ static unsigned int traverse_path_from_component_index(struct hlsl_ctx *ctx, bool row_major = hlsl_type_is_row_major(type); assert(index < type->dimx * type->dimy); - *type_ptr = hlsl_get_vector_type(ctx, type->base_type, row_major ? type->dimx : type->dimy); + *type_ptr = hlsl_get_vector_type(ctx, type->e.numeric.type, row_major ? type->dimx : type->dimy); *index_ptr = row_major ? x : y; return row_major ? y : x; } @@ -761,13 +761,13 @@ struct hlsl_type *hlsl_get_element_type_from_path_index(struct hlsl_ctx *ctx, co switch (type->class) { case HLSL_CLASS_VECTOR: - return hlsl_get_scalar_type(ctx, type->base_type); + return hlsl_get_scalar_type(ctx, type->e.numeric.type); case HLSL_CLASS_MATRIX: if (hlsl_type_is_row_major(type)) - return hlsl_get_vector_type(ctx, type->base_type, type->dimx); + return hlsl_get_vector_type(ctx, type->e.numeric.type, type->dimx); else - return hlsl_get_vector_type(ctx, type->base_type, type->dimy); + return hlsl_get_vector_type(ctx, type->e.numeric.type, type->dimy); case HLSL_CLASS_ARRAY: return type->e.array.type; @@ -985,7 +985,7 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2 case HLSL_CLASS_SCALAR: case HLSL_CLASS_VECTOR: case HLSL_CLASS_MATRIX: - if (t1->base_type != t2->base_type) + if (t1->e.numeric.type != t2->e.numeric.type) return false; if ((t1->modifiers & HLSL_MODIFIER_ROW_MAJOR) != (t2->modifiers & HLSL_MODIFIER_ROW_MAJOR)) @@ -1066,7 +1066,6 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old, } } type->class = old->class; - type->base_type = old->base_type; type->dimx = old->dimx; type->dimy = old->dimy; type->modifiers = old->modifiers | modifiers; @@ -1078,6 +1077,12 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old, switch (old->class) { + case HLSL_CLASS_SCALAR: + case HLSL_CLASS_VECTOR: + case HLSL_CLASS_MATRIX: + type->e.numeric.type = old->e.numeric.type; + break; + case HLSL_CLASS_ARRAY: if (!(type->e.array.type = hlsl_type_clone(ctx, old->e.array.type, default_majority, modifiers))) { @@ -1665,10 +1670,11 @@ struct hlsl_ir_node *hlsl_new_swizzle(struct hlsl_ctx *ctx, uint32_t s, unsigned if (!(swizzle = hlsl_alloc(ctx, sizeof(*swizzle)))) return NULL; + assert(hlsl_is_numeric_type(val->data_type)); if (components == 1) - type = hlsl_get_scalar_type(ctx, val->data_type->base_type); + type = hlsl_get_scalar_type(ctx, val->data_type->e.numeric.type); else - type = hlsl_get_vector_type(ctx, val->data_type->base_type, components); + type = hlsl_get_vector_type(ctx, val->data_type->e.numeric.type, components); init_node(&swizzle->node, HLSL_IR_SWIZZLE, type, loc); hlsl_src_from_node(&swizzle->val, val); swizzle->swizzle = s; @@ -1731,7 +1737,7 @@ struct hlsl_ir_node *hlsl_new_index(struct hlsl_ctx *ctx, struct hlsl_ir_node *v if (type->class == HLSL_CLASS_TEXTURE || type->class == HLSL_CLASS_UAV) type = type->e.resource.format; else if (type->class == HLSL_CLASS_MATRIX) - type = hlsl_get_vector_type(ctx, type->base_type, type->dimx); + type = hlsl_get_vector_type(ctx, type->e.numeric.type, type->dimx); else type = hlsl_get_element_type_from_path_index(ctx, type, idx); @@ -2317,18 +2323,18 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru switch (type->class) { case HLSL_CLASS_SCALAR: - assert(type->base_type < ARRAY_SIZE(base_types)); - vkd3d_string_buffer_printf(string, "%s", base_types[type->base_type]); + assert(type->e.numeric.type < ARRAY_SIZE(base_types)); + vkd3d_string_buffer_printf(string, "%s", base_types[type->e.numeric.type]); return string; case HLSL_CLASS_VECTOR: - assert(type->base_type < ARRAY_SIZE(base_types)); - vkd3d_string_buffer_printf(string, "%s%u", base_types[type->base_type], type->dimx); + assert(type->e.numeric.type < ARRAY_SIZE(base_types)); + vkd3d_string_buffer_printf(string, "%s%u", base_types[type->e.numeric.type], type->dimx); return string; case HLSL_CLASS_MATRIX: - assert(type->base_type < ARRAY_SIZE(base_types)); - vkd3d_string_buffer_printf(string, "%s%ux%u", base_types[type->base_type], type->dimy, type->dimx); + assert(type->e.numeric.type < ARRAY_SIZE(base_types)); + vkd3d_string_buffer_printf(string, "%s%ux%u", base_types[type->e.numeric.type], type->dimy, type->dimx); return string; case HLSL_CLASS_ARRAY: @@ -2365,7 +2371,8 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru return string; } - assert(type->e.resource.format->base_type < ARRAY_SIZE(base_types)); + assert(hlsl_is_numeric_type(type->e.resource.format)); + assert(type->e.resource.format->e.numeric.type < ARRAY_SIZE(base_types)); if (type->sampler_dim == HLSL_SAMPLER_DIM_BUFFER) { vkd3d_string_buffer_printf(string, "Buffer"); @@ -2688,7 +2695,7 @@ static void dump_ir_constant(struct vkd3d_string_buffer *buffer, const struct hl { const union hlsl_constant_value_component *value = &constant->value.u[x]; - switch (type->base_type) + switch (type->e.numeric.type) { case HLSL_TYPE_BOOL: vkd3d_string_buffer_printf(buffer, "%s ", value->u ? "true" : "false"); diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 113d1ea3..4a8e3524 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -142,9 +142,6 @@ struct hlsl_type struct rb_entry scope_entry; enum hlsl_type_class class; - /* If class is <= HLSL_CLASS_LAST_NUMERIC, then base_type is <= HLSL_TYPE_LAST_SCALAR. - * Otherwise, base_type is not used. */ - enum hlsl_base_type base_type; /* If class is HLSL_CLASS_SAMPLER, then sampler_dim is <= HLSL_SAMPLER_DIM_LAST_SAMPLER. * If class is HLSL_CLASS_TEXTURE, then sampler_dim can be any value of the enum except @@ -175,6 +172,11 @@ struct hlsl_type union { + /* Additional information if type is numeric. */ + struct + { + enum hlsl_base_type type; + } numeric; /* Additional information if type is HLSL_CLASS_STRUCT. */ struct { diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y index 930929ad..266ed50c 100644 --- a/libs/vkd3d-shader/hlsl.y +++ b/libs/vkd3d-shader/hlsl.y @@ -1352,9 +1352,6 @@ static unsigned int evaluate_static_expression_as_uint(struct hlsl_ctx *ctx, str static bool expr_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2) { - if (t1->base_type > HLSL_TYPE_LAST_SCALAR || t2->base_type > HLSL_TYPE_LAST_SCALAR) - return false; - /* Scalar vars can be converted to pretty much everything */ if ((t1->dimx == 1 && t1->dimy == 1) || (t2->dimx == 1 && t2->dimy == 1)) return true; @@ -1489,7 +1486,7 @@ static struct hlsl_ir_node *add_expr(struct hlsl_ctx *ctx, struct hlsl_block *bl struct hlsl_ir_node *load; struct hlsl_ir_var *var; - scalar_type = hlsl_get_scalar_type(ctx, type->base_type); + scalar_type = hlsl_get_scalar_type(ctx, type->e.numeric.type); if (!(var = hlsl_new_synthetic_var(ctx, "split_op", type, loc))) return NULL; @@ -1539,7 +1536,7 @@ static void check_integer_type(struct hlsl_ctx *ctx, const struct hlsl_ir_node * const struct hlsl_type *type = instr->data_type; struct vkd3d_string_buffer *string; - switch (type->base_type) + switch (type->e.numeric.type) { case HLSL_TYPE_BOOL: case HLSL_TYPE_INT: @@ -1595,7 +1592,7 @@ static struct hlsl_type *get_common_numeric_type(struct hlsl_ctx *ctx, const str if (!expr_common_shape(ctx, arg1->data_type, arg2->data_type, loc, &type, &dimx, &dimy)) return NULL; - base = expr_common_base_type(arg1->data_type->base_type, arg2->data_type->base_type); + base = expr_common_base_type(arg1->data_type->e.numeric.type, arg2->data_type->e.numeric.type); return hlsl_get_numeric_type(ctx, type, base, dimx, dimy); } @@ -1640,7 +1637,7 @@ static struct hlsl_ir_node *add_binary_comparison_expr(struct hlsl_ctx *ctx, str if (!expr_common_shape(ctx, arg1->data_type, arg2->data_type, loc, &type, &dimx, &dimy)) return NULL; - base = expr_common_base_type(arg1->data_type->base_type, arg2->data_type->base_type); + base = expr_common_base_type(arg1->data_type->e.numeric.type, arg2->data_type->e.numeric.type); common_type = hlsl_get_numeric_type(ctx, type, base, dimx, dimy); return_type = hlsl_get_numeric_type(ctx, type, HLSL_TYPE_BOOL, dimx, dimy); @@ -1680,7 +1677,7 @@ static struct hlsl_ir_node *add_binary_shift_expr(struct hlsl_ctx *ctx, struct h enum hlsl_ir_expr_op op, struct hlsl_ir_node *arg1, struct hlsl_ir_node *arg2, const struct vkd3d_shader_location *loc) { - enum hlsl_base_type base = arg1->data_type->base_type; + enum hlsl_base_type base = arg1->data_type->e.numeric.type; struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0}; struct hlsl_type *return_type, *integer_type; enum hlsl_type_class type; @@ -1710,7 +1707,7 @@ static struct hlsl_ir_node *add_binary_shift_expr(struct hlsl_ctx *ctx, struct h static struct hlsl_ir_node *add_binary_dot_expr(struct hlsl_ctx *ctx, struct hlsl_block *instrs, struct hlsl_ir_node *arg1, struct hlsl_ir_node *arg2, const struct vkd3d_shader_location *loc) { - enum hlsl_base_type base = expr_common_base_type(arg1->data_type->base_type, arg2->data_type->base_type); + enum hlsl_base_type base = expr_common_base_type(arg1->data_type->e.numeric.type, arg2->data_type->e.numeric.type); struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0}; struct hlsl_type *common_type, *ret_type; enum hlsl_ir_expr_op op; @@ -1961,7 +1958,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct hlsl_blo "Resource store expressions must write to all components."); assert(coords->data_type->class == HLSL_CLASS_VECTOR); - assert(coords->data_type->base_type == HLSL_TYPE_UINT); + assert(coords->data_type->e.numeric.type == HLSL_TYPE_UINT); assert(coords->data_type->dimx == dim_count); if (!(store = hlsl_new_resource_store(ctx, &resource_deref, coords, rhs, &lhs->loc))) @@ -2600,7 +2597,7 @@ static struct hlsl_ir_node *intrinsic_float_convert_arg(struct hlsl_ctx *ctx, { struct hlsl_type *type = arg->data_type; - if (type->base_type == HLSL_TYPE_FLOAT || type->base_type == HLSL_TYPE_HALF) + if (type->e.numeric.type == HLSL_TYPE_FLOAT || type->e.numeric.type == HLSL_TYPE_HALF) return arg; type = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_FLOAT, type->dimx, type->dimy); @@ -2627,7 +2624,7 @@ static bool convert_args(struct hlsl_ctx *ctx, const struct parse_initializer *p static struct hlsl_type *elementwise_intrinsic_get_common_type(struct hlsl_ctx *ctx, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) { - enum hlsl_base_type base = params->args[0]->data_type->base_type; + enum hlsl_base_type base = params->args[0]->data_type->e.numeric.type; bool vectors = false, matrices = false; unsigned int dimx = 4, dimy = 4; struct hlsl_type *common_type; @@ -2637,7 +2634,7 @@ static struct hlsl_type *elementwise_intrinsic_get_common_type(struct hlsl_ctx * { struct hlsl_type *arg_type = params->args[i]->data_type; - base = expr_common_base_type(base, arg_type->base_type); + base = expr_common_base_type(base, arg_type->e.numeric.type); if (arg_type->class == HLSL_CLASS_VECTOR) { @@ -2694,7 +2691,7 @@ static bool elementwise_intrinsic_float_convert_args(struct hlsl_ctx *ctx, if (!(type = elementwise_intrinsic_get_common_type(ctx, params, loc))) return false; - base_type = type->base_type == HLSL_TYPE_HALF ? HLSL_TYPE_HALF : HLSL_TYPE_FLOAT; + base_type = type->e.numeric.type == HLSL_TYPE_HALF ? HLSL_TYPE_HALF : HLSL_TYPE_FLOAT; type = hlsl_get_numeric_type(ctx, type->class, base_type, type->dimx, type->dimy); return convert_args(ctx, params, type, loc); @@ -2918,7 +2915,7 @@ static bool intrinsic_asfloat(struct hlsl_ctx *ctx, struct hlsl_type *data_type; data_type = params->args[0]->data_type; - if (data_type->base_type == HLSL_TYPE_BOOL || data_type->base_type == HLSL_TYPE_DOUBLE) + if (data_type->e.numeric.type == HLSL_TYPE_BOOL || data_type->e.numeric.type == HLSL_TYPE_DOUBLE) { struct vkd3d_string_buffer *string; @@ -2954,7 +2951,7 @@ static bool intrinsic_asuint(struct hlsl_ctx *ctx, } data_type = params->args[0]->data_type; - if (data_type->base_type == HLSL_TYPE_BOOL || data_type->base_type == HLSL_TYPE_DOUBLE) + if (data_type->e.numeric.type == HLSL_TYPE_BOOL || data_type->e.numeric.type == HLSL_TYPE_DOUBLE) { struct vkd3d_string_buffer *string; @@ -3083,7 +3080,7 @@ static bool intrinsic_cross(struct hlsl_ctx *ctx, struct hlsl_type *cast_type; enum hlsl_base_type base; - if (arg1->data_type->base_type == HLSL_TYPE_HALF && arg2->data_type->base_type == HLSL_TYPE_HALF) + if (arg1->data_type->e.numeric.type == HLSL_TYPE_HALF && arg2->data_type->e.numeric.type == HLSL_TYPE_HALF) base = HLSL_TYPE_HALF; else base = HLSL_TYPE_FLOAT; @@ -3264,7 +3261,7 @@ static bool intrinsic_determinant(struct hlsl_ctx *ctx, return hlsl_add_load_component(ctx, params->instrs, arg, 0, loc); } - typename = type->base_type == HLSL_TYPE_HALF ? "half" : "float"; + typename = type->e.numeric.type == HLSL_TYPE_HALF ? "half" : "float"; template = templates[dim]; switch (dim) @@ -3618,7 +3615,7 @@ static bool intrinsic_mul(struct hlsl_ctx *ctx, const struct parse_initializer *params, const struct vkd3d_shader_location *loc) { struct hlsl_ir_node *arg1 = params->args[0], *arg2 = params->args[1], *cast1, *cast2; - enum hlsl_base_type base = expr_common_base_type(arg1->data_type->base_type, arg2->data_type->base_type); + enum hlsl_base_type base = expr_common_base_type(arg1->data_type->e.numeric.type, arg2->data_type->e.numeric.type); struct hlsl_type *cast_type1 = arg1->data_type, *cast_type2 = arg2->data_type, *matrix_type, *ret_type; unsigned int i, j, k, vect_count = 0; struct hlsl_deref var_deref; @@ -3821,7 +3818,7 @@ static bool intrinsic_refract(struct hlsl_ctx *ctx, if (!(res_type = elementwise_intrinsic_get_common_type(ctx, &mut_params, loc))) return false; - base = expr_common_base_type(res_type->base_type, i_type->base_type); + base = expr_common_base_type(res_type->e.numeric.type, i_type->e.numeric.type); base = base == HLSL_TYPE_HALF ? HLSL_TYPE_HALF : HLSL_TYPE_FLOAT; res_type = convert_numeric_type(ctx, res_type, base); idx_type = convert_numeric_type(ctx, i_type, base); @@ -3881,7 +3878,7 @@ static bool intrinsic_sign(struct hlsl_ctx *ctx, struct hlsl_type *int_type = hlsl_get_numeric_type(ctx, arg->data_type->class, HLSL_TYPE_INT, arg->data_type->dimx, arg->data_type->dimy); - if (!(zero = hlsl_new_constant(ctx, hlsl_get_scalar_type(ctx, arg->data_type->base_type), &zero_value, loc))) + if (!(zero = hlsl_new_constant(ctx, hlsl_get_scalar_type(ctx, arg->data_type->e.numeric.type), &zero_value, loc))) return false; hlsl_block_add_instr(params->instrs, zero); @@ -4254,7 +4251,7 @@ static bool intrinsic_transpose(struct hlsl_ctx *ctx, return true; } - mat_type = hlsl_get_matrix_type(ctx, arg_type->base_type, arg_type->dimy, arg_type->dimx); + mat_type = hlsl_get_matrix_type(ctx, arg_type->e.numeric.type, arg_type->dimy, arg_type->dimx); if (!(var = hlsl_new_synthetic_var(ctx, "transpose", mat_type, loc))) return false; @@ -4550,7 +4547,7 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block, if (common_type->dimx == 1 && common_type->dimy == 1) { common_type = hlsl_get_numeric_type(ctx, cond_type->class, - common_type->base_type, cond_type->dimx, cond_type->dimy); + common_type->e.numeric.type, cond_type->dimx, cond_type->dimy); } else if (cond_type->dimx != common_type->dimx || cond_type->dimy != common_type->dimy) { @@ -4600,7 +4597,7 @@ static bool add_ternary(struct hlsl_ctx *ctx, struct hlsl_block *block, common_type = first->data_type; } - assert(cond->data_type->base_type == HLSL_TYPE_BOOL); + assert(cond->data_type->e.numeric.type == HLSL_TYPE_BOOL); args[0] = cond; args[1] = first; @@ -4923,7 +4920,7 @@ static bool add_gather_method_call(struct hlsl_ctx *ctx, struct hlsl_block *bloc hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, sampler_dim), loc))) return false; - load_params.format = hlsl_get_vector_type(ctx, object_type->e.resource.format->base_type, 4); + load_params.format = hlsl_get_vector_type(ctx, object_type->e.resource.format->e.numeric.type, 4); load_params.resource = object; load_params.sampler = params->args[0]; @@ -6582,7 +6579,7 @@ type_no_void: YYABORT; } - $$ = hlsl_type_clone(ctx, hlsl_get_vector_type(ctx, $3->base_type, $5), 0, 0); + $$ = hlsl_type_clone(ctx, hlsl_get_vector_type(ctx, $3->e.numeric.type, $5), 0, 0); $$->is_minimum_precision = $3->is_minimum_precision; } | KW_VECTOR @@ -6615,7 +6612,7 @@ type_no_void: YYABORT; } - $$ = hlsl_type_clone(ctx, hlsl_get_matrix_type(ctx, $3->base_type, $7, $5), 0, 0); + $$ = hlsl_type_clone(ctx, hlsl_get_matrix_type(ctx, $3->e.numeric.type, $7, $5), 0, 0); $$->is_minimum_precision = $3->is_minimum_precision; } | KW_MATRIX diff --git a/libs/vkd3d-shader/hlsl_codegen.c b/libs/vkd3d-shader/hlsl_codegen.c index d321b984..e0254ef4 100644 --- a/libs/vkd3d-shader/hlsl_codegen.c +++ b/libs/vkd3d-shader/hlsl_codegen.c @@ -263,8 +263,8 @@ static bool types_are_semantic_equivalent(struct hlsl_ctx *ctx, const struct hls if (type1->dimx != type2->dimx) return false; - return base_type_get_semantic_equivalent(type1->base_type) - == base_type_get_semantic_equivalent(type2->base_type); + return base_type_get_semantic_equivalent(type1->e.numeric.type) + == base_type_get_semantic_equivalent(type2->e.numeric.type); } static struct hlsl_ir_var *add_semantic_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *var, @@ -355,10 +355,10 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct hlsl_block *block, s if (!semantic->name) return; - vector_type_dst = hlsl_get_vector_type(ctx, type->base_type, hlsl_type_minor_size(type)); + vector_type_dst = hlsl_get_vector_type(ctx, type->e.numeric.type, hlsl_type_minor_size(type)); vector_type_src = vector_type_dst; if (ctx->profile->major_version < 4 && ctx->profile->type == VKD3D_SHADER_TYPE_VERTEX) - vector_type_src = hlsl_get_vector_type(ctx, type->base_type, 4); + vector_type_src = hlsl_get_vector_type(ctx, type->e.numeric.type, 4); for (i = 0; i < hlsl_type_major_size(type); ++i) { @@ -500,7 +500,7 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct hlsl_block *block, s if (!semantic->name) return; - vector_type = hlsl_get_vector_type(ctx, type->base_type, hlsl_type_minor_size(type)); + vector_type = hlsl_get_vector_type(ctx, type->e.numeric.type, hlsl_type_minor_size(type)); for (i = 0; i < hlsl_type_major_size(type); ++i) { @@ -1101,7 +1101,7 @@ static bool lower_index_loads(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, struct hlsl_ir_node *resource_load; assert(coords->data_type->class == HLSL_CLASS_VECTOR); - assert(coords->data_type->base_type == HLSL_TYPE_UINT); + assert(coords->data_type->e.numeric.type == HLSL_TYPE_UINT); assert(coords->data_type->dimx == dim_count); if (!(coords = add_zero_mipmap_level(ctx, coords, &instr->loc))) @@ -1191,7 +1191,7 @@ static bool lower_broadcasts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, s { struct hlsl_ir_node *new_cast, *swizzle; - dst_scalar_type = hlsl_get_scalar_type(ctx, dst_type->base_type); + dst_scalar_type = hlsl_get_scalar_type(ctx, dst_type->e.numeric.type); /* We need to preserve the cast since it might be doing more than just * turning the scalar into a vector. */ if (!(new_cast = hlsl_new_cast(ctx, cast->operands[0].node, dst_scalar_type, &cast->node.loc))) @@ -2065,7 +2065,7 @@ static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst src_type = expr->operands[0].node->data_type; if (hlsl_types_are_equal(src_type, dst_type) - || (src_type->base_type == dst_type->base_type && is_vec1(src_type) && is_vec1(dst_type))) + || (src_type->e.numeric.type == dst_type->e.numeric.type && is_vec1(src_type) && is_vec1(dst_type))) { hlsl_replace_node(&expr->node, expr->operands[0].node); return true; @@ -2192,7 +2192,7 @@ static bool split_matrix_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr type = rhs->data_type; if (type->class != HLSL_CLASS_MATRIX) return false; - element_type = hlsl_get_vector_type(ctx, type->base_type, hlsl_type_minor_size(type)); + element_type = hlsl_get_vector_type(ctx, type->e.numeric.type, hlsl_type_minor_size(type)); if (rhs->type != HLSL_IR_LOAD) { @@ -2229,7 +2229,7 @@ static bool lower_narrowing_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *ins { struct hlsl_ir_node *new_cast, *swizzle; - dst_vector_type = hlsl_get_vector_type(ctx, dst_type->base_type, src_type->dimx); + dst_vector_type = hlsl_get_vector_type(ctx, dst_type->e.numeric.type, src_type->dimx); /* We need to preserve the cast since it might be doing more than just * narrowing the vector. */ if (!(new_cast = hlsl_new_cast(ctx, cast->operands[0].node, dst_vector_type, &cast->node.loc))) @@ -2483,7 +2483,7 @@ static bool lower_nonconstant_vector_derefs(struct hlsl_ctx *ctx, struct hlsl_ir op = HLSL_OP2_DOT; if (type->dimx == 1) - op = type->base_type == HLSL_TYPE_BOOL ? HLSL_OP2_LOGIC_AND : HLSL_OP2_MUL; + op = type->e.numeric.type == HLSL_TYPE_BOOL ? HLSL_OP2_LOGIC_AND : HLSL_OP2_MUL; /* Note: We may be creating a DOT for bool vectors here, which we need to lower to * LOGIC_OR + LOGIC_AND. */ @@ -2677,9 +2677,9 @@ static bool lower_casts_to_int(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, return false; arg = expr->operands[0].node; - if (instr->data_type->base_type != HLSL_TYPE_INT && instr->data_type->base_type != HLSL_TYPE_UINT) + if (instr->data_type->e.numeric.type != HLSL_TYPE_INT && instr->data_type->e.numeric.type != HLSL_TYPE_UINT) return false; - if (arg->data_type->base_type != HLSL_TYPE_FLOAT && arg->data_type->base_type != HLSL_TYPE_HALF) + if (arg->data_type->e.numeric.type != HLSL_TYPE_FLOAT && arg->data_type->e.numeric.type != HLSL_TYPE_HALF) return false; if (!(floor = hlsl_new_unary_expr(ctx, HLSL_OP1_FLOOR, arg, &instr->loc))) @@ -2936,7 +2936,7 @@ static bool lower_logic_not(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, st float_type = hlsl_get_vector_type(ctx, HLSL_TYPE_FLOAT, arg->data_type->dimx); /* If this is happens, it means we failed to cast the argument to boolean somewhere. */ - assert(arg->data_type->base_type == HLSL_TYPE_BOOL); + assert(arg->data_type->e.numeric.type == HLSL_TYPE_BOOL); if (!(arg_cast = hlsl_new_cast(ctx, arg, float_type, &arg->loc))) return false; @@ -2992,7 +2992,7 @@ static bool lower_ternary(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, stru return false; } - assert(cond->data_type->base_type == HLSL_TYPE_BOOL); + assert(cond->data_type->e.numeric.type == HLSL_TYPE_BOOL); type = hlsl_get_numeric_type(ctx, instr->data_type->class, HLSL_TYPE_FLOAT, instr->data_type->dimx, instr->data_type->dimy); @@ -3286,7 +3286,7 @@ static bool lower_casts_to_bool(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr arg_type = expr->operands[0].node->data_type; if (type->class > HLSL_CLASS_VECTOR || arg_type->class > HLSL_CLASS_VECTOR) return false; - if (type->base_type != HLSL_TYPE_BOOL) + if (type->e.numeric.type != HLSL_TYPE_BOOL) return false; /* Narrowing casts should have already been lowered. */ @@ -3314,7 +3314,7 @@ struct hlsl_ir_node *hlsl_add_conditional(struct hlsl_ctx *ctx, struct hlsl_bloc assert(hlsl_types_are_equal(if_true->data_type, if_false->data_type)); - if (cond_type->base_type != HLSL_TYPE_BOOL) + if (cond_type->e.numeric.type != HLSL_TYPE_BOOL) { cond_type = hlsl_get_numeric_type(ctx, cond_type->class, HLSL_TYPE_BOOL, cond_type->dimx, cond_type->dimy); @@ -3350,7 +3350,7 @@ static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, return false; if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_VECTOR) return false; - if (type->base_type != HLSL_TYPE_INT) + if (type->e.numeric.type != HLSL_TYPE_INT) return false; utype = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_UINT, type->dimx, type->dimy); @@ -3416,7 +3416,7 @@ static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, return false; if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_VECTOR) return false; - if (type->base_type != HLSL_TYPE_INT) + if (type->e.numeric.type != HLSL_TYPE_INT) return false; utype = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_UINT, type->dimx, type->dimy); @@ -3475,7 +3475,7 @@ static bool lower_int_abs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, stru return false; if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_VECTOR) return false; - if (type->base_type != HLSL_TYPE_INT) + if (type->e.numeric.type != HLSL_TYPE_INT) return false; arg = expr->operands[0].node; @@ -3506,14 +3506,14 @@ static bool lower_int_dot(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, stru if (expr->op != HLSL_OP2_DOT) return false; - if (type->base_type == HLSL_TYPE_INT || type->base_type == HLSL_TYPE_UINT - || type->base_type == HLSL_TYPE_BOOL) + if (type->e.numeric.type == HLSL_TYPE_INT || type->e.numeric.type == HLSL_TYPE_UINT + || type->e.numeric.type == HLSL_TYPE_BOOL) { arg1 = expr->operands[0].node; arg2 = expr->operands[1].node; assert(arg1->data_type->dimx == arg2->data_type->dimx); dimx = arg1->data_type->dimx; - is_bool = type->base_type == HLSL_TYPE_BOOL; + is_bool = type->e.numeric.type == HLSL_TYPE_BOOL; if (!(mult = hlsl_new_binary_expr(ctx, is_bool ? HLSL_OP2_LOGIC_AND : HLSL_OP2_MUL, arg1, arg2))) return false; @@ -3559,7 +3559,7 @@ static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr return false; if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_VECTOR) return false; - if (type->base_type != HLSL_TYPE_FLOAT) + if (type->e.numeric.type != HLSL_TYPE_FLOAT) return false; btype = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_BOOL, type->dimx, type->dimy); @@ -3615,7 +3615,7 @@ static bool lower_nonfloat_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *inst if (instr->type != HLSL_IR_EXPR) return false; expr = hlsl_ir_expr(instr); - if (expr->op == HLSL_OP1_CAST || instr->data_type->base_type == HLSL_TYPE_FLOAT) + if (expr->op == HLSL_OP1_CAST || instr->data_type->e.numeric.type == HLSL_TYPE_FLOAT) return false; switch (expr->op) @@ -4454,7 +4454,7 @@ static void allocate_const_registers_recurse(struct hlsl_ctx *ctx, continue; value = &constant->value.u[i++]; - switch (type->base_type) + switch (type->e.numeric.type) { case HLSL_TYPE_BOOL: f = !!value->u; @@ -5047,7 +5047,7 @@ bool hlsl_component_index_range_from_deref(struct hlsl_ctx *ctx, const struct hl /* We should always have generated a cast to UINT. */ assert(path_node->data_type->class == HLSL_CLASS_SCALAR - && path_node->data_type->base_type == HLSL_TYPE_UINT); + && path_node->data_type->e.numeric.type == HLSL_TYPE_UINT); idx = hlsl_ir_constant(path_node)->value.u[0].u; @@ -5123,7 +5123,7 @@ bool hlsl_regset_index_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref /* We should always have generated a cast to UINT. */ assert(path_node->data_type->class == HLSL_CLASS_SCALAR - && path_node->data_type->base_type == HLSL_TYPE_UINT); + && path_node->data_type->e.numeric.type == HLSL_TYPE_UINT); idx = hlsl_ir_constant(path_node)->value.u[0].u; @@ -5163,7 +5163,7 @@ bool hlsl_offset_from_deref(struct hlsl_ctx *ctx, const struct hlsl_deref *deref { /* We should always have generated a cast to UINT. */ assert(offset_node->data_type->class == HLSL_CLASS_SCALAR - && offset_node->data_type->base_type == HLSL_TYPE_UINT); + && offset_node->data_type->e.numeric.type == HLSL_TYPE_UINT); assert(offset_node->type != HLSL_IR_CONSTANT); return false; } @@ -5230,7 +5230,7 @@ static void parse_numthreads_attribute(struct hlsl_ctx *ctx, const struct hlsl_a const struct hlsl_ir_constant *constant; if (type->class != HLSL_CLASS_SCALAR - || (type->base_type != HLSL_TYPE_INT && type->base_type != HLSL_TYPE_UINT)) + || (type->e.numeric.type != HLSL_TYPE_INT && type->e.numeric.type != HLSL_TYPE_UINT)) { struct vkd3d_string_buffer *string; @@ -5249,8 +5249,8 @@ static void parse_numthreads_attribute(struct hlsl_ctx *ctx, const struct hlsl_a } constant = hlsl_ir_constant(instr); - if ((type->base_type == HLSL_TYPE_INT && constant->value.u[0].i <= 0) - || (type->base_type == HLSL_TYPE_UINT && !constant->value.u[0].u)) + if ((type->e.numeric.type == HLSL_TYPE_INT && constant->value.u[0].i <= 0) + || (type->e.numeric.type == HLSL_TYPE_UINT && !constant->value.u[0].u)) hlsl_error(ctx, &instr->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_THREAD_COUNT, "Thread count must be a positive integer."); diff --git a/libs/vkd3d-shader/hlsl_constant_ops.c b/libs/vkd3d-shader/hlsl_constant_ops.c index 51f2f9cc..16015fa8 100644 --- a/libs/vkd3d-shader/hlsl_constant_ops.c +++ b/libs/vkd3d-shader/hlsl_constant_ops.c @@ -25,10 +25,10 @@ static bool fold_abs(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -116,10 +116,10 @@ static int32_t double_to_int(double x) static bool fold_bit_not(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -158,7 +158,7 @@ static bool fold_cast(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, for (k = 0; k < dst_type->dimx; ++k) { - switch (src->node.data_type->base_type) + switch (src->node.data_type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_HALF: @@ -200,7 +200,7 @@ static bool fold_cast(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, vkd3d_unreachable(); } - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_HALF: @@ -231,10 +231,10 @@ static bool fold_cast(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, static bool fold_ceil(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -257,10 +257,10 @@ static bool fold_ceil(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, static bool fold_exp2(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -283,10 +283,10 @@ static bool fold_exp2(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, static bool fold_floor(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -309,11 +309,11 @@ static bool fold_floor(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, static bool fold_fract(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; float i; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -336,10 +336,10 @@ static bool fold_fract(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, static bool fold_log2(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src, const struct vkd3d_shader_location *loc) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -381,10 +381,10 @@ static bool fold_log2(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, con static bool fold_neg(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -415,10 +415,10 @@ static bool fold_neg(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, static bool fold_not(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -439,10 +439,10 @@ static bool fold_not(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, static bool fold_rcp(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src, const struct vkd3d_shader_location *loc) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -484,10 +484,10 @@ static bool fold_rcp(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons static bool fold_rsq(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src, const struct vkd3d_shader_location *loc) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -524,10 +524,10 @@ static bool fold_rsq(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons static bool fold_sat(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -550,10 +550,10 @@ static bool fold_sat(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons static bool fold_sqrt(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src, const struct vkd3d_shader_location *loc) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src->node.data_type->base_type); + assert(type == src->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -595,11 +595,11 @@ static bool fold_sqrt(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, con static bool fold_add(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -632,11 +632,11 @@ static bool fold_add(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons static bool fold_and(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -659,11 +659,11 @@ static bool fold_and(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons static bool fold_or(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -686,11 +686,11 @@ static bool fold_or(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const static bool fold_bit_xor(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -712,11 +712,11 @@ static bool fold_bit_xor(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, static bool fold_dot(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); assert(src1->node.data_type->dimx == src2->node.data_type->dimx); dst->u[0].f = 0.0f; @@ -740,12 +740,12 @@ static bool fold_dot(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons static bool fold_dp2add(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2, const struct hlsl_ir_constant *src3) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); - assert(type == src3->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); + assert(type == src3->node.data_type->e.numeric.type); assert(src1->node.data_type->dimx == src2->node.data_type->dimx); assert(src3->node.data_type->dimx == 1); @@ -771,11 +771,11 @@ static bool fold_div(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2, const struct vkd3d_shader_location *loc) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -841,12 +841,12 @@ static bool fold_equal(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, co { unsigned int k; - assert(dst_type->base_type == HLSL_TYPE_BOOL); - assert(src1->node.data_type->base_type == src2->node.data_type->base_type); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); + assert(src1->node.data_type->e.numeric.type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { - switch (src1->node.data_type->base_type) + switch (src1->node.data_type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_HALF: @@ -877,12 +877,12 @@ static bool fold_gequal(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, c { unsigned int k; - assert(dst_type->base_type == HLSL_TYPE_BOOL); - assert(src1->node.data_type->base_type == src2->node.data_type->base_type); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); + assert(src1->node.data_type->e.numeric.type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { - switch (src1->node.data_type->base_type) + switch (src1->node.data_type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_HALF: @@ -916,12 +916,12 @@ static bool fold_less(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, con { unsigned int k; - assert(dst_type->base_type == HLSL_TYPE_BOOL); - assert(src1->node.data_type->base_type == src2->node.data_type->base_type); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); + assert(src1->node.data_type->e.numeric.type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { - switch (src1->node.data_type->base_type) + switch (src1->node.data_type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_HALF: @@ -955,14 +955,14 @@ static bool fold_lshift(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, c { unsigned int k; - assert(dst_type->base_type == src1->node.data_type->base_type); - assert(src2->node.data_type->base_type == HLSL_TYPE_INT); + assert(dst_type->e.numeric.type == src1->node.data_type->e.numeric.type); + assert(src2->node.data_type->e.numeric.type == HLSL_TYPE_INT); for (k = 0; k < dst_type->dimx; ++k) { unsigned int shift = src2->value.u[k].u % 32; - switch (src1->node.data_type->base_type) + switch (src1->node.data_type->e.numeric.type) { case HLSL_TYPE_INT: dst->u[k].i = src1->value.u[k].i << shift; @@ -983,11 +983,11 @@ static bool fold_lshift(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, c static bool fold_max(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -1021,11 +1021,11 @@ static bool fold_max(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons static bool fold_min(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -1060,11 +1060,11 @@ static bool fold_mod(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2, const struct vkd3d_shader_location *loc) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -1102,11 +1102,11 @@ static bool fold_mod(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, cons static bool fold_mul(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, const struct hlsl_type *dst_type, const struct hlsl_ir_constant *src1, const struct hlsl_ir_constant *src2) { - enum hlsl_base_type type = dst_type->base_type; + enum hlsl_base_type type = dst_type->e.numeric.type; unsigned int k; - assert(type == src1->node.data_type->base_type); - assert(type == src2->node.data_type->base_type); + assert(type == src1->node.data_type->e.numeric.type); + assert(type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { @@ -1139,12 +1139,12 @@ static bool fold_nequal(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, c { unsigned int k; - assert(dst_type->base_type == HLSL_TYPE_BOOL); - assert(src1->node.data_type->base_type == src2->node.data_type->base_type); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); + assert(src1->node.data_type->e.numeric.type == src2->node.data_type->e.numeric.type); for (k = 0; k < dst_type->dimx; ++k) { - switch (src1->node.data_type->base_type) + switch (src1->node.data_type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_HALF: @@ -1175,9 +1175,9 @@ static bool fold_ternary(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, { unsigned int k; - assert(dst_type->base_type == src2->node.data_type->base_type); - assert(dst_type->base_type == src3->node.data_type->base_type); - assert(src1->node.data_type->base_type == HLSL_TYPE_BOOL); + assert(dst_type->e.numeric.type == src2->node.data_type->e.numeric.type); + assert(dst_type->e.numeric.type == src3->node.data_type->e.numeric.type); + assert(src1->node.data_type->e.numeric.type == HLSL_TYPE_BOOL); for (k = 0; k < dst_type->dimx; ++k) dst->u[k] = src1->value.u[k].u ? src2->value.u[k] : src3->value.u[k]; @@ -1190,14 +1190,14 @@ static bool fold_rshift(struct hlsl_ctx *ctx, struct hlsl_constant_value *dst, c { unsigned int k; - assert(dst_type->base_type == src1->node.data_type->base_type); - assert(src2->node.data_type->base_type == HLSL_TYPE_INT); + assert(dst_type->e.numeric.type == src1->node.data_type->e.numeric.type); + assert(src2->node.data_type->e.numeric.type == HLSL_TYPE_INT); for (k = 0; k < dst_type->dimx; ++k) { unsigned int shift = src2->value.u[k].u % 32; - switch (src1->node.data_type->base_type) + switch (src1->node.data_type->e.numeric.type) { case HLSL_TYPE_INT: dst->u[k].i = src1->value.u[k].i >> shift; @@ -1403,7 +1403,7 @@ static bool constant_is_zero(struct hlsl_ir_constant *const_arg) for (k = 0; k < data_type->dimx; ++k) { - switch (data_type->base_type) + switch (data_type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_HALF: @@ -1437,7 +1437,7 @@ static bool constant_is_one(struct hlsl_ir_constant *const_arg) for (k = 0; k < data_type->dimx; ++k) { - switch (data_type->base_type) + switch (data_type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_HALF: diff --git a/libs/vkd3d-shader/tpf.c b/libs/vkd3d-shader/tpf.c index e24b22df..c98667de 100644 --- a/libs/vkd3d-shader/tpf.c +++ b/libs/vkd3d-shader/tpf.c @@ -2744,7 +2744,7 @@ static void write_sm4_block(const struct tpf_writer *tpf, const struct hlsl_bloc static bool type_is_integer(const struct hlsl_type *type) { - switch (type->base_type) + switch (type->e.numeric.type) { case HLSL_TYPE_BOOL: case HLSL_TYPE_INT: @@ -2933,7 +2933,7 @@ static void write_sm4_signature(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc, put_u32(&buffer, 0); /* name */ put_u32(&buffer, usage_idx); put_u32(&buffer, usage); - switch (var->data_type->base_type) + switch (var->data_type->e.numeric.type) { case HLSL_TYPE_FLOAT: case HLSL_TYPE_HALF: @@ -3026,7 +3026,7 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type) static D3D_SHADER_VARIABLE_TYPE sm4_base_type(const struct hlsl_type *type) { - switch (type->base_type) + switch (type->e.numeric.type) { case HLSL_TYPE_BOOL: return D3D_SVT_BOOL; @@ -3140,7 +3140,7 @@ static D3D_RESOURCE_RETURN_TYPE sm4_resource_format(const struct hlsl_type *type if (type->class == HLSL_CLASS_ARRAY) return sm4_resource_format(type->e.array.type); - switch (type->e.resource.format->base_type) + switch (type->e.resource.format->e.numeric.type) { case HLSL_TYPE_DOUBLE: return D3D_RETURN_TYPE_DOUBLE; @@ -4728,11 +4728,11 @@ static void write_sm4_sampleinfo(const struct tpf_writer *tpf, const struct hlsl const struct hlsl_ir_node *dst = &load->node; struct sm4_instruction instr; - assert(dst->data_type->base_type == HLSL_TYPE_UINT || dst->data_type->base_type == HLSL_TYPE_FLOAT); + assert(dst->data_type->e.numeric.type == HLSL_TYPE_UINT || dst->data_type->e.numeric.type == HLSL_TYPE_FLOAT); memset(&instr, 0, sizeof(instr)); instr.opcode = VKD3D_SM4_OP_SAMPLE_INFO; - if (dst->data_type->base_type == HLSL_TYPE_UINT) + if (dst->data_type->e.numeric.type == HLSL_TYPE_UINT) instr.extra_bits |= VKD3DSI_SAMPLE_INFO_UINT << VKD3D_SM4_INSTRUCTION_FLAGS_SHIFT; sm4_dst_from_node(&instr.dsts[0], dst); @@ -4757,11 +4757,11 @@ static void write_sm4_resinfo(const struct tpf_writer *tpf, const struct hlsl_ir return; } - assert(dst->data_type->base_type == HLSL_TYPE_UINT || dst->data_type->base_type == HLSL_TYPE_FLOAT); + assert(dst->data_type->e.numeric.type == HLSL_TYPE_UINT || dst->data_type->e.numeric.type == HLSL_TYPE_FLOAT); memset(&instr, 0, sizeof(instr)); instr.opcode = VKD3D_SM4_OP_RESINFO; - if (dst->data_type->base_type == HLSL_TYPE_UINT) + if (dst->data_type->e.numeric.type == HLSL_TYPE_UINT) instr.extra_bits |= VKD3DSI_RESINFO_UINT << VKD3D_SM4_INSTRUCTION_FLAGS_SHIFT; sm4_dst_from_node(&instr.dsts[0], dst); @@ -4776,7 +4776,7 @@ static void write_sm4_resinfo(const struct tpf_writer *tpf, const struct hlsl_ir static bool type_is_float(const struct hlsl_type *type) { - return type->base_type == HLSL_TYPE_FLOAT || type->base_type == HLSL_TYPE_HALF; + return type->e.numeric.type == HLSL_TYPE_FLOAT || type->e.numeric.type == HLSL_TYPE_HALF; } static void write_sm4_cast_from_bool(const struct tpf_writer *tpf, const struct hlsl_ir_expr *expr, @@ -4813,11 +4813,11 @@ static void write_sm4_cast(const struct tpf_writer *tpf, const struct hlsl_ir_ex /* Narrowing casts were already lowered. */ assert(src_type->dimx == dst_type->dimx); - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_HALF: case HLSL_TYPE_FLOAT: - switch (src_type->base_type) + switch (src_type->e.numeric.type) { case HLSL_TYPE_HALF: case HLSL_TYPE_FLOAT: @@ -4846,7 +4846,7 @@ static void write_sm4_cast(const struct tpf_writer *tpf, const struct hlsl_ir_ex break; case HLSL_TYPE_INT: - switch (src_type->base_type) + switch (src_type->e.numeric.type) { case HLSL_TYPE_HALF: case HLSL_TYPE_FLOAT: @@ -4872,7 +4872,7 @@ static void write_sm4_cast(const struct tpf_writer *tpf, const struct hlsl_ir_ex break; case HLSL_TYPE_UINT: - switch (src_type->base_type) + switch (src_type->e.numeric.type) { case HLSL_TYPE_HALF: case HLSL_TYPE_FLOAT: @@ -4942,7 +4942,7 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex switch (expr->op) { case HLSL_OP1_ABS: - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_unary_op(tpf, VKD3D_SM4_OP_MOV, &expr->node, arg1, VKD3DSPSM_ABS); @@ -5023,12 +5023,12 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex break; case HLSL_OP1_LOGIC_NOT: - assert(dst_type->base_type == HLSL_TYPE_BOOL); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); write_sm4_unary_op(tpf, VKD3D_SM4_OP_NOT, &expr->node, arg1, 0); break; case HLSL_OP1_NEG: - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_unary_op(tpf, VKD3D_SM4_OP_MOV, &expr->node, arg1, VKD3DSPSM_NEG); @@ -5081,7 +5081,7 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex break; case HLSL_OP2_ADD: - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_binary_op(tpf, VKD3D_SM4_OP_ADD, &expr->node, arg1, arg2); @@ -5113,7 +5113,7 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex break; case HLSL_OP2_DIV: - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_binary_op(tpf, VKD3D_SM4_OP_DIV, &expr->node, arg1, arg2); @@ -5129,7 +5129,7 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex break; case HLSL_OP2_DOT: - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_FLOAT: switch (arg1->data_type->dimx) @@ -5161,9 +5161,9 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex { const struct hlsl_type *src_type = arg1->data_type; - assert(dst_type->base_type == HLSL_TYPE_BOOL); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); - switch (src_type->base_type) + switch (src_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_binary_op(tpf, VKD3D_SM4_OP_EQ, &expr->node, arg1, arg2); @@ -5187,9 +5187,9 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex { const struct hlsl_type *src_type = arg1->data_type; - assert(dst_type->base_type == HLSL_TYPE_BOOL); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); - switch (src_type->base_type) + switch (src_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_binary_op(tpf, VKD3D_SM4_OP_GE, &expr->node, arg1, arg2); @@ -5216,9 +5216,9 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex { const struct hlsl_type *src_type = arg1->data_type; - assert(dst_type->base_type == HLSL_TYPE_BOOL); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); - switch (src_type->base_type) + switch (src_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_binary_op(tpf, VKD3D_SM4_OP_LT, &expr->node, arg1, arg2); @@ -5242,23 +5242,23 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex } case HLSL_OP2_LOGIC_AND: - assert(dst_type->base_type == HLSL_TYPE_BOOL); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); write_sm4_binary_op(tpf, VKD3D_SM4_OP_AND, &expr->node, arg1, arg2); break; case HLSL_OP2_LOGIC_OR: - assert(dst_type->base_type == HLSL_TYPE_BOOL); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); write_sm4_binary_op(tpf, VKD3D_SM4_OP_OR, &expr->node, arg1, arg2); break; case HLSL_OP2_LSHIFT: assert(type_is_integer(dst_type)); - assert(dst_type->base_type != HLSL_TYPE_BOOL); + assert(dst_type->e.numeric.type != HLSL_TYPE_BOOL); write_sm4_binary_op(tpf, VKD3D_SM4_OP_ISHL, &expr->node, arg1, arg2); break; case HLSL_OP2_MAX: - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_binary_op(tpf, VKD3D_SM4_OP_MAX, &expr->node, arg1, arg2); @@ -5278,7 +5278,7 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex break; case HLSL_OP2_MIN: - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_binary_op(tpf, VKD3D_SM4_OP_MIN, &expr->node, arg1, arg2); @@ -5298,7 +5298,7 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex break; case HLSL_OP2_MOD: - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_UINT: write_sm4_binary_op_with_two_destinations(tpf, VKD3D_SM4_OP_UDIV, &expr->node, 1, arg1, arg2); @@ -5310,7 +5310,7 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex break; case HLSL_OP2_MUL: - switch (dst_type->base_type) + switch (dst_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_binary_op(tpf, VKD3D_SM4_OP_MUL, &expr->node, arg1, arg2); @@ -5332,9 +5332,9 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex { const struct hlsl_type *src_type = arg1->data_type; - assert(dst_type->base_type == HLSL_TYPE_BOOL); + assert(dst_type->e.numeric.type == HLSL_TYPE_BOOL); - switch (src_type->base_type) + switch (src_type->e.numeric.type) { case HLSL_TYPE_FLOAT: write_sm4_binary_op(tpf, VKD3D_SM4_OP_NE, &expr->node, arg1, arg2); @@ -5356,8 +5356,8 @@ static void write_sm4_expr(const struct tpf_writer *tpf, const struct hlsl_ir_ex case HLSL_OP2_RSHIFT: assert(type_is_integer(dst_type)); - assert(dst_type->base_type != HLSL_TYPE_BOOL); - write_sm4_binary_op(tpf, dst_type->base_type == HLSL_TYPE_INT ? VKD3D_SM4_OP_ISHR : VKD3D_SM4_OP_USHR, + assert(dst_type->e.numeric.type != HLSL_TYPE_BOOL); + write_sm4_binary_op(tpf, dst_type->e.numeric.type == HLSL_TYPE_INT ? VKD3D_SM4_OP_ISHR : VKD3D_SM4_OP_USHR, &expr->node, arg1, arg2); break; @@ -5459,7 +5459,7 @@ static void write_sm4_load(const struct tpf_writer *tpf, const struct hlsl_ir_lo instr.dst_count = 1; assert(hlsl_is_numeric_type(type)); - if (type->base_type == HLSL_TYPE_BOOL && var_is_user_input(tpf->ctx, load->src.var)) + if (type->e.numeric.type == HLSL_TYPE_BOOL && var_is_user_input(tpf->ctx, load->src.var)) { struct hlsl_constant_value value;