Commit Graph

2863 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
dd35821f2f
Merge pull request #1499 from cdavis5e/subgroup-fixes
Subgroup fixes
2020-10-26 09:47:39 +01:00
Chip Davis
1264e2705e MSL: Cast broadcast booleans to ushort.
Metal doesn't support broadcasting or shuffling boolean values, but we
can work around that by casting it to `ushort`, then casting it back to
`bool`. I used `ushort` instead of `uint` because 16-bit values give
better throughput on Apple GPUs.
2020-10-23 21:55:46 -05:00
Chip Davis
065b5bda3c MSL: Mask ballots passed to Ballot bit ops.
Only the least *n* bits are significant, where *n* is the subgroup size.
The Vulkan CTS actually checks this.

The `FindLSB` tests weren't actually failing, but I masked that anyway,
in case there's some corner case the CTS is missing.
2020-10-23 21:55:46 -05:00
Chip Davis
781367d083 MSL: Support vectors with OpGroupNonUniformAllEqual.
This was not tested here in SPIRV-Cross. Predictably, it broke when I
tried it in the CTS.
2020-10-23 21:55:46 -05:00
Chip Davis
6ccb902462 MSL: Correct definitions of subgroup ballot mask variables.
`SubgroupEqMask` had a fencepost error that gave wrong values for
invocation ID 32.

For `SubgroupGeMask` and `SubgroupGtMask`, I forgot to shift the values
from `extract_bits()` up so that the mask is in the correct position.
Using `insert_bits()` instead should fold these two operations into one.

`SubgroupLtMask` and `SubgroupLeMask` were already correct.
2020-10-23 21:54:55 -05:00
Hans-Kristian Arntzen
a57b4b1b2e
Merge pull request #1498 from cdavis5e/msl-swizzle-arrayed-nonconstant
MSL: Don't remove periods from swizzle buffer index exprs.
2020-10-22 13:24:49 +02:00
Chip Davis
064ed448b9 MSL: Don't remove periods from swizzle buffer index exprs. 2020-10-20 17:47:40 -05:00
Hans-Kristian Arntzen
7b80307a7d
Merge pull request #1495 from cdavis5e/1d-2d-offset-grad
MSL: Handle Offset and Grad operands for 1D-as-2D textures.
2020-10-20 10:29:17 +02:00
Chip Davis
5845e009ea MSL: Handle Offset and Grad operands for 1D-as-2D textures. 2020-10-15 12:51:00 -05:00
Hans-Kristian Arntzen
0db1569e97
Merge pull request #1492 from KhronosGroup/non-native-matrix-fix
GLSL: Use need_transpose when checking for non-native matrix.
2020-10-15 10:52:44 +02:00
Hans-Kristian Arntzen
9c220a8247
Merge pull request #1490 from KhronosGroup/fix-1488
MSL: Support querying and modifying generated combined sampler suffix.
2020-10-15 10:52:28 +02:00
Hans-Kristian Arntzen
23a0cfc842
Merge pull request #1494 from cdavis5e/msl-tesc-tess-level-cast
MSL: Don't use a bitcast for tessellation levels in tesc shaders.
2020-10-15 10:52:11 +02:00
Chip Davis
3e6010d8c5 MSL: Don't use a bitcast for tessellation levels in tesc shaders.
`half` cannot be bitcasted to `float`, because the two types are not the
same size. Use an expanding cast instead.

We were already doing this for stores to the tessellation levels; why I
didn't also do this for loads is beyond me.
2020-10-14 18:35:59 -05:00
Hans-Kristian Arntzen
120af42616 GLSL: Use need_transpose when checking for non-native matrix. 2020-10-14 16:07:10 +02:00
Hans-Kristian Arntzen
bd1ee4344e MSL: Support querying and modifying generated combined sampler suffix. 2020-10-14 14:52:18 +02:00
Hans-Kristian Arntzen
7332b44c3c
Merge pull request #1489 from cdavis5e/msl-fix-atomic-image-coord
MSL: Fix calculation of atomic image buffer address.
2020-10-14 10:44:59 +02:00
Chip Davis
21d38f74ce MSL: Fix calculation of atomic image buffer address.
Fix reversed coordinates: `y` should be used to calculate the row
address. Align row address to the row stride.

I've made the row alignment a function constant; this makes it possible
to override it at pipeline compile time.

Honestly, I don't know how this worked at all for Epic. It definitely
didn't work in the CTS prior to this.
2020-10-13 20:51:56 -05:00
Hans-Kristian Arntzen
e827a06984
Merge pull request #1487 from cdavis5e/msl-atomic-image-interlock
MSL: Add missing interlock handling to atomic image buffers.
2020-10-14 00:35:56 +02:00
Chip Davis
7a5d0d6b29 MSL: Add missing interlock handling to atomic image buffers. 2020-10-13 11:44:17 -05:00
Hans-Kristian Arntzen
fab6ad234e
Merge pull request #1486 from cdavis5e/atomic-image-argument-buffer
MSL: Support atomic access to images from argument buffers.
2020-10-13 12:55:43 +02:00
Hans-Kristian Arntzen
cc7aabce72
Merge pull request #1485 from cdavis5e/msl23-demote-to-helper
MSL: Support SPV_EXT_demote_to_helper_invocation for MSL 2.3.
2020-10-13 12:47:46 +02:00
Chip Davis
9cafea6cf8 MSL: Support atomic access to images from argument buffers.
This was not added when Epic contributed atomic image support.

Fixes #1484.
2020-10-13 02:37:18 -05:00
Chip Davis
2219c4a392 MSL: Support SPV_EXT_demote_to_helper_invocation for MSL 2.3.
MSL 2.3 has everything needed to support this extension on all
platforms. The existing `discard_fragment()` function was given demote
semantics, similar to Direct3D, and the `simd_is_helper_thread()`
function was finally added to iOS.

I've left the old test alone. Should I remove it in favor of these?
2020-10-13 00:25:32 -05:00
Hans-Kristian Arntzen
401af49326
Merge pull request #1482 from KhronosGroup/gl-subgroup-merge
Merge GL subgroup support.
2020-10-08 17:19:07 +02:00
Hans-Kristian Arntzen
5619329665 Style nits for GL subgroup implementation. 2020-10-08 13:25:29 +02:00
Hans-Kristian Arntzen
a6f6547cf1 Add missing VK variant of the test file. 2020-10-08 12:22:45 +02:00
Hans-Kristian Arntzen
28994a3186 Update GL subgroup test file. 2020-10-08 12:22:24 +02:00
Hans-Kristian Arntzen
819c599ecd Merge branch 'issues1350-2' of git://github.com/devshgraphicsprogramming/SPIRV-Cross into master 2020-10-08 12:20:07 +02:00
criss
db52e277b9 Resolved issues 1350, 1351, 1352 2020-10-08 12:14:52 +02:00
Hans-Kristian Arntzen
5cc2e4f634
Merge pull request #1475 from KhronosGroup/fix-1474
GLSL: Support geometry streams.
2020-09-30 16:16:48 +02:00
Hans-Kristian Arntzen
e0c9aad934 GLSL: Add support for transform_feedback3 geometry streams. 2020-09-30 13:01:35 +02:00
Hans-Kristian Arntzen
7a99d1cb72 GLSL: Use literal array size for cull/clip array sizes. 2020-09-30 13:01:18 +02:00
Hans-Kristian Arntzen
e6f5ce6b89
Merge pull request #1471 from KhronosGroup/fix-1467
Work around MSVC warning.
2020-09-28 18:47:29 +02:00
Hans-Kristian Arntzen
6254be910e
Merge pull request #1470 from KhronosGroup/fix-1469
Allow flip_vert_y in all relevant stages.
2020-09-28 18:46:55 +02:00
Hans-Kristian Arntzen
34a6a45fba Work around MSVC warning. 2020-09-28 14:12:54 +02:00
Hans-Kristian Arntzen
5ea576ece2 Allow flip_vert_y in all relevant stages. 2020-09-28 14:10:08 +02:00
Hans-Kristian Arntzen
ea3cd74426
Merge pull request #1468 from dj2/roll-09-22
Roll dependencies.
2020-09-24 20:00:59 +02:00
dan sinclair
9880b05572 Roll dependencies.
This CL rolls the spirv-tools, spirv-headers and glslang dependencies.
2020-09-22 12:31:38 -04:00
Hans-Kristian Arntzen
8891bd3512
Merge pull request #1466 from KhronosGroup/fix-1465
Clean up and fix awkward conditional branch codegen.
2020-09-17 13:49:14 +02:00
Hans-Kristian Arntzen
2144274a91 Clean up conditional branch codegen.
Should only need to look at whether or not we're branching to our own
merge target. Any other branch needs to emit code in some way.
2020-09-17 12:12:37 +02:00
Hans-Kristian Arntzen
54cc0b01f6 Deal with case where a selection construct conditionally merges/breaks. 2020-09-17 12:02:43 +02:00
Hans-Kristian Arntzen
16d9fea77c
Merge pull request #1463 from KhronosGroup/fix-1462
Implement a simple evaluator of specialization constants.
2020-09-14 13:31:10 +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
bdbef7b1f3
Merge pull request #1461 from Kangz/fix-warnings
Fix -Wduplicate-enum and -Wrange-for-analysis.
2020-09-04 12:59:22 +02:00
Corentin Wallez
bcd71536e2 Fix -Wduplicate-enum and -Wrange-for-analysis. 2020-09-04 11:13:21 +02:00
Hans-Kristian Arntzen
ba2d0e17d3
Merge pull request #1460 from KhronosGroup/fix-1458
Roll dependencies.
2020-09-04 10:50:18 +02:00
Hans-Kristian Arntzen
446596643a Roll glslang/SPIRV-Tools deps. 2020-09-04 09:30:07 +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
bad9dab8df
Merge pull request #1457 from cdavis5e/msl-layered-subpass-data
MSL: Support layered input attachments.
2020-09-03 12:06:29 +02:00
Chip Davis
4cf840ee7b MSL: Support layered input attachments.
These need to use arrayed texture types, or Metal will complain when
binding the resource. The target layer is addressed relative to the
Layer output by the vertex pipeline, or to the ViewIndex if in a
multiview pipeline. Unlike with the s/t coordinates, Vulkan does not
forbid non-zero layer coordinates here, though this cannot be expressed
in Vulkan GLSL.

Supporting 3D textures will require additional work. Part of the problem
is that Metal does not allow texture views to subset a 3D texture, so we
need some way to pass the base depth to the shader.
2020-09-02 09:18:25 -05:00