@@ -78,6 +78,7 @@ Renderer::Renderer(IVideoDriver* _driver, IAssetManager* _assetManager, scene::I
78
78
break ;
79
79
}
80
80
81
+ <<<<<<< HEAD
81
82
// set up raycount buffers
82
83
{
83
84
const uint32_t zeros[RAYCOUNT_N_BUFFERING] = { 0u };
@@ -136,7 +137,7 @@ Renderer::Renderer(IVideoDriver* _driver, IAssetManager* _assetManager, scene::I
136
137
}
137
138
138
139
{
139
- constexpr auto raytracingCommonDescriptorCount = 6u ;
140
+ constexpr auto raytracingCommonDescriptorCount = 4u ;
140
141
IGPUDescriptorSetLayout::SBinding bindings[raytracingCommonDescriptorCount];
141
142
fillIotaDescriptorBindingDeclarations (bindings,ISpecializedShader::ESS_COMPUTE,raytracingCommonDescriptorCount);
142
143
bindings[0 ].type = asset::EDT_UNIFORM_BUFFER;
@@ -157,7 +158,6 @@ Renderer::Renderer(IVideoDriver* _driver, IAssetManager* _assetManager, scene::I
157
158
samplerParams.CompareEnable = false ;
158
159
auto sampler = m_driver->createGPUSampler (samplerParams);
159
160
{
160
-
161
161
constexpr auto raygenDescriptorCount = 1u ;
162
162
IGPUDescriptorSetLayout::SBinding bindings[raygenDescriptorCount];
163
163
fillIotaDescriptorBindingDeclarations (bindings,ISpecializedShader::ESS_COMPUTE,raygenDescriptorCount,EDT_COMBINED_IMAGE_SAMPLER);
@@ -255,7 +255,7 @@ Renderer::InitializationData Renderer::initSceneObjects(const SAssetBundle& mesh
255
255
256
256
constexpr uint8_t kIndicesPerTriangle = 3u ;
257
257
constexpr uint16_t minIndicesBatch = minTrisBatch*kIndicesPerTriangle ;
258
-
258
+
259
259
CPUMeshPacker::AllocationParams allocParams;
260
260
allocParams.vertexBuffSupportedByteSize = 1u <<31u ;
261
261
allocParams.vertexBufferMinAllocByteSize = minTrisBatch*minVertexSize;
@@ -264,6 +264,7 @@ Renderer::InitializationData Renderer::initSceneObjects(const SAssetBundle& mesh
264
264
allocParams.MDIDataBuffSupportedCnt = allocParams.indexBuffSupportedCnt /minIndicesBatch;
265
265
allocParams.MDIDataBuffMinAllocCnt = 1u ; // so structs from different meshbuffers are adjacent in memory
266
266
267
+
267
268
constexpr auto combinedNormalUVAttributeIx = 1 ;
268
269
constexpr auto newEnabledAttributeMask = (0x1u <<combinedNormalUVAttributeIx)|0b1 ;
269
270
@@ -325,6 +326,7 @@ Renderer::InitializationData Renderer::initSceneObjects(const SAssetBundle& mesh
325
326
}
326
327
for (auto meshBuffer : meshBuffersToProcess)
327
328
const_cast <ICPUMeshBuffer*>(meshBuffer)->getPipeline ()->getVertexInputParams ().enabledAttribFlags = newEnabledAttributeMask;
329
+
328
330
allocData.resize (meshBuffersToProcess.size ());
329
331
330
332
cpump->alloc (allocData.data (),meshBuffersToProcess.begin (),meshBuffersToProcess.end ());
@@ -807,6 +809,7 @@ void Renderer::init(const SAssetBundle& meshes, core::smart_refctd_ptr<ICPUBuffe
807
809
core::smart_refctd_ptr (m_commonRaytracingDSLayout),
808
810
core::smart_refctd_ptr (m_raygenDSLayout)
809
811
);
812
+
810
813
m_raygenPipeline = m_driver->createGPUComputePipeline (nullptr ,std::move (_raygenPipelineLayout),gpuSpecializedShaderFromFile (m_assetManager,m_driver," ../raygen.comp" ));
811
814
812
815
m_raygenDS = m_driver->createGPUDescriptorSet (core::smart_refctd_ptr (m_raygenDSLayout));
@@ -982,6 +985,7 @@ void Renderer::init(const SAssetBundle& meshes, core::smart_refctd_ptr<ICPUBuffe
982
985
setDstSetAndDescTypesOnWrites (m_closestHitDS[i].get (),writes,infos,{EDT_STORAGE_BUFFER,EDT_STORAGE_BUFFER});
983
986
m_driver->updateDescriptorSets (descriptorUpdateCounts[3 ],writes,0u ,nullptr );
984
987
}
988
+ initData = {}; // reclaim some memory
985
989
// set up m_resolveDS
986
990
{
987
991
infos[0 ].buffer = {0u ,_staticViewDataBuffer->getSize ()};
@@ -1157,6 +1161,8 @@ void Renderer::deinit()
1157
1161
// one day it will just work like that
1158
1162
// #include <nbl/builtin/glsl/sampling/box_muller_transform.glsl>
1159
1163
1164
+ constexpr uint16_t m_maxDepth = 2u ; // TODO: = 5u
1165
+ constexpr uint16_t m_UNUSED_russianRouletteDepth = 5u ;
1160
1166
void Renderer::render (nbl::ITimer* timer)
1161
1167
{
1162
1168
if (m_cullPushConstants.maxGlobalInstanceCount ==0u )
@@ -1374,6 +1380,7 @@ uint32_t Renderer::traceBounce(uint32_t raycount)
1374
1380
1375
1381
auto commandQueue = m_rrManager->getCLCommandQueue ();
1376
1382
const cl_mem clObjects[] = {m_rayBuffer[descSetIx].asRRBuffer .second ,m_intersectionBuffer[descSetIx].asRRBuffer .second };
1383
+
1377
1384
const auto objCount = sizeof (clObjects)/sizeof (cl_mem);
1378
1385
cl_event acquired=nullptr , raycastDone=nullptr ;
1379
1386
// run the raytrace queries
0 commit comments