Module: vkd3d Branch: master Commit: 001328e08497754a9ff8ceb66d563977a4563970 URL: https://source.winehq.org/git/vkd3d.git/?a=commit;h=001328e08497754a9ff8ceb6...
Author: Zebediah Figura zfigura@codeweavers.com Date: Thu Mar 4 17:33:28 2021 -0600
vkd3d-shader: Use yy_scan_bytes() instead of yy_scan_string().
Signed-off-by: Zebediah Figura zfigura@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com Signed-off-by: Matteo Bruni mbruni@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
libs/vkd3d-shader/hlsl.c | 4 ++-- libs/vkd3d-shader/hlsl.h | 2 +- libs/vkd3d-shader/hlsl.l | 4 ++-- libs/vkd3d-shader/vkd3d_shader_main.c | 2 +- libs/vkd3d-shader/vkd3d_shader_private.h | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c index 19bfc93..e78f05c 100644 --- a/libs/vkd3d-shader/hlsl.c +++ b/libs/vkd3d-shader/hlsl.c @@ -1618,7 +1618,7 @@ static void hlsl_ctx_cleanup(struct hlsl_ctx *ctx) hlsl_free_type(type); }
-int hlsl_compile_shader(const char *text, const struct vkd3d_shader_compile_info *compile_info, +int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *dxbc, struct vkd3d_shader_message_context *message_context) { const struct vkd3d_shader_hlsl_source_info *hlsl_source_info; @@ -1646,7 +1646,7 @@ int hlsl_compile_shader(const char *text, const struct vkd3d_shader_compile_info if (!hlsl_ctx_init(&ctx, message_context)) return VKD3D_ERROR_OUT_OF_MEMORY;
- if (hlsl_lexer_compile(&ctx, text) == 2) + if (hlsl_lexer_compile(&ctx, hlsl) == 2) { hlsl_ctx_cleanup(&ctx); return VKD3D_ERROR_OUT_OF_MEMORY; diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h index 4af021e..7673440 100644 --- a/libs/vkd3d-shader/hlsl.h +++ b/libs/vkd3d-shader/hlsl.h @@ -572,6 +572,6 @@ 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;
-int hlsl_lexer_compile(struct hlsl_ctx *ctx, const char *text) DECLSPEC_HIDDEN; +int hlsl_lexer_compile(struct hlsl_ctx *ctx, const struct vkd3d_shader_code *hlsl) DECLSPEC_HIDDEN;
#endif diff --git a/libs/vkd3d-shader/hlsl.l b/libs/vkd3d-shader/hlsl.l index da54d57..cee98ea 100644 --- a/libs/vkd3d-shader/hlsl.l +++ b/libs/vkd3d-shader/hlsl.l @@ -282,13 +282,13 @@ static void update_location(struct hlsl_ctx *ctx, YYLTYPE *lloc) ctx->location.column += yyget_leng(ctx->scanner); }
-int hlsl_lexer_compile(struct hlsl_ctx *ctx, const char *text) +int hlsl_lexer_compile(struct hlsl_ctx *ctx, const struct vkd3d_shader_code *hlsl) { YY_BUFFER_STATE buffer; int ret;
yylex_init_extra(ctx, &ctx->scanner); - buffer = yy_scan_string(text, ctx->scanner); + buffer = yy_scan_bytes(hlsl->code, hlsl->size, ctx->scanner); yy_switch_to_buffer(buffer, ctx->scanner);
ret = hlsl_yyparse(ctx->scanner, ctx); diff --git a/libs/vkd3d-shader/vkd3d_shader_main.c b/libs/vkd3d-shader/vkd3d_shader_main.c index 5113624..2308b89 100644 --- a/libs/vkd3d-shader/vkd3d_shader_main.c +++ b/libs/vkd3d-shader/vkd3d_shader_main.c @@ -1047,7 +1047,7 @@ static int compile_hlsl(const struct vkd3d_shader_compile_info *compile_info, if ((ret = preproc_lexer_parse(compile_info, &preprocessed, message_context))) return ret;
- ret = hlsl_compile_shader(preprocessed.code, compile_info, out, message_context); + ret = hlsl_compile_shader(&preprocessed, compile_info, out, message_context);
vkd3d_shader_free_shader_code(&preprocessed); return ret; diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index cf66c67..6d756e4 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -949,7 +949,7 @@ void vkd3d_compute_dxbc_checksum(const void *dxbc, size_t size, uint32_t checksu int preproc_lexer_parse(const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *out, struct vkd3d_shader_message_context *message_context) DECLSPEC_HIDDEN;
-int hlsl_compile_shader(const char *text, const struct vkd3d_shader_compile_info *compile_info, +int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d_shader_compile_info *compile_info, struct vkd3d_shader_code *dxbc, struct vkd3d_shader_message_context *message_context) DECLSPEC_HIDDEN;
static inline enum vkd3d_shader_component_type vkd3d_component_type_from_data_type(