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
Enrico Galli
ad88e2f959
microsoft/spirv_to_dxil: Use non-zero exit code on failed compilations
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10064 >
2021-04-07 23:50:39 +00:00
Enrico Galli
5756f2cd2c
microsoft/spirv_to_dxil: Add support for load_vulkan_descriptor
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10064 >
2021-04-07 23:50:39 +00:00
Jesse Natalie
91dbad7956
microsoft/compiler: Fix barrier flag for shared memory
...
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10010 >
2021-04-05 15:58:03 +00:00
Jesse Natalie
f447c69653
spirv_to_dxil: Handle clip/cull distance
...
Clip/cull only needs a little bit of lowering before nir_to_dxil can
handle it. Specifically, we just need to split apart arrays that
straddle the 4-component boundary of location, so that the signature
builder can handle it.
To do that cleanly, we need to add some lowering and optimization passes:
* nir_lower_clip_cull_distance_arrays: Merge clip/cull into a single array,
which is similar to DXIL's requirements here.
* nir_lower_io_to_temporaries: Ensure that we only have one non-indirect write
to the clip/cull output.
* nir_split_var_copies and nir_lower_var_copies: Ensure that each array entry
has an independent write with a constant index
* Optimization loop: Make sure that there's no extra derefs in the way between
deref_var for the output, deref_array for the component, and store_deref.
Then we can actually lower the clip/cull array cleanly.
Still to do is to sort the variables and add driver_location.
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Reviewed-by: Michael Tang <tangm@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846 >
2021-04-02 17:16:48 +00:00
Jesse Natalie
39aa32b838
microsoft/spirv_to_dxil: Implement TODO for removing dead functions
...
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Reviewed-by: Michael Tang <tangm@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846 >
2021-04-02 17:16:48 +00:00
Jesse Natalie
baeb363df0
microsoft/compiler: Support compact arrays for clip/cull in nir_to_dxil
...
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Acked-by: Michael Tang <tangm@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846 >
2021-04-02 17:16:48 +00:00
Jesse Natalie
4941decc58
microsoft/compiler: Enable dxil_nir.h to be included from C++
...
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Acked-by: Michael Tang <tangm@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846 >
2021-04-02 17:16:48 +00:00
Jesse Natalie
65e1bee99c
microsoft/compiler: Add a lowering pass to split clip/cull distance compact arrays
...
As the pass's comment explains, NIR compact arrays are a better match
to represent the GLSL float[] design of clip/cull distance arrays, compared
to the float4[2] approach. This pass adjusts the variables to more closely
match what DXIL signatures would look like for that representation.
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Acked-by: Michael Tang <tangm@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846 >
2021-04-02 17:16:48 +00:00
Jesse Natalie
96cd961853
microsoft/compiler: Add copy_prop_vars to optimization loop
...
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Acked-by: Michael Tang <tangm@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846 >
2021-04-02 17:16:48 +00:00
Jesse Natalie
3f1b90d638
microsoft/compiler: Move blob_init earlier to prevent crash on failure
...
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Acked-by: Michael Tang <tangm@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846 >
2021-04-02 17:16:48 +00:00
Michael Tang
cb5120bcf7
microsoft/spirv_to_dxil: Add extra lowering functions according to the docs on nir_inline_functions
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846 >
2021-04-02 17:16:48 +00:00
Michael Tang
2f3dc0264c
microsoft/spirv_to_dxil: Add lowering pass to handle gl_PerVertex
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9846 >
2021-04-02 17:16:48 +00:00
Dave Airlie
01dfd65a2d
nir: port fp16 casting code from dxil
...
This moves the dxil pass to common code and makes dxil
use the new code.
Acked-by: Adam Jackson <ajax@redhat.com >
Reviewed-by: Roland Scheidegger <sroland@vmware.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9643 >
2021-03-22 12:16:59 +10:00
Michael Tang
8016a098fc
microsoft/spirv_to_dxil: Fix spirv2dxil I/O to use binary mode
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9513 >
2021-03-11 23:43:47 +00:00
Jesse Natalie
fe90bcf11a
microsoft/compiler: Don't separate phis while inserting upcasts
...
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4414
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9464 >
2021-03-09 01:41:32 +00:00
Jason Ekstrand
e20e85f01e
nir: Make nir_ssa_def_rewrite_uses_after take an SSA value
...
This replaces the new_src parameter of nir_ssa_def_rewrite_uses_after()
with an SSA def, and rewrites all the users as needed.
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com >
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9383 >
2021-03-08 16:59:55 +00:00
Jason Ekstrand
117668b811
nir: Make nir_ssa_def_rewrite_uses take an SSA value
...
This commit replaces the new_src parameter of nir_ssa_def_rewrite_uses()
with an SSA def, removes nir_ssa_def_rewrite_uses_ssa(), and rewrites
all the users as needed.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com >
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9383 >
2021-03-08 16:59:55 +00:00
Christian Gmeiner
3fbde2fd93
nir: add has_txs flag
...
Some nir lowerings might need to know if txs is supported by
the backend.
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8898 >
2021-02-23 14:04:30 +00:00
Jesse Natalie
8a3dbf1ca6
microsoft/clc: Add a test with an unused kernel arg
...
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9160 >
2021-02-19 16:36:46 +00:00
Jesse Natalie
11061c4e28
microsoft/clc: Re-order dead variable removal after uniform vars_to_explicit_types
...
Since vars_to_explicit_types is now where driver_location/offset is filled out,
we need to make sure that we still have all app-provided kernel arg variables
at that point in time so they all get assigned unique offsets. That means
that we can't have removed dead uniforms yet, which also means we can't have
filled out metadata for inline samplers (since usage of them generates tons
of duplicate uniforms).
Reviewed-by: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9160 >
2021-02-19 16:36:46 +00:00
Jesse Natalie
5b0a10823b
microsoft/clc: Use driver_location for metadata instead of re-computing offsets
...
Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138 >
2021-02-18 21:33:54 +00:00
Jesse Natalie
3ee8f2ccba
microsoft/clc: Move inline samplers to the end of the variable list
...
Since inline samplers are uniforms, just like kernel args, and
nir_lower_vars_to_explicit_types will assign driver_location based
on order in the variable list, move the inline samplers to the end
of the list to prevent them from creating gaps in the kernel arg
offsets.
Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138 >
2021-02-18 21:33:54 +00:00
Jesse Natalie
d773257012
microsoft/clc: Fix wrap modes for inline samplers for integer textures
...
Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138 >
2021-02-18 21:33:54 +00:00
Jesse Natalie
9da8179a1e
microsoft/clc: Let lower_vars_to_explicit_types fill kernel input driver_location
...
Importantly, also run that before mucking with the variable list via image lowering,
which removes and inserts variables, making the driver_location no longer line up
with metadata.
Fixes: ff05da7f ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9138 >
2021-02-18 21:33:54 +00:00
Jesse Natalie
6f729a7c9d
microsoft/clc: Only apply float scaling to 32bit fdiv
...
Reviewed By: Bill Kristiansen <billkris@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9091 >
2021-02-17 19:01:02 +00:00
Jesse Natalie
37142847fa
microsoft/clc: Add test with inline function
...
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9085 >
2021-02-16 22:11:21 +00:00
Jesse Natalie
c1b8629b2c
microsoft/clc: Add -fgnu89-inline to clang args
...
Without this, inline functions don't have their body emitted in the
resulting LLVM IR, meaning the kernel will fail to link.
Reviewed-by: Karol Herbst <kherbst@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9085 >
2021-02-16 22:11:21 +00:00
Michael Tang
f026345b34
microsoft/compiler: Make resource_state_manager only build with_gallium_d3d12
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8785 >
2021-01-29 12:54:02 -08:00
James Park
bef0af3f21
microsoft: Fix comma in variadic macro for MSVC
...
New preprocessor seems to be enabled by default when C17 mode is active.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8772 >
2021-01-29 05:43:31 +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
Connor Abbott
c81389ace0
dxil: Use sized types for nir_tex_instr::dest_type
...
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7989 >
2021-01-25 11:21:42 +01:00
Daniel Schürmann
bd8e84eb8d
nir: replace .lower_sub with .has_fsub and .has_isub
...
This allows a more fine-grained control about whether
a backend supports one of these instructions.
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6597 >
2021-01-11 19:13:51 +00:00
Daniel Schürmann
b3ce55b445
nir,vc4: Lower fneg to fmul(x, -1.0)
...
This patch also replaces lower_negate with lower_ineg / lower_fneg.
The fneg semantics have been clarified as of Version 1.5, Revision 1
of the SPIR-V specification, which means that the previous lowering
to fsub is not a viable solution anymore, and is replaced with
lowering to fmul(x, -1.0).
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6597 >
2021-01-11 19:13:51 +00:00
Erik Faye-Lund
6f3a34e75c
microsoft/compiler: do not lower away 64-bit ffma
...
In DXIL, the FMA instruction only supports 64-bit operations. However,
back when we implemented support for this, there were only a single
switch for lowering all ffma instructions, so we couldn't easily use it.
But now that there's separate flags to lower ffma on 16, 32 and 64 bit,
we can lower 16 and 32 bit ffmas, and leave 64 bit ffmas alone.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8349 >
2021-01-08 15:09:23 +00:00
Erik Faye-Lund
c2fa965cc3
microsoft/compiler: correct dxil fma opcode
...
When I originally added the FFMA opcode here, I added the FMAD opcode
instead of the FMA opcode. The reason for this is that it works on
32-bit values as well, so that seemed like a better fit.
But that's not correct, as the FMA opcode isn't a fused operation, so
let's correct the opcode.
This isn't currently in use, because we currently lower away all ffma
opcodes on the NIR level, but that's about to change.
While we're at it, let's also update the opcode name to match the DXIL
documentation.
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8349 >
2021-01-08 15:09:23 +00:00
Christian Gmeiner
c6d65bb01e
microsoft/compiler: use intrinsic builders
...
Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com >
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8295 >
2021-01-06 14:34:41 +00:00
Jesse Natalie
dcd8adcc28
microsoft/clc: Fix const violations from ralloc_steal
...
Fixes: ff05da7f8d ("microsoft: Add CLC frontend and kernel/compute support to DXIL converter")
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7697 >
2021-01-04 22:05:02 +00:00
Adam Jackson
8ddddfb516
treewide: Disambiguate various variables named "debug_options"
...
Name them after what they control so 'vi -t' can take you somewhere
useful.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8165 >
2021-01-04 20:51:28 +00:00
Jesse Natalie
24dcdc3fa9
microsoft/compiler: Fix clang fallthrough warnings
...
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
72d7e173e3
microsoft/resource_state_manager: Remove unused private variable
...
Clang detects that this variable is unused. We can re-add it if
we end up needing it but for now let's just remove it.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
c11f2f5de8
microsoft/compiler: Fix tautological comparison
...
Clang detects that a signed character can't be >= 128. Instead,
we should just explicitly check for the 8th bit via bitmask compare.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
f0eda8fbf8
microsoft/compile: Fix incorrect enum type in function signature
...
Clang warns for passing one enum type where another was expected.
This was just a copy/paste bug, and had no real impact since the
enum was just used as an integer in this function.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
cda9d44bae
microsoft/resoure_state_manager: Silence GCC invalid offsetof warning
...
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
bd97f401dc
microsoft/compiler: Fix incorrect size passed to strncpy
...
GCC correctly detects/warns that this was the wrong size
Fixes: b9c61379 ("microsoft/compiler: translate nir to dxil")
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
bb6a1f5b1e
microsoft/compiler: Fix warnings produced by GCC in release mode
...
Inline some variables/functions that are only used for asserts.
Reviewed-by: Adam Jackson <ajax@redhat.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8248 >
2021-01-03 23:07:21 +00:00
Jesse Natalie
4dbcf24f68
microsoft/clc: Hook up printf
...
Rewrites the original lowering pass to use the one shared with Clover,
instead only handling the new load_printf_buffer_address intrinsic.
Exports the new metadata to the runtime containing strings and arg sizes.
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8254 >
2020-12-28 15:55:08 -08:00
Vinson Lee
512ca3464d
d3d12: Initialize TransitionableResourceState m_SupportsSimultaneousAccess.
...
Fix defect reported by Coverity Scan.
Uninitialized scalar field (UNINIT_CTOR)
uninit_member: Non-static class member m_SupportsSimultaneousAccess is
not initialized in this constructor nor in any functions that it calls.
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8192 >
2020-12-24 22:02:00 +00:00
Michael Tang
0b3379c7be
microsoft/compiler: Add spirv2dxil executable
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8043 >
2020-12-22 13:28:22 -08:00
Michael Tang
67e48bee1e
microsoft/compiler: Add dedicated spirv_to_dxil libraries
...
Reviewed-by: Jesse Natalie <jenatali@microsoft.com >
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8043 >
2020-12-22 13:28:21 -08:00