Skip to content

Commit

Permalink
Merge pull request #1889 from billhollings/rmv-config2
Browse files Browse the repository at this point in the history
Remove vkGetMoltenVKConfiguration2MVK() and vkSetMoltenVKConfiguration2MVK()
  • Loading branch information
billhollings authored May 5, 2023
2 parents cfa0ed2 + cde220a commit af9544d
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 45 deletions.
2 changes: 0 additions & 2 deletions Docs/Whats_New.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ Released TBD
- Support BC compression on iOS/tvOS where available (iOS/tvOS 16.4 and above and supported by the GPU).
- Support separate depth and stencil attachments during dynamic rendering.
- Deprecate the obsolete and non-standard `VK_MVK_moltenvk` extension.
- Add `vkGetMoltenVKConfiguration2MVK()` and `vkGetMoltenVKConfiguration2MVK()` to clarify
MoltenVK config does not require any Vulkan objects.
- Fix memory leak when waiting on timeline semaphores.
- Ensure shaders that use `PhysicalStorageBufferAddresses` encode the use of the associated `MTLBuffer`.
- Disable pipeline cache compression prior to macOS 10.15 and iOS/tvOS 13.0.
Expand Down
18 changes: 14 additions & 4 deletions MoltenVK/MoltenVK/API/mvk_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -920,8 +920,8 @@ typedef struct {
#pragma mark -
#pragma mark Function types

typedef VkResult (VKAPI_PTR *PFN_vkGetMoltenVKConfiguration2MVK)(MVKConfiguration* pConfiguration, size_t* pConfigurationSize);
typedef VkResult (VKAPI_PTR *PFN_vkSetMoltenVKConfiguration2MVK)(const MVKConfiguration* pConfiguration, size_t* pConfigurationSize);
typedef VkResult (VKAPI_PTR *PFN_vkGetMoltenVKConfigurationMVK)(VkInstance ignored, MVKConfiguration* pConfiguration, size_t* pConfigurationSize);
typedef VkResult (VKAPI_PTR *PFN_vkSetMoltenVKConfigurationMVK)(VkInstance ignored, const MVKConfiguration* pConfiguration, size_t* pConfigurationSize);


#pragma mark -
Expand All @@ -936,6 +936,10 @@ typedef struct {
* the current configuration, make changes, and call vkSetMoltenVKConfigurationMVK() to
* update all of the values.
*
* The VkInstance object you provide here is ignored, and a VK_NULL_HANDLE value can be provided.
* This function can be called before the VkInstance has been created. It is safe to call this function
* with a VkInstance retrieved from a different layer in the Vulkan SDK Loader and Layers framework.
*
* To be active, some configuration settings must be set before a VkInstance or VkDevice
* is created. See the description of the MVKConfiguration members for more information.
*
Expand All @@ -958,7 +962,8 @@ typedef struct {
* to NULL. In that case, this function will set *pConfigurationSize to the size that MoltenVK
* expects MVKConfiguration to be.
*/
VKAPI_ATTR VkResult VKAPI_CALL vkGetMoltenVKConfiguration2MVK(
VKAPI_ATTR VkResult VKAPI_CALL vkGetMoltenVKConfigurationMVK(
VkInstance ignored,
MVKConfiguration* pConfiguration,
size_t* pConfigurationSize);

Expand All @@ -969,6 +974,10 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMoltenVKConfiguration2MVK(
* to retrieve the current configuration, make changes, and call
* vkSetMoltenVKConfigurationMVK() to update all of the values.
*
* The VkInstance object you provide here is ignored, and a VK_NULL_HANDLE value can be provided.
* This function can be called before the VkInstance has been created. It is safe to call this function
* with a VkInstance retrieved from a different layer in the Vulkan SDK Loader and Layers framework.
*
* To be active, some configuration settings must be set before a VkInstance or VkDevice
* is created. See the description of the MVKConfiguration members for more information.
*
Expand All @@ -991,7 +1000,8 @@ VKAPI_ATTR VkResult VKAPI_CALL vkGetMoltenVKConfiguration2MVK(
* to NULL. In that case, this function will set *pConfigurationSize to the size that MoltenVK
* expects MVKConfiguration to be.
*/
VKAPI_ATTR VkResult VKAPI_CALL vkSetMoltenVKConfiguration2MVK(
VKAPI_ATTR VkResult VKAPI_CALL vkSetMoltenVKConfigurationMVK(
VkInstance ignored,
const MVKConfiguration* pConfiguration,
size_t* pConfigurationSize);

Expand Down
16 changes: 0 additions & 16 deletions MoltenVK/MoltenVK/API/mvk_deprecated_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ extern "C" {
#pragma mark -
#pragma mark Function types

typedef VkResult (VKAPI_PTR *PFN_vkGetMoltenVKConfigurationMVK)(VkInstance ignored, MVKConfiguration* pConfiguration, size_t* pConfigurationSize);
typedef VkResult (VKAPI_PTR *PFN_vkSetMoltenVKConfigurationMVK)(VkInstance ignored, const MVKConfiguration* pConfiguration, size_t* pConfigurationSize);
typedef void (VKAPI_PTR *PFN_vkGetVersionStringsMVK)(char* pMoltenVersionStringBuffer, uint32_t moltenVersionStringBufferLength, char* pVulkanVersionStringBuffer, uint32_t vulkanVersionStringBufferLength);
typedef void (VKAPI_PTR *PFN_vkSetWorkgroupSizeMVK)(VkShaderModule shaderModule, uint32_t x, uint32_t y, uint32_t z);
typedef VkResult (VKAPI_PTR *PFN_vkUseIOSurfaceMVK)(VkImage image, IOSurfaceRef ioSurface);
Expand All @@ -74,20 +72,6 @@ typedef void (VKAPI_PTR *PFN_vkGetMTLCommandQueueMVK)(VkQueue queue, id<MTLComma
#define MVK_DEPRECATED_USE_MTL_OBJS VKAPI_ATTR [[deprecated("Use the VK_EXT_metal_objects extension instead.")]]


/** DEPRECATED. Identical functionality to vkGetMoltenVKConfiguration2MVK(). */
VKAPI_ATTR [[deprecated("Use vkGetMoltenVKConfiguration2MVK() instead.")]]
VkResult VKAPI_CALL vkGetMoltenVKConfigurationMVK(
VkInstance ignored,
MVKConfiguration* pConfiguration,
size_t* pConfigurationSize);

/** DEPRECATED. Identical functionality to vkSetMoltenVKConfiguration2MVK(). */
VKAPI_ATTR [[deprecated("Use vkSetMoltenVKConfiguration2MVK() instead.")]]
VkResult VKAPI_CALL vkSetMoltenVKConfigurationMVK(
VkInstance ignored,
const MVKConfiguration* pConfiguration,
size_t* pConfigurationSize);

/**
* DEPRECATED.
* Returns a human readable version of the MoltenVK and Vulkan versions.
Expand Down
6 changes: 2 additions & 4 deletions MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm
Original file line number Diff line number Diff line change
Expand Up @@ -507,16 +507,14 @@
#endif

// MoltenVK-specific instannce functions, not tied to a Vulkan API version or an extension.
ADD_INST_OPEN_ENTRY_POINT(vkGetMoltenVKConfiguration2MVK);
ADD_INST_OPEN_ENTRY_POINT(vkSetMoltenVKConfiguration2MVK);
ADD_INST_OPEN_ENTRY_POINT(vkGetMoltenVKConfigurationMVK);
ADD_INST_OPEN_ENTRY_POINT(vkSetMoltenVKConfigurationMVK);
ADD_INST_OPEN_ENTRY_POINT(vkGetPhysicalDeviceMetalFeaturesMVK);
ADD_INST_OPEN_ENTRY_POINT(vkGetPerformanceStatisticsMVK);

// For deprecated MoltenVK-specific functions, suppress compiler deprecation warning.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
ADD_INST_EXT_ENTRY_POINT(vkGetMoltenVKConfigurationMVK, MVK_MOLTENVK);
ADD_INST_EXT_ENTRY_POINT(vkSetMoltenVKConfigurationMVK, MVK_MOLTENVK);
ADD_INST_EXT_ENTRY_POINT(vkGetVersionStringsMVK, MVK_MOLTENVK);
ADD_INST_EXT_ENTRY_POINT(vkGetMTLDeviceMVK, MVK_MOLTENVK);
ADD_INST_EXT_ENTRY_POINT(vkSetMTLTextureMVK, MVK_MOLTENVK);
Expand Down
2 changes: 1 addition & 1 deletion MoltenVK/MoltenVK/Layers/MVKExtensions.mm
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ static bool mvkIsSupportedOnPlatform(VkExtensionProperties* pProperties) {
enable(extnName);
if (mvkStringsAreEqual(extnName, VK_MVK_MOLTENVK_EXTENSION_NAME)) {
reportMessage(MVK_CONFIG_LOG_LEVEL_WARNING, "Extension %s is deprecated. For access to Metal objects, use extension %s. "
"For MoltenVK configuration, use the global vkGetMoltenVKConfiguration2MVK() and vkSetMoltenVKConfiguration2MVK() functions.",
"For MoltenVK configuration, use the global vkGetMoltenVKConfigurationMVK() and vkSetMoltenVKConfigurationMVK() functions.",
VK_MVK_MOLTENVK_EXTENSION_NAME, VK_EXT_METAL_OBJECTS_EXTENSION_NAME);
}
}
Expand Down
22 changes: 4 additions & 18 deletions MoltenVK/MoltenVK/Vulkan/mvk_api.mm
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ VkResult mvkCopyGrowingStruct(S* pDst, const S* pSrc, size_t* pCopySize) {
#pragma mark -
#pragma mark mvk_config.h

MVK_PUBLIC_VULKAN_SYMBOL VkResult vkGetMoltenVKConfiguration2MVK(
MVK_PUBLIC_VULKAN_SYMBOL VkResult vkGetMoltenVKConfigurationMVK(
VkInstance ignored,
MVKConfiguration* pConfiguration,
size_t* pConfigurationSize) {

return mvkCopyGrowingStruct(pConfiguration, &mvkConfig(), pConfigurationSize);
}

MVK_PUBLIC_VULKAN_SYMBOL VkResult vkSetMoltenVKConfiguration2MVK(
MVK_PUBLIC_VULKAN_SYMBOL VkResult vkSetMoltenVKConfigurationMVK(
VkInstance ignored,
const MVKConfiguration* pConfiguration,
size_t* pConfigurationSize) {

Expand Down Expand Up @@ -100,22 +102,6 @@ MVK_PUBLIC_VULKAN_SYMBOL VkResult vkGetPerformanceStatisticsMVK(
#pragma mark -
#pragma mark mvk_deprecated_api.h

MVK_PUBLIC_VULKAN_SYMBOL VkResult vkGetMoltenVKConfigurationMVK(
VkInstance ignored,
MVKConfiguration* pConfiguration,
size_t* pConfigurationSize) {

return vkGetMoltenVKConfiguration2MVK(pConfiguration, pConfigurationSize);
}

MVK_PUBLIC_VULKAN_SYMBOL VkResult vkSetMoltenVKConfigurationMVK(
VkInstance ignored,
const MVKConfiguration* pConfiguration,
size_t* pConfigurationSize) {

return vkSetMoltenVKConfiguration2MVK(pConfiguration, pConfigurationSize);
}

MVK_PUBLIC_VULKAN_SYMBOL void vkGetVersionStringsMVK(
char* pMoltenVersionStringBuffer,
uint32_t moltenVersionStringBufferLength,
Expand Down

0 comments on commit af9544d

Please sign in to comment.