@@ -28,6 +28,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
28
28
29
29
constexpr static inline std::string_view DefaultImagePathsFile = " ../../media/noises/spp_benchmark_4k_512.exr" ;
30
30
constexpr static inline std::array<int , 2 > Dimensions = { 1280 , 720 };
31
+ constexpr static inline std::array<int , 2 > SampleCount = { 10000 , 10000 };
31
32
32
33
public:
33
34
// Yay thanks to multiple inheritance we cannot forward ctors anymore
@@ -100,7 +101,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
100
101
101
102
const IGPUDescriptorSetLayout::SBinding tonemapperBindings[1 ] = {
102
103
{
103
- .binding = 1 ,
104
+ .binding = 0 ,
104
105
.type = IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER,
105
106
.createFlags = IGPUDescriptorSetLayout::SBinding::E_CREATE_FLAGS::ECF_NONE,
106
107
.stageFlags = IShader::E_SHADER_STAGE::ESS_COMPUTE,
@@ -217,7 +218,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
217
218
return m_device->createShader (overriddenSource.get ());
218
219
};
219
220
220
- auto createComputePipeline = [&](smart_refctd_ptr<IGPUShader> shader, smart_refctd_ptr<IGPUComputePipeline> pipeline) -> bool
221
+ auto createComputePipeline = [&](smart_refctd_ptr<IGPUShader>& shader, smart_refctd_ptr<IGPUComputePipeline>& pipeline) -> bool
221
222
{
222
223
const nbl::asset::SPushConstantRange pcRange = {
223
224
.stageFlags = IShader::E_SHADER_STAGE::ESS_COMPUTE,
@@ -287,7 +288,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
287
288
// create the commandbuffers
288
289
if (!m_cmdPool)
289
290
return logFail (" Couldn't create Command Pool!" );
290
- if (!m_cmdPool->createCommandBuffers (IGPUCommandPool::BUFFER_LEVEL::PRIMARY, { m_cmdBufs.data (), 1 }))
291
+ if (!m_cmdPool->createCommandBuffers (IGPUCommandPool::BUFFER_LEVEL::PRIMARY, { m_cmdBufs.data (), 3 }))
291
292
return logFail (" Couldn't create Command Buffer!" );
292
293
}
293
294
@@ -301,6 +302,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
301
302
m_intendedSubmit.queue = queue;
302
303
// wait for nothing before upload
303
304
m_intendedSubmit.waitSemaphores = {};
305
+ m_intendedSubmit.waitSemaphores = {};
304
306
// fill later
305
307
m_intendedSubmit.commandBuffers = {};
306
308
m_intendedSubmit.scratchSemaphore = {
@@ -514,19 +516,32 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
514
516
inline void workLoopBody () override
515
517
{
516
518
// Acquire
517
- auto acquire = m_surface->acquireNextImage ();
518
- if (!acquire)
519
- return ;
519
+ // auto acquire = m_surface->acquireNextImage();
520
+ // if (!acquire)
521
+ // return;
520
522
521
- auto queue = getGraphicsQueue ();
522
- auto cmdbuf = m_cmdBufs[0 ].get ();
523
- auto ds = m_lumaPresentDS[1 ].get ();
524
-
525
- queue->startCapture ();
526
- // Render to the swapchain
523
+ // Luma Meter
527
524
{
525
+ auto queue = getComputeQueue ();
526
+ auto cmdbuf = m_cmdBufs[0 ].get ();
527
+ auto ds = m_lumaPresentDS[0 ].get ();
528
+
529
+ const uint32_t SubgroupSize = m_physicalDevice->getLimits ().maxSubgroupSize ;
530
+
531
+ queue->startCapture ();
532
+
528
533
cmdbuf->begin (IGPUCommandBuffer::USAGE::ONE_TIME_SUBMIT_BIT);
529
534
535
+ cmdbuf->bindComputePipeline (m_lumaMeterPipeline.get ());
536
+ cmdbuf->bindDescriptorSets (nbl::asset::EPBP_GRAPHICS, m_lumaMeterPipeline->getLayout (), 0 , 1 , &ds);
537
+ cmdbuf->dispatch (1 + (SampleCount[0 ] - 1 ) / SubgroupSize, 1 + (SampleCount[1 ] - 1 ) / SubgroupSize);
538
+ cmdbuf->end ();
539
+ }
540
+
541
+ // Render to the swapchain
542
+ /* {
543
+ cmdbuf3->begin(IGPUCommandBuffer::USAGE::ONE_TIME_SUBMIT_BIT);
544
+
530
545
const VkRect2D currentRenderArea =
531
546
{
532
547
.offset = {0,0},
@@ -539,9 +554,9 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
539
554
.width = float(m_window->getWidth()),
540
555
.height = float(m_window->getHeight())
541
556
};
542
- cmdbuf ->setViewport ({ &viewport, 1 });
557
+ cmdbuf3 ->setViewport({ &viewport, 1 });
543
558
}
544
- cmdbuf ->setScissor ({ ¤tRenderArea, 1 });
559
+ cmdbuf3 ->setScissor({ ¤tRenderArea, 1 });
545
560
546
561
// begin the renderpass
547
562
{
@@ -553,15 +568,15 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
553
568
.depthStencilClearValues = nullptr,
554
569
.renderArea = currentRenderArea
555
570
};
556
- cmdbuf ->beginRenderPass (info, IGPUCommandBuffer::SUBPASS_CONTENTS::INLINE);
571
+ cmdbuf3 ->beginRenderPass(info, IGPUCommandBuffer::SUBPASS_CONTENTS::INLINE);
557
572
}
558
573
559
- cmdbuf ->bindGraphicsPipeline (m_presentPipeline.get ());
560
- cmdbuf ->bindDescriptorSets (nbl::asset::EPBP_GRAPHICS, m_presentPipeline->getLayout (), 3 , 1 , &ds);
561
- ext::FullScreenTriangle::recordDrawCall (cmdbuf );
562
- cmdbuf ->endRenderPass ();
574
+ cmdbuf3 ->bindGraphicsPipeline(m_presentPipeline.get());
575
+ cmdbuf3 ->bindDescriptorSets(nbl::asset::EPBP_GRAPHICS, m_presentPipeline->getLayout(), 3, 1, &ds);
576
+ ext::FullScreenTriangle::recordDrawCall(cmdbuf3 );
577
+ cmdbuf3 ->endRenderPass();
563
578
564
- cmdbuf ->end ();
579
+ cmdbuf3 ->end();
565
580
}
566
581
567
582
// submit
@@ -574,7 +589,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
574
589
{
575
590
{
576
591
const IQueue::SSubmitInfo::SCommandBufferInfo commandBuffers[1] = { {
577
- .cmdbuf = cmdbuf
592
+ .cmdbuf = cmdbuf3
578
593
} };
579
594
// we don't need to wait for the transfer semaphore, because we submit everything to the same queue
580
595
const IQueue::SSubmitInfo::SSemaphoreInfo acquired[1] = { {
@@ -607,7 +622,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
607
622
};
608
623
if (m_device->blockForSemaphores(cmdbufDonePending) != ISemaphore::WAIT_RESULT::SUCCESS)
609
624
return;
610
- }
625
+ }*/
611
626
}
612
627
613
628
inline bool keepRunning () override
0 commit comments