vkd3d-shader: Implement macro body expansion.

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-01-12 16:14:17 -06:00
committed by Alexandre Julliard
parent 73a937edd0
commit 668820f069
5 changed files with 114 additions and 23 deletions

View File

@@ -50,10 +50,24 @@ struct preproc_file
size_t if_count, if_stack_size;
};
struct preproc_text
{
struct vkd3d_string_buffer text;
struct vkd3d_shader_location location;
};
struct preproc_expansion
{
struct preproc_buffer buffer;
const struct preproc_text *text;
};
struct preproc_macro
{
struct rb_entry entry;
char *name;
struct preproc_text body;
};
struct preproc_ctx
@@ -67,6 +81,9 @@ struct preproc_ctx
struct preproc_file *file_stack;
size_t file_count, file_stack_size;
struct preproc_expansion *expansion_stack;
size_t expansion_count, expansion_stack_size;
struct rb_tree macros;
int current_directive;
@@ -78,6 +95,7 @@ struct preproc_ctx
};
void preproc_close_include(struct preproc_ctx *ctx, const struct vkd3d_shader_code *code) DECLSPEC_HIDDEN;
struct preproc_macro *preproc_find_macro(struct preproc_ctx *ctx, const char *name) DECLSPEC_HIDDEN;
void preproc_free_macro(struct preproc_macro *macro) DECLSPEC_HIDDEN;
bool preproc_push_include(struct preproc_ctx *ctx, char *filename, const struct vkd3d_shader_code *code) DECLSPEC_HIDDEN;
void preproc_warning(struct preproc_ctx *ctx, const struct vkd3d_shader_location *loc,