Commit Graph

2984 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen
e07f0a9df5 GLSL: Fix buffer_reference with aliased names. 2020-11-23 16:36:49 +01:00
Hans-Kristian Arntzen
c5826b4b69 GLSL: Emit storage qualifiers for buffer_reference. 2020-11-23 16:26:33 +01:00
Hans-Kristian Arntzen
650b5e1b12 HLSL: Fix validation with FXC for test. 2020-11-23 16:03:35 +01:00
Hans-Kristian Arntzen
6a614cc7f7 Normalize all internal workaround methods to use spv prefix.
We have been interchanging spv and SPIRV_Cross_ for a while, which
causes weirdness since we don't explicitly ban SPIRV_Cross identifiers,
as these identifiers are generally used for interface variable
workarounds.
2020-11-23 15:42:27 +01:00
Hans-Kristian Arntzen
35d3b9c3e7 Merge branch 'msl-subgroup-ops-2' of git://github.com/cdavis5e/SPIRV-Cross 2020-11-23 14:20:06 +01:00
Hans-Kristian Arntzen
dabdf4eff6
Merge pull request #1547 from scribam/cmake-minimum-required
CMake: Set minimum required version to 3.0
2020-11-23 14:12:14 +01:00
scribam
1eb4852856 CMake: Set minimum required version to 3.0 2020-11-21 17:38:54 +01:00
Chip Davis
68908355a9 MSL: Expand subgroup support.
Add support for declaring a fixed subgroup size. Metal, like Vulkan with
`VK_EXT_subgroup_size_control`, allows the thread execution width to
vary depending on factors such as register usage. Unfortunately, this
breaks several tests that depend on the subgroup size being what the
device says it is. So we'll fix the subgroup size at the size the device
declares. The extra invocations in the subgroup will appear to be
inactive. Because of this, the ballot mask builtins are now ANDed with
the active subgroup mask.

Add support for emulating a subgroup of size 1. This is intended to be
used by Vulkan Portability implementations (e.g. MoltenVK) when the
hardware/software combo provides insufficient support for subgroups.
Luckily for us, Vulkan 1.1 only requires that the subgroup size be at
least 1.

Add support for quadgroup and SIMD-group functions which were added to
iOS in Metal 2.2 and 2.3. This will allow clients to take advantage of
expanded quadgroup and SIMD-group support in recent Metal versions and
on recent Apple GPUs (families 6 and 7).

Gut emulation of subgroup builtins in fragment shaders. It turns out
codegen for the SIMD-group functions in fragment wasn't implemented for
AMD on Mojave; it's a safe bet that it wasn't implemented for the other
drivers either. Subgroup support in fragment shaders now requires Metal
2.2.
2020-11-20 15:55:49 -06:00
Hans-Kristian Arntzen
58291963c6 Merge branch 'glsl-vertex-attrib-64bit' of git://github.com/rdb/SPIRV-Cross 2020-11-17 09:41:05 +01:00
rdb
df5e3730ca GLSL: Require GL_ARB_vertex_attrib_64bit for double input in pre-4.10 2020-11-16 22:14:46 +01:00
Hans-Kristian Arntzen
b3c59263a0
Merge pull request #1541 from cdavis5e/msl-ios-features
MSL: Expose some more features on iOS.
2020-11-16 09:43:40 +01:00
Chip Davis
88e25e60ec MSL: Expose some more features on iOS.
`min_lod_clamp()` was actually added in MSL 2.2 on iOS 13. The
restriction was based on the beta versions which didn't have it. Since
the beta versions didn't support family 6, this leads me to suspect that
the reason they lacked `min_lod_clamp()` is that it requires family 6.
This does not seem to be documented anywhere.

`simd_is_helper_thread()` was added in MSL 2.3 to iOS. I neglected to
update this when I finished up `SPV_EXT_demote_to_helper_invocation`.

`barycentric_coord` and `primitive_id` were added in MSL 2.3 on iOS 14.
They are only supported on family 7.
2020-11-14 01:57:11 -06:00
Hans-Kristian Arntzen
1ee2d13873 MSL: Add missing reference file. 2020-11-11 16:25:01 +01:00
Hans-Kristian Arntzen
ef0256c23e Fix switch fallthrough 2020-11-11 16:21:18 +01:00
Hans-Kristian Arntzen
0d6fad4ab9 Merge branch 'extract_subgroup_ops' of git://github.com/js6i/SPIRV-Cross 2020-11-11 16:17:23 +01:00
Hans-Kristian Arntzen
9c2c0a23b9
Merge pull request #1533 from rdb/texture-fetch-size-fallbacks
GLSL: Legacy / extension fallbacks for textureSize and texelFetch
2020-11-11 16:14:39 +01:00
rdb
10fa5f62aa GLSL: Legacy / extension fallbacks for textureSize and texelFetch 2020-11-09 15:26:46 +01:00
Jan Sikorski
f0239bce05 MSL: extract global variables from subgroup ballot operations
Fixes #1513.
2020-11-09 11:23:01 +01:00
Hans-Kristian Arntzen
6fc2a0581a Run format_all.sh. 2020-11-08 13:59:52 +01:00
Hans-Kristian Arntzen
71fcf0d9e6 Update texture gather test result. 2020-11-08 13:54:30 +01:00
Hans-Kristian Arntzen
008f3baad7 Merge branch 'arb-texture-gather' of git://github.com/rdb/SPIRV-Cross 2020-11-08 13:54:07 +01:00
Hans-Kristian Arntzen
46bf1e99d6
Merge pull request #1525 from cdavis5e/msl-interpolation-functions
MSL: Support pull-model interpolation on MSL 2.3+.
2020-11-07 17:04:56 +01:00
rdb
509908d8db GLSL: Add error checking and extension fallback for textureGather 2020-11-07 16:49:18 +01:00
Hans-Kristian Arntzen
683c3f5c3f
Merge pull request #1530 from rdb/legacy-glsl-round
GLSL: Provide round/roundEven for legacy GLSL
2020-11-07 16:40:18 +01:00
Hans-Kristian Arntzen
ea334c14bc
Merge pull request #1527 from rdb/legacy-transpose
GLSL: implement transpose() in GLSL 1.10 / ES 1.00
2020-11-07 16:37:59 +01:00
Hans-Kristian Arntzen
2417010046
Merge pull request #1528 from rdb/fix-legacy-vertex-shader-lod
GLSL: Fix support for textureLod in legacy vertex shaders
2020-11-07 16:33:50 +01:00
Hans-Kristian Arntzen
1648747fa7
Merge pull request #1529 from KhronosGroup/fix-msl-gather-regression
MSL: Fix regression in image gather handling.
2020-11-07 16:32:38 +01:00
rdb
b3bd674aa7 GLSL: Remove unused lod argument from legacy_tex_op() 2020-11-07 12:43:53 +01:00
rdb
bf71994dae GLSL: implement transpose() in GLSL 1.10 / ES 1.00 2020-11-06 22:27:54 +01:00
rdb
9e6e5d2738 GLSL: Fix round/roundEven for legacy GLSL. 2020-11-06 17:34:38 +01:00
rdb
e8c500ceef GLSL: Fix support for textureLod in legacy vertex shaders 2020-11-06 16:37:27 +01:00
Hans-Kristian Arntzen
db13762297 MSL: Fix regression in image gather handling.
It was not always possible to get backing variable for a late-combined
image sampler.
2020-11-06 16:21:30 +01:00
Chip Davis
aca9b6879a MSL: Support pull-model interpolation on MSL 2.3+.
New in MSL 2.3 is a template that can be used in the place of a scalar
type in a stage-in struct. This template has methods which interpolate
the varying at the given points. Curiously, you can't set interpolation
attributes on such a varying; perspective-correctness is encoded in the
type, while interpolation must be done using one of the methods. This
makes using this somewhat awkward from SPIRV-Cross, requiring us to jump
through a bunch of hoops to make this all work.

Using varyings from functions in particular is a pain point, requiring
us to pass the stage-in struct itself around. An alternative is to pass
references to the interpolants; except this will fall over badly with
composite types, which naturally must be flattened.  As with
tessellation, dynamic indexing isn't supported with pull-model
interpolation. This is because of the need to reference the original
struct member in order to call one of the pull-model interpolation
methods on it. Also, this is done at the variable level; this means that
if one varying in a struct is used with the pull-model functions, then
the entire struct is emitted as pull-model interpolants.

For some reason, this was not documented in the MSL spec, though there
is a property on `MTLDevice`, `supportsPullModelInterpolation`,
indicating support for this, which *is* documented. This does not appear
to be implemented yet for AMD: it returns `NO` from
`supportsPullModelInterpolation`, and pipelines with shaders using the
templates fail to compile. It *is* implemeted for Intel. It's probably
also implemented for Apple GPUs: on Apple Silicon, OpenGL calls down to
Metal, and it wouldn't be possible to use the interpolation functions
without this implemented in Metal.

Based on my testing, where SPIR-V and GLSL have the offset relative to
the pixel center, in Metal it appears to be relative to the pixel's
upper-left corner, as in HLSL. Therefore, I've added an offset 0.4375,
i.e. one half minus one sixteenth, to all arguments to
`interpolate_at_offset()`.

This also fixes a long-standing bug: if a pull-model interpolation
function is used on a varying, make sure that varying is declared. We
were already doing this only for the AMD pull-model function,
`interpolateAtVertexAMD()`; for reasons which are completely beyond me,
we weren't doing this for the base interpolation functions. I also note
that there are no tests for the interpolation functions for GLSL or
HLSL.
2020-11-05 11:57:45 -06:00
Hans-Kristian Arntzen
a20c768698
Merge pull request #1524 from rdb/hlsl-round-even
HLSL: Support roundEven() in HLSL SM 4.0 and above
2020-11-05 13:24:25 +01:00
rdb
854f566869 HLSL: Support roundEven() in HLSL SM 4.0 and above 2020-11-03 21:28:07 +01:00
Hans-Kristian Arntzen
2e1bdeb212
Merge pull request #1520 from rdb/dx9-dref-samplers
HLSL: Support depth comparison texture sampling in SM 2/3.
2020-11-03 20:51:17 +01:00
rdb
135933d59e HLSL: Add regression test for SM3.0 texture samplers 2020-11-03 18:15:05 +01:00
rdb
18893ba3b9 HLSL: Support depth comparison texture sampling in SM 2/3. 2020-11-03 18:10:43 +01:00
Hans-Kristian Arntzen
fc644b50e6
Merge pull request #1523 from KhronosGroup/fix-1512
HLSL: Add option to flatten matrix vertex input semantics.
2020-11-03 13:16:54 +01:00
Hans-Kristian Arntzen
512e851185
Merge pull request #1522 from KhronosGroup/fix-1510
Parser: Don't assume OpTypePointer will always take a SPIRType.
2020-11-03 13:16:18 +01:00
Hans-Kristian Arntzen
b3344174f7 HLSL: Add option to flatten matrix vertex input semantics.
Helps translation layers where we expect inputs to be multiple float
vectors rather than an indexed matrix.
2020-11-03 11:18:32 +01:00
Hans-Kristian Arntzen
1f018b0fb8 Parser: Don't assume OpTypePointer will always take a SPIRType.
Possible to receive a function prototype here. Don't try to do anything
smart here, just don't crash during parsing.
2020-11-03 10:53:37 +01:00
Hans-Kristian Arntzen
244839d350
Merge pull request #1516 from billhollings/VK_EXT_descriptor_indexing
MSL: Support run-time sized image and sampler arrays
2020-11-03 10:15:36 +01:00
Bill Hollings
4bdd49df3f Syntax and format updates from code review. 2020-11-02 22:15:20 -05:00
Hans-Kristian Arntzen
c5a3f37a1c
Merge pull request #1519 from cdavis5e/msl-mac-comparison-bias-grad
MSL: Allow Bias and Grad arguments with comparison on Mac in MSL 2.3.
2020-11-02 20:01:14 +01:00
Hans-Kristian Arntzen
dcd66c283c
Merge pull request #1521 from devshgraphicsprogramming/master
Fix some bad assumptions about emulating `subgroupBarrier`
2020-11-02 19:52:43 +01:00
criss
6402586015 Updated ref file for subgroups_basicvoteballot.vk.comp 2020-11-02 18:40:56 +01:00
Mateusz Kielan
9a1af25f02
Merge pull request #2 from KhronosGroup/master
AMD workaround
2020-10-31 21:54:58 +01:00
devsh
6c5f394b09 Fix some bad assumptions about emulating subgroupBarrier 2020-10-31 21:46:59 +01:00
Bill Hollings
7f67abe0fe Minor format and typo updates from code review. 2020-10-30 16:05:44 -04:00