diff --git a/example/Vulkan/CMakeLists.txt b/example/Vulkan/CMakeLists.txt index 93b0c440..429e50ee 100644 --- a/example/Vulkan/CMakeLists.txt +++ b/example/Vulkan/CMakeLists.txt @@ -23,6 +23,7 @@ SET(VULKAN_TEST_SOURCE_FILES main.cpp VKPipeline.cpp VKSemaphore.cpp VKFramebuffer.cpp + VKFence.cpp ) SET(VULKAN_TEST_HEADER_FILES VK.h @@ -42,6 +43,7 @@ SET(VULKAN_TEST_HEADER_FILES VK.h VKSemaphore.h VKPipeline.h VKFramebuffer.h + VKFence.h Window.h) SET(SHADER_FILES shader_compile.bat diff --git a/example/Vulkan/VKDeviceAttribute.h b/example/Vulkan/VKDeviceAttribute.h index 5667209a..29efde34 100644 --- a/example/Vulkan/VKDeviceAttribute.h +++ b/example/Vulkan/VKDeviceAttribute.h @@ -20,6 +20,9 @@ struct DeviceAttribute uint32_t graphics_family =ERROR_FAMILY_INDEX; uint32_t present_family =ERROR_FAMILY_INDEX; + VkQueue graphics_queue =nullptr; + VkQueue present_queue =nullptr; + List family_properties; List supports_present; diff --git a/example/Vulkan/VKDeviceCreater.cpp b/example/Vulkan/VKDeviceCreater.cpp index 0ed7f53f..b8f68091 100644 --- a/example/Vulkan/VKDeviceCreater.cpp +++ b/example/Vulkan/VKDeviceCreater.cpp @@ -64,6 +64,16 @@ namespace return nullptr; } + void GetDeviceQueue(DeviceAttribute *attr) + { + vkGetDeviceQueue(attr->device,attr->graphics_family,0,&attr->graphics_queue); + + if(attr->graphics_family==attr->present_family) + attr->present_queue=attr->graphics_queue; + else + vkGetDeviceQueue(attr->device,attr->present_family,0,&attr->present_queue); + } + VkCommandPool CreateCommandPool(VkDevice device,uint32_t graphics_family) { VkCommandPoolCreateInfo cmd_pool_info={}; @@ -327,6 +337,8 @@ Device *CreateRenderDevice(VkInstance inst,const PhysicalDevice *physical_device if(!rdc->device) return(nullptr); + GetDeviceQueue(rdc.attr); + rdc->cmd_pool=CreateCommandPool(rdc->device,rdc->graphics_family); if(!rdc->cmd_pool)