Skip to content

Commit dd35ffd

Browse files
committed
Merge branch 'wip_swapchain_dynamic' of github.com:tgfrerer/island into wip_swapchain_dynamic
2 parents f3d2e9e + 346d1d5 commit dd35ffd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/le_backend_vk/le_backend_vk.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -979,7 +979,7 @@ static le_swapchain_handle backend_add_swapchain( le_backend_o* self, le_swapcha
979979

980980
assert( swapchain );
981981

982-
uint64_t swapchain_index = ++self->swapchains_next_handle; // note pre-increment
982+
uint64_t swapchain_index = ++self->swapchains_next_handle; // note pre-increment: this is so that index 0 means invalid swapchain
983983

984984
char swapchain_name[ 64 ];
985985

@@ -1442,7 +1442,8 @@ static void backend_setup( le_backend_o* self ) {
14421442

14431443
if ( !self->swapchains.empty() ) {
14441444
// Take the first swapchain, and use this to specify the default format for a color attachment
1445-
self->defaultFormatColorAttachment = le::Format( self->swapchains.at( 0 ).swapchain_surface_format.format );
1445+
// Note that we take swapchain with index 1, as index 0 must not exist (it represents an invalid swapchain index or handle)
1446+
self->defaultFormatColorAttachment = le::Format( self->swapchains.at( 1 ).swapchain_surface_format.format );
14461447
} else {
14471448
self->defaultFormatColorAttachment = le::Format::eB8G8R8A8Unorm;
14481449
}

0 commit comments

Comments
 (0)