[PATCH vkd3d v3 3/3] vkd3d-compiler: Try to detect the source type by inspecting the file.

Henri Verbeet hverbeet at gmail.com
Thu Jan 6 03:33:51 CST 2022


On Sun, 26 Dec 2021 at 05:43, Zebediah Figura <zfigura at codeweavers.com> wrote:
>      {VKD3D_SHADER_SOURCE_D3D_BYTECODE,
>          "d3dbc",        "Legacy Direct3D byte-code.\n"
>          "                This is the format used for Direct3D shader model 1, 2, and 3 shaders.\n",
> -        true},
> +        true, VKD3D_SHADER_TARGET_SPIRV_BINARY},

On some level this is fine, but note that SPIR-V isn't currently a
supported target type for d3dbc...

> +    if (options.source_type == VKD3D_SHADER_SOURCE_NONE)
> +    {
> +        uint32_t token;
> +
> +        if (options.preprocess_only)
> +        {
> +            options.source_type = VKD3D_SHADER_SOURCE_HLSL;
> +        }
> +        else if (info.source.size >= sizeof(token))
> +        {
> +            memcpy(&token, info.source.code, sizeof(token));
> +            if (token == TAG_DXBC)
> +                options.source_type = VKD3D_SHADER_SOURCE_DXBC_TPF;

Note that DXBC containers can also contain e.g. DXIL or Aon9 source though.



More information about the wine-devel mailing list