Commit Graph

3163 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
4561ecddbd Handle Modf/Frexp in more cases.
Consider it a write to a variable, similar to OpStore.
2021-11-07 11:36:44 +01:00
Hans-Kristian Arntzen
d295c2a046
Merge pull request #1800 from EddeDev/master
Fixed potential compilation error in spirv_cross_containers.hpp
2021-11-07 10:36:05 +01:00
Hans-Kristian Arntzen
849978653a
Merge pull request #1798 from billhollings/tess-output-clip
MSL: Correctly emit user(clip/cullN) for clip/cull builtins in tess output struct.
2021-11-07 10:35:24 +01:00
Hans-Kristian Arntzen
05e8e5a953 Correctly reflect declared buffer size for out of order members.
Need to deduce size based on member with highest offset, not highest
index.
2021-11-07 10:08:17 +01:00
Edvin Pettersson
4dcf64a99b
Fixed potential compilation error in spirv_cross_containers.hpp 2021-11-05 01:39:35 +01:00
Sebastián Aedo
250a02967d Removed unnecessary tracking of types.
We don't need to keep track of the type itself, only its width since the
type check of the OpSwitch can be done at runtime. This also avoids
creating a dangling reference.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-03 16:12:14 -03:00
Bill Hollings
4ebd56bf9e MSL: Correctly emit user(clip/cullN) for clip/cull builtins in tess output struct.
Only emit user(locnN) for tess builtin input variables, and allow output builtin
to emit user(clip/cullN). Previously, output builtin would emit location if
input builtin also existed.
2021-11-03 00:03:26 -04:00
Sebastián Aedo
f099d714f3 Removing logic in the parser
Moving out the logic from the parser as requested because it's sensitive
to try to keep the parsing the most simple process as said.

For that, the load_types is now tracked in the ParsedIR, which can be
accessed in the Compiler struct. The switch cases are fixed in the CFG
stage since that's the point where the nullptr is deref.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-11-02 17:17:13 -03:00
Hans-Kristian Arntzen
04293e03fd
Merge pull request #1797 from KhronosGroup/clone-protocol
Always use https protocol when cloning external test deps.
2021-11-02 18:00:59 +01:00
Hans-Kristian Arntzen
0d03516382 Always use https protocol when cloning external test deps.
git:// is deprecated now and is starting to fail.
2021-11-02 17:36:22 +01:00
Hans-Kristian Arntzen
061397e32e
Merge pull request #1792 from billhollings/uniform-struct-packing-nested
MSL: Remove over-zealous check for struct packing compatibility.
2021-11-01 13:02:16 +01:00
Sebastián Aedo
3eb5532979 Add 64 bit support for OpSwitch
According to the spec, if the `condition` has a type wider than 32 bits,
the literals to be compared with will be of that size as well.

This caused some misalignments if the `condition` was bigger than 32,
causing a nullptr return without further explanation.

Currently neither GLSL nor MSL supports uint64 as the condition but the
SPIRV allows it anyway.

This also fixes #1768.

Signed-off-by: Sebastián Aedo <saedo@codeweavers.com>
2021-10-29 11:02:16 -03:00
Bill Hollings
be812c45e5 MSL: Remove over-zealous check for struct packing compatibility.
Previous test for SPIRVCrossDecorationPhysicalTypePacked on parent struct
when unpacking member struct was too restrictive, and not needed as long
as padding compensates.
2021-10-28 19:36:32 -04:00
Hans-Kristian Arntzen
66adba17a8
Merge pull request #1791 from billhollings/msl-out-of-order-struct-offsets
MSL: Fix type redirection when struct members are reordered to align with offsets.
2021-10-28 18:03:54 +02:00
Bill Hollings
76cb807c19 MSL: Fix type redirection when struct members are reordered to align with offsets.
Populate member_type_index_redirection as reverse lookup, not forward lookup.
Move use of member_type_index_redirection from CompilerMSL::to_member_reference()
to CompilerGLSL::access_chain_internal() to access all redirected type info,
not just name.
2021-10-28 10:16:34 -04:00
Hans-Kristian Arntzen
29632959d2
Merge pull request #1787 from KhronosGroup/fix-1786
MSL: Workaround compiler crashes when using threadgroup bool.
2021-10-25 12:30:01 +02:00
Hans-Kristian Arntzen
edf247fb1c MSL: Workaround compiler crashes when using threadgroup bool.
Promote to short instead and do simple casts on load/store instead.

Not 100% complete fix since structs can contain booleans, but this is
getting into pretty ridiculously complicated territory.
2021-10-25 10:55:11 +02:00
Erfan Ahmadi
43eecb2360 SPIRV-Cross contribution needed for INTEL_fragment_shader_ordering 2021-10-25 10:50:10 +02:00
Hans-Kristian Arntzen
94dea2507e
Merge pull request #1769 from audulus/spm2
Add support for SPM without modifying directory structure
2021-10-21 23:49:28 +02:00
Taylor Holliday
f5219f47c3 Add Package.swift.
This makes it really easy to add SPIRV-Cross to an Xcode project.
2021-10-21 14:06:04 -07:00
Hans-Kristian Arntzen
2a56c2bc04
Merge pull request #1783 from billhollings/more-unpacked-vectors
MSL: Support more usecases for unpacked vectors.
2021-10-21 23:00:14 +02:00
Hans-Kristian Arntzen
ab640bc3d3
Merge pull request #1782 from KhronosGroup/fix-1781
MSL: Fix some build regressions
2021-10-21 22:39:32 +02:00
Bill Hollings
974a0818b8 MSL: Support more usecases for unpacked vectors.
Additional usecases include array and vector indexing, variable declarations,
loop initializers, function return values, switch statement evaluations,
and various specialized MSL operations.

Ultimately, we might consider refactoring CompilerMSL::to_expression()
to always take into consideration possible unpacking behavior.

Refactor CompilerGLSL::to_enclosed_unpacked_expression()
for conciseness and consistency with similar functionality.
2021-10-21 16:11:33 -04:00
Hans-Kristian Arntzen
2b5e17eca5 MSL: Never used templated array for RayQuery objects.
Not supported and compiler derps out.
2021-10-21 22:02:01 +02:00
Hans-Kristian Arntzen
bc338710e1 MSL: Remove some redundant breaks. 2021-10-21 22:01:50 +02:00
Hans-Kristian Arntzen
5afb3d313f MSL: Fix some trivial bugs not caught by CI when adding ray query. 2021-10-21 21:53:41 +02:00
Hans-Kristian Arntzen
345a7d171c
Merge pull request #1773 from congyue1977/master
Support Metal 2.4 Intersection Query, Implement GL_EXT_ray_query.
2021-10-21 15:56:15 +02:00
丛越
2895a43274 Fix unsupported exceptions for ConvertUToAccelerationStructure & BindingTableRecordOffset. 2021-10-21 19:01:38 +08:00
丛越
d52ec1e196 Fix all requested changes, test_shaders.py supports compiling MSL 2.4 shaders, and the Intersection Query currently only supports MSL 2.4 on the iOS platform. 2021-10-21 17:46:45 +08:00
Hans-Kristian Arntzen
6d13c99273
Merge pull request #1780 from billhollings/out-of-bounds-swizzle-fix
Per spec, support undefined behavior for out-of-bounds swizzles.
2021-10-20 22:24:18 +02:00
Bill Hollings
595eb0c21d Per spec, support undefined behavior for out-of-bounds swizzles.
Per spec, instead of throwing exception for out-of-bounds swizzles,
engage undefined behavior by defaulting to the .x swizzle.
2021-10-20 14:46:30 -04:00
丛越
597f29d09d Support Metal 2.4 Intersection Query, Implement GL_EXT_ray_query. 2021-10-19 18:45:10 +08:00
Hans-Kristian Arntzen
e4243b898c
Merge pull request #1766 from KhronosGroup/fix-1765
Fix some silly bugs in trivial mix op detection.
2021-10-13 16:46:53 +02:00
Hans-Kristian Arntzen
6382f15470 Test behavior around OpSelect with matrices. 2021-10-13 16:08:29 +02:00
Hans-Kristian Arntzen
6071df5840 Fix wrong detection of trivial_mix_op.
Effectively, only the last component of the select was considered, need
to correctly early out if any case is hit.
2021-10-13 15:34:00 +02:00
Hans-Kristian Arntzen
97a438d214
Merge pull request #1757 from KhronosGroup/fix-1754
Improve handling of INT_MIN/INT64_MIN literals.
2021-09-30 17:04:30 +02:00
Hans-Kristian Arntzen
f72bb3c6f5 Improve handling of INT_MIN/INT64_MIN literals.
We cannot naively convert these to decimal literals. C/C++ (and thus
MSL) has extremely awkward literal promotion rules.
2021-09-30 16:29:30 +02:00
Hans-Kristian Arntzen
457c00bd07
Merge pull request #1756 from KhronosGroup/fix-1753
HLSL: Fix NumWorkgroups for SPIR-V 1.4+
2021-09-30 16:22:51 +02:00
Hans-Kristian Arntzen
91c25e8473
Merge pull request #1755 from KhronosGroup/fix-1751
MSVC: Workaround crtdbg macroing free().
2021-09-30 16:22:34 +02:00
Hans-Kristian Arntzen
9b2a8c7622 HLSL: Ensure synthetic NumWorkgroups variable is considered active.
In SPIR-V 1.4+, active global variables must be marked as such.
2021-09-30 14:39:42 +02:00
Hans-Kristian Arntzen
bb04156d3c CLI/HLSL: Don't set explicit binding for synthesized NumWorkgroups CBV. 2021-09-30 14:30:49 +02:00
Hans-Kristian Arntzen
96d95fbb31 MSVC: Workaround crtdbg macroing free(). 2021-09-30 14:12:08 +02:00
Hans-Kristian Arntzen
9462b90067
Merge pull request #1752 from billhollings/function-constants-opquantize
MSL: Support synthetic functions in function constants.
2021-09-30 14:06:10 +02:00
Hans-Kristian Arntzen
325f107c5b
Merge pull request #1745 from billhollings/location-component-vecsize
MSL: Track location component to match vecsize between shader stages.
2021-09-30 14:02:25 +02:00
Bill Hollings
ec054dad7f MSL: Support synthetic functions in function constants.
Emit synthetic functions before function constants.
Support use of spvQuantizeToF16() in function constants for numerical
behavior consistency with the op code.
Ensure subnormal results from OpQuantizeToF16 are flushed to zero per SPIR-V spec.

Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
Any MSL reference shader that inclues a synthetic function is affected,
since the location it is emitted has changed.
2021-09-28 19:10:16 -04:00
Hans-Kristian Arntzen
dee35bf3ce
Merge pull request #1749 from billhollings/fastmath-quantize
MSL: Honor infinities in OpQuantizeToF16 when compiling using fast-math.
2021-09-27 13:09:33 +02:00
Bill Hollings
ba66a91402 MSL: Use vec<T, n> in template SpvHalfTypeSelector for function spvQuantizeToF16().
Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
2021-09-25 14:36:42 -04:00
Bill Hollings
a2671e35b0 MSL: Consolidate spvQuantizeToF16() functions into a single template function.
Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
2021-09-24 14:41:15 -04:00
Bill Hollings
5742047b24 MSL: Honor infinities in OpQuantizeToF16 when compiling using fast-math.
Add spvQuantizeToF16() family of synthetic functions to convert
from float to half and back again, and add function attribute
[[clang::optnone]] to honor infinities during conversions.

Adjust SPIRV-Cross unit test reference shaders to accommodate these changes.
2021-09-24 11:22:05 -04:00
Hans-Kristian Arntzen
05ac99ae23
Merge pull request #1748 from billhollings/fastmath-nocontraction
MSL: Honor DecorationNoContraction when compiling using fast-math.
2021-09-24 12:17:42 +02:00