mirror of
https://github.com/Drezil/imgui.git
synced 2024-11-15 09:27:00 +00:00
Examples: Vulkan: Coding style fixes (#910)
This commit is contained in:
parent
a5600b6e59
commit
127dd7c88c
@ -217,10 +217,12 @@ static void setup_vulkan(GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties(g_Gpu, &count, NULL);
|
vkGetPhysicalDeviceQueueFamilyProperties(g_Gpu, &count, NULL);
|
||||||
VkQueueFamilyProperties *queues = (VkQueueFamilyProperties*)malloc(sizeof(VkQueueFamilyProperties)*count);
|
VkQueueFamilyProperties* queues = (VkQueueFamilyProperties*)malloc(sizeof(VkQueueFamilyProperties) * count);
|
||||||
vkGetPhysicalDeviceQueueFamilyProperties(g_Gpu, &count, queues);
|
vkGetPhysicalDeviceQueueFamilyProperties(g_Gpu, &count, queues);
|
||||||
for(uint32_t i=0; i<count; i++){
|
for (uint32_t i = 0; i < count; i++)
|
||||||
if(queues[i].queueFlags & VK_QUEUE_GRAPHICS_BIT){
|
{
|
||||||
|
if (queues[i].queueFlags & VK_QUEUE_GRAPHICS_BIT)
|
||||||
|
{
|
||||||
g_QueueFamily = i;
|
g_QueueFamily = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -232,7 +234,8 @@ static void setup_vulkan(GLFWwindow* window)
|
|||||||
{
|
{
|
||||||
VkBool32 res;
|
VkBool32 res;
|
||||||
vkGetPhysicalDeviceSurfaceSupportKHR(g_Gpu, g_QueueFamily, g_Surface, &res);
|
vkGetPhysicalDeviceSurfaceSupportKHR(g_Gpu, g_QueueFamily, g_Surface, &res);
|
||||||
if(res != VK_TRUE){
|
if (res != VK_TRUE)
|
||||||
|
{
|
||||||
fprintf(stderr, "Error no WSI support on physical device 0\n");
|
fprintf(stderr, "Error no WSI support on physical device 0\n");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
@ -240,15 +243,17 @@ static void setup_vulkan(GLFWwindow* window)
|
|||||||
|
|
||||||
// Get Surface Format
|
// Get Surface Format
|
||||||
{
|
{
|
||||||
VkFormat image_view_format[][2] = {{VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM},
|
VkFormat image_view_format[][2] = {{VK_FORMAT_B8G8R8A8_UNORM, VK_FORMAT_B8G8R8A8_UNORM}, {VK_FORMAT_B8G8R8A8_SRGB, VK_FORMAT_B8G8R8A8_UNORM}};
|
||||||
{VK_FORMAT_B8G8R8A8_SRGB, VK_FORMAT_B8G8R8A8_UNORM}};
|
|
||||||
uint32_t count;
|
uint32_t count;
|
||||||
vkGetPhysicalDeviceSurfaceFormatsKHR(g_Gpu, g_Surface, &count, NULL);
|
vkGetPhysicalDeviceSurfaceFormatsKHR(g_Gpu, g_Surface, &count, NULL);
|
||||||
VkSurfaceFormatKHR *formats = (VkSurfaceFormatKHR*)malloc(sizeof(VkSurfaceFormatKHR)*count);
|
VkSurfaceFormatKHR *formats = (VkSurfaceFormatKHR*)malloc(sizeof(VkSurfaceFormatKHR) * count);
|
||||||
vkGetPhysicalDeviceSurfaceFormatsKHR(g_Gpu, g_Surface, &count, formats);
|
vkGetPhysicalDeviceSurfaceFormatsKHR(g_Gpu, g_Surface, &count, formats);
|
||||||
for(size_t i=0; i<sizeof(image_view_format)/sizeof(image_view_format[0]); i++){
|
for (size_t i = 0; i < sizeof(image_view_format) / sizeof(image_view_format[0]); i++)
|
||||||
for(uint32_t j=0; j<count; j++){
|
{
|
||||||
if(formats[j].format == image_view_format[i][0]){
|
for (uint32_t j = 0; j < count; j++)
|
||||||
|
{
|
||||||
|
if (formats[j].format == image_view_format[i][0])
|
||||||
|
{
|
||||||
g_ImageFormat = image_view_format[i][0];
|
g_ImageFormat = image_view_format[i][0];
|
||||||
g_ViewFormat = image_view_format[i][1];
|
g_ViewFormat = image_view_format[i][1];
|
||||||
g_ColorSpace = formats[j].colorSpace;
|
g_ColorSpace = formats[j].colorSpace;
|
||||||
|
Loading…
Reference in New Issue
Block a user