vkd3d-shader: Replace "parse_status" with a boolean variable.

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-12 14:38:46 -06:00 committed by Alexandre Julliard
parent 8313225cc6
commit 193218f54e
3 changed files with 5 additions and 22 deletions

View File

@ -35,14 +35,12 @@ void hlsl_error(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc, co
{
/* FIXME */
set_parse_status(&ctx->status, PARSE_ERR);
ctx->failed = true;
}
void hlsl_warning(struct hlsl_ctx *ctx, const struct vkd3d_shader_location loc, const char *fmt, ...)
{
/* FIXME */
set_parse_status(&ctx->status, PARSE_WARN);
}
bool hlsl_add_var(struct hlsl_ctx *ctx, struct hlsl_ir_var *decl, bool local_var)

View File

@ -23,13 +23,6 @@
#include "vkd3d_shader_private.h"
#include "rbtree.h"
enum parse_status
{
PARSE_SUCCESS = 0,
PARSE_WARN = 1,
PARSE_ERR = 2
};
/* The general IR structure is inspired by Mesa GLSL hir, even though the code
* ends up being quite different in practice. Anyway, here comes the relevant
* licensing information.
@ -396,8 +389,8 @@ struct hlsl_ctx
const char **source_files;
unsigned int source_files_count;
struct vkd3d_shader_location location;
enum parse_status status;
struct vkd3d_shader_message_context *message_context;
bool failed;
void *scanner;
@ -501,14 +494,6 @@ static inline void hlsl_src_remove(struct hlsl_src *src)
src->node = NULL;
}
static inline void set_parse_status(enum parse_status *current, enum parse_status update)
{
if (update == PARSE_ERR)
*current = PARSE_ERR;
else if (update == PARSE_WARN && *current == PARSE_SUCCESS)
*current = PARSE_WARN;
}
const char *hlsl_base_type_to_string(const struct hlsl_type *type) DECLSPEC_HIDDEN;
const char *debug_hlsl_type(const struct hlsl_type *type) DECLSPEC_HIDDEN;
const char *hlsl_debug_modifiers(DWORD modifiers) DECLSPEC_HIDDEN;

View File

@ -2006,7 +2006,7 @@ param_list:
if (!add_func_parameter(ctx, $$, &$1, @1))
{
ERR("Error adding function parameter %s.\n", $1.name);
set_parse_status(&ctx->status, PARSE_ERR);
ctx->failed = true;
YYABORT;
}
}
@ -3111,7 +3111,7 @@ int hlsl_parser_compile(struct hlsl_ctx *ctx, const char *entrypoint)
yyparse(ctx->scanner, ctx);
if (ctx->status == PARSE_ERR)
if (ctx->failed)
return VKD3D_ERROR_INVALID_SHADER;
if (!(entry_func = get_func_entry(ctx, entrypoint)))
@ -3140,7 +3140,7 @@ int hlsl_parser_compile(struct hlsl_ctx *ctx, const char *entrypoint)
compute_liveness(ctx, entry_func);
if (ctx->status == PARSE_ERR)
if (ctx->failed)
return VKD3D_ERROR_INVALID_SHADER;
return VKD3D_ERROR_NOT_IMPLEMENTED;
}