@@ -28,6 +28,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
2828
2929 constexpr static inline std::string_view DefaultImagePathsFile = " ../../media/noises/spp_benchmark_4k_512.exr" ;
3030 constexpr static inline std::array<int , 2 > Dimensions = { 1280 , 720 };
31+ constexpr static inline std::array<int , 2 > SampleCount = { 10000 , 10000 };
3132
3233public:
3334 // Yay thanks to multiple inheritance we cannot forward ctors anymore
@@ -100,7 +101,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
100101
101102 const IGPUDescriptorSetLayout::SBinding tonemapperBindings[1 ] = {
102103 {
103- .binding = 1 ,
104+ .binding = 0 ,
104105 .type = IDescriptor::E_TYPE::ET_COMBINED_IMAGE_SAMPLER,
105106 .createFlags = IGPUDescriptorSetLayout::SBinding::E_CREATE_FLAGS::ECF_NONE,
106107 .stageFlags = IShader::E_SHADER_STAGE::ESS_COMPUTE,
@@ -217,7 +218,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
217218 return m_device->createShader (overriddenSource.get ());
218219 };
219220
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
221222 {
222223 const nbl::asset::SPushConstantRange pcRange = {
223224 .stageFlags = IShader::E_SHADER_STAGE::ESS_COMPUTE,
@@ -287,7 +288,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
287288 // create the commandbuffers
288289 if (!m_cmdPool)
289290 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 }))
291292 return logFail (" Couldn't create Command Buffer!" );
292293 }
293294
@@ -301,6 +302,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
301302 m_intendedSubmit.queue = queue;
302303 // wait for nothing before upload
303304 m_intendedSubmit.waitSemaphores = {};
305+ m_intendedSubmit.waitSemaphores = {};
304306 // fill later
305307 m_intendedSubmit.commandBuffers = {};
306308 m_intendedSubmit.scratchSemaphore = {
@@ -514,19 +516,32 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
514516 inline void workLoopBody () override
515517 {
516518 // Acquire
517- auto acquire = m_surface->acquireNextImage ();
518- if (!acquire)
519- return ;
519+ // auto acquire = m_surface->acquireNextImage();
520+ // if (!acquire)
521+ // return;
520522
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
527524 {
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+
528533 cmdbuf->begin (IGPUCommandBuffer::USAGE::ONE_TIME_SUBMIT_BIT);
529534
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+
530545 const VkRect2D currentRenderArea =
531546 {
532547 .offset = {0,0},
@@ -539,9 +554,9 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
539554 .width = float(m_window->getWidth()),
540555 .height = float(m_window->getHeight())
541556 };
542- cmdbuf ->setViewport ({ &viewport, 1 });
557+ cmdbuf3 ->setViewport({ &viewport, 1 });
543558 }
544- cmdbuf ->setScissor ({ ¤tRenderArea, 1 });
559+ cmdbuf3 ->setScissor({ ¤tRenderArea, 1 });
545560
546561 // begin the renderpass
547562 {
@@ -553,15 +568,15 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
553568 .depthStencilClearValues = nullptr,
554569 .renderArea = currentRenderArea
555570 };
556- cmdbuf ->beginRenderPass (info, IGPUCommandBuffer::SUBPASS_CONTENTS::INLINE);
571+ cmdbuf3 ->beginRenderPass(info, IGPUCommandBuffer::SUBPASS_CONTENTS::INLINE);
557572 }
558573
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();
563578
564- cmdbuf ->end ();
579+ cmdbuf3 ->end();
565580 }
566581
567582 // submit
@@ -574,7 +589,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
574589 {
575590 {
576591 const IQueue::SSubmitInfo::SCommandBufferInfo commandBuffers[1] = { {
577- .cmdbuf = cmdbuf
592+ .cmdbuf = cmdbuf3
578593 } };
579594 // we don't need to wait for the transfer semaphore, because we submit everything to the same queue
580595 const IQueue::SSubmitInfo::SSemaphoreInfo acquired[1] = { {
@@ -607,7 +622,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
607622 };
608623 if (m_device->blockForSemaphores(cmdbufDonePending) != ISemaphore::WAIT_RESULT::SUCCESS)
609624 return;
610- }
625+ }*/
611626 }
612627
613628 inline bool keepRunning () override
0 commit comments