Check MTLDevice for gpuAddress support.

Support by the MTLDevice for Metal Tier 2 argument buffers has an
impact on both descriptor indexing and buffer device address support.
Add MVKPhysicalDeviceMetalFeatures::argumentBuffersTier, to track
the MTLDevice argument buffers support tier, set it from
[MTLDevice argumentBuffersSupport], and subsequently enable support for
VK_KHR_buffer_device_address and VK_EXT_buffer_device_address extensions,
and set descriptor indexing resource counts, based on it.
Update documentation requirements.
This commit is contained in:
Bill Hollings 2022-07-19 14:30:38 -04:00
parent fe8d4d4d34
commit b04a6db72e
4 changed files with 15 additions and 4 deletions

View File

@ -263,7 +263,7 @@ In addition to core *Vulkan* functionality, **MoltenVK** also supports the foll
- `VK_KHR_16bit_storage`
- `VK_KHR_8bit_storage`
- `VK_KHR_bind_memory2`
- `VK_KHR_buffer_device_address` *(requires Metal 3.0)*
- `VK_KHR_buffer_device_address` *(requires GPU Tier 2 argument buffers support)*
- `VK_KHR_create_renderpass2`
- `VK_KHR_dedicated_allocation`
- `VK_KHR_depth_stencil_resolve`
@ -298,7 +298,7 @@ In addition to core *Vulkan* functionality, **MoltenVK** also supports the foll
- `VK_KHR_timeline_semaphore`
- `VK_KHR_uniform_buffer_standard_layout`
- `VK_KHR_variable_pointers`
- `VK_EXT_buffer_device_address` *(requires Metal 3.0)*
- `VK_EXT_buffer_device_address` *(requires GPU Tier 2 argument buffers support)*
- `VK_EXT_debug_marker`
- `VK_EXT_debug_report`
- `VK_EXT_debug_utils`

View File

@ -20,7 +20,7 @@ Released TBD
- Add support for extensions:
- `VK_EXT_metal_objects`
- `VK_KHR_buffer_device_address` and `VK_EXT_buffer_device_address`.
- `VK_KHR_buffer_device_address` and `VK_EXT_buffer_device_address` *(requires GPU Tier 2 argument buffers support)*.
- Reducing redundant state changes to improve command encoding performance.
- Update minimum Xcode deployment targets to macOS 10.13, iOS 11, and tvOS 11,
to avoid Xcode build warnings in Xcode 14.

View File

@ -33,6 +33,7 @@ extern "C" {
#import <Metal/Metal.h>
#else
typedef unsigned long MTLLanguageVersion;
typedef unsigned long MTLArgumentBuffersTier;
#endif
@ -931,6 +932,7 @@ typedef struct {
MVKCounterSamplingFlags counterSamplingPoints; /**< Identifies the points where pipeline GPU counter sampling may occur. */
VkBool32 programmableSamplePositions; /**< If true, programmable MSAA sample positions are supported. */
VkBool32 shaderBarycentricCoordinates; /**< If true, fragment shader barycentric coordinates are supported. */
MTLArgumentBuffersTier argumentBuffersTier; /**< The argument buffer tier available on this device, as a Metal enumeration. */
} MVKPhysicalDeviceMetalFeatures;
/** MoltenVK performance of a particular type of activity. */

View File

@ -415,7 +415,7 @@ void MVKPhysicalDevice::getProperties(VkPhysicalDeviceProperties2* properties) {
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT: {
bool isTier2 = isUsingMetalArgumentBuffers() && (_mtlDevice.argumentBuffersSupport >= MTLArgumentBuffersTier2);
bool isTier2 = isUsingMetalArgumentBuffers() && (_metalFeatures.argumentBuffersTier >= MTLArgumentBuffersTier2);
uint32_t maxSampCnt = getMaxSamplerCount();
auto* pDescIdxProps = (VkPhysicalDeviceDescriptorIndexingPropertiesEXT*)next;
@ -1724,6 +1724,10 @@ void MVKPhysicalDevice::initMetalFeatures() {
// Currently, if we don't support descriptor set argument buffers, we can't support argument buffers.
_metalFeatures.argumentBuffers = _metalFeatures.descriptorSetArgumentBuffers;
if ([_mtlDevice respondsToSelector: @selector(argumentBuffersSupport)]) {
_metalFeatures.argumentBuffersTier = _mtlDevice.argumentBuffersSupport;
}
#define checkSupportsMTLCounterSamplingPoint(mtlSP, mvkSP) \
if ([_mtlDevice respondsToSelector: @selector(supportsCounterSampling:)] && \
[_mtlDevice supportsCounterSampling: MTLCounterSamplingPointAt ##mtlSP ##Boundary]) { \
@ -2851,6 +2855,11 @@ void MVKPhysicalDevice::initExtensions() {
pWritableExtns->vk_KHR_fragment_shader_barycentric.enabled = false;
pWritableExtns->vk_NV_fragment_shader_barycentric.enabled = false;
}
// gpuAddress requires Tier2 argument buffer support (per feedback from Apple engineers).
if (_metalFeatures.argumentBuffersTier < MTLArgumentBuffersTier2) {
pWritableExtns->vk_KHR_buffer_device_address.enabled = false;
pWritableExtns->vk_EXT_buffer_device_address.enabled = false;
}
#if MVK_MACOS
if (!supportsMTLGPUFamily(Apple5)) {
pWritableExtns->vk_AMD_shader_image_load_store_lod.enabled = false;