Commit graph

182089 commits

Author SHA1 Message Date
Faith Ekstrand
18ae2d1878 nvk: Throw Tegra behind NVK_I_WANT_A_BROKEN_VULKAN_DRIVER
It's recieved very little testing and what testing it has recieved
indicates that synchronization is pretty badly broken.  Let's turn it
off for users by default right now.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26627>
2023-12-10 18:27:43 -06:00
Echo J
9ca9b67446 nvk: Set HOST_CACHED_BIT for the GTT type
vkd3d-proton requires this memory bit in various cases (adding
it to the GTT memory type significantly reduces failures in the
vkd3d-proton test suite) 🐸

I'm not sure if Tegra supports this bit though so I'm not adding it
to the VRAM-less path (hopefully someone can provide an actual answer)

The next step would be adding HOST_VISIBLE bit to the VRAM type (this
will likely require more work and maybe even some KMD changes) which
would make gamescope work (Faith said that DXVK benefits from it too)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26621>
2023-12-10 17:57:38 +02:00
Marek Olšák
9ab59574ef gallium: add typedef pipe_draw_func matching the draw_vbo signature and use it
We've copied the signature too many times already. This will also be used
more.

It intentionally deviates from the name by not including the "_vbo" part.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:14 +00:00
Marek Olšák
7f11272d29 mesa: execute an error path sooner in _mesa_validated_drawrangeelements
Also don't print the warning in release builds.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
4f766426b2 cso: inline cso_get_pipe_context
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
7da5b8dac0 cso: do cso_context inheritance how we do it elsewhere
Currently, we have:
- cso_context_base is the base class, but cso_context is passed to functions
- cso_context is the derived class

Change:
- cso_context to become the base class, and is passed to functions
- cso_context_priv to become the derived class.

mesa/main will need to access the base class directly.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
3b16541a8f mesa: move index bounds code (st_prepare_indexed_draw) into draw.c
there is no other user

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
c6281a6f26 st/mesa: no need to check index_size in st_prepare_indexed_draw anymore
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
4cd585ab50 mesa: call st_prepare_(indexed_)draw before Driver.DrawGallium(MultiMode)
This is refactoring for future work. Also, it unifies the st_draw_feedback
path with the normal path and the "indexed" version doesn't have to be called
in many places.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
8cbab48403 mesa: inline st_draw_transform_feedback
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
b14e26b198 st/mesa: make prepare_(indexed_)draw non-static
for later use

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
cf951bace2 mesa: remove non-relevant 16-year-old comment
The comment has nothing to do with the code around it and all uploads
are handled by u_vbuf today.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
360166c6f4 mesa: remove more DrawArrays/Elements duplication
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
2b8d764a76 mesa: remove some DrawElementsInstanced duplication
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Marek Olšák
23227954bc mesa: remove some DrawTransformFeedback duplication
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26619>
2023-12-10 06:20:13 +00:00
Faith Ekstrand
df62471fef nvk: CBuf alignment reduces to 64B on Turing
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26617>
2023-12-10 03:06:01 +00:00
Faith Ekstrand
289149ebcb nvk: Simplify alignment limit plumbing
We dont't need this whole function just for advertising alignment
requirements.  We now have enough #defines and helpers that they map
pretty cleanly to those.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26617>
2023-12-10 03:06:01 +00:00
Faith Ekstrand
08222146ac nak: Reduce minStorageBufferAlignment
The only real requirement here is that we can load an entire vec4 at a
time without getting a misaligned address.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26617>
2023-12-10 03:06:01 +00:00
Faith Ekstrand
35a40b4c6a nvk: Add an NVK_MIN_TEXEL_BUFFER_ALIGNMENT #define
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26617>
2023-12-10 03:06:01 +00:00
Faith Ekstrand
b7f8a9e648 nvk: Add a nvk_min_cbuf_alignment() helper and use it
We want to be able to use cbufs for UBOs and descriptor buffers going
forward.  This also cleans up alignments all over the code-base where
just kinda did whatever seemed like a good idea at the time.  The result
is a lot more flexible and accurate.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26617>
2023-12-10 03:06:01 +00:00
Faith Ekstrand
bc236acff5 nvk: Plumb a physical device into descriptor_stride_align_for_type
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26617>
2023-12-10 03:06:01 +00:00
Faith Ekstrand
c7de8afbe0 nvk: s/device/dev in nvk_descriptor_set_layout.c
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26617>
2023-12-10 03:06:01 +00:00
Faith Ekstrand
700d5c56d1 nvk: Make NVK_DEBUG=push an alias for push_dump
This has been bothering me for a while.  I can never remember whether
it's push_dump or dump_push.  Let's just get rid of the confusion.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26617>
2023-12-10 03:06:01 +00:00
Alyssa Rosenzweig
d11c9f9836 asahi: clamp draw count for mdi
spec req. KHR-GL43.indirect_parameters_tests.MultiDrawArraysIndirectCount

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
fdec9dcf05 asahi: wire up hardware gl_PrimitiveID
when FS reads but no GS in the pipeline, the hw supplies for us. fixes

KHR-GL43.shader_image_size.basic-*-fs-*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
1e2de134ad asahi: respect render condition for compute
KHR-GL43.compute_shader.conditional-dispatching

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
1a39d1c73a asahi: allow more format reinterpretation
This seems to be the hw rule... would like to confirm with perf counters
though...

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
e69a0f830e asahi: fix size calculation for 2d msaa arrays
otherwise the hw can overprefetch. fixes KHR-GL42.shader_image_load_store.basic-allTargets-load-ms

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
982e644d18 agx: don't produce split of immediate
can't be consumed, affects KHR-GL42.shader_image_load_store.basic-allTargets-load-ms

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
6e2c71dc3b agx: Lower 64-bit I/O to 32-bit
Fixes KHR-GL42.vertex_attrib_64bit.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
d6474be46b agx: fix fp64 lowering options
we have no fp64 whatsoever.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
8d451fe9f2 asahi: fix integer RT clamping
fixes the rest of KHR-GL33.packed_pixels.*

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
01d0fb1cde asahi: fix pbe swizzling
fixes cases in KHR-GL33.packed_pixels.rectangle.*. matches what the powervr
driver does.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
6d05bf8761 asahi: fix dupe rgb65 formats
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
b68caa13e4 asahi: add more BGR formats
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
c89f0becf7 asahi: Implement ARB_cull_distance
Passes KHR-GL33.cull_distance.* and the piglits.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
ba077d899e asahi: handle compact clip/cull in gs component gather
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
f02190b688 asahi: prepare gs copy shaders for compact clip/cull
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
0dc004888c asahi: handle some components/offsets in GS lowering
occurs for compact clip/cull xfb. not hard to deal with, do so instead of
getting caught up in assertions.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
17f348f73a asahi: Implement ARB_viewport_array
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
af9241ce92 asahi: add XML for multiple viewports
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
3435ccb49a asahi: allow empty scissor box
we can't cull on the cpu when we have a scissor array, so don't try.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
bb59c787ec agx: report if we have a nonzero viewport
so driver can optimize.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
bc7afbf23d agx: allocate varying slot if writing viewport only
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
643acacd1b agx: note that sample_mask runs occlusion queries
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
79e58e1d77 agx: handle force early-z + discard
fixes ./arb_shader_image_load_store-early-z. experimentally, an opaque pass type
works too but better match what the blob does.

also, I now have proof that sample_mask triggers occlusion query updates because
if you run it multiple times, you get >1 hits per fragment in a counting query
:p

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
3987c8a35f agx: remove spurious z/s writes in force early-z shaders
fixes crash in arb_shader_image_load_store-early-z

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
c43c90a5fa asahi: rewrite pointsize handling
In the wise words of Mike Blumenkrantz, "I hate gl_PointSize and so can you".

The mesa/st lowering won't mesh well with vertex shader epilogues, and it falls
over in various circumstances. I am too tired to go against the grain, so let's
just pretend to be a normal gallium driver and trust in the rasterizer CSO,
lowering point size internally. This properly handles transform feedback without
any hacks, both GL and GLES behaviours, etc.

Fixes:

   KHR-GL31.transform_feedback.capture_vertex_separate_test
   gl-2.0-large-point-fs

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
aa1849a541 asahi: assert hw invariant
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00
Alyssa Rosenzweig
23f216d6e7 asahi: Lower edge flags
With the common geometry shader based lowering added for zink. Fixes edge flag
related piglits.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26614>
2023-12-09 12:08:39 -04:00