Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap Metal 3 argument buffer references in Xcode 14 guard code. #2263

Merged
merged 1 commit into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions MoltenVK/MoltenVK/GPUObjects/MVKDescriptorSet.mm
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,29 @@
if (_mtlArgumentEncoder) {
[_mtlArgumentEncoder setBuffer: mtlBuff offset: offset atIndex: index];
} else {
#if MVK_XCODE_14
*(uint64_t*)getArgumentPointer(index) = mtlBuff.gpuAddress + offset;
#endif
}
}

void MVKMetalArgumentBuffer::setTexture(id<MTLTexture> mtlTex, uint32_t index) {
if (_mtlArgumentEncoder) {
[_mtlArgumentEncoder setTexture: mtlTex atIndex: index];
} else {
#if MVK_XCODE_14
*(MTLResourceID*)getArgumentPointer(index) = mtlTex.gpuResourceID;
#endif
}
}

void MVKMetalArgumentBuffer::setSamplerState(id<MTLSamplerState> mtlSamp, uint32_t index) {
if (_mtlArgumentEncoder) {
[_mtlArgumentEncoder setSamplerState: mtlSamp atIndex: index];
} else {
#if MVK_XCODE_14
*(MTLResourceID*)getArgumentPointer(index) = mtlSamp.gpuResourceID;
#endif
}
}

Expand Down
6 changes: 6 additions & 0 deletions MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2402,10 +2402,14 @@
_properties.vendorID == kIntelVendorId));

// Argument encoders are not needed if Metal 3 plus Tier 2 argument buffers.
#if MVK_XCODE_14
_metalFeatures.needsArgumentBufferEncoders = (_metalFeatures.argumentBuffers &&
!(mvkOSVersionIsAtLeast(13.0, 16.0, 1.0) &&
supportsMTLGPUFamily(Metal3) &&
_metalFeatures.argumentBuffersTier >= MTLArgumentBuffersTier2));
#else
_metalFeatures.needsArgumentBufferEncoders = _metalFeatures.argumentBuffers;
#endif

_isUsingMetalArgumentBuffers = _metalFeatures.descriptorSetArgumentBuffers && getMVKConfig().useMetalArgumentBuffers;;

Expand Down Expand Up @@ -3486,7 +3490,9 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope
logMsg += "\n\tMetal Shading Language %s";
logMsg += "\n\tsupports the following GPU Features:";

#if MVK_XCODE_14
if (supportsMTLGPUFamily(Metal3)) { logMsg += "\n\t\tGPU Family Metal 3"; }
#endif
#if MVK_XCODE_15 && (MVK_IOS || MVK_MACOS)
if (supportsMTLGPUFamily(Apple9)) { logMsg += "\n\t\tGPU Family Apple 9"; }
#endif
Expand Down
Loading