Commit Graph

1583 Commits

Author SHA1 Message Date
Chip Davis
06d483459b MSL: Force signedness of shader vertex attributes to match the host.
Based on a patch by Stefan Dösinger.

Metal cannot do signedness conversion on vertex attributes, and for good
reason. Putting a `uint4` into an `int4`, or a `char4` into a `uint4`,
would lose those values that are outside the range of the target type.
But putting a `uchar4` into a `short4` or an `int4`, or a `ushort4` into
an `int4`, should work. In that case, force the signedness in the shader
to match the declared type of the host.

Unfortunately, I don't really know how to automatically test this. This
remapping is done based on input parameters normally supplied by
MoltenVK. I'm not sure how we'd set this up for the command-line
`spirv-cross` tool.
2018-11-28 17:53:56 -06:00
Hans-Kristian Arntzen
84588753dc
Merge pull request #774 from KhronosGroup/fix-770
Keep track of pointer-to-pointer depth in parser.
2018-11-26 13:35:27 +01:00
Hans-Kristian Arntzen
d0b937206f Keep track of pointer-to-pointer depth in parser.
Defer failure of pointer-to-pointer to compilation time, so we can still
reflect VK_KHR_variable_pointer shaders.
2018-11-26 12:23:28 +01:00
Hans-Kristian Arntzen
a89ebba827
Merge pull request #772 from KhronosGroup/fix-771
Fix unsigned switch case selectors.
2018-11-26 11:24:02 +01:00
Hans-Kristian Arntzen
04f410d35c Fix unsigned switch case selectors. 2018-11-26 10:36:50 +01:00
Hans-Kristian Arntzen
cd5cdda13d
Merge pull request #769 from KhronosGroup/fix-761
Handle invariant decoration more robustly.
2018-11-22 22:30:58 +01:00
Hans-Kristian Arntzen
816c1167ce Handle invariant decoration more robustly.
Avoids certain cases of variance between translation units by forcing
every dependent expression of a store to be temporary.
Should avoid the major failure cases where invariance matters.
2018-11-22 11:55:57 +01:00
Hans-Kristian Arntzen
f247b05ffd
Merge pull request #768 from KhronosGroup/fix-764
Remove old hack for dealing with HLSL counter buffers.
2018-11-22 11:17:13 +01:00
Hans-Kristian Arntzen
9aa623a553 Remove old hack for dealing with HLSL counter buffers.
No longer needed.
2018-11-22 10:23:58 +01:00
Hans-Kristian Arntzen
2588309290
Merge pull request #763 from trzecieu/patch-2
Adding C++ syntax coloring for missed snippet
2018-11-19 10:54:15 +01:00
Piotr Paczkowski (trzeci.eu)
30743aa931
Adding C++ syntax coloring for missed snippet 2018-11-19 10:49:49 +01:00
Hans-Kristian Arntzen
7611dc0967
Merge pull request #762 from trzecieu/patch-1
Syntax coloring for C++ snippets in README.md
2018-11-19 10:13:06 +01:00
Piotr Paczkowski (trzeci.eu)
bc6011b512
Syntax coloring for C++ snippets in README.md 2018-11-19 08:52:12 +01:00
Hans-Kristian Arntzen
ea6bdacd05
Merge pull request #760 from KhronosGroup/fix-758
Parser: Handle group decorations.
2018-11-15 12:01:51 +01:00
Hans-Kristian Arntzen
fa42ed37ba Parser: Handle group decorations. 2018-11-15 10:51:52 +01:00
Hans-Kristian Arntzen
e4822981cc
Merge pull request #759 from lifpan/master
Handle opcode OpSourceContinued.
2018-11-15 10:09:30 +01:00
Hans-Kristian Arntzen
510e1475c6
Merge pull request #756 from cdavis5e/relaxed-block-layout-2
MSL: Also pack 2- and 4- element vectors when necessary.
2018-11-15 10:09:09 +01:00
lifpan
00a765eccf Handle opcode OpSourceContinued. 2018-11-15 09:04:36 +08:00
Hans-Kristian Arntzen
c2fe5878b4
Merge pull request #757 from cdavis5e/msl-extended-arith
MSL: Support extended arithmetic opcodes.
2018-11-14 18:46:07 +01:00
Chip Davis
a5882da091 Test loading from and storing to packed vectors. 2018-11-14 10:47:20 -06:00
Chip Davis
6d675ae6a2 Correct carry/borrow bit checks.
Don't use `addsat()`/`subsat()`; that'll erroneously flag cases where
the sum is exactly the maximum integer value, or the difference is
exactly 0. Also, correct the condition for the `select()` function; it's
basically `mix()` with a boolean factor.

(What was I *thinking*?)
2018-11-14 10:13:56 -06:00
Chip Davis
cf2a890e4f MSL: Support extended arithmetic opcodes. 2018-11-13 17:33:03 -06:00
Chip Davis
bed4918cb5 MSL: Also pack 2- and 4- element vectors when necessary.
This is also needed for `VK_KHR_relaxed_block_layout` support.
2018-11-13 17:31:47 -06:00
Hans-Kristian Arntzen
1adaaba74e
Merge pull request #755 from KhronosGroup/fix-740
GLSL: Support extended arithmetic opcodes.
2018-11-13 16:54:53 +01:00
Hans-Kristian Arntzen
2a8a4fe706 GLSL: Support extended arithmetic opcodes.
- uaddCarry
- usubBorrow
- umulExtended
- imulExtended
2018-11-13 14:50:46 +01:00
Hans-Kristian Arntzen
14a3ce4a20
Merge pull request #754 from lifpan/master
Handle opcode OpModuleProcessed.
2018-11-13 09:23:46 +01:00
lifpan
9161096676 Handle opcode OpModuleProcessed. 2018-11-13 14:28:38 +08:00
Hans-Kristian Arntzen
f734d78c15
Merge pull request #750 from KhronosGroup/msl-travis-fix
MSL: Split out early_fragment_tests.
2018-11-12 17:14:37 +01:00
Hans-Kristian Arntzen
d6be21543d MSL: Split out early_fragment_tests.
Was causing compilation failures, jumped the merge a bit too soon.
2018-11-12 16:20:49 +01:00
Hans-Kristian Arntzen
be732f5f51
Merge pull request #749 from KhronosGroup/fix-747
Deal with depth_greater/depth_less qualifiers.
2018-11-12 13:10:26 +01:00
Hans-Kristian Arntzen
4e5c8d7199 Deal with depth_greater/depth_less qualifiers.
Adds support on HLSL SM 5.0, and fixes bug on GLSL.
Makes sure early fragment tests is tested on MSL as well.
2018-11-12 10:35:36 +01:00
Hans-Kristian Arntzen
b778e16e48 HLSL: Complete support for combined image samplers in legacy. 2018-11-12 09:59:39 +01:00
Hans-Kristian Arntzen
e8e7baf1ca Merge branch 'mgong/CombineOnSM3' of git://github.com/gongminmin/SPIRV-Cross 2018-11-12 09:59:12 +01:00
Minmin Gong
e3ebfdaae5 HLSL: Combine image and sampler on shader model <= 30 2018-11-10 13:44:59 -08:00
Hans-Kristian Arntzen
485eb0fb67
Merge pull request #742 from stenzek/msl-ssign
MSL: Emit wrapper for SSign (sign() for int types)
2018-11-08 12:03:56 +01:00
Connor McLaughlin
1dd676c1de MSL: Emit wrapper for SSign (sign() for int types)
Metal does not define the sign() function for integer types, only
floating-point types.
2018-11-08 13:08:34 +10:00
Hans-Kristian Arntzen
cf5e1c2801
Merge pull request #743 from cdavis5e/relaxed-block-layout
MSL: Also pack members at unaligned offsets.
2018-11-07 19:38:56 +01:00
Hans-Kristian Arntzen
28a7583cfa
Merge pull request #741 from stenzek/msl-early-fragment-tests
MSL: Print early_fragment_tests specifier before fragment
2018-11-07 19:32:37 +01:00
Chip Davis
e50eecfeeb MSL: Also pack members at unaligned offsets.
This is necessary to support `VK_KHR_relaxed_block_layout`.
2018-11-07 09:42:54 -06:00
Connor McLaughlin
801431b45b MSL: Print early_fragment_tests specifier before fragment
The compiler in 10.14 reports an error that the attribute cannot be
applied to types if the specifier is printed before fragment.
2018-11-07 21:54:19 +10:00
Hans-Kristian Arntzen
daaffc4717
Merge pull request #738 from cdavis5e/shader-small-storage
Add support for 8- and 16-bit types to GLSL and MSL.
2018-11-06 19:58:44 +01:00
Chip Davis
0d949e11ff Support bitcasts of 16-bit types. 2018-11-05 14:56:36 -06:00
Chip Davis
ca4744ab72 Support constants of 16-bit integral type in GLSL and MSL.
Constants of 8-bit type aren't supported in GLSL, since there's no
extension letting you use them.
2018-11-02 14:39:55 -05:00
Chip Davis
117ccf407c Use specific base types for 8- and 16-bit integers. 2018-11-01 17:45:10 -05:00
Chip Davis
1fb27b4cda Add support for 8- and 16-bit types to GLSL and MSL.
In GLSL, 8-bit types require GL_EXT_shader_8bit_storage. 16-bit types
can use either GL_AMD_gpu_shader_int16/GL_AMD_gpu_shader_half_float or
GL_EXT_shader_16bit_storage.
2018-11-01 10:20:57 -05:00
Hans-Kristian Arntzen
13633c0500
Merge pull request #737 from KhronosGroup/fix-724
Deal with OpSpecConstantOp used as array size.
2018-11-01 15:26:19 +01:00
Hans-Kristian Arntzen
480acdad18 Deal with OpSpecConstantOp used as array size.
When trying to validate buffer sizes, we usually need to bail out when
using SpecConstantOps, but for some very specific cases where we allow
unsized arrays currently, we can safely allow "unknown" sized arrays as
well.

This is probably the best we can do, when we have even more difficult
cases than this, we throw a more sensible error message.
2018-11-01 14:58:02 +01:00
Hans-Kristian Arntzen
37dbdf14fa
Merge pull request #736 from KhronosGroup/spec-constant-macro-hlsl-msl
Add spec constant macro support to HLSL/MSL as well
2018-11-01 13:24:05 +01:00
Hans-Kristian Arntzen
00d542ed44 Minor nit, set emitted when emitting spec constant op in HLSL. 2018-11-01 11:49:32 +01:00
Hans-Kristian Arntzen
6e99fcf695 Run format_all.sh. 2018-11-01 11:23:48 +01:00