Qiang Yu
eee3091e3e
glsl: add KHR_shader_subgroup_shuffle builtin functions
...
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30610 >
2024-08-26 10:46:19 +08:00
Qiang Yu
a496d84ac8
glsl: add KHR_shader_subgroup_ballot builtin functions
...
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30610 >
2024-08-26 10:46:18 +08:00
Qiang Yu
7113d3c6ba
glsl: prepare ballot function args for subgroup usage
...
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30610 >
2024-08-26 10:46:18 +08:00
Qiang Yu
5f212a190b
glsl: add KHR_shader_subgroup_vote builtin functions
...
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30610 >
2024-08-26 10:46:18 +08:00
Qiang Yu
2d71467ec3
glsl: prepare vote function args for subgroup usage
...
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30610 >
2024-08-26 10:46:18 +08:00
Qiang Yu
f0c8520a90
glsl: add KHR_shader_subgroup_basic builtin functions
...
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30610 >
2024-08-26 10:46:18 +08:00
Qiang Yu
c631116644
glsl: remove unused builtin function macros
...
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30610 >
2024-08-26 10:46:17 +08:00
Timothy Arceri
8e4b14dcfd
glsl: apply implicit matching rules when linking
...
Previously when linking i.e. when compiler state was NULL. We just
assumed all implicit matching was avaliable.
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30752 >
2024-08-23 12:14:22 +10:00
Adam Jackson
10d21d4100
mesa: Enable EXT_shadow_samplers for GLES2
...
I thought this was just the funny GLES spelling of the extn name, but
there's also some ESSL bits you need to add. Most of which you could
probably yoink from the old Unity glsl-optimizer (which itself yoinked
most of the GLSL compiler from Mesa):
https://github.com/aras-p/glsl-optimizer/commit/94a9b2959b885dba4e355aa344adb4d472b00f18
Signed-off-by: Adam Jackson <ajax@redhat.com >
Co-authored-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6691 >
2024-06-18 14:40:33 +00:00
Timothy Arceri
5f1f6d7496
glsl: add half float AMD_shader_trinary_minmax functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:14 +00:00
Timothy Arceri
d619c16c3f
glsl: add half float derivative functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:14 +00:00
Timothy Arceri
14de2eff89
glsl: add half float interpolation functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:14 +00:00
Timothy Arceri
3dc67c2c7e
glsl: add half float vector relational functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:14 +00:00
Timothy Arceri
e7f1be1ceb
glsl: add half float matrix functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:14 +00:00
Timothy Arceri
99a80ac930
glsl: add half float geometric functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:14 +00:00
Timothy Arceri
6a170051a9
glsl: add support for half float packing functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:14 +00:00
Timothy Arceri
c386d56915
glsl: add half float support for common functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:14 +00:00
Timothy Arceri
94865a45f8
glsl: add half float exponential functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:14 +00:00
Timothy Arceri
829c99def1
glsl: add half float angle and trigonometry functions
...
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:13 +00:00
Timothy Arceri
3ff22ee4ae
glsl: add some new helpers for half float builtin functions
...
These helpers will be used in the following patches.
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18540 >
2024-02-12 13:23:13 +00:00
Caio Oliveira
d06f0305f6
glsl: Use glsl_type C helpers
...
Acked-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26707 >
2023-12-22 06:51:01 -08:00
Caio Oliveira
81e3b28f78
compiler: Remove C++ static member pointers to builtin types
...
When we moved the bulk of glsl_type to C, these globals were
kept to avoid changes to compiler/glsl code in the MR. Now that
landed, change the code to use the actual bultins directly.
Acked-by: Timothy Arceri <tarceri@itsqueeze.com >
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26658 >
2023-12-15 03:09:19 +00:00
Eric Anholt
b1b0ebba1e
glsl: Remove int64 div/mod lowering.
...
Most drivers that can expose GL4 were claiming the cap anyway (llvmpipe,
softpipe, zink, iris, nvc0, radeonsi, r600, freedreno, d3d12), and just
doing lowering in NIR if nessary.
crocus was only claiming the cap for gen8, but the backend compiler
enables NIR lowering regardless.
svga is the only other GL4 driver that didn't set it, and we can just set
the NIR lowering flag.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Acked-by: Faith Ekstrand <faith.ekstrand@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25777 >
2023-10-24 00:16:30 +00:00
twisted89
d3e796da6b
util/driconf: add workarounds for the Chronicles of Riddick
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24567 >
2023-08-24 22:38:56 +00:00
Emma Anholt
7325f699db
glsl: Drop frontend lowering of 32-bit frexp.
...
All the users should now be calling the appropriate NIR lowering function.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22083 >
2023-04-06 02:32:01 +00:00
Emma Anholt
4a51944639
glsl: Fix the precision of atomic counter builtin function args.
...
More special-casing dropped from GLSL lower_precision.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21666 >
2023-03-21 00:51:24 +00:00
Emma Anholt
b1d228e9d5
glsl: Handle highp promotion of builtin function args in the builtins.
...
It's what the spec says to do. This will may help us avoid special-casing
these functions if we ever lower precision after builtin inlining.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21666 >
2023-03-21 00:51:24 +00:00
Emma Anholt
be2731f445
glsl: Set the precisions of builtin function arguments and returns.
...
These have precision qualifiers defined in the spec, in which case we
should emit them them while generating builtin signatures and code. We've
been special-casing them in GLSL lower_precision, but now we can just rely
on the precision qualifier of the builtin if non-NONE.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21666 >
2023-03-21 00:51:24 +00:00
Yonggang Luo
ad0d39efed
glsl: Use DETECT_CC_GCC_VERSION in glsl/builtin_functions.cpp
...
The expression "(__GNUC__ * 100) + __GNUC_MINOR" is invalid
because __GNUC_MINOR is not defined by the compiler
This can not fixes the previous version because DETECT_CC_GCC_VERSION is not available
in previous released version
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19771 >
2022-11-17 01:43:37 +00:00
Yonggang Luo
e518ff4fd5
glsl: Remove the need of _MTX_INITIALIZER_NP by using simple_mtx_t/SIMPLE_MTX_INITIALIZER
...
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com >
Acked-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: David Heidelberg <david.heidelberg@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18493 >
2022-11-09 04:38:28 +00:00
Timothy Arceri
f533dfff55
glsl: drop non-nir path for atan in builtin functions
...
All drivers now use NIR. Here we drop the non NIR path and rename
the NIR path to drop the extra "_op" chars from the function names.
Reviewed-by: Emma Anholt <emma@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17308 >
2022-07-01 03:05:03 +00:00
Erik Faye-Lund
2cd0779f83
nir/spirv: guard macros in case of redefinition
...
On some systems, these macros are already defined, and being defined
slightly differently causes them to emit redefinition-warnings.
Let's wrap them in ifdefs to avoid the warnings.
Acked-by: Caio Oliveira <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15084 >
2022-02-21 19:47:17 +00:00
Qiang Yu
10a71c6106
glsl: add ARB_sparse_texture_clamp builtin functions
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488 >
2022-02-01 10:28:05 +00:00
Qiang Yu
391f2dffaa
glsl: _textureCubeArrayShadow support clamp
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488 >
2022-02-01 10:28:05 +00:00
Qiang Yu
de37146c71
glsl: _texture support clamp parameter
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488 >
2022-02-01 10:28:05 +00:00
Dave Airlie
b4aa10c089
glsl: avoid rebuilding builtin functions on mtypes.h changes.
...
Restrict to when shader types or consts change
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Dave Airlie
3868b30fc4
glsl/parser: extract consts/exts/api out of context at start.
...
This stores these pointers separately. in theory now gl_context
can be made more opaque later, if we split header files ups.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437 >
2022-01-20 00:20:06 +00:00
Qiang Yu
634bb25123
glsl: add sparseTexelsResidentARB builtin function
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:36 +08:00
Qiang Yu
59d94d8188
glsl: add sparse texture image load builtin functions
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
dcec15d79c
glsl: add _texelFetch related sparse texture builtin function
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
a26dbfc24b
glsl: add _textureCubeArrayShadow related sparse texture builtin func
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Qiang Yu
640f909862
glsl: add _texture related sparse texture builtin functions
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Signed-off-by: Qiang Yu <yuq825@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362 >
2022-01-18 16:10:35 +08:00
Emma Anholt
f568d80986
glsl: Retire unused modes for lower_64bit_integer_instructions.
...
Unused since 424ac809bf ("i965: Do int64 lowering in NIR")
Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com >.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14249 >
2021-12-20 14:56:35 -08:00
Danylo Piliaiev
c0f623e62f
glsl: Prohibit implicit conversion of mem parameter in atomicOP functions
...
Per OpenGL Shading Language, section 8.11. "Atomic Memory Functions"
first argument "mem" of all atomicOP functions is inout.
The same is true for ARB_shader_storage_buffer_object and
GL_INTEL_shader_atomic_float_minmax
For implicit conversion of inout parameters it is required for type
to support bi-directional conversion, since there is no such types
in glsl - implicit conversion is effectively prohibited.
Alternatively we could have marked atomic_var parameter of built-in
atomicOP functions as inout, however it opens another can of worms
during NIR lowerings.
Fixes: ea0a1f5beb
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2837
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4887 >
2021-07-05 18:29:51 +03:00
Martin Krastev
eb272f6571
compiler/glsl: Use mutex lock while freeing up mem_ctx
...
builtin_builder::~builtin_builder() and builtin_builder::release()
are running into race condition. This leads lightsmark to crash at
the end because both calls ralloc_free which mutates the arguments state
This patch fixes lightsmark2008 crash
Fixes: e4da8b9c33 ("mesa/compiler: rework tear down of builtin/types")
Reviewed-by: Charmaine Lee <charmainel@vmware.com >
Reviewed-by: Neha Bhende <bhenden@vmware.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Tested-by: Neha Bhende <bhenden@vmware.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11385 >
2021-06-16 23:14:23 +00:00
Timothy Arceri
3d1022382c
glsl: enforce restrictions on builtin functions moved to compat
...
Section 8.9.4 (Compatibility Profile Texture Functions) of the
GLSL 4.20 spec outlines a number of builtin texture functions that
have been moved to compatibility shaders.
This change enforces those restrictions. Note we don't worry about
enforcing restrictions on the EXT_gpu_shader4 extensions of these
functions because EXT_gpu_shader4 should only be enabled for compat
already.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9887 >
2021-04-01 02:41:40 +00:00
Ilia Mirkin
a0f4affcf6
glsl: only expose int64 atomics when extension is enabled
...
This limits the exposure of these functions to when the extension is
available. Prevents crashes otherwise, as the rest of the infrastructure
doesn't necessarily expect these functions when the extension is not
available.
Fixes: 40c1f9883e ("mesa,glsl: add support for GL_NV_shader_atomic_int64")
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8533 >
2021-01-16 18:21:03 +00:00
Alexander von Gluck IV
c7486c996e
glsl/builtin_functions: Rename int64 function to int64_avail
...
* int64 is a core type on Haiku (and potentially other platforms)
* rename to int64_avail matching other similar calls
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
2021-01-04 21:18:55 -06:00
Michel Zou
df143fa1ef
glsl: Drop mingw -O1 workaround for GCC>=7.3
...
Reviewed-by: Jose Fonseca <jfonseca@vmware.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7770 >
2020-11-26 12:55:54 +00:00
Indrajit Kumar Das
40c1f9883e
mesa,glsl: add support for GL_NV_shader_atomic_int64
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6708 >
2020-09-29 14:24:44 +00:00