Commit Graph

798 Commits

Author SHA1 Message Date
Jesse Natalie ad7f7ea007 dzn: Don't use write-combine memory for cache-coherent UMA
Cache coherent UMA implies that the GPU is reading data through the
CPU caches. Using write-combined CPU pages for such a system would
be bad, since the GPU would then be reading uncached data. One
example of such a system is WARP. This significantly improves WARP's
performance for some apps (including the CTS).

Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22225>
(cherry picked from commit eaa8c8097c)
2023-04-20 16:05:00 -07:00
Jesse Natalie 6d08143be0 dzn: Ensure pipeline variants are used for dynamic stencil masks
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22225>
(cherry picked from commit 3db019a816)
2023-04-20 16:05:00 -07:00
Jesse Natalie 67e71ee93f dzn: Fix SRV barrier state on compute command lists
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22225>
(cherry picked from commit f2a5a03d3b)
2023-04-20 16:05:00 -07:00
Jesse Natalie a9b6993937 microsoft/compiler: Fix setting bit 31 in feature flags
Fixes: a84208ee ("microsoft/compiler: Fill out and sort the shader/module flags")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21913>
(cherry picked from commit 273a7cf0e2)
2023-04-04 10:47:22 -07:00
Jesse Natalie f6a8dfe7e1 microsoft/clc: Set features that are used by CL tests
Reviewed-by: Karol Herbst <kherbst@redhat.com>
(cherry picked from commit e9ab33c9a1)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21467>
2023-02-22 23:33:44 +00:00
Jesse Natalie 99a1c04fba dzn: Define a symbol that was present in older D3D headers
D3D12_BARRIER_SYNC_INPUT_ASSEMBLER was renamed to D3D12_BARRIER_SYNC_INDEX_INPUT,
so conditionally define the old name based on the version of the headers that are
being used.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20617>
(cherry picked from commit 1e0adac84a)
2023-02-07 08:35:22 -08:00
Jesse Natalie 48de75f438 dzn: Report as a software device for non-Windows
Fixes: 5f1b8b3e6c ("dzn: Use DXGI swapchains")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20939>
(cherry picked from commit 2010b91547)
2023-01-27 09:17:35 -08:00
Jesse Natalie 668503534d dzn: Fix clear bind flag logic
This is the patch I had meant to merge

Fixes: 8b79e6fb ("dzn: No need to add another bind flag for clears if one is already present")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20361>
(cherry picked from commit f1faf30a5f)
2023-01-17 10:16:16 -08:00
GH Cao af55e36d79 dzn: Declare debug only root_dwords as ASSERTED
Such variable is only used in assert(), so declare it as ASSERTED.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7885
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7234

Signed-off-by: GH Cao <driver1998.ms@outlook.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20676>
2023-01-12 21:02:23 +00:00
Jesse Natalie dee97e7b99 dzn: Allow multiple graphics queues
There's no real reason not to, WDDM supports it. It's not really that
useful, but I don't expect most apps to really want to do it anyway.
It does enable some useful synchronization scenarios sometimes.

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16200>
2023-01-11 09:31:02 +00:00
Boris Brezillon 5f1b8b3e6c dzn: Use DXGI swapchains
Makes things so much faster than doing CPU copies using StretchBlt().

Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16200>
2023-01-11 09:31:02 +00:00
Pedro J. Estébanez 9d814c405b microsoft/spirv_to_dxil: Let linking report the need of runtime data
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20608>
2023-01-10 13:43:01 +00:00
Jesse Natalie 8b79e6fb5e dzn: No need to add another bind flag for clears if one is already present
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20400>
2023-01-10 04:25:26 +00:00
Jesse Natalie c59141d3c2 dzn: Lower tg4 offsets
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20400>
2023-01-10 04:25:26 +00:00
Jesse Natalie 9a991cc52e dzn: Implement point coord
Since we don't support wide points, this isn't a useful feature, but the CTS
requires a particular point coord value for the single rasterized pixel, based
on where the original point coord fell within the pixel. Since we're not doing
a quad, we don't get free interpolation like the GL driver does, so split the
logic between vertex (transform point center into screen space) and pixel
(compute delta between current pixel/sample and point center).

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20400>
2023-01-10 04:25:26 +00:00
Jesse Natalie 03ce60ec7e dzn: Lower fragcoord wtrans
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20400>
2023-01-10 04:25:26 +00:00
Jesse Natalie e8b12006bb dzn: Use the right variable for heap slots when prepping resolves
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20400>
2023-01-10 04:25:26 +00:00
Jesse Natalie 22b8e0c74c microsoft/compiler: Set the advanced texture ops flag correctly
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20400>
2023-01-10 04:25:26 +00:00
Jesse Natalie a84208ee4d microsoft/compiler: Fill out and sort the shader/module flags
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20400>
2023-01-10 04:25:26 +00:00
Jesse Natalie beeeb74a4c microsoft/compiler: For Vulkan, centroid should be ignored on position
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20400>
2023-01-10 04:25:26 +00:00
Jesse Natalie d3cae18cb5 microsoft/compiler: For Vulkan, when shading at sample rate, pos is sample pos
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20400>
2023-01-10 04:25:26 +00:00
Vinson Lee 84527093c4 spirv2dxil: Fix memory leak on error path.
Fix resource leak reported by Coverity Scan.

Resource leak (RESOURCE_LEAK)
leaked_storage: Variable file_contents going out of scope leaks the storage it points to.

Fixes: 531d17c334 ("spirv2dxil: Support linking multiple shaders")
Signed-off-by: Vinson Lee <vlee@freedesktop.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20576>
2023-01-08 21:12:46 +00:00
Jesse Natalie a573f6a6da dzn: Handle split front/back compare/write masks for dynamic state
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20364>
2023-01-04 11:12:34 -08:00
Jesse Natalie 33e2444384 dzn: For CmdBindIndexBuffer, look at the graphics pipeline instead of last used
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20364>
2023-01-04 11:12:34 -08:00
Jesse Natalie a81e832af0 dzn: Don't touch pMultisampleState if rasterizerDiscardEnable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20364>
2023-01-04 11:12:34 -08:00
Jesse Natalie 22bb768a8e dzn: Remove spammy logging during device create
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20364>
2023-01-04 11:12:34 -08:00
Jesse Natalie a0b9e5a93e dzn: Flip on enhanced barrier code paths based on D3D capability
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie dc9a3ed4d5 dzn: Add an "enhanced" version of CmdPipelineBarrier2
This allows us to *much* more accurately express the app's barrier
requests. Unfortunately, there's still a few mismatches, so in those
cases we'll end up conservatively over-synchronizing/flushing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie 4fb076fc22 dzn: Add an enhanced barrier path for internal and fixup barriers
While enhanced barriers is a *much* closer model to Vulkan's, there's
still one big mismatch: Vulkan's "transfer" concept supports clears,
copies, and resolves, while D3D's closest match only supports copies.
So when doing clears and resolves, we need to transition from the copy
layout to the correct layout, and then back.

Internal barriers are done for some meta scenarios as well as render
pass initial layout transitions. These look more or less the same as
non-enhanced, we just want to avoid mixing the two paradigms if possible.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie d50f160d0a dzn: CmdWaitForEvents needs to submit barriers too
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie 2314afae9d dzn: Fix aspects used for blit barriers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie 5b9aedce0e dzn: Remove unnecessary read -> read transition barriers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie e616d33850 dzn: Respect sharing mode
D3D's "simultaneous access" concept pretty closely matches
Vulkan's concurrent sharing mode, except that we don't
support simultaneous access for depth buffers.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie b9df7f0a27 dzn: Store valid BARRIER_ACCESS flag masks for a few objects
A subset of total access flags are valid based on command list
type and resource flags, so store that set during object creation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie 184339ba6f dzn: Store command list type in the command buffer object
We'll want to use this for choosing queue-type-specific
layouts in the new pipeline barrier implementation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie d7f5563907 dzn: Create all buffers in COMMON state
Since they promote/decay, there's no point in using any
other initial state value.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie 76e72ed452 dzn: Delete initial_state which is always COMMON
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20324>
2023-01-04 18:20:26 +00:00
Jesse Natalie 531d17c334 spirv2dxil: Support linking multiple shaders
This probably could/should be split up into multiple commits, but
it's simpler to make this a monolithic change.

This change inlines a bunch of logic from spirv_to_dxil into the
spirv2dxil tool so that linking can be done on the nir shaders.
Probably the linking functionality should be exposed in the lib/dll
form too, which means that a helper for freeing intermediate nir
would be needed too. That's TODO for now.

The tool now requires arguments to be in-order, and once a filename
is encountered, will use the previous arguments to compile the shader.
If multiple graphics shaders are passed, they're linked as if they
were forming a pipeline together.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20440>
2023-01-03 18:42:45 +00:00
Jesse Natalie ac7abf0483 spirv2dxil: Rename and move prep helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20440>
2023-01-03 18:42:45 +00:00
Jesse Natalie 53260f7bed dzn: Swizzle SRV access to stencil
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Jesse Natalie e4e0ab2207 dzn: Pass input clip size to shader compilation
For cases where both clip and cull are used, and a shader has both
inputs and outputs that can contain them, we need metadata to tell
us where the clip array ends and the cull array begins, since they
get combined into CLIP location registers. For outputs, this is in
the nir info, but for input we pass it in a sideband channel.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Jesse Natalie 565d454071 dzn: Don't add UAV flag to DSV textures
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Jesse Natalie c4201f4a79 dzn: Use ResolveSubresourceRegion to support non-averaging resolve modes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Jesse Natalie e24468803e dzn: Use driver-implemented triangle fans if available
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Jesse Natalie e1ea140d77 dzn: Get options15
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Jesse Natalie e950224787 microsoft/compiler: Handle cull distance starting fractional with no previous clip
This can happen if the clip distance was declared, but was discarded as an
unused variable.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Jesse Natalie 638e375c19 microsoft/compiler: Sort all user varyings before any sysvals
User varyings are linked by both name and register. The name is based
on how many *variables* are before it in final driver_location sort
order, not necessarily how many registers are before it.

In some cases where clip/cull distance are involved, it's possible
for one shader to write into a part of the cull distance that's
ignored by a downstream shader, but because linking is done by
*whole* register locations, and clip/cull can be combined using
*fractional* register locations, this is hard to detect. Since no
non-sysvals end up using fractional locations, just put all non-sysvals
first so they always generate the same semantic names for the same
register locations.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Jesse Natalie 8c1af8854b microsoft/compiler: Make nir_var_to_dxil_sysvalue_type static
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Jesse Natalie f363504b42 microsoft/compiler: Handle both input and output clip/cull distances
For clip/cull coming into a GS and being written, this pass was wrong
and would modify variable types incorrectly. Track both inputs and
outputs separately.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20346>
2022-12-16 18:40:47 +00:00
Ian Romanick eb76cee9f8 nir: Eliminate nir_op_i2b
There are a lot of optimizations in opt_algebraic that match ('ine', a,
0), but there are almost none that match i2b.  Instead of adding a huge
pile of additional patterns (including variations that include both ine
and i2b), always lower i2b to a != 0.

At this point in the series, it should be impossible for anything to
generate i2b, so there /should not/ be any changes.

The failing test on d3d12 is a pre-existing bug that is triggered by
this change.  I talked to Jesse about it, and, after some analysis, he
suggested just adding it to the list of known failures.

v2: Don't rematerialize i2b instructions in dxil_nir_lower_x2b.

v3: Don't rematerialize i2b instructions in zink_nir_algebraic.py.

v4: Fix zink-on-TGL CI failures by calling nir_opt_algebraic after
nir_lower_doubles makes progress.  The latter can generate b2i
instructions, but nir_lower_int64 can't handle them (anymore).

v5: Add back most of the hunk at line 2125 of nir_opt_algebraic.py. I
had accidentally removed the f2b(bf2(x)) optimization.

v6: Just eliminate the i2b instruction.

v7: Remove missed i2b32 in midgard_compile.c. Remove (now unused)
emit_alu_i2orf2_b1 function from sfn_instr_alu.cpp. Previously this
function was still used. 🤷

No shader-db changes on any Intel platform.

All Intel platforms had similar results. (Ice Lake shown)
Instructions in all programs: 141165875 -> 141165873 (-0.0%)
Instructions helped: 2

Cycles in all programs: 9098956382 -> 9098956350 (-0.0%)
Cycles helped: 2

The two Vulkan shaders are helped because of the "new" (('b2i32',
('ine', ('ubfe', a, b, 1), 0)), ('ubfe', a, b, 1)) algebraic pattern.

Acked-by: Jesse Natalie <jenatali@microsoft.com> [earlier version]
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Tested-by: Daniel Schürmann <daniel@schuermann.dev> [earlier version]
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15121>
2022-12-14 06:23:21 +00:00