Commit Graph

3457 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
b192b8887a MSL: Consider that gl_IsHelperInvocation can be Volatile.
Just emit simd_is_helper_thread() directly.
2022-03-04 11:46:35 +01:00
Hans-Kristian Arntzen
15d29f00e2 Add test for SPIR-V 1.6 Volatile HelperInvocation. 2022-03-04 11:19:33 +01:00
Hans-Kristian Arntzen
93b0dc7718 Consider Volatile in should_forward().
Never forward these variables.
2022-03-04 11:08:55 +01:00
Hans-Kristian Arntzen
476b6541fa Remove forwardable bit in SPIRVariable.
Was never really used for anything. It's always true.
2022-03-04 11:05:21 +01:00
Hans-Kristian Arntzen
5d9fc2d903 HLSL: Add test for HelperInvocation. 2022-03-04 10:58:40 +01:00
Hans-Kristian Arntzen
005c14ad6a HLSL: Implement HelperInvocationEXT.
It is volatile by nature and must not be forwarded.
2022-03-04 10:54:31 +01:00
Hans-Kristian Arntzen
75224c6c7c Merge branch 'gl_helper_invocation' of https://github.com/RandomShaper/SPIRV-Cross 2022-03-04 10:49:56 +01:00
Pedro J. Estébanez
278a4c80ed HLSL: Add support for gl_HelperInvocation 2022-03-04 09:25:09 +01:00
Hans-Kristian Arntzen
6c7a40822f
Merge pull request #1881 from KhronosGroup/relax-nan-checks
Add relax_nan_checks options.
2022-03-03 15:31:57 +01:00
Hans-Kristian Arntzen
31be74a853 Add relax_nan_checks options.
Makes codegen from typical D3D emulation SPIR-V more readable.
Also makes cross compilation with NotEqual more sensible.
It's very rare to actually need the strict NaN-checks in practice.

Also, glslang now emits UnordNotEqual by default it seems, so give up
trying to assume OrdNotEqual. Harmonize for UnordNotEqual as the sane
default.
2022-03-03 14:50:56 +01:00
Hans-Kristian Arntzen
b91ecf6077
Merge pull request #1880 from KhronosGroup/fix-1879
Handle OpTerminateInvocation.
2022-03-03 13:49:14 +01:00
Hans-Kristian Arntzen
2ce1e5c140
Merge pull request #1878 from mysterymath/move
Qualify std::move.
2022-03-03 11:06:13 +01:00
Hans-Kristian Arntzen
dc62cc792b Handle OpTerminateInvocation. 2022-03-03 10:36:07 +01:00
Hans-Kristian Arntzen
2a7f436135 Merge branch 'msl-add-nested-structs-to-io-blocks-squash' 2022-03-03 10:29:15 +01:00
Hans-Kristian Arntzen
7b594c125e Fix formatting nits from review. 2022-03-03 10:26:09 +01:00
Bill Hollings
bb4ced0280 MSL: Document clarification of location incrementing. 2022-03-03 10:19:04 +01:00
Bill Hollings
02d588b7e4 MSL: Fix var names in test shaders to avoid reserved identifiers. 2022-03-03 10:19:04 +01:00
Bill Hollings
3bb3b22b34 MSL: Non-functional fixes from PR code review. 2022-03-03 10:19:03 +01:00
Bill Hollings
3d4daab29d MSL: Support input/output blocks containing nested struct arrays
Fixes numerous CTS tests of types
dEQP-VK.pipeline.interface_matching.vector_length.member_of_*,
passing complex nested structs between stages as stage I/O.

- Make add_composite_member_variable_to_interface_block() recursive to allow
  struct members to contain nested structs, building up member names and access
  chains recursively, and only add the resulting flattened leaf members to the
  synthetic input and output interface blocks.
- Recursively generate individual location numbers for the flattened members
  of the input/output block.
- Replace to_qualified_member_name() with append_member_name().
- Update add_variable_to_interface_block() to support arrays as struct members,
  adding a member to input and output interface blocks for each element of the array.
- Pass name qualifiers to add_plain_member_variable_to_interface_block() to allow
  struct members to be arrays of structs, building up member names and access chains,
  and adding multiple distinct flattened leaf members to the synthetic input and
  output interface blocks.
- Generate individual location numbers for the individual array members
  of the input/output block.
- SPIRVCrossDecorationInterfaceMemberIndex references the index of a member
  of a variable that is a struct type. The value is relative to the variable,
  and for structs nested within that top-level struct, the index value needs
  to take into consideration the members within those nested structs.
- Pass var_mbr_idx to add_plain_member_variable_to_interface_block() and
  add_composite_member_variable_to_interface_block(), start at zero for each
  variable, and increment for each member or nested member within that variable.
- Add unit test shaders-msl/vert/out-block-with-nested-struct-array.vert
- Add unit test shaders-msl/vert/out-block-with-struct-array.vert
- Add unit test shaders-msl/tese/in-block-with-nested-struct.tese
2022-03-03 10:18:40 +01:00
Daniel Thornburgh
44c3333a1c Qualify std::move.
Clang added -Wunqualified-std-cast-call in
https://reviews.llvm.org/D119670, which warns on unqualified std::move
and std::forward calls. This change qualifies these calls to allow the
project to build on HEAD Clang -Werror.
2022-03-02 23:17:58 +00:00
Hans-Kristian Arntzen
d16183d1d2
Merge pull request #1873 from KhronosGroup/fix-1861
HLSL: Do not emit VPOS fixup unless position is active.
2022-02-28 12:58:07 +01:00
Hans-Kristian Arntzen
02440e85cf
Merge pull request #1872 from KhronosGroup/fix-1867
MSL: Refactor and fix use of quadgroup vs simdgroup.
2022-02-28 12:50:43 +01:00
Hans-Kristian Arntzen
7af0a5f820 HLSL: Do not emit VPOS fixup unless position is active. 2022-02-28 12:09:57 +01:00
Hans-Kristian Arntzen
5555f2784b MSL: Refactor and fix use of quadgroup vs simdgroup. 2022-02-28 11:58:33 +01:00
Hans-Kristian Arntzen
a569680406
Merge pull request #1870 from abrachet/master
Qualify move as std::move
2022-02-28 11:57:58 +01:00
Alex Brachet
0eda71c409 Qualify move as std::move
Seeing downstream errors:
"spirv_common.hpp:692:19: error: unqualified call to std::move"
2022-02-25 18:15:35 -05:00
Hans-Kristian Arntzen
c08ee860c8
Merge pull request #1869 from xndcn/msl
MSL: append entry point args to local variable names to avoid conflicts
2022-02-25 15:43:10 +01:00
xndcn
1b5c406a3d MSL: append entry point args to local variable names to avoid conflicts 2022-02-24 22:52:21 +08:00
Hans-Kristian Arntzen
188dc8b13c
Merge pull request #1862 from flokart-world/feature/flatten-ubo-for-hlsl
HLSL: Make --flatten-ubo work correctly
2022-02-16 16:39:45 +01:00
Hans-Kristian Arntzen
64e058aa9b
Merge pull request #1863 from KhronosGroup/various-fixes
Various fixes
2022-02-16 14:09:40 +01:00
Shintaro Sakahara
ed4ded040e HLSL: Make --flatten-ubo work correctly 2022-02-16 21:53:24 +09:00
Hans-Kristian Arntzen
a56b22bf4e Add more scenarios where we can guarantee forward progress.
The patterns where we force temporary due to invalid/overused expression -> recompile
should be seen as making forward progress, and there are very rare scenarios where
these recompiles can cascade into many loops.

Refactor this style of logic into a new function which is equivalent to handle_invalid_expression().
2022-02-16 12:12:58 +01:00
Hans-Kristian Arntzen
c716a9a5dd Add debug option to modify maximum number of compile iterations.
Should be seen as a hack, but it's pragmatic in some scenarios.
2022-02-16 12:12:27 +01:00
Hans-Kristian Arntzen
29cc18988c Fix regression from adding 64-bit switch support.
Missed some cases where we did not handle the loaded type width
properly.
2022-02-16 11:49:24 +01:00
Hans-Kristian Arntzen
339e61a0e0 Do not emit hoisted access chain temporaries unless backend supports it.
This can happen for access chains into buffer objects which were marked
as potentially hoisted, but it's benign in almost all cases.
2022-02-16 11:36:38 +01:00
Hans-Kristian Arntzen
5d9a95370f GLSL: Ensure correct signed integer type for more texture functions. 2022-02-16 11:14:07 +01:00
Hans-Kristian Arntzen
131278458e
Merge pull request #1860 from KhronosGroup/docs-update
Update documentation for descriptor set support in MSL/HLSL.
2022-02-04 14:25:19 +01:00
Hans-Kristian Arntzen
a8016a6470 Update documentation for descriptor set support in MSL/HLSL.
Ancient outdated README.
2022-02-04 12:51:32 +01:00
Rodolphe
1a36968e5d
[Spirv_msl] Fix normalize on half3/half2 (#1856)
When emitting a normalize OP, conditionally stop using the fast namespace
2022-02-01 23:17:22 +01:00
Hans-Kristian Arntzen
53d94a982e
Merge pull request #1852 from KhronosGroup/fix-1850
MSL: Rethink how opaque descriptors are passed to leaf functions.
2022-01-18 15:25:32 +01:00
Hans-Kristian Arntzen
5a29181b35
Merge pull request #1851 from KhronosGroup/fix-1835
Handle aliased names in spec constants.
2022-01-18 15:25:17 +01:00
Hans-Kristian Arntzen
5b952d2cbf MSL: Rethink how opaque descriptors are passed to leaf functions.
We were passing arrays by value which the compiler fails to optimize,
causing abyssal performance. To fix this, we need to consider that
descriptors can be in constant or const device address spaces.

Also, lone descriptors are passed by value, so we explicitly remove address
space qualifiers.

One failure case is when shader passes a texture/sampler array as an
argument. It's all UniformConstant in SPIR-V, but in MSL it might be
thread, const device or constant, so that won't work ...
Global variable use works fine though, and that should cover 99.9999999%
of use cases.
2022-01-18 14:40:52 +01:00
Hans-Kristian Arntzen
ac46140ba3 Test aliased names in declared LUTs. 2022-01-18 12:39:16 +01:00
Hans-Kristian Arntzen
48b5a9069f Handle aliased names in spec constants.
Need to register resource name.
2022-01-18 12:31:28 +01:00
Hans-Kristian Arntzen
08d5f5ed18
Merge pull request #1849 from KhronosGroup/fix-1844
MSL: Handle constant construct of block-like array types.
2022-01-17 20:40:37 +01:00
Hans-Kristian Arntzen
9b25581d49 MSL: Handle constant construct of block-like array types.
Need this to be context sensitive, since array of block-like struct is
template, but struct of block-like array is C-style.

Also, test a mix and match, so we have constant array of block-like
struct with array inside. :v
2022-01-17 18:28:25 +01:00
Hans-Kristian Arntzen
79b13813c6
Merge pull request #1848 from KhronosGroup/fix-1843
MSL: Handle signed atomic min/max.
2022-01-17 16:55:35 +01:00
Hans-Kristian Arntzen
5a5be7f9b9 MSL: Handle signed atomic min/max.
C++ deduces this based on the pointer type, so cast to atomic_uint/int
if we have to.
2022-01-17 15:40:58 +01:00
Hans-Kristian Arntzen
7dd974b9db
Merge pull request #1847 from KhronosGroup/fix-1775
Rework how loop iteration counts are validated.
2022-01-17 14:55:56 +01:00
Hans-Kristian Arntzen
e940577fba
Merge pull request #1846 from KhronosGroup/fix-1760
Do not forward expressions which carry a huge amount of dependencies.
2022-01-17 14:55:46 +01:00