aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pugl_vulkan_cpp_demo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pugl_vulkan_cpp_demo.cpp')
-rw-r--r--examples/pugl_vulkan_cpp_demo.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp
index a1d6954..4a73157 100644
--- a/examples/pugl_vulkan_cpp_demo.cpp
+++ b/examples/pugl_vulkan_cpp_demo.cpp
@@ -17,13 +17,14 @@
#include "demo_utils.h"
#include "file_utils.h"
#include "rects.h"
-#include "test/test_utils.h"
#include "sybok.hpp"
-#include "pugl/pugl.h"
-#include "pugl/pugl.hpp"
-#include "pugl/vulkan.hpp"
+#include <puglutil/test_utils.h>
+
+#include <pugl/pugl.h>
+#include <pugl/pugl.hpp>
+#include <pugl/vulkan.hpp>
#include <vulkan/vk_platform.h>
@@ -559,7 +560,7 @@ Swapchain::init(const sk::VulkanApi& vk,
const auto minNumImages =
(!capabilities.maxImageCount || capabilities.maxImageCount >= 3U)
- ? 3U
+ ? std::max(capabilities.minImageCount, 3U)
: capabilities.maxImageCount;
const VkSwapchainCreateInfoKHR swapchainCreateInfo{
@@ -576,7 +577,7 @@ Swapchain::init(const sk::VulkanApi& vk,
VK_SHARING_MODE_EXCLUSIVE,
SK_COUNTED(0, nullptr),
capabilities.currentTransform,
- VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR,
+ VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR,
mode == RenderMode::resizing ? gpu.resizePresentMode : gpu.presentMode,
VK_TRUE,
oldSwapchain};
@@ -715,7 +716,12 @@ readFile(const char* const programPath, const std::string& filename)
}
fseek(file.get(), 0, SEEK_END);
- const auto fileSize = static_cast<size_t>(ftell(file.get()));
+ const auto filePos = ftell(file.get());
+ if (filePos <= 0) {
+ return {};
+ }
+
+ const auto fileSize = static_cast<size_t>(filePos);
fseek(file.get(), 0, SEEK_SET);
const auto numWords = fileSize / sizeof(uint32_t);