@@ -37,7 +37,7 @@ struct SwapchainImageResource {
3737
3838namespace {
3939 constexpr auto BUFFERING_COUNT = 2_u32;
40- constexpr auto POOL_SIZES = std:: array {
40+ constexpr auto POOL_SIZES = array {
4141 gpu::DescriptorPool::Size { .type = gpu::DescriptorType::COMBINED_IMAGE_SAMPLER, .descriptor_count = BUFFERING_COUNT }
4242 };
4343} // namespace
@@ -55,7 +55,7 @@ class Application: public base::Application {
5555 " Failed to create descriptor pool!" );
5656
5757 // create present engine resources
58- m_submission_resources = init_by<std::vector <SubmissionResource>>([&](auto & out) noexcept {
58+ m_submission_resources = init_by<dyn_array <SubmissionResource>>([&](auto & out) noexcept {
5959 out.reserve (BUFFERING_COUNT);
6060 for (auto _ : range (BUFFERING_COUNT)) {
6161 out.push_back ({
@@ -84,12 +84,11 @@ class Application: public base::Application {
8484 for (const auto & swap_image : images) {
8585 auto view = TryAssert (gpu::ImageView::create (m_device, swap_image), " Failed to create swapchain image view!" );
8686
87- m_image_resources
88- .push_back ({ .image = swap_image,
89- .view = std::move (view),
90- .render_finished = TryAssert (gpu::Semaphore::create (m_device),
91- " Failed to create render "
92- " signal semaphore!" ) });
87+ m_image_resources.push_back ({ .image = swap_image,
88+ .view = std::move (view),
89+ .render_finished = TryAssert (gpu::Semaphore::create (m_device),
90+ " Failed to create render "
91+ " signal semaphore!" ) });
9392
9493 auto & transition_cmb = transition_cmbs[image_index];
9594 TryDiscardAssert ((transition_cmb.record ([&](auto cmb) noexcept {
@@ -163,39 +162,40 @@ class Application: public base::Application {
163162 ImGui_ImplVulkan_LoadFunctions (VK_API_VERSION_1_1, gpu::vk::imgui_vk_loader, &*m_device);
164163 ImGui_ImplVulkan_Init (&init_info);
165164
166- m_window
167- ->on (wsi::KeyDownEventFunc { [this , &io](u8 /* id*/ , wsi::Key key, char c) mutable noexcept {
168- if (key == wsi::Key::ESCAPE) m_window->close ();
169- io.AddInputCharactersUTF8 (&c);
170- } },
171- wsi::MouseMovedEventFunc { [&io](u8 /* id*/ , const math::ivec2& position) mutable noexcept {
172- const auto _position = position.to <f32 >();
173-
174- io.AddMouseSourceEvent (ImGuiMouseSource_Mouse);
175- io.AddMousePosEvent (_position.x , _position.y );
176- } },
177- wsi::MouseButtonDownEventFunc { [&io](u8 /* id*/ , wsi::MouseButton button, const math::ivec2&) mutable noexcept {
178- auto mouse_button = -1 ;
179- if (button == wsi::MouseButton::LEFT) mouse_button = 0 ;
180- if (button == wsi::MouseButton::RIGHT) mouse_button = 1 ;
181- if (button == wsi::MouseButton::MIDDLE) mouse_button = 2 ;
182- if (button == wsi::MouseButton::BUTTON_1) mouse_button = 3 ;
183- if (button == wsi::MouseButton::BUTTON_2) mouse_button = 4 ;
184- if (mouse_button == -1 ) return ;
185- io.AddMouseSourceEvent (ImGuiMouseSource_Mouse);
186- io.AddMouseButtonEvent (mouse_button, true );
187- } },
188- wsi::MouseButtonUpEventFunc { [&io](u8 /* id*/ , wsi::MouseButton button, const math::ivec2&) mutable noexcept {
189- auto mouse_button = -1 ;
190- if (button == wsi::MouseButton::LEFT) mouse_button = 0 ;
191- if (button == wsi::MouseButton::RIGHT) mouse_button = 1 ;
192- if (button == wsi::MouseButton::MIDDLE) mouse_button = 2 ;
193- if (button == wsi::MouseButton::BUTTON_1) mouse_button = 3 ;
194- if (button == wsi::MouseButton::BUTTON_2) mouse_button = 4 ;
195- if (mouse_button == -1 ) return ;
196- io.AddMouseSourceEvent (ImGuiMouseSource_Mouse);
197- io.AddMouseButtonEvent (mouse_button, false );
198- } });
165+ m_window->on (wsi::KeyDownEventFunc { [this , &io](u8 /* id*/ , wsi::Key key, char c) mutable noexcept {
166+ if (key == wsi::Key::ESCAPE) m_window->close ();
167+ io.AddInputCharactersUTF8 (&c);
168+ } },
169+ wsi::MouseMovedEventFunc { [&io](u8 /* id*/ , const math::ivec2& position) mutable noexcept {
170+ const auto _position = position.to <f32 >();
171+
172+ io.AddMouseSourceEvent (ImGuiMouseSource_Mouse);
173+ io.AddMousePosEvent (_position.x , _position.y );
174+ } },
175+ wsi::MouseButtonDownEventFunc {
176+ [&io](u8 /* id*/ , wsi::MouseButton button, const math::ivec2&) mutable noexcept {
177+ auto mouse_button = -1 ;
178+ if (button == wsi::MouseButton::LEFT) mouse_button = 0 ;
179+ if (button == wsi::MouseButton::RIGHT) mouse_button = 1 ;
180+ if (button == wsi::MouseButton::MIDDLE) mouse_button = 2 ;
181+ if (button == wsi::MouseButton::BUTTON_1) mouse_button = 3 ;
182+ if (button == wsi::MouseButton::BUTTON_2) mouse_button = 4 ;
183+ if (mouse_button == -1 ) return ;
184+ io.AddMouseSourceEvent (ImGuiMouseSource_Mouse);
185+ io.AddMouseButtonEvent (mouse_button, true );
186+ } },
187+ wsi::MouseButtonUpEventFunc {
188+ [&io](u8 /* id*/ , wsi::MouseButton button, const math::ivec2&) mutable noexcept {
189+ auto mouse_button = -1 ;
190+ if (button == wsi::MouseButton::LEFT) mouse_button = 0 ;
191+ if (button == wsi::MouseButton::RIGHT) mouse_button = 1 ;
192+ if (button == wsi::MouseButton::MIDDLE) mouse_button = 2 ;
193+ if (button == wsi::MouseButton::BUTTON_1) mouse_button = 3 ;
194+ if (button == wsi::MouseButton::BUTTON_2) mouse_button = 4 ;
195+ if (mouse_button == -1 ) return ;
196+ io.AddMouseSourceEvent (ImGuiMouseSource_Mouse);
197+ io.AddMouseButtonEvent (mouse_button, false );
198+ } });
199199 }
200200
201201 auto run_example () {
@@ -221,7 +221,7 @@ class Application: public base::Application {
221221 const auto & swapchain_image_resource = m_image_resources[image_index];
222222 const auto & signal = swapchain_image_resource.render_finished ;
223223
224- static constexpr auto PIPELINE_FLAGS = std:: array { gpu::PipelineStageFlag::COLOR_ATTACHMENT_OUTPUT };
224+ static constexpr auto PIPELINE_FLAGS = array { gpu::PipelineStageFlag::COLOR_ATTACHMENT_OUTPUT };
225225
226226 const auto window_extent = m_window->extent ().to <i32 >();
227227 const auto rendering_info = gpu::RenderingInfo {
@@ -268,16 +268,16 @@ class Application: public base::Application {
268268 ImGui::DestroyContext ();
269269 }
270270
271- constexpr auto example_name () const noexcept -> std:: string_view { return " Imgui" ; }
271+ constexpr auto example_name () const noexcept -> string_view { return " Imgui" ; }
272272
273273 private:
274- DeferInit<gpu::DescriptorPool> m_descriptor_pool;
275- std::vector <SubmissionResource> m_submission_resources;
276- std::vector <SwapchainImageResource> m_image_resources;
277- usize m_current_frame = 0_usize;
274+ DeferInit<gpu::DescriptorPool> m_descriptor_pool;
275+ dyn_array <SubmissionResource> m_submission_resources;
276+ dyn_array <SwapchainImageResource> m_image_resources;
277+ usize m_current_frame = 0_usize;
278278};
279279
280- auto main (std::span <const std:: string_view> args) -> int {
280+ auto main (array_view <const string_view> args) -> int {
281281 auto app = Application {};
282282 app.run (args);
283283 return 0 ;
0 commit comments