Commit graph

177262 commits

Author SHA1 Message Date
Faith Ekstrand
62fa4ff5e0 nvk: Take an nvk_image_plane in nouveau_copy_rect_image
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
8d712c2e06 nvk: Add helpers for binding image planes
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
fe022d4e87 nvk: s/device/dev in nvk_image.c
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Dave Airlie
ebcac6b81c nvk: introduce an optimisation loop.
This brings in pretty much the radv opt loop.

So for tess ctrl where this a loop we can unroll, this fixes
some dynamic array access later to be non-dynamic.

Fixes:
dEQP-VK.clipping.user_defined.clip_distance_dynamic_index.vert_tess.1

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Dave Airlie
0b6b59e654 nvk: merge tess info between tcs/tes.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Dave Airlie
136d49054b nvk: fix transform feedback crash when optimiser removes things.
This optimise loop can remove stuff, which causes this to crash,
just exit early.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
George Ouzounoudis
7715aea5aa nvk: Lower io to temporaries for tessellation evaluation nir
This is consistent to what radv does.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
George Ouzounoudis
f561406d38 nvk: Respect tessellation domain origin state
When switching to lower left tessellation domain origin we need to
switch the orientation for triangles/quads. The changes are based on
what anv and radv do.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
George Ouzounoudis
93369f1f96 nvk: Fix cases where execution mode is specified in the tesc shader.
We need to keep some context for the compilation of the tessellation shaders.
This is required in the case where the domain is specified in the
tessellation control shader instead of the tessellation evaluation
shader, as codegen needs the domain information when compiling the
tessellation evaluation shader.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
George Ouzounoudis
544aadc56b nvk: Enable multiview with tessellation shader
This works by default, we just switch it on.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
George Ouzounoudis
76e02c7f77 nvk: Assign locations correctly for arrayed IO
Arrayed IO, encountered in tessellation shaders, should not take up
multiple driver locations.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
George Ouzounoudis
304636297f nvk: Basic tessellation shader support
Based on nvc0 implementation but with added nvidia-headers usage.
Device limits taken from http://www.vulkan.gpuinfo.org/ and minimum
required values.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Thomas H.P. Andersen
ecbcc26a6e nvk: remove duplicated device features
These are already set in the Vulkan 1.2 section

Add status for bufferDeviceAddressCaptureReplayEXT

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Mohamed Ahmed
e41031d8ff nvk: Enable multiplane images and image views
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
39d8d3811d nvk: Advertise KHR_spirv_1_4
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
Faith Ekstrand
1ea94caab6 nvk: Fix the NO_PREFETCH assert for CmdDrawIndirect
The NO_PREFETCH bit gets set on the range.  The offset can pretty much
be whatever.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24326>
2023-08-04 21:32:05 +00:00
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