vkd3d-shader: Replace BOOL with bool.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-02-02 16:11:17 -06:00 committed by Alexandre Julliard
parent aa52cb10b4
commit c2c092b143
4 changed files with 169 additions and 169 deletions

View File

@ -36,14 +36,14 @@ void hlsl_report_message(const struct source_location loc,
set_parse_status(&hlsl_ctx.status, PARSE_WARN);
}
BOOL hlsl_add_var(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var)
bool hlsl_add_var(struct hlsl_scope *scope, struct hlsl_ir_var *decl, bool local_var)
{
struct hlsl_ir_var *var;
LIST_FOR_EACH_ENTRY(var, &scope->vars, struct hlsl_ir_var, scope_entry)
{
if (!strcmp(decl->name, var->name))
return FALSE;
return false;
}
if (local_var && scope->upper->upper == hlsl_ctx.globals)
{
@ -51,12 +51,12 @@ BOOL hlsl_add_var(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local
LIST_FOR_EACH_ENTRY(var, &scope->upper->vars, struct hlsl_ir_var, scope_entry)
{
if (!strcmp(decl->name, var->name))
return FALSE;
return false;
}
}
list_add_tail(&scope->vars, &decl->scope_entry);
return TRUE;
return true;
}
struct hlsl_ir_var *hlsl_get_var(struct hlsl_scope *scope, const char *name)
@ -154,7 +154,7 @@ struct hlsl_type *hlsl_new_struct_type(const char *name, struct list *fields)
return type;
}
struct hlsl_type *hlsl_get_type(struct hlsl_scope *scope, const char *name, BOOL recursive)
struct hlsl_type *hlsl_get_type(struct hlsl_scope *scope, const char *name, bool recursive)
{
struct rb_entry *entry = rb_get(&scope->types, name);
@ -166,7 +166,7 @@ struct hlsl_type *hlsl_get_type(struct hlsl_scope *scope, const char *name, BOOL
return NULL;
}
BOOL hlsl_get_function(const char *name)
bool hlsl_get_function(const char *name)
{
return rb_get(&hlsl_ctx.functions, name) != NULL;
}
@ -197,24 +197,24 @@ unsigned int hlsl_type_component_count(struct hlsl_type *type)
return count;
}
BOOL hlsl_type_compare(const struct hlsl_type *t1, const struct hlsl_type *t2)
bool hlsl_type_compare(const struct hlsl_type *t1, const struct hlsl_type *t2)
{
if (t1 == t2)
return TRUE;
return true;
if (t1->type != t2->type)
return FALSE;
return false;
if (t1->base_type != t2->base_type)
return FALSE;
return false;
if (t1->base_type == HLSL_TYPE_SAMPLER && t1->sampler_dim != t2->sampler_dim)
return FALSE;
return false;
if ((t1->modifiers & HLSL_MODIFIERS_MAJORITY_MASK)
!= (t2->modifiers & HLSL_MODIFIERS_MAJORITY_MASK))
return FALSE;
return false;
if (t1->dimx != t2->dimx)
return FALSE;
return false;
if (t1->dimy != t2->dimy)
return FALSE;
return false;
if (t1->type == HLSL_CLASS_STRUCT)
{
struct list *t1cur, *t2cur;
@ -227,20 +227,20 @@ BOOL hlsl_type_compare(const struct hlsl_type *t1, const struct hlsl_type *t2)
t1field = LIST_ENTRY(t1cur, struct hlsl_struct_field, entry);
t2field = LIST_ENTRY(t2cur, struct hlsl_struct_field, entry);
if (!hlsl_type_compare(t1field->type, t2field->type))
return FALSE;
return false;
if (strcmp(t1field->name, t2field->name))
return FALSE;
return false;
t1cur = list_next(t1->e.elements, t1cur);
t2cur = list_next(t2->e.elements, t2cur);
}
if (t1cur != t2cur)
return FALSE;
return false;
}
if (t1->type == HLSL_CLASS_ARRAY)
return t1->e.array.elements_count == t2->e.array.elements_count
&& hlsl_type_compare(t1->e.array.type, t2->e.array.type);
return TRUE;
return true;
}
struct hlsl_type *hlsl_type_clone(struct hlsl_type *old, unsigned int default_majority)
@ -368,7 +368,7 @@ struct hlsl_ir_var *hlsl_new_synthetic_var(const char *name, struct hlsl_type *t
return var;
}
static BOOL type_is_single_reg(const struct hlsl_type *type)
static bool type_is_single_reg(const struct hlsl_type *type)
{
return type->type == HLSL_CLASS_SCALAR || type->type == HLSL_CLASS_VECTOR;
}
@ -473,7 +473,7 @@ struct hlsl_ir_swizzle *hlsl_new_swizzle(DWORD s, unsigned int components,
return swizzle;
}
BOOL hlsl_type_is_void(const struct hlsl_type *type)
bool hlsl_type_is_void(const struct hlsl_type *type)
{
return type->type == HLSL_CLASS_OBJECT && type->base_type == HLSL_TYPE_VOID;
}
@ -1235,7 +1235,7 @@ void hlsl_free_function_rb(struct rb_entry *entry, void *context)
free_function(RB_ENTRY_VALUE(entry, struct hlsl_ir_function, entry));
}
void hlsl_add_function(struct rb_tree *funcs, char *name, struct hlsl_ir_function_decl *decl, BOOL intrinsic)
void hlsl_add_function(struct rb_tree *funcs, char *name, struct hlsl_ir_function_decl *decl, bool intrinsic)
{
struct hlsl_ir_function *func;
struct rb_entry *func_entry, *old_entry;
@ -1292,7 +1292,7 @@ struct hlsl_profile_info
DWORD sm_minor;
DWORD level_major;
DWORD level_minor;
BOOL sw;
bool sw;
};
static const struct hlsl_profile_info *get_target_info(const char *target)
@ -1301,66 +1301,66 @@ static const struct hlsl_profile_info *get_target_info(const char *target)
static const struct hlsl_profile_info profiles[] =
{
{"cs_4_0", VKD3D_SHADER_TYPE_COMPUTE, 4, 0, 0, 0, FALSE},
{"cs_4_1", VKD3D_SHADER_TYPE_COMPUTE, 4, 1, 0, 0, FALSE},
{"cs_5_0", VKD3D_SHADER_TYPE_COMPUTE, 5, 0, 0, 0, FALSE},
{"ds_5_0", VKD3D_SHADER_TYPE_DOMAIN, 5, 0, 0, 0, FALSE},
{"fx_2_0", VKD3D_SHADER_TYPE_EFFECT, 2, 0, 0, 0, FALSE},
{"fx_4_0", VKD3D_SHADER_TYPE_EFFECT, 4, 0, 0, 0, FALSE},
{"fx_4_1", VKD3D_SHADER_TYPE_EFFECT, 4, 1, 0, 0, FALSE},
{"fx_5_0", VKD3D_SHADER_TYPE_EFFECT, 5, 0, 0, 0, FALSE},
{"gs_4_0", VKD3D_SHADER_TYPE_GEOMETRY, 4, 0, 0, 0, FALSE},
{"gs_4_1", VKD3D_SHADER_TYPE_GEOMETRY, 4, 1, 0, 0, FALSE},
{"gs_5_0", VKD3D_SHADER_TYPE_GEOMETRY, 5, 0, 0, 0, FALSE},
{"hs_5_0", VKD3D_SHADER_TYPE_HULL, 5, 0, 0, 0, FALSE},
{"ps.1.0", VKD3D_SHADER_TYPE_PIXEL, 1, 0, 0, 0, FALSE},
{"ps.1.1", VKD3D_SHADER_TYPE_PIXEL, 1, 1, 0, 0, FALSE},
{"ps.1.2", VKD3D_SHADER_TYPE_PIXEL, 1, 2, 0, 0, FALSE},
{"ps.1.3", VKD3D_SHADER_TYPE_PIXEL, 1, 3, 0, 0, FALSE},
{"ps.1.4", VKD3D_SHADER_TYPE_PIXEL, 1, 4, 0, 0, FALSE},
{"ps.2.0", VKD3D_SHADER_TYPE_PIXEL, 2, 0, 0, 0, FALSE},
{"ps.2.a", VKD3D_SHADER_TYPE_PIXEL, 2, 1, 0, 0, FALSE},
{"ps.2.b", VKD3D_SHADER_TYPE_PIXEL, 2, 2, 0, 0, FALSE},
{"ps.2.sw", VKD3D_SHADER_TYPE_PIXEL, 2, 0, 0, 0, TRUE},
{"ps.3.0", VKD3D_SHADER_TYPE_PIXEL, 3, 0, 0, 0, FALSE},
{"ps_1_0", VKD3D_SHADER_TYPE_PIXEL, 1, 0, 0, 0, FALSE},
{"ps_1_1", VKD3D_SHADER_TYPE_PIXEL, 1, 1, 0, 0, FALSE},
{"ps_1_2", VKD3D_SHADER_TYPE_PIXEL, 1, 2, 0, 0, FALSE},
{"ps_1_3", VKD3D_SHADER_TYPE_PIXEL, 1, 3, 0, 0, FALSE},
{"ps_1_4", VKD3D_SHADER_TYPE_PIXEL, 1, 4, 0, 0, FALSE},
{"ps_2_0", VKD3D_SHADER_TYPE_PIXEL, 2, 0, 0, 0, FALSE},
{"ps_2_a", VKD3D_SHADER_TYPE_PIXEL, 2, 1, 0, 0, FALSE},
{"ps_2_b", VKD3D_SHADER_TYPE_PIXEL, 2, 2, 0, 0, FALSE},
{"ps_2_sw", VKD3D_SHADER_TYPE_PIXEL, 2, 0, 0, 0, TRUE},
{"ps_3_0", VKD3D_SHADER_TYPE_PIXEL, 3, 0, 0, 0, FALSE},
{"ps_3_sw", VKD3D_SHADER_TYPE_PIXEL, 3, 0, 0, 0, TRUE},
{"ps_4_0", VKD3D_SHADER_TYPE_PIXEL, 4, 0, 0, 0, FALSE},
{"ps_4_0_level_9_0", VKD3D_SHADER_TYPE_PIXEL, 4, 0, 9, 0, FALSE},
{"ps_4_0_level_9_1", VKD3D_SHADER_TYPE_PIXEL, 4, 0, 9, 1, FALSE},
{"ps_4_0_level_9_3", VKD3D_SHADER_TYPE_PIXEL, 4, 0, 9, 3, FALSE},
{"ps_4_1", VKD3D_SHADER_TYPE_PIXEL, 4, 1, 0, 0, FALSE},
{"ps_5_0", VKD3D_SHADER_TYPE_PIXEL, 5, 0, 0, 0, FALSE},
{"tx_1_0", VKD3D_SHADER_TYPE_TEXTURE, 1, 0, 0, 0, FALSE},
{"vs.1.0", VKD3D_SHADER_TYPE_VERTEX, 1, 0, 0, 0, FALSE},
{"vs.1.1", VKD3D_SHADER_TYPE_VERTEX, 1, 1, 0, 0, FALSE},
{"vs.2.0", VKD3D_SHADER_TYPE_VERTEX, 2, 0, 0, 0, FALSE},
{"vs.2.a", VKD3D_SHADER_TYPE_VERTEX, 2, 1, 0, 0, FALSE},
{"vs.2.sw", VKD3D_SHADER_TYPE_VERTEX, 2, 0, 0, 0, TRUE},
{"vs.3.0", VKD3D_SHADER_TYPE_VERTEX, 3, 0, 0, 0, FALSE},
{"vs.3.sw", VKD3D_SHADER_TYPE_VERTEX, 3, 0, 0, 0, TRUE},
{"vs_1_0", VKD3D_SHADER_TYPE_VERTEX, 1, 0, 0, 0, FALSE},
{"vs_1_1", VKD3D_SHADER_TYPE_VERTEX, 1, 1, 0, 0, FALSE},
{"vs_2_0", VKD3D_SHADER_TYPE_VERTEX, 2, 0, 0, 0, FALSE},
{"vs_2_a", VKD3D_SHADER_TYPE_VERTEX, 2, 1, 0, 0, FALSE},
{"vs_2_sw", VKD3D_SHADER_TYPE_VERTEX, 2, 0, 0, 0, TRUE},
{"vs_3_0", VKD3D_SHADER_TYPE_VERTEX, 3, 0, 0, 0, FALSE},
{"vs_3_sw", VKD3D_SHADER_TYPE_VERTEX, 3, 0, 0, 0, TRUE},
{"vs_4_0", VKD3D_SHADER_TYPE_VERTEX, 4, 0, 0, 0, FALSE},
{"vs_4_0_level_9_0", VKD3D_SHADER_TYPE_VERTEX, 4, 0, 9, 0, FALSE},
{"vs_4_0_level_9_1", VKD3D_SHADER_TYPE_VERTEX, 4, 0, 9, 1, FALSE},
{"vs_4_0_level_9_3", VKD3D_SHADER_TYPE_VERTEX, 4, 0, 9, 3, FALSE},
{"vs_4_1", VKD3D_SHADER_TYPE_VERTEX, 4, 1, 0, 0, FALSE},
{"vs_5_0", VKD3D_SHADER_TYPE_VERTEX, 5, 0, 0, 0, FALSE},
{"cs_4_0", VKD3D_SHADER_TYPE_COMPUTE, 4, 0, 0, 0, false},
{"cs_4_1", VKD3D_SHADER_TYPE_COMPUTE, 4, 1, 0, 0, false},
{"cs_5_0", VKD3D_SHADER_TYPE_COMPUTE, 5, 0, 0, 0, false},
{"ds_5_0", VKD3D_SHADER_TYPE_DOMAIN, 5, 0, 0, 0, false},
{"fx_2_0", VKD3D_SHADER_TYPE_EFFECT, 2, 0, 0, 0, false},
{"fx_4_0", VKD3D_SHADER_TYPE_EFFECT, 4, 0, 0, 0, false},
{"fx_4_1", VKD3D_SHADER_TYPE_EFFECT, 4, 1, 0, 0, false},
{"fx_5_0", VKD3D_SHADER_TYPE_EFFECT, 5, 0, 0, 0, false},
{"gs_4_0", VKD3D_SHADER_TYPE_GEOMETRY, 4, 0, 0, 0, false},
{"gs_4_1", VKD3D_SHADER_TYPE_GEOMETRY, 4, 1, 0, 0, false},
{"gs_5_0", VKD3D_SHADER_TYPE_GEOMETRY, 5, 0, 0, 0, false},
{"hs_5_0", VKD3D_SHADER_TYPE_HULL, 5, 0, 0, 0, false},
{"ps.1.0", VKD3D_SHADER_TYPE_PIXEL, 1, 0, 0, 0, false},
{"ps.1.1", VKD3D_SHADER_TYPE_PIXEL, 1, 1, 0, 0, false},
{"ps.1.2", VKD3D_SHADER_TYPE_PIXEL, 1, 2, 0, 0, false},
{"ps.1.3", VKD3D_SHADER_TYPE_PIXEL, 1, 3, 0, 0, false},
{"ps.1.4", VKD3D_SHADER_TYPE_PIXEL, 1, 4, 0, 0, false},
{"ps.2.0", VKD3D_SHADER_TYPE_PIXEL, 2, 0, 0, 0, false},
{"ps.2.a", VKD3D_SHADER_TYPE_PIXEL, 2, 1, 0, 0, false},
{"ps.2.b", VKD3D_SHADER_TYPE_PIXEL, 2, 2, 0, 0, false},
{"ps.2.sw", VKD3D_SHADER_TYPE_PIXEL, 2, 0, 0, 0, true},
{"ps.3.0", VKD3D_SHADER_TYPE_PIXEL, 3, 0, 0, 0, false},
{"ps_1_0", VKD3D_SHADER_TYPE_PIXEL, 1, 0, 0, 0, false},
{"ps_1_1", VKD3D_SHADER_TYPE_PIXEL, 1, 1, 0, 0, false},
{"ps_1_2", VKD3D_SHADER_TYPE_PIXEL, 1, 2, 0, 0, false},
{"ps_1_3", VKD3D_SHADER_TYPE_PIXEL, 1, 3, 0, 0, false},
{"ps_1_4", VKD3D_SHADER_TYPE_PIXEL, 1, 4, 0, 0, false},
{"ps_2_0", VKD3D_SHADER_TYPE_PIXEL, 2, 0, 0, 0, false},
{"ps_2_a", VKD3D_SHADER_TYPE_PIXEL, 2, 1, 0, 0, false},
{"ps_2_b", VKD3D_SHADER_TYPE_PIXEL, 2, 2, 0, 0, false},
{"ps_2_sw", VKD3D_SHADER_TYPE_PIXEL, 2, 0, 0, 0, true},
{"ps_3_0", VKD3D_SHADER_TYPE_PIXEL, 3, 0, 0, 0, false},
{"ps_3_sw", VKD3D_SHADER_TYPE_PIXEL, 3, 0, 0, 0, true},
{"ps_4_0", VKD3D_SHADER_TYPE_PIXEL, 4, 0, 0, 0, false},
{"ps_4_0_level_9_0", VKD3D_SHADER_TYPE_PIXEL, 4, 0, 9, 0, false},
{"ps_4_0_level_9_1", VKD3D_SHADER_TYPE_PIXEL, 4, 0, 9, 1, false},
{"ps_4_0_level_9_3", VKD3D_SHADER_TYPE_PIXEL, 4, 0, 9, 3, false},
{"ps_4_1", VKD3D_SHADER_TYPE_PIXEL, 4, 1, 0, 0, false},
{"ps_5_0", VKD3D_SHADER_TYPE_PIXEL, 5, 0, 0, 0, false},
{"tx_1_0", VKD3D_SHADER_TYPE_TEXTURE, 1, 0, 0, 0, false},
{"vs.1.0", VKD3D_SHADER_TYPE_VERTEX, 1, 0, 0, 0, false},
{"vs.1.1", VKD3D_SHADER_TYPE_VERTEX, 1, 1, 0, 0, false},
{"vs.2.0", VKD3D_SHADER_TYPE_VERTEX, 2, 0, 0, 0, false},
{"vs.2.a", VKD3D_SHADER_TYPE_VERTEX, 2, 1, 0, 0, false},
{"vs.2.sw", VKD3D_SHADER_TYPE_VERTEX, 2, 0, 0, 0, true},
{"vs.3.0", VKD3D_SHADER_TYPE_VERTEX, 3, 0, 0, 0, false},
{"vs.3.sw", VKD3D_SHADER_TYPE_VERTEX, 3, 0, 0, 0, true},
{"vs_1_0", VKD3D_SHADER_TYPE_VERTEX, 1, 0, 0, 0, false},
{"vs_1_1", VKD3D_SHADER_TYPE_VERTEX, 1, 1, 0, 0, false},
{"vs_2_0", VKD3D_SHADER_TYPE_VERTEX, 2, 0, 0, 0, false},
{"vs_2_a", VKD3D_SHADER_TYPE_VERTEX, 2, 1, 0, 0, false},
{"vs_2_sw", VKD3D_SHADER_TYPE_VERTEX, 2, 0, 0, 0, true},
{"vs_3_0", VKD3D_SHADER_TYPE_VERTEX, 3, 0, 0, 0, false},
{"vs_3_sw", VKD3D_SHADER_TYPE_VERTEX, 3, 0, 0, 0, true},
{"vs_4_0", VKD3D_SHADER_TYPE_VERTEX, 4, 0, 0, 0, false},
{"vs_4_0_level_9_0", VKD3D_SHADER_TYPE_VERTEX, 4, 0, 9, 0, false},
{"vs_4_0_level_9_1", VKD3D_SHADER_TYPE_VERTEX, 4, 0, 9, 1, false},
{"vs_4_0_level_9_3", VKD3D_SHADER_TYPE_VERTEX, 4, 0, 9, 3, false},
{"vs_4_1", VKD3D_SHADER_TYPE_VERTEX, 4, 1, 0, 0, false},
{"vs_5_0", VKD3D_SHADER_TYPE_VERTEX, 5, 0, 0, 0, false},
};
for (i = 0; i < ARRAY_SIZE(profiles); ++i)

View File

@ -230,7 +230,7 @@ struct hlsl_ir_function
struct rb_entry entry;
const char *name;
struct rb_tree overloads;
BOOL intrinsic;
bool intrinsic;
};
struct hlsl_ir_function_decl
@ -386,7 +386,7 @@ struct hlsl_ir_constant
int i[4];
float f[4];
double d[4];
BOOL b[4];
bool b[4];
} value;
};
@ -596,8 +596,8 @@ const char *hlsl_debug_modifiers(DWORD modifiers) DECLSPEC_HIDDEN;
const char *hlsl_node_type_to_string(enum hlsl_ir_node_type type) DECLSPEC_HIDDEN;
void hlsl_add_function(struct rb_tree *funcs, char *name, struct hlsl_ir_function_decl *decl,
BOOL intrinsic) DECLSPEC_HIDDEN;
BOOL hlsl_add_var(struct hlsl_scope *scope, struct hlsl_ir_var *decl, BOOL local_var) DECLSPEC_HIDDEN;
bool intrinsic) DECLSPEC_HIDDEN;
bool hlsl_add_var(struct hlsl_scope *scope, struct hlsl_ir_var *decl, bool local_var) DECLSPEC_HIDDEN;
int hlsl_compile(enum vkd3d_shader_type type, DWORD major, DWORD minor, const char *entrypoint,
struct vkd3d_shader_code *dxbc, struct vkd3d_shader_message_context *message_context) DECLSPEC_HIDDEN;
@ -610,8 +610,8 @@ void hlsl_free_function_rb(struct rb_entry *entry, void *context) DECLSPEC_HIDDE
void hlsl_free_type(struct hlsl_type *type) DECLSPEC_HIDDEN;
void hlsl_free_var(struct hlsl_ir_var *decl) DECLSPEC_HIDDEN;
BOOL hlsl_get_function(const char *name) DECLSPEC_HIDDEN;
struct hlsl_type *hlsl_get_type(struct hlsl_scope *scope, const char *name, BOOL recursive) DECLSPEC_HIDDEN;
bool hlsl_get_function(const char *name) DECLSPEC_HIDDEN;
struct hlsl_type *hlsl_get_type(struct hlsl_scope *scope, const char *name, bool recursive) DECLSPEC_HIDDEN;
struct hlsl_ir_var *hlsl_get_var(struct hlsl_scope *scope, const char *name) DECLSPEC_HIDDEN;
struct hlsl_type *hlsl_new_array_type(struct hlsl_type *basic_type, unsigned int array_size) DECLSPEC_HIDDEN;
@ -649,10 +649,10 @@ void hlsl_push_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
void hlsl_pop_scope(struct hlsl_parse_ctx *ctx) DECLSPEC_HIDDEN;
struct hlsl_type *hlsl_type_clone(struct hlsl_type *old, unsigned int default_majority) DECLSPEC_HIDDEN;
BOOL hlsl_type_compare(const struct hlsl_type *t1, const struct hlsl_type *t2) DECLSPEC_HIDDEN;
bool hlsl_type_compare(const struct hlsl_type *t1, const struct hlsl_type *t2) DECLSPEC_HIDDEN;
unsigned int hlsl_type_component_count(struct hlsl_type *type) DECLSPEC_HIDDEN;
BOOL hlsl_type_is_row_major(const struct hlsl_type *type) DECLSPEC_HIDDEN;
BOOL hlsl_type_is_void(const struct hlsl_type *type) DECLSPEC_HIDDEN;
bool hlsl_type_is_row_major(const struct hlsl_type *type) DECLSPEC_HIDDEN;
bool hlsl_type_is_void(const struct hlsl_type *type) DECLSPEC_HIDDEN;
int hlsl_lexer_compile(const char *text, enum vkd3d_shader_type type, DWORD major, DWORD minor, const char *entrypoint,
struct vkd3d_shader_code *dxbc, struct vkd3d_shader_message_context *message_context) DECLSPEC_HIDDEN;

View File

@ -174,7 +174,7 @@ row_major {return KW_ROW_MAJOR; }
hlsl_lval.name = vkd3d_strdup(yytext);
if (hlsl_get_var(hlsl_ctx.cur_scope, yytext) || hlsl_get_function(yytext))
return VAR_IDENTIFIER;
else if (hlsl_get_type(hlsl_ctx.cur_scope, yytext, TRUE))
else if (hlsl_get_type(hlsl_ctx.cur_scope, yytext, true))
return TYPE_IDENTIFIER;
else
return NEW_IDENTIFIER;

View File

@ -61,21 +61,21 @@ static void check_invalid_matrix_modifiers(DWORD modifiers, struct source_locati
"'row_major' or 'column_major' modifiers are only allowed for matrices.");
}
static BOOL convertible_data_type(struct hlsl_type *type)
static bool convertible_data_type(struct hlsl_type *type)
{
return type->type != HLSL_CLASS_OBJECT;
}
static BOOL compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
static bool compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
{
if (!convertible_data_type(t1) || !convertible_data_type(t2))
return FALSE;
return false;
if (t1->type <= HLSL_CLASS_LAST_NUMERIC)
{
/* Scalar vars can be cast to pretty much everything */
if (t1->dimx == 1 && t1->dimy == 1)
return TRUE;
return true;
if (t1->type == HLSL_CLASS_VECTOR && t2->type == HLSL_CLASS_VECTOR)
return t1->dimx >= t2->dimx;
@ -83,13 +83,13 @@ static BOOL compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
/* The other way around is true too i.e. whatever to scalar */
if (t2->type <= HLSL_CLASS_LAST_NUMERIC && t2->dimx == 1 && t2->dimy == 1)
return TRUE;
return true;
if (t1->type == HLSL_CLASS_ARRAY)
{
if (hlsl_type_compare(t1->e.array.type, t2))
/* e.g. float4[3] to float4 is allowed */
return TRUE;
return true;
if (t2->type == HLSL_CLASS_ARRAY || t2->type == HLSL_CLASS_STRUCT)
return hlsl_type_component_count(t1) >= hlsl_type_component_count(t2);
@ -106,33 +106,33 @@ static BOOL compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
if (t1->type == HLSL_CLASS_MATRIX || t2->type == HLSL_CLASS_MATRIX)
{
if (t1->type == HLSL_CLASS_MATRIX && t2->type == HLSL_CLASS_MATRIX && t1->dimx >= t2->dimx && t1->dimy >= t2->dimy)
return TRUE;
return true;
/* Matrix-vector conversion is apparently allowed if they have the same components count */
if ((t1->type == HLSL_CLASS_VECTOR || t2->type == HLSL_CLASS_VECTOR)
&& hlsl_type_component_count(t1) == hlsl_type_component_count(t2))
return TRUE;
return FALSE;
return true;
return false;
}
if (hlsl_type_component_count(t1) >= hlsl_type_component_count(t2))
return TRUE;
return FALSE;
return true;
return false;
}
static BOOL implicit_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
static bool implicit_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
{
if (!convertible_data_type(t1) || !convertible_data_type(t2))
return FALSE;
return false;
if (t1->type <= HLSL_CLASS_LAST_NUMERIC)
{
/* Scalar vars can be converted to any other numeric data type */
if (t1->dimx == 1 && t1->dimy == 1 && t2->type <= HLSL_CLASS_LAST_NUMERIC)
return TRUE;
return true;
/* The other way around is true too */
if (t2->dimx == 1 && t2->dimy == 1 && t2->type <= HLSL_CLASS_LAST_NUMERIC)
return TRUE;
return true;
}
if (t1->type == HLSL_CLASS_ARRAY && t2->type == HLSL_CLASS_ARRAY)
@ -145,36 +145,36 @@ static BOOL implicit_compatible_data_types(struct hlsl_type *t1, struct hlsl_typ
{
/* e.g. float4[3] to float4 is allowed */
if (t1->type == HLSL_CLASS_ARRAY && hlsl_type_compare(t1->e.array.type, t2))
return TRUE;
return true;
if (hlsl_type_component_count(t1) == hlsl_type_component_count(t2))
return TRUE;
return FALSE;
return true;
return false;
}
if (t1->type <= HLSL_CLASS_VECTOR && t2->type <= HLSL_CLASS_VECTOR)
{
if (t1->dimx >= t2->dimx)
return TRUE;
return FALSE;
return true;
return false;
}
if (t1->type == HLSL_CLASS_MATRIX || t2->type == HLSL_CLASS_MATRIX)
{
if (t1->type == HLSL_CLASS_MATRIX && t2->type == HLSL_CLASS_MATRIX
&& t1->dimx >= t2->dimx && t1->dimy >= t2->dimy)
return TRUE;
return true;
/* Matrix-vector conversion is apparently allowed if they have the same components count */
if ((t1->type == HLSL_CLASS_VECTOR || t2->type == HLSL_CLASS_VECTOR)
&& hlsl_type_component_count(t1) == hlsl_type_component_count(t2))
return TRUE;
return FALSE;
return true;
return false;
}
if (t1->type == HLSL_CLASS_STRUCT && t2->type == HLSL_CLASS_STRUCT)
return hlsl_type_compare(t1, t2);
return FALSE;
return false;
}
static struct hlsl_ir_node *add_implicit_conversion(struct list *instrs, struct hlsl_ir_node *node,
@ -204,9 +204,9 @@ static struct hlsl_ir_node *add_implicit_conversion(struct list *instrs, struct
return &cast->node;
}
static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
static bool declare_variable(struct hlsl_ir_var *decl, bool local)
{
BOOL ret;
bool ret;
TRACE("Declaring variable %s.\n", decl->name);
if (decl->data_type->type != HLSL_CLASS_MATRIX)
@ -226,7 +226,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
{
hlsl_report_message(decl->loc, HLSL_LEVEL_ERROR,
"semantics are not allowed on local variables");
return FALSE;
return false;
}
}
else
@ -234,7 +234,7 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
if (hlsl_get_function(decl->name))
{
hlsl_report_message(decl->loc, HLSL_LEVEL_ERROR, "redefinition of '%s'", decl->name);
return FALSE;
return false;
}
}
ret = hlsl_add_var(hlsl_ctx.cur_scope, decl, local);
@ -244,9 +244,9 @@ static BOOL declare_variable(struct hlsl_ir_var *decl, BOOL local)
hlsl_report_message(decl->loc, HLSL_LEVEL_ERROR, "\"%s\" already declared", decl->name);
hlsl_report_message(old->loc, HLSL_LEVEL_NOTE, "\"%s\" was previously declared here", old->name);
return FALSE;
return false;
}
return TRUE;
return true;
}
static DWORD add_modifiers(DWORD modifiers, DWORD mod, const struct source_location loc)
@ -264,13 +264,13 @@ static DWORD add_modifiers(DWORD modifiers, DWORD mod, const struct source_locat
return modifiers | mod;
}
static BOOL add_type_to_scope(struct hlsl_scope *scope, struct hlsl_type *def)
static bool add_type_to_scope(struct hlsl_scope *scope, struct hlsl_type *def)
{
if (hlsl_get_type(scope, def->name, FALSE))
return FALSE;
if (hlsl_get_type(scope, def->name, false))
return false;
rb_put(&scope->types, def->name, &def->scope_entry);
return TRUE;
return true;
}
static void declare_predefined_types(struct hlsl_scope *scope)
@ -354,7 +354,7 @@ static void declare_predefined_types(struct hlsl_scope *scope)
add_type_to_scope(scope, type);
}
static BOOL append_conditional_break(struct list *cond_list)
static bool append_conditional_break(struct list *cond_list)
{
struct hlsl_ir_node *condition, *not;
struct hlsl_ir_jump *jump;
@ -362,23 +362,23 @@ static BOOL append_conditional_break(struct list *cond_list)
/* E.g. "for (i = 0; ; ++i)". */
if (!list_count(cond_list))
return TRUE;
return true;
condition = node_from_list(cond_list);
if (!(not = hlsl_new_unary_expr(HLSL_IR_UNOP_LOGIC_NOT, condition, condition->loc)))
return FALSE;
return false;
list_add_tail(cond_list, &not->entry);
if (!(iff = hlsl_new_if(not, condition->loc)))
return FALSE;
return false;
list_add_tail(cond_list, &iff->node.entry);
if (!(jump = vkd3d_malloc(sizeof(*jump))))
return FALSE;
return false;
init_node(&jump->node, HLSL_IR_JUMP, NULL, condition->loc);
jump->type = HLSL_IR_JUMP_BREAK;
list_add_head(&iff->then_instrs, &jump->node.entry);
return TRUE;
return true;
}
enum loop_type
@ -461,12 +461,12 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ir_node *value, const cha
{
unsigned int len = strlen(swizzle), component = 0;
unsigned int i, set, swiz = 0;
BOOL valid;
bool valid;
if (value->data_type->type == HLSL_CLASS_MATRIX)
{
/* Matrix swizzle */
BOOL m_swizzle;
bool m_swizzle;
unsigned int inc, x, y;
if (len < 3 || swizzle[0] != '_')
@ -508,7 +508,7 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ir_node *value, const cha
for (set = 0; set < 2; ++set)
{
valid = TRUE;
valid = true;
component = 0;
for (i = 0; i < len; ++i)
{
@ -522,7 +522,7 @@ static struct hlsl_ir_swizzle *get_swizzle(struct hlsl_ir_node *value, const cha
}
if (s == 4)
{
valid = FALSE;
valid = false;
break;
}
@ -668,20 +668,20 @@ static struct hlsl_ir_load *add_array_load(struct list *instrs, struct hlsl_ir_n
return add_load(instrs, array, index, data_type, loc);
}
static BOOL add_struct_field(struct list *fields, struct hlsl_struct_field *field)
static bool add_struct_field(struct list *fields, struct hlsl_struct_field *field)
{
struct hlsl_struct_field *f;
LIST_FOR_EACH_ENTRY(f, fields, struct hlsl_struct_field, entry)
{
if (!strcmp(f->name, field->name))
return FALSE;
return false;
}
list_add_tail(fields, &field->entry);
return TRUE;
return true;
}
BOOL hlsl_type_is_row_major(const struct hlsl_type *type)
bool hlsl_type_is_row_major(const struct hlsl_type *type)
{
/* Default to column-major if the majority isn't explicitly set, which can
* happen for anonymous nodes. */
@ -763,11 +763,11 @@ static struct list *gen_struct_fields(struct hlsl_type *type, DWORD modifiers, s
return list;
}
static BOOL add_typedef(DWORD modifiers, struct hlsl_type *orig_type, struct list *list)
static bool add_typedef(DWORD modifiers, struct hlsl_type *orig_type, struct list *list)
{
struct parse_variable_def *v, *v_next;
struct hlsl_type *type;
BOOL ret;
bool ret;
LIST_FOR_EACH_ENTRY_SAFE(v, v_next, list, struct parse_variable_def, entry)
{
@ -776,7 +776,7 @@ static BOOL add_typedef(DWORD modifiers, struct hlsl_type *orig_type, struct lis
else
type = hlsl_type_clone(orig_type, 0);
if (!type)
return FALSE;
return false;
vkd3d_free((void *)type->name);
type->name = v->name;
type->modifiers |= modifiers;
@ -797,10 +797,10 @@ static BOOL add_typedef(DWORD modifiers, struct hlsl_type *orig_type, struct lis
vkd3d_free(v);
}
vkd3d_free(list);
return TRUE;
return true;
}
static BOOL add_func_parameter(struct list *list, struct parse_parameter *param, const struct source_location loc)
static bool add_func_parameter(struct list *list, struct parse_parameter *param, const struct source_location loc)
{
struct hlsl_ir_var *var;
@ -808,15 +808,15 @@ static BOOL add_func_parameter(struct list *list, struct parse_parameter *param,
assert(param->type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK);
if (!(var = hlsl_new_var(param->name, param->type, loc, param->semantic, param->modifiers, param->reg_reservation)))
return FALSE;
return false;
if (!hlsl_add_var(hlsl_ctx.cur_scope, var, FALSE))
if (!hlsl_add_var(hlsl_ctx.cur_scope, var, false))
{
hlsl_free_var(var);
return FALSE;
return false;
}
list_add_tail(list, &var->param_entry);
return TRUE;
return true;
}
static struct hlsl_reg_reservation *parse_reg_reservation(const char *reg_string)
@ -858,7 +858,7 @@ static struct hlsl_reg_reservation *parse_reg_reservation(const char *reg_string
}
static const struct hlsl_ir_function_decl *get_overloaded_func(struct rb_tree *funcs, char *name,
struct list *params, BOOL exact_signature)
struct list *params, bool exact_signature)
{
struct hlsl_ir_function *func;
struct rb_entry *entry;
@ -952,17 +952,17 @@ static unsigned int evaluate_array_dimension(struct hlsl_ir_node *node)
}
}
static BOOL expr_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t2)
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;
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;
return true;
if (t1->type == HLSL_CLASS_VECTOR && t2->type == HLSL_CLASS_VECTOR)
return TRUE;
return true;
if (t1->type == HLSL_CLASS_MATRIX || t2->type == HLSL_CLASS_MATRIX)
{
@ -971,7 +971,7 @@ static BOOL expr_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t
if (t1->type == HLSL_CLASS_VECTOR || t2->type == HLSL_CLASS_VECTOR)
{
if (hlsl_type_component_count(t1) == hlsl_type_component_count(t2))
return TRUE;
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));
@ -980,10 +980,10 @@ static BOOL expr_compatible_data_types(struct hlsl_type *t1, struct hlsl_type *t
/* Both matrices */
if ((t1->dimx >= t2->dimx && t1->dimy >= t2->dimy)
|| (t1->dimx <= t2->dimx && t1->dimy <= t2->dimy))
return TRUE;
return true;
}
return FALSE;
return false;
}
static enum hlsl_base_type expr_common_base_type(enum hlsl_base_type t1, enum hlsl_base_type t2)
@ -1198,7 +1198,7 @@ static enum hlsl_ir_expr_op op_from_assignment(enum parse_assign_op op)
return ops[op];
}
static BOOL invert_swizzle(unsigned int *swizzle, unsigned int *writemask, unsigned int *ret_width)
static bool invert_swizzle(unsigned int *swizzle, unsigned int *writemask, unsigned int *ret_width)
{
unsigned int i, j, bit = 0, inverted = 0, width, new_writemask = 0, new_swizzle = 0;
@ -1210,7 +1210,7 @@ static BOOL invert_swizzle(unsigned int *swizzle, unsigned int *writemask, unsig
unsigned int s = (*swizzle >> (i * 2)) & 3;
new_swizzle |= s << (bit++ * 2);
if (new_writemask & (1 << s))
return FALSE;
return false;
new_writemask |= 1 << s;
}
}
@ -1231,7 +1231,7 @@ static BOOL invert_swizzle(unsigned int *swizzle, unsigned int *writemask, unsig
*swizzle = inverted;
*writemask = new_writemask;
*ret_width = width;
return TRUE;
return true;
}
static struct hlsl_ir_node *add_assignment(struct list *instrs, struct hlsl_ir_node *lhs,
@ -1377,7 +1377,7 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers,
struct list *statements_list;
struct hlsl_ir_var *var;
struct hlsl_type *type;
BOOL ret, local = TRUE;
bool ret, local = true;
if (basic_type->type == HLSL_CLASS_MATRIX)
assert(basic_type->modifiers & HLSL_MODIFIERS_MAJORITY_MASK);
@ -1411,7 +1411,7 @@ static struct list *declare_vars(struct hlsl_type *basic_type, DWORD modifiers,
if (hlsl_ctx.cur_scope == hlsl_ctx.globals)
{
var->modifiers |= HLSL_STORAGE_UNIFORM;
local = FALSE;
local = false;
}
if (type->modifiers & HLSL_MODIFIER_CONST && !(var->modifiers & HLSL_STORAGE_UNIFORM) && !v->initializer.args_count)
@ -1723,7 +1723,7 @@ hlsl_prog:
{
const struct hlsl_ir_function_decl *decl;
decl = get_overloaded_func(&hlsl_ctx.functions, $2.name, $2.decl->parameters, TRUE);
decl = get_overloaded_func(&hlsl_ctx.functions, $2.name, $2.decl->parameters, true);
if (decl && !decl->func->intrinsic)
{
if (decl->body && $2.decl->body)
@ -1751,7 +1751,7 @@ hlsl_prog:
}
TRACE("Adding function '%s' to the function list.\n", $2.name);
hlsl_add_function(&hlsl_ctx.functions, $2.name, $2.decl, FALSE);
hlsl_add_function(&hlsl_ctx.functions, $2.name, $2.decl, false);
}
| hlsl_prog declaration_statement
{
@ -1822,7 +1822,7 @@ struct_spec:
named_struct_spec:
KW_STRUCT any_identifier '{' fields_list '}'
{
BOOL ret;
bool ret;
TRACE("Structure %s declaration.\n", debugstr_a($2));
$$ = hlsl_new_struct_type($2, $4);
@ -1861,14 +1861,14 @@ fields_list:
}
| fields_list field
{
BOOL ret;
bool ret;
struct hlsl_struct_field *field, *next;
$$ = $1;
LIST_FOR_EACH_ENTRY_SAFE(field, next, $2, struct hlsl_struct_field, entry)
{
ret = add_struct_field($$, field);
if (ret == FALSE)
if (ret == false)
{
hlsl_report_message(get_location(&@2),
HLSL_LEVEL_ERROR, "redefinition of '%s'", field->name);
@ -2153,12 +2153,12 @@ base_type:
}
| TYPE_IDENTIFIER
{
$$ = hlsl_get_type(hlsl_ctx.cur_scope, $1, TRUE);
$$ = hlsl_get_type(hlsl_ctx.cur_scope, $1, true);
vkd3d_free($1);
}
| KW_STRUCT TYPE_IDENTIFIER
{
$$ = hlsl_get_type(hlsl_ctx.cur_scope, $2, TRUE);
$$ = hlsl_get_type(hlsl_ctx.cur_scope, $2, true);
if ($$->type != HLSL_CLASS_STRUCT)
hlsl_report_message(get_location(&@1), HLSL_LEVEL_ERROR, "'%s' redefined as a structure\n", $2);
vkd3d_free($2);