Commit Graph

187761 Commits

Author SHA1 Message Date
Konstantin Seurer 1a718e0adf lavapipe: Make lvp_shader_init non-static
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28187>
2024-04-09 07:13:01 +00:00
Konstantin Seurer 5d43b8c46e lavapipe: Add lvp_spirv_to_nir
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28187>
2024-04-09 07:13:01 +00:00
Konstantin Seurer 04af9b3ac2 llvmpipe: Fix function call handling
Fixes using images and samplers inside functions and allows for
function calls outside of kernels.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28187>
2024-04-09 07:13:01 +00:00
Konstantin Seurer 85e840786c nir: Add lavapipe ray tracing intrinsics
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28187>
2024-04-09 07:13:01 +00:00
Konstantin Seurer edc8e011eb nir/serialize: Encode data for temporaries
the location has to be preserved when lowering them to scratch using
nir_lower_vars_to_explicit_types and nir_lower_explicit_io.

cc: mesa-stable

Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28187>
2024-04-09 07:13:01 +00:00
Konstantin Seurer 1ff8659f41 nir/print: Fix printing booleans with bit_size>1
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28187>
2024-04-09 07:13:01 +00:00
Paul Gofman 27dba224d3 driconf: add a workaround for Joe Danger
CC: mesa-stable
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28439>
2024-04-09 01:29:24 +00:00
Paul Gofman 2abb72f512 driconf: add a workaround for Joe Danger 2
CC: mesa-stable
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28439>
2024-04-09 01:29:23 +00:00
Paul Gofman bd189dbd77 glsl: allow out arrays in #110 with allow_glsl_120_subset_in_110
CC: mesa-stable
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28439>
2024-04-09 01:29:23 +00:00
Faith Ekstrand 6b383ca810 nil: Enforce units via Rust types
We add a units generic parameter to Extent4D and Offset4D and then make
every helper take and return the right type.  The mul and div_* helpers
only half-enforce types but it's better than nothing.  We leave them
non-public so no one outside extent.rs uses them.

Reviewed-by: Lina Versace <linyaa@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28639>
2024-04-09 00:13:01 +00:00
Faith Ekstrand c3b33de33c nil: Take a format in el_to_B()
Reviewed-by: Lina Versace <linyaa@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28639>
2024-04-09 00:13:01 +00:00
Faith Ekstrand 5a075785ac nil: Drop the nil_extent/offset4d() helpers
They're only used one place each in NVK and we can just use a struct
initializer instead.

Reviewed-by: Lina Versace <linyaa@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28639>
2024-04-09 00:13:01 +00:00
Faith Ekstrand bc0de7a2cf nil: Add Extent/Offset4D::new() helpers
We're about to add a PhantomData to Extent/Offset4D and that'll make it
harder to construct.  Adding a helper lets us more easily construct them
elsewhere in the code.

Reviewed-by: Lina Versace <linyaa@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28639>
2024-04-09 00:13:01 +00:00
Connor Abbott 8f65ecac21 ir3: Use divergence analysis for (jp) and physical CFG
This will be important for checking whether we can use scalar registers
for phis.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28573>
2024-04-08 23:20:08 +00:00
Connor Abbott b349dc5c74 ir3: Remove loop shared copy check
This is now handled by inserting LCSSA phis similar to how it's handled
in ACO.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28573>
2024-04-08 23:20:08 +00:00
Connor Abbott 5ed567fea1 ir3: Run divergence analysis at the end
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28573>
2024-04-08 23:20:08 +00:00
Connor Abbott 266adc3e11 ir3: Allow single-predecessor phis
These will be used to block propagating shared -> non shared moves out
of loops instead of the current check in ir3_cp.c, similar to what ACO
does.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28573>
2024-04-08 23:20:08 +00:00
Connor Abbott 42ddbf4ebe nir/divergence_analysis: Fix load_view_index divergence in VS
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28573>
2024-04-08 23:20:08 +00:00
Connor Abbott 223e3727d5 nir/divergence_analysis: Add uniform_load_tears option
This "tear" is similar to the original concept of loads/stores tearing,
but across invocations in a wave instead of bytes. Qualcomm seems to
have this problem, at least for some GPUs. This fixes
spec@arb_shader_storage_buffer_object@execution@ssbo-atomiccompswap-int
on a630 once we start relying on divergence analysis for computing
reconvergence properties. For backends that have readFirstInvocation(),
it should be possible to fix the problem by inserting
readFirstInvocation() instead, but a5xx doesn't have it so we can't rely
on it in freedreno.

Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28573>
2024-04-08 23:20:08 +00:00
Connor Abbott 291e6d2940 nir/divergence_analysis: Add ir3-specific intrinsics
Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28573>
2024-04-08 23:20:08 +00:00
Paulo Zanoni cf7e1f3817 anv, iris: add missing CS_STALL bit for GPGPU texture invalidation
The BSpec page "Flush Types" (46213) says the following about the Tex
Invalidate bit:

  "Requires stall bit ([20] of DW) set for all GPGPU Workloads."

For newer platforms, this is documented in the description of the
texture invalidation bit in the PIPE_CONTROL page (56551):

  "CS Stall bit in PIPE_CONTROL command must be always set for GPGPU
   workloads when Texture Cache Invalidation Enable bit is set"

Iris had it only for GFX_VER 9 and 11, while Anv had it missing for
everything.

Please notice that this patch includes a revert of 397e728ef4.

Fixes: 397e728ef4 ("iris: Drop GPGPU Tex Invalidate restriction for TGL+")
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28608>
2024-04-08 22:57:22 +00:00
Zack Rusin 955444e068 svga: Fix instanced draw detection
The new GTK+ GL renderer is extensively using instanced rendering. SVGA
driver was incorrectly detecting the instanced draws by only checking
whether the instance count was greater than 1. Base instance has to
be also checked to make sure that the draw correctly offsets the vertex
buffer.

Fix instanced draw detection by checking both the instance count and
the base instance. Fixes the new GTK+ 4 GL renderer.

Signed-off-by: Zack Rusin <zack.rusin@broadcom.com>
Fixes: ccb4ea5a43 ("svga: Add GL4.1(compatibility profile) support in svga driver")
Reviewed-by: Neha Bhende <neha.bhende@broadcom.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28616>
2024-04-08 22:35:48 +00:00
Pavel Ondračka 96479794a5 nir/lower_vec_to_regs: always set cursor before inserting decl_reg
Otherwise we can end with invalid curson in some cases, specifically,
if we encounter an identity vector and thus neither register
declaration nor swizzle is inserted, it can lead to invalid cursor and a
crash later.

Suggested by: Alyssa Rosenzweig <alyssa@rosenzweig.io>

Signed-off-by: Pavel Ondračka <pavel.ondracka@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/10905
Reviewed-by: Christian Gmeiner <cgmeiner@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28581>
2024-04-08 21:03:46 +00:00
Faith Ekstrand fc90d4eed9 nil: Make the Rust library the primary build target
This just shuffles around the meson to make it so that the Rust library
is the final build target, not a C library.  We're still building
fundamentally the same amount of stuff because nil_format_table.c is
still C (C is really good at tables that go in the .data section) and we
still need a wrapper rlib for bindgen.  Howver, the Rust library is now
the main thing.  When the time comes to start using NIL from other Rust
code, this will mean that we can just build an rlib and it will have
everything.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:44 +00:00
Faith Ekstrand 571b77fee7 nil: Delete unused USAGE bits
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:44 +00:00
Daniel Almeida 5577128c83 nil: Rewrite the TIC code in Rust
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:44 +00:00
Faith Ekstrand d5b7dd6ce5 nak/bitview: Add a SetField<f32> implementation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:44 +00:00
Daniel Almeida 426553d61d nil: Re-implement nil_image in Rust
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand 9fdcd217a4 nil: Rename nil_tiling::gob_height_8 to gob_height_is_8
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand c13e7b01f9 nvk: Stop using nvk_extent4d short names
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Daniel Almeida 1713b02da7 nil: Rewrite nil_format in rust
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Daniel Almeida 303dc12214 nil: Add the start of a Rust library
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand 299f32736a nil: Move to a single header file
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand cdaa8e67e3 nil: Move nil_tic_format to nil_format_table.h
This gets it out of nil_format.c/h and decouples things a bit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Daniel Almeida dde95fc039 meson,ci: Add the paste crate
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand 923a0a727b ci: Add cbindgen to the build images
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand 640d14969e nouveau/headers: Add Rust bindings for texture headers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand 56aefac615 nouveau/headers: Add initial Rust bindings
This adds the infrastructure for the nvidia_headers crate.  It currently
only has declarations for the texture headers but QMDs should be trivial
to add as well.  The plan is to organize it as follows:

crate nvidia_headers {
    mod cl9097 {
        // Methods
        mod tex {
            // Texture defines
        }
    }
    mod clc5c0 {
        // Methods
        mod qmd {
            // QMD defines
        }
    }
}

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand 53bc795616 nouveau: Use hyphenated arguments to class_parser.py
This is more consistent with other code generators in Mesa.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Faith Ekstrand 0d2008461d nouveau: Move .rustfmt.toml from NAK to src/nouveau/
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27397>
2024-04-08 20:28:43 +00:00
Samuel Pitoiset f387c47365 ci: uprev vkd3d-proton to c3b385606a93baed42482d822805e0d9c2f3f603
The current version was 3 months old and a bunch of new tests have
been added since.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28124>
2024-04-08 19:18:21 +00:00
Rhys Perry 0f2d5ed75c aco: assume no unreachable blocks
These shouldn't happen anymore.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28301>
2024-04-08 18:38:39 +00:00
Rhys Perry 306a72db1f aco/tests: add control flow tests
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28301>
2024-04-08 18:38:39 +00:00
Rhys Perry ae63d967d7 aco/tests: add isel test helpers
Having NIR-based instruction selection tests instead of GLSL lets us be
more precise with the input NIR.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28301>
2024-04-08 18:38:39 +00:00
Rhys Perry 543ca160a5 nir,aco: add test intrinsics
These don't really do anything. They're just a source and user of SSA
defs.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28301>
2024-04-08 18:38:39 +00:00
Rhys Perry 0a25af1d4e aco: save/reset/combine has_divergent_continue in uniform branches
For
if (uniform) {
   if (divergent)
      continue
} else {
   break
}
we don't need to consider the continue to be divergent.

No fossil-db changes.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28301>
2024-04-08 18:38:39 +00:00
Rhys Perry 46c734ff02 aco: ensure loop exits exist in NIR
This simplifies instruction selection and fixes the case where the loop
ends with a continue instruction.

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28301>
2024-04-08 18:38:39 +00:00
Rhys Perry 842191e9ba aco: remove unreachable merge blocks
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28301>
2024-04-08 18:38:39 +00:00
Rhys Perry 863718d62e nir: add nir_remove_after_cf_node helper
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28301>
2024-04-08 18:38:39 +00:00
Paulo Zanoni b0653370d0 vulkan: don't zero-initialize STACK_ARRAY()'s stack array
STACK_ARRAY() is used in a lot of places. When games are running we
see STACK_ARRAY() arrays being used all the time: each queue
submission uses 6, WaitSemaphores and syncobj waiting also uses them:
they're constantly present in Vulkan runtime.

There's no need for STACK_ARRAY()'s stack array to be initialized,
callers cannot not depend on it. If the number of elements is greater
than STACK_ARRAY_SIZE, then STACK_ARRAY() will just malloc() the array
and return it not initialized: anybody depending of
zero-initialization is going to break when the array is big.

The reason why we're zero-intializing STACK_ARRAY()'s stack array is
to silence -Wmaybe-uninitialized warnings: see commit d7957df318
("vulkan: fix uninitialized variables"). I don't think that commit is
the ideal way to deal with the problem, so this patch proposes a
better solution.

The problem here is that zero-initializing it adds code we don't need
for every single caller. STACK_ARRAY() already has 63 callers and only
3 of them are affected by the -Wmaybe-uninitialized warining. So here
we undo what commit d7957df318 did and instead we fix the 3 cases
that actually generate the -Wmaybe-uninitialized warnings.

Gcc is only emitting those warinings because it knows that the number
of elements in the array may be zero, so the loops we have that set
elements to the array may end up do nothing, and then we pass the
array uninitialized to other functions.

For the cases related to vk_sync this is just returning VK_SUCCESS
earlier, instead of relying on the check that eventually happens at
__vk_sync_wait_many(). For the vkCmdWaitEvents() function, the Vulkan
spec says that "eventCount must be greater than 0", so the early
return doesn't hurt anybody either. In both cases we make the zero
case faster by not defining an 8-sized array, zero-initializing it,
then returning success without using it.

Reference: d7957df318 ("vulkan: fix uninitialized variables")
Acked-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Yiwei Zhang <zzyiwei@chromium.org>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28288>
2024-04-08 17:23:25 +00:00