Commit Graph

3457 Commits

Author SHA1 Message Date
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
Yuwen Wu
1b9296e1a5 MSL: only fix up gl_FragCoord if really necessary. 2022-09-13 18:50:57 +08:00
Hans-Kristian Arntzen
f6ca617825
Merge pull request #2017 from KhronosGroup/roll-deps
Roll dependencies
2022-09-12 14:07:05 +02:00
Hans-Kristian Arntzen
a5a7999666 Update mesh/task test references. 2022-09-12 12:46:14 +02:00
Hans-Kristian Arntzen
d7a6861f64 Update glslang/spirv-tools. 2022-09-12 12:37:27 +02:00
Hans-Kristian Arntzen
1e7e9fc32b
Merge pull request #2015 from FrankXie05/vcpkg-instructions
Add vcpkg installation instructions
2022-09-12 12:06:56 +02:00
Hans-Kristian Arntzen
8553588895
Merge pull request #2014 from cdavis5e/msl-shader-output-fixup
MSL: Add a mechanism to fix up shader outputs.
2022-09-12 12:05:48 +02:00
Chip Davis
064eaebe72 MSL: Add a mechanism to fix up shader outputs.
This is analogous to the existing support for fixing up shader inputs.
It is intended to be used with tessellation to add implicit builtins
that are read from a later stage, despite not being written in an
earlier stage. (Believe it or not, this is in fact legal in Vulkan.)

Helps fix 8 CTS tests under `dEQP-VK.pipeline.*.no_position`. (Eight
other tests work solely by accident without this change.)
2022-09-09 17:06:34 -07:00
FrankXie
d206e54ece Add vcpkg installation instructions 2022-09-08 01:19:18 -07:00
Hans-Kristian Arntzen
210a800130
Merge pull request #2012 from KhronosGroup/mesh-shaders
GLSL: Implement GL_EXT_mesh_shader
2022-09-05 13:19:32 +02:00
Hans-Kristian Arntzen
4c345166dc GLSL: Implement task shaders.
Due to bugged glslang / spirv-tools w.r.t. terminator instructions,
add a hack to ignore invalid SPIR-V for the time being.
2022-09-05 12:31:22 +02:00
Hans-Kristian Arntzen
5762617729 GLSL: Implement GL_EXT_mesh_shader. 2022-09-05 11:25:04 +02:00
Hans-Kristian Arntzen
6a73e68d30 Update glslang reference. 2022-09-05 11:18:44 +02:00
Hans-Kristian Arntzen
ec7b9b0ce7 Update SPIR-V headers. 2022-09-02 16:22:28 +02:00
Hans-Kristian Arntzen
9fcf62784b
Merge pull request #2011 from KhronosGroup/roll-deps
Update dependencies.
2022-09-02 15:39:03 +02:00
Hans-Kristian Arntzen
d24f41f1d5 Update dependencies. 2022-09-02 14:58:04 +02:00
Hans-Kristian Arntzen
c93ee9261e
Merge pull request #2005 from atyuwen/master
Don't rename remapped variables like 'gl_LastFragDepthARM'
2022-08-24 10:36:48 +02:00
Yuwen Wu
f40dba4919 GLSL: added an option to disable row-major-load workaround. 2022-08-24 11:07:12 +08:00
Yuwen Wu
10f2aa77da Skip remapped vars in 'fixup_reserved_names' 2022-08-24 11:06:09 +08:00
Yuwen Wu
9afa82e7b8 GLSL: disable row major load around on GLES. 2022-08-23 19:27:01 +08:00
Yuwen Wu
33e19e86bf Don't rename remapped variables like 'gl_LastFragDepthARM' 2022-08-18 19:38:25 +08:00
Hans-Kristian Arntzen
61c603f3ba
Merge pull request #1996 from KhronosGroup/fix-1993
MSL: Fix various bugs with Ptr/U bitcasts.
2022-08-09 14:40:55 +02:00
Hans-Kristian Arntzen
bc3987e59a MSL: Fix various bugs with Ptr/U bitcasts. 2022-08-09 13:49:40 +02:00
Hans-Kristian Arntzen
c084973c67
Merge pull request #1995 from KhronosGroup/fix-1992
Do not optimize OpCompositeInsert for hoisted temporaries.
2022-08-09 13:39:35 +02:00
Hans-Kristian Arntzen
05bbcc2d09 Do not optimize OpCompositeInsert for hoisted temporaries.
We cannot track uses that happens in subsequent loop iterations, so have
to be very careful.

Fixes regression introduced after this was added.
2022-08-09 12:44:57 +02:00
Hans-Kristian Arntzen
a725d8fad1 Fix minor style nit from review. 2022-08-09 11:56:52 +02:00
Hans-Kristian Arntzen
1bc05ef735 Merge branch 'master' of https://github.com/gpx1000/SPIRV-Cross 2022-08-09 11:54:53 +02:00
Chip Davis
a9cadd4982 Merged in cts-shared-composite-variables (pull request #1)
Fix shared composite variables tests

Approved-by: Steven Winston
2022-08-08 00:35:49 +00:00
Chip Davis
fc4a12fd4f MSL: Use a wrapper type for matrices in workgroup storage.
The standard `matrix` type in MSL lacked a constructor in the
`threadgroup` AS. This means that it was impossible to declare a
`threadgroup` variable that contains a matrix. This appears to have been
an oversight that was corrected in macOS 13/Xcode 14 beta 4. This
workaround continues to be required, however, for older systems.

To avoid changing interfaces unnecessarily (which shouldn't be a problem
regardless because the old and new types take up the same amount of
storage), only do this for structs if the struct is positively
identified as being used for workgroup storage.

I'm entirely aware this is inconsistent with the way packed matrices are
handled. One of them should be changed to match the other. Not sure
which one.

Fixes 23 CTS tests under `dEQP-VK.memory_model.shared`.
2022-08-07 17:31:41 -07:00
Chip Davis
faea931de3 MSL: Also replace bool with short in structures.
Since `bool` is a logical type, it cannot be used in uniform or storage
buffers. Therefore, replacing it in structures should not change the
shader interface.

We leave it alone for builtins. (FIXME: Should we also leave it for
I/O varyings?)

Fixes 24 CTS tests under `dEQP-VK.memory_model.shared`.
2022-08-05 11:43:21 -07:00
Hans-Kristian Arntzen
0cccd0a65a
Merge pull request #1986 from KhronosGroup/fix-1975
Handle multiple breaks out of switches.
2022-07-22 21:45:47 +02:00
Hans-Kristian Arntzen
4dfac510ed Handle multiple breaks out of switches.
Use a switch stack instead.
2022-07-22 15:31:40 +02:00
Hans-Kristian Arntzen
c24d5a7b90
Merge pull request #1985 from KhronosGroup/fix-1973
Handle collapsed loops similar to collapsed selections.
2022-07-22 15:28:54 +02:00
Hans-Kristian Arntzen
8ba0820c9d
Merge pull request #1984 from KhronosGroup/fix-1972
Avoid detection of false loop variables.
2022-07-22 14:55:06 +02:00
Hans-Kristian Arntzen
095e9e5cee
Merge pull request #1982 from RandomShaper/hlsl_subgroup_scan
HLSL: Implement GroupOperation(Inclusive/Exclusive)Scan.
2022-07-22 14:44:10 +02:00