vkd3d-shader: Introduce struct vkd3d_shader_source_list.

This commit is contained in:
Henri Verbeet
2025-08-05 21:17:28 +02:00
parent e4bb77ecef
commit 7c37fc6a8b
Notes: Henri Verbeet 2025-08-07 20:51:41 +02:00
Approved-by: Elizabeth Figura (@zfigura)
Approved-by: Henri Verbeet (@hverbeet)
Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1671
5 changed files with 63 additions and 27 deletions

View File

@@ -7190,23 +7190,19 @@ declaration_statement_list:
preproc_directive:
PRE_LINE STRING
{
const char **new_array = NULL;
ctx->location.line = $1;
if (strcmp($2, ctx->location.source_name))
new_array = hlsl_realloc(ctx, ctx->source_files,
sizeof(*ctx->source_files) * (ctx->source_files_count + 1));
if (new_array)
{
ctx->source_files = new_array;
ctx->source_files[ctx->source_files_count++] = $2;
ctx->location.source_name = $2;
}
else
{
vkd3d_free($2);
if (!vkd3d_shader_source_list_append(&ctx->source_files, $2))
{
ctx->result = VKD3D_ERROR_OUT_OF_MEMORY;
}
else
{
ctx->location.line = $1;
ctx->location.source_name = ctx->source_files.sources[ctx->source_files.count - 1];
}
}
vkd3d_free($2);
}
struct_declaration_without_vars: