Merge branch 'ParticlePeter-g_FrameIndex_not_used_fix'

This commit is contained in:
omar 2017-05-01 16:23:27 +02:00
commit 55be2f0722

View File

@ -12,6 +12,7 @@
#include "imgui_impl_glfw_vulkan.h" #include "imgui_impl_glfw_vulkan.h"
#define IMGUI_MAX_POSSIBLE_BACK_BUFFERS 16 #define IMGUI_MAX_POSSIBLE_BACK_BUFFERS 16
#define IMGUI_UNLIMITED_FRAME_RATE
static VkAllocationCallbacks* g_Allocator = NULL; static VkAllocationCallbacks* g_Allocator = NULL;
static VkInstance g_Instance = VK_NULL_HANDLE; static VkInstance g_Instance = VK_NULL_HANDLE;
@ -83,7 +84,12 @@ static void resize_vulkan(GLFWwindow* /*window*/, int w, int h)
info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; info.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE;
info.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR; info.preTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; info.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR;
#ifdef IMGUI_UNLIMITED_FRAME_RATE
info.presentMode = VK_PRESENT_MODE_IMMEDIATE_KHR;
#else
info.presentMode = VK_PRESENT_MODE_FIFO_KHR; info.presentMode = VK_PRESENT_MODE_FIFO_KHR;
#endif
info.clipped = VK_TRUE; info.clipped = VK_TRUE;
info.oldSwapchain = old_swapchain; info.oldSwapchain = old_swapchain;
VkSurfaceCapabilitiesKHR cap; VkSurfaceCapabilitiesKHR cap;
@ -93,6 +99,7 @@ static void resize_vulkan(GLFWwindow* /*window*/, int w, int h)
info.minImageCount = (cap.minImageCount + 2 < cap.maxImageCount) ? (cap.minImageCount + 2) : cap.maxImageCount; info.minImageCount = (cap.minImageCount + 2 < cap.maxImageCount) ? (cap.minImageCount + 2) : cap.maxImageCount;
else else
info.minImageCount = cap.minImageCount + 2; info.minImageCount = cap.minImageCount + 2;
if (cap.currentExtent.width == 0xffffffff) if (cap.currentExtent.width == 0xffffffff)
{ {
fb_width = w; fb_width = w;
@ -462,7 +469,7 @@ static void frame_end()
check_vk_result(err); check_vk_result(err);
check_vk_result(res); check_vk_result(res);
} }
g_FrameIndex = (g_FrameIndex) % IMGUI_VK_QUEUED_FRAMES; g_FrameIndex = (g_FrameIndex+1) % IMGUI_VK_QUEUED_FRAMES;
} }
static void error_callback(int error, const char* description) static void error_callback(int error, const char* description)