Commit Graph

3841 Commits

Author SHA1 Message Date
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
Chip Davis
0b679334e4 MSL: Don't flatten arrayed per-patch output blocks in tessellation shaders.
Flattening doesn't play well with dynamic indices. In this case, it's
better to leave it as an array of structs.

(I wanted to do this for named blocks generally. Trouble is, the builtin
`gl_out` block is *also* a named block...)

Fixes six more CTS tests, under
`dEQP-VK.tessellation.user_defined_io.per_patch_block_array.*`.
2022-10-18 15:04:42 -07:00
Chip Davis
a171087180 MSL: Support "raw" buffer input in tessellation evaluation shaders.
Using vertex-style stage input is complex, and it doesn't support
nesting of structures or arrays. By using raw buffer input instead, we
get this support "for free," and everything becomes much simpler.
Arguably, this is the way I should've done this in the first place.

Eventually, I'd like to make this the default, and then remove the
option altogether. (And I still need to do that with
`multi_patch_workgroup`...)

Should help fix 66 tests in the Vulkan CTS, under the following trees:

 - `dEQP-VK.pipeline.*.interface_matching.*`
 - `dEQP-VK.tessellation.user_defined_io.*`
 - `dEQP-VK.clipping.user_defined.*`
2022-10-18 14:58:59 -07:00
Hans-Kristian Arntzen
f09ba27777
Merge pull request #2035 from KhronosGroup/fix-2032
HLSL: Improve support for VertexInfo aux struct.
2022-10-03 14:54:07 +02:00
Hans-Kristian Arntzen
f15d465a52
Merge pull request #2034 from KhronosGroup/fix-2028
MSL: Expose way to query if a buffer needs array length.
2022-10-03 13:32:07 +02:00
Hans-Kristian Arntzen
799d8c9e35
Merge pull request #2033 from KhronosGroup/fix-2029
Add reflection support for shader record buffers.
2022-10-03 13:31:56 +02:00
Hans-Kristian Arntzen
b5386e3ea9 HLSL: Improve support for VertexInfo aux struct.
Add concept of explicit bindings for aux structs and allows query if
these aux structs are required.
2022-10-03 13:31:27 +02:00
Hans-Kristian Arntzen
4ecdb24e59 MSL: Expose way to query if a buffer needs array length. 2022-10-03 12:30:15 +02:00
Hans-Kristian Arntzen
f3b1375b13 Add reflection support for shader record buffers.
Reflect naming scheme in a context sensitive way that matches the
frontend.

GLSL -> use block name
HLSL (DXC) -> use instance name.
2022-10-03 12:20:08 +02:00
Hans-Kristian Arntzen
c821207ae2
Merge pull request #2027 from billhollings/msl-opstore-addr-space-cast
MSL: Emit correct address space when casting during OpStore.
2022-10-03 11:51:27 +02:00
Bill Hollings
0a1127aa50 MSL: Emit correct address space when casting during OpStore.
When storing to local variable (eg. OpCopyLogical), the
default device address space used during casts is illegal.
Determine correct address space based on variable type.
2022-09-22 21:28:42 -04:00
Hans-Kristian Arntzen
81ba8f78f6
Merge pull request #2025 from KhronosGroup/fix-2009
MSL: Block 64-bit atomics and fix some reserved keywords
2022-09-22 11:36:48 +02:00
Hans-Kristian Arntzen
291def0793 MSL: Add more keywords to reserved set.
Address space qualifiers must also be banned.
2022-09-21 14:53:36 +02:00
Hans-Kristian Arntzen
a7f64a8b90 MSL: Report unsupported 64-bit atomics.
Overall just broken in some cases. And lack of fetch_* variants for a
few opcodes is also broken. When officially supported in some future MSL
version, this can be lifted.
2022-09-21 14:53:36 +02:00
Hans-Kristian Arntzen
ddaa2da629
Merge pull request #2024 from KhronosGroup/msl-descriptor-aliasing
MSL: Do not attempt to alias push constants.
2022-09-21 12:07:58 +02:00
Hans-Kristian Arntzen
a915e0bd4b MSL: Do not attempt to alias push constants. 2022-09-21 11:01:42 +02:00
Hans-Kristian Arntzen
adf0995bb9
Merge pull request #2023 from KhronosGroup/msl-descriptor-aliasing
MSL: Handle descriptor aliasing of raw buffer descriptors.
2022-09-20 16:18:58 +02:00
Hans-Kristian Arntzen
24dc49e692 MSL: Handle descriptor aliasing of raw buffer descriptors.
It is allowed to redeclare descriptors with different types in Vulkan.
MSL in general does not allow this, but for raw buffers, we can cast the
reference type at the very least.

For typed resources we are kinda hosed. Without descriptor indexing's
PARTIALLY_BOUND_BIT, descriptors must be valid if they are statically
accessed, so it would not be valid to access differently typed aliases
unless that flag is used. There might be a way to reinterpret cast
descriptors, but that seems very sketchy.

Implements support for:

- Single discrete descriptor
- Single argument buffer descriptor
- Array of argument buffer descriptors

Other cases are unimplemented for now since they are extremely painful
to unroll.
2022-09-20 15:21:56 +02:00
Hans-Kristian Arntzen
1ad6006130
Merge pull request #2021 from siegelaaron94/opengles_texture1d_textureSize
GLSL: Account for ES sampler1D to sampler2D promotion in textureSize.
2022-09-19 19:10:07 +02:00
Aaron Siegel
7b4c470f16 GLSL: Account for ES sampler1D to sampler2D promotion in textureSize. 2022-09-15 11:33:09 -07:00
Hans-Kristian Arntzen
6d3518e238
Merge pull request #2018 from atyuwen/master
MSL: only fix up gl_FragCoord if really necessary.
2022-09-15 11:44:38 +02:00
Hans-Kristian Arntzen
7afbbb624a
Merge pull request #2019 from billhollings/msl-OpPtrEqual-OpPtrNotEqual-OppPtrDiff
MSL: Support OpPtrEqual, OpPtrNotEqual, and OpPtrDiff.
2022-09-15 11:33:48 +02:00
Bill Hollings
5493b3030e MSL: Support OpPtrEqual, OpPtrNotEqual, and OpPtrDiff.
- Add CompilerMSL::emit_binary_ptr_op() and to_ptr_expression()
  to emit binary pointer op. Compare matrix addresses without automatic
  transpose() conversion, to avoid error taking address of temporary copy.
- Add Compiler::add_active_interface_variable() to also track active
  interface vars in the entry point for SPIR-V 1.4 and above.
- For OpPtrAccessChain that ends in array element, use Element
  as offset to existing index, otherwise it will access into
  array dimension that doesn't exist.
- Dereference pointer function call arguments. Ultimately, this
  dereferencing is actually backwards, and in future, we should aim
  to properly support passing pointer variables between functions,
  but such a refactoring was beyond the scope here.
- Use [] to declare array of pointers, as array<T*> is not supported in MSL.
- Add unit test shaders.
2022-09-14 15:19:15 -04:00