Commit Graph

659 Commits

Author SHA1 Message Date
Jesse Natalie bdf91b25d9 dzn: Retrieve validator version
For platforms where there's no validator available, leave the field zero-initialized
to let the DXIL backend choose whatever target validator version it wants.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie b8328c9664 microsoft/compiler: Blacklist DXIL validator 1.6 from 20348 SDK
This version claims to support validator version 1.6, but doesn't
actually have the 1.6 changes (PSV v2, PSV resource v1, barycentrics).

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 8fcd506178 microsoft/compiler: Add a getter for a validator version from DXIL.dll
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 46335debf6 microsoft/compiler: Support DXIL validator 1.7
Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 4abe781a0b microsoft/compiler: Support DXIL validator 1.6
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 9dbaece312 microsoft/compiler: DXIL validator 1.6 uses a new PSV resource struct
This is a huge pain because it's an array, meaning that accessing
an entry in the array now depends on the validator version to use
the right element stride.

We could always just store the v1 and downconvert if needed... but
this isn't *that* bad that I felt I had to do it that way.

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie d9e575d4d7 microsoft/compiler: DXIL validator 1.6 uses a new PSV struct version
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 4d257929da microsoft/compiler: Set the barycentrics flag for attribute_at_vertex
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 271c8d7a8c microsoft/compiler: DXIL validator 1.6 counts UAVs differently
Instead of counting the number of UAV arrays, it counts the
number of actual UAVs declared. This is more correct, but we
need to do the same accounting to set the 64 UAVs flag.

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 494af9db04 microsoft/compiler: Correctly compute dynamic indexing I/O masks
Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 31d09d2f77 microsoft/compiler: Compute correct usage masks
This starts actually updating the always-read/never-written
masks while processing the shader. Note that we follow DXC's
lead here and treat "always read" as "sometimes read."

This isn't strictly required, but might help drivers out.

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie c26b28f711 microsoft/compiler: Support DXIL validator version 1.5
This version of the validator starts adding usage masks into
the DXIL, which then are expected to match the PSV and signature
data. The usage masks are "correct" meaning that the never-writes
mask no longer includes bits outside of components 0-3.

A future change will actually compute useful masks.

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 170d428887 microsoft/compiler: Lower I/O to scalar
A future change will start computing component masks while
processing I/O instructions, and only having to compute
a mask for one component per instruction simplifies things.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 80d35739ff microsoft/compiler: Ensure 4-component position writes via NIR
We're about to lower I/O to scalar, which means we'll end up with
multiple writes to position, and none of them has enough info to
fill in the blanks.

This causes a test that previously crashed on WARP (due to
StoreOutput with an undef not being handled) to fail more
gracefully - but that failure means that the test spends
forever just outputting errors, so explicitly skip it.

Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 252c3c409d microsoft/compiler: Split signature processing into two parts
First, preprocess the signatures, strictly based on the variables
in the nir shader. Then, later, after the actual shader contents
have been processed, we emit the metadata.

This lets shader processing rely on the pre-processed data (e.g.
the row -> ID mapping needed for large VS inputs) while also allowing
the signature data to rely on data gathered during the shader traversal
(e.g. which components are actually used).

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie e4c927545d microsoft/compiler: Emit metadata based on long-lived signature data
Instead of using the short-lived semantic structure (that's used to
fill out the long-lived signature and PSV data), use the long-lived
ones. This is staging so we can hold off on emitting the metadata
until later.

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie 6af22121cf microsoft/compiler: Add a max validator version
Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Jesse Natalie c8f63e07da microsoft/compiler: Add a max shader model option
Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17603>
2022-07-23 14:48:17 +00:00
Emma Anholt f6c5b1d6c6 nir: Split usub_sat lowering flag from uadd_sat.
Intel vec4 would like to do uadd_sat, but use lowering for usub_sat.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17637>
2022-07-22 17:54:28 +00:00
Erik Faye-Lund e630637eab dzn: expose VK_KHR_driver_properties
We're not quite conformant with the extension, because we don't have
a valid conformance version.

That's not a quick-fix, so we should probably just accept some failures
for now.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16998>
2022-07-18 17:10:52 +02:00
Erik Faye-Lund e5da067384 dzn: fill misc props
This is just a bag of misc properties that we should fill in.

Not all of them are filled out super accurately, but this is the best we
can do for now.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16998>
2022-07-18 16:49:42 +02:00
Erik Faye-Lund 053e2fd9d0 dzn: fill in minmax props
This should be possible to support, but we don't support minmax blending
at all yet, so let's leave these as unsupported for now.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16998>
2022-07-18 16:49:42 +02:00
Erik Faye-Lund 18c590e0b3 dzn: fill in depth/stencil resolve props
Before enabling Vulkan 1.2 support, we need to fix the TODO in here.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16998>
2022-07-18 16:49:42 +02:00
Erik Faye-Lund 141e715f29 dzn: fill in bindless props
These might not be exactly right, but they are good enough for now.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16998>
2022-07-18 16:49:42 +02:00
Erik Faye-Lund 34b0828cdc dzn: fill in non-uniform-indexing props
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16998>
2022-07-18 16:49:42 +02:00
Erik Faye-Lund 8e9191cd24 dzn: fill in float-control details
We can do better here in the future, but this is what's supported right
now.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16998>
2022-07-18 16:49:42 +02:00
Erik Faye-Lund 4d7403d4dc dzn: fill in driver name and info
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16998>
2022-07-18 16:49:42 +02:00
Jesse Natalie f4f1914cd2 microsoft/clc: Add helpers to build with correct ABI for MinGW
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17548>
2022-07-15 16:27:11 +00:00
Jesse Natalie 489ab1aa3b dzn: Remove the cast when the SDK version is high enough
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17548>
2022-07-15 16:27:11 +00:00
Jesse Natalie b9fb14da06 dzn: Missed ABI fixes for GetCustomHeapProperties
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Reviewed-by: Sil Vilerino <sivileri@microsoft.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17548>
2022-07-15 16:27:11 +00:00
Enrico Galli 1f0d27e45f microsoft/spirv_to_dxil: Fix discard to demote + return pass
While SPIR-V's OpKill is block terminating, the converted discard
intrinsic is not block terminating. This can lead to issues where
instruction could be placed after discard.

This patch adds an extra pass that drops all instructions after discard
before we convert discards.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17474>
2022-07-12 20:22:52 +00:00
Eric Engestrom a96ddc3803 dzn: use updated tokens from vk.xml
Signed-off-by: Eric Engestrom <eric@igalia.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17342>
2022-07-12 15:53:11 +00:00
Jesse Natalie 5a59211acd dzn: Use fabs on floating point input
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17423>
2022-07-09 14:04:48 +00:00
Jesse Natalie 2ace7832f9 dzn: Re-order dzn_physical_device_desc so = { 0 } doesn't initialize a struct
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17423>
2022-07-09 14:04:48 +00:00
Jesse Natalie e0ebae8dca dzn: Fix comparison order for format enums
Fixes: 53a352e1 ("dzn: Provide a helper to check if 2 formats are compatible")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17423>
2022-07-09 14:04:48 +00:00
Jesse Natalie 6c1ab8fdeb dzn: Disable Wunused-value for C++ files
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17423>
2022-07-09 14:04:48 +00:00
Jesse Natalie 10e8e0b9d6 dzn: Only add Werror flags that the compiler supports
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17423>
2022-07-09 14:04:48 +00:00
Jesse Natalie 4ea58cf35f dzn: Re-order includes in dzn_nir to prevent TRUE redefinition
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17423>
2022-07-09 14:04:48 +00:00
Jesse Natalie f7c741c058 dzn: Add for condition to break nested loop
Fixes: d132ec92 ("dzn: Support native image copies when formats are compatible")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17377>
2022-07-08 19:17:53 +00:00
pal1000 36516b869e dzn: Fix incompatible pointer type error affecting MSYS2 MINGW32
Suggested-by: Yonggang Luo <luoyonggang@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6807

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17414>
2022-07-08 18:53:24 +00:00
Jesse Natalie b16f9f8ba4 dzn: Only support high/normal queue priorities
D3D uses an int which seems like it'd support value between 0 and 100,
but in reality it only accepts values of exactly 0, or 100. The space
is left in case future values were to be added, so that comparisons
would work (e.g. MEDIUM_HIGH < HIGH).

Treat higher than 0.5 to be HIGH, and anything less to be NORMAL.

Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17406>
2022-07-08 03:09:11 +00:00
Jesse Natalie 6ee9002ff6 dzn: Fix winsys reporting
For Windows we don't support using the DISPLAY winsys,
and for WSL we should add the ones that support software

Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17346>
2022-07-07 23:02:00 +00:00
Jason Ekstrand 0b92636b62 dozen: Stop asking for semaphore/fence signaling
Dozen is currently a SW driver as far as WSI is concerned so it's going
to wait on a fence anyway.  Also, I highly doubt it's actually hooked
these up properly.  It's probably just a copy+paste from ANV.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388>
2022-07-07 11:44:20 -05:00
Jason Ekstrand 14dd5bd2cb dozen: Increase optimalBufferCopy*Alignment
D3D12 requires the offset to be 512B-aligned and row pitch to be
256B-aligned for copy commands.  There will need to be a fallback
written eventually because Vulkan has no such requirements but these
will remain the optimal limits as they allow using the D3D12 copy
commands directly.

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17388>
2022-07-07 11:44:19 -05:00
Jesse Natalie 53565c9929 dzn: Add ABI helpers for D3D12 functions returning structs
The currently available D3D12 API headers have incorrect C function
prototypes for these functions when compiling for non-Windows platforms.

Future changes here will move these helpers into the DirectX-Headers
project, but:
* The process of getting a fix into the headers is still ongoing
* I'd prefer to avoid taking an immediate dependency on just-published
  headers again

So, for now add some helpers to work around this problem in Dozen

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17340>
2022-07-06 12:18:55 +00:00
Jesse Natalie 074275d911 dzn: Add a DXCore enumeration path
WSL doesn't have DXGI, but it does have DXCore. DXCore also has a nice
property that it filters to only D3D12-capable adapters. We can rely
on DXCore as a first option even for Windows, because we'll be able
to let the Vulkan loader do preference sorting, instead of having to
rely on DXGI to do it for us.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17340>
2022-07-06 12:18:55 +00:00
Jesse Natalie 49967ea306 dzn: Move DXGI code to a separate file and only build it on Windows
The prototypes for physical device enumeration are moved to a new
dedicated header so that it can be included from a DXCore path,
which will C++, in the next commit

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17340>
2022-07-06 12:18:55 +00:00
Jesse Natalie 68c65de264 dzn: Use a custom adapter desc instead of DXGI adapter desc
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17340>
2022-07-06 12:18:55 +00:00
Jesse Natalie 9a2ab661b7 dzn: Don't hash adapter LUID as part of device UUID
Per the Vulkan spec, the device UUID should be identical between reboots.
It should also uniquely identify different instances of the same device,
e.g. 2 identical GPUs connected to different PCI ports, but D3D doesn't
currently expose a way to do both of these things. Prefer persistence
over uniqueness here.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17340>
2022-07-06 12:18:55 +00:00
Jesse Natalie 236282559e dzn: Use IUnknown instead of IDXGIAdapter1 as the stored adapter
WSL doesn't support DXGI, and DirectX-Headers used to build for WSL
doesn't have the DXGI headers, so we need to isolate DXGI usage
and only build it on Windows

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Bill Kristiansen <billkris@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17340>
2022-07-06 12:18:55 +00:00