@@ -227,6 +227,46 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
227
227
};
228
228
}
229
229
230
+ // Allocate and create buffer for Luma Gather
231
+ {
232
+ // Allocate memory
233
+ nbl::video::IDeviceMemoryAllocator::SAllocation allocation = {};
234
+ smart_refctd_ptr<IGPUBuffer> buffer;
235
+ // smart_refctd_ptr<nbl::video::IGPUDescriptorSet> ds;
236
+ {
237
+ auto build_buffer = [this ](
238
+ smart_refctd_ptr<ILogicalDevice> m_device,
239
+ nbl::video::IDeviceMemoryAllocator::SAllocation* allocation,
240
+ smart_refctd_ptr<IGPUBuffer>& buffer,
241
+ size_t buffer_size,
242
+ const char * label)
243
+ {
244
+ IGPUBuffer::SCreationParams params;
245
+ params.size = buffer_size;
246
+ params.usage = IGPUBuffer::EUF_STORAGE_BUFFER_BIT | IGPUBuffer::EUF_SHADER_DEVICE_ADDRESS_BIT;
247
+ buffer = m_device->createBuffer (std::move (params));
248
+ if (!buffer)
249
+ return logFail (" Failed to create GPU buffer of size %d!\n " , buffer_size);
250
+
251
+ buffer->setObjectDebugName (label);
252
+
253
+ auto reqs = buffer->getMemoryReqs ();
254
+ reqs.memoryTypeBits &= m_physicalDevice->getHostVisibleMemoryTypeBits ();
255
+
256
+ *allocation = m_device->allocate (reqs, buffer.get (), IDeviceMemoryAllocation::EMAF_DEVICE_ADDRESS_BIT);
257
+ if (!allocation->isValid ())
258
+ return logFail (" Failed to allocate Device Memory compatible with our GPU Buffer!\n " );
259
+
260
+ assert (allocation->memory .get () == buffer->getBoundMemory ().memory );
261
+ };
262
+
263
+ auto x = m_physicalDevice->getLimits ();
264
+
265
+ build_buffer (m_device, &allocation, buffer, m_physicalDevice->getLimits ().maxSubgroupSize , " Luma Gather Buffer" );
266
+ }
267
+ m_lumaGatherBDA = buffer->getDeviceAddress ();
268
+ }
269
+
230
270
// Allocate and Leave 1/4 for image uploads, to test image copy with small memory remaining
231
271
{
232
272
uint32_t localOffset = video::StreamingTransientDataBufferMT<>::invalid_value;
@@ -347,8 +387,6 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
347
387
queue->endCapture ();
348
388
}
349
389
350
- m_computeSubgroupSize = m_physicalDevice->getLimits ().maxComputeWorkgroupSubgroups ;
351
-
352
390
return true ;
353
391
}
354
392
@@ -487,8 +525,8 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
487
525
smart_refctd_ptr<IWindow> m_window;
488
526
smart_refctd_ptr<CSimpleResizeSurface<CDefaultSwapchainFramebuffers>> m_surface;
489
527
490
- // constants
491
- uint32_t m_computeSubgroupSize = 0 ;
528
+ // luma gather
529
+ uint64_t m_lumaGatherBDA ;
492
530
};
493
531
494
532
NBL_MAIN_FUNC (AutoexposureApp)
@@ -531,20 +569,6 @@ int main()
531
569
if (!device)
532
570
return 1; // could not create selected driver.
533
571
534
- QToQuitEventReceiver receiver;
535
- device->setEventReceiver(&receiver);
536
-
537
- IVideoDriver* driver = device->getVideoDriver();
538
-
539
- nbl::io::IFileSystem* filesystem = device->getFileSystem();
540
- IAssetManager* am = device->getAssetManager();
541
-
542
- IAssetLoader::SAssetLoadParams lp;
543
- auto imageBundle = am->getAsset("../../media/noises/spp_benchmark_4k_512.exr", lp);
544
-
545
- auto glslCompiler = am->getCompilerSet();
546
- const auto inputColorSpace = std::make_tuple(inFormat,ECP_SRGB,EOTF_IDENTITY);
547
-
548
572
using LumaMeterClass = ext::LumaMeter::CLumaMeter;
549
573
constexpr auto MeterMode = LumaMeterClass::EMM_MEDIAN;
550
574
const float minLuma = 1.f/2048.f;
0 commit comments