KhronosGroup / MoltenVK

MoltenVK is a Vulkan Portability implementation. It layers a subset of the high-performance, industry-standard Vulkan graphics and compute API over Apple's Metal graphics framework, enabling Vulkan applications to run on macOS, iOS and tvOS.
Apache License 2.0
4.79k stars 423 forks source link

Build failure with custom SPIRV-Cross namespace #2365

Closed reckenrode closed 1 week ago

reckenrode commented 1 week ago

I ran into an issue while updating MoltenVK in nixpkgs to 1.2.10. The issue appears to be present in 1.2.11, but the Vulkan SDK in nixpkgs has not yet been updated to 1.3.296, so I’ve only tried to build 1.2.10. It appears that MoltenVK/MoltenVK/GPUObjects/MVKDescriptorSet.mm is using a hard-coded MVK_spirv_cross instead of the SPIRV_CROSS_NAMESPACE macro.

In file included from /nix/store/l57xs1wxakm6syb5qw7kl5031g3kap2b-apple-sdk-14.4/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Metal.framework/Headers/Metal.h:30:
/nix/store/l57xs1wxakm6syb5qw7kl5031g3kap2b-apple-sdk-14.4/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Metal.framework/Headers/MTLSampler.h:222:36: note: 'gpuR>
@property (readonly) MTLResourceID gpuResourceID API_AVAILABLE(macos(13.0), ios(16.0));
                                   ^
/private/tmp/nix-build-MoltenVK-1.2.10.drv-0/source/MoltenVK/MoltenVK/GPUObjects/MVKDescriptorSet.mm:72:56: note: enclose 'gpuResourceID' in an @available check to silence this warning
                *(MTLResourceID*)getArgumentPointer(index) = mtlSamp.gpuResourceID;
                                                                     ^~~~~~~~~~~~~
/private/tmp/nix-build-MoltenVK-1.2.10.drv-0/source/MoltenVK/MoltenVK/GPUObjects/MVKDescriptorSet.mm:266:9: error: use of undeclared identifier 'MVK_spirv_cross'; did you mean 'spirv_cross'?
                                                  MVK_spirv_cross::kBufferSizeBufferBinding,
                                                  ^~~~~~~~~~~~~~~
                                                  spirv_cross
billhollings commented 1 week ago

Thanks for catching and reporting this.

PR #2371 fixes this.