Commit graph

162870 commits

Author SHA1 Message Date
Faith Ekstrand
e2379a2e87 nvk: Advertise shaderStorageImageReadWithoutFormat
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
6334cac288 nvk/heap: Set the right pitch for heap resize copies
Otherwise, once we need to grow past 2^17 B, we attempt to copy two
lines, the hardware errors out, and we get left with a junk heap.
While we're here, re-arrange the code a bit so we keep all the P_FOO
together.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Echo J
729b34be8a nil: Add A4B4G4R4_UNORM format support
DXVK versions before v1.5.5 need this format in some cases

I haven't tried running CTS yet, but GTA San Andreas runs
well now on DXVK v1.5.1 (before this change it crashed) so
I think CTS should be happy enough 🐸

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Dave Airlie
ac4073a4ee nvk: expose EXT_sampler_filter_minmax
The sampler bits of this were already hooked up.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
72263d7589 nvk: Only use view_id for layer in multiview
I can't prove that this fixes anything but it seems right.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
3e93173cc9 nvk: Move code inside view mask loops to a helper function
Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
45001c878f nvk: Combine CLEAR_VIEWS and CLEAR_LAYERS MME macros
Check view_mask inside the macro to determine which loop to run. In
emit_clear_rects(), move code out of if/else that is the same in both
branches.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
b6a3dd4b51 nvk: Load view_mask to shadow scratch in nvk_CmdBeginRendering
Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Thomas H.P. Andersen
71a00a0a1c nvk: simplify code by using new helpers
All tests still pass:
dEQP-VK.query_pool.*.compute_shader_invocations*

Test run totals:
  Passed:        78/78 (100.0%)
  Failed:        0/78 (0.0%)
  Not supported: 0/78 (0.0%)
  Warnings:      0/78 (0.0%)
  Waived:        0/78 (0.0%)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Echo J
d1bbd16f1f nvk: Reset offset value in ResetDescriptorPool
This is another secret change you've been waiting for 🐸

This change resets the current_offset value to 0 in ResetDescriptorPool
(without it the offset would keep counting until it reaches the limit
which causes allocation issues and/or application crashes/freezes)

RADV does the same thing, so I think this change is correct 🤓

BTW this meme seems to be relevant: https://youtu.be/1stQbTuUBIE

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Echo J
35d85fca88 nvk: Add bufferImageGranularity limit
This is the secret change everyone has been waiting for 🐸

But anyway, this change adds the bufferImageGranularity limit (which
is needed by both DXVK and osu!lazer; DXVK will be a corrupted mess
without it and osu!lazer simply throws an exception)

The values have been scraped from https://vulkan.gpuinfo.org BTW
(because of that I'm not sure if they're actually accurate)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
c4aba5b310 nvk: Advertise EXT_shader_viewport_index_layer on MaxwellB+
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
8269ca0d51 nvk: Sort SPIR-V caps
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
86f960090e nvk: Implement VK_KHR_map_memory2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
fc368b2b90 nvk: Use vk_device_memory
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
0dd4237896 nvk: Set spirv_to_nir_options::min_*_alignment
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
7810c9171e nvk: Add a separate #define for SSBO alignment
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
06c798f39b nvk: Expose VK_KHR_maintenance2
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
a626eff1c3 nvk: Set pointClippingBehavior
This is what the blob advertises.  I don't know if it's correct or not
because the CTS test for this seems to pass either way:

    dEQP-VK.clipping.clip_volume.depth_clamp.point_list

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
4c760d2436 nvk: Implement uncompressed views of compressed images
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
0895e160a8 nil: Add an image_level_as_uncompressed helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
5fff5b7c4f nil: Add a nil_image_for_level helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
George Ouzounoudis
6caf1e473d nvk: Support geometry shaders
This enables geometry shaders for nvk.  Physical device limits taken
from nouveau codebase and http://www.vulkan.gpuinfo.org

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
George Ouzounoudis
8eac1b0c4d nvk: Fix geometry shader active stream mask
This sets StreamOutMask in the shader header correctly based on:
https://download.nvidia.com/open-gpu-doc/Shader-Program-Header/1/Shader-Program-Header.html

After this fix transform feedback CTS tests with geometry shader streams
are passing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
George Ouzounoudis
921c06a6d4 nvk: Disable PRIMITIVE_RESTART_VERTEX_ARRAY by default
This made various strip geometry tests fail.  Tests with primitive
restart do not seem affected after this.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
7cbe711760 nvk: Increase the push runout to 512 dwords
This is needed in order to do all of viewport state in a single push.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Echo J
16f4c21559 nvk: Add A8B8G8R8_*_PACK32 format support
Here it is; the long-awaited change (as requested by 2 people on Discord 🥺)

This change originally added one Vulkan format which was needed for STK's
Vulkan renderer, but @gfxstrand suggested to add all of the A8B8G8R8_*_PACK32
formats in a GitLab thread)

This obviously fixes SuperTuxKart crashing with the Vulkan renderer 🐸

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
d02e895152 nvk: Advertise VK_KHR_multiview
Closes: https://gitlab.freedesktop.org/nouveau/mesa/-/issues/52

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
5472e96849 nvk: Add input attachments support for multiview
Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
ec4e014b9b nvk: Add query support for multiview
When multiview is enabled, queries must use N consecutive query indices in the
query pool, where N is the number of bits set in the view mask in the subpass
the query is used in.

In our case, only the first query is used, so we emit zeros for the remaining
queries.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
903b917979 nvk: Add draw support for multiview
Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
df2f07a57c nvk: Break the inner MME draw loop into a helper
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
18c1977b65 nvk: Spill DRAW_IDX pre-Turing
Spill draw_idx to shadow scratch once we've written it to the root
descriptor.  This saves us a bit of register pressure around a pretty
tight seciton.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
3d8ffa3dd4 nvk: Rework spill helpers and DRAW_COUNT spilling
The new helpers, now moved to nvk_mme.h, take an nvk_mme_scratch value
to ensure no overlap.  They also ensure that we use exactly the same
register for the unspilled value as the spilled value.  This makes
spilling safe for loop-carried values and the like.  The old
nvk_mme_fill() helper just loads a spilled value to a new, possibly
different register.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
6b7d13529a nouveau/mme: Add a helper for re-allocating registers
This helper unlike alloc, tries to use the same value as the register
had before.  This is intended for manual spill/unspill code which wants
to keep register numbers the same while carefully spilling around high-
pressure regions.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
9009100486 nvk: Use the new load/store_scratch helpers for DRAW_PAD_DW
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
8ae61af5e3 nvk: Add begin to mme_scratch
Introduce helpers to make it easier to work with the nvk mme shadow
scratch. Store begin in the shadow scratch in vkCmdDraw* related code to
save registers, which is necessary for Fermi.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
ec917719bf nvk: Lower nir_intrinsic_load_view_index
Lower view_index intrinsics to a load_ubo using NIR.

Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Rebecca Mckeever
f0c86365da nvk: Add view_index to root descriptor table
Signed-off-by: Rebecca Mckeever <rebecca.mckeever@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
08a200193f nouveau/mme: Fix while loops pre-Turing
Pre-Turing, we don't have a full condition built into the loop so, for
mme_while(b, ine, x, y) we have to generate the following:

[top]   BR -> [cond]
        /* loop body */
[cond]  XOR tmp, x, y
        BRZ !tmp -> [top]

However, due to an accounting error, we were generating

[top]   BR -> [cond]
        /* loop body */
        XOR tmp, x, y
[cond]  BRZ !tmp -> [top]

which meant that the XOR (or ADD if one is an immediate) was getting
skipped, leading to the loop either never terminating or always
terminating.  The way to fix this accounting error is to close the while
first, then compute the condition value, then do the jump.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
ccf004837a nouveau/mme: Use ADD for ine with an immediate
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Karol Herbst
837b622dbf nvk: Add a macro to set MMIO registers via falcons
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Karol Herbst
63bb25f87d nouveau/mme: add a macro exit helper
At the moment it's turing+ only.

Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Karol Herbst
dc099bd808 nouveau/mme: add test for BEQ with magic exit offset
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Echo J
bd1ff51b77 nvk: Fix some cast defines
This removes compiler warnings on 32-bit builds 🐸

Also other drivers do define casts this way, so this should actually
be an uncontroversial change 😁

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
3ecf6db521 nvk: Add instace WSI entrypoints
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
bb003b75a1 nvk: Advertise ICD/loader interface version 4
We can't advertise v5 yet because we don't support Vulkan 1.1 yet.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Faith Ekstrand
43083a041b nvk: Use the same lock for the submit and the memory objects list
We need to lock the memory objects list around the entire push builder
process.  Otherwise, a memory object could get destroyed between adding
it to the BO list and doing the submit, leading to the kernel rejecting
our pushbuf.

When the time comes that we switch to the new uAPI both uses of
nvk_device::mutex will go away.  We'll no longer be passing lists of BOs
to the kernel and we'll move to syncobj and be able to drop all the
nvk_bo_sync nonsense.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Mohamed Ahmed
93c439f660 nvk: advertise DemoteToHelperInvocation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00
Dave Airlie
651bdb3822 nvk: fix r32_sint format support
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:04 +00:00