Skip to content

Commit 4ea28c1

Browse files
committed
Log Resource Sizes
1 parent e78cf77 commit 4ea28c1

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

examples_tests/22.RaytracedAO/Renderer.cpp

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -810,14 +810,26 @@ void Renderer::initSceneResources(SAssetBundle& meshes)
810810
IGPUDescriptorSet::SDescriptorInfo infos[MaxDescritorUpdates];
811811
IGPUDescriptorSet::SWriteDescriptorSet writes[MaxDescritorUpdates];
812812

813+
size_t lightCDF_BufferSize = 0u;
814+
size_t lights_BufferSize = 0u;
815+
813816
// set up rest of m_additionalGlobalDS
814817
{
815-
createFilledBufferAndSetUpInfoFromVector(infos+0,initData.lightCDF);
816-
createFilledBufferAndSetUpInfoFromVector(infos+1,initData.lights);
817-
818+
auto lightCDFBuffer = createFilledBufferAndSetUpInfoFromVector(infos+0,initData.lightCDF);
819+
auto lightsBuffer = createFilledBufferAndSetUpInfoFromVector(infos+1,initData.lights);
820+
lightCDF_BufferSize = lightCDFBuffer->getSize();
821+
lights_BufferSize = lightsBuffer->getSize();
818822
setDstSetAndDescTypesOnWrites(m_additionalGlobalDS.get(),writes,infos,{EDT_STORAGE_BUFFER,EDT_STORAGE_BUFFER},3u);
819823
}
820824
m_driver->updateDescriptorSets(2u,writes,0u,nullptr);
825+
826+
std::cout << "\nScene Resources Initialized:" << std::endl;
827+
std::cout << "\tlightCDF = " << lightCDF_BufferSize << " bytes" << std::endl;
828+
std::cout << "\tlights = " << lights_BufferSize << " bytes" << std::endl;
829+
std::cout << "\tindexBuffer = " << m_indexBuffer->getSize() << " bytes" << std::endl;
830+
for (auto i=0u; i<2u; i++)
831+
std::cout << "\tIndirect Draw Buffers[" << i << "] = " << m_indirectDrawBuffers[i]->getSize() << " bytes" << std::endl;
832+
std::cout << std::endl;
821833
}
822834
}
823835
}
@@ -880,6 +892,7 @@ void Renderer::initScreenSizedResources(uint32_t width, uint32_t height, core::s
880892

881893
const auto renderPixelCount = m_staticViewData.imageDimensions.x*m_staticViewData.imageDimensions.y;
882894
// figure out how much Samples Per Pixel Per Dispatch we can afford
895+
size_t scrambleBufferSize=0u;
883896
size_t raygenBufferSize=0u,intersectionBufferSize=0u;
884897
{
885898
uint32_t bxdfSamples=1u,maxNEESamples=1u;
@@ -1006,8 +1019,10 @@ void Renderer::initScreenSizedResources(uint32_t width, uint32_t height, core::s
10061019

10071020
// set up m_commonRaytracingDS
10081021
core::smart_refctd_ptr<IGPUBuffer> _staticViewDataBuffer;
1022+
size_t staticViewDataBufferSize=0u;
10091023
{
10101024
_staticViewDataBuffer = createFilledBufferAndSetUpInfoFromStruct(infos+0,m_staticViewData);
1025+
staticViewDataBufferSize = _staticViewDataBuffer->getSize();
10111026
{
10121027
constexpr auto ScrambleStateChannels = 2u;
10131028
auto tmpBuff = m_driver->createCPUSideGPUVisibleGPUBufferOnDedMem(sizeof(uint32_t)*ScrambleStateChannels*renderPixelCount);
@@ -1022,6 +1037,7 @@ void Renderer::initScreenSizedResources(uint32_t width, uint32_t height, core::s
10221037
*it = rng.nextSample();
10231038
tmpBuff->getBoundMemory()->unmapMemory();
10241039
}
1040+
scrambleBufferSize = tmpBuff->getSize();
10251041
// upload
10261042
IGPUImage::SBufferCopy region;
10271043
//region.imageSubresource.aspectMask = ;
@@ -1107,6 +1123,16 @@ void Renderer::initScreenSizedResources(uint32_t width, uint32_t height, core::s
11071123
m_colorBuffer = m_driver->addFrameBuffer();
11081124
m_colorBuffer->attach(EFAP_COLOR_ATTACHMENT0, core::smart_refctd_ptr(m_tonemapOutput));
11091125

1126+
std::cout << "\nScreen Sized Resources have been initialized (" << width << "x" << height << ")" << std::endl;
1127+
std::cout << "\tStaticViewData = " << staticViewDataBufferSize << " bytes" << std::endl;
1128+
std::cout << "\tScrambleBuffer = " << scrambleBufferSize << " bytes" << std::endl;
1129+
std::cout << "\tSampleSequence = " << sampleSequence->getSize() << " bytes" << std::endl;
1130+
std::cout << "\tRayCount Buffer = " << m_rayCountBuffer->getSize() << " bytes" << std::endl;
1131+
for (auto i=0u; i<2u; i++)
1132+
std::cout << "\tIntersection Buffer[" << i << "] = " << m_intersectionBuffer[i].buffer->getSize() << " bytes" << std::endl;
1133+
for (auto i=0u; i<2u; i++)
1134+
std::cout << "\tRay Buffer[" << i << "] = " << m_rayBuffer[i].buffer->getSize() << " bytes" << std::endl;
1135+
std::cout << std::endl;
11101136
#ifdef _NBL_BUILD_OPTIX_
11111137
while (m_denoiser)
11121138
{

0 commit comments

Comments
 (0)