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>
This commit is contained in:
Zebediah Figura 2021-03-04 17:33:28 -06:00 committed by Alexandre Julliard
parent b35fd8628e
commit 001328e084
5 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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(