Commit Graph

3341 Commits

Author SHA1 Message Date
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
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
Hans-Kristian Arntzen
be904dcc1e Handle collapsed loops similar to collapsed selections.
If we hit the deprecated scenario of selection with identical branches,
we need to collapse loops into direct branches if need be.
2022-07-22 14:37:46 +02:00
Hans-Kristian Arntzen
f7e98c39db Avoid detection of false loop variables.
If the loop variable candidate has a dominating block that lives in an
unrelated loop, we have to reject the loop variable candidate.
2022-07-22 14:08:21 +02:00
Hans-Kristian Arntzen
cb4e310f43
Merge pull request #1983 from KhronosGroup/fix-1979
HLSL: Add option to emit entry point name 1:1 instead of main().
2022-07-22 13:50:26 +02:00
Pedro J. Estébanez
1fe470b199 HLSL: Implement GroupOperation(Inclusive/Exclusive)Scan. 2022-07-22 13:39:37 +02:00
Hans-Kristian Arntzen
06ca9accd7 HLSL: Add option to emit entry point name 1:1 instead of main().
MSL backend supports emitting custom name, and there's no reason for
HLSL to not support that as well, but we have to make it an option to
not break existing users.
2022-07-22 12:04:33 +02:00
Hans-Kristian Arntzen
d8d051381f
Merge pull request #1970 from KhronosGroup/fix-1969
Handle PHI in collapsed switch constructs.
2022-07-04 15:17:52 +02:00
Hans-Kristian Arntzen
963fdfdf68 Handle PHI in collapsed switch constructs.
Collapsed switch constructs only branch directly to the merge block.
2022-07-04 13:55:00 +02:00
Hans-Kristian Arntzen
f46745095d
Merge pull request #1965 from billhollings/msl-physical_storage_buffer
MSL: Add support for SPV_KHR_physical_storage_buffer extension.
2022-07-04 12:59:42 +02:00
Bill Hollings
064a697b18 MSL: Fix implicit conversion precision build error. 2022-07-01 17:09:35 -04:00
Bill Hollings
4185acc70d MSL: Fixes from review for SPV_KHR_physical_storage_buffer extension.
- Assign ulongn physical type to buffer pointers in short arrays
  when array stride is larger than pointer size.
- Support GL_EXT_buffer_reference_uvec2 casting
  buffer reference pointers to and from uvec2 values.
- When packing structs, include structs inside physical buffers.
- Update mechanism for traversing pointer arrays when calculating type sizes.
- Added unit test shaders.
2022-07-01 16:10:41 -04:00
Bill Hollings
78eb5043f9 MSL: Fixes from review for SPV_KHR_physical_storage_buffer extension.
- For physical storage pointers, emit forward reference
  declarations in addition to definitions.
- Minor syntax corrections.
2022-06-24 17:28:17 -04:00
Hans-Kristian Arntzen
e6925974d1
Merge pull request #1966 from fred-wang/macos-snprintf
Fix compilation errors with deprecated sprintf function
2022-06-23 14:30:12 +02:00
Frédéric Wang
9c44a97faa address more review comments 2022-06-23 11:40:02 +02:00
Frédéric Wang
1310f5ba4d Keep using sprintf on windows. 2022-06-23 11:34:51 +02:00
Frédéric Wang
99f8613847 Fix compilation errors with deprecated sprintf function
This commit modifies sprintf calls to fix the following compilation
errors using XCode 14.0 beta on MacOS:

> 'sprintf' is deprecated: This function is provided for compatibility
> reasons only.  Due to security concerns inherent in the design of
> sprintf(3), it is highly recommended that you use snprintf(3) instead.
2022-06-21 16:28:16 +02:00
Hans-Kristian Arntzen
ba3e6ffe03
Merge pull request #1964 from sergmister/patch-1
Fix typo
2022-06-21 13:39:11 +02:00