Commit Graph

3763 Commits

Author SHA1 Message Date
Jan Sikorski
ffb2c9bb6f MSL: Added tests for overlapping bindings. 2024-04-02 12:01:07 +02:00
Jan Sikorski
221a517be5 MSL: Pass variable id when emitting image entry point declarations. 2024-04-02 12:01:07 +02:00
Jan Sikorski
064186e474 MSL: Check for device argument buffers for overlapping bindings. 2024-04-02 12:01:07 +02:00
Jan Sikorski
760a659f5c MSL: Avoid emitting multiple declaration of the same variable. 2024-04-02 12:01:07 +02:00
Jan Sikorski
44a5f1fc3e MSL: Add support for overlapping bindings.
This adds support for bindings which share the same DescriptorSet/Binding pair.

The motivating example is vkd3d, which uses overlapping arrays of resources to
emulate D3D12 descriptor tables. The generated MSL argument buffer only
includes the first resource (in this example 't0'):

struct spvDescriptorSetBuffer2
{
    array<texture2d<float>, 499968> t0 [[id(0)]];
    // Overlapping binding: array<texture3d<float>, 499968> t2 [[id(0)]];
};

When t2 is referenced, we cast the instantiated member:

float4 r1 = spvDescriptorSet2.t0[_79].sample(...);
float4 r2 = (*(constant array<texture3d<float>, 499968>*)&spvDescriptorSet2.t0)[_97].sample(...);
2024-04-02 12:01:07 +02:00
Hans-Kristian Arntzen
f9393f44d3 MSL: Get rid of obsolete "is pointer" methods.
Just use the common ones.
2024-04-02 11:47:54 +02:00
Hans-Kristian Arntzen
7d92d7d879
Merge pull request #2299 from KhronosGroup/fix-2285
Block loop optimization if Phi is used.
2024-03-18 12:31:21 +01:00
Hans-Kristian Arntzen
b4c84bb135 Block loop optimization if Phi is used.
Somehow this hasn't been caught until now. Impressive.

We'll have to emit side effects in condition block to make this work,
which breaks loop conditionals.
2024-03-18 12:09:38 +01:00
Hans-Kristian Arntzen
1e3f31e69c
Merge pull request #2298 from KhronosGroup/pr-2297
Land PR 2297
2024-03-18 11:56:15 +01:00
Hans-Kristian Arntzen
48aba6ab03 Add test for multi-function Private LUT. 2024-03-18 11:25:59 +01:00
Hans-Kristian Arntzen
48bede6a2a Smaller cleanups on multi-function Private LUTs. 2024-03-18 11:25:38 +01:00
Hans-Kristian Arntzen
6ee80151e4 Merge branch 'global-luts' of https://github.com/js6i/SPIRV-Cross into pr-2297 2024-03-18 11:04:53 +01:00
Hans-Kristian Arntzen
326199641d
Merge pull request #2296 from KhronosGroup/vulkan-sdk-1.3.280-moltenvk
MSL: Merge `vulkan-sdk-1.3.280-moltenvk` branch into `main` branch.
2024-03-18 10:50:37 +01:00
Jan Sikorski
8465ec8109 Support cases of LUTs which are not function local.
Prevent cases where arrays that are globally defined constants are redeclared
on stack. On Intel macs, declaring a large, statically initialized
spvUnsafeArray on stack may cause an internal compiler error.
2024-03-15 17:19:49 +01:00
Bill Hollings
de0e72a0db
Merge pull request #2293 from billhollings/atomic_compare_exchange_weak-texture_1D_as_2D
MSL: atomic_compare_exchange_weak() support CompilerMSL:msl_options.texture_1D_as_2D.
2024-03-11 23:27:25 -04:00
Bill Hollings
5e6500466c MSL: atomic_compare_exchange_weak() support CompilerMSL:msl_options.texture_1D_as_2D.
CompilerMSL:msl_options.texture_1D_as_2D emulates a Metal 1D texture
as a 2D texture in order to expand features available for 1D textures.
Support accessing such textures as 2D for atomic_compare_exchange_weak().
2024-03-11 22:42:43 -04:00
Hans-Kristian Arntzen
2a7c818492
Merge pull request #2290 from KhronosGroup/fix-2287
MSL: Fix type hierarchy for extended vectors.
2024-03-06 15:26:57 +01:00
Hans-Kristian Arntzen
261589a5b2 MSL: Fix type hierarchy for extended vectors. 2024-03-06 14:33:02 +01:00
Hans-Kristian Arntzen
c2eb27c172
Merge pull request #2289 from KhronosGroup/fix-2279
Fix crash when traversing PtrAccessChain to OpTypeStruct.
2024-03-06 14:32:27 +01:00
Hans-Kristian Arntzen
572c413176 Fix crash when traversing PtrAccessChain to OpTypeStruct. 2024-03-06 13:14:54 +01:00
Hans-Kristian Arntzen
4db95b762f
Merge pull request #2288 from KhronosGroup/fix-2272
MSL: Improve handling of BDA + atomics.
2024-03-05 15:03:56 +01:00
Hans-Kristian Arntzen
c524e3396f MSL: Improve handling of BDA + atomics. 2024-03-05 14:30:46 +01:00
Hans-Kristian Arntzen
5f7a6de552
Merge pull request #2282 from hypengw/main
GLSL: Fix atomic_uint being incorrectly generated as uint
2024-02-26 16:31:26 +01:00
Hans-Kristian Arntzen
346c734955
Merge pull request #2283 from KhronosGroup/pr-2281
Land PR 2281
2024-02-26 16:31:07 +01:00
Hans-Kristian Arntzen
855a5c369f MSL: Also test image atomic for image2DArray. 2024-02-26 15:51:32 +01:00
Hans-Kristian Arntzen
7e0c9ab9ed MSL: Nit from review. 2024-02-26 15:51:32 +01:00
Jan Sikorski
052c57e2f2 MSL: Pass texture array index separately to atomic texture operations. 2024-02-26 15:51:32 +01:00
Hans-Kristian Arntzen
08391d91f0
Merge pull request #2278 from billhollings/fix-opcopyobject-temp-var
OpCopyObject declare a temp var of base type, not pointer type.
2024-02-26 15:35:01 +01:00
penghaiyi
18cb2ce961 GLSL: Fix atomic_uint being incorrectly generated as uint 2024-02-23 09:33:08 +08:00
Bill Hollings
fa0d4b9057 OpCopyObject declare a temp var of base type, not pointer type.
Fixes MSL issue where temp variable was declared as pointer var, and
OpCopyObject attempted to copy a base type var into the pointer var.
2024-02-15 19:34:30 -05:00
Hans-Kristian Arntzen
b8fcf307f1
Merge pull request #2274 from DmitryTsyganov/error_message_fix
Add CompilerError constructor that accepts const char* as a parameter (Fixes #2273)
2024-02-05 12:54:10 +01:00
Hans-Kristian Arntzen
3198ac2ff2
Merge pull request #2276 from Try/msl-descriptor-array-fixup
Fix codegen for shader with only bindless ssbo
2024-02-05 10:28:16 +01:00
Try
ed7a3e3ebb fix codegen for shader with only bindless ssbo 2024-02-04 23:28:58 +01:00
DmitryTsyganov
fd3ce6e865 Add CompilerError constructor that accepts const char* as a parameter
Fixes #2273
2024-02-01 18:08:01 +01:00
Hans-Kristian Arntzen
03b485dc47
Merge pull request #2271 from KhronosGroup/fix-2264
MSL: Handle volatile properly for emulated image atomics.
2024-01-23 14:43:04 +01:00
Hans-Kristian Arntzen
bad97c85e1
Merge pull request #2269 from jaxfrank/main
Fixed conflict with windows min() and max() macros in spirv_common.hpp
2024-01-23 14:42:56 +01:00
Hans-Kristian Arntzen
9d87a014f0 MSL: Handle volatile properly for emulated image atomics. 2024-01-23 13:09:41 +01:00
Hans-Kristian Arntzen
01c8a2a002
Merge pull request #2270 from KhronosGroup/fix-2262
Use more descriptive versioning in gitversion.h.
2024-01-23 13:07:37 +01:00
Hans-Kristian Arntzen
c3d0bd4cdb Use more descriptive versioning in gitversion.h. 2024-01-23 12:01:32 +01:00
Frank McCoy
e07956776d
Fixed conflict with windows min and max
If windows.h is included before spirv_common.hpp without NOMINMAX being defined the windows min and max macros will conflict with the STL numeric limits functions.
2024-01-22 00:49:18 -08:00
Hans-Kristian Arntzen
b82536766d
Merge pull request #2268 from KhronosGroup/fix-2260
GLSL: Improve BDA handling in esoteric situations
2024-01-18 14:28:51 +01:00
Hans-Kristian Arntzen
376a308dc7 GLSL: Handle ptr-to-array casts with unexpected array strides. 2024-01-18 14:14:10 +01:00
Hans-Kristian Arntzen
071969811b GLSL: Add basic test for chained access chains. 2024-01-18 13:35:43 +01:00
Hans-Kristian Arntzen
32ac768c15 GLSL: Handle synthesized pointer-to-pointer. 2024-01-18 13:11:04 +01:00
Hans-Kristian Arntzen
3da5bc7a57 GLSL: Forward declare non-block BDA types as well.
With non-block structs, we can have pointers in those types too.
2024-01-18 12:56:31 +01:00
Hans-Kristian Arntzen
871ac0e5b7 GLSL: Handle BDA to plain non-block struct.
The implementation assumed that BDA to struct would always result in a
Block-like type, but that is not necessarily the case. Treat non-Block
structs as POD types as well.
2024-01-18 12:40:47 +01:00
Hans-Kristian Arntzen
c0f48374c7 Add reserve to object pool. 2024-01-18 11:54:24 +01:00
Hans-Kristian Arntzen
64f64c837a
Merge pull request #2266 from KhronosGroup/pr-2257
Land MSL integer dot products
2024-01-16 16:24:33 +01:00
Hans-Kristian Arntzen
e9851cc6aa MSL: Fix misc sign issues with dot product impl and add more coverage. 2024-01-16 16:17:43 +01:00
Hans-Kristian Arntzen
b9abac5024 Fix nits from review. 2024-01-16 14:46:16 +01:00