qt5base-lts/tests/manual/rhi/multiview
Laszlo Agocs b7d9b7fa69 rhi: d3d12: Implement multiview support
This relies on qsb being able to invoke dxc instead of fxc when the
request HLSL (shader model) version is 6.1.  (6.1 is required for
SV_ViewID) This currently works only when conditioning offline with
qsb (or via CMake), because qsb can easily invoke dxc instead of
fxc. When shipping HLSL inside the .qsb package (so when -c is not
specified or running the external tool fails), this won't work since
the D3D12 backend still uses D3DCompile(), not IDxcCompiler. Support
for that will be investigated separately.

We also need to bump to ID3D12Device2 and ID3D12GraphicsCommandList1.
With Windows 10 version 1703 being quite old now, this should not be a
problem at run time.

There are however issues at build time, namely that MinGW and
MinGW/LLVM and similar seems to have ancient Windows SDK headers
according to the CI test runs. None of the MSVC configurations have
this in the CI, they have reasonable versions of d3d12.h and similar.

Therefore, one important aspect of this change is that the D3D12
backend of QRhi will only be available from now on when the SDK
headers are new enough (meaning ID3D12Device2 is declared, which is a
several years old type now). Otherwise, QRhi::create() will simply
fail when asking for D3D12 with a helpful warning message about the Qt
build being crippled.

Implementation-wise, there are surprises in store as well:

The way the PSO is created needs to be revamped to follow the
extensible approach that uses a pipeline state stream
description. Both the graphics and compute pipeline creation is
changed to use CreatePipelineState() and the associated
machinery. This is only really essential for graphics pipelines since
we know have to include data for view instancing (multiview). For
compute the result is the same as before.

Additionally, the view count must now be baked into the
QRhiGraphicsPipeline. This means that applications must call
setMultiViewCount() with the same value (typically 2) *both* on the
render target's color attachment and on the pipeline. Backends that do
not care about the pipeline's view count (GL, Vulkan) will of course
ignore it, but if it's not set correctly D3D12 will fail. The manual
test is updated accordingly.

Fixes: QTBUG-114772
Change-Id: I93db7313377e711c2faeb956815899b12132d23b
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
2023-06-22 15:20:26 +02:00
..
buildshaders.bat rhi: d3d12: Implement multiview support 2023-06-22 15:20:26 +02:00
CMakeLists.txt rhi: Introduce multiview starting with OpenGL (ES) 2023-06-22 15:20:26 +02:00
multiview.cpp rhi: d3d12: Implement multiview support 2023-06-22 15:20:26 +02:00
multiview.frag rhi: Introduce multiview starting with OpenGL (ES) 2023-06-22 15:20:26 +02:00
multiview.frag.qsb rhi: d3d12: Implement multiview support 2023-06-22 15:20:26 +02:00
multiview.pro rhi: Introduce multiview starting with OpenGL (ES) 2023-06-22 15:20:26 +02:00
multiview.qrc rhi: Introduce multiview starting with OpenGL (ES) 2023-06-22 15:20:26 +02:00
multiview.vert rhi: Introduce multiview starting with OpenGL (ES) 2023-06-22 15:20:26 +02:00
multiview.vert.qsb rhi: d3d12: Implement multiview support 2023-06-22 15:20:26 +02:00
texture.frag rhi: Introduce multiview starting with OpenGL (ES) 2023-06-22 15:20:26 +02:00
texture.frag.qsb rhi: d3d12: Implement multiview support 2023-06-22 15:20:26 +02:00
texture.vert rhi: Introduce multiview starting with OpenGL (ES) 2023-06-22 15:20:26 +02:00
texture.vert.qsb rhi: d3d12: Implement multiview support 2023-06-22 15:20:26 +02:00