diff --git a/Project/Common/VulkanCommon.cpp b/Project/Common/VulkanCommon.cpp index 343e8c8..558ec77 100644 --- a/Project/Common/VulkanCommon.cpp +++ b/Project/Common/VulkanCommon.cpp @@ -612,7 +612,7 @@ namespace ApiWithoutSecrets { // Set of images defined in a swap chain may not always be available for application to render to: // One may be displayed and one may wait in a queue to be presented // If application wants to use more images at the same time it must ask for more images - uint32_t image_count = surface_capabilities.minImageCount + 1; + uint32_t image_count = surface_capabilities.minImageCount + 2; if( (surface_capabilities.maxImageCount > 0) && (image_count > surface_capabilities.maxImageCount) ) { image_count = surface_capabilities.maxImageCount; @@ -699,13 +699,20 @@ namespace ApiWithoutSecrets { } VkPresentModeKHR VulkanCommon::GetSwapChainPresentMode( std::vector &present_modes ) { - // FIFO present mode is always available // MAILBOX is the lowest latency V-Sync enabled mode (something like triple-buffering) so use it if available for( VkPresentModeKHR &present_mode : present_modes ) { if( present_mode == VK_PRESENT_MODE_MAILBOX_KHR ) { return present_mode; } } + // IMMEDIATE mode allows us to display frames in a V-Sync independent manner so it can introduce screen tearing + // But this mode is the best for benchmarking purposes if we want to check the real number of FPS + for( VkPresentModeKHR &present_mode : present_modes ) { + if( present_mode == VK_PRESENT_MODE_IMMEDIATE_KHR ) { + return present_mode; + } + } + // FIFO present mode is always available for( VkPresentModeKHR &present_mode : present_modes ) { if( present_mode == VK_PRESENT_MODE_FIFO_KHR ) { return present_mode; diff --git a/Project/Common/VulkanCommon.h b/Project/Common/VulkanCommon.h index 1403f99..b239871 100644 --- a/Project/Common/VulkanCommon.h +++ b/Project/Common/VulkanCommon.h @@ -57,6 +57,40 @@ namespace ApiWithoutSecrets { } }; + // ************************************************************ // + // BufferParameters // + // // + // Vulkan Buffer's parameters container class // + // ************************************************************ // + struct BufferParameters { + VkBuffer Handle; + VkDeviceMemory Memory; + uint32_t Size; + + BufferParameters() : + Handle( VK_NULL_HANDLE ), + Memory( VK_NULL_HANDLE ), + Size( 0 ) { + } + }; + + // ************************************************************ // + // DescriptorParameters // + // // + // Container class for descriptor related resources // + // ************************************************************ // + struct DescriptorSetParameters { + VkDescriptorPool Pool; + VkDescriptorSetLayout Layout; + VkDescriptorSet Handle; + + DescriptorSetParameters() : + Pool( VK_NULL_HANDLE ), + Layout( VK_NULL_HANDLE ), + Handle( VK_NULL_HANDLE ) { + } + }; + // ************************************************************ // // SwapChainParameters // // // diff --git a/Project/Tutorials/03/Tutorial03.cpp b/Project/Tutorials/03/Tutorial03.cpp index c4b8d61..398ecdd 100644 --- a/Project/Tutorials/03/Tutorial03.cpp +++ b/Project/Tutorials/03/Tutorial03.cpp @@ -19,8 +19,7 @@ namespace ApiWithoutSecrets { - Tutorial03::Tutorial03() : - Vulkan() { + Tutorial03::Tutorial03() { } bool Tutorial03::CreateRenderPass() { diff --git a/Project/Tutorials/04/Tutorial04.cpp b/Project/Tutorials/04/Tutorial04.cpp index a2584a8..8cfe250 100644 --- a/Project/Tutorials/04/Tutorial04.cpp +++ b/Project/Tutorials/04/Tutorial04.cpp @@ -20,8 +20,7 @@ namespace ApiWithoutSecrets { - Tutorial04::Tutorial04() : - Vulkan() { + Tutorial04::Tutorial04() { } bool Tutorial04::CreateRenderPass() { diff --git a/Project/Tutorials/04/Tutorial04.h b/Project/Tutorials/04/Tutorial04.h index 9db8cc0..dbe8d95 100644 --- a/Project/Tutorials/04/Tutorial04.h +++ b/Project/Tutorials/04/Tutorial04.h @@ -22,23 +22,6 @@ namespace ApiWithoutSecrets { - // ************************************************************ // - // BufferParameters // - // // - // Vulkan Buffer's parameters container class // - // ************************************************************ // - struct BufferParameters { - VkBuffer Handle; - VkDeviceMemory Memory; - uint32_t Size; - - BufferParameters() : - Handle( VK_NULL_HANDLE ), - Memory( VK_NULL_HANDLE ), - Size( 0 ) { - } - }; - // ************************************************************ // // VertexData // // // diff --git a/Project/Tutorials/05/Tutorial05.cpp b/Project/Tutorials/05/Tutorial05.cpp index 2f9e59b..5c2cfeb 100644 --- a/Project/Tutorials/05/Tutorial05.cpp +++ b/Project/Tutorials/05/Tutorial05.cpp @@ -19,8 +19,7 @@ namespace ApiWithoutSecrets { - Tutorial05::Tutorial05() : - Vulkan() { + Tutorial05::Tutorial05() { } bool Tutorial05::CreateRenderingResources() { diff --git a/Project/Tutorials/05/Tutorial05.h b/Project/Tutorials/05/Tutorial05.h index f8bef39..6bafabc 100644 --- a/Project/Tutorials/05/Tutorial05.h +++ b/Project/Tutorials/05/Tutorial05.h @@ -22,23 +22,6 @@ namespace ApiWithoutSecrets { - // ************************************************************ // - // BufferParameters // - // // - // Vulkan Buffer's parameters container class // - // ************************************************************ // - struct BufferParameters { - VkBuffer Handle; - VkDeviceMemory Memory; - uint32_t Size; - - BufferParameters() : - Handle( VK_NULL_HANDLE ), - Memory( VK_NULL_HANDLE ), - Size( 0 ) { - } - }; - // ************************************************************ // // VertexData // // // diff --git a/Project/Tutorials/06/Tutorial06.cpp b/Project/Tutorials/06/Tutorial06.cpp index 0a99b04..efbaa55 100644 --- a/Project/Tutorials/06/Tutorial06.cpp +++ b/Project/Tutorials/06/Tutorial06.cpp @@ -19,8 +19,7 @@ namespace ApiWithoutSecrets { - Tutorial06::Tutorial06() : - Vulkan() { + Tutorial06::Tutorial06() { } bool Tutorial06::CreateRenderingResources() { diff --git a/Project/Tutorials/06/Tutorial06.h b/Project/Tutorials/06/Tutorial06.h index c25cfe9..171972b 100644 --- a/Project/Tutorials/06/Tutorial06.h +++ b/Project/Tutorials/06/Tutorial06.h @@ -22,40 +22,6 @@ namespace ApiWithoutSecrets { - // ************************************************************ // - // BufferParameters // - // // - // Vulkan Buffer's parameters container class // - // ************************************************************ // - struct BufferParameters { - VkBuffer Handle; - VkDeviceMemory Memory; - uint32_t Size; - - BufferParameters() : - Handle( VK_NULL_HANDLE ), - Memory( VK_NULL_HANDLE ), - Size( 0 ) { - } - }; - - // ************************************************************ // - // DescriptorParameters // - // // - // Container class for descriptor related resources // - // ************************************************************ // - struct DescriptorSetParameters { - VkDescriptorPool Pool; - VkDescriptorSetLayout Layout; - VkDescriptorSet Handle; - - DescriptorSetParameters() : - Pool( VK_NULL_HANDLE ), - Layout( VK_NULL_HANDLE ), - Handle( VK_NULL_HANDLE ) { - } - }; - // ************************************************************ // // VertexData // // // diff --git a/Project/Tutorials/07/Tutorial07.cpp b/Project/Tutorials/07/Tutorial07.cpp index 7154776..d7fca22 100644 --- a/Project/Tutorials/07/Tutorial07.cpp +++ b/Project/Tutorials/07/Tutorial07.cpp @@ -19,8 +19,7 @@ namespace ApiWithoutSecrets { - Tutorial07::Tutorial07() : - Vulkan() { + Tutorial07::Tutorial07() { } bool Tutorial07::CreateRenderingResources() { diff --git a/Project/Tutorials/07/Tutorial07.h b/Project/Tutorials/07/Tutorial07.h index 571bfe8..61b3c8f 100644 --- a/Project/Tutorials/07/Tutorial07.h +++ b/Project/Tutorials/07/Tutorial07.h @@ -22,40 +22,6 @@ namespace ApiWithoutSecrets { - // ************************************************************ // - // BufferParameters // - // // - // Vulkan Buffer's parameters container class // - // ************************************************************ // - struct BufferParameters { - VkBuffer Handle; - VkDeviceMemory Memory; - uint32_t Size; - - BufferParameters() : - Handle( VK_NULL_HANDLE ), - Memory( VK_NULL_HANDLE ), - Size( 0 ) { - } - }; - - // ************************************************************ // - // DescriptorParameters // - // // - // Container class for descriptor related resources // - // ************************************************************ // - struct DescriptorSetParameters { - VkDescriptorPool Pool; - VkDescriptorSetLayout Layout; - VkDescriptorSet Handle; - - DescriptorSetParameters() : - Pool( VK_NULL_HANDLE ), - Layout( VK_NULL_HANDLE ), - Handle( VK_NULL_HANDLE ) { - } - }; - // ************************************************************ // // VertexData // // //