Code: Select all
./PhysicsEngine -r
zsh: segmentation fault ./PhysicsEngine -r
[*] Der Segmentierungsfehler erfolgt spezifisch bei:
Code: Select all
vkCreateSwapchainKHR(P_LogicalDevice, &CreateInfo, nullptr, &P_Swapchain);
< /code>
< /li>
Anrufstapel: < /p>
[Unknown/Just-In-Time compiled code] (Unknown Source:0)
PhysicsEngine!App::CreateSwapchain() (/Users/tibecornelis/Documents/Programming/PhysicsEngine/Main/Source/App.cpp:157)
PhysicsEngine!App::InitVulkan() (/Users/tibecornelis/Documents/Programming/PhysicsEngine/Main/Source/App.cpp:409)
PhysicsEngine!App::run() (/Users/tibecornelis/Documents/Programming/PhysicsEngine/Main/Source/App.cpp:19)
PhysicsEngine!RunApp() (/Users/tibecornelis/Documents/Programming/PhysicsEngine/Main/Source/App.cpp:531)
PhysicsEngine!main (/Users/tibecornelis/Documents/Programming/PhysicsEngine/Main/Source/main.cpp:104)
start (Unknown Source:0)
< /code>
< /li>
Systemspezifikationen: < /p>
[b] macOS [/b]: M3 MacBook Pro
[*] [b] OSX [/b]: Sonoma Version 14.6.1
< /ul>
< /li>
< /ul>
[b] Zusätzliche Informationen < /strong> < /h3>
[*] Der Vulkan -Dreieckstest aus dem Quellcode wird erfolgreich ausgeführt und zeigt an, dass Vulkan selbst korrekt installiert und funktional ist. < /li>
< /ul>
Relevante Code -Snippets [/b]
[h4] [b] Swapchain -Erstellungsfunktion [/b] [/h4]
void App::CreateSwapchain()
{
SwapchainSupportDetails mySwapchainSupportDetails = QuerySwapChainSupport(P_GPU);
VkSurfaceFormatKHR mySurfaceFormat = ChooseSwapchainSurfaceFormat(mySwapchainSupportDetails.surfaceFormats);
VkPresentModeKHR myPresentMode = ChooseSwapchainPresentMode(mySwapchainSupportDetails.presentModes);
VkExtent2D myExtent = ChooseSwapchainExtent(mySwapchainSupportDetails.surfaceCapabilities);
uint32_t MinimumImageCount = mySwapchainSupportDetails.surfaceCapabilities.minImageCount + 1;
if (mySwapchainSupportDetails.surfaceCapabilities.maxImageCount > 0 &&
MinimumImageCount > mySwapchainSupportDetails.surfaceCapabilities.maxImageCount)
{
MinimumImageCount = mySwapchainSupportDetails.surfaceCapabilities.maxImageCount;
}
VkSwapchainCreateInfoKHR CreateInfo{};
CreateInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
CreateInfo.surface = P_Surface;
CreateInfo.minImageCount = MinimumImageCount;
CreateInfo.imageFormat = mySurfaceFormat.format;
CreateInfo.imageColorSpace = mySurfaceFormat.colorSpace;
CreateInfo.imageExtent = myExtent;
CreateInfo.imageArrayLayers = 1;
CreateInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT;
QueueFamilyIndices myFamilyIndices = FindQueueFamilies(P_GPU);
uint32_t QueueFamilyIndices[] = {myFamilyIndices.graphicsFamily.value(), myFamilyIndices.presentFamily.value()};
if (myFamilyIndices.graphicsFamily != myFamilyIndices.presentFamily)
{
CreateInfo.imageSharingMode = VK_SHARING_MODE_CONCURRENT;
CreateInfo.queueFamilyIndexCount = 2;
CreateInfo.pQueueFamilyIndices = QueueFamilyIndices;
}
else
{
CreateInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
}
CreateInfo.preTransform = mySwapchainSupportDetails.surfaceCapabilities.currentTransform;
CreateInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
CreateInfo.presentMode = myPresentMode;
CreateInfo.clipped = VK_TRUE;
CreateInfo.oldSwapchain = VK_NULL_HANDLE;
if (vkCreateSwapchainKHR(P_LogicalDevice, &CreateInfo, nullptr, &P_Swapchain) != VK_SUCCESS)
{
throw std::runtime_error("Error : Failed to create swapchain");
}
}
< /code>
< /h3>
[b] Schritte zur Fehlerbehebung >
Verifizierte Vulkan -Installation: [/b] Vulkan SDK -Installation und GLFW Vulkan -Unterstützung
[*] [b] Überprüfte Swapchain -Unterstützung: [/b] verwendet QuerysWapchainsupport ()
Fragen < /strong> < /h3>
[*] Was könnte das verursachen Segmentierungsfehler auf vkcreateSwapchainkhr () ? macOS? /p>
Welche Validierungsebenen eignen sich am besten für macOS, um dieses Problem zu diagnostizieren? [/b]
< /li>
< /ol>
Alle Anleitungen oder Debugging -Vorschläge wären sehr geschätzt! < /p>