@@ -25,6 +25,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
25
25
using clock_t = std::chrono::steady_clock;
26
26
27
27
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 };
28
29
29
30
public:
30
31
// Yay thanks to multiple inheritance we cannot forward ctors anymore
@@ -40,8 +41,8 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
40
41
{
41
42
IWindow::SCreationParams params = {};
42
43
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 ] ;
45
46
params.x = 32 ;
46
47
params.y = 32 ;
47
48
// 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
278
279
return false ;
279
280
m_gpuImg->setObjectDebugName (" Autoexposure Image" );
280
281
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
294
283
m_winMgr->show (m_window.get ());
295
284
296
285
// we don't want to overcomplicate the example with multi-queue
@@ -373,46 +362,26 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
373
362
auto cmdbuf = m_cmdBufs[0 ].get ();
374
363
auto ds = m_descriptorSets[0 ].get ();
375
364
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
-
384
365
queue->startCapture ();
385
- // Render to the Image
366
+ // Render to the swapchain
386
367
{
387
368
cmdbuf->begin (IGPUCommandBuffer::USAGE::ONE_TIME_SUBMIT_BIT);
388
369
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
-
401
370
const VkRect2D currentRenderArea =
402
371
{
403
372
.offset = {0 ,0 },
404
- .extent = {gpuImgCreationParams. extent . width , gpuImgCreationParams. extent . height }
373
+ .extent = { m_window-> getWidth (), m_window-> getHeight () }
405
374
};
406
375
// set viewport
407
376
{
408
377
const asset::SViewport viewport =
409
378
{
410
- .width = float (gpuImgCreationParams. extent . width ),
411
- .height = float (gpuImgCreationParams. extent . height )
379
+ .width = float (m_window-> getWidth () ),
380
+ .height = float (m_window-> getHeight () )
412
381
};
413
- cmdbuf->setViewport ({ &viewport,1 });
382
+ cmdbuf->setViewport ({ &viewport, 1 });
414
383
}
415
- cmdbuf->setScissor ({ ¤tRenderArea,1 });
384
+ cmdbuf->setScissor ({ ¤tRenderArea, 1 });
416
385
417
386
// begin the renderpass
418
387
{
@@ -426,6 +395,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
426
395
};
427
396
cmdbuf->beginRenderPass (info, IGPUCommandBuffer::SUBPASS_CONTENTS::INLINE);
428
397
}
398
+
429
399
cmdbuf->bindGraphicsPipeline (m_pipeline.get ());
430
400
cmdbuf->bindDescriptorSets (nbl::asset::EPBP_GRAPHICS, m_pipeline->getLayout (), 3 , 1 , &ds);
431
401
ext::FullScreenTriangle::recordDrawCall (cmdbuf);
@@ -467,6 +437,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
467
437
m_surface->present (acquire.imageIndex , rendered);
468
438
getGraphicsQueue ()->endCapture ();
469
439
440
+ // Wait for completion
470
441
{
471
442
const ISemaphore::SWaitInfo cmdbufDonePending[] = {
472
443
{
0 commit comments