@@ -25,6 +25,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
2525 using clock_t = std::chrono::steady_clock;
2626
2727 constexpr static inline std::string_view DefaultImagePathsFile = " ../../media/noises/spp_benchmark_4k_512.exr" ;
28+ constexpr static inline std::array<int , 2 > Dimensions = { 1280 , 720 };
2829
2930public:
3031 // Yay thanks to multiple inheritance we cannot forward ctors anymore
@@ -40,8 +41,8 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
4041 {
4142 IWindow::SCreationParams params = {};
4243 params.callback = core::make_smart_refctd_ptr<nbl::video::ISimpleManagedSurface::ICallback>();
43- params.width = 256 ;
44- params.height = 256 ;
44+ params.width = Dimensions[ 0 ] ;
45+ params.height = Dimensions[ 1 ] ;
4546 params.x = 32 ;
4647 params.y = 32 ;
4748 // Don't want to have a window lingering about before we're ready so create it hidden.
@@ -278,19 +279,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
278279 return false ;
279280 m_gpuImg->setObjectDebugName (" Autoexposure Image" );
280281
281- // set window size
282- const auto imageExtent = m_gpuImg->getCreationParameters ().extent ;
283- const VkExtent2D newWindowResolution = { imageExtent.width , imageExtent.height };
284-
285- if (newWindowResolution.width != m_window->getWidth () || newWindowResolution.height != m_window->getHeight ())
286- {
287- // Resize the window
288- m_winMgr->setWindowSize (m_window.get (), newWindowResolution.width , newWindowResolution.height );
289- // Don't want to rely on the Swapchain OUT_OF_DATE causing an implicit re-create in the `acquireNextImage` because the
290- // swapchain may report OUT_OF_DATE after the next VBlank after the resize, not getting the message right away.
291- m_surface->recreateSwapchain ();
292- }
293- // Now show the window (ideally should happen just after present, but don't want to mess with acquire/recreation)
282+ // Now show the window
294283 m_winMgr->show (m_window.get ());
295284
296285 // we don't want to overcomplicate the example with multi-queue
@@ -373,46 +362,26 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
373362 auto cmdbuf = m_cmdBufs[0 ].get ();
374363 auto ds = m_descriptorSets[0 ].get ();
375364
376- // there's no previous operation to wait for
377- const SMemoryBarrier toTransferBarrier = {
378- .dstStageMask = PIPELINE_STAGE_FLAGS::COPY_BIT,
379- .dstAccessMask = ACCESS_FLAGS::TRANSFER_WRITE_BIT
380- };
381- const auto gpuImgCreationParams = m_gpuImg->getCreationParameters ();
382- const auto gpuImgViewCreationParams = m_gpuImgView->getCreationParameters ();
383-
384365 queue->startCapture ();
385- // Render to the Image
366+ // Render to the swapchain
386367 {
387368 cmdbuf->begin (IGPUCommandBuffer::USAGE::ONE_TIME_SUBMIT_BIT);
388369
389- // need a pipeline barrier to transition layout
390- const IGPUCommandBuffer::SImageMemoryBarrier<IGPUCommandBuffer::SOwnershipTransferBarrier> imgBarriers[] = { {
391- .barrier = {
392- .dep = toTransferBarrier.nextBarrier (PIPELINE_STAGE_FLAGS::FRAGMENT_SHADER_BIT,ACCESS_FLAGS::SAMPLED_READ_BIT)
393- },
394- .image = m_gpuImg.get (),
395- .subresourceRange = gpuImgViewCreationParams.subresourceRange ,
396- .oldLayout = IGPUImage::LAYOUT::TRANSFER_DST_OPTIMAL,
397- .newLayout = IGPUImage::LAYOUT::READ_ONLY_OPTIMAL
398- } };
399- cmdbuf->pipelineBarrier (E_DEPENDENCY_FLAGS::EDF_NONE, { .imgBarriers = imgBarriers });
400-
401370 const VkRect2D currentRenderArea =
402371 {
403372 .offset = {0 ,0 },
404- .extent = {gpuImgCreationParams. extent . width , gpuImgCreationParams. extent . height }
373+ .extent = { m_window-> getWidth (), m_window-> getHeight () }
405374 };
406375 // set viewport
407376 {
408377 const asset::SViewport viewport =
409378 {
410- .width = float (gpuImgCreationParams. extent . width ),
411- .height = float (gpuImgCreationParams. extent . height )
379+ .width = float (m_window-> getWidth () ),
380+ .height = float (m_window-> getHeight () )
412381 };
413- cmdbuf->setViewport ({ &viewport,1 });
382+ cmdbuf->setViewport ({ &viewport, 1 });
414383 }
415- cmdbuf->setScissor ({ ¤tRenderArea,1 });
384+ cmdbuf->setScissor ({ ¤tRenderArea, 1 });
416385
417386 // begin the renderpass
418387 {
@@ -426,6 +395,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
426395 };
427396 cmdbuf->beginRenderPass (info, IGPUCommandBuffer::SUBPASS_CONTENTS::INLINE);
428397 }
398+
429399 cmdbuf->bindGraphicsPipeline (m_pipeline.get ());
430400 cmdbuf->bindDescriptorSets (nbl::asset::EPBP_GRAPHICS, m_pipeline->getLayout (), 3 , 1 , &ds);
431401 ext::FullScreenTriangle::recordDrawCall (cmdbuf);
@@ -467,6 +437,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
467437 m_surface->present (acquire.imageIndex , rendered);
468438 getGraphicsQueue ()->endCapture ();
469439
440+ // Wait for completion
470441 {
471442 const ISemaphore::SWaitInfo cmdbufDonePending[] = {
472443 {
0 commit comments