Tapani Pälli
5910c938a2
nir/glsl: gather bitmask of images used by program
...
In a similar fashion as commit f5c7df4dc9 does for textures.
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4080 >
2020-03-16 10:34:21 +00:00
Danylo Piliaiev
1305b93274
glsl: do not crash if string literal is used outside of #include/#line
...
Fixes: 67b32190f3
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2619
Signed-off-by: Danylo Piliaiev <danylo.piliaiev@globallogic.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4146 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4146 >
2020-03-13 11:49:06 +02:00
Eric Anholt
d0a52432b1
glsl/tests: Fix waiting for disk_cache_put() to finish.
...
We were wasting 4s on waiting for expected-not-to-appear files to show
up on every test. Using timeouts in test code is error-prone anyway,
as our shared runners may be busy on other jobs.
Fixes: 50989f87e6 ("util/disk_cache: use a thread queue to write to shader cache")
Link: https://gitlab.freedesktop.org/mesa/mesa/issues/2505
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4140 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4140 >
2020-03-12 19:47:23 +00:00
Eric Anholt
e178bca5cc
glsl/tests: Catch mkdir errors to help explain when they happen.
...
A recent pipeline
(https://gitlab.freedesktop.org/Venemo/mesa/-/jobs/1893357 ) failed
with what looks like an intermittent error related to making files for
the cache test inside of the core of the cache. Given some of the
errors, it looks like maybe a mkdir failed, so log those errors
earlier so we can debug what's going on next time.
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4140 >
2020-03-12 19:47:23 +00:00
Caio Marcelo de Oliveira Filho
bf432cd831
nir: Add pass to combine adjacent scoped memory barriers
...
SPIR-V generates very granular barriers, however HW and backends might
not necessarily take advantage of those. This pass provides a general
mechanism to combine such barriers.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3224 >
2020-03-12 19:21:36 +00:00
Caio Marcelo de Oliveira Filho
d31a8ed8fd
nir: Reorder nir_scopes so wider scope has larger numeric value
...
Makes code comparing and combining scopes slightly more readable.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3224 >
2020-03-12 19:21:36 +00:00
Caio Marcelo de Oliveira Filho
67fc88fbb9
nir: Don't skip a bit in nir_memory_semantics
...
There was another enum entry in the draft versions of
nir_memory_semantics, but when it got dropped the entries were not
updated.
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3224 >
2020-03-12 19:21:36 +00:00
Juan A. Suarez Romero
90550b2a3e
nir/algebraic: coalesce fmod lowering
...
As fmod for 16/32/64 bits lowering does the same, let's merge all of
them in a single case.
Fixes dEQP-VK.glsl.builtin.precision_double.mod.compute.* on ACO.
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4118 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4118 >
2020-03-12 16:42:52 +00:00
Juan A. Suarez Romero
acd0dd3b4b
nir/lower_double_ops: relax lower mod()
...
Currently when lowering mod() we add an extra instruction so if
mod(a,b) == b then 0 is returned instead of b, as mathematically
mod(a,b) is in the interval [0, b).
But Vulkan spec has relaxed this restriction, and allows the result to
be in the interval [0, b].
For the OpenGL case, while the spec does not allow this behaviour, due
the allowed precision errors we can end up having the same result, so
from a practical point of view, this behaviour is allowed (see
https://github.com/KhronosGroup/VK-GL-CTS/issues/51 ).
This commit takes this in account to remove the extra instruction
required to return 0 instead.
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4118 >
2020-03-12 16:42:52 +00:00
Timur Kristóf
ec16535b49
nir: Add ability to lower non-const quad broadcasts to const ones.
...
Some hardware doesn't support subgroup shuffle, and on such hardware
it makes no sense to lower quad broadcasts to shuffle. Instead, let's
lower them to four const quad broadcasts, paired with bcsel instructions.
Cc: mesa-stable@lists.freedesktop.org
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4147 >
2020-03-12 13:16:07 +00:00
Rhys Perry
4d0203aa83
glsl/list: use uintptr_t for exec_node_data()'s subtraction
...
This fixes UBSan warnings when foreach_list_typed_safe() passes NULL:
pointer index expression with base 0x000000000000 overflowed to 0xffffffffffffffa8
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4157 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4157 >
2020-03-12 12:09:07 +00:00
Rob Clark
3535797e8c
nir/print: show variable precision
...
Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4071 >
2020-03-10 16:01:39 +00:00
Neil Roberts
83e20139db
glsl/opt_minmax: Add support for float16
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Kristian H. Kristensen
e3cc81e86c
glsl/lower_instructions: Handle fp16 for FDIV_TO_MUL_RCP
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Hyunjun Ko
4fcac46cbd
glsl/lower_instructions: Handle fp16 for MOD_TO_FLOOR
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Neil Roberts
6c1c2b779a
glsl/lower_instructions: Use float16 constants when appropriate
...
When lowering instructions that involve floating-point constants, pick
the appropriate type for the constant so that it will also work with
float16 parameters.
v2: Use float16_t constructor instead of helper function.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Neil Roberts
2b39bb4fc0
glsl/validate: Allow float16 in the expression tree
...
v2. [Hyunjun Ko (zzoon@igalia.com )] squashed 3 commits
into one commit.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Kristian H. Kristensen
198d4a535b
glsl: Add type queries for fp16+float and fp16+float+double
...
Following the is_integer_32_64() convention, add is_float_16_32() and
float_16_32_64() for these commonly tested combinations.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Hyunjun Ko
ad27eb28d9
glsl: Handle fp16 unary operations when lowering matrix operations
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Neil Roberts
1b8edffaa5
glsl: Add ir_unop_f2fmp
...
This is the same as ir_unop_f2f16 except that it comes with a promise
that it is safe to optimise it out if the result is immediately
converted back to float32 again. Normally this would be a lossy
operation but it is safe to do if the conversion was generated as part
of the precision lowering pass.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Neil Roberts
5d6b007da8
glsl: Add b2f16 and f162b conversion operations
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Neil Roberts
6b9f6caf06
glsl: Add IR conversion ops for 16-bit float types
...
Adds ir_unop_f162f and ir_unop_f2f16.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Kristian H. Kristensen
878a35db9d
glsl: Expand fp16 to float before constant expression evaluation
...
This way the generated constant folding code doesn't need to
understand fp16. All operations have to be expanded to full float for
evaulation on the CPU, so we might as well do it up front. As far as
GLSL is concerned, fp16 isn't a separate type from float, so
everything we're supposed to support for float we need to do for fp16.
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Kristian H. Kristensen
505428f20b
glsl: Implement constant propagation for fp16
...
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Kristian H. Kristensen
83afebf359
glsl: Add fp16 case for ir_triop_lrp optimization
...
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Neil Roberts
668ab9f19d
glsl: Add support for float16 types in the IR tree
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Kristian H. Kristensen
4068d6baff
glsl: Add ir_constant constructor for fp16
...
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3929 >
2020-03-09 16:31:08 +00:00
Daniel Schürmann
ce87da71e9
nir: add pass to lower discard() to demote()
...
This pass is intended to work around game bugs, only!
It also lowers nir_intrinsic_load_helper_invocation to
nir_intrinsic_is_helper_invocation for consistency.
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4047 >
2020-03-09 12:29:32 +00:00
Daniel Schürmann
5adcfa68a9
nir: gather info whether a shader uses demote_to_helper
...
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4047 >
2020-03-09 12:29:32 +00:00
Tapani Pälli
24408acca4
nir: fix compilation warning on glsl_get_internal_ifc_packing
...
Removes following warning:
warning: 'const' type qualifier on return type has no effect
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4111 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4111 >
2020-03-09 09:43:49 +00:00
Timothy Arceri
1da6b7f8a3
glsl: add subroutine support to nir linker
...
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
b1bc24f826
glsl: dont try to assign uniform storage for uniform blocks
...
Fixes a crash in some shaders.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
576b5ace9e
glsl: add support for builtins to the nir uniform linker
...
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
79127f8d5b
glsl: set ShaderStorageBlocksWriteAccess in the nir linker
...
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
17f240b874
glsl: nir linker fix setting of ssbo top level array
...
This helps correcly set it for each top level member and correctly
handle unsized arrays.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
8ffd09f311
glsl: find the base offset for block members from unnamed blocks
...
These block member have been split into individual vars so we need
to set the correct offsets for each member in the new glsl nir
linker. We also take this opportunity to set the correct location
for the variable.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
76ce775240
glsl: correctly set explicit offsets for struct members
...
This correctly sets offsets set in glsl when using the nir linker.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
590a59437f
glsl: add std140 and std430 layouts to nir uniform linker
...
The current ARB_gl_spirv linking only supports explicit layouts so
we need to update it to support std140 and std430 layouts before
we can use the linker for glsl.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
858a49a10d
nir: add glsl_get_std430_size() helper
...
This will be used by the nir glsl linker for linking uniforms.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
a005f1a6e7
nir: add glsl_get_std430_base_alignment() helper
...
This will be used by the nir glsl linker for linking uniforms.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
1ccfe821b2
nir: add glsl_get_std140_size() helper
...
This will be used by the nir glsl linker for linking uniforms.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
120a26c6f2
nir: add glsl_get_std140_base_alignment() helper
...
This will be used by the nir glsl linker for linking uniforms.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
262b611a5b
nir: add glsl_get_internal_ifc_packing() helper
...
This will be used by the nir glsl linker for linking uniforms.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
a02d8e040f
glsl: correctly find block index when linking glsl with nir linker
...
The existing code for spirv expects all vars to have explicit
bindings set which is not true for glsl.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
10b816d27e
glsl: add name support to nir uniform linker
...
Name support is optional for spirv support but is required for glsl
support.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
aa9b457062
glsl: move get_next_index() earlier in nir link uniforms
...
We will use get_next_index() in more of the helper functions in
the following patches.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
219cefe24f
glsl: move add_parameter() earlier in nir link uniforms
...
We will use add_parameter() in more of the helper functions in
the following patches.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Timothy Arceri
51898c8ee5
glsl: move nir link uniforms struct defs earlier
...
We will need to use the state in more of the helper functions in
the following patches.
Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4050 >
2020-03-06 23:22:14 +00:00
Alejandro Piñeiro
2ba272135a
nir/linker: remove reference to just SPIR-V linking
...
Several files had a initial comment about the purpose of such files,
including a reference that the NIR linker was implemented with just
ARB_gl_spirv in mind.
Since the nice job Timothy is doing to use the NIR linker on GLSL,
that is not true anymore, so let's remove that reference and also
tweak some other comments.
Acked-by: Timothy Arceri <tarceri@itsqueeze.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4081 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4081 >
2020-03-06 12:28:08 +00:00
Samuel Pitoiset
913d2dcd23
nir/lower_input_attachments: remove bogus assert in try_lower_input_texop()
...
It can be a sampler too.
Fixes: 84b08971fb ("nir/lower_input_attachments: lower nir_texop_fragment_{mask}_fetch")
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2558
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4043 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4043 >
2020-03-06 09:13:40 +00:00