From df0e12a783a6c86e1a6ffffe432f8dcdab1065db Mon Sep 17 00:00:00 2001 From: pupbrained Date: Sun, 6 Oct 2024 01:26:41 -0400 Subject: [PATCH] some more things --- flake.nix | 6 ++++-- src/main.cpp | 32 ++++++++++++++++---------------- 2 files changed, 20 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index f9f78de..d2ad8c9 100644 --- a/flake.nix +++ b/flake.nix @@ -18,8 +18,10 @@ system: let pkgs = import nixpkgs { inherit system; - config.allowUnfree = true; - config.allowUnsupportedSystem = true; + config = { + allowUnfree = true; + allowUnsupportedSystem = true; + }; }; stdenv = diff --git a/src/main.cpp b/src/main.cpp index c7cfd8b..8d8dc9e 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -361,18 +361,20 @@ class VulkanApp { for (u32 i = 0; i < mSwapChainImages.size(); i++) { vk::ImageViewCreateInfo createInfo { - .image = mSwapChainImages[i], - .viewType = vk::ImageViewType::e2D, - .format = mSwapChainImageFormat, + .image = mSwapChainImages[i], + .viewType = vk::ImageViewType::e2D, + .format = mSwapChainImageFormat, + // clang-format off .components = { .r = vk::ComponentSwizzle::eIdentity, - .g = vk::ComponentSwizzle::eIdentity, - .b = vk::ComponentSwizzle::eIdentity, - .a = vk::ComponentSwizzle::eIdentity }, + .g = vk::ComponentSwizzle::eIdentity, + .b = vk::ComponentSwizzle::eIdentity, + .a = vk::ComponentSwizzle::eIdentity }, .subresourceRange = { .aspectMask = vk::ImageAspectFlagBits::eColor, - .baseMipLevel = 0, - .levelCount = 1, - .baseArrayLayer = 0, - .layerCount = 1 }, + .baseMipLevel = 0, + .levelCount = 1, + .baseArrayLayer = 0, + .layerCount = 1 }, + // clang-format on }; mSwapChainImageViews[i] = mDevice->createImageViewUnique(createInfo).value; @@ -707,12 +709,10 @@ class VulkanApp { u32 width = 0, height = 0; std::tie(width, height) = mWindow->getFramebufferSize(); - vk::Extent2D actualExtent = { width, height }; - - actualExtent.width = - std::clamp(actualExtent.width, capabilities.minImageExtent.width, capabilities.maxImageExtent.width); - actualExtent.height = - std::clamp(actualExtent.height, capabilities.minImageExtent.height, capabilities.maxImageExtent.height); + vk::Extent2D actualExtent = { + std::clamp(actualExtent.width, capabilities.minImageExtent.width, capabilities.maxImageExtent.width), + std::clamp(actualExtent.height, capabilities.minImageExtent.height, capabilities.maxImageExtent.height) + }; return actualExtent; }