增加GetDeviceQueue代码,,,,会崩溃(原因未知)
This commit is contained in:
parent
d9b0739c4d
commit
9ad7a3cd70
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user