[PATCH vkd3d 1/4] vkd3d-shader: Expose support for HLSL to DXBC_TPF compilation.

Zebediah Figura zfigura at codeweavers.com
Fri Sep 25 10:44:21 CDT 2020


On 9/25/20 7:58 AM, Henri Verbeet wrote:
> On Fri, 25 Sep 2020 at 03:00, Zebediah Figura <zfigura at codeweavers.com> wrote:
>> +int vkd3d_shader_compile(const struct vkd3d_shader_compile_info *compile_info,
>> +        struct vkd3d_shader_code *out, char **messages)
>> +{
>> +    struct vkd3d_shader_message_context message_context;
>> +    int ret;
>> +
>> +    TRACE("compile_info %p, out %p, messages %p.\n", compile_info, out, messages);
>> +
>> +    if (messages)
>> +        *messages = NULL;
>> +
>> +    if ((ret = vkd3d_shader_validate_compile_info(compile_info)) < 0)
>> +        return ret;
>> +
>> +    if (!vkd3d_shader_message_context_init(&message_context, compile_info->log_level, compile_info->source_name))
>> +        return VKD3D_ERROR_OUT_OF_MEMORY;
>> +
>> +    if (compile_info->source_type == VKD3D_SHADER_SOURCE_DXBC_TPF
>> +            && compile_info->target_type == VKD3D_SHADER_TARGET_SPIRV_BINARY)
>> +        ret = compile_dxbc_to_spirv(compile_info, out, &message_context);
>> +    else if (compile_info->source_type == VKD3D_SHADER_SOURCE_HLSL
>> +            && compile_info->target_type == VKD3D_SHADER_TARGET_DXBC_TPF)
>> +        ret = compile_hlsl_to_dxbc(compile_info, out, &message_context);
>> +
> I guess this is a rebase glitch, but VKD3D_SHADER_SOURCE_DXBC_TPF also
> supports VKD3D_SHADER_TARGET_SPIRV_TEXT as target. (And soon
> VKD3D_SHADER_TARGET_D3D_ASM.) I'd suggest to simply split based on the
> source type here, and then split on target type if needed in a
> hypothetical compile_dxbc().

Yes, this commit is pretty old...

That seems like a better structure; thanks for the suggestion.

> 
> There's probably also room for splitting some of the changes here into
> their own commits. For example, the "message_context" change in the
> vkd3d_shader_scan_context structure. (Although it's not immediately
> clear to me why that would be required at this stage; I guess it
> allows creating the message context in a single place for both
> compile_dxbc_to_spirv() and future compile_hlsl_to_dxbc().)
> 

I don't think it's necessary, but in any case it does seem like a nice
bit of deduplication.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20200925/2359c903/attachment.sig>


More information about the wine-devel mailing list