Commit Graph

351 Commits

Author SHA1 Message Date
Jon Leech
f2a65545b8 Finish adding SPDX tags and setup a reuse checked in Github Actions CI 2021-06-29 11:03:52 +02:00
Hans-Kristian Arntzen
d6b29ab017 HLSL: Rewrite how block IO is emitted.
Emit block members directly in the IO structs and sort them.
Ensures we can get some kind of stable order between stages.

To complete the story, we'll need to be able to inject unused inputs /
builtins, or eliminate unused outputs (probably easiest solution).
2021-06-28 15:04:49 +02:00
Hans-Kristian Arntzen
8216e87f02 Handle SPIR-V 1.4 selection constructs.
Fix bug in to_trivial_mix_op, where we made a pre-1.4 assumption that
component count of selector is equal to value component count.
2021-06-28 12:23:44 +02:00
Hans-Kristian Arntzen
b8115ffbe0 HLSL: Implement invariant as precise.
Only option we have.
2021-05-07 13:15:55 +02:00
Hans-Kristian Arntzen
e47a30e807 Honor NoContraction qualifier.
We'll need to force a temporary and mark it as precise.
MSL is a little weird here, but we can piggyback on top of the invariant
float math option here to force fma() operations everywhere.
2021-05-07 12:59:47 +02:00
Hans-Kristian Arntzen
0e963c62b6 HLSL: Support Shuffle wave ops.
WaveReadLaneAt is no longer restricted to dynamically uniform index,
so can implement the other shuffle ops.
2021-04-23 13:03:35 +02:00
Hans-Kristian Arntzen
532f65583e Rewrite how non-uniform qualifiers are handled.
Remove all shenanigans with propagation, and only consume nonuniform
qualifiers exactly where needed (last minute).
2021-04-22 16:03:08 +02:00
Hans-Kristian Arntzen
96ba044f01 HLSL: Fix automatic location assignment in block IO. 2021-04-20 13:04:26 +02:00
Hans-Kristian Arntzen
d6c2c1b39a HLSL: Support logical subgroup ops. 2021-03-08 12:52:03 +01:00
Hans-Kristian Arntzen
21a931613e HLSL: Add vector to illegal names list. 2021-02-15 11:38:14 +01:00
Hans-Kristian Arntzen
ea02a0c03a Check entry point variables in is_hidden_variables.
Need to be careful not to emit globals we're not supposed to.
2021-01-22 13:53:22 +01:00
Hans-Kristian Arntzen
4704482bbc meta: Update copyright headers to 2021. 2021-01-14 16:07:49 +01:00
Hans-Kristian Arntzen
a1c784f002 More robust handling of initialized output builtin variables. 2021-01-04 19:12:43 +01:00
Hans-Kristian Arntzen
9a304fe931 Handle output IO block initializers more robustly. 2021-01-04 19:04:10 +01:00
Hans-Kristian Arntzen
dc940846d7 GLSL/HLSL: Disallow VariablePointers capability outright.
Cannot be supported, error out early.
2020-12-07 12:16:02 +01:00
Hans-Kristian Arntzen
cf1e9e0643 Add MIT dual license for the SPIRV-Cross API. 2020-12-01 16:47:08 +01:00
Hans-Kristian Arntzen
6a614cc7f7 Normalize all internal workaround methods to use spv prefix.
We have been interchanging spv and SPIRV_Cross_ for a while, which
causes weirdness since we don't explicitly ban SPIRV_Cross identifiers,
as these identifiers are generally used for interface variable
workarounds.
2020-11-23 15:42:27 +01:00
Hans-Kristian Arntzen
6fc2a0581a Run format_all.sh. 2020-11-08 13:59:52 +01:00
rdb
854f566869 HLSL: Support roundEven() in HLSL SM 4.0 and above 2020-11-03 21:28:07 +01:00
rdb
18893ba3b9 HLSL: Support depth comparison texture sampling in SM 2/3. 2020-11-03 18:10:43 +01:00
Hans-Kristian Arntzen
b3344174f7 HLSL: Add option to flatten matrix vertex input semantics.
Helps translation layers where we expect inputs to be multiple float
vectors rather than an indexed matrix.
2020-11-03 11:18:32 +01:00
Hans-Kristian Arntzen
5ea576ece2 Allow flip_vert_y in all relevant stages. 2020-09-28 14:10:08 +02:00
Hans-Kristian Arntzen
66afe8c499 Implement a simple evaluator of specialization constants.
In some cases, we need to get a literal value from a spec constant op.
Mostly relevant when emitting buffers, so implement a 32-bit integer
scalar subset of the evaluator. Can be extended as needed to support
evaluating any specialization constant operation.
2020-09-14 11:45:59 +02:00
Hans-Kristian Arntzen
18d03b3ea6 Handle OpUndef %void.
Apparently this is legal and spirv-opt is starting to emit this kind of
code now.
2020-09-04 09:29:44 +02:00
Hans-Kristian Arntzen
a07441568e Overhaul how we deal with reserved identifiers.
- Do not silently drop reserved identifiers in the parser. This makes it
  possible to reflect identifiers which are reserved by the
  cross-compiler module.
- Instead of dropping the name, emit _RESERVED_IDENTIFIER_FIXUP in the
  source to make it clear that a name has been rewritten.
- Document what is reserved and not.
2020-08-21 16:33:27 +02:00
Hans-Kristian Arntzen
fdbc80d131 HLSL: Fix FragCoord.w.
Need to invert it, SM 4.0+ uses W, not 1/W (like Vulkan/GL).
2020-08-20 16:22:48 +02:00
Tomek Ponitka
ba58f78395 Adding BuiltInSampleMask in HLSL 2020-07-27 14:14:26 +02:00
Hans-Kristian Arntzen
2d43103a55 GLSL: Support multi-level struct flattening for I/O. 2020-07-03 14:38:51 +02:00
Hans-Kristian Arntzen
d573a95a9c Run format_all.sh. 2020-07-01 11:42:58 +02:00
Hans-Kristian Arntzen
d13dc0ce47 HLSL: Fix texProj in legacy HLSL. 2020-06-16 12:54:22 +02:00
Hans-Kristian Arntzen
553a7f959b
Merge pull request #1385 from KhronosGroup/fix-1237
GLSL: Implement sparse feedback.
2020-06-08 11:12:00 +02:00
Hans-Kristian Arntzen
275974e062 GLSL: Implement sparse feedback. 2020-06-04 15:50:28 +02:00
Hans-Kristian Arntzen
2d5200650a HLSL: Add native support for 16-bit types.
Adds support for templated load/store in SM 6.2 to deal with small
types.
2020-06-04 12:33:56 +02:00
Bryan Bernhart
32bead81c8 Prefer set/binding API 2020-05-28 10:21:41 -07:00
Bryan Bernhart
17bccc9f7e HLSL: Add option to treat certain SSBO bindings as UAV, even with readonly. 2020-05-27 13:08:15 -07:00
Hans-Kristian Arntzen
f3a362b1aa HLSL: Implement image queries for UAV images.
This was completely unimplemented for some reason.
2020-05-19 13:53:04 +02:00
Hans-Kristian Arntzen
9b7140e2ba Implement OpAtomicLoad/OpAtomicStore.
Need some emulation on GLSL/HLSL, fix bug with atomic store on MSL.
2020-04-27 12:11:46 +02:00
Hans-Kristian Arntzen
5e5d1c27ce GLSL: Support f16x2 <-> f32 bitcast.
There is no native formulation, so introduce a concept of a "complex"
bitcast to handle odd-ball cases which have no native unary operation.
2020-04-21 23:27:33 +02:00
Hans-Kristian Arntzen
bdb343ea06 Be a bit more careful what nonuniform state is propagated. 2020-04-21 14:48:44 +02:00
Hans-Kristian Arntzen
7b9cba7424 HLSL: Add parens in unpackUint2x32 for clarity. 2020-04-21 11:49:26 +02:00
Hans-Kristian Arntzen
e4e4791c4e HLSL: Only allow 64-bit integers in SM 6.0. 2020-04-21 11:49:26 +02:00
Asuka
55dfbead2f GLSL/HLSL: Support packUint2x32 and unpackUint2x32 2020-04-21 11:34:12 +02:00
Hans-Kristian Arntzen
28bf9057df HLSL: Add support for treating NonWritable UAV texture as SRV instead. 2020-04-03 11:50:50 +02:00
Hans-Kristian Arntzen
b8905bbd95 Add support for forcefully zero-initialized variables.
Useful to better support certain platforms which require all variables
to be initialized to something.
2020-03-26 13:38:27 +01:00
Hans-Kristian Arntzen
04e877df12 GLSL: Implement GL_EXT_shader_framebuffer_fetch. 2020-03-19 14:53:39 +01:00
Hans-Kristian Arntzen
05004a57ea GLSL/HLSL: Fix nonuniform qualifier for SSBO atomics. 2020-03-19 12:05:27 +01:00
Hans-Kristian Arntzen
a3d3c80dd7 GLSL/HLSL: Implement nonuniform qualifier for image atomics. 2020-03-19 11:35:29 +01:00
Hans-Kristian Arntzen
185551bfaf HLSL: Do not emit globallycoherent for SRV ByteAddressBuffer. 2020-03-05 10:37:36 +01:00
Hans-Kristian Arntzen
c27e1efbf1 HLSL: Add option to always treat SSBO as UAV, even with readonly.
This can make codegen more predictable since ByteAddressBuffer is SRV
and not UAV.
2020-03-04 16:42:31 +01:00
Hans-Kristian Arntzen
e81c1b1d98 HLSL: Declare undef variables as static.
Undef variables would somehow become cbuffer variables without any
warning ...
2020-02-08 13:39:50 +01:00