質問内容
以下のエラーコードですが、発生する原因がわかりません。
調べたこと
- エラーコード部のコンソール出力のようにそのコードに達しているか、値を取得しているか確認
- ChatGPTにて
graphicsQueueFamilyIndex 0
が0
で正常であると確認 - 参考サイトを参考に
void Device()
を作成して物理デバイスの作成と論理デバイスを作成 graphicsQueueFamilyIndex 0
が僕の感覚では怪しいChatGPT
でエラーコードについて質問して無効なコマンドバッファ、無効なコマンドプールなどをヒントを得る
環境
OS: Windows 10
Terminal: msys2
vulkan-hpp: https://github.com/KhronosGroup/Vulkan-Hpp
現状
プログラムがint main()
の戻り値(return 0
)でプログラムが終了すると以下のエラーコードが出ます
参考サイト
入門サイト:https://chaosplant.tech/do/vulkan/2-4/
その他: ChatGPT,gemini
エラーコード
queueProps.size() 5 find 0 graphicsQueueFamilyIndex 0 VUID-vkFreeCommandBuffers-commandPool-parameter(ERROR / SPEC): msgNum: 554912453 - Validation Error: [ VUID-vkFreeCommandBuffers-commandPool-p arameter ] Object 0: handle = 0x1d1c086ed70, type = VK_OBJECT_TYPE_INSTANCE; | MessageID = 0x21134ac5 | vkFreeCommandBuffers(): commandPool In valid VkCommandPool Object 0xfd5b260000000001. The Vulkan spec states: commandPool must be a valid VkCommandPool handle (https://vulkan.lunarg.com/doc/view/1.3.296.0/windows/1.3-extensions/ vkspec.html#VUID-vkFreeCommandBuffers-commandPool-parameter) Objects: 1 [0] 0x1d1c086ed70, type: 1, name: NULL VUID-vkFreeCommandBuffers-pCommandBuffers-00048(ERROR / SPEC): msgNum: 515182009 - Validation Error: [ VUID-vkFreeCommandBuffers-pCommandBuffe rs-00048 ] Object 0: handle = 0x1d1c2915e30, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x1eb50db9 | vkFreeCommandBuffers(): pCommand Buffers[0] Invalid VkCommandBuffer 0x1d1c2915e30[]. The Vulkan spec states: pCommandBuffers must be a valid pointer to an array of commandBufferCount VkCommandBuffer handles, each element of whi ch must either be a valid handle or NULL (https://vulkan.lunarg.com/doc/view/1.3.296.0/windows/1.3-extensions/vkspec.html#VUID-vkFreeCommandBu ffers-pCommandBuffers-00048) Objects: 1 [0] 0x1d1c2915e30, type: 6, name: NULL UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 1567320034 - Validation Error: [ UNASSIGNED-Threading-Info ] Object 0: handle = 0xfd5b2600000 00001, type = VK_OBJECT_TYPE_COMMAND_POOL; | MessageID = 0x5d6b67e2 | vkFreeCommandBuffers(): Couldn't find VkCommandPool Object 0xfd5b260000 000001. This should not happen and may indicate a bug in the application. Objects: 1 [0] 0xfd5b260000000001, type: 25, name: NULL UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 1567320034 - Validation Error: [ UNASSIGNED-Threading-Info ] Object 0: handle = 0x1d1c2915e30 , type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x5d6b67e2 | vkFreeCommandBuffers(): Couldn't find VkCommandBuffer Object 0x1d1c2915e30 . This should not happen and may indicate a bug in the application. Objects: 1 [0] 0x1d1c2915e30, type: 6, name: NULL UNASSIGNED-Threading-Info(ERROR / SPEC): msgNum: 1567320034 - Validation Error: [ UNASSIGNED-Threading-Info ] Object 0: handle = 0x1d1c2915e30 , type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID = 0x5d6b67e2 | vkFreeCommandBuffers(): Couldn't find VkCommandBuffer Object 0x1d1c2915e30 . This should not happen and may indicate a bug in the application. Objects: 1 [0] 0x1d1c2915e30, type: 6, name: NULL test.sh: line 6: 1062 Segmentation fault ./test/build/game.exe
提示コード
cpp
1 2 void Device() 3 { 4 // 物理デバイスを選択 5 std::vector<vk::PhysicalDevice> physicalDeviceList = instance->enumeratePhysicalDevices(); 6 if(physicalDeviceList.empty()) 7 { 8 std::cerr << "No physical devices found!" << std::endl; 9 Quit(); 10 } 11 12 bool existsSuitablePhysicalDevice = false; 13 for(size_t i = 0; i < physicalDeviceList.size(); i++) 14 { 15 std::vector<vk::QueueFamilyProperties> queueProps = physicalDeviceList[i].getQueueFamilyProperties(); 16 bool existsGraphicsQueue = false; 17 18 std::cout<<" queueProps.size() "<<queueProps.size()<<std::endl; 19 for(size_t j = 0; j < queueProps.size(); j++) 20 { 21 if(queueProps[j].queueFlags & vk::QueueFlagBits::eGraphics) 22 { 23 std::cout<<" find "<< j <<std::endl; 24 existsGraphicsQueue = true; 25 graphicsQueueFamilyIndex = j; 26 break; 27 } 28 } 29 30 if(existsGraphicsQueue == true) 31 { 32 physicalDevice = physicalDeviceList[i]; 33 existsSuitablePhysicalDevice = true; 34 break; 35 } 36 } 37 38 if(existsSuitablePhysicalDevice == false) 39 { 40 std::cerr << "Error 使用可能な物理デバイスがありません。" << std::endl; 41 Quit(); 42 } 43 44 vk::DeviceCreateInfo devCreateInfo; 45 vk::DeviceQueueCreateInfo queueCreateInfo[1]; 46 queueCreateInfo[0].queueFamilyIndex = graphicsQueueFamilyIndex; 47 queueCreateInfo[0].queueCount = 1; 48 49 float queuePriorities[1] = { 1.0 }; 50 51 queueCreateInfo[0].pQueuePriorities = queuePriorities; 52 53 devCreateInfo.pQueueCreateInfos = queueCreateInfo; 54 devCreateInfo.queueCreateInfoCount = 1; 55 device = physicalDevice.createDeviceUnique(devCreateInfo); 56 57 58 59 } 60 61 void CommandBuffer() 62 { 63 std::cout<<" graphicsQueueFamilyIndex "<<graphicsQueueFamilyIndex<<std::endl; 64 65 vk::CommandPoolCreateInfo cmdPoolCreateInfo; 66 cmdPoolCreateInfo.queueFamilyIndex = graphicsQueueFamilyIndex; 67 68 try 69 { 70 commandPool = device->createCommandPoolUnique(cmdPoolCreateInfo); 71 } 72 catch(const vk::SystemError& e) 73 { 74 std::cout <<"Error: "<< e.what() << '\n'; 75 } 76 77 vk::CommandBufferAllocateInfo cmdBufAllocInfo; 78 cmdBufAllocInfo.commandPool = commandPool.get(); 79 cmdBufAllocInfo.commandBufferCount = 1; 80 cmdBufAllocInfo.level = vk::CommandBufferLevel::ePrimary; 81 82 commandBufferList = device->allocateCommandBuffersUnique(cmdBufAllocInfo); 83 } 84
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2024/11/18 14:26
2024/11/18 14:30
2024/11/18 14:36