Skip to content

Commit a0d236b

Browse files
committed
(gpu) fix swapchain using Extent3 instead of Extent2
1 parent f6f8275 commit a0d236b

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

modules/stormkit/gpu/execution/swapchain.mpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ export namespace stormkit::gpu {
3232

3333
static auto create(const Device& device,
3434
const Surface& surface,
35-
const math::Extent3<u32>& extent,
35+
const math::Extent2<u32>& extent,
3636
OptionalRef<SwapChain> old_swapchain = std::nullopt) noexcept
3737
-> Expected<SwapChain>;
3838
static auto allocate(const Device& device,
3939
const Surface& surface,
40-
const math::Extent3<u32>& extent,
40+
const math::Extent2<u32>& extent,
4141
OptionalRef<SwapChain> old_swapchain = std::nullopt) noexcept
4242
-> Expected<Heap<SwapChain>>;
4343
~SwapChain();
@@ -64,10 +64,10 @@ export namespace stormkit::gpu {
6464
private:
6565
auto do_init(const Device&,
6666
const Surface&,
67-
const math::Extent3<u32>&,
67+
const math::Extent2<u32>&,
6868
VkSwapchainKHR) noexcept -> Expected<void>;
6969

70-
math::Extent3<u32> m_extent;
70+
math::Extent2<u32> m_extent;
7171
PixelFormat m_pixel_format;
7272
u32 m_image_count;
7373

@@ -113,7 +113,7 @@ namespace stormkit::gpu {
113113
STORMKIT_FORCE_INLINE
114114
inline auto SwapChain::create(const Device& device,
115115
const Surface& surface,
116-
const math::Extent3<u32>& extent,
116+
const math::Extent2<u32>& extent,
117117
OptionalRef<SwapChain> old_swapchain) noexcept
118118
-> Expected<SwapChain> {
119119
auto swapchain = SwapChain { device, PrivateFuncTag {} };
@@ -130,7 +130,7 @@ namespace stormkit::gpu {
130130
STORMKIT_FORCE_INLINE
131131
inline auto SwapChain::allocate(const Device& device,
132132
const Surface& surface,
133-
const math::Extent3<u32>& extent,
133+
const math::Extent2<u32>& extent,
134134
OptionalRef<SwapChain> old_swapchain) noexcept
135135
-> Expected<Heap<SwapChain>> {
136136
auto swapchain = std::make_unique<SwapChain>(device, PrivateFuncTag {});

src/gpu/execution/swapchain.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ namespace stormkit::gpu {
5555

5656
auto actual_extent = to_vk(extent);
5757
actual_extent
58-
.width = std::max(capabilities.minImageExtent.width,
59-
std::min(capabilities.maxImageExtent.width, actual_extent.width));
58+
.width = std::max(capabilities.minImageExtent.width,
59+
std::min(capabilities.maxImageExtent.width, actual_extent.width));
6060
actual_extent.height = std::max(capabilities.minImageExtent.height,
6161
std::min(capabilities.maxImageExtent.height,
6262
actual_extent.height));
@@ -80,7 +80,7 @@ namespace stormkit::gpu {
8080
/////////////////////////////////////
8181
auto SwapChain::do_init(const Device& device,
8282
const Surface& surface,
83-
const math::Extent3<u32>& extent,
83+
const math::Extent2<u32>& extent,
8484
VkSwapchainKHR old_swapchain) noexcept -> Expected<void> {
8585
const auto& physical_device = device.physical_device();
8686

@@ -115,7 +115,7 @@ namespace stormkit::gpu {
115115
const auto image_usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT
116116
| VK_IMAGE_USAGE_TRANSFER_DST_BIT;
117117

118-
m_extent = extent.to<u32>();
118+
m_extent = extent;
119119
m_pixel_format = from_vk<PixelFormat>(format.format);
120120

121121
const auto create_info = VkSwapchainCreateInfoKHR {
@@ -158,7 +158,7 @@ namespace stormkit::gpu {
158158
m_images = vk_images
159159
| std::views::transform([this, &device](auto&& image) noexcept {
160160
const auto create_info = Image::CreateInfo {
161-
.extent = m_extent,
161+
.extent = { m_extent.width, m_extent.height, 1_u32 },
162162
.format = m_pixel_format
163163
};
164164
return Image::create(device, create_info, std::move(image));

0 commit comments

Comments
 (0)