[PATCH vkd3d 4/5] vkd3d-shader: Implement #include.

Zebediah Figura (she/her) zfigura at codeweavers.com
Thu Jan 7 10:55:25 CST 2021


On 1/7/21 6:49 AM, Matteo Bruni wrote:
> On Tue, Jan 5, 2021 at 5:18 PM Zebediah Figura <zfigura at codeweavers.com> wrote:
>>
>> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
>> ---
>>  libs/vkd3d-shader/preproc.h              |  44 +++++--
>>  libs/vkd3d-shader/preproc.l              | 129 +++++++++++++++----
>>  libs/vkd3d-shader/preproc.y              | 155 +++++++++++++++++++++--
>>  libs/vkd3d-shader/vkd3d_shader_private.h |   1 +
>>  tests/hlsl_d3d12.c                       |  16 +--
>>  5 files changed, 292 insertions(+), 53 deletions(-)
>>
>> @@ -60,8 +76,16 @@ struct preproc_ctx
>>      bool error;
>>  };
>>
>> +void preproc_close_include(struct preproc_ctx *ctx, const struct vkd3d_shader_code *code) 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,
>>          enum vkd3d_shader_error error, const char *format, ...) VKD3D_PRINTF_FUNC(4, 5) DECLSPEC_HIDDEN;
>>
>> +static struct preproc_file *preproc_get_top_file(struct preproc_ctx *ctx)
>> +{
>> +    assert(ctx->file_count);
>> +    return &ctx->file_stack[ctx->file_count - 1];
>> +}
> 
> There are a couple of places in preproc.l (e.g. in update_location(),
> preproc_pop_buffer()) where this helper can be used, in particular one
> with the same assert too. It's a stylistic choice so not using it is
> also fine.
> You probably want to make the function inline though.
> 
> I like the patch overall.
> 

That sounds right. I think it ended up not being used there in the first
place because of some restructuring of how I handled the buffer stack.
I'll add those and resend.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20210107/01ae7c54/attachment-0001.sig>


More information about the wine-devel mailing list