增加GetDeviceQueue代码,,,,会崩溃(原因未知)

This commit is contained in:
HuYingzhuo 2019-04-19 13:43:50 +08:00
parent d9b0739c4d
commit 9ad7a3cd70
3 changed files with 17 additions and 0 deletions

View File

@ -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

View File

@ -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<VkQueueFamilyProperties> family_properties;
List<VkBool32> supports_present;

View File

@ -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)