Commit Graph

3236 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
779138f39f
Merge pull request #1914 from RandomShaper/hlsl_view_index
HLSL: Implement ViewIndex.
2022-04-19 11:27:23 +02:00
Pedro J. Estébanez
2ea1c9b642 HLSL: Implement ViewIndex. 2022-04-15 10:42:52 +02:00
Hans-Kristian Arntzen
6a67891418
Merge pull request #1909 from skkkksdkfak/primitive_id
Translate gl_PrimitiveID to SV_PrimitiveID.
2022-04-13 11:25:30 +02:00
skksdkfak
54c00b69a4 Translate gl_PrimitiveID to SV_PrimitiveID. 2022-04-07 12:56:53 +03:00
Hans-Kristian Arntzen
0d4ce028bf
Merge pull request #1903 from KhronosGroup/fix-1900
MSL: Fix goofy bugs in ray query.
2022-03-24 19:27:22 +01:00
Hans-Kristian Arntzen
17c52990d5 MSL: Fix goofy bugs in ray query. 2022-03-24 18:14:46 +01:00
Hans-Kristian Arntzen
a3996eccf3
Merge pull request #1896 from Roy-AMD/fix-condition-issue
Use types have same widths in loop condition.
2022-03-24 18:00:56 +01:00
Roy.li
749be80389 Use types have same widths in loop condition.
In case comparisons between types of different widths in a loop condition
caused the loop to behave unexpectedly.
2022-03-24 14:26:03 +08:00
Hans-Kristian Arntzen
44691aa975
Merge pull request #1899 from billhollings/forward-volatile-vars-except-builtins
Allow volatile vars that are not builtins to be forwarded.
2022-03-23 22:07:10 +01:00
Bill Hollings
85f98eb0c5 Allow volatile vars that are not builtins to be forwarded.
This fixes a regression introduced by 93b0dc7, where all volatile variables
were not allowed to be forwarded. This doesn't work well for volatile memory
object variables like images or buffer blocks, because it forces local variables
to be defined, which is unnecessary, and sometimes results in wrong types.

This patch restricts volatile builtin variables (eg. HelperInvocation) from
being forwarded, but allows other volatile variables to be forwarded, as before.
2022-03-23 14:48:22 -04:00
Hans-Kristian Arntzen
d000b9e71c
Merge pull request #1898 from KhronosGroup/pr-1859
Merge PR #1859 with minor fixes
2022-03-22 13:50:43 +01:00
Hans-Kristian Arntzen
191c57b6cc
Merge pull request #1897 from KhronosGroup/fix-1763
MSL: Handle awkward mix and match of Offset / ArrayStride in constants.
2022-03-22 13:50:33 +01:00
Hans-Kristian Arntzen
a7eefbc114 HLSL: Disable FXC testing for rayquery shaders.
Manually tested that it compiles on DXC.
2022-03-22 12:34:43 +01:00
Hans-Kristian Arntzen
cd209ff46d HLSL: Update test from review. 2022-03-22 12:31:52 +01:00
Hans-Kristian Arntzen
c95338e03e Merge branch 'ray_query' of https://github.com/k-payl/SPIRV-Cross into pr-1859 2022-03-22 12:29:49 +01:00
Hans-Kristian Arntzen
7b9eaf0b5e MSL: Handle awkward mix and match of Offset / ArrayStride in constants.
In normal buffer blocks, every member must be declared, but for
constants, you can technically mix and match, causing much pain and
suffering ...
2022-03-22 12:25:09 +01:00
Konstantin Pail
251361bd6f VK_KHR_ray_query implementation 2022-03-15 21:54:29 +03:00
Hans-Kristian Arntzen
565db34cba
Merge pull request #1892 from KhronosGroup/meta-lookup-cleanup
Avoid redundant meta lookups in ParsedIR when setting member decorations
2022-03-12 12:55:03 +01:00
Hans-Kristian Arntzen
39bad2c1f9 Avoid redundant meta lookups in ParsedIR when setting member decorations. 2022-03-12 12:14:01 +01:00
Hans-Kristian Arntzen
d5c3bd8b5e
Merge pull request #1890 from KhronosGroup/fix-1889
Fixup names of anonymous inner structs.
2022-03-10 16:48:01 +01:00
Hans-Kristian Arntzen
4ab5bbb4e5 Fixup names of anonymous inner structs.
Just like we try to fixup struct names for block types, inner structs
can be "anonymous" structs. HLSL codegen from DXC tends to emit this,
and emitting dummy struct names tends to break GL linkage on some
drivers.
2022-03-10 15:45:38 +01:00
Hans-Kristian Arntzen
0b51794f01
Merge pull request #1888 from KhronosGroup/msl-ib-variable-name-alias-fix
MSL: Fix variable name alias in IB structs.
2022-03-07 14:54:27 +01:00
Hans-Kristian Arntzen
1ec9d018fd MSL: Handle aliased variable names for resources placed in IB struct.
Just remember to register the names.
2022-03-07 12:00:40 +01:00
Hans-Kristian Arntzen
213c5f42ea MSL: Fix minor nits. 2022-03-07 11:45:38 +01:00
Hans-Kristian Arntzen
4ec1fb0aa9
Merge pull request #1887 from billhollings/msl-use-var-name-for-flattened-interface-struct-members
MSL: Use var name instead of var-type name for flattened interface members.
2022-03-07 11:45:20 +01:00
Bill Hollings
0c0fd98322 MSL: Use var name instead of var-type name for flattened interface members.
This allows two variables of the same struct type to be flattened
into the same interface struct without a member name conflict.

Add shaders-msl/frag/in_block_with_multiple_structs_of_same_type.frag
unit test shader to demonstrate this.
2022-03-04 11:38:53 -05:00
Hans-Kristian Arntzen
3915c37bb1 Merge branch 'fixup_gl_helper_invocation' of https://github.com/RandomShaper/SPIRV-Cross 2022-03-04 13:14:17 +01:00
Pedro J. Estébanez
c4f9e4fde9 HLSL: Fix Helper Invocation wrongly allowed in compute. 2022-03-04 13:10:41 +01:00
Hans-Kristian Arntzen
a1803778c2
Merge pull request #1885 from KhronosGroup/helper-invocation-rework
Helper invocation rework
2022-03-04 12:36:21 +01:00
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