[PATCH vkd3d 3/5] vkd3d-shader: Store the shader type and version in the hlsl_ctx structure.
Zebediah Figura (she/her)
zfigura at codeweavers.com
Fri Apr 2 17:08:12 CDT 2021
On 4/2/21 3:05 PM, Matteo Bruni wrote:
> On Wed, Mar 31, 2021 at 12:04 AM Zebediah Figura
> <zfigura at codeweavers.com> wrote:
>>
>> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
>> ---
>> libs/vkd3d-shader/hlsl.c | 9 +++++++--
>> libs/vkd3d-shader/hlsl.h | 4 ++++
>> 2 files changed, 11 insertions(+), 2 deletions(-)
>>
>> diff --git a/libs/vkd3d-shader/hlsl.c b/libs/vkd3d-shader/hlsl.c
>> index 67ca2f2c..c1f03978 100644
>> --- a/libs/vkd3d-shader/hlsl.c
>> +++ b/libs/vkd3d-shader/hlsl.c
>> @@ -1556,10 +1556,15 @@ static void declare_predefined_types(struct hlsl_ctx *ctx)
>> }
>> }
>>
>> -static bool hlsl_ctx_init(struct hlsl_ctx *ctx, struct vkd3d_shader_message_context *message_context)
>> +static bool hlsl_ctx_init(struct hlsl_ctx *ctx, const struct hlsl_profile_info *profile,
>> + struct vkd3d_shader_message_context *message_context)
>> {
>> memset(ctx, 0, sizeof(*ctx));
>>
>> + ctx->shader_type = profile->type;
>> + ctx->major_version = profile->sm_major;
>> + ctx->minor_version = profile->sm_minor;
>> +
>> ctx->message_context = message_context;
>>
>> if (!(ctx->source_files = vkd3d_malloc(sizeof(*ctx->source_files))))
>> @@ -1642,7 +1647,7 @@ int hlsl_compile_shader(const struct vkd3d_shader_code *hlsl, const struct vkd3d
>>
>> vkd3d_shader_dump_shader(profile->type, &compile_info->source);
>>
>> - if (!hlsl_ctx_init(&ctx, message_context))
>> + if (!hlsl_ctx_init(&ctx, profile, message_context))
>> return VKD3D_ERROR_OUT_OF_MEMORY;
>>
>> if (hlsl_lexer_compile(&ctx, hlsl) == 2)
>> diff --git a/libs/vkd3d-shader/hlsl.h b/libs/vkd3d-shader/hlsl.h
>> index 664137ce..475119d1 100644
>> --- a/libs/vkd3d-shader/hlsl.h
>> +++ b/libs/vkd3d-shader/hlsl.h
>> @@ -380,6 +380,7 @@ struct hlsl_ir_constant
>> double d[4];
>> bool b[4];
>> } value;
>> + struct hlsl_reg reg;
>> };
>>
>> struct hlsl_scope
>> @@ -392,6 +393,9 @@ struct hlsl_scope
>>
>> struct hlsl_ctx
>> {
>> + enum vkd3d_shader_type shader_type;
>> + unsigned int major_version, minor_version;
>> +
>> const char **source_files;
>> unsigned int source_files_count;
>> struct vkd3d_shader_location location;
>
> Otherwise we could store a pointer to the hlsl_profile_info structure.
> Not sure if that would make things more complicated down the line.
>
I don't think it makes a particular difference, no; that seems like a
good idea.
-------------- 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/20210402/4845601b/attachment.sig>
More information about the wine-devel
mailing list