Commit graph

2839 commits

Author SHA1 Message Date
Gurchetan Singh
08fb1c16b4 util: rust: spelling and whitespace fixes
Reviewed-by: Aaron Ruby <aruby@qnx.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37410>
2025-09-16 23:26:27 +00:00
Alyssa Rosenzweig
a2d14208b0 util: add unit tests for util/lut.h
Wasn't 100% sure about some of these derivations so let's add tests.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37200>
2025-09-16 21:48:37 +00:00
Alyssa Rosenzweig
95badb6b1d util: add boolean lookup table helpers
Many instruction sets (Intel, Apple, NVIDIA) implement bitwise operations with a
single general instruction that takes a lookup table in sum-of-products
(minterms) form. Working with these tables manually is a bit gnarly, and
multiple backends need to do this. This adds common code for representing such
lookup tables with 2- or 3-sources, with a rich set of helpers for building,
inspecting, and manipulating the LUTs.

Eventually, we may want to introduce a nir_op_bitop3 instruction to NIR to build
common code for fusing boolean expression trees into lookup tables. That NIR
pass will presumably use the helpers here.

NAK already has this abstraction internally (in Rust). Possibly NAK will be able
to drop (or cut down) that code once we handle this in NIR.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37200>
2025-09-16 21:48:37 +00:00
Alyssa Rosenzweig
86a5dd10ac util: add util_bit_swap macro
We will use this to manipulate lookup tables, but it's a common algorithm.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37200>
2025-09-16 21:48:37 +00:00
Valentine Burley
ee56aed92d util: Disable Werror for BLAKE3
Avoid treating warnings as errors in the third-party BLAKE3 code.

Suggested-by: @eric

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35853>
2025-09-16 06:16:20 +00:00
Valentine Burley
8d2bb19c63 util: Update BLAKE3 from 1.5.1 to 1.8.2
Steps for uprev:
 - copy files from BLAKE3/c src/util/blake3/
 - edit README
 - `for file in *.asm; do mv "$file" "${file%.asm}.masm"; done`
 - keep
  - blake3.h (no relevant changes), only change BLAKE3_VERSION_STRING
  - blake3_sse2_x86-64_unix.S (no changes)
  - blake3_avx512_x86-64_unix.S (no changes)
  - blake3_sse41_x86-64_unix.S (no changes)

Signed-off-by: Valentine Burley <valentine.burley@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35853>
2025-09-16 06:16:19 +00:00
Boris Brezillon
18f352090d util/format: Add a Z24_UNORM_PACKED format
Mali GPUs support Z24_UNORM stored on three bytes instead of four. Add
a new format for this case.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37158>
2025-09-15 10:59:04 +00:00
Boris Brezillon
f57cc49683 util/format: Autogen type conversion helpers
We are about to need new type converters for our AFBC mode selection
logic (AFBC is type agnostic, but we currently accept only UNORM
formats), so let's switch to an autogen solution for the existing ones,
and generate all missing type converters along the way.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Christoph Pillmayer <christoph.pillmayer@arm.com>
Reviewed-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37158>
2025-09-15 10:59:04 +00:00
Yonggang Luo
bd915eeb96 util: Fixes gcc warning: declaration of 'strndup' shadows a built-in function [-Wshadow]
../../src/util/strndup.h:37:1: warning: declaration of 'strndup' shadows a built-in function [-Wshadow]
   37 | strndup(const char *str, size_t max)
      | ^~~~~~~

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37289>
2025-09-13 08:23:07 +00:00
Samuel Pitoiset
c122d70dfd radv: set radv_gfx12_hiz_wa=partial for some games to mitigate performance loss
The full workaround can hurt performance and there is no other known
solution. The only one is to select which HiZ WA works the best by
trial and error.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36174>
2025-09-11 15:21:50 +00:00
Samuel Pitoiset
b00b8c763b radv: disable radv_disable_hiz_his_gfx12 for Mafia Definition Edition
This should be properly fixed now. Also remove this drirc option which
should no longer be needed.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36174>
2025-09-11 15:21:50 +00:00
Samuel Pitoiset
5f8f4686bf radv: replace RADV_GFX12_HIZ_WA by a drirc option
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36174>
2025-09-11 15:21:50 +00:00
Ella Stanforth
01c7c97ef7 util/tests: Add list iterator tests
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Reviewed-by: Rob Clark <rob.clark@oss.qualcomm.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37061>
2025-09-10 07:38:25 +00:00
Ella Stanforth
d943a91b71 util/list: Add iterator debug to more routines.
Reviewed-by: Rob Clark <rob.clark@oss.qualcomm.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37061>
2025-09-10 07:38:24 +00:00
Ella Stanforth
6863223033 util/list: Fix next instruction removal usecase for non safe iterators
Introducing this iterator debug information breaks the usecase of removing
elements in the list other than the current element.

Fixes: 372e83b95f

Reviewed-by: Rob Clark <rob.clark@oss.qualcomm.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37061>
2025-09-10 07:38:24 +00:00
Timothy Arceri
bf946bccf2 util: add range remap util
This util allows a range of values to be remapped to a single
pointer.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36997>
2025-09-10 05:11:47 +00:00
Francisco Jerez
74168a601e util/ra: Allow driver to override class P value.
This is helpful for the driver to have the option to provide a custom
threshold for the PQ test performed by the graph coloring algorithm.

A threshold lower than the physical number of registers is helpful on
platforms where the number of registers used can impose a limit on the
thread parallelism of the program.  In such platforms even though a
passing PQ test guarantees that the node can be pushed onto the stack
and neglected while coloring the remaining nodes, the ordering in
which this happen can have a dramatic effect in the register pressure
of the resulting shader and therefore also on the thread parallelism
of the program.

Setting a P value threshold lower than the real P value will cause
nodes with Q value above the threshold to use the existing optimistic
coloring heuristic that takes the effort of ordering nodes in the
stack by Q value, in order to do a better job at minimizing the total
register requirement of the program.  Even though this causes us to
hit the optimistic codepaths for trivially colorable nodes the
interference graph is still guaranteed to be trivially colorable if it
was trivially colorable without the override.

The use of a threshold lower than the real P value will come at a
compile-time performance cost, the specific trade-off between
compile-time and run-time can be adjusted by the driver based on the
number of registers available to each thread without causing a hit to
thread parallelism.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36618>
2025-09-10 02:15:55 +00:00
Mel Henning
0d07b86073 util: Add range_minimum_query
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36184>
2025-09-08 23:03:13 +00:00
Faith Ekstrand
14c2afcb06 util/log: Add a MESA_LOG_LEVEL environment variable
This lets us control how much logging we want Mesa to do, which is
useful in CI where we don't want to collect lots of log spam that then
has to be saved somewhere.

Reviewed-by: Eric Engestrom <eric@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37203>
2025-09-08 21:28:10 +00:00
David Rosca
10dbb0ed2a util/format: Add VK_EXT_ycbcr_2plane_444_formats formats
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37174>
2025-09-08 11:59:36 +00:00
Caio Oliveira
62815cc91f util: Avoid invalid access in ralloc_print_info()
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
Check if allocation is large enough to hold the
linear and gc contexts before probing for them.

Fixes: 7b5b164281 ("util: Add function print information about a ralloc tree")
Acked-by: Eric R. Smith <eric.smith@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37017>
2025-09-06 20:28:34 +00:00
Karol Herbst
083a3dc545 util: move typed_memcpy into macros.h
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37135>
2025-09-05 20:01:00 +00:00
David Rosca
ac896c0327 util/format: Add RGB lowering for single plane YUV formats
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This fixes a regression with Y8_400 format, which needs to return
R8 as plane format.

Fixes: 5e01ec4bd0 ("util/format: Auto-generate a bunch of YUV helpers")
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37056>
2025-09-03 12:51:23 +00:00
Gurchetan Singh
8a9baab791 mesa3d: util: rust: add proper stubs
Fixes some errors when compiling on non-traditional platforms.

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37097>
2025-09-02 19:37:19 +00:00
Gurchetan Singh
68f957292e util: rust: fix some warnings
Fixes some warnings.

21 |     pub fn new(data: &[u8]) -> Reader {
   |                      ^^^^^     ------ the same lifetime is hidden here
   |                      |
   |                      the lifetime is elided here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
   = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
   |
21 |     pub fn new(data: &[u8]) -> Reader<'_> {
   |                                      ++++

Reviewed-by: David Gilhooley <djgilhooley.gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37097>
2025-09-02 19:37:19 +00:00
Tapani Pälli
4035520ca9 anv: change some image qualifiers as coherent for Last Of Us
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This fixes graphics artifacts happening with particular shader.

This 'heuristic' hits few very similar shaders but should provide better
performance than current fix to turn off caching from all shaders.

Cc: mesa-stable
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35929>
2025-09-02 11:04:35 +00:00
Rob Clark
b82e49f644 drirc: Work around ANGLE brokeness
ANGLE is completely broken on certain vendors, see
https://issues.angleproject.org/u/1/issues/431097618

Work around this by spoofing gl vendor.

Cc: mesa-stable
Signed-off-by: Rob Clark <rob.clark@oss.qualcomm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36540>
2025-08-28 12:59:52 +00:00
Robert Mader
6c83ae95a2 mesa: Add support for NV61, NV24 and NV42 pixel formats
Which are essentially variants of NV12. All of them have been tested
with the Weston client-buffer test with llvmpipe and radeonsi.

Signed-off-by: Robert Mader <robert.mader@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36890>
2025-08-26 18:08:37 +00:00
Emma Anholt
d1a6be75db util/u_queue: Fix data race on num_threads during finish.
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
This should fix a deadlock I saw on
dEQP-EGL.functional.sharing.gles2.multithread.random.programs.link.7 on
radeonsi, where we were waiting on an invalid fence[1] value.  This was
probably because between when we started setting up the fences for
u_queue_finish and when we waited on those fences, a second thread was
created.

Closes: #13738
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36919>
2025-08-24 19:30:06 +00:00
Josh Simmons
922c3c53ce util: Fix BITSET_EXTRACT out-of-bounds read
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run
In some situations the implementation of `BITSET_EXTRACT` would read
beyond the size of the bitset due to an unconditional + 1 in the address
calculation.

Reviewed-by: Georg Lehmann <dadschoorse@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Fixes: 0cc9443e9b ("util: Add BITSET_EXTRACT")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34605>
2025-08-23 19:46:05 +02:00
Danylo Piliaiev
3ec7615e54 util/disk_cache: Allow disk cache on Android if explicitly enabled
Disk cache is disabled on Android because by default it is
managed by EGL_ANDROID_blob_cache layer. However there are cases
or custom Android builds where disk cache is needed, then it can be
explicitly enabled via `mesa.shader.cache.disable=false` property
and cache path must be set via `mesa.shader.cache.dir`.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36821>
2025-08-23 10:06:47 +00:00
Danylo Piliaiev
ff9ba2cef0 util/disk_cache: Fallback to ftruncate if posix_fallocate not supported
The posix_fallocate itself may be present and callable but filesystem
may not support it. Happens at least on Android.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36821>
2025-08-23 10:06:47 +00:00
Danylo Piliaiev
d93813c7a0 util/disk_cache: Use os independent functions instead of getenv
In preparation to allow disk cache to work on Android.

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36821>
2025-08-23 10:06:46 +00:00
Danylo Piliaiev
1184830f60 util: Add function os_get_option_secure
Same as os_get_option() but uses secure_getenv() instead of getenv()

Signed-off-by: Danylo Piliaiev <dpiliaiev@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36821>
2025-08-23 10:06:46 +00:00
Jesse Natalie
415f4d7678 util: Disable inline asm for arm64 for MSVC
Fixes: b2761d14 ("util: Remove usage of USE_**_ASM macros")
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36940>
2025-08-22 22:33:50 +00:00
Yonggang Luo
dda1692484 util: Implement p_atomic_read for C++ properly.
../src/compiler/glsl/ast_function.cpp
..\src\util/u_cpu_detect.h(168): error C2220: the following warning is treated as an error
..\src\util/u_cpu_detect.h(168): warning C4197: 'uint32_t *volatile ': top-level volatile in cast is ignored
[325/1703] Compiling C++ object src/compiler/glsl/libglsl.a.p/builtin_functions.cpp.obj

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36863>
2025-08-22 02:05:57 +00:00
Yonggang Luo
de1a2a3537 util: Remove the __declspec(dllexport) on win32 for PUBLIC export macro
As on Windows, all DLLs are exported use def files, there is no need do __declspec(dllexport) on the function marker.

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36863>
2025-08-22 02:05:57 +00:00
Juan A. Suarez Romero
fa25e2de48 util: add DECLARE_LINEAR_ZALLOC with no sanitize
This specific macro allow to create a new() operator version with a
sanitizer flag disabled.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36884>
2025-08-21 12:09:04 +00:00
Juan A. Suarez Romero
1c2aa6f5c3 meson: check for no_sanitize function attributes
Meson doesn't support for checking no_sanitize attributes, so we do it
manually through testing.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Yonggang Luo <luoyonggang@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36884>
2025-08-21 12:09:04 +00:00
Yiwei Zhang
5568085568 driconf: drop obsolete DRI_CONF_VK_KHR_PRESENT_WAIT
Acked-by: Daniel Stone <daniels@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36835>
2025-08-21 07:53:15 +00:00
Marek Olšák
61c58fa0af util/hash_table: add _mesa_hash_table_copy, a cloning helper without allocation
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
271a1d8dd9 util/hash_table: don't allocate hash_table_u64::table, declare it statically
We can use _mesa_hash_table_init instead of _mesa_hash_table_create.
It doesn't have to be allocated.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
9724f7eeae util/hash_table: set _mesa_hash_table_init return type to void
it always returns true because it no longer allocates anything

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
bcffade9af util/hash_table: don't allocate the smallest table, declare it in the struct
When compiling Heaven shaders with radeonsi+ACO, this reduces the total
number of ralloc calls by 10.8% (same number as the sets, which also reduced
it by 10.8%). Apparently we like to create a lot of hash tables.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
2028caad28 util/hash_table: improve support for usage without "hash_table" allocation
_mesa_hash_table_init & _mesa_hash_table_fini (and equivalents) is
the preferred way to set up hash tables.

This adds missing "init" and "fini" functions.

_mesa_string_hash_table_create is also changed to non-inline.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
be5a15f11d util/hash_table: start with 16 entries to reduce reallocations
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
06cef7bcc2 util/set: add _mesa_set_copy, a cloning helper without allocation
Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
ed246aafd8 util/set: set _mesa_set_init return type to void
it always returns true because it no longer allocates anything

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
34cfc2600f util/set: don't allocate the smallest table, declare it in the struct
When compiling Heaven shaders with radeonsi+ACO, this reduces the total
number of ralloc calls by 10.8%. _mesa_set_init was the biggest user
of ralloc (rzalloc_array) during shader compilation.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:48 +00:00
Marek Olšák
3ead244914 util/set: start with 16 entries to reduce reallocations when growing the set
The set originally started with just 2 entries.

Reviewed-by: Gert Wollny <gert.wollny@collabora.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36728>
2025-08-21 06:13:47 +00:00