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

Henri Verbeet hverbeet at gmail.com
Fri Sep 25 07:58:23 CDT 2020


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().

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().)



More information about the wine-devel mailing list