diff --git a/ExternalRevisions/SPIRV-Cross_repo_revision b/ExternalRevisions/SPIRV-Cross_repo_revision index bb8c3d06..511b7a38 100644 --- a/ExternalRevisions/SPIRV-Cross_repo_revision +++ b/ExternalRevisions/SPIRV-Cross_repo_revision @@ -1 +1 @@ -52f26ee73648a25e9465035a55b276898f453830 +ed16b3e69985feaf565efbecea70a1cc2fca2a58 diff --git a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h index 5dc90805..ccd9b6a8 100644 --- a/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h +++ b/MoltenVK/MoltenVK/API/vk_mvk_moltenvk.h @@ -48,7 +48,7 @@ extern "C" { */ #define MVK_VERSION_MAJOR 1 #define MVK_VERSION_MINOR 0 -#define MVK_VERSION_PATCH 28 +#define MVK_VERSION_PATCH 29 #define MVK_MAKE_VERSION(major, minor, patch) (((major) * 10000) + ((minor) * 100) + (patch)) #define MVK_VERSION MVK_MAKE_VERSION(MVK_VERSION_MAJOR, MVK_VERSION_MINOR, MVK_VERSION_PATCH) diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm index 0361cfb9..384bff85 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm +++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm @@ -524,15 +524,21 @@ void MVKPhysicalDevice::initMetalFeatures() { _metalFeatures.dynamicMTLBuffers = true; _metalFeatures.maxTextureDimension = (8 * KIBI); } + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v3] ) { _metalFeatures.mslVersion = SPIRVToMSLConverterOptions::makeMSLVersion(1, 2); _metalFeatures.shaderSpecialization = true; _metalFeatures.stencilViews = true; } + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v4] ) { _metalFeatures.mslVersion = SPIRVToMSLConverterOptions::makeMSLVersion(2); } + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v5] ) { + _metalFeatures.mslVersion = SPIRVToMSLConverterOptions::makeMSLVersion(2, 1); + } + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily3_v1] ) { _metalFeatures.indirectDrawing = true; _metalFeatures.baseVertexInstanceDrawing = true; @@ -566,6 +572,7 @@ void MVKPhysicalDevice::initMetalFeatures() { } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily1_v4] ) { + _metalFeatures.mslVersion = SPIRVToMSLConverterOptions::makeMSLVersion(2, 1); _metalFeatures.multisampleArrayTextures = true; } @@ -1204,20 +1211,26 @@ void MVKPhysicalDevice::logGPUInfo() { logMsg += "\n\t\tvendorID: %#06x"; logMsg += "\n\t\tdeviceID: %#06x"; logMsg += "\n\t\tpipelineCacheUUID: %s"; - logMsg += "\n\tsupports the following Metal Feature Sets:"; + logMsg += "\n\tsupports Metal Shading Language version %s and the following Metal Feature Sets:"; #if MVK_IOS - if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily4_v1] ) { logMsg += "\n\t\tiOS GPU Family 4 v1"; } + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily5_v1] ) { logMsg += "\n\t\tiOS GPU Family 5 v1"; } + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily4_v2] ) { logMsg += "\n\t\tiOS GPU Family 4 v2"; } + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily4_v1] ) { logMsg += "\n\t\tiOS GPU Family 4 v1"; } + + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily3_v4] ) { logMsg += "\n\t\tiOS GPU Family 3 v4"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily3_v3] ) { logMsg += "\n\t\tiOS GPU Family 3 v3"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily3_v2] ) { logMsg += "\n\t\tiOS GPU Family 3 v2"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily3_v1] ) { logMsg += "\n\t\tiOS GPU Family 3 v1"; } + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily2_v5] ) { logMsg += "\n\t\tiOS GPU Family 2 v5"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily2_v4] ) { logMsg += "\n\t\tiOS GPU Family 2 v4"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily2_v3] ) { logMsg += "\n\t\tiOS GPU Family 2 v3"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily2_v2] ) { logMsg += "\n\t\tiOS GPU Family 2 v2"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily2_v1] ) { logMsg += "\n\t\tiOS GPU Family 2 v1"; } + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v5] ) { logMsg += "\n\t\tiOS GPU Family 1 v5"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v4] ) { logMsg += "\n\t\tiOS GPU Family 1 v4"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v3] ) { logMsg += "\n\t\tiOS GPU Family 1 v3"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_iOS_GPUFamily1_v2] ) { logMsg += "\n\t\tiOS GPU Family 1 v2"; } @@ -1225,13 +1238,20 @@ void MVKPhysicalDevice::logGPUInfo() { #endif #if MVK_MACOS + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily2_v1] ) { logMsg += "\n\t\tmacOS GPU Family 2 v1"; } + + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily1_v4] ) { logMsg += "\n\t\tmacOS GPU Family 1 v4"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily1_v3] ) { logMsg += "\n\t\tmacOS GPU Family 1 v3"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily1_v2] ) { logMsg += "\n\t\tmacOS GPU Family 1 v2"; } if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_macOS_GPUFamily1_v1] ) { logMsg += "\n\t\tmacOS GPU Family 1 v1"; } + + if ( [_mtlDevice supportsFeatureSet: MTLFeatureSet_macOS_ReadWriteTextureTier2] ) { logMsg += "\n\t\tmacOS Read-Write Texture Tier 2"; } + #endif MVKLogInfo(logMsg.c_str(), _properties.deviceName, devTypeStr.c_str(), _properties.vendorID, _properties.deviceID, - [[[NSUUID alloc] initWithUUIDBytes: _properties.pipelineCacheUUID] autorelease].UUIDString.UTF8String); + [[[NSUUID alloc] initWithUUIDBytes: _properties.pipelineCacheUUID] autorelease].UUIDString.UTF8String, + SPIRVToMSLConverterOptions::printMSLVersion(_metalFeatures.mslVersion).c_str()); } // Initializes the queue families supported by this instance. diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm b/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm index 3acd3d47..462fe40f 100644 --- a/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm +++ b/MoltenVK/MoltenVK/GPUObjects/MVKInstance.mm @@ -137,6 +137,10 @@ MVKInstance::MVKInstance(const VkInstanceCreateInfo* pCreateInfo) { if (_physicalDevices.empty()) { setConfigurationResult(mvkNotifyErrorWithText(VK_ERROR_INCOMPATIBLE_DRIVER, "Vulkan is not supported on this device. MoltenVK requires Metal, which is not available on this device.")); } + + string logMsg = "Created VkInstance with the following Vulkan extensions enabled:"; + logMsg += _enabledExtensions.enabledNamesString("\n\t\t", true); + MVKLogInfo("%s", logMsg.c_str()); } #define ADD_PROC_ADDR(entrypoint) _procAddrMap[""#entrypoint] = (PFN_vkVoidFunction)&entrypoint; @@ -339,12 +343,9 @@ void MVKInstance::logVersions() { char vkVer[buffLen]; vkGetVersionStringsMVK(mvkVer, buffLen, vkVer, buffLen); - const char* indent = "\n\t\t"; string logMsg = "MoltenVK version %s. Vulkan version %s."; logMsg += "\n\tThe following Vulkan extensions are supported:"; - logMsg += getDriverLayer()->getSupportedExtensions()->enabledNamesString(indent, true); - logMsg += "\n\tCreated VkInstance with the following Vulkan extensions enabled:"; - logMsg += _enabledExtensions.enabledNamesString(indent, true); + logMsg += getDriverLayer()->getSupportedExtensions()->enabledNamesString("\n\t\t", true); MVKLogInfo(logMsg.c_str(), mvkVer, vkVer); } diff --git a/MoltenVKShaderConverter/MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.cpp b/MoltenVKShaderConverter/MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.cpp index 8752a727..ee6be256 100644 --- a/MoltenVKShaderConverter/MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.cpp +++ b/MoltenVKShaderConverter/MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.cpp @@ -49,6 +49,25 @@ MVK_PUBLIC_SYMBOL bool SPIRVToMSLConverterOptions::matches(const SPIRVToMSLConve return true; } +MVK_PUBLIC_SYMBOL std::string SPIRVToMSLConverterOptions::printMSLVersion(uint32_t mslVersion, bool includePatch) { + string verStr; + + uint32_t major = mslVersion / 10000; + verStr += to_string(major); + + uint32_t minor = (mslVersion - makeMSLVersion(major)) / 100; + verStr += "."; + verStr += to_string(minor); + + if (includePatch) { + uint32_t patch = mslVersion - makeMSLVersion(major, minor); + verStr += "."; + verStr += to_string(patch); + } + + return verStr; +} + MVK_PUBLIC_SYMBOL bool MSLVertexAttribute::matches(const MSLVertexAttribute& other) const { if (location != other.location) { return false; } if (mslBuffer != other.mslBuffer) { return false; } diff --git a/MoltenVKShaderConverter/MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.h b/MoltenVKShaderConverter/MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.h index f9dff22a..07bcb2ef 100644 --- a/MoltenVKShaderConverter/MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.h +++ b/MoltenVKShaderConverter/MoltenVKSPIRVToMSLConverter/SPIRVToMSLConverter.h @@ -66,6 +66,8 @@ namespace mvk { return (major * 10000) + (minor * 100) + patch; } + static std::string printMSLVersion(uint32_t mslVersion, bool includePatch = false); + } SPIRVToMSLConverterOptions; /**