vkd3d: Thoughts on how to include shaders in the project?
philip.rebohle at tu-dortmund.de
Mon Nov 4 11:38:32 CST 2019
Am 04.11.19 um 17:12 schrieb Henri Verbeet:
> Hi Philip,
> On Mon, 4 Nov 2019 at 19:16, Philip Rebohle
> <philip.rebohle at tu-dortmund.de> wrote:
>> I'm currently looking into getting Deus Ex: Mankind Divided to run on
>> vkd3d. Among other issues, it uses ClearUnorderedAccessView for typed
>> buffer views, which is currently not supported and will require the use
>> of a compute shader.
>> There are also a few other areas where shader-based implementations
>> might become necessary in the future, e.g. for copies between depth and
>> color images, ResolveSubresource with typeless images, etc.
>> What would be the preferred way to integrate shaders for this purpose in
> I think the preferred way would be to include them as HLSL source, and
> use vkd3d-shader to compile them to SPIR-V. The tricky part there is
> that the HLSL compiler is currently still a work in progress. It's
> possible to use Microsoft's fxc as a replacement—we've used that for
> vkmodelviewer in the past—but it seems undesirable to have fxc as a
> dependency for vkd3d.
Is there any particular reason you're suggesting HLSL? Given that these
shaders would sort out some of the gritty implementation details and we
want full control over how exactly resources are accessed, I'd think
having a more direct path without going through DXBC and especially the
peculiarities of the D3D12 binding model would be preferable.
>> One option would be to compile GLSL shaders at build-time to a C header
>> containing the SPIR-V code, which could then be included in the vkd3d
>> source files directly.
>> This would introduce glslangValidator as a new build-time dependency, is
>> that acceptable? Also, how would this be implemented in the build
>> system? I don't have much experience with autoconf, so some help in that
>> regard would be highly appreciated.
> In principle, sure. We used to have a dependency on glslangValidator
> in the past for the demos, but that was removed in commit
> aa5d48eec4987c4c1cb55571b536cd485c25740b once vkd3d-shader became
> capable of translating the TPF/DXBC shaders.
>> I'd like to avoid including pre-compiled SPIR-V binaries in the source
>> tree directly or installing them as separate files if possible, since
>> doing so would complicate the workflow significantly.
> What we typically do (e.g. in the tests) is to include HLSL source in
> a comment, and then setup editor commands to generate the equivalent
> blob inline. It's not too bad once you have things set up, but it is a
> bit of a pain, yes.
Right, I might just do this for now to get things started.
More information about the wine-devel