mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-shader/hlsl: Rename the "type" field of struct hlsl_type to "class".
To be consistent with enum hlsl_type_class and HLSL_CLASS_*.
This commit is contained in:
parent
b172f4c257
commit
7a9e393ea0
Notes:
Alexandre Julliard
2023-04-03 22:08:48 +02:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Francisco Casas (@fcasas) Approved-by: Henri Verbeet (@hverbeet) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/121
@ -126,7 +126,7 @@ bool hlsl_type_is_row_major(const struct hlsl_type *type)
|
||||
|
||||
unsigned int hlsl_type_minor_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type != HLSL_CLASS_MATRIX || hlsl_type_is_row_major(type))
|
||||
if (type->class != HLSL_CLASS_MATRIX || hlsl_type_is_row_major(type))
|
||||
return type->dimx;
|
||||
else
|
||||
return type->dimy;
|
||||
@ -134,7 +134,7 @@ unsigned int hlsl_type_minor_size(const struct hlsl_type *type)
|
||||
|
||||
unsigned int hlsl_type_major_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type != HLSL_CLASS_MATRIX || hlsl_type_is_row_major(type))
|
||||
if (type->class != HLSL_CLASS_MATRIX || hlsl_type_is_row_major(type))
|
||||
return type->dimy;
|
||||
else
|
||||
return type->dimx;
|
||||
@ -142,7 +142,7 @@ unsigned int hlsl_type_major_size(const struct hlsl_type *type)
|
||||
|
||||
unsigned int hlsl_type_element_count(const struct hlsl_type *type)
|
||||
{
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_VECTOR:
|
||||
return type->dimx;
|
||||
@ -159,14 +159,14 @@ unsigned int hlsl_type_element_count(const struct hlsl_type *type)
|
||||
|
||||
static unsigned int get_array_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
return get_array_size(type->e.array.type) * type->e.array.elements_count;
|
||||
return 1;
|
||||
}
|
||||
|
||||
bool hlsl_type_is_resource(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type == HLSL_CLASS_OBJECT)
|
||||
if (type->class == HLSL_CLASS_OBJECT)
|
||||
{
|
||||
switch (type->base_type)
|
||||
{
|
||||
@ -183,10 +183,10 @@ bool hlsl_type_is_resource(const struct hlsl_type *type)
|
||||
|
||||
enum hlsl_regset hlsl_type_get_regset(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type <= HLSL_CLASS_LAST_NUMERIC)
|
||||
if (type->class <= HLSL_CLASS_LAST_NUMERIC)
|
||||
return HLSL_REGSET_NUMERIC;
|
||||
|
||||
if (type->type == HLSL_CLASS_OBJECT)
|
||||
if (type->class == HLSL_CLASS_OBJECT)
|
||||
{
|
||||
switch (type->base_type)
|
||||
{
|
||||
@ -203,7 +203,7 @@ enum hlsl_regset hlsl_type_get_regset(const struct hlsl_type *type)
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
}
|
||||
else if (type->type == HLSL_CLASS_ARRAY)
|
||||
else if (type->class == HLSL_CLASS_ARRAY)
|
||||
return hlsl_type_get_regset(type->e.array.type);
|
||||
|
||||
vkd3d_unreachable();
|
||||
@ -216,7 +216,7 @@ unsigned int hlsl_type_get_sm4_offset(const struct hlsl_type *type, unsigned int
|
||||
* (b) the type would cross a vec4 boundary; i.e. a vec3 and a
|
||||
* vec1 can be packed together, but not a vec3 and a vec2.
|
||||
*/
|
||||
if (type->type > HLSL_CLASS_LAST_NUMERIC || (offset & 3) + type->reg_size[HLSL_REGSET_NUMERIC] > 4)
|
||||
if (type->class > HLSL_CLASS_LAST_NUMERIC || (offset & 3) + type->reg_size[HLSL_REGSET_NUMERIC] > 4)
|
||||
return align(offset, 4);
|
||||
return offset;
|
||||
}
|
||||
@ -229,7 +229,7 @@ static void hlsl_type_calculate_reg_size(struct hlsl_ctx *ctx, struct hlsl_type
|
||||
for (k = 0; k <= HLSL_REGSET_LAST; ++k)
|
||||
type->reg_size[k] = 0;
|
||||
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_SCALAR:
|
||||
case HLSL_CLASS_VECTOR:
|
||||
@ -317,7 +317,7 @@ static struct hlsl_type *hlsl_new_type(struct hlsl_ctx *ctx, const char *name, e
|
||||
vkd3d_free(type);
|
||||
return NULL;
|
||||
}
|
||||
type->type = type_class;
|
||||
type->class = type_class;
|
||||
type->base_type = base_type;
|
||||
type->dimx = dimx;
|
||||
type->dimy = dimy;
|
||||
@ -330,7 +330,7 @@ static struct hlsl_type *hlsl_new_type(struct hlsl_ctx *ctx, const char *name, e
|
||||
|
||||
static bool type_is_single_component(const struct hlsl_type *type)
|
||||
{
|
||||
return type->type == HLSL_CLASS_SCALAR || type->type == HLSL_CLASS_OBJECT;
|
||||
return type->class == HLSL_CLASS_SCALAR || type->class == HLSL_CLASS_OBJECT;
|
||||
}
|
||||
|
||||
/* Given a type and a component index, this function moves one step through the path required to
|
||||
@ -349,7 +349,7 @@ static unsigned int traverse_path_from_component_index(struct hlsl_ctx *ctx,
|
||||
assert(!type_is_single_component(type));
|
||||
assert(index < hlsl_type_component_count(type));
|
||||
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_VECTOR:
|
||||
assert(index < type->dimx);
|
||||
@ -505,7 +505,7 @@ struct hlsl_type *hlsl_get_element_type_from_path_index(struct hlsl_ctx *ctx, co
|
||||
{
|
||||
assert(idx);
|
||||
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_VECTOR:
|
||||
return hlsl_get_scalar_type(ctx, type->base_type);
|
||||
@ -539,7 +539,7 @@ struct hlsl_type *hlsl_new_array_type(struct hlsl_ctx *ctx, struct hlsl_type *ba
|
||||
if (!(type = hlsl_alloc(ctx, sizeof(*type))))
|
||||
return NULL;
|
||||
|
||||
type->type = HLSL_CLASS_ARRAY;
|
||||
type->class = HLSL_CLASS_ARRAY;
|
||||
type->modifiers = basic_type->modifiers;
|
||||
type->e.array.elements_count = array_size;
|
||||
type->e.array.type = basic_type;
|
||||
@ -559,7 +559,7 @@ struct hlsl_type *hlsl_new_struct_type(struct hlsl_ctx *ctx, const char *name,
|
||||
|
||||
if (!(type = hlsl_alloc(ctx, sizeof(*type))))
|
||||
return NULL;
|
||||
type->type = HLSL_CLASS_STRUCT;
|
||||
type->class = HLSL_CLASS_STRUCT;
|
||||
type->base_type = HLSL_TYPE_VOID;
|
||||
type->name = name;
|
||||
type->dimy = 1;
|
||||
@ -579,7 +579,7 @@ struct hlsl_type *hlsl_new_texture_type(struct hlsl_ctx *ctx, enum hlsl_sampler_
|
||||
|
||||
if (!(type = hlsl_alloc(ctx, sizeof(*type))))
|
||||
return NULL;
|
||||
type->type = HLSL_CLASS_OBJECT;
|
||||
type->class = HLSL_CLASS_OBJECT;
|
||||
type->base_type = HLSL_TYPE_TEXTURE;
|
||||
type->dimx = 4;
|
||||
type->dimy = 1;
|
||||
@ -597,7 +597,7 @@ struct hlsl_type *hlsl_new_uav_type(struct hlsl_ctx *ctx, enum hlsl_sampler_dim
|
||||
|
||||
if (!(type = vkd3d_calloc(1, sizeof(*type))))
|
||||
return NULL;
|
||||
type->type = HLSL_CLASS_OBJECT;
|
||||
type->class = HLSL_CLASS_OBJECT;
|
||||
type->base_type = HLSL_TYPE_UAV;
|
||||
type->dimx = format->dimx;
|
||||
type->dimy = 1;
|
||||
@ -679,7 +679,7 @@ struct hlsl_ir_function_decl *hlsl_get_func_decl(struct hlsl_ctx *ctx, const cha
|
||||
|
||||
unsigned int hlsl_type_component_count(const struct hlsl_type *type)
|
||||
{
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_SCALAR:
|
||||
case HLSL_CLASS_VECTOR:
|
||||
@ -711,7 +711,7 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
|
||||
if (t1 == t2)
|
||||
return true;
|
||||
|
||||
if (t1->type != t2->type)
|
||||
if (t1->class != t2->class)
|
||||
return false;
|
||||
if (t1->base_type != t2->base_type)
|
||||
return false;
|
||||
@ -731,7 +731,7 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
|
||||
return false;
|
||||
if (t1->dimy != t2->dimy)
|
||||
return false;
|
||||
if (t1->type == HLSL_CLASS_STRUCT)
|
||||
if (t1->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@ -750,7 +750,7 @@ bool hlsl_types_are_equal(const struct hlsl_type *t1, const struct hlsl_type *t2
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (t1->type == HLSL_CLASS_ARRAY)
|
||||
if (t1->class == HLSL_CLASS_ARRAY)
|
||||
return t1->e.array.elements_count == t2->e.array.elements_count
|
||||
&& hlsl_types_are_equal(t1->e.array.type, t2->e.array.type);
|
||||
|
||||
@ -774,7 +774,7 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
type->type = old->type;
|
||||
type->class = old->class;
|
||||
type->base_type = old->base_type;
|
||||
type->dimx = old->dimx;
|
||||
type->dimy = old->dimy;
|
||||
@ -783,7 +783,7 @@ struct hlsl_type *hlsl_type_clone(struct hlsl_ctx *ctx, struct hlsl_type *old,
|
||||
type->modifiers |= default_majority;
|
||||
type->sampler_dim = old->sampler_dim;
|
||||
type->is_minimum_precision = old->is_minimum_precision;
|
||||
switch (old->type)
|
||||
switch (old->class)
|
||||
{
|
||||
case HLSL_CLASS_ARRAY:
|
||||
if (!(type->e.array.type = hlsl_type_clone(ctx, old->e.array.type, default_majority, modifiers)))
|
||||
@ -912,7 +912,7 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(struct hlsl_ctx *ctx, const char *tem
|
||||
|
||||
static bool type_is_single_reg(const struct hlsl_type *type)
|
||||
{
|
||||
return type->type == HLSL_CLASS_SCALAR || type->type == HLSL_CLASS_VECTOR;
|
||||
return type->class == HLSL_CLASS_SCALAR || type->class == HLSL_CLASS_VECTOR;
|
||||
}
|
||||
|
||||
bool hlsl_copy_deref(struct hlsl_ctx *ctx, struct hlsl_deref *deref, const struct hlsl_deref *other)
|
||||
@ -1052,7 +1052,7 @@ struct hlsl_ir_constant *hlsl_new_constant(struct hlsl_ctx *ctx, struct hlsl_typ
|
||||
{
|
||||
struct hlsl_ir_constant *c;
|
||||
|
||||
assert(type->type <= HLSL_CLASS_VECTOR);
|
||||
assert(type->class <= HLSL_CLASS_VECTOR);
|
||||
|
||||
if (!(c = hlsl_alloc(ctx, sizeof(*c))))
|
||||
return NULL;
|
||||
@ -1700,10 +1700,10 @@ static int compare_param_hlsl_types(const struct hlsl_type *t1, const struct hls
|
||||
{
|
||||
int r;
|
||||
|
||||
if ((r = vkd3d_u32_compare(t1->type, t2->type)))
|
||||
if ((r = vkd3d_u32_compare(t1->class, t2->class)))
|
||||
{
|
||||
if (!((t1->type == HLSL_CLASS_SCALAR && t2->type == HLSL_CLASS_VECTOR)
|
||||
|| (t1->type == HLSL_CLASS_VECTOR && t2->type == HLSL_CLASS_SCALAR)))
|
||||
if (!((t1->class == HLSL_CLASS_SCALAR && t2->class == HLSL_CLASS_VECTOR)
|
||||
|| (t1->class == HLSL_CLASS_VECTOR && t2->class == HLSL_CLASS_SCALAR)))
|
||||
return r;
|
||||
}
|
||||
if ((r = vkd3d_u32_compare(t1->base_type, t2->base_type)))
|
||||
@ -1720,7 +1720,7 @@ static int compare_param_hlsl_types(const struct hlsl_type *t1, const struct hls
|
||||
return r;
|
||||
if ((r = vkd3d_u32_compare(t1->dimy, t2->dimy)))
|
||||
return r;
|
||||
if (t1->type == HLSL_CLASS_STRUCT)
|
||||
if (t1->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@ -1740,7 +1740,7 @@ static int compare_param_hlsl_types(const struct hlsl_type *t1, const struct hls
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (t1->type == HLSL_CLASS_ARRAY)
|
||||
if (t1->class == HLSL_CLASS_ARRAY)
|
||||
{
|
||||
if ((r = vkd3d_u32_compare(t1->e.array.elements_count, t2->e.array.elements_count)))
|
||||
return r;
|
||||
@ -1791,7 +1791,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
|
||||
return string;
|
||||
}
|
||||
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_SCALAR:
|
||||
assert(type->base_type < ARRAY_SIZE(base_types));
|
||||
@ -1813,7 +1813,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
|
||||
struct vkd3d_string_buffer *inner_string;
|
||||
const struct hlsl_type *t;
|
||||
|
||||
for (t = type; t->type == HLSL_CLASS_ARRAY; t = t->e.array.type)
|
||||
for (t = type; t->class == HLSL_CLASS_ARRAY; t = t->e.array.type)
|
||||
;
|
||||
|
||||
if ((inner_string = hlsl_type_to_string(ctx, t)))
|
||||
@ -1822,7 +1822,7 @@ struct vkd3d_string_buffer *hlsl_type_to_string(struct hlsl_ctx *ctx, const stru
|
||||
hlsl_release_string_buffer(ctx, inner_string);
|
||||
}
|
||||
|
||||
for (t = type; t->type == HLSL_CLASS_ARRAY; t = t->e.array.type)
|
||||
for (t = type; t->class == HLSL_CLASS_ARRAY; t = t->e.array.type)
|
||||
{
|
||||
if (t->e.array.elements_count == HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT)
|
||||
vkd3d_string_buffer_printf(string, "[]");
|
||||
@ -2423,7 +2423,7 @@ void hlsl_free_type(struct hlsl_type *type)
|
||||
size_t i;
|
||||
|
||||
vkd3d_free((void *)type->name);
|
||||
if (type->type == HLSL_CLASS_STRUCT)
|
||||
if (type->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
for (i = 0; i < type->e.record.field_count; ++i)
|
||||
{
|
||||
|
@ -134,7 +134,7 @@ struct hlsl_type
|
||||
/* Item entry in hlsl_scope->types. hlsl_type->name is used as key (if not NULL). */
|
||||
struct rb_entry scope_entry;
|
||||
|
||||
enum hlsl_type_class type;
|
||||
enum hlsl_type_class class;
|
||||
/* If type is <= HLSL_CLASS_LAST_NUMERIC, then base_type is <= HLSL_TYPE_LAST_SCALAR.
|
||||
* If type is HLSL_CLASS_OBJECT, then base_type is > HLSL_TYPE_LAST_SCALAR.
|
||||
* Otherwise, base_type is not used. */
|
||||
|
@ -164,7 +164,7 @@ static bool hlsl_types_are_componentwise_compatible(struct hlsl_ctx *ctx, struct
|
||||
src_comp_type = hlsl_type_get_component_type(ctx, src, k);
|
||||
dst_comp_type = hlsl_type_get_component_type(ctx, dst, k);
|
||||
|
||||
if ((src_comp_type->type != HLSL_CLASS_SCALAR || dst_comp_type->type != HLSL_CLASS_SCALAR)
|
||||
if ((src_comp_type->class != HLSL_CLASS_SCALAR || dst_comp_type->class != HLSL_CLASS_SCALAR)
|
||||
&& !hlsl_types_are_equal(src_comp_type, dst_comp_type))
|
||||
return false;
|
||||
}
|
||||
@ -196,9 +196,9 @@ static bool type_contains_only_numerics(struct hlsl_type *type)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
return type_contains_only_numerics(type->e.array.type);
|
||||
if (type->type == HLSL_CLASS_STRUCT)
|
||||
if (type->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
for (i = 0; i < type->e.record.field_count; ++i)
|
||||
{
|
||||
@ -207,23 +207,23 @@ static bool type_contains_only_numerics(struct hlsl_type *type)
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return type->type <= HLSL_CLASS_LAST_NUMERIC;
|
||||
return type->class <= HLSL_CLASS_LAST_NUMERIC;
|
||||
}
|
||||
|
||||
static bool explicit_compatible_data_types(struct hlsl_ctx *ctx, struct hlsl_type *src, struct hlsl_type *dst)
|
||||
{
|
||||
if (src->type <= HLSL_CLASS_LAST_NUMERIC && src->dimx == 1 && src->dimy == 1 && type_contains_only_numerics(dst))
|
||||
if (src->class <= HLSL_CLASS_LAST_NUMERIC && src->dimx == 1 && src->dimy == 1 && type_contains_only_numerics(dst))
|
||||
return true;
|
||||
|
||||
if (src->type == HLSL_CLASS_MATRIX && dst->type == HLSL_CLASS_MATRIX
|
||||
if (src->class == HLSL_CLASS_MATRIX && dst->class == HLSL_CLASS_MATRIX
|
||||
&& src->dimx >= dst->dimx && src->dimy >= dst->dimy)
|
||||
return true;
|
||||
|
||||
if ((src->type == HLSL_CLASS_MATRIX && src->dimx > 1 && src->dimy > 1)
|
||||
if ((src->class == HLSL_CLASS_MATRIX && src->dimx > 1 && src->dimy > 1)
|
||||
&& hlsl_type_component_count(src) != hlsl_type_component_count(dst))
|
||||
return false;
|
||||
|
||||
if ((dst->type == HLSL_CLASS_MATRIX && dst->dimy > 1)
|
||||
if ((dst->class == HLSL_CLASS_MATRIX && dst->dimy > 1)
|
||||
&& hlsl_type_component_count(src) != hlsl_type_component_count(dst))
|
||||
return false;
|
||||
|
||||
@ -232,10 +232,10 @@ static bool explicit_compatible_data_types(struct hlsl_ctx *ctx, struct hlsl_typ
|
||||
|
||||
static bool implicit_compatible_data_types(struct hlsl_ctx *ctx, struct hlsl_type *src, struct hlsl_type *dst)
|
||||
{
|
||||
if ((src->type <= HLSL_CLASS_LAST_NUMERIC) != (dst->type <= HLSL_CLASS_LAST_NUMERIC))
|
||||
if ((src->class <= HLSL_CLASS_LAST_NUMERIC) != (dst->class <= HLSL_CLASS_LAST_NUMERIC))
|
||||
return false;
|
||||
|
||||
if (src->type <= HLSL_CLASS_LAST_NUMERIC)
|
||||
if (src->class <= HLSL_CLASS_LAST_NUMERIC)
|
||||
{
|
||||
/* Scalar vars can be converted to any other numeric data type */
|
||||
if (src->dimx == 1 && src->dimy == 1)
|
||||
@ -244,21 +244,21 @@ static bool implicit_compatible_data_types(struct hlsl_ctx *ctx, struct hlsl_typ
|
||||
if (dst->dimx == 1 && dst->dimy == 1)
|
||||
return true;
|
||||
|
||||
if (src->type == HLSL_CLASS_MATRIX || dst->type == HLSL_CLASS_MATRIX)
|
||||
if (src->class == HLSL_CLASS_MATRIX || dst->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
if (src->type == HLSL_CLASS_MATRIX && dst->type == HLSL_CLASS_MATRIX)
|
||||
if (src->class == HLSL_CLASS_MATRIX && dst->class == HLSL_CLASS_MATRIX)
|
||||
return src->dimx >= dst->dimx && src->dimy >= dst->dimy;
|
||||
|
||||
/* Matrix-vector conversion is apparently allowed if they have
|
||||
* the same components count, or if the matrix is 1xN or Nx1
|
||||
* and we are reducing the component count */
|
||||
if (src->type == HLSL_CLASS_VECTOR || dst->type == HLSL_CLASS_VECTOR)
|
||||
if (src->class == HLSL_CLASS_VECTOR || dst->class == HLSL_CLASS_VECTOR)
|
||||
{
|
||||
if (hlsl_type_component_count(src) == hlsl_type_component_count(dst))
|
||||
return true;
|
||||
|
||||
if ((src->type == HLSL_CLASS_VECTOR || src->dimx == 1 || src->dimy == 1) &&
|
||||
(dst->type == HLSL_CLASS_VECTOR || dst->dimx == 1 || dst->dimy == 1))
|
||||
if ((src->class == HLSL_CLASS_VECTOR || src->dimx == 1 || src->dimy == 1) &&
|
||||
(dst->class == HLSL_CLASS_VECTOR || dst->dimx == 1 || dst->dimy == 1))
|
||||
return hlsl_type_component_count(src) >= hlsl_type_component_count(dst);
|
||||
}
|
||||
|
||||
@ -285,7 +285,7 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct list *instrs,
|
||||
if (hlsl_types_are_equal(src_type, dst_type))
|
||||
return node;
|
||||
|
||||
if (src_type->type > HLSL_CLASS_VECTOR || dst_type->type > HLSL_CLASS_VECTOR)
|
||||
if (src_type->class > HLSL_CLASS_VECTOR || dst_type->class > HLSL_CLASS_VECTOR)
|
||||
{
|
||||
unsigned int src_comp_count = hlsl_type_component_count(src_type);
|
||||
unsigned int dst_comp_count = hlsl_type_component_count(dst_type);
|
||||
@ -295,9 +295,9 @@ static struct hlsl_ir_node *add_cast(struct hlsl_ctx *ctx, struct list *instrs,
|
||||
struct hlsl_ir_var *var;
|
||||
unsigned int dst_idx;
|
||||
|
||||
broadcast = src_type->type <= HLSL_CLASS_LAST_NUMERIC && src_type->dimx == 1 && src_type->dimy == 1;
|
||||
broadcast = src_type->class <= HLSL_CLASS_LAST_NUMERIC && src_type->dimx == 1 && src_type->dimy == 1;
|
||||
matrix_cast = !broadcast && dst_comp_count != src_comp_count
|
||||
&& src_type->type == HLSL_CLASS_MATRIX && dst_type->type == HLSL_CLASS_MATRIX;
|
||||
&& src_type->class == HLSL_CLASS_MATRIX && dst_type->class == HLSL_CLASS_MATRIX;
|
||||
assert(src_comp_count >= dst_comp_count || broadcast);
|
||||
if (matrix_cast)
|
||||
{
|
||||
@ -384,7 +384,7 @@ static struct hlsl_ir_node *add_implicit_conversion(struct hlsl_ctx *ctx, struct
|
||||
|
||||
if (dst_type->dimx * dst_type->dimy < src_type->dimx * src_type->dimy)
|
||||
hlsl_warning(ctx, loc, VKD3D_SHADER_WARNING_HLSL_IMPLICIT_TRUNCATION, "Implicit truncation of %s type.",
|
||||
src_type->type == HLSL_CLASS_VECTOR ? "vector" : "matrix");
|
||||
src_type->class == HLSL_CLASS_VECTOR ? "vector" : "matrix");
|
||||
|
||||
return add_cast(ctx, instrs, node, dst_type, loc);
|
||||
}
|
||||
@ -507,7 +507,7 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ctx *ctx, struct hlsl_ir_
|
||||
unsigned int i, set, swiz = 0;
|
||||
bool valid;
|
||||
|
||||
if (value->data_type->type == HLSL_CLASS_MATRIX)
|
||||
if (value->data_type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
/* Matrix swizzle */
|
||||
bool m_swizzle;
|
||||
@ -789,7 +789,7 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
|
||||
const struct hlsl_type *expr_type = array->data_type, *index_type = index->data_type;
|
||||
struct hlsl_ir_expr *cast;
|
||||
|
||||
if (expr_type->type == HLSL_CLASS_OBJECT
|
||||
if (expr_type->class == HLSL_CLASS_OBJECT
|
||||
&& (expr_type->base_type == HLSL_TYPE_TEXTURE || expr_type->base_type == HLSL_TYPE_UAV)
|
||||
&& expr_type->sampler_dim != HLSL_SAMPLER_DIM_GENERIC)
|
||||
{
|
||||
@ -799,7 +799,7 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
|
||||
struct hlsl_ir_load *object_load = hlsl_ir_load(array);
|
||||
struct hlsl_ir_resource_load *resource_load;
|
||||
|
||||
if (index_type->type > HLSL_CLASS_VECTOR || index_type->dimx != dim_count)
|
||||
if (index_type->class > HLSL_CLASS_VECTOR || index_type->dimx != dim_count)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -827,7 +827,7 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
|
||||
return true;
|
||||
}
|
||||
|
||||
if (index_type->type != HLSL_CLASS_SCALAR)
|
||||
if (index_type->class != HLSL_CLASS_SCALAR)
|
||||
{
|
||||
hlsl_error(ctx, &index->loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Array index is not scalar.");
|
||||
return false;
|
||||
@ -838,12 +838,12 @@ static bool add_array_load(struct hlsl_ctx *ctx, struct list *instrs, struct hls
|
||||
list_add_tail(instrs, &cast->node.entry);
|
||||
index = &cast->node;
|
||||
|
||||
if (expr_type->type == HLSL_CLASS_MATRIX)
|
||||
if (expr_type->class == HLSL_CLASS_MATRIX)
|
||||
return add_matrix_index(ctx, instrs, array, index, loc);
|
||||
|
||||
if (expr_type->type != HLSL_CLASS_ARRAY && expr_type->type != HLSL_CLASS_VECTOR)
|
||||
if (expr_type->class != HLSL_CLASS_ARRAY && expr_type->class != HLSL_CLASS_VECTOR)
|
||||
{
|
||||
if (expr_type->type == HLSL_CLASS_SCALAR)
|
||||
if (expr_type->class == HLSL_CLASS_SCALAR)
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_INDEX, "Scalar expressions cannot be array-indexed.");
|
||||
else
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_INDEX, "Expression cannot be array-indexed.");
|
||||
@ -877,12 +877,12 @@ static struct hlsl_type *apply_type_modifiers(struct hlsl_ctx *ctx, struct hlsl_
|
||||
|
||||
if (!(*modifiers & HLSL_MODIFIERS_MAJORITY_MASK)
|
||||
&& !(type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK)
|
||||
&& type->type == HLSL_CLASS_MATRIX)
|
||||
&& type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
if (!(default_majority = ctx->matrix_majority) && force_majority)
|
||||
default_majority = HLSL_MODIFIER_COLUMN_MAJOR;
|
||||
}
|
||||
else if (type->type != HLSL_CLASS_MATRIX && (*modifiers & HLSL_MODIFIERS_MAJORITY_MASK))
|
||||
else if (type->class != HLSL_CLASS_MATRIX && (*modifiers & HLSL_MODIFIERS_MAJORITY_MASK))
|
||||
{
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_MODIFIER,
|
||||
"'row_major' and 'column_major' modifiers are only allowed for matrices.");
|
||||
@ -923,7 +923,7 @@ static bool gen_struct_fields(struct hlsl_ctx *ctx, struct parse_fields *fields,
|
||||
struct parse_variable_def *v, *v_next;
|
||||
size_t i = 0;
|
||||
|
||||
if (type->type == HLSL_CLASS_MATRIX)
|
||||
if (type->class == HLSL_CLASS_MATRIX)
|
||||
assert(type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK);
|
||||
|
||||
memset(fields, 0, sizeof(*fields));
|
||||
@ -939,7 +939,7 @@ static bool gen_struct_fields(struct hlsl_ctx *ctx, struct parse_fields *fields,
|
||||
|
||||
field->type = type;
|
||||
|
||||
if (shader_is_sm_5_1(ctx) && type->type == HLSL_CLASS_OBJECT)
|
||||
if (shader_is_sm_5_1(ctx) && type->class == HLSL_CLASS_OBJECT)
|
||||
{
|
||||
for (k = 0; k < v->arrays.count; ++k)
|
||||
unbounded_res_array |= (v->arrays.sizes[k] == HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT);
|
||||
@ -1056,7 +1056,7 @@ static bool add_func_parameter(struct hlsl_ctx *ctx, struct hlsl_func_parameters
|
||||
{
|
||||
struct hlsl_ir_var *var;
|
||||
|
||||
if (param->type->type == HLSL_CLASS_MATRIX)
|
||||
if (param->type->class == HLSL_CLASS_MATRIX)
|
||||
assert(param->type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK);
|
||||
|
||||
if ((param->modifiers & HLSL_STORAGE_OUT) && (param->modifiers & HLSL_STORAGE_UNIFORM))
|
||||
@ -1124,7 +1124,7 @@ static struct list *make_list(struct hlsl_ctx *ctx, struct hlsl_ir_node *node)
|
||||
|
||||
static unsigned int evaluate_static_expression(struct hlsl_ir_node *node)
|
||||
{
|
||||
if (node->data_type->type != HLSL_CLASS_SCALAR)
|
||||
if (node->data_type->class != HLSL_CLASS_SCALAR)
|
||||
return 0;
|
||||
|
||||
switch (node->type)
|
||||
@ -1180,20 +1180,20 @@ static bool expr_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t
|
||||
if ((t1->dimx == 1 && t1->dimy == 1) || (t2->dimx == 1 && t2->dimy == 1))
|
||||
return true;
|
||||
|
||||
if (t1->type == HLSL_CLASS_VECTOR && t2->type == HLSL_CLASS_VECTOR)
|
||||
if (t1->class == HLSL_CLASS_VECTOR && t2->class == HLSL_CLASS_VECTOR)
|
||||
return true;
|
||||
|
||||
if (t1->type == HLSL_CLASS_MATRIX || t2->type == HLSL_CLASS_MATRIX)
|
||||
if (t1->class == HLSL_CLASS_MATRIX || t2->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
/* Matrix-vector conversion is apparently allowed if either they have the same components
|
||||
count or the matrix is nx1 or 1xn */
|
||||
if (t1->type == HLSL_CLASS_VECTOR || t2->type == HLSL_CLASS_VECTOR)
|
||||
if (t1->class == HLSL_CLASS_VECTOR || t2->class == HLSL_CLASS_VECTOR)
|
||||
{
|
||||
if (hlsl_type_component_count(t1) == hlsl_type_component_count(t2))
|
||||
return true;
|
||||
|
||||
return (t1->type == HLSL_CLASS_MATRIX && (t1->dimx == 1 || t1->dimy == 1))
|
||||
|| (t2->type == HLSL_CLASS_MATRIX && (t2->dimx == 1 || t2->dimy == 1));
|
||||
return (t1->class == HLSL_CLASS_MATRIX && (t1->dimx == 1 || t1->dimy == 1))
|
||||
|| (t2->class == HLSL_CLASS_MATRIX && (t2->dimx == 1 || t2->dimy == 1));
|
||||
}
|
||||
|
||||
/* Both matrices */
|
||||
@ -1226,7 +1226,7 @@ static enum hlsl_base_type expr_common_base_type(enum hlsl_base_type t1, enum hl
|
||||
static bool expr_common_shape(struct hlsl_ctx *ctx, struct hlsl_type *t1, struct hlsl_type *t2,
|
||||
const struct vkd3d_shader_location *loc, enum hlsl_type_class *type, unsigned int *dimx, unsigned int *dimy)
|
||||
{
|
||||
if (t1->type > HLSL_CLASS_LAST_NUMERIC)
|
||||
if (t1->class > HLSL_CLASS_LAST_NUMERIC)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -1237,7 +1237,7 @@ static bool expr_common_shape(struct hlsl_ctx *ctx, struct hlsl_type *t1, struct
|
||||
return false;
|
||||
}
|
||||
|
||||
if (t2->type > HLSL_CLASS_LAST_NUMERIC)
|
||||
if (t2->class > HLSL_CLASS_LAST_NUMERIC)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -1264,17 +1264,17 @@ static bool expr_common_shape(struct hlsl_ctx *ctx, struct hlsl_type *t1, struct
|
||||
|
||||
if (t1->dimx == 1 && t1->dimy == 1)
|
||||
{
|
||||
*type = t2->type;
|
||||
*type = t2->class;
|
||||
*dimx = t2->dimx;
|
||||
*dimy = t2->dimy;
|
||||
}
|
||||
else if (t2->dimx == 1 && t2->dimy == 1)
|
||||
{
|
||||
*type = t1->type;
|
||||
*type = t1->class;
|
||||
*dimx = t1->dimx;
|
||||
*dimy = t1->dimy;
|
||||
}
|
||||
else if (t1->type == HLSL_CLASS_MATRIX && t2->type == HLSL_CLASS_MATRIX)
|
||||
else if (t1->class == HLSL_CLASS_MATRIX && t2->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
*type = HLSL_CLASS_MATRIX;
|
||||
*dimx = min(t1->dimx, t2->dimx);
|
||||
@ -1284,13 +1284,13 @@ static bool expr_common_shape(struct hlsl_ctx *ctx, struct hlsl_type *t1, struct
|
||||
{
|
||||
if (t1->dimx * t1->dimy <= t2->dimx * t2->dimy)
|
||||
{
|
||||
*type = t1->type;
|
||||
*type = t1->class;
|
||||
*dimx = t1->dimx;
|
||||
*dimy = t1->dimy;
|
||||
}
|
||||
else
|
||||
{
|
||||
*type = t2->type;
|
||||
*type = t2->class;
|
||||
*dimx = t2->dimx;
|
||||
*dimy = t2->dimy;
|
||||
}
|
||||
@ -1306,7 +1306,7 @@ static struct hlsl_ir_node *add_expr(struct hlsl_ctx *ctx, struct list *instrs,
|
||||
struct hlsl_ir_node *expr;
|
||||
unsigned int i;
|
||||
|
||||
if (type->type == HLSL_CLASS_MATRIX)
|
||||
if (type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
struct hlsl_type *vector_type;
|
||||
struct hlsl_deref var_deref;
|
||||
@ -1407,7 +1407,7 @@ static struct hlsl_ir_node *add_unary_logical_expr(struct hlsl_ctx *ctx, struct
|
||||
struct hlsl_ir_node *args[HLSL_MAX_OPERANDS] = {0};
|
||||
struct hlsl_type *bool_type;
|
||||
|
||||
bool_type = hlsl_get_numeric_type(ctx, arg->data_type->type, HLSL_TYPE_BOOL,
|
||||
bool_type = hlsl_get_numeric_type(ctx, arg->data_type->class, HLSL_TYPE_BOOL,
|
||||
arg->data_type->dimx, arg->data_type->dimy);
|
||||
|
||||
if (!(args[0] = add_implicit_conversion(ctx, instrs, arg, bool_type, loc)))
|
||||
@ -1596,7 +1596,7 @@ static struct hlsl_ir_node *add_binary_dot_expr(struct hlsl_ctx *ctx, struct lis
|
||||
enum hlsl_ir_expr_op op;
|
||||
unsigned dim;
|
||||
|
||||
if (arg1->data_type->type == HLSL_CLASS_MATRIX)
|
||||
if (arg1->data_type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -1607,7 +1607,7 @@ static struct hlsl_ir_node *add_binary_dot_expr(struct hlsl_ctx *ctx, struct lis
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (arg2->data_type->type == HLSL_CLASS_MATRIX)
|
||||
if (arg2->data_type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -1618,9 +1618,9 @@ static struct hlsl_ir_node *add_binary_dot_expr(struct hlsl_ctx *ctx, struct lis
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (arg1->data_type->type == HLSL_CLASS_SCALAR)
|
||||
if (arg1->data_type->class == HLSL_CLASS_SCALAR)
|
||||
dim = arg2->data_type->dimx;
|
||||
else if (arg2->data_type->type == HLSL_CLASS_SCALAR)
|
||||
else if (arg2->data_type->class == HLSL_CLASS_SCALAR)
|
||||
dim = arg1->data_type->dimx;
|
||||
else
|
||||
dim = min(arg1->data_type->dimx, arg2->data_type->dimx);
|
||||
@ -1720,7 +1720,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (lhs_type->type <= HLSL_CLASS_LAST_NUMERIC)
|
||||
if (lhs_type->class <= HLSL_CLASS_LAST_NUMERIC)
|
||||
writemask = (1 << lhs_type->dimx) - 1;
|
||||
|
||||
if (!(rhs = add_implicit_conversion(ctx, instrs, rhs, lhs_type, &rhs->loc)))
|
||||
@ -1738,7 +1738,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
|
||||
struct hlsl_ir_swizzle *swizzle = hlsl_ir_swizzle(lhs), *new_swizzle;
|
||||
unsigned int width, s = swizzle->swizzle;
|
||||
|
||||
if (lhs->data_type->type == HLSL_CLASS_MATRIX)
|
||||
if (lhs->data_type->class == HLSL_CLASS_MATRIX)
|
||||
hlsl_fixme(ctx, &lhs->loc, "Matrix assignment with a writemask.");
|
||||
|
||||
if (!invert_swizzle(&s, &writemask, &width))
|
||||
@ -1774,7 +1774,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
|
||||
/* Such an lvalue was produced by an index expression. */
|
||||
assert(load->load_type == HLSL_RESOURCE_LOAD);
|
||||
resource_type = hlsl_deref_get_type(ctx, &load->resource);
|
||||
assert(resource_type->type == HLSL_CLASS_OBJECT);
|
||||
assert(resource_type->class == HLSL_CLASS_OBJECT);
|
||||
assert(resource_type->base_type == HLSL_TYPE_TEXTURE || resource_type->base_type == HLSL_TYPE_UAV);
|
||||
|
||||
if (resource_type->base_type != HLSL_TYPE_UAV)
|
||||
@ -1788,7 +1788,7 @@ static struct hlsl_ir_node *add_assignment(struct hlsl_ctx *ctx, struct list *in
|
||||
"Resource store expressions must write to all components.");
|
||||
|
||||
/* Remove the (implicit) mipmap level from the load expression. */
|
||||
assert(load->coords.node->data_type->type == HLSL_CLASS_VECTOR);
|
||||
assert(load->coords.node->data_type->class == HLSL_CLASS_VECTOR);
|
||||
assert(load->coords.node->data_type->base_type == HLSL_TYPE_UINT);
|
||||
assert(load->coords.node->data_type->dimx == dim_count + 1);
|
||||
if (!(coords = hlsl_new_swizzle(ctx, HLSL_SWIZZLE(X, Y, Z, W), dim_count, load->coords.node, &lhs->loc)))
|
||||
@ -1885,12 +1885,12 @@ static void initialize_var_components(struct hlsl_ctx *ctx, struct list *instrs,
|
||||
|
||||
static bool type_has_object_components(struct hlsl_type *type, bool must_be_in_struct)
|
||||
{
|
||||
if (type->type == HLSL_CLASS_OBJECT)
|
||||
if (type->class == HLSL_CLASS_OBJECT)
|
||||
return !must_be_in_struct;
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
return type_has_object_components(type->e.array.type, must_be_in_struct);
|
||||
|
||||
if (type->type == HLSL_CLASS_STRUCT)
|
||||
if (type->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
@ -1905,12 +1905,12 @@ static bool type_has_object_components(struct hlsl_type *type, bool must_be_in_s
|
||||
|
||||
static bool type_has_numeric_components(struct hlsl_type *type)
|
||||
{
|
||||
if (type->type <= HLSL_CLASS_LAST_NUMERIC)
|
||||
if (type->class <= HLSL_CLASS_LAST_NUMERIC)
|
||||
return true;
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
return type_has_numeric_components(type->e.array.type);
|
||||
|
||||
if (type->type == HLSL_CLASS_STRUCT)
|
||||
if (type->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
@ -1934,7 +1934,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
|
||||
struct hlsl_type *type;
|
||||
bool local = true;
|
||||
|
||||
if (basic_type->type == HLSL_CLASS_MATRIX)
|
||||
if (basic_type->class == HLSL_CLASS_MATRIX)
|
||||
assert(basic_type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK);
|
||||
|
||||
if (!(statements_list = make_empty_list(ctx)))
|
||||
@ -1966,7 +1966,7 @@ static struct list *declare_vars(struct hlsl_ctx *ctx, struct hlsl_type *basic_t
|
||||
|
||||
type = basic_type;
|
||||
|
||||
if (shader_is_sm_5_1(ctx) && type->type == HLSL_CLASS_OBJECT)
|
||||
if (shader_is_sm_5_1(ctx) && type->class == HLSL_CLASS_OBJECT)
|
||||
{
|
||||
for (i = 0; i < v->arrays.count; ++i)
|
||||
unbounded_res_array |= (v->arrays.sizes[i] == HLSL_ARRAY_ELEMENTS_COUNT_IMPLICIT);
|
||||
@ -2279,7 +2279,7 @@ static struct hlsl_ir_node *intrinsic_float_convert_arg(struct hlsl_ctx *ctx,
|
||||
if (type->base_type == HLSL_TYPE_FLOAT || type->base_type == HLSL_TYPE_HALF)
|
||||
return arg;
|
||||
|
||||
type = hlsl_get_numeric_type(ctx, type->type, HLSL_TYPE_FLOAT, type->dimx, type->dimy);
|
||||
type = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_FLOAT, type->dimx, type->dimy);
|
||||
return add_implicit_conversion(ctx, params->instrs, arg, type, loc);
|
||||
}
|
||||
|
||||
@ -2315,12 +2315,12 @@ static struct hlsl_type *elementwise_intrinsic_get_common_type(struct hlsl_ctx *
|
||||
|
||||
base = expr_common_base_type(base, arg_type->base_type);
|
||||
|
||||
if (arg_type->type == HLSL_CLASS_VECTOR)
|
||||
if (arg_type->class == HLSL_CLASS_VECTOR)
|
||||
{
|
||||
vectors = true;
|
||||
dimx = min(dimx, arg_type->dimx);
|
||||
}
|
||||
else if (arg_type->type == HLSL_CLASS_MATRIX)
|
||||
else if (arg_type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
matrices = true;
|
||||
dimx = min(dimx, arg_type->dimx);
|
||||
@ -2369,7 +2369,7 @@ static bool elementwise_intrinsic_float_convert_args(struct hlsl_ctx *ctx,
|
||||
if (!(type = elementwise_intrinsic_get_common_type(ctx, params, loc)))
|
||||
return false;
|
||||
|
||||
type = hlsl_get_numeric_type(ctx, type->type, HLSL_TYPE_FLOAT, type->dimx, type->dimy);
|
||||
type = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_FLOAT, type->dimx, type->dimy);
|
||||
|
||||
return convert_args(ctx, params, type, loc);
|
||||
}
|
||||
@ -2416,7 +2416,7 @@ static bool intrinsic_all(struct hlsl_ctx *ctx,
|
||||
static struct hlsl_type *convert_numeric_type(const struct hlsl_ctx *ctx,
|
||||
const struct hlsl_type *type, enum hlsl_base_type base_type)
|
||||
{
|
||||
return hlsl_get_numeric_type(ctx, type->type, base_type, type->dimx, type->dimy);
|
||||
return hlsl_get_numeric_type(ctx, type->class, base_type, type->dimx, type->dimy);
|
||||
}
|
||||
|
||||
static bool intrinsic_asuint(struct hlsl_ctx *ctx,
|
||||
@ -2635,7 +2635,7 @@ static bool intrinsic_length(struct hlsl_ctx *ctx,
|
||||
struct hlsl_type *type = params->args[0]->data_type;
|
||||
struct hlsl_ir_node *arg, *dot;
|
||||
|
||||
if (type->type == HLSL_CLASS_MATRIX)
|
||||
if (type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -2703,9 +2703,9 @@ static bool intrinsic_lit(struct hlsl_ctx *ctx,
|
||||
struct hlsl_ir_var *var;
|
||||
struct hlsl_block block;
|
||||
|
||||
if (params->args[0]->data_type->type != HLSL_CLASS_SCALAR
|
||||
|| params->args[1]->data_type->type != HLSL_CLASS_SCALAR
|
||||
|| params->args[2]->data_type->type != HLSL_CLASS_SCALAR)
|
||||
if (params->args[0]->data_type->class != HLSL_CLASS_SCALAR
|
||||
|| params->args[1]->data_type->class != HLSL_CLASS_SCALAR
|
||||
|| params->args[2]->data_type->class != HLSL_CLASS_SCALAR)
|
||||
{
|
||||
hlsl_error(ctx, loc, VKD3D_SHADER_ERROR_HLSL_INVALID_TYPE, "Invalid argument type.");
|
||||
return false;
|
||||
@ -2808,15 +2808,15 @@ static bool intrinsic_mul(struct hlsl_ctx *ctx,
|
||||
struct hlsl_ir_load *load;
|
||||
struct hlsl_ir_var *var;
|
||||
|
||||
if (arg1->data_type->type == HLSL_CLASS_SCALAR || arg2->data_type->type == HLSL_CLASS_SCALAR)
|
||||
if (arg1->data_type->class == HLSL_CLASS_SCALAR || arg2->data_type->class == HLSL_CLASS_SCALAR)
|
||||
return !!add_binary_arithmetic_expr(ctx, params->instrs, HLSL_OP2_MUL, arg1, arg2, loc);
|
||||
|
||||
if (arg1->data_type->type == HLSL_CLASS_VECTOR)
|
||||
if (arg1->data_type->class == HLSL_CLASS_VECTOR)
|
||||
{
|
||||
vect_count++;
|
||||
cast_type1 = hlsl_get_matrix_type(ctx, base, arg1->data_type->dimx, 1);
|
||||
}
|
||||
if (arg2->data_type->type == HLSL_CLASS_VECTOR)
|
||||
if (arg2->data_type->class == HLSL_CLASS_VECTOR)
|
||||
{
|
||||
vect_count++;
|
||||
cast_type2 = hlsl_get_matrix_type(ctx, base, 1, arg2->data_type->dimx);
|
||||
@ -2901,7 +2901,7 @@ static bool intrinsic_normalize(struct hlsl_ctx *ctx,
|
||||
struct hlsl_type *type = params->args[0]->data_type;
|
||||
struct hlsl_ir_node *dot, *rsq, *arg;
|
||||
|
||||
if (type->type == HLSL_CLASS_MATRIX)
|
||||
if (type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -3081,7 +3081,7 @@ static bool intrinsic_step(struct hlsl_ctx *ctx,
|
||||
return false;
|
||||
|
||||
type = ge->data_type;
|
||||
type = hlsl_get_numeric_type(ctx, type->type, HLSL_TYPE_FLOAT, type->dimx, type->dimy);
|
||||
type = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_FLOAT, type->dimx, type->dimy);
|
||||
return !!add_implicit_conversion(ctx, params->instrs, ge, type, loc);
|
||||
}
|
||||
|
||||
@ -3107,7 +3107,7 @@ static bool intrinsic_tex(struct hlsl_ctx *ctx, const struct parse_initializer *
|
||||
}
|
||||
|
||||
sampler_type = params->args[0]->data_type;
|
||||
if (sampler_type->type != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
|
||||
if (sampler_type->class != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
|
||||
|| (sampler_type->sampler_dim != dim && sampler_type->sampler_dim != HLSL_SAMPLER_DIM_GENERIC))
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
@ -3162,7 +3162,7 @@ static bool intrinsic_transpose(struct hlsl_ctx *ctx,
|
||||
struct hlsl_ir_var *var;
|
||||
unsigned int i, j;
|
||||
|
||||
if (arg_type->type != HLSL_CLASS_SCALAR && arg_type->type != HLSL_CLASS_MATRIX)
|
||||
if (arg_type->class != HLSL_CLASS_SCALAR && arg_type->class != HLSL_CLASS_MATRIX)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -3174,7 +3174,7 @@ static bool intrinsic_transpose(struct hlsl_ctx *ctx,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (arg_type->type == HLSL_CLASS_SCALAR)
|
||||
if (arg_type->class == HLSL_CLASS_SCALAR)
|
||||
{
|
||||
list_add_tail(params->instrs, &arg->entry);
|
||||
return true;
|
||||
@ -3360,7 +3360,7 @@ static struct list *add_call(struct hlsl_ctx *ctx, const char *name,
|
||||
|
||||
for (i = 0; i < args->args_count; ++i)
|
||||
{
|
||||
if (args->args[i]->data_type->type > HLSL_CLASS_LAST_NUMERIC)
|
||||
if (args->args[i]->data_type->class > HLSL_CLASS_LAST_NUMERIC)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -3410,7 +3410,7 @@ static struct list *add_constructor(struct hlsl_ctx *ctx, struct hlsl_type *type
|
||||
{
|
||||
struct hlsl_ir_node *arg = params->args[i];
|
||||
|
||||
if (arg->data_type->type == HLSL_CLASS_OBJECT)
|
||||
if (arg->data_type->class == HLSL_CLASS_OBJECT)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -3461,7 +3461,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
|
||||
const struct hlsl_type *object_type = object->data_type;
|
||||
struct hlsl_ir_load *object_load;
|
||||
|
||||
if (object_type->type != HLSL_CLASS_OBJECT || object_type->base_type != HLSL_TYPE_TEXTURE
|
||||
if (object_type->class != HLSL_CLASS_OBJECT || object_type->base_type != HLSL_TYPE_TEXTURE
|
||||
|| object_type->sampler_dim == HLSL_SAMPLER_DIM_GENERIC)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
@ -3546,7 +3546,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
|
||||
}
|
||||
|
||||
sampler_type = params->args[0]->data_type;
|
||||
if (sampler_type->type != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
|
||||
if (sampler_type->class != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
|
||||
|| sampler_type->sampler_dim != HLSL_SAMPLER_DIM_GENERIC)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
@ -3656,7 +3656,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
|
||||
}
|
||||
|
||||
sampler_type = params->args[0]->data_type;
|
||||
if (sampler_type->type != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
|
||||
if (sampler_type->class != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
|
||||
|| sampler_type->sampler_dim != HLSL_SAMPLER_DIM_GENERIC)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
@ -3711,7 +3711,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
|
||||
}
|
||||
|
||||
sampler_type = params->args[0]->data_type;
|
||||
if (sampler_type->type != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
|
||||
if (sampler_type->class != HLSL_CLASS_OBJECT || sampler_type->base_type != HLSL_TYPE_SAMPLER
|
||||
|| sampler_type->sampler_dim != HLSL_SAMPLER_DIM_GENERIC)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
@ -3768,7 +3768,7 @@ static bool add_method_call(struct hlsl_ctx *ctx, struct list *instrs, struct hl
|
||||
static void validate_texture_format_type(struct hlsl_ctx *ctx, struct hlsl_type *format,
|
||||
const struct vkd3d_shader_location *loc)
|
||||
{
|
||||
if (format->type > HLSL_CLASS_VECTOR)
|
||||
if (format->class > HLSL_CLASS_VECTOR)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -4640,7 +4640,7 @@ uav_type:
|
||||
type_no_void:
|
||||
KW_VECTOR '<' type ',' C_INTEGER '>'
|
||||
{
|
||||
if ($3->type != HLSL_CLASS_SCALAR)
|
||||
if ($3->class != HLSL_CLASS_SCALAR)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -4667,7 +4667,7 @@ type_no_void:
|
||||
}
|
||||
| KW_MATRIX '<' type ',' C_INTEGER ',' C_INTEGER '>'
|
||||
{
|
||||
if ($3->type != HLSL_CLASS_SCALAR)
|
||||
if ($3->class != HLSL_CLASS_SCALAR)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -4747,7 +4747,7 @@ type_no_void:
|
||||
}
|
||||
| uav_type '<' type '>'
|
||||
{
|
||||
if ($3->type > HLSL_CLASS_VECTOR)
|
||||
if ($3->class > HLSL_CLASS_VECTOR)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
@ -4779,7 +4779,7 @@ type_no_void:
|
||||
| KW_STRUCT TYPE_IDENTIFIER
|
||||
{
|
||||
$$ = hlsl_get_type(ctx->cur_scope, $2, true, true);
|
||||
if ($$->type != HLSL_CLASS_STRUCT)
|
||||
if ($$->class != HLSL_CLASS_STRUCT)
|
||||
hlsl_error(ctx, &@1, VKD3D_SHADER_ERROR_HLSL_REDEFINED, "\"%s\" redefined as a structure.", $2);
|
||||
vkd3d_free($2);
|
||||
}
|
||||
@ -5352,7 +5352,7 @@ postfix_expr:
|
||||
{
|
||||
struct hlsl_ir_node *node = node_from_list($1);
|
||||
|
||||
if (node->data_type->type == HLSL_CLASS_STRUCT)
|
||||
if (node->data_type->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
struct hlsl_type *type = node->data_type;
|
||||
const struct hlsl_struct_field *field;
|
||||
@ -5369,7 +5369,7 @@ postfix_expr:
|
||||
YYABORT;
|
||||
$$ = $1;
|
||||
}
|
||||
else if (node->data_type->type <= HLSL_CLASS_LAST_NUMERIC)
|
||||
else if (node->data_type->class <= HLSL_CLASS_LAST_NUMERIC)
|
||||
{
|
||||
struct hlsl_ir_swizzle *swizzle;
|
||||
|
||||
@ -5412,7 +5412,7 @@ postfix_expr:
|
||||
free_parse_initializer(&$4);
|
||||
YYABORT;
|
||||
}
|
||||
if ($2->type > HLSL_CLASS_LAST_NUMERIC)
|
||||
if ($2->class > HLSL_CLASS_LAST_NUMERIC)
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
|
||||
|
@ -31,7 +31,7 @@ static struct hlsl_ir_node *new_offset_from_path_index(struct hlsl_ctx *ctx, str
|
||||
|
||||
list_init(&block->instrs);
|
||||
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_VECTOR:
|
||||
idx_offset = idx;
|
||||
@ -140,7 +140,7 @@ static void replace_deref_path_with_offset(struct hlsl_ctx *ctx, struct hlsl_der
|
||||
|
||||
/* Instructions that directly refer to structs or arrays (instead of single-register components)
|
||||
* are removed later by dce. So it is not a problem to just cleanup their derefs. */
|
||||
if (type->type == HLSL_CLASS_STRUCT || type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_STRUCT || type->class == HLSL_CLASS_ARRAY)
|
||||
{
|
||||
hlsl_cleanup_deref(deref);
|
||||
return;
|
||||
@ -282,7 +282,7 @@ static void prepend_input_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
|
||||
return;
|
||||
list_add_after(&lhs->node.entry, &load->node.entry);
|
||||
|
||||
if (type->type == HLSL_CLASS_MATRIX)
|
||||
if (type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc)))
|
||||
return;
|
||||
@ -324,7 +324,7 @@ static void prepend_input_struct_copy(struct hlsl_ctx *ctx, struct list *instrs,
|
||||
return;
|
||||
list_add_after(&c->node.entry, &field_load->node.entry);
|
||||
|
||||
if (field->type->type == HLSL_CLASS_STRUCT)
|
||||
if (field->type->class == HLSL_CLASS_STRUCT)
|
||||
prepend_input_struct_copy(ctx, instrs, field_load);
|
||||
else if (field->semantic.name)
|
||||
prepend_input_copy(ctx, instrs, field_load, field->storage_modifiers, &field->semantic);
|
||||
@ -345,7 +345,7 @@ static void prepend_input_var_copy(struct hlsl_ctx *ctx, struct list *instrs, st
|
||||
return;
|
||||
list_add_head(instrs, &load->node.entry);
|
||||
|
||||
if (var->data_type->type == HLSL_CLASS_STRUCT)
|
||||
if (var->data_type->class == HLSL_CLASS_STRUCT)
|
||||
prepend_input_struct_copy(ctx, instrs, load);
|
||||
else if (var->semantic.name)
|
||||
prepend_input_copy(ctx, instrs, load, var->storage_modifiers, &var->semantic);
|
||||
@ -373,7 +373,7 @@ static void append_output_copy(struct hlsl_ctx *ctx, struct list *instrs, struct
|
||||
if (!(output = add_semantic_var(ctx, var, vector_type, modifiers, &semantic_copy, true)))
|
||||
return;
|
||||
|
||||
if (type->type == HLSL_CLASS_MATRIX)
|
||||
if (type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
if (!(c = hlsl_new_uint_constant(ctx, i, &var->loc)))
|
||||
return;
|
||||
@ -419,7 +419,7 @@ static void append_output_struct_copy(struct hlsl_ctx *ctx, struct list *instrs,
|
||||
return;
|
||||
list_add_tail(instrs, &field_load->node.entry);
|
||||
|
||||
if (field->type->type == HLSL_CLASS_STRUCT)
|
||||
if (field->type->class == HLSL_CLASS_STRUCT)
|
||||
append_output_struct_copy(ctx, instrs, field_load);
|
||||
else if (field->semantic.name)
|
||||
append_output_copy(ctx, instrs, field_load, field->storage_modifiers, &field->semantic);
|
||||
@ -441,7 +441,7 @@ static void append_output_var_copy(struct hlsl_ctx *ctx, struct list *instrs, st
|
||||
return;
|
||||
list_add_tail(instrs, &load->node.entry);
|
||||
|
||||
if (var->data_type->type == HLSL_CLASS_STRUCT)
|
||||
if (var->data_type->class == HLSL_CLASS_STRUCT)
|
||||
append_output_struct_copy(ctx, instrs, load);
|
||||
else if (var->semantic.name)
|
||||
append_output_copy(ctx, instrs, load, var->storage_modifiers, &var->semantic);
|
||||
@ -746,7 +746,7 @@ static bool lower_broadcasts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, v
|
||||
src_type = cast->operands[0].node->data_type;
|
||||
dst_type = cast->node.data_type;
|
||||
|
||||
if (src_type->type <= HLSL_CLASS_VECTOR && dst_type->type <= HLSL_CLASS_VECTOR && src_type->dimx == 1)
|
||||
if (src_type->class <= HLSL_CLASS_VECTOR && dst_type->class <= HLSL_CLASS_VECTOR && src_type->dimx == 1)
|
||||
{
|
||||
struct hlsl_ir_node *replacement;
|
||||
struct hlsl_ir_swizzle *swizzle;
|
||||
@ -949,7 +949,7 @@ static void copy_propagation_invalidate_variable_from_deref_recurse(struct hlsl_
|
||||
path_node = deref->path[depth].node;
|
||||
subtype = hlsl_get_element_type_from_path_index(ctx, type, path_node);
|
||||
|
||||
if (type->type == HLSL_CLASS_STRUCT)
|
||||
if (type->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
unsigned int idx = hlsl_ir_constant(path_node)->value[0].u;
|
||||
|
||||
@ -1041,7 +1041,7 @@ static bool copy_propagation_replace_with_single_instr(struct hlsl_ctx *ctx,
|
||||
var->name, start, start + count, debug_hlsl_swizzle(swizzle, instr_component_count),
|
||||
new_instr, debug_hlsl_swizzle(ret_swizzle, instr_component_count));
|
||||
|
||||
if (instr->data_type->type != HLSL_CLASS_OBJECT)
|
||||
if (instr->data_type->class != HLSL_CLASS_OBJECT)
|
||||
{
|
||||
struct hlsl_ir_swizzle *swizzle_node;
|
||||
|
||||
@ -1099,7 +1099,7 @@ static bool copy_propagation_transform_load(struct hlsl_ctx *ctx,
|
||||
{
|
||||
struct hlsl_type *type = load->node.data_type;
|
||||
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_SCALAR:
|
||||
case HLSL_CLASS_VECTOR:
|
||||
@ -1220,7 +1220,7 @@ static void copy_propagation_record_store(struct hlsl_ctx *ctx, struct hlsl_ir_s
|
||||
{
|
||||
unsigned int writemask = store->writemask;
|
||||
|
||||
if (store->rhs.node->data_type->type == HLSL_CLASS_OBJECT)
|
||||
if (store->rhs.node->data_type->class == HLSL_CLASS_OBJECT)
|
||||
writemask = VKD3DSP_WRITEMASK_0;
|
||||
copy_propagation_set_value(var_def, start, writemask, store->rhs.node);
|
||||
}
|
||||
@ -1471,7 +1471,7 @@ static bool validate_static_object_references(struct hlsl_ctx *ctx, struct hlsl_
|
||||
|
||||
static bool is_vec1(const struct hlsl_type *type)
|
||||
{
|
||||
return (type->type == HLSL_CLASS_SCALAR) || (type->type == HLSL_CLASS_VECTOR && type->dimx == 1);
|
||||
return (type->class == HLSL_CLASS_SCALAR) || (type->class == HLSL_CLASS_VECTOR && type->dimx == 1);
|
||||
}
|
||||
|
||||
static bool fold_redundant_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void *context)
|
||||
@ -1538,7 +1538,7 @@ static bool split_array_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
store = hlsl_ir_store(instr);
|
||||
rhs = store->rhs.node;
|
||||
type = rhs->data_type;
|
||||
if (type->type != HLSL_CLASS_ARRAY)
|
||||
if (type->class != HLSL_CLASS_ARRAY)
|
||||
return false;
|
||||
element_type = type->e.array.type;
|
||||
|
||||
@ -1575,7 +1575,7 @@ static bool split_struct_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
|
||||
store = hlsl_ir_store(instr);
|
||||
rhs = store->rhs.node;
|
||||
type = rhs->data_type;
|
||||
if (type->type != HLSL_CLASS_STRUCT)
|
||||
if (type->class != HLSL_CLASS_STRUCT)
|
||||
return false;
|
||||
|
||||
if (rhs->type != HLSL_IR_LOAD)
|
||||
@ -1614,7 +1614,7 @@ static bool split_matrix_copies(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
|
||||
store = hlsl_ir_store(instr);
|
||||
rhs = store->rhs.node;
|
||||
type = rhs->data_type;
|
||||
if (type->type != HLSL_CLASS_MATRIX)
|
||||
if (type->class != HLSL_CLASS_MATRIX)
|
||||
return false;
|
||||
element_type = hlsl_get_vector_type(ctx, type->base_type, hlsl_type_minor_size(type));
|
||||
|
||||
@ -1649,7 +1649,7 @@ static bool lower_narrowing_casts(struct hlsl_ctx *ctx, struct hlsl_ir_node *ins
|
||||
src_type = cast->operands[0].node->data_type;
|
||||
dst_type = cast->node.data_type;
|
||||
|
||||
if (src_type->type <= HLSL_CLASS_VECTOR && dst_type->type <= HLSL_CLASS_VECTOR && dst_type->dimx < src_type->dimx)
|
||||
if (src_type->class <= HLSL_CLASS_VECTOR && dst_type->class <= HLSL_CLASS_VECTOR && dst_type->dimx < src_type->dimx)
|
||||
{
|
||||
struct hlsl_ir_swizzle *swizzle;
|
||||
struct hlsl_ir_expr *new_cast;
|
||||
@ -1860,7 +1860,7 @@ static bool lower_casts_to_bool(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
|
||||
if (expr->op != HLSL_OP1_CAST)
|
||||
return false;
|
||||
arg_type = expr->operands[0].node->data_type;
|
||||
if (type->type > HLSL_CLASS_VECTOR || arg_type->type > HLSL_CLASS_VECTOR)
|
||||
if (type->class > HLSL_CLASS_VECTOR || arg_type->class > HLSL_CLASS_VECTOR)
|
||||
return false;
|
||||
if (type->base_type != HLSL_TYPE_BOOL)
|
||||
return false;
|
||||
@ -1928,11 +1928,11 @@ static bool lower_int_division(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
arg2 = expr->operands[1].node;
|
||||
if (expr->op != HLSL_OP2_DIV)
|
||||
return false;
|
||||
if (type->type != HLSL_CLASS_SCALAR && type->type != HLSL_CLASS_VECTOR)
|
||||
if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_VECTOR)
|
||||
return false;
|
||||
if (type->base_type != HLSL_TYPE_INT)
|
||||
return false;
|
||||
utype = hlsl_get_numeric_type(ctx, type->type, HLSL_TYPE_UINT, type->dimx, type->dimy);
|
||||
utype = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_UINT, type->dimx, type->dimy);
|
||||
|
||||
if (!(xor = hlsl_new_binary_expr(ctx, HLSL_OP2_BIT_XOR, arg1, arg2)))
|
||||
return false;
|
||||
@ -2000,11 +2000,11 @@ static bool lower_int_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
arg2 = expr->operands[1].node;
|
||||
if (expr->op != HLSL_OP2_MOD)
|
||||
return false;
|
||||
if (type->type != HLSL_CLASS_SCALAR && type->type != HLSL_CLASS_VECTOR)
|
||||
if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_VECTOR)
|
||||
return false;
|
||||
if (type->base_type != HLSL_TYPE_INT)
|
||||
return false;
|
||||
utype = hlsl_get_numeric_type(ctx, type->type, HLSL_TYPE_UINT, type->dimx, type->dimy);
|
||||
utype = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_UINT, type->dimx, type->dimy);
|
||||
|
||||
if (!(high_bit = hlsl_new_constant(ctx, type, &instr->loc)))
|
||||
return false;
|
||||
@ -2063,7 +2063,7 @@ static bool lower_int_abs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr, void
|
||||
|
||||
if (expr->op != HLSL_OP1_ABS)
|
||||
return false;
|
||||
if (type->type != HLSL_CLASS_SCALAR && type->type != HLSL_CLASS_VECTOR)
|
||||
if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_VECTOR)
|
||||
return false;
|
||||
if (type->base_type != HLSL_TYPE_INT)
|
||||
return false;
|
||||
@ -2096,11 +2096,11 @@ static bool lower_float_modulus(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr
|
||||
arg2 = expr->operands[1].node;
|
||||
if (expr->op != HLSL_OP2_MOD)
|
||||
return false;
|
||||
if (type->type != HLSL_CLASS_SCALAR && type->type != HLSL_CLASS_VECTOR)
|
||||
if (type->class != HLSL_CLASS_SCALAR && type->class != HLSL_CLASS_VECTOR)
|
||||
return false;
|
||||
if (type->base_type != HLSL_TYPE_FLOAT)
|
||||
return false;
|
||||
btype = hlsl_get_numeric_type(ctx, type->type, HLSL_TYPE_BOOL, type->dimx, type->dimy);
|
||||
btype = hlsl_get_numeric_type(ctx, type->class, HLSL_TYPE_BOOL, type->dimx, type->dimy);
|
||||
|
||||
if (!(mul1 = hlsl_new_binary_expr(ctx, HLSL_OP2_MUL, arg2, arg1)))
|
||||
return false;
|
||||
@ -2543,7 +2543,7 @@ static struct hlsl_reg allocate_numeric_registers_for_type(struct hlsl_ctx *ctx,
|
||||
{
|
||||
unsigned int reg_size = type->reg_size[HLSL_REGSET_NUMERIC];
|
||||
|
||||
if (type->type <= HLSL_CLASS_VECTOR)
|
||||
if (type->class <= HLSL_CLASS_VECTOR)
|
||||
return allocate_register(ctx, liveness, first_write, last_read, reg_size, type->dimx);
|
||||
else
|
||||
return allocate_range(ctx, liveness, first_write, last_read, reg_size);
|
||||
@ -2662,7 +2662,7 @@ static void allocate_const_registers_recurse(struct hlsl_ctx *ctx, struct hlsl_b
|
||||
defs->count = end_reg;
|
||||
}
|
||||
|
||||
assert(type->type <= HLSL_CLASS_LAST_NUMERIC);
|
||||
assert(type->class <= HLSL_CLASS_LAST_NUMERIC);
|
||||
|
||||
if (!(writemask = constant->reg.writemask))
|
||||
writemask = (1u << type->dimx) - 1;
|
||||
@ -2880,7 +2880,7 @@ static void allocate_buffers(struct hlsl_ctx *ctx)
|
||||
|
||||
LIST_FOR_EACH_ENTRY(var, &ctx->extern_vars, struct hlsl_ir_var, extern_entry)
|
||||
{
|
||||
if (var->is_uniform && var->data_type->type != HLSL_CLASS_OBJECT)
|
||||
if (var->is_uniform && var->data_type->class != HLSL_CLASS_OBJECT)
|
||||
{
|
||||
if (var->is_param)
|
||||
var->buffer = ctx->params_buffer;
|
||||
@ -3034,12 +3034,12 @@ bool hlsl_component_index_range_from_deref(struct hlsl_ctx *ctx, const struct hl
|
||||
return false;
|
||||
|
||||
/* We should always have generated a cast to UINT. */
|
||||
assert(path_node->data_type->type == HLSL_CLASS_SCALAR
|
||||
assert(path_node->data_type->class == HLSL_CLASS_SCALAR
|
||||
&& path_node->data_type->base_type == HLSL_TYPE_UINT);
|
||||
|
||||
idx = hlsl_ir_constant(path_node)->value[0].u;
|
||||
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_VECTOR:
|
||||
if (idx >= type->dimx)
|
||||
@ -3102,7 +3102,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->type == HLSL_CLASS_SCALAR
|
||||
assert(offset_node->data_type->class == HLSL_CLASS_SCALAR
|
||||
&& offset_node->data_type->base_type == HLSL_TYPE_UINT);
|
||||
|
||||
if (offset_node->type != HLSL_IR_CONSTANT)
|
||||
@ -3170,7 +3170,7 @@ static void parse_numthreads_attribute(struct hlsl_ctx *ctx, const struct hlsl_a
|
||||
const struct hlsl_type *type = instr->data_type;
|
||||
const struct hlsl_ir_constant *constant;
|
||||
|
||||
if (type->type != HLSL_CLASS_SCALAR
|
||||
if (type->class != HLSL_CLASS_SCALAR
|
||||
|| (type->base_type != HLSL_TYPE_INT && type->base_type != HLSL_TYPE_UINT))
|
||||
{
|
||||
struct vkd3d_string_buffer *string;
|
||||
@ -3234,13 +3234,13 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
|
||||
{
|
||||
var = entry_func->parameters.vars[i];
|
||||
|
||||
if (var->data_type->type == HLSL_CLASS_OBJECT || (var->storage_modifiers & HLSL_STORAGE_UNIFORM))
|
||||
if (var->data_type->class == HLSL_CLASS_OBJECT || (var->storage_modifiers & HLSL_STORAGE_UNIFORM))
|
||||
{
|
||||
prepend_uniform_copy(ctx, &body->instrs, var);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (var->data_type->type != HLSL_CLASS_STRUCT && !var->semantic.name)
|
||||
if (var->data_type->class != HLSL_CLASS_STRUCT && !var->semantic.name)
|
||||
hlsl_error(ctx, &var->loc, VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC,
|
||||
"Parameter \"%s\" is missing a semantic.", var->name);
|
||||
|
||||
@ -3252,7 +3252,7 @@ int hlsl_emit_bytecode(struct hlsl_ctx *ctx, struct hlsl_ir_function_decl *entry
|
||||
}
|
||||
if (entry_func->return_var)
|
||||
{
|
||||
if (entry_func->return_var->data_type->type != HLSL_CLASS_STRUCT && !entry_func->return_var->semantic.name)
|
||||
if (entry_func->return_var->data_type->class != HLSL_CLASS_STRUCT && !entry_func->return_var->semantic.name)
|
||||
hlsl_error(ctx, &entry_func->loc, VKD3D_SHADER_ERROR_HLSL_MISSING_SEMANTIC,
|
||||
"Entry point \"%s\" is missing a return value semantic.", entry_func->func->name);
|
||||
|
||||
|
@ -512,7 +512,7 @@ bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
if (!expr->operands[0].node)
|
||||
return false;
|
||||
|
||||
if (instr->data_type->type > HLSL_CLASS_VECTOR)
|
||||
if (instr->data_type->class > HLSL_CLASS_VECTOR)
|
||||
return false;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(expr->operands); ++i)
|
||||
@ -521,7 +521,7 @@ bool hlsl_fold_constant_exprs(struct hlsl_ctx *ctx, struct hlsl_ir_node *instr,
|
||||
{
|
||||
if (expr->operands[i].node->type != HLSL_IR_CONSTANT)
|
||||
return false;
|
||||
assert(expr->operands[i].node->data_type->type <= HLSL_CLASS_VECTOR);
|
||||
assert(expr->operands[i].node->data_type->class <= HLSL_CLASS_VECTOR);
|
||||
}
|
||||
}
|
||||
arg1 = hlsl_ir_constant(expr->operands[0].node);
|
||||
|
@ -139,7 +139,7 @@ static uint32_t sm1_version(enum vkd3d_shader_type type, unsigned int major, uns
|
||||
|
||||
static D3DXPARAMETER_CLASS sm1_class(const struct hlsl_type *type)
|
||||
{
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_ARRAY:
|
||||
return sm1_class(type->e.array.type);
|
||||
@ -158,7 +158,7 @@ static D3DXPARAMETER_CLASS sm1_class(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_VECTOR:
|
||||
return D3DXPC_VECTOR;
|
||||
default:
|
||||
ERR("Invalid class %#x.\n", type->type);
|
||||
ERR("Invalid class %#x.\n", type->class);
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
}
|
||||
@ -226,14 +226,14 @@ static D3DXPARAMETER_TYPE sm1_base_type(const struct hlsl_type *type)
|
||||
|
||||
static const struct hlsl_type *get_array_type(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
return get_array_type(type->e.array.type);
|
||||
return type;
|
||||
}
|
||||
|
||||
static unsigned int get_array_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
return get_array_size(type->e.array.type) * type->e.array.elements_count;
|
||||
return 1;
|
||||
}
|
||||
@ -249,7 +249,7 @@ static void write_sm1_type(struct vkd3d_bytecode_buffer *buffer, struct hlsl_typ
|
||||
if (type->bytecode_offset)
|
||||
return;
|
||||
|
||||
if (array_type->type == HLSL_CLASS_STRUCT)
|
||||
if (array_type->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
field_count = array_type->e.record.field_count;
|
||||
|
||||
@ -360,7 +360,7 @@ static void write_sm1_uniforms(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffe
|
||||
if (!var->semantic.name && var->regs[regset].allocated)
|
||||
{
|
||||
put_u32(buffer, 0); /* name */
|
||||
if (var->data_type->type == HLSL_CLASS_OBJECT
|
||||
if (var->data_type->class == HLSL_CLASS_OBJECT
|
||||
&& (var->data_type->base_type == HLSL_TYPE_SAMPLER
|
||||
|| var->data_type->base_type == HLSL_TYPE_TEXTURE))
|
||||
{
|
||||
@ -849,7 +849,7 @@ static void write_sm1_store(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
|
||||
.src_count = 1,
|
||||
};
|
||||
|
||||
if (store->lhs.var->data_type->type == HLSL_CLASS_MATRIX)
|
||||
if (store->lhs.var->data_type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
FIXME("Matrix writemasks need to be lowered.\n");
|
||||
return;
|
||||
@ -910,19 +910,19 @@ static void write_sm1_instructions(struct hlsl_ctx *ctx, struct vkd3d_bytecode_b
|
||||
{
|
||||
if (instr->data_type)
|
||||
{
|
||||
if (instr->data_type->type == HLSL_CLASS_MATRIX)
|
||||
if (instr->data_type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
/* These need to be lowered. */
|
||||
hlsl_fixme(ctx, &instr->loc, "SM1 matrix expression.");
|
||||
continue;
|
||||
}
|
||||
else if (instr->data_type->type == HLSL_CLASS_OBJECT)
|
||||
else if (instr->data_type->class == HLSL_CLASS_OBJECT)
|
||||
{
|
||||
hlsl_fixme(ctx, &instr->loc, "Object copy.");
|
||||
break;
|
||||
}
|
||||
|
||||
assert(instr->data_type->type == HLSL_CLASS_SCALAR || instr->data_type->type == HLSL_CLASS_VECTOR);
|
||||
assert(instr->data_type->class == HLSL_CLASS_SCALAR || instr->data_type->class == HLSL_CLASS_VECTOR);
|
||||
}
|
||||
|
||||
switch (instr->type)
|
||||
|
@ -257,21 +257,21 @@ static void write_sm4_signature(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc,
|
||||
|
||||
static const struct hlsl_type *get_array_type(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
return get_array_type(type->e.array.type);
|
||||
return type;
|
||||
}
|
||||
|
||||
static unsigned int get_array_size(const struct hlsl_type *type)
|
||||
{
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
return get_array_size(type->e.array.type) * type->e.array.elements_count;
|
||||
return 1;
|
||||
}
|
||||
|
||||
static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type)
|
||||
{
|
||||
switch (type->type)
|
||||
switch (type->class)
|
||||
{
|
||||
case HLSL_CLASS_ARRAY:
|
||||
return sm4_class(type->e.array.type);
|
||||
@ -290,7 +290,7 @@ static D3D_SHADER_VARIABLE_CLASS sm4_class(const struct hlsl_type *type)
|
||||
case HLSL_CLASS_VECTOR:
|
||||
return D3D_SVC_VECTOR;
|
||||
default:
|
||||
ERR("Invalid class %#x.\n", type->type);
|
||||
ERR("Invalid class %#x.\n", type->class);
|
||||
vkd3d_unreachable();
|
||||
}
|
||||
}
|
||||
@ -372,10 +372,10 @@ static void write_sm4_type(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *b
|
||||
if (profile->major_version >= 5)
|
||||
name_offset = put_string(buffer, name);
|
||||
|
||||
if (type->type == HLSL_CLASS_ARRAY)
|
||||
if (type->class == HLSL_CLASS_ARRAY)
|
||||
array_size = get_array_size(type);
|
||||
|
||||
if (array_type->type == HLSL_CLASS_STRUCT)
|
||||
if (array_type->class == HLSL_CLASS_STRUCT)
|
||||
{
|
||||
field_count = array_type->e.record.field_count;
|
||||
|
||||
@ -858,7 +858,7 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct sm4_register *r
|
||||
|
||||
if (var->is_uniform)
|
||||
{
|
||||
if (data_type->type == HLSL_CLASS_OBJECT && data_type->base_type == HLSL_TYPE_TEXTURE)
|
||||
if (data_type->class == HLSL_CLASS_OBJECT && data_type->base_type == HLSL_TYPE_TEXTURE)
|
||||
{
|
||||
reg->type = VKD3D_SM4_RT_RESOURCE;
|
||||
reg->dim = VKD3D_SM4_DIMENSION_VEC4;
|
||||
@ -868,7 +868,7 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct sm4_register *r
|
||||
reg->idx_count = 1;
|
||||
*writemask = VKD3DSP_WRITEMASK_ALL;
|
||||
}
|
||||
else if (data_type->type == HLSL_CLASS_OBJECT && data_type->base_type == HLSL_TYPE_UAV)
|
||||
else if (data_type->class == HLSL_CLASS_OBJECT && data_type->base_type == HLSL_TYPE_UAV)
|
||||
{
|
||||
reg->type = VKD3D_SM5_RT_UAV;
|
||||
reg->dim = VKD3D_SM4_DIMENSION_VEC4;
|
||||
@ -878,7 +878,7 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct sm4_register *r
|
||||
reg->idx_count = 1;
|
||||
*writemask = VKD3DSP_WRITEMASK_ALL;
|
||||
}
|
||||
else if (data_type->type == HLSL_CLASS_OBJECT && data_type->base_type == HLSL_TYPE_SAMPLER)
|
||||
else if (data_type->class == HLSL_CLASS_OBJECT && data_type->base_type == HLSL_TYPE_SAMPLER)
|
||||
{
|
||||
reg->type = VKD3D_SM4_RT_SAMPLER;
|
||||
reg->dim = VKD3D_SM4_DIMENSION_NONE;
|
||||
@ -892,7 +892,7 @@ static void sm4_register_from_deref(struct hlsl_ctx *ctx, struct sm4_register *r
|
||||
{
|
||||
unsigned int offset = hlsl_offset_from_deref_safe(ctx, deref) + var->buffer_offset;
|
||||
|
||||
assert(data_type->type <= HLSL_CLASS_VECTOR);
|
||||
assert(data_type->class <= HLSL_CLASS_VECTOR);
|
||||
reg->type = VKD3D_SM4_RT_CONSTBUFFER;
|
||||
reg->dim = VKD3D_SM4_DIMENSION_VEC4;
|
||||
if (swizzle_type)
|
||||
@ -2231,9 +2231,9 @@ static void write_sm4_resource_load(struct hlsl_ctx *ctx,
|
||||
const struct hlsl_ir_node *texel_offset = load->texel_offset.node;
|
||||
const struct hlsl_ir_node *coords = load->coords.node;
|
||||
|
||||
if (resource_type->type != HLSL_CLASS_OBJECT)
|
||||
if (resource_type->class != HLSL_CLASS_OBJECT)
|
||||
{
|
||||
assert(resource_type->type == HLSL_CLASS_ARRAY || resource_type->type == HLSL_CLASS_STRUCT);
|
||||
assert(resource_type->class == HLSL_CLASS_ARRAY || resource_type->class == HLSL_CLASS_STRUCT);
|
||||
hlsl_fixme(ctx, &load->node.loc, "Resource being a component of another variable.");
|
||||
return;
|
||||
}
|
||||
@ -2242,9 +2242,9 @@ static void write_sm4_resource_load(struct hlsl_ctx *ctx,
|
||||
{
|
||||
const struct hlsl_type *sampler_type = load->sampler.var->data_type;
|
||||
|
||||
if (sampler_type->type != HLSL_CLASS_OBJECT)
|
||||
if (sampler_type->class != HLSL_CLASS_OBJECT)
|
||||
{
|
||||
assert(sampler_type->type == HLSL_CLASS_ARRAY || sampler_type->type == HLSL_CLASS_STRUCT);
|
||||
assert(sampler_type->class == HLSL_CLASS_ARRAY || sampler_type->class == HLSL_CLASS_STRUCT);
|
||||
hlsl_fixme(ctx, &load->node.loc, "Sampler being a component of another variable.");
|
||||
return;
|
||||
}
|
||||
@ -2312,9 +2312,9 @@ static void write_sm4_resource_store(struct hlsl_ctx *ctx,
|
||||
{
|
||||
const struct hlsl_type *resource_type = store->resource.var->data_type;
|
||||
|
||||
if (resource_type->type != HLSL_CLASS_OBJECT)
|
||||
if (resource_type->class != HLSL_CLASS_OBJECT)
|
||||
{
|
||||
assert(resource_type->type == HLSL_CLASS_ARRAY || resource_type->type == HLSL_CLASS_STRUCT);
|
||||
assert(resource_type->class == HLSL_CLASS_ARRAY || resource_type->class == HLSL_CLASS_STRUCT);
|
||||
hlsl_fixme(ctx, &store->node.loc, "Resource being a component of another variable.");
|
||||
return;
|
||||
}
|
||||
@ -2377,18 +2377,18 @@ static void write_sm4_block(struct hlsl_ctx *ctx, struct vkd3d_bytecode_buffer *
|
||||
{
|
||||
if (instr->data_type)
|
||||
{
|
||||
if (instr->data_type->type == HLSL_CLASS_MATRIX)
|
||||
if (instr->data_type->class == HLSL_CLASS_MATRIX)
|
||||
{
|
||||
hlsl_fixme(ctx, &instr->loc, "Matrix operations need to be lowered.");
|
||||
break;
|
||||
}
|
||||
else if (instr->data_type->type == HLSL_CLASS_OBJECT)
|
||||
else if (instr->data_type->class == HLSL_CLASS_OBJECT)
|
||||
{
|
||||
hlsl_fixme(ctx, &instr->loc, "Object copy.");
|
||||
break;
|
||||
}
|
||||
|
||||
assert(instr->data_type->type == HLSL_CLASS_SCALAR || instr->data_type->type == HLSL_CLASS_VECTOR);
|
||||
assert(instr->data_type->class == HLSL_CLASS_SCALAR || instr->data_type->class == HLSL_CLASS_VECTOR);
|
||||
}
|
||||
|
||||
switch (instr->type)
|
||||
|
Loading…
x
Reference in New Issue
Block a user