[PATCH vkd3d 3/6] vkd3d-shader/hlsl: Write an empty SHDR section.

Zebediah Figura (she/her) zfigura at codeweavers.com
Thu Aug 19 10:46:56 CDT 2021


On 8/19/21 10:29 AM, Matteo Bruni wrote:
> On Tue, Aug 17, 2021 at 7:39 PM Zebediah Figura <zfigura at codeweavers.com> wrote:
>>
>> Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
>> ---
>>   libs/vkd3d-shader/hlsl_sm4.c | 34 +++++++++++++++++++++++++++++++++-
>>   libs/vkd3d-shader/sm4.h      |  1 +
>>   2 files changed, 34 insertions(+), 1 deletion(-)
>>
>> diff --git a/libs/vkd3d-shader/hlsl_sm4.c b/libs/vkd3d-shader/hlsl_sm4.c
>> index 977b8395..c9a427d8 100644
>> --- a/libs/vkd3d-shader/hlsl_sm4.c
>> +++ b/libs/vkd3d-shader/hlsl_sm4.c
>> @@ -20,12 +20,44 @@
>>
>>   #include "hlsl.h"
>>   #include <stdio.h>
>> +#include "sm4.h"
>> +
>> +static void write_sm4_shdr(struct hlsl_ctx *ctx, struct dxbc_writer *dxbc)
>> +{
>> +    const struct hlsl_profile_info *profile = ctx->profile;
>> +    struct vkd3d_bytecode_buffer buffer = {0};
>> +
>> +    static const uint16_t shader_types[VKD3D_SHADER_TYPE_COUNT] =
>> +    {
>> +        VKD3D_SM4_PS,
>> +        VKD3D_SM4_VS,
>> +        VKD3D_SM4_GS,
>> +        VKD3D_SM5_HS,
>> +        VKD3D_SM5_DS,
>> +        VKD3D_SM5_CS,
>> +        0, /* EFFECT */
>> +        0, /* TEXTURE */
>> +        VKD3D_SM4_LIB,
>> +    };
>> +
>> +    put_u32(&buffer, (shader_types[profile->type] << 16) | (profile->major_version << 4) | profile->minor_version);
> 
> It might make sense to use vkd3d_make_u32() here.
> There are other similar occurrences in patch 4/6 and 5/6.
> 

Yes, that's pretty much exactly what I added it for. Sadly I wrote that 
patch after most of these...

I'll send a follow-up.



More information about the wine-devel mailing list