Commit Graph

3613 Commits

Author SHA1 Message Date
Bill Hollings
284ccf5d2d Fixes from code review of adding writable images to iOS Tier2 argument buffers. 2023-01-08 21:22:23 -05:00
Hans-Kristian Arntzen
0bb28ef88a
Merge pull request #2078 from KhronosGroup/fix-2072
Fix GCC5 build.
2023-01-05 13:00:56 +01:00
Hans-Kristian Arntzen
549cde7fae Fix GCC5 build. 2023-01-05 12:24:02 +01:00
Hans-Kristian Arntzen
cc2b3b61a6
Merge pull request #2077 from EpicGames/fixes_glsl
Fixed typo in CompilerGLSL::should_dereference()
2023-01-05 11:54:49 +01:00
Laura Hermanns
6371580f51 Fixed typo in CompilerGLSL::should_dereference() 2023-01-03 14:19:42 -05:00
Bill Hollings
643b7be196 MSL: Add support for writable images in iOS Tier2 argument buffers.
- Add CompilerMSL::Options::argument_buffers_tier as an enumeration to
  allow calling app to specify platform argument buffer tier capabilities.
- Support iOS writable images in Tier2 argument buffers when specified.

Tier capabilities based on recommendations from Apple engineering.
2022-12-28 12:40:37 -05:00
Hans-Kristian Arntzen
a89dea3c49
Merge pull request #2071 from KhronosGroup/fix-2068
CFG: Handle implied access to opaque loaded values.
2022-12-13 17:16:31 +01:00
Hans-Kristian Arntzen
baf38f0593
Merge pull request #2070 from KhronosGroup/fix-2066
Handle row major matrix workaround more gracefully
2022-12-13 16:34:34 +01:00
Hans-Kristian Arntzen
68a012a4f2 CFG: Handle implied access to opaque loaded values.
Similar concern as access chains. Objects that we cannot lower to
temporaries must implicitly access all expression dependencies when they
are themselves accessed.
2022-12-13 16:34:00 +01:00
Hans-Kristian Arntzen
03b1f66ef1 GLSL: Fix row-major workaround wrapper for ES.
By default, the matrix would be declared as mediump, causing precision
issues. Need to dispatch to two separate functions since GLSL does not
support overload based on precision.
2022-12-13 15:44:03 +01:00
Hans-Kristian Arntzen
3c997e12eb Add C API option for enable row major workaround. 2022-12-13 15:04:55 +01:00
Hans-Kristian Arntzen
c77b09b57c
Merge pull request #2063 from KhronosGroup/fix-2060
Merge #2061
2022-11-21 14:29:47 +01:00
Hans-Kristian Arntzen
451ed10e91
Merge pull request #2062 from cdavis5e/msl-spirv-assembly-fixes
MSL: SPIR-V assembly fixes
2022-11-21 13:53:17 +01:00
Hans-Kristian Arntzen
df76a14056 MSL: Refactor member reference in terms of one boolean.
ptr_chain was really just masking the proper i == 0 check.
Be more explicit about what the check is actually doing and comment
this.
2022-11-21 13:40:27 +01:00
Dunfan Lu
e75c496ec6 Fix MSL Access Chain 2022-11-21 13:29:18 +01:00
Hans-Kristian Arntzen
540a1e82c6
Merge pull request #2056 from cdavis5e/msl-discarded-frag-checks
MSL: Prevent stores to storage resources in discarded fragments.
2022-11-21 12:53:48 +01:00
Chip Davis
061cdd2052 MSL: Don't dereference forwarded copies of OpVariable pointers.
Fixes two more CTS tests under
`dEQP-VK.spirv_assembly.instruction.compute.empty_struct.copying`.
2022-11-20 02:08:37 -08:00
Chip Davis
5547b25afe Interleave undef values with constants and types.
Undef values may be of struct type and may be used in constants.
Therefore, they must be interleaved with constants and types.

Fixes the rest of the Vulkan CTS test
`dEQP-VK.spirv_assembly.instruction.compute.opundef.undefined_spec_constant_composite`.

(Please excuse the churn in the reference output; it's an inevitable
result of this change.)
2022-11-20 02:08:37 -08:00
Chip Davis
06ef3de002 GLSL, MSL: Handle OpUndef as part of a constant composite.
Fixes the CTS test
`dEQP-VK.spirv_assembly.instruction.compute.opundef.undefined_constant_composite`
and helps with another,
`dEQP-VK.spirv_assembly.instruction.compute.opundef.undefined_spec_constant_composite`.
Unfortunately, fixing the latter requires another change.
2022-11-20 02:08:33 -08:00
Chip Davis
aa5a8c482e MSL: Prevent stores to storage resources in discarded fragments.
Some Metal devices have a bug where storage resources can still be
written to even if the fragment is discarded. This is obviously a bug in
Metal, but bothering Apple to fix it will only fix it for newer
versions; therefore, a workaround is needed for older versions. I have
made this an option so that, in case the bug is ever fixed, the
workaround can be disabled.

This workaround is simple: if a fragment shader may discard its fragment
and writes to a storage resource, a variable representing the
`HelperInvocation` built-in is created and passed to all functions. The
flag is checked on all resource writes; writes do not occur when
`HelperInvocation` is `true`. This relies on the earlier workaround to
update `HelperInvocation` when the fragment is discarded.

Fixes at least 3 failures in the CTS.
2022-11-20 01:29:41 -08:00
Chip Davis
51d2dfe02a MSL: Add missing casts to Op?MulExtended.
It is possible to pass unsigned integers to `OpSMulExtended`. In that
case, we want to do a signed multiply with sign extension, so make sure
the operands are forced to be interpreted as signed.

This was an oversight on my part when I added these instructions.

Fixes the CTS test
`dEQP-VK.spirv_assembly.instruction.compute.signed_op.uint_smulextended`.
2022-11-20 00:20:49 -08:00
Chip Davis
c7ce92a95b MSL: Manually update BuiltInHelperInvocation when a fragment is discarded.
Some Metal devices have a bug where `simd_is_helper_thread()` won't
return true after a fragment has been discarded. We can work around this
by manually setting `gl_HelperInvocation` upon discarding a fragment.
This is fairly unintrusive, so it is enabled by default. I've made it an
option so that, when the bug is fixed, we can disable it.
2022-11-19 23:48:26 -08:00
Hans-Kristian Arntzen
edd66a2fc9
Merge pull request #2055 from KhronosGroup/fix-2053
Handle ShaderDebugInfo non-semantic extension.
2022-11-08 13:25:17 +01:00
Hans-Kristian Arntzen
e8a22a7cf6 Handle ShaderDebugInfo non-semantic extension. 2022-11-08 12:21:07 +01:00
Hans-Kristian Arntzen
abc31207bf
Merge pull request #2052 from KhronosGroup/hlsl-mesh-shader-ext
Merge HLSL support for VK_EXT_mesh_shader
2022-11-02 14:37:51 +01:00
Hans-Kristian Arntzen
b606e4f752 HLSL: Fix test for non-block per-primitive IO.
Force gl_in_out path for HLSL as well when mesh shaders are used.
2022-11-02 13:41:32 +01:00
Hans-Kristian Arntzen
ebf779dcfb HLSL: Do not support ClipCull size > 4 in mesh shaders.
The array mechanism breaks DXC which needs to observe that all
components have been written.

Uninitialized outputs will be undefined. Resort to simple vector
instead.
2022-11-02 13:34:11 +01:00
Hans-Kristian Arntzen
94160e8890 GLSL: Add test for mesh with non-block builtin IO. 2022-11-02 13:08:56 +01:00
Hans-Kristian Arntzen
3a066cd733 HLSL: Handle case where PerVertex block is not used. 2022-11-02 13:07:32 +01:00
Hans-Kristian Arntzen
f5ef0a74fb HLSL: Make sure to test deeply nested functions in mesh shaders. 2022-11-02 12:56:10 +01:00
Hans-Kristian Arntzen
e418266d25 HLSL: Some cleanups and fixes in analyze_meshlet_writes. 2022-11-02 12:56:04 +01:00
Hans-Kristian Arntzen
892f65b3a6 HLSL: Fix some warnings from review. 2022-11-02 12:15:10 +01:00
Hans-Kristian Arntzen
a4d5c0c4a5 HLSL: Fix-up some style issues from review. 2022-11-02 12:15:10 +01:00
Hans-Kristian Arntzen
10f55a11eb HLSL: Add missing reference for mesh shader test. 2022-11-02 11:52:02 +01:00
Hans-Kristian Arntzen
322f1b9fb3 Fixup glslang reference. 2022-11-02 11:50:03 +01:00
Try
80146a20da HLSL: Implement VK_EXT_mesh_shader 2022-11-02 11:48:58 +01:00
Hans-Kristian Arntzen
744279ec78
Merge pull request #2050 from cdavis5e/op-spec-constant-op-composite-insert
MSL: Implement `CompositeInsert` `OpSpecConstantOp`.
2022-11-02 11:13:17 +01:00
Chip Davis
8cf99e7d44 MSL: Implement CompositeInsert OpSpecConstantOp.
This op creates a new composite constant with one element replaced. So,
we reconstruct the `SPIRConstant` for the composite constant, but with
one of the IDs replaced. Constant initializer lists are memoized for
when the result of a `CompositeInsert` is used in another
`CompositeInsert`.

(I wanted to add a test case for GLSL as well, but for two things:
1. `glslang` in Vulkan mode chokes on the first constant array,
   insisting that its initializer needs to be a constant. [Bug in
   glslang?]
2. The declarations for the buffers used by the shader aren't emitted,
   regardless of whether Vulkan mode is enabled.)

Fixes five tests under
`dEQP-VK.spirv_assembly.instruction.*.opspecconstantop.vector_related`.
2022-11-01 18:11:39 -07:00
Hans-Kristian Arntzen
3cecac74c6
Merge pull request #2051 from KhronosGroup/roll-glslang-dep
Roll glslang dependency.
2022-11-01 13:04:50 +01:00
Hans-Kristian Arntzen
605bce39d7 Roll glslang dependency. 2022-11-01 12:47:56 +01:00
Hans-Kristian Arntzen
677299cc56
Merge pull request #2049 from KhronosGroup/fix-2046
MSL: Handle implicit integer promotion rules.
2022-10-31 14:36:26 +01:00
Hans-Kristian Arntzen
4de9d6c2b6 MSL: Handle implicit integer promotion rules.
MSL inherits the behavior of C where arithmetic on small types are
implicitly converted to int. SPIR-V does not have this behavior, so make
sure that arithmetic results are handled correctly.
2022-10-31 13:33:46 +01:00
Hans-Kristian Arntzen
c813d8d67b
Merge pull request #2044 from KhronosGroup/fix-2038
MSL: Fix restrict vs __restrict incompatibility.
2022-10-26 18:35:37 +02:00
Hans-Kristian Arntzen
2a49f7e82d MSL: Fix restrict vs __restrict incompatibility.
restrict was supported, but it broke in MSL 3.0. __restrict works on all
versions, so opt for that instead.

Also check for RestrictPointer decoration and refactor to_restrict() to
not take optional parameter to make it more obvious when implied space
character is added.
2022-10-26 17:52:47 +02:00
Hans-Kristian Arntzen
3ea057a303
Merge pull request #2045 from KhronosGroup/fix-2037
HLSL: Add option to bind vertex input smemantics by name.
2022-10-26 17:42:48 +02:00
Hans-Kristian Arntzen
0851baf9ee
Merge pull request #2043 from KhronosGroup/fix-2040
MSL: Handle partial access chains with array-of-UBO/SSBO.
2022-10-26 12:43:51 +02:00
Hans-Kristian Arntzen
47c7fc16eb HLSL: Add option to bind vertex input smemantics by name. 2022-10-26 12:41:23 +02:00
Hans-Kristian Arntzen
04af769e85 MSL: Handle partial access chains with array-of-UBO/SSBO.
Need to consider the backing variable, not just plain SPIRVariable.
2022-10-26 11:33:04 +02:00
Hans-Kristian Arntzen
5763919669
Merge pull request #2039 from cdavis5e/raw-buffer-tess-input
Raw buffer tess input
2022-10-19 11:00:40 +02:00
Chip Davis
e698633e22 MSL: Account for composite types when assigning locations.
In tessellation shaders, we call
`add_plain_member_variable_to_interface_block()` on composite types,
since we are using buffers for I/O and can use nested structs/arrays
here. In those cases, we need to make sure the next location is
incremented by the total amount consumed by the entire composite.

Fixes six more tests in the CTS, under
`dEQP-VK.tessellation.user_defined_io.per_vertex_block.*`.
2022-10-18 15:04:50 -07:00