diff options
author | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-05-01 22:11:54 +0200 |
---|---|---|
committer | Steven Le Rouzic <steven.lerouzic@gmail.com> | 2024-05-01 22:11:54 +0200 |
commit | a3fdb87df94f8d377b7ea90ca50a06418fda3867 (patch) | |
tree | 61bd8721273ccae6e8a55d78d762562e63997b93 /main | |
parent | 84062873e162bc4a7c799fb67f72dbd055eb15ca (diff) |
Open window & basic lifetime
Diffstat (limited to 'main')
-rw-r--r-- | main/main.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/main/main.cpp b/main/main.cpp index 938d225..4a999ce 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -99,8 +99,8 @@ StatusOr<uint32_t> FindQueueFamily(VulkanApi* vk, VkPhysicalDevice physical_devi {
const auto& prps = queue_families[index];
- bool supports_graphics_compute = (prps.queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0 && (prps.queueFlags & VK_QUEUE_COMPUTE_BIT) != 0;
- bool supports_presentation = vk->GetPhysicalDeviceWin32PresentationSupportKHR(physical_device, index) == VK_TRUE;
+ const bool supports_graphics_compute = (prps.queueFlags & VK_QUEUE_GRAPHICS_BIT) != 0 && (prps.queueFlags & VK_QUEUE_COMPUTE_BIT) != 0;
+ const bool supports_presentation = vk->GetPhysicalDeviceWin32PresentationSupportKHR(physical_device, index) == VK_TRUE;
if (supports_graphics_compute && supports_presentation)
{
return index;
@@ -114,7 +114,7 @@ StatusOr<VkDevice> CreateDevice(VulkanApi* vk, VkPhysicalDevice physical_device, {
const float queue_priority = 1.0F;
- VkDeviceQueueCreateInfo queue_create_info{
+ const VkDeviceQueueCreateInfo queue_create_info{
.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
@@ -127,7 +127,7 @@ StatusOr<VkDevice> CreateDevice(VulkanApi* vk, VkPhysicalDevice physical_device, VK_KHR_SWAPCHAIN_EXTENSION_NAME,
};
- VkDeviceCreateInfo create_info{
+ const VkDeviceCreateInfo create_info{
.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO,
.pNext = nullptr,
.flags = 0,
@@ -141,7 +141,7 @@ StatusOr<VkDevice> CreateDevice(VulkanApi* vk, VkPhysicalDevice physical_device, };
VkDevice device = VK_NULL_HANDLE;
- VkResult res = vk->CreateDevice(physical_device, &create_info, kVkAlloc, &device);
+ const VkResult res = vk->CreateDevice(physical_device, &create_info, kVkAlloc, &device);
if (res != VK_SUCCESS)
{
return InternalError("vkCreateDeviceFailed");
@@ -224,7 +224,7 @@ int main(int /* argc */, char* /* argv */[]) log_api->LogInfo("Base APIs registered");
- OsWindowHandle* window{};
+ OsWindow* window{};
{
auto s = os_api->window->Create("Deimos", 1280, 720);
if (!s.ok())
@@ -235,6 +235,11 @@ int main(int /* argc */, char* /* argv */[]) window = s.value();
}
+ while (!os_api->window->QuitRequested(window))
+ {
+ os_api->window->Update(window);
+ }
+
const Status s = InitializeVulkan(api_registry);
if (!s.ok())
{
|