Skip to content

Commit c646c7d

Browse files
committed
Create separate ds for luma and present
1 parent 15e489f commit c646c7d

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

26_Autoexposure/main.cpp

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
136136
return logFail("Failed to Create Descriptor Pools");
137137

138138
m_lumaPresentDS[0] = lumaPresentPool->createDescriptorSet(core::smart_refctd_ptr(lumaPresentDSLayout));
139-
if (!m_lumaPresentDS[0])
139+
m_lumaPresentDS[1] = lumaPresentPool->createDescriptorSet(core::smart_refctd_ptr(lumaPresentDSLayout));
140+
if (!m_lumaPresentDS[0] || !m_lumaPresentDS[1])
140141
return logFail("Could not create Descriptor Set: lumaPresentDS!");
141142
m_tonemapperDS[0] = tonemapperPool->createDescriptorSet(core::smart_refctd_ptr(tonemapperDSLayout));
142143
if (!m_tonemapperDS[0])
@@ -450,28 +451,8 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
450451

451452
m_gpuImgView = m_device->createImageView(std::move(gpuImgViewParams));
452453

453-
IGPUDescriptorSet::SDescriptorInfo info = {};
454-
info.info.image.imageLayout = IImage::LAYOUT::READ_ONLY_OPTIMAL;
455-
info.desc = m_gpuImgView;
456-
457-
IGPUDescriptorSet::SWriteDescriptorSet writeDescriptors[] = {
458-
{
459-
.dstSet = m_lumaPresentDS[0].get(),
460-
.binding = 0,
461-
.arrayElement = 0,
462-
.count = 1,
463-
.info = &info
464-
}
465-
};
466-
467-
m_device->updateDescriptorSets(1, writeDescriptors, 0, nullptr);
468-
469-
queue->endCapture();
470-
}
471-
472-
// Allocate and create texture for tonemapping
473-
{
474-
IGPUImage::SCreationParams imageParams = {};
454+
// Allocate and create texture for tonemapping
455+
imageParams = {};
475456
imageParams = m_gpuImg->getCreationParameters();
476457
// promote format because RGB8 and friends don't actually exist in HW
477458
{
@@ -495,6 +476,35 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
495476
};
496477

497478
m_gpuTonemapImgView = m_device->createImageView(std::move(gpuTonemapImgViewParams));
479+
480+
IGPUDescriptorSet::SDescriptorInfo info1 = {};
481+
info1.info.image.imageLayout = IImage::LAYOUT::READ_ONLY_OPTIMAL;
482+
info1.desc = m_gpuImgView;
483+
484+
IGPUDescriptorSet::SDescriptorInfo info2 = {};
485+
info2.info.image.imageLayout = IImage::LAYOUT::READ_ONLY_OPTIMAL;
486+
info2.desc = m_gpuImgView;
487+
488+
IGPUDescriptorSet::SWriteDescriptorSet writeDescriptors[] = {
489+
{
490+
.dstSet = m_lumaPresentDS[0].get(),
491+
.binding = 0,
492+
.arrayElement = 0,
493+
.count = 1,
494+
.info = &info1
495+
},
496+
{
497+
.dstSet = m_lumaPresentDS[1].get(),
498+
.binding = 0,
499+
.arrayElement = 0,
500+
.count = 1,
501+
.info = &info2
502+
}
503+
};
504+
505+
m_device->updateDescriptorSets(2, writeDescriptors, 0, nullptr);
506+
507+
queue->endCapture();
498508
}
499509

500510
return true;
@@ -510,7 +520,7 @@ class AutoexposureApp final : public examples::SimpleWindowedApplication, public
510520

511521
auto queue = getGraphicsQueue();
512522
auto cmdbuf = m_cmdBufs[0].get();
513-
auto ds = m_lumaPresentDS[0].get();
523+
auto ds = m_lumaPresentDS[1].get();
514524

515525
queue->startCapture();
516526
// Render to the swapchain

0 commit comments

Comments
 (0)