Marek Olšák
e54264c84f
nir: add shader_info::source_sha1, its initialization and printing
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13869 >
2021-11-26 11:58:27 +00:00
Lionel Landwerlin
52c0e6e5b3
spirv: switch Groups capability to non AMD specific field
...
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13081 >
2021-09-29 15:40:20 +00:00
Lionel Landwerlin
9d9e67d118
spirv: don't fail on CapabilitySubgroupDispatch if supported
...
Since only Anv uses the value, I'm only enabling this on anv.
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Fixes: 518693c3ec
("spirv: Handle the SubgroupSize execution mode")
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13034 >
2021-09-24 20:23:14 +00:00
Jason Ekstrand
518693c3ec
spirv: Handle the SubgroupSize execution mode
...
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12959 >
2021-09-21 18:34:59 +00:00
Ian Romanick
d7ba52cce9
nir/edgeflags: Add a flag to indicate the edge flag input is needed
...
Most modern hardware needs the edge flag added as a hidden vertex input
and needs code added to the vertex shader to copy the input to an
output. Intel hardware is a little different. Gfx4 and Gfx5 hardware
works in the previously described mannter. Gfx6+ hardware needs the
edge flag as a specific vertex shader input, and that input is magically
processed by fixed-function hardware without need for extra shader code.
This flag signals only that the vertex shader input is needed. It would
be nice if we could decouple adding the vertex shader input from
generating the copy-to-output code, but that has proven to be
challenging. Not having that code causes other passes to want to
eliminate that shader input.
v2: Convert conditional to assertion. This pass is only called for
vertex shaders. Suggested by Ken.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12858 >
2021-09-17 16:36:08 -07:00
Emma Anholt
91dc863921
mesa: Move the advanced blend bitmask to shader_info.
...
For drivers that don't lower advanced blend to FBFETCH, we need the
bitmask to be in the NIR shader so that it gets carried over to TGSI
successfully.
Reviewed-by: Rob Clark <robdclark@chromium.org >
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12813 >
2021-09-13 18:36:58 +00:00
Caio Marcelo de Oliveira Filho
b34f9740ca
spirv: Implement non-Multiview parts of SPV_NV_mesh_shader
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10600 >
2021-08-28 03:56:43 +00:00
Caio Marcelo de Oliveira Filho
9631d24c3f
compiler: Add Task/Mesh to shader_info
...
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10600 >
2021-08-28 03:56:42 +00:00
Caio Marcelo de Oliveira Filho
f95daad3a2
nir: Add a way to identify per-primitive variables
...
Per-primitive is similar to per-vertex attributes, but applies to all
fragments of the primitive without any interpolation involved.
Because they are regular input and outputs, keep track in shader_info
of which I/O is per-primitive so we can distinguish them after deref
lowering. These fields can be used combined with the regular
`inputs_read`, `outputs_written` and `outputs_read`.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10600 >
2021-08-28 03:56:42 +00:00
Pierre-Eric Pelloux-Prayer
8cd2e82c89
mesa: move gl_program::is_arb_asm to shader_info
...
This will be used from radeonsi in the next commit.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11972 >
2021-07-28 08:49:30 +00:00
Caio Marcelo de Oliveira Filho
baefdceeaf
spirv: Implement SPV_EXT_shader_atomic_float16_add
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11981 >
2021-07-21 20:15:21 +00:00
Caio Marcelo de Oliveira Filho
6ad88a8f08
spirv: Support SPV_KHR_subgroup_uniform_control_flow
...
There's no SPIR-V Capability associated, so check in the Execution
Mode. For now, don't keep track of whether a shader uses uniform
control flow in the shader_info, we can add that when/if a driver
actually need that information.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11476 >
2021-06-25 22:41:32 +00:00
Caio Marcelo de Oliveira Filho
8af6766062
nir: Move workgroup_size and workgroup_variable_size into common shader_info
...
Move it out the "cs" sub-struct, since these will be used for other
shader stages in the future.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11225 >
2021-06-08 09:23:55 -07:00
Caio Marcelo de Oliveira Filho
b5f6fc442c
nir: Move zero_initialize_shared_memory into common shader_info
...
Move it out the "cs" sub-struct, since the bit will be used for other
shader stages in the future.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11225 >
2021-06-08 09:23:55 -07:00
Caio Marcelo de Oliveira Filho
430d2206da
compiler: Rename local_size to workgroup_size
...
Acked-by: Emma Anholt <emma@anholt.net >
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Acked-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11190 >
2021-06-07 22:34:42 +00:00
Caio Marcelo de Oliveira Filho
dd48683cfd
nir: Move shared_memory_explicit_layout bit into common shader_info
...
Move it out of the "cs" sub-struct, since the bit can be used for
other shader stages in the future.
This also removes a subtle issue in spirv_to_nir:
info.cs.shared_memory_explicit_layout was used without checking for
the CS shader stage. It ended up being "harmless" since the effects
also depended on presence of shared variables.
Fixes: 5de6c5973a
("spirv: Implement SPV_KHR_workgroup_memory_explicit_layout")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10529 >
2021-05-04 20:54:58 +00:00
Marek Olšák
73f532e5bf
nir: add new VARYING_SLOTs and shader info for packed 16-bit varyings
...
This allows mediump inputs and outputs to be trivially lowered into packed
16-bit varyings where 1 slot is occupied by 2 16-bit vec4s, without any
packing instructions in NIR and without any conflicts with 32-bit varyings.
The only thing that is changed is IO semantics in intrinsics to get packed
16-bit varyings.
This simplifies supporting 16-bit types for drivers that have 32-bit slots
everywhere except the fragment shader where they can do 16-bit interpolation
on either the low or high half of each slot.
Reviewed-by: Matt Turner <mattst88@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9050 >
2021-04-13 05:07:42 +00:00
Jesse Natalie
c04b36de39
vtn: Add a cap for CL drivers to support read-write images
...
This is a required CL2.0, optional CL3.0 feature
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10181 >
2021-04-12 13:41:39 +00:00
Bas Nieuwenhuizen
580f1ac473
nir: Extract shader_info->cs.shared_size out of union.
...
It is valid for all stages, just 0 for most of them. In particular
mesh/task shaders might be using it.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10094 >
2021-04-08 14:39:28 +00:00
Jason Ekstrand
a572471edc
spirv: Add support for SPV_EXT_shader_atomic_float_min_max
...
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8750 >
2021-03-18 00:13:40 +00:00
Dave Airlie
8027a7ba8a
shader_info: convert textures_used to a bitset.
...
For now keep it a bitset of 1 32-bit dword.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9456 >
2021-03-10 06:16:09 +10:00
Alyssa Rosenzweig
9f934e922d
compiler, nir: Add and set barrier metadata
...
Useful for determining whether certain optimizations are legal for a
compute shader (e.g. optimizing workgroup size in the driver).
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6312 >
2021-02-12 01:37:05 +00:00
Caio Marcelo de Oliveira Filho
c4f2297f00
spirv: Recognize zero initializers in Workgroup variables
...
This will be used to implement
VK_KHR_zero_initialize_workgroup_memory.
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8708 >
2021-02-02 17:06:56 +00:00
Caio Marcelo de Oliveira Filho
5de6c5973a
spirv: Implement SPV_KHR_workgroup_memory_explicit_layout
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8699 >
2021-01-27 22:20:53 +00:00
Caio Marcelo de Oliveira Filho
9f3d5e99ea
compiler: Use util/bitset.h for system_values_read
...
It is currently a bitset on top of a uint64_t but there are already
more than 64 values. Change to use BITSET to cover all the
SYSTEM_VALUE_MAX bits.
Cc: mesa-stable
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Acked-by: Jesse Natalie <jenatali@microsoft.com >
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com >
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Acked-by: Alejandro Piñeiro <apinheiro@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8585 >
2021-01-26 20:20:47 +00:00
Rhys Perry
c73c246e05
nir: gather whether a compute shader uses non-quad subgroup intrinsics
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7918 >
2021-01-07 15:01:02 +00:00
Rhys Perry
f7a5b8ed35
vtn: support SpvCapabilitySparseResidency
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7774 >
2021-01-06 20:36:38 +00:00
Jesse Natalie
9524e9dbd0
nir/vtn: Implement printf opcode in terms of intrinsic (v9)
...
[airlied: rebase fixup types]
v2: add support for storing strings in a sideband storage,
just store the index in print buffer.
v3: move the format strings into the nir shader as well
v4: simplify the write constant string + explicit sizes
move printf cap definition.
v5: just parse the format string to find string specifiers
using util code.
add vtn_fail_if if we can't get the correct type.
v6: use ralloc + avoid instr handler for srcs > 5
v7: use a packed struct 4 bytes align all of it
v8: simplify constant copy
v9: rework to use a single string and common string
extract code, (Jason)
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Dave Airlie <airlied@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254 >
2020-12-29 09:07:23 +10:00
Vinson Lee
836b9e1d88
glsl: Fix typos in comments.
...
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7767 >
2020-12-16 02:19:56 +00:00
Samuel Pitoiset
128b2de63b
nir: gather if a fragment shader uses sample shading
...
This introduces a new flag in shader_info to know if a fragment
shader uses sample shading, even if there is no inputs.
During NIR linking, constants varyings are optimized and the
per-sample interpolation info (ie. the sample qualifier) might
be removed if nir_shader_gather_info() is called again.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7876 >
2020-12-03 08:24:05 +01:00
Lionel Landwerlin
a5b899c7da
spirv: add support for KHR_fragment_shading_rate
...
v2: Use VARYING (Samuel)
v3: Only allow VERTEX & GEOMETRY stages (Samuel)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7795 >
2020-12-01 08:20:38 +00:00
Boris Brezillon
7d3aec9905
compiler/spirv: Handle the LocalSizeHint execution modes
...
It's basically the same as the LocalSize version except it fills
the local_size_hint array.
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7565 >
2020-11-18 04:05:37 +00:00
Marek Olšák
d5039f99b4
nir: gather shader_info::needs_all_helper_invocations
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7586 >
2020-11-12 21:02:05 +00:00
Marek Olšák
baa5807e36
nir: rename needs_helper_invocations to needs_quad_helper_invocations
...
This indicates that only quad operations use helper invocations.
Also handle quad_swizzle_amd.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7586 >
2020-11-12 21:02:05 +00:00
Jason Ekstrand
2bbe01b186
spirv: Add support for SPV_EXT_shader_image_atomic_int64
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7509 >
2020-11-09 17:17:40 +00:00
Jason Ekstrand
d8dbdf20de
spirv: Add basic plumbing for ray-tracing capabilities
...
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com >
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6479 >
2020-11-05 23:36:45 +00:00
Caio Marcelo de Oliveira Filho
eb03f29655
spirv: Implement SpvCapabilitySubgroupBufferBlockIOINTEL
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7448 >
2020-11-04 20:24:48 +00:00
Caio Marcelo de Oliveira Filho
b86ce274f9
spirv: Implement SpvCapabilitySubgroupShuffleINTEL from SPV_INTEL_subgroups
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7448 >
2020-11-04 20:24:48 +00:00
Rhys Perry
4e5c85526b
nir: add shader_info::bit_sizes_used
...
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/4791 >
2020-11-04 11:50:37 +00:00
Jason Ekstrand
a8e53a772f
spirv: Add generic pointer support
...
Most of this is fairly straightforward; we just set all the modes on any
derefs which are generic. The one tricky bit is OpGenericCastToPtrExplicit.
Instead of adding NIR intrinsics to do the cast, we add NIR intrinsics
to do a storage class check and then bcsel based on that.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6332 >
2020-11-03 22:18:28 +00:00
Marek Olšák
3f1b35a2f0
nir: add new helper passes that lower uniforms to literals
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6955 >
2020-10-07 17:30:12 +00:00
Jesse Natalie
93db59e066
nir: Add an internal flag to shader_info
...
Don't print the shader if it's marked internal, unless NIR_PRINT
has been explicitly set to 2 (or higher).
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6035 >
2020-09-25 20:09:08 +00:00
Marek Olšák
ea77958fea
nir: gather information about fbfetch and dual source color
...
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6758 >
2020-09-25 02:29:30 -04:00
Jesse Natalie
b778e7bd6c
nir/vtn: Convert constant samplers to variables with data
...
Reviewd-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5242 >
2020-08-31 21:17:39 +00:00
Jesse Natalie
de36b5b805
nir/vtn: Add support for kernel images to SPIRV-to-NIR.
...
There's a few quirks: kernel images are untyped, whether they're
sampled is unknown, and they're passed as inputs to the kernel even though
SPIR-V declares their address space as UniformConstant.
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5242 >
2020-08-31 21:17:39 +00:00
Marek Olšák
7980f3e519
nir: add interpolation qualifiers for color sysvals into shader_info
...
needed by radeonsi
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6442 >
2020-08-24 19:07:18 +00:00
Marek Olšák
4d36dceeab
nir: add shader_info::io_lowered
...
This will drive decisions in many NIR passes and st/mesa.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6442 >
2020-08-24 19:07:18 +00:00
Louis-Francis Ratté-Boulianne
7dcb1d272f
st/mesa: Replace UsesStreams by ActiveStreamMask for GS
...
Some drivers need to know which streams are used by a geometry
shader. Adding a mask of active streams makes the use of
UsesStreams superfluous as it's the equivalent of:
ActiveStreamMask != (1 << 0)
Signed-off-by: Louis-Francis Ratté-Boulianne <lfrb@collabora.com >
Reviewed-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5984 >
2020-08-18 11:17:26 +00:00
Jason Ekstrand
84086b620e
spirv: Add support for SPV_EXT_shader_atomic_float
...
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com >
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5992 >
2020-07-21 05:01:34 +00:00
Marek Olšák
cac24bee62
nir: gather which images are MSAA
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5209 >
2020-06-02 20:47:49 +00:00