From 3fbd60d8f388618ece247f9b6ffc93d19a4c3511 Mon Sep 17 00:00:00 2001 From: "Richard S. Wright Jr" Date: Fri, 12 Apr 2024 07:25:53 -0400 Subject: [PATCH] Updates and tweaks for iOS builds (#202) * Added cmake support * CMAKE updates * cmake update * Linux updates * Linux for real this time * Added build instructions * iOS updates and fixes --- iOS/Info.plist | 8 ++++-- settingsDialog.cpp | 4 +-- submitDialog.cpp | 7 +++-- vulkancapsviewer.cpp | 68 ++++++++++++++++++++++---------------------- 4 files changed, 45 insertions(+), 42 deletions(-) diff --git a/iOS/Info.plist b/iOS/Info.plist index fe8a976..685071e 100644 --- a/iOS/Info.plist +++ b/iOS/Info.plist @@ -9,15 +9,17 @@ CFBundleExecutable Vulkan Caps Viewer CFBundleIconName - vulkanCapsViewer.png + AppIcon CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 CFBundleName Vulkan Caps Viewer CFBundlePackageType APPL CFBundleShortVersionString - 1.0 + 1.17 CFBundleSignature ???? CFBundleSupportedPlatforms @@ -45,7 +47,7 @@ LSRequiresIPhoneOS MinimumOSVersion - 12.0 + 15.0 NOTE Ported to iOS by LunarG UIDeviceFamily diff --git a/settingsDialog.cpp b/settingsDialog.cpp index 727a07a..75cc25f 100644 --- a/settingsDialog.cpp +++ b/settingsDialog.cpp @@ -69,8 +69,8 @@ settingsDialog::settingsDialog(Settings appSet) formLayout->addRow(tr("Use proxy settings for upload"), createCheckBox("checkBoxUseProxy")); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel())); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept()), Qt::QueuedConnection); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel()), Qt::QueuedConnection); formLayout->addWidget(buttonBox); diff --git a/submitDialog.cpp b/submitDialog.cpp index 4f8d5a7..eeda042 100644 --- a/submitDialog.cpp +++ b/submitDialog.cpp @@ -29,6 +29,7 @@ #include #include #include +#include SubmitDialog::SubmitDialog(QString submitter, QString caption) { @@ -57,13 +58,13 @@ SubmitDialog::SubmitDialog(QString submitter, QString caption) formLayout->addRow("Comment:", editComment); QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); - connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept())); - connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel())); + connect(buttonBox, SIGNAL(accepted()), this, SLOT(slotAccept()), Qt::QueuedConnection); + connect(buttonBox, SIGNAL(rejected()), this, SLOT(slotCancel()), Qt::QueuedConnection); formLayout->addWidget(buttonBox); setLayout(formLayout); - setWindowTitle(caption); + setWindowTitle(caption); } diff --git a/vulkancapsviewer.cpp b/vulkancapsviewer.cpp index d1fbfcb..d6d1dbc 100644 --- a/vulkancapsviewer.cpp +++ b/vulkancapsviewer.cpp @@ -71,9 +71,13 @@ #include #endif +#ifdef __APPLE__ +#include + #ifdef VK_USE_PLATFORM_IOS_MVK extern "C" const char *getWorkingFolderForiOS(void); #endif +#endif using std::to_string; @@ -169,15 +173,15 @@ VulkanCapsViewer::VulkanCapsViewer(QWidget *parent) ui.setupUi(this); setWindowTitle("Vulkan Hardware Capability Viewer " + version); // Connect slots - connect(ui.comboBoxGPU, SIGNAL(currentIndexChanged(int)), this, SLOT(slotComboBoxGPUIndexChanged(int))); - connect(ui.toolButtonUpload, SIGNAL(pressed()), this, SLOT(slotUploadReport())); - connect(ui.toolButtonSave, SIGNAL(pressed()), this, SLOT(slotSaveReport())); - connect(ui.toolButtonOnlineDevice, SIGNAL(pressed()), this, SLOT(slotDisplayOnlineReport())); - connect(ui.toolButtonOnlineDataBase, SIGNAL(pressed()), this, SLOT(slotBrowseDatabase())); - connect(ui.toolButtonAbout, SIGNAL(pressed()), this, SLOT(slotAbout())); - connect(ui.toolButtonExit, SIGNAL(pressed()), this, SLOT(slotClose())); - connect(ui.toolButtonSettings, SIGNAL(pressed()), this, SLOT(slotSettings())); - connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotComboTabChanged(int))); + connect(ui.comboBoxGPU, SIGNAL(currentIndexChanged(int)), this, SLOT(slotComboBoxGPUIndexChanged(int)), Qt::QueuedConnection); + connect(ui.toolButtonUpload, SIGNAL(pressed()), this, SLOT(slotUploadReport()), Qt::QueuedConnection); + connect(ui.toolButtonSave, SIGNAL(pressed()), this, SLOT(slotSaveReport()), Qt::QueuedConnection); + connect(ui.toolButtonOnlineDevice, SIGNAL(pressed()), this, SLOT(slotDisplayOnlineReport()), Qt::QueuedConnection); + connect(ui.toolButtonOnlineDataBase, SIGNAL(pressed()), this, SLOT(slotBrowseDatabase()), Qt::QueuedConnection); + connect(ui.toolButtonAbout, SIGNAL(pressed()), this, SLOT(slotAbout()), Qt::QueuedConnection); + connect(ui.toolButtonExit, SIGNAL(pressed()), this, SLOT(slotClose()), Qt::QueuedConnection); + connect(ui.toolButtonSettings, SIGNAL(pressed()), this, SLOT(slotSettings()), Qt::QueuedConnection); + connect(ui.comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(slotComboTabChanged(int)), Qt::QueuedConnection); qApp->setStyle(QStyleFactory::create("Fusion")); boldFont.setBold(true); @@ -618,13 +622,14 @@ bool VulkanCapsViewer::initVulkan() #if defined(VK_USE_PLATFORM_XCB_KHR) VK_KHR_XCB_SURFACE_EXTENSION_NAME, #endif -#if defined(VK_USE_PLATFORM_MACOS_MVK) - VK_MVK_MACOS_SURFACE_EXTENSION_NAME, -#endif - -#if defined(VK_USE_PLATFORM_IOS_MVK) - VK_MVK_IOS_SURFACE_EXTENSION_NAME, -#endif + +//#if defined(VK_USE_PLATFORM_MACOS_MVK) +// VK_MVK_MACOS_SURFACE_EXTENSION_NAME, +//#endif +// +//#if defined(VK_USE_PLATFORM_IOS_MVK) +// VK_MVK_IOS_SURFACE_EXTENSION_NAME, +//#endif }; std::vector enabledExtensions = {}; @@ -637,6 +642,10 @@ bool VulkanCapsViewer::initVulkan() if (availableExtensionCount != 0) { enabledExtensions.push_back(VK_KHR_SURFACE_EXTENSION_NAME); } + +#if __APPLE__ + enabledExtensions.push_back("VK_EXT_metal_surface"); +#endif std::vector surfaceExtensionsAvailable = {}; @@ -676,7 +685,7 @@ bool VulkanCapsViewer::initVulkan() } } -#if defined(VK_USE_PLATFORM_MACOS_MVK) && (VK_HEADER_VERSION >= 216) +#if defined(__APPLE__) && (VK_HEADER_VERSION >= 216) instanceCreateInfo.flags = VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR; enabledExtensions.push_back(VK_KHR_PORTABILITY_ENUMERATION_EXTENSION_NAME); enabledExtensions.push_back(VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME); @@ -802,25 +811,16 @@ bool VulkanCapsViewer::initVulkan() } #endif -#if defined(VK_USE_PLATFORM_MACOS_MVK) - if (surface_extension == VK_MVK_MACOS_SURFACE_EXTENSION_NAME) { - VkMacOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; - surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; - pMetalSurrogate = new QVukanSurrogate(); - surfaceCreateInfo.pView = (void*)pMetalSurrogate->winId(); - surfaceResult = vkCreateMacOSSurfaceMVK(vulkanContext.instance, &surfaceCreateInfo, nullptr, &vulkanContext.surface); - } +// This works for deskop and iOS devices +#if __APPLE__ + VkMetalSurfaceCreateInfoEXT info = {}; + info.sType = VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT; + info.pNext = nullptr; + info.pLayer = (void*)pMetalSurrogate->winId(); + info.flags = 0; + vkCreateMetalSurfaceEXT(vulkanContext.instance, &info, nullptr, &vulkanContext.surface); #endif -#if defined(VK_USE_PLATFORM_IOS_MVK) - if (surface_extension == VK_MVK_IOS_SURFACE_EXTENSION_NAME) { - VkIOSSurfaceCreateInfoMVK surfaceCreateInfo = {}; - surfaceCreateInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; - pMetalSurrogate = new QVukanSurrogate(); - surfaceCreateInfo.pView = (void*)pMetalSurrogate->winId(); - surfaceResult = vkCreateIOSSurfaceMVK(vulkanContext.instance, &surfaceCreateInfo, nullptr, &vulkanContext.surface); - } -#endif if (surfaceResult == VK_SUCCESS) { vulkanContext.surfaceExtension = surface_extension; break;