@@ -1144,8 +1144,25 @@ struct RenderGraphContextCleaner {
1144
1144
prevFenceValue(context.nextFenceValue) {
1145
1145
++context.nextFenceValue ;
1146
1146
context.clearPreviousResources (prevFenceValue);
1147
- context.renderSceneResources .clear ();
1148
1147
context.sceneCulling .clear ();
1148
+
1149
+ // Clear the resource graph index
1150
+ // Notice: we do not call `nativeContext.resourceGraphIndex.clear()`.
1151
+ // Avoid memory allocation.
1152
+ for (auto & [_, index] : context.resourceGraphIndex ) {
1153
+ index.clear ();
1154
+ }
1155
+
1156
+ // Notice: we do not call `nativeContext.graphNodeRenderData.clear()`.
1157
+ // Avoid memory allocation.
1158
+ // TODO(zhouzhenglong): we should use a pool allocator for this map.
1159
+ for (auto & [_, data] : context.graphNodeRenderData ) {
1160
+ data.clear ();
1161
+ CC_ENSURES (data.hasNoData ());
1162
+ }
1163
+
1164
+ // Clear the descriptor sets
1165
+ context.graphNodeDescriptorSets .clear ();
1149
1166
}
1150
1167
RenderGraphContextCleaner (const RenderGraphContextCleaner&) = delete ;
1151
1168
RenderGraphContextCleaner& operator =(const RenderGraphContextCleaner&) = delete ;
@@ -1282,16 +1299,6 @@ void NativePipeline::executeRenderGraph(const RenderGraph& rg) {
1282
1299
ppl.pipelineSceneData ->getShadows ());
1283
1300
}
1284
1301
1285
- // gpu driven
1286
- if constexpr (ENABLE_GPU_DRIVEN) {
1287
- // TODO(jilin): consider populating renderSceneResources here
1288
- const scene::RenderScene* const ptr = nullptr ;
1289
- auto & sceneResource = ppl.nativeContext .renderSceneResources [ptr];
1290
- const auto & nameID = lg.attributeIndex .find (" cc_xxxDescriptor" )->second ;
1291
- sceneResource.resourceIndex .emplace (nameID, ResourceType::STORAGE_BUFFER);
1292
- sceneResource.storageBuffers .emplace (nameID, nullptr );
1293
- }
1294
-
1295
1302
// Execute all valid passes
1296
1303
{
1297
1304
boost::filtered_graph<
@@ -1325,30 +1332,6 @@ void NativePipeline::executeRenderGraph(const RenderGraph& rg) {
1325
1332
#endif
1326
1333
}
1327
1334
1328
- ccstd::pmr::unordered_map<
1329
- RenderGraph::vertex_descriptor,
1330
- PmrFlatMap<NameLocalID, ResourceGraph::vertex_descriptor>>
1331
- perPassResourceIndex (scratch);
1332
-
1333
- ccstd::pmr::unordered_map<
1334
- RenderGraph::vertex_descriptor,
1335
- std::tuple<gfx::DescriptorSet*, gfx::DescriptorSet*>>
1336
- renderGraphDescriptorSet (scratch);
1337
-
1338
- ccstd::pmr::unordered_map<
1339
- RenderGraph::vertex_descriptor, gfx::DescriptorSet*>
1340
- uiDescriptorSet (scratch);
1341
-
1342
- ccstd::pmr::unordered_map<
1343
- RenderGraph::vertex_descriptor,
1344
- gfx::DescriptorSet*>
1345
- profilerPerPassDescriptorSets (scratch);
1346
-
1347
- ccstd::pmr::unordered_map<
1348
- RenderGraph::vertex_descriptor,
1349
- gfx::DescriptorSet*>
1350
- perInstanceDescriptorSets (scratch);
1351
-
1352
1335
ccstd::pmr::vector<ccstd::optional<gfx::Viewport>> viewportStack (scratch);
1353
1336
viewportStack.reserve (4 );
1354
1337
@@ -1360,11 +1343,6 @@ void NativePipeline::executeRenderGraph(const RenderGraph& rg) {
1360
1343
validPasses,
1361
1344
ppl.device , submit.primaryCommandBuffer ,
1362
1345
&ppl,
1363
- perPassResourceIndex,
1364
- renderGraphDescriptorSet,
1365
- uiDescriptorSet,
1366
- profilerPerPassDescriptorSets,
1367
- perInstanceDescriptorSets,
1368
1346
programLibrary,
1369
1347
viewportStack,
1370
1348
CustomRenderGraphContext{
@@ -1375,26 +1353,6 @@ void NativePipeline::executeRenderGraph(const RenderGraph& rg) {
1375
1353
},
1376
1354
scratch};
1377
1355
1378
- {
1379
- // Clear the resource graph index
1380
- // Notice: we do not call `nativeContext.resourceGraphIndex.clear()`.
1381
- // Avoid memory allocation.
1382
- for (auto & [_, index] : nativeContext.resourceGraphIndex ) {
1383
- index.clear ();
1384
- }
1385
-
1386
- // Notice: we do not call `nativeContext.graphNodeRenderData.clear()`.
1387
- // Avoid memory allocation.
1388
- // TODO(zhouzhenglong): we should use a pool allocator for this map.
1389
- for (auto & [_, data] : nativeContext.graphNodeRenderData ) {
1390
- data.clear ();
1391
- CC_ENSURES (data.hasNoData ());
1392
- }
1393
-
1394
- // Clear the descriptor sets
1395
- ppl.nativeContext .graphNodeDescriptorSets .clear ();
1396
- }
1397
-
1398
1356
RenderGraphVisitor visitor{{}, ctx};
1399
1357
auto colors = rg.colors (scratch);
1400
1358
for (const auto vertID : ctx.g .sortedVertices ) {
0 commit comments