Zebediah Figura : vkd3d-shader: Replace "parse_status" with a boolean variable.
Alexandre Julliard
julliard at winehq.org
Tue Feb 16 15:53:08 CST 2021
Module: vkd3d
Branch: master
Commit: 193218f54ed50e79760dd9ac49103debc5c97eb3
URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=193218f54ed50e79760dd9ac49103debc5c97eb3
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Fri Feb 12 14:38:46 2021 -0600
vkd3d-shader: Replace "parse_status" with a boolean variable.
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
libs/vkd3d-shader/hlsl.c | 4 +---
libs/vkd3d-shader/hlsl.h | 17 +----------------
libs/vkd3d-shader/hlsl.y | 6 +++---
3 files changed, 5 insertions(+), 22 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
index a129e84..4151c84 100644
--- a/libs/vkd3d-shader/hlsl.c
+++ b/libs/vkd3d-shader/hlsl.c
@@ -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)
diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
index 067aae8..88e7df5 100644
--- a/libs/vkd3d-shader/hlsl.h
+++ b/libs/vkd3d-shader/hlsl.h
@@ -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;
diff --git a/libs/vkd3d-shader/hlsl.y b/libs/vkd3d-shader/hlsl.y
index d7201f5..2fda89e 100644
--- a/libs/vkd3d-shader/hlsl.y
+++ b/libs/vkd3d-shader/hlsl.y
@@ -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;
}
More information about the wine-cvs
mailing list