From bb5aa2523f46930ea5459ec0c10acda9075febfd Mon Sep 17 00:00:00 2001 From: hyde zhou Date: Tue, 20 Sep 2022 14:43:44 +0800 Subject: [PATCH] [pipeline] rename graph _vertices (#12802) --- cocos/rendering/custom/compiler.ts | 8 +- cocos/rendering/custom/executor.ts | 8 +- cocos/rendering/custom/render-graph.ts | 42 ++ .../pipeline/custom/FGDispatcherGraphs.h | 32 +- .../pipeline/custom/FGDispatcherTypes.cpp | 4 +- .../pipeline/custom/FGDispatcherTypes.h | 34 +- .../pipeline/custom/FrameGraphDispatcher.cpp | 6 +- .../renderer/pipeline/custom/GraphImpl.h | 8 +- .../pipeline/custom/LayoutGraphGraphs.h | 136 ++-- .../pipeline/custom/LayoutGraphTypes.cpp | 14 +- .../pipeline/custom/LayoutGraphTypes.h | 52 +- .../pipeline/custom/NativeResourceGraph.cpp | 57 +- .../pipeline/custom/RenderGraphGraphs.h | 634 ++++++++++++------ .../pipeline/custom/RenderGraphTypes.cpp | 28 +- .../pipeline/custom/RenderGraphTypes.h | 62 +- .../src/complicated_barrier_case.cpp | 2 +- .../unit-test/src/simple_barrier_test.cpp | 2 +- .../src/simple_closed_barrier_test.cpp | 2 +- 18 files changed, 747 insertions(+), 384 deletions(-) diff --git a/cocos/rendering/custom/compiler.ts b/cocos/rendering/custom/compiler.ts index 13cbe3a252..412293bb4e 100644 --- a/cocos/rendering/custom/compiler.ts +++ b/cocos/rendering/custom/compiler.ts @@ -28,7 +28,7 @@ import { VectorGraphColorMap } from './effect'; import { DefaultVisitor, depthFirstSearch, ReferenceGraphView } from './graph'; import { LayoutGraphData } from './layout-graph'; import { Pipeline } from './pipeline'; -import { Blit, ClearView, ComputePass, CopyPass, Dispatch, ManagedResource, MovePass, +import { Blit, ClearView, ComputePass, CopyPass, Dispatch, ManagedBuffer, ManagedResource, ManagedTexture, MovePass, PresentPass, RasterPass, RaytracePass, RenderGraph, RenderGraphVisitor, RenderQueue, RenderSwapchain, ResourceGraph, ResourceGraphVisitor, SceneData } from './render-graph'; import { AccessType, RasterView, ResourceResidency } from './types'; @@ -166,6 +166,12 @@ class ResourceVisitor implements ResourceGraphVisitor { managed (value: ManagedResource) { this.dependency(); } + managedBuffer (value: ManagedBuffer) { + // noop + } + managedTexture (value: ManagedTexture) { + // noop + } persistentBuffer (value: Buffer) { } diff --git a/cocos/rendering/custom/executor.ts b/cocos/rendering/custom/executor.ts index 3be4fa7a98..10c352b055 100644 --- a/cocos/rendering/custom/executor.ts +++ b/cocos/rendering/custom/executor.ts @@ -51,7 +51,7 @@ import { PipelineSceneData } from '../pipeline-scene-data'; import { PipelineInputAssemblerData } from '../render-pipeline'; import { LayoutGraphData, PipelineLayoutData, RenderPhaseData, RenderStageData } from './layout-graph'; import { Pipeline, SceneVisitor } from './pipeline'; -import { Blit, ClearView, ComputePass, CopyPass, Dispatch, ManagedResource, MovePass, PresentPass, +import { Blit, ClearView, ComputePass, CopyPass, Dispatch, ManagedBuffer, ManagedResource, ManagedTexture, MovePass, PresentPass, RasterPass, RaytracePass, RenderData, RenderGraph, RenderGraphVisitor, RenderQueue, RenderSwapchain, ResourceDesc, ResourceGraph, ResourceGraphVisitor, ResourceTraits, SceneData } from './render-graph'; import { AttachmentType, ComputeView, QueueHint, ResourceDimension, ResourceFlags, SceneFlags, UpdateFrequency } from './types'; @@ -1301,6 +1301,12 @@ class ResourceVisitor implements ResourceGraphVisitor { managed (value: ManagedResource) { this.createDeviceTex(value); } + managedBuffer (value: ManagedBuffer) { + // noop + } + managedTexture (value: ManagedTexture) { + // noop + } persistentBuffer (value: Buffer) { } persistentTexture (value: Texture) { diff --git a/cocos/rendering/custom/render-graph.ts b/cocos/rendering/custom/render-graph.ts index 7b46cf1a16..9106f73b3c 100644 --- a/cocos/rendering/custom/render-graph.ts +++ b/cocos/rendering/custom/render-graph.ts @@ -94,6 +94,8 @@ export class ManagedResource { // PolymorphicGraph Concept export const enum ResourceGraphValue { Managed, + ManagedBuffer, + ManagedTexture, PersistentBuffer, PersistentTexture, Framebuffer, @@ -103,6 +105,8 @@ export const enum ResourceGraphValue { export function getResourceGraphValueName (e: ResourceGraphValue): string { switch (e) { case ResourceGraphValue.Managed: return 'Managed'; + case ResourceGraphValue.ManagedBuffer: return 'ManagedBuffer'; + case ResourceGraphValue.ManagedTexture: return 'ManagedTexture'; case ResourceGraphValue.PersistentBuffer: return 'PersistentBuffer'; case ResourceGraphValue.PersistentTexture: return 'PersistentTexture'; case ResourceGraphValue.Framebuffer: return 'Framebuffer'; @@ -113,6 +117,8 @@ export function getResourceGraphValueName (e: ResourceGraphValue): string { interface ResourceGraphValueType { [ResourceGraphValue.Managed]: ManagedResource + [ResourceGraphValue.ManagedBuffer]: ManagedBuffer + [ResourceGraphValue.ManagedTexture]: ManagedTexture [ResourceGraphValue.PersistentBuffer]: Buffer [ResourceGraphValue.PersistentTexture]: Texture [ResourceGraphValue.Framebuffer]: Framebuffer @@ -121,6 +127,8 @@ interface ResourceGraphValueType { export interface ResourceGraphVisitor { managed(value: ManagedResource): unknown; + managedBuffer(value: ManagedBuffer): unknown; + managedTexture(value: ManagedTexture): unknown; persistentBuffer(value: Buffer): unknown; persistentTexture(value: Texture): unknown; framebuffer(value: Framebuffer): unknown; @@ -128,6 +136,8 @@ export interface ResourceGraphVisitor { } type ResourceGraphObject = ManagedResource +| ManagedBuffer +| ManagedTexture | Buffer | Texture | Framebuffer @@ -518,6 +528,10 @@ export class ResourceGraph implements impl.BidirectionalGraph switch (vert._id) { case ResourceGraphValue.Managed: return visitor.managed(vert._object as ManagedResource); + case ResourceGraphValue.ManagedBuffer: + return visitor.managedBuffer(vert._object as ManagedBuffer); + case ResourceGraphValue.ManagedTexture: + return visitor.managedTexture(vert._object as ManagedTexture); case ResourceGraphValue.PersistentBuffer: return visitor.persistentBuffer(vert._object as Buffer); case ResourceGraphValue.PersistentTexture: @@ -537,6 +551,20 @@ export class ResourceGraph implements impl.BidirectionalGraph throw Error('value id not match'); } } + getManagedBuffer (v: number): ManagedBuffer { + if (this._vertices[v]._id === ResourceGraphValue.ManagedBuffer) { + return this._vertices[v]._object as ManagedBuffer; + } else { + throw Error('value id not match'); + } + } + getManagedTexture (v: number): ManagedTexture { + if (this._vertices[v]._id === ResourceGraphValue.ManagedTexture) { + return this._vertices[v]._object as ManagedTexture; + } else { + throw Error('value id not match'); + } + } getPersistentBuffer (v: number): Buffer { if (this._vertices[v]._id === ResourceGraphValue.PersistentBuffer) { return this._vertices[v]._object as Buffer; @@ -572,6 +600,20 @@ export class ResourceGraph implements impl.BidirectionalGraph return null; } } + tryGetManagedBuffer (v: number): ManagedBuffer | null { + if (this._vertices[v]._id === ResourceGraphValue.ManagedBuffer) { + return this._vertices[v]._object as ManagedBuffer; + } else { + return null; + } + } + tryGetManagedTexture (v: number): ManagedTexture | null { + if (this._vertices[v]._id === ResourceGraphValue.ManagedTexture) { + return this._vertices[v]._object as ManagedTexture; + } else { + return null; + } + } tryGetPersistentBuffer (v: number): Buffer | null { if (this._vertices[v]._id === ResourceGraphValue.PersistentBuffer) { return this._vertices[v]._object as Buffer; diff --git a/native/cocos/renderer/pipeline/custom/FGDispatcherGraphs.h b/native/cocos/renderer/pipeline/custom/FGDispatcherGraphs.h index 28bed650ab..2059fa06a5 100644 --- a/native/cocos/renderer/pipeline/custom/FGDispatcherGraphs.h +++ b/native/cocos/renderer/pipeline/custom/FGDispatcherGraphs.h @@ -144,8 +144,8 @@ add_edge( // NOLINT } inline void remove_edge(ResourceAccessGraph::vertex_descriptor u, ResourceAccessGraph::vertex_descriptor v, ResourceAccessGraph& g) noexcept { // NOLINT - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; s.outEdges.erase(std::remove(s.outEdges.begin(), s.outEdges.end(), ResourceAccessGraph::OutEdge(v)), s.outEdges.end()); t.inEdges.erase(std::remove(t.inEdges.begin(), t.inEdges.end(), ResourceAccessGraph::InEdge(u)), t.inEdges.end()); } @@ -154,8 +154,8 @@ inline void remove_edge(ResourceAccessGraph::out_edge_iterator outIter, Resource auto e = *outIter; const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; auto inIter = std::find(t.inEdges.begin(), t.inEdges.end(), ResourceAccessGraph::InEdge(u)); CC_EXPECTS(inIter != t.inEdges.end()); t.inEdges.erase(inIter); @@ -165,7 +165,7 @@ inline void remove_edge(ResourceAccessGraph::out_edge_iterator outIter, Resource inline void remove_edge(ResourceAccessGraph::edge_descriptor e, ResourceAccessGraph& g) noexcept { // NOLINT const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; + auto& s = g._vertices[u]; auto outIter = std::find(s.outEdges.begin(), s.outEdges.end(), ResourceAccessGraph::OutEdge(v)); CC_EXPECTS(outIter != s.outEdges.end()); remove_edge(ResourceAccessGraph::out_edge_iterator(outIter, u), g); @@ -228,9 +228,9 @@ inline void remove_vertex(ResourceAccessGraph::vertex_descriptor u, ResourceAcce template inline ResourceAccessGraph::vertex_descriptor addVertex(Component0&& c0, Component1&& c1, ResourceAccessGraph& g) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); + g._vertices.emplace_back(); { // UuidGraph const auto& uuid = c0; @@ -246,9 +246,9 @@ addVertex(Component0&& c0, Component1&& c1, ResourceAccessGraph& g) { template inline ResourceAccessGraph::vertex_descriptor addVertex(std::piecewise_construct_t /*tag*/, Component0&& c0, Component1&& c1, ResourceAccessGraph& g) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); + g._vertices.emplace_back(); { // UuidGraph std::apply( @@ -376,8 +376,8 @@ add_edge( // NOLINT } inline void remove_edge(EmptyGraph::vertex_descriptor u, EmptyGraph::vertex_descriptor v, EmptyGraph& g) noexcept { // NOLINT - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; s.outEdges.erase(std::remove(s.outEdges.begin(), s.outEdges.end(), EmptyGraph::OutEdge(v)), s.outEdges.end()); t.inEdges.erase(std::remove(t.inEdges.begin(), t.inEdges.end(), EmptyGraph::InEdge(u)), t.inEdges.end()); } @@ -386,8 +386,8 @@ inline void remove_edge(EmptyGraph::out_edge_iterator outIter, EmptyGraph& g) no auto e = *outIter; const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; auto inIter = std::find(t.inEdges.begin(), t.inEdges.end(), EmptyGraph::InEdge(u)); CC_EXPECTS(inIter != t.inEdges.end()); t.inEdges.erase(inIter); @@ -397,7 +397,7 @@ inline void remove_edge(EmptyGraph::out_edge_iterator outIter, EmptyGraph& g) no inline void remove_edge(EmptyGraph::edge_descriptor e, EmptyGraph& g) noexcept { // NOLINT const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; + auto& s = g._vertices[u]; auto outIter = std::find(s.outEdges.begin(), s.outEdges.end(), EmptyGraph::OutEdge(v)); CC_EXPECTS(outIter != s.outEdges.end()); remove_edge(EmptyGraph::out_edge_iterator(outIter, u), g); @@ -664,9 +664,9 @@ get(ccstd::pmr::vector& colors, const EmptyGraph& /*g // MutableGraph(Vertex) inline EmptyGraph::vertex_descriptor addVertex(EmptyGraph& g) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); + g._vertices.emplace_back(); return v; } diff --git a/native/cocos/renderer/pipeline/custom/FGDispatcherTypes.cpp b/native/cocos/renderer/pipeline/custom/FGDispatcherTypes.cpp index 4d2f2c7597..2d1c1c65bf 100644 --- a/native/cocos/renderer/pipeline/custom/FGDispatcherTypes.cpp +++ b/native/cocos/renderer/pipeline/custom/FGDispatcherTypes.cpp @@ -36,7 +36,7 @@ namespace cc { namespace render { ResourceAccessGraph::ResourceAccessGraph(const allocator_type& alloc) noexcept -: vertices(alloc), +: _vertices(alloc), passID(alloc), access(alloc), passIndex(alloc), @@ -47,7 +47,7 @@ ResourceAccessGraph::ResourceAccessGraph(const allocator_type& alloc) noexcept // ContinuousContainer void ResourceAccessGraph::reserve(vertices_size_type sz) { - vertices.reserve(sz); + _vertices.reserve(sz); passID.reserve(sz); access.reserve(sz); } diff --git a/native/cocos/renderer/pipeline/custom/FGDispatcherTypes.h b/native/cocos/renderer/pipeline/custom/FGDispatcherTypes.h index 5ddd18f9a3..1c14ab3c94 100644 --- a/native/cocos/renderer/pipeline/custom/FGDispatcherTypes.h +++ b/native/cocos/renderer/pipeline/custom/FGDispatcherTypes.h @@ -94,7 +94,7 @@ struct ResourceAccessNode { struct ResourceAccessGraph { using allocator_type = boost::container::pmr::polymorphic_allocator; allocator_type get_allocator() const noexcept { // NOLINT - return {vertices.get_allocator().resource()}; + return {_vertices.get_allocator().resource()}; } inline boost::container::pmr::memory_resource* resource() const noexcept { @@ -146,29 +146,29 @@ struct ResourceAccessGraph { // VertexList help functions inline ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline const ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline const ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline boost::integer_range getVertexList() const noexcept { - return {0, static_cast(vertices.size())}; + return {0, static_cast(_vertices.size())}; } inline vertex_descriptor getCurrentID() const noexcept { - return static_cast(vertices.size()); + return static_cast(_vertices.size()); } inline ccstd::pmr::vector colors(boost::container::pmr::memory_resource* mr) const { - return ccstd::pmr::vector(vertices.size(), mr); + return ccstd::pmr::vector(_vertices.size(), mr); } // EdgeListGraph @@ -218,7 +218,7 @@ struct ResourceAccessGraph { } static constexpr AccessNode{}; // NOLINT // Vertices - ccstd::pmr::vector vertices; + ccstd::pmr::vector _vertices; // Components ccstd::pmr::vector passID; ccstd::pmr::vector access; @@ -278,29 +278,29 @@ struct EmptyGraph { // VertexList help functions inline std::vector& getOutEdgeList(vertex_descriptor v) noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline const std::vector& getOutEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline std::vector& getInEdgeList(vertex_descriptor v) noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline const std::vector& getInEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline boost::integer_range getVertexList() const noexcept { - return {0, static_cast(vertices.size())}; + return {0, static_cast(_vertices.size())}; } inline vertex_descriptor getCurrentID() const noexcept { - return static_cast(vertices.size()); + return static_cast(_vertices.size()); } inline ccstd::pmr::vector colors(boost::container::pmr::memory_resource* mr) const { - return ccstd::pmr::vector(vertices.size(), mr); + return ccstd::pmr::vector(_vertices.size(), mr); } // EdgeListGraph @@ -316,7 +316,7 @@ struct EmptyGraph { std::vector inEdges; }; // Vertices - std::vector vertices; + std::vector _vertices; }; struct Barrier { diff --git a/native/cocos/renderer/pipeline/custom/FrameGraphDispatcher.cpp b/native/cocos/renderer/pipeline/custom/FrameGraphDispatcher.cpp index ad5214bff0..40df977039 100644 --- a/native/cocos/renderer/pipeline/custom/FrameGraphDispatcher.cpp +++ b/native/cocos/renderer/pipeline/custom/FrameGraphDispatcher.cpp @@ -1160,12 +1160,12 @@ void passReorder(FrameGraphDispatcher &fgDispatcher) { } // topological sort - bool empty = relationGraph.vertices.empty(); + bool empty = relationGraph._vertices.empty(); ScoreMap scoreMap; std::queue vertQ; EmptyVerts candidates; - for (size_t i = 0; i < relationGraph.vertices.size(); ++i) { + for (size_t i = 0; i < relationGraph._vertices.size(); ++i) { if (in_degree(static_cast(i), relationGraph) == 0) { if (std::find(candidates.begin(), candidates.end(), i) == candidates.end()) { candidates.push_back(static_cast(i)); @@ -1175,7 +1175,7 @@ void passReorder(FrameGraphDispatcher &fgDispatcher) { std::vector candidateBuffer; uint32_t coloredVerts = 0; - while (coloredVerts < relationGraph.vertices.size()) { + while (coloredVerts < relationGraph._vertices.size()) { // decreasing order, pop back from vector, push into queue, then it's ascending order. std::sort(candidates.begin(), candidates.end(), [&](EmptyVert lhsVert, EmptyVert rhsVert) { int64_t lhsForwardScore{0}; diff --git a/native/cocos/renderer/pipeline/custom/GraphImpl.h b/native/cocos/renderer/pipeline/custom/GraphImpl.h index 767c14c146..95296a4a92 100644 --- a/native/cocos/renderer/pipeline/custom/GraphImpl.h +++ b/native/cocos/renderer/pipeline/custom/GraphImpl.h @@ -511,7 +511,7 @@ inline void reindexVectorHandle(Container &container, HandleDescriptor u) { template inline void removeVectorVertex(Graph &g, VertexDescriptor u, boost::directed_tag /*tag*/) { - g.vertices.erase(g.vertices.begin() + u); + g._vertices.erase(g._vertices.begin() + u); auto numV = num_vertices(g); if (u != numV) { for (VertexDescriptor v = 0; v < numV; ++v) { @@ -522,7 +522,7 @@ inline void removeVectorVertex(Graph &g, VertexDescriptor u, boost::directed_tag template inline void removeVectorVertex(Graph &g, VertexDescriptor u, boost::undirected_tag /*tag*/) { - g.vertices.erase(g.vertices.begin() + u); + g._vertices.erase(g._vertices.begin() + u); VertexDescriptor numV = num_vertices(g); for (VertexDescriptor v = 0; v < numV; ++v) { reindexEdgeList(g.getOutEdgeList(v), u); @@ -542,7 +542,7 @@ inline void removeVectorVertex(Graph &g, VertexDescriptor u, boost::undirected_t template inline void removeVectorVertex(Graph &g, VertexDescriptor u, boost::bidirectional_tag /*tag*/) { - g.vertices.erase(g.vertices.begin() + u); + g._vertices.erase(g._vertices.begin() + u); VertexDescriptor numV = num_vertices(g); VertexDescriptor v; if (u != numV) { @@ -559,7 +559,7 @@ inline void removeVectorVertex(Graph &g, VertexDescriptor u, boost::bidirectiona template inline void removeVectorVertex(Graph &g, EdgeList & /*edges*/, VertexDescriptor u, boost::bidirectional_tag /*tag*/) { - g.vertices.erase(g.vertices.begin() + u); + g._vertices.erase(g._vertices.begin() + u); VertexDescriptor numV = num_vertices(g); VertexDescriptor v; if (u != numV) { diff --git a/native/cocos/renderer/pipeline/custom/LayoutGraphGraphs.h b/native/cocos/renderer/pipeline/custom/LayoutGraphGraphs.h index 4cd89b9ccf..2b41ab24cb 100644 --- a/native/cocos/renderer/pipeline/custom/LayoutGraphGraphs.h +++ b/native/cocos/renderer/pipeline/custom/LayoutGraphGraphs.h @@ -144,8 +144,8 @@ add_edge( // NOLINT } inline void remove_edge(LayoutGraph::vertex_descriptor u, LayoutGraph::vertex_descriptor v, LayoutGraph& g) noexcept { // NOLINT - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; s.outEdges.erase(std::remove(s.outEdges.begin(), s.outEdges.end(), LayoutGraph::OutEdge(v)), s.outEdges.end()); t.inEdges.erase(std::remove(t.inEdges.begin(), t.inEdges.end(), LayoutGraph::InEdge(u)), t.inEdges.end()); } @@ -154,8 +154,8 @@ inline void remove_edge(LayoutGraph::out_edge_iterator outIter, LayoutGraph& g) auto e = *outIter; const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; auto inIter = std::find(t.inEdges.begin(), t.inEdges.end(), LayoutGraph::InEdge(u)); CC_EXPECTS(inIter != t.inEdges.end()); t.inEdges.erase(inIter); @@ -165,7 +165,7 @@ inline void remove_edge(LayoutGraph::out_edge_iterator outIter, LayoutGraph& g) inline void remove_edge(LayoutGraph::edge_descriptor e, LayoutGraph& g) noexcept { // NOLINT const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; + auto& s = g._vertices[u]; auto outIter = std::find(s.outEdges.begin(), s.outEdges.end(), LayoutGraph::OutEdge(v)); CC_EXPECTS(outIter != s.outEdges.end()); remove_edge(LayoutGraph::out_edge_iterator(outIter, u), g); @@ -359,8 +359,8 @@ add_edge( // NOLINT } inline void remove_edge(LayoutGraphData::vertex_descriptor u, LayoutGraphData::vertex_descriptor v, LayoutGraphData& g) noexcept { // NOLINT - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; s.outEdges.erase(std::remove(s.outEdges.begin(), s.outEdges.end(), LayoutGraphData::OutEdge(v)), s.outEdges.end()); t.inEdges.erase(std::remove(t.inEdges.begin(), t.inEdges.end(), LayoutGraphData::InEdge(u)), t.inEdges.end()); } @@ -369,8 +369,8 @@ inline void remove_edge(LayoutGraphData::out_edge_iterator outIter, LayoutGraphD auto e = *outIter; const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; auto inIter = std::find(t.inEdges.begin(), t.inEdges.end(), LayoutGraphData::InEdge(u)); CC_EXPECTS(inIter != t.inEdges.end()); t.inEdges.erase(inIter); @@ -380,7 +380,7 @@ inline void remove_edge(LayoutGraphData::out_edge_iterator outIter, LayoutGraphD inline void remove_edge(LayoutGraphData::edge_descriptor e, LayoutGraphData& g) noexcept { // NOLINT const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; + auto& s = g._vertices[u]; auto outIter = std::find(s.outEdges.begin(), s.outEdges.end(), LayoutGraphData::OutEdge(v)); CC_EXPECTS(outIter != s.outEdges.end()); remove_edge(LayoutGraphData::out_edge_iterator(outIter, u), g); @@ -724,7 +724,7 @@ id(LayoutGraph::vertex_descriptor u, const LayoutGraph& g) noexcept { [](const impl::ValueHandle& h) { return h.value; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline LayoutGraph::VertexTag @@ -738,7 +738,7 @@ tag(LayoutGraph::vertex_descriptor u, const LayoutGraph& g) noexcept { [](const impl::ValueHandle&) { return LayoutGraph::VertexTag{RenderPhaseTag{}}; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline LayoutGraph::VertexValue @@ -752,7 +752,7 @@ value(LayoutGraph::vertex_descriptor u, LayoutGraph& g) noexcept { [&](const impl::ValueHandle& h) { return LayoutGraph::VertexValue{&g.phases[h.value]}; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline LayoutGraph::VertexConstValue @@ -766,7 +766,7 @@ value(LayoutGraph::vertex_descriptor u, const LayoutGraph& g) noexcept { [&](const impl::ValueHandle& h) { return LayoutGraph::VertexConstValue{&g.phases[h.value]}; }), - g.vertices[u].handle); + g._vertices[u].handle); } template @@ -778,7 +778,7 @@ inline bool holds(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -786,7 +786,7 @@ inline bool holds(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template @@ -798,7 +798,7 @@ inline bool holds_alternative(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -806,7 +806,7 @@ inline bool holds_alternative(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template @@ -818,7 +818,7 @@ inline uint32_t& get(LayoutGraph::vertex_descriptor v, LayoutGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.stages[handle.value]; } @@ -827,7 +827,7 @@ inline RenderPhase& get(LayoutGraph::vertex_descriptor v, LayoutGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.phases[handle.value]; } @@ -840,7 +840,7 @@ inline const uint32_t& get(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.stages[handle.value]; } @@ -849,7 +849,7 @@ inline const RenderPhase& get(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.phases[handle.value]; } @@ -857,7 +857,7 @@ inline uint32_t& get(RenderStageTag /*tag*/, LayoutGraph::vertex_descriptor v, LayoutGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.stages[handle.value]; } @@ -865,7 +865,7 @@ inline RenderPhase& get(RenderPhaseTag /*tag*/, LayoutGraph::vertex_descriptor v, LayoutGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.phases[handle.value]; } @@ -873,7 +873,7 @@ inline const uint32_t& get(RenderStageTag /*tag*/, LayoutGraph::vertex_descriptor v, const LayoutGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.stages[handle.value]; } @@ -881,7 +881,7 @@ inline const RenderPhase& get(RenderPhaseTag /*tag*/, LayoutGraph::vertex_descriptor v, const LayoutGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.phases[handle.value]; } @@ -899,7 +899,7 @@ get_if(LayoutGraph::vertex_descriptor v, LayoutGraph* pGraph) noexcept auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.stages[pHandle->value]; } @@ -916,7 +916,7 @@ get_if(LayoutGraph::vertex_descriptor v, LayoutGraph* pGraph) noexc auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.phases[pHandle->value]; } @@ -937,7 +937,7 @@ get_if(LayoutGraph::vertex_descriptor v, const LayoutGraph* pGraph) no const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.stages[pHandle->value]; } @@ -954,7 +954,7 @@ get_if(LayoutGraph::vertex_descriptor v, const LayoutGraph* pGraph) const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.phases[pHandle->value]; } @@ -1207,21 +1207,21 @@ inline void remove_vertex_value_impl(const LayoutGraph::VertexHandle& h, LayoutG if (h.value == g.stages.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.phases.erase(g.phases.begin() + std::ptrdiff_t(h.value)); if (h.value == g.phases.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }), h); } inline void remove_vertex(LayoutGraph::vertex_descriptor u, LayoutGraph& g) noexcept { // NOLINT // preserve vertex' iterators - auto& vert = g.vertices[u]; + auto& vert = g._vertices[u]; remove_vertex_value_impl(vert.handle, g); impl::removeVectorVertex(const_cast(g), u, LayoutGraph::directed_category{}); @@ -1252,10 +1252,10 @@ void addVertexImpl( // NOLINT template inline LayoutGraph::vertex_descriptor addVertex(Component0&& c0, Component1&& c1, ValueT&& val, LayoutGraph& g, LayoutGraph::vertex_descriptor u = LayoutGraph::null_vertex()) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); - auto& vert = g.vertices.back(); + g._vertices.emplace_back(); + auto& vert = g._vertices.back(); g.names.emplace_back(std::forward(c0)); g.descriptors.emplace_back(std::forward(c1)); @@ -1294,10 +1294,10 @@ void addVertexImpl(RenderPhaseTag /*tag*/, Tuple &&val, LayoutGraph &g, LayoutGr template inline LayoutGraph::vertex_descriptor addVertex(Tag tag, Component0&& c0, Component1&& c1, ValueT&& val, LayoutGraph& g, LayoutGraph::vertex_descriptor u = LayoutGraph::null_vertex()) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); - auto& vert = g.vertices.back(); + g._vertices.emplace_back(); + auto& vert = g._vertices.back(); std::apply( [&](auto&&... args) { @@ -1424,7 +1424,7 @@ id(LayoutGraphData::vertex_descriptor u, const LayoutGraphData& g) noexcept { [](const impl::ValueHandle& h) { return h.value; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline LayoutGraphData::VertexTag @@ -1438,7 +1438,7 @@ tag(LayoutGraphData::vertex_descriptor u, const LayoutGraphData& g) noexcept { [](const impl::ValueHandle&) { return LayoutGraphData::VertexTag{RenderPhaseTag{}}; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline LayoutGraphData::VertexValue @@ -1452,7 +1452,7 @@ value(LayoutGraphData::vertex_descriptor u, LayoutGraphData& g) noexcept { [&](const impl::ValueHandle& h) { return LayoutGraphData::VertexValue{&g.phases[h.value]}; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline LayoutGraphData::VertexConstValue @@ -1466,7 +1466,7 @@ value(LayoutGraphData::vertex_descriptor u, const LayoutGraphData& g) noexcept { [&](const impl::ValueHandle& h) { return LayoutGraphData::VertexConstValue{&g.phases[h.value]}; }), - g.vertices[u].handle); + g._vertices[u].handle); } template @@ -1478,7 +1478,7 @@ inline bool holds(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -1486,7 +1486,7 @@ inline bool holds(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template @@ -1498,7 +1498,7 @@ inline bool holds_alternative(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -1506,7 +1506,7 @@ inline bool holds_alternative(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template @@ -1518,7 +1518,7 @@ inline RenderStageData& get(LayoutGraphData::vertex_descriptor v, LayoutGraphData& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.stages[handle.value]; } @@ -1527,7 +1527,7 @@ inline RenderPhaseData& get(LayoutGraphData::vertex_descriptor v, LayoutGraphData& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.phases[handle.value]; } @@ -1540,7 +1540,7 @@ inline const RenderStageData& get(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.stages[handle.value]; } @@ -1549,7 +1549,7 @@ inline const RenderPhaseData& get(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.phases[handle.value]; } @@ -1557,7 +1557,7 @@ inline RenderStageData& get(RenderStageTag /*tag*/, LayoutGraphData::vertex_descriptor v, LayoutGraphData& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.stages[handle.value]; } @@ -1565,7 +1565,7 @@ inline RenderPhaseData& get(RenderPhaseTag /*tag*/, LayoutGraphData::vertex_descriptor v, LayoutGraphData& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.phases[handle.value]; } @@ -1573,7 +1573,7 @@ inline const RenderStageData& get(RenderStageTag /*tag*/, LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.stages[handle.value]; } @@ -1581,7 +1581,7 @@ inline const RenderPhaseData& get(RenderPhaseTag /*tag*/, LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.phases[handle.value]; } @@ -1599,7 +1599,7 @@ get_if(LayoutGraphData::vertex_descriptor v, LayoutGraphData* p auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.stages[pHandle->value]; } @@ -1616,7 +1616,7 @@ get_if(LayoutGraphData::vertex_descriptor v, LayoutGraphData* p auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.phases[pHandle->value]; } @@ -1637,7 +1637,7 @@ get_if(LayoutGraphData::vertex_descriptor v, const LayoutGraphD const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.stages[pHandle->value]; } @@ -1654,7 +1654,7 @@ get_if(LayoutGraphData::vertex_descriptor v, const LayoutGraphD const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.phases[pHandle->value]; } @@ -1907,21 +1907,21 @@ inline void remove_vertex_value_impl(const LayoutGraphData::VertexHandle& h, Lay if (h.value == g.stages.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.phases.erase(g.phases.begin() + std::ptrdiff_t(h.value)); if (h.value == g.phases.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }), h); } inline void remove_vertex(LayoutGraphData::vertex_descriptor u, LayoutGraphData& g) noexcept { // NOLINT // preserve vertex' iterators - auto& vert = g.vertices[u]; + auto& vert = g._vertices[u]; remove_vertex_value_impl(vert.handle, g); impl::removeVectorVertex(const_cast(g), u, LayoutGraphData::directed_category{}); @@ -1953,10 +1953,10 @@ void addVertexImpl( // NOLINT template inline LayoutGraphData::vertex_descriptor addVertex(Component0&& c0, Component1&& c1, Component2&& c2, ValueT&& val, LayoutGraphData& g, LayoutGraphData::vertex_descriptor u = LayoutGraphData::null_vertex()) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); - auto& vert = g.vertices.back(); + g._vertices.emplace_back(); + auto& vert = g._vertices.back(); g.names.emplace_back(std::forward(c0)); g.updateFrequencies.emplace_back(std::forward(c1)); g.layouts.emplace_back(std::forward(c2)); @@ -1996,10 +1996,10 @@ void addVertexImpl(RenderPhaseTag /*tag*/, Tuple &&val, LayoutGraphData &g, Layo template inline LayoutGraphData::vertex_descriptor addVertex(Tag tag, Component0&& c0, Component1&& c1, Component2&& c2, ValueT&& val, LayoutGraphData& g, LayoutGraphData::vertex_descriptor u = LayoutGraphData::null_vertex()) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); - auto& vert = g.vertices.back(); + g._vertices.emplace_back(); + auto& vert = g._vertices.back(); std::apply( [&](auto&&... args) { diff --git a/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.cpp b/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.cpp index 4abfadf53b..20e9538476 100644 --- a/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.cpp +++ b/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.cpp @@ -54,7 +54,7 @@ RenderPhase::RenderPhase(RenderPhase const& rhs, const allocator_type& alloc) : shaders(rhs.shaders, alloc) {} LayoutGraph::LayoutGraph(const allocator_type& alloc) noexcept -: vertices(alloc), +: _vertices(alloc), names(alloc), descriptors(alloc), stages(alloc), @@ -62,7 +62,7 @@ LayoutGraph::LayoutGraph(const allocator_type& alloc) noexcept pathIndex(alloc) {} LayoutGraph::LayoutGraph(LayoutGraph&& rhs, const allocator_type& alloc) -: vertices(std::move(rhs.vertices), alloc), +: _vertices(std::move(rhs._vertices), alloc), names(std::move(rhs.names), alloc), descriptors(std::move(rhs.descriptors), alloc), stages(std::move(rhs.stages), alloc), @@ -70,7 +70,7 @@ LayoutGraph::LayoutGraph(LayoutGraph&& rhs, const allocator_type& alloc) pathIndex(std::move(rhs.pathIndex), alloc) {} LayoutGraph::LayoutGraph(LayoutGraph const& rhs, const allocator_type& alloc) -: vertices(rhs.vertices, alloc), +: _vertices(rhs._vertices, alloc), names(rhs.names, alloc), descriptors(rhs.descriptors, alloc), stages(rhs.stages, alloc), @@ -79,7 +79,7 @@ LayoutGraph::LayoutGraph(LayoutGraph const& rhs, const allocator_type& alloc) // ContinuousContainer void LayoutGraph::reserve(vertices_size_type sz) { - vertices.reserve(sz); + _vertices.reserve(sz); names.reserve(sz); descriptors.reserve(sz); } @@ -191,7 +191,7 @@ RenderPhaseData::RenderPhaseData(RenderPhaseData&& rhs, const allocator_type& al shaderIndex(std::move(rhs.shaderIndex), alloc) {} LayoutGraphData::LayoutGraphData(const allocator_type& alloc) noexcept -: vertices(alloc), +: _vertices(alloc), names(alloc), updateFrequencies(alloc), layouts(alloc), @@ -204,7 +204,7 @@ LayoutGraphData::LayoutGraphData(const allocator_type& alloc) noexcept pathIndex(alloc) {} LayoutGraphData::LayoutGraphData(LayoutGraphData&& rhs, const allocator_type& alloc) -: vertices(std::move(rhs.vertices), alloc), +: _vertices(std::move(rhs._vertices), alloc), names(std::move(rhs.names), alloc), updateFrequencies(std::move(rhs.updateFrequencies), alloc), layouts(std::move(rhs.layouts), alloc), @@ -218,7 +218,7 @@ LayoutGraphData::LayoutGraphData(LayoutGraphData&& rhs, const allocator_type& al // ContinuousContainer void LayoutGraphData::reserve(vertices_size_type sz) { - vertices.reserve(sz); + _vertices.reserve(sz); names.reserve(sz); updateFrequencies.reserve(sz); layouts.reserve(sz); diff --git a/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.h b/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.h index cb34c98665..65326bd7e3 100644 --- a/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.h +++ b/native/cocos/renderer/pipeline/custom/LayoutGraphTypes.h @@ -149,7 +149,7 @@ struct RenderPhase { struct LayoutGraph { using allocator_type = boost::container::pmr::polymorphic_allocator; allocator_type get_allocator() const noexcept { // NOLINT - return {vertices.get_allocator().resource()}; + return {_vertices.get_allocator().resource()}; } inline boost::container::pmr::memory_resource* resource() const noexcept { @@ -204,29 +204,29 @@ struct LayoutGraph { // VertexList help functions inline ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline const ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline const ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline boost::integer_range getVertexList() const noexcept { - return {0, static_cast(vertices.size())}; + return {0, static_cast(_vertices.size())}; } inline vertex_descriptor getCurrentID() const noexcept { - return static_cast(vertices.size()); + return static_cast(_vertices.size()); } inline ccstd::pmr::vector colors(boost::container::pmr::memory_resource* mr) const { - return ccstd::pmr::vector(vertices.size(), mr); + return ccstd::pmr::vector(_vertices.size(), mr); } // EdgeListGraph @@ -252,17 +252,17 @@ struct LayoutGraph { // AddressableGraph help functions inline ccstd::pmr::vector& getChildrenList(vertex_descriptor v) noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline const ccstd::pmr::vector& getChildrenList(vertex_descriptor v) const noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline ccstd::pmr::vector& getParentsList(vertex_descriptor v) noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline const ccstd::pmr::vector& getParentsList(vertex_descriptor v) const noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } // PolymorphicGraph @@ -303,7 +303,7 @@ struct LayoutGraph { } static constexpr Descriptors{}; // NOLINT // Vertices - ccstd::pmr::vector vertices; + ccstd::pmr::vector _vertices; // Components ccstd::pmr::vector names; ccstd::pmr::vector descriptors; @@ -509,7 +509,7 @@ struct RenderPhaseData { struct LayoutGraphData { using allocator_type = boost::container::pmr::polymorphic_allocator; allocator_type get_allocator() const noexcept { // NOLINT - return {vertices.get_allocator().resource()}; + return {_vertices.get_allocator().resource()}; } inline boost::container::pmr::memory_resource* resource() const noexcept { @@ -563,29 +563,29 @@ struct LayoutGraphData { // VertexList help functions inline ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline const ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline const ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline boost::integer_range getVertexList() const noexcept { - return {0, static_cast(vertices.size())}; + return {0, static_cast(_vertices.size())}; } inline vertex_descriptor getCurrentID() const noexcept { - return static_cast(vertices.size()); + return static_cast(_vertices.size()); } inline ccstd::pmr::vector colors(boost::container::pmr::memory_resource* mr) const { - return ccstd::pmr::vector(vertices.size(), mr); + return ccstd::pmr::vector(_vertices.size(), mr); } // EdgeListGraph @@ -611,17 +611,17 @@ struct LayoutGraphData { // AddressableGraph help functions inline ccstd::pmr::vector& getChildrenList(vertex_descriptor v) noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline const ccstd::pmr::vector& getChildrenList(vertex_descriptor v) const noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline ccstd::pmr::vector& getParentsList(vertex_descriptor v) noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline const ccstd::pmr::vector& getParentsList(vertex_descriptor v) const noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } // PolymorphicGraph @@ -664,7 +664,7 @@ struct LayoutGraphData { } static constexpr Layout{}; // NOLINT // Vertices - ccstd::pmr::vector vertices; + ccstd::pmr::vector _vertices; // Components ccstd::pmr::vector names; ccstd::pmr::vector updateFrequencies; diff --git a/native/cocos/renderer/pipeline/custom/NativeResourceGraph.cpp b/native/cocos/renderer/pipeline/custom/NativeResourceGraph.cpp index d2a90e1196..3d6ce320fe 100644 --- a/native/cocos/renderer/pipeline/custom/NativeResourceGraph.cpp +++ b/native/cocos/renderer/pipeline/custom/NativeResourceGraph.cpp @@ -23,18 +23,71 @@ THE SOFTWARE. ****************************************************************************/ +#include "Range.h" +#include "RenderGraphGraphs.h" #include "RenderGraphTypes.h" + namespace cc { namespace render { void ResourceGraph::mount(vertex_descriptor vertID, ccstd::pmr::vector& mounted) { - + auto& resg = *this; + visitObject( + vertID, resg, + [&](const ManagedResource& resource) { + // to be removed + }, + [&](ManagedBuffer& buffer) { + if (!buffer.buffer) { + mounted.emplace_back(vertID); + } + buffer.fenceValue = nextFenceValue; + }, + [&](ManagedTexture& texture) { + if (!texture.texture) { + mounted.emplace_back(vertID); + } + texture.fenceValue = nextFenceValue; + }, + [&](const IntrusivePtr& pass) { + }, + [&](const IntrusivePtr& pass) { + }, + [&](const IntrusivePtr& pass) { + }, + [&](const RenderSwapchain& queue) { + }); } void ResourceGraph::unmount(uint64_t completedFenceValue) { - + auto& resg = *this; + for (const auto& vertID : makeRange(vertices(resg))) { + visitObject( + vertID, resg, + [&](const ManagedResource& resource) { + // to be removed + }, + [&](ManagedBuffer& buffer) { + if (buffer.fenceValue <= completedFenceValue) { + buffer.buffer.reset(); + } + }, + [&](ManagedTexture& texture) { + if (texture.fenceValue <= completedFenceValue) { + texture.texture.reset(); + } + }, + [&](const IntrusivePtr& pass) { + }, + [&](const IntrusivePtr& pass) { + }, + [&](const IntrusivePtr& pass) { + }, + [&](const RenderSwapchain& queue) { + }); + } } } // namespace render diff --git a/native/cocos/renderer/pipeline/custom/RenderGraphGraphs.h b/native/cocos/renderer/pipeline/custom/RenderGraphGraphs.h index f6882f7e21..05607c3392 100644 --- a/native/cocos/renderer/pipeline/custom/RenderGraphGraphs.h +++ b/native/cocos/renderer/pipeline/custom/RenderGraphGraphs.h @@ -144,8 +144,8 @@ add_edge( // NOLINT } inline void remove_edge(ResourceGraph::vertex_descriptor u, ResourceGraph::vertex_descriptor v, ResourceGraph& g) noexcept { // NOLINT - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; s.outEdges.erase(std::remove(s.outEdges.begin(), s.outEdges.end(), ResourceGraph::OutEdge(v)), s.outEdges.end()); t.inEdges.erase(std::remove(t.inEdges.begin(), t.inEdges.end(), ResourceGraph::InEdge(u)), t.inEdges.end()); } @@ -154,8 +154,8 @@ inline void remove_edge(ResourceGraph::out_edge_iterator outIter, ResourceGraph& auto e = *outIter; const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; auto inIter = std::find(t.inEdges.begin(), t.inEdges.end(), ResourceGraph::InEdge(u)); CC_EXPECTS(inIter != t.inEdges.end()); t.inEdges.erase(inIter); @@ -165,7 +165,7 @@ inline void remove_edge(ResourceGraph::out_edge_iterator outIter, ResourceGraph& inline void remove_edge(ResourceGraph::edge_descriptor e, ResourceGraph& g) noexcept { // NOLINT const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; + auto& s = g._vertices[u]; auto outIter = std::find(s.outEdges.begin(), s.outEdges.end(), ResourceGraph::OutEdge(v)); CC_EXPECTS(outIter != s.outEdges.end()); remove_edge(ResourceGraph::out_edge_iterator(outIter, u), g); @@ -214,42 +214,56 @@ inline void remove_vertex_value_impl(const ResourceGraph::VertexHandle& h, Resou if (h.value == g.resources.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); + }, + [&](const impl::ValueHandle& h) { + g.managedBuffers.erase(g.managedBuffers.begin() + std::ptrdiff_t(h.value)); + if (h.value == g.managedBuffers.size()) { + return; + } + impl::reindexVectorHandle(g._vertices, h.value); + }, + [&](const impl::ValueHandle& h) { + g.managedTextures.erase(g.managedTextures.begin() + std::ptrdiff_t(h.value)); + if (h.value == g.managedTextures.size()) { + return; + } + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.buffers.erase(g.buffers.begin() + std::ptrdiff_t(h.value)); if (h.value == g.buffers.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.textures.erase(g.textures.begin() + std::ptrdiff_t(h.value)); if (h.value == g.textures.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.framebuffers.erase(g.framebuffers.begin() + std::ptrdiff_t(h.value)); if (h.value == g.framebuffers.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.swapchains.erase(g.swapchains.begin() + std::ptrdiff_t(h.value)); if (h.value == g.swapchains.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }), h); } inline void remove_vertex(ResourceGraph::vertex_descriptor u, ResourceGraph& g) noexcept { // NOLINT // preserve vertex' iterators - auto& vert = g.vertices[u]; + auto& vert = g._vertices[u]; remove_vertex_value_impl(vert.handle, g); { // UuidGraph const auto& key = g.names[u]; @@ -281,6 +295,24 @@ void addVertexImpl( // NOLINT g.resources.emplace_back(std::forward(val)); } +template +void addVertexImpl( // NOLINT + ValueT &&val, ResourceGraph &g, ResourceGraph::Vertex &vert, // NOLINT + std::enable_if_t, ManagedBuffer>::value>* dummy = nullptr) { // NOLINT + vert.handle = impl::ValueHandle{ + gsl::narrow_cast(g.managedBuffers.size())}; + g.managedBuffers.emplace_back(std::forward(val)); +} + +template +void addVertexImpl( // NOLINT + ValueT &&val, ResourceGraph &g, ResourceGraph::Vertex &vert, // NOLINT + std::enable_if_t, ManagedTexture>::value>* dummy = nullptr) { // NOLINT + vert.handle = impl::ValueHandle{ + gsl::narrow_cast(g.managedTextures.size())}; + g.managedTextures.emplace_back(std::forward(val)); +} + template void addVertexImpl( // NOLINT ValueT &&val, ResourceGraph &g, ResourceGraph::Vertex &vert, // NOLINT @@ -320,10 +352,10 @@ void addVertexImpl( // NOLINT template inline ResourceGraph::vertex_descriptor addVertex(Component0&& c0, Component1&& c1, Component2&& c2, Component3&& c3, ValueT&& val, ResourceGraph& g) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); - auto& vert = g.vertices.back(); + g._vertices.emplace_back(); + auto& vert = g._vertices.back(); { // UuidGraph const auto& uuid = c0; @@ -353,6 +385,28 @@ void addVertexImpl(ManagedTag /*tag*/, Tuple &&val, ResourceGraph &g, ResourceGr std::forward(val)); } +template +void addVertexImpl(ManagedBufferTag /*tag*/, Tuple &&val, ResourceGraph &g, ResourceGraph::Vertex &vert) { + std::apply( + [&](auto&&... args) { + vert.handle = impl::ValueHandle{ + gsl::narrow_cast(g.managedBuffers.size())}; + g.managedBuffers.emplace_back(std::forward(args)...); + }, + std::forward(val)); +} + +template +void addVertexImpl(ManagedTextureTag /*tag*/, Tuple &&val, ResourceGraph &g, ResourceGraph::Vertex &vert) { + std::apply( + [&](auto&&... args) { + vert.handle = impl::ValueHandle{ + gsl::narrow_cast(g.managedTextures.size())}; + g.managedTextures.emplace_back(std::forward(args)...); + }, + std::forward(val)); +} + template void addVertexImpl(PersistentBufferTag /*tag*/, Tuple &&val, ResourceGraph &g, ResourceGraph::Vertex &vert) { std::apply( @@ -400,10 +454,10 @@ void addVertexImpl(SwapchainTag /*tag*/, Tuple &&val, ResourceGraph &g, Resource template inline ResourceGraph::vertex_descriptor addVertex(Tag tag, Component0&& c0, Component1&& c1, Component2&& c2, Component3&& c3, ValueT&& val, ResourceGraph& g) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); - auto& vert = g.vertices.back(); + g._vertices.emplace_back(); + auto& vert = g._vertices.back(); { // UuidGraph std::apply( @@ -547,8 +601,8 @@ add_edge( // NOLINT } inline void remove_edge(SubpassGraph::vertex_descriptor u, SubpassGraph::vertex_descriptor v, SubpassGraph& g) noexcept { // NOLINT - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; s.outEdges.erase(std::remove(s.outEdges.begin(), s.outEdges.end(), SubpassGraph::OutEdge(v)), s.outEdges.end()); t.inEdges.erase(std::remove(t.inEdges.begin(), t.inEdges.end(), SubpassGraph::InEdge(u)), t.inEdges.end()); } @@ -557,8 +611,8 @@ inline void remove_edge(SubpassGraph::out_edge_iterator outIter, SubpassGraph& g auto e = *outIter; const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; auto inIter = std::find(t.inEdges.begin(), t.inEdges.end(), SubpassGraph::InEdge(u)); CC_EXPECTS(inIter != t.inEdges.end()); t.inEdges.erase(inIter); @@ -568,7 +622,7 @@ inline void remove_edge(SubpassGraph::out_edge_iterator outIter, SubpassGraph& g inline void remove_edge(SubpassGraph::edge_descriptor e, SubpassGraph& g) noexcept { // NOLINT const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; + auto& s = g._vertices[u]; auto outIter = std::find(s.outEdges.begin(), s.outEdges.end(), SubpassGraph::OutEdge(v)); CC_EXPECTS(outIter != s.outEdges.end()); remove_edge(SubpassGraph::out_edge_iterator(outIter, u), g); @@ -620,9 +674,9 @@ inline void remove_vertex(SubpassGraph::vertex_descriptor u, SubpassGraph& g) no template inline SubpassGraph::vertex_descriptor addVertex(Component0&& c0, Component1&& c1, SubpassGraph& g) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); + g._vertices.emplace_back(); g.names.emplace_back(std::forward(c0)); g.subpasses.emplace_back(std::forward(c1)); @@ -632,9 +686,9 @@ addVertex(Component0&& c0, Component1&& c1, SubpassGraph& g) { template inline SubpassGraph::vertex_descriptor addVertex(std::piecewise_construct_t /*tag*/, Component0&& c0, Component1&& c1, SubpassGraph& g) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); - g.vertices.emplace_back(); + g._vertices.emplace_back(); std::apply( [&](auto&&... args) { @@ -753,8 +807,8 @@ add_edge( // NOLINT } inline void remove_edge(RenderGraph::vertex_descriptor u, RenderGraph::vertex_descriptor v, RenderGraph& g) noexcept { // NOLINT - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; s.outEdges.erase(std::remove(s.outEdges.begin(), s.outEdges.end(), RenderGraph::OutEdge(v)), s.outEdges.end()); t.inEdges.erase(std::remove(t.inEdges.begin(), t.inEdges.end(), RenderGraph::InEdge(u)), t.inEdges.end()); } @@ -763,8 +817,8 @@ inline void remove_edge(RenderGraph::out_edge_iterator outIter, RenderGraph& g) auto e = *outIter; const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; - auto& t = g.vertices[v]; + auto& s = g._vertices[u]; + auto& t = g._vertices[v]; auto inIter = std::find(t.inEdges.begin(), t.inEdges.end(), RenderGraph::InEdge(u)); CC_EXPECTS(inIter != t.inEdges.end()); t.inEdges.erase(inIter); @@ -774,7 +828,7 @@ inline void remove_edge(RenderGraph::out_edge_iterator outIter, RenderGraph& g) inline void remove_edge(RenderGraph::edge_descriptor e, RenderGraph& g) noexcept { // NOLINT const auto u = source(e, g); const auto v = target(e, g); - auto& s = g.vertices[u]; + auto& s = g._vertices[u]; auto outIter = std::find(s.outEdges.begin(), s.outEdges.end(), RenderGraph::OutEdge(v)); CC_EXPECTS(outIter != s.outEdges.end()); remove_edge(RenderGraph::out_edge_iterator(outIter, u), g); @@ -1329,6 +1383,12 @@ id(ResourceGraph::vertex_descriptor u, const ResourceGraph& g) noexcept { [](const impl::ValueHandle& h) { return h.value; }, + [](const impl::ValueHandle& h) { + return h.value; + }, + [](const impl::ValueHandle& h) { + return h.value; + }, [](const impl::ValueHandle& h) { return h.value; }, @@ -1341,7 +1401,7 @@ id(ResourceGraph::vertex_descriptor u, const ResourceGraph& g) noexcept { [](const impl::ValueHandle& h) { return h.value; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline ResourceGraph::VertexTag @@ -1352,6 +1412,12 @@ tag(ResourceGraph::vertex_descriptor u, const ResourceGraph& g) noexcept { [](const impl::ValueHandle&) { return ResourceGraph::VertexTag{ManagedTag{}}; }, + [](const impl::ValueHandle&) { + return ResourceGraph::VertexTag{ManagedBufferTag{}}; + }, + [](const impl::ValueHandle&) { + return ResourceGraph::VertexTag{ManagedTextureTag{}}; + }, [](const impl::ValueHandle&) { return ResourceGraph::VertexTag{PersistentBufferTag{}}; }, @@ -1364,7 +1430,7 @@ tag(ResourceGraph::vertex_descriptor u, const ResourceGraph& g) noexcept { [](const impl::ValueHandle&) { return ResourceGraph::VertexTag{SwapchainTag{}}; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline ResourceGraph::VertexValue @@ -1375,6 +1441,12 @@ value(ResourceGraph::vertex_descriptor u, ResourceGraph& g) noexcept { [&](const impl::ValueHandle& h) { return ResourceGraph::VertexValue{&g.resources[h.value]}; }, + [&](const impl::ValueHandle& h) { + return ResourceGraph::VertexValue{&g.managedBuffers[h.value]}; + }, + [&](const impl::ValueHandle& h) { + return ResourceGraph::VertexValue{&g.managedTextures[h.value]}; + }, [&](const impl::ValueHandle& h) { return ResourceGraph::VertexValue{&g.buffers[h.value]}; }, @@ -1387,7 +1459,7 @@ value(ResourceGraph::vertex_descriptor u, ResourceGraph& g) noexcept { [&](const impl::ValueHandle& h) { return ResourceGraph::VertexValue{&g.swapchains[h.value]}; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline ResourceGraph::VertexConstValue @@ -1398,6 +1470,12 @@ value(ResourceGraph::vertex_descriptor u, const ResourceGraph& g) noexcept { [&](const impl::ValueHandle& h) { return ResourceGraph::VertexConstValue{&g.resources[h.value]}; }, + [&](const impl::ValueHandle& h) { + return ResourceGraph::VertexConstValue{&g.managedBuffers[h.value]}; + }, + [&](const impl::ValueHandle& h) { + return ResourceGraph::VertexConstValue{&g.managedTextures[h.value]}; + }, [&](const impl::ValueHandle& h) { return ResourceGraph::VertexConstValue{&g.buffers[h.value]}; }, @@ -1410,7 +1488,7 @@ value(ResourceGraph::vertex_descriptor u, const ResourceGraph& g) noexcept { [&](const impl::ValueHandle& h) { return ResourceGraph::VertexConstValue{&g.swapchains[h.value]}; }), - g.vertices[u].handle); + g._vertices[u].handle); } template @@ -1422,7 +1500,23 @@ inline bool holds(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); +} + +template <> +inline bool +holds(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { + return ccstd::holds_alternative< + impl::ValueHandle>( + g._vertices[v].handle); +} + +template <> +inline bool +holds(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { + return ccstd::holds_alternative< + impl::ValueHandle>( + g._vertices[v].handle); } template <> @@ -1430,7 +1524,7 @@ inline bool holds(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -1438,7 +1532,7 @@ inline bool holds(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -1446,7 +1540,7 @@ inline bool holds(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -1454,7 +1548,7 @@ inline bool holds(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template @@ -1466,7 +1560,23 @@ inline bool holds_alternative(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); +} + +template <> +inline bool +holds_alternative(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { // NOLINT + return ccstd::holds_alternative< + impl::ValueHandle>( + g._vertices[v].handle); +} + +template <> +inline bool +holds_alternative(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { // NOLINT + return ccstd::holds_alternative< + impl::ValueHandle>( + g._vertices[v].handle); } template <> @@ -1474,7 +1584,7 @@ inline bool holds_alternative>(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -1482,7 +1592,7 @@ inline bool holds_alternative>(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -1490,7 +1600,7 @@ inline bool holds_alternative>(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -1498,7 +1608,7 @@ inline bool holds_alternative(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template @@ -1510,16 +1620,34 @@ inline ManagedResource& get(ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.resources[handle.value]; } +template <> +inline ManagedBuffer& +get(ResourceGraph::vertex_descriptor v, ResourceGraph& g) { + auto& handle = ccstd::get< + impl::ValueHandle>( + g._vertices[v].handle); + return g.managedBuffers[handle.value]; +} + +template <> +inline ManagedTexture& +get(ResourceGraph::vertex_descriptor v, ResourceGraph& g) { + auto& handle = ccstd::get< + impl::ValueHandle>( + g._vertices[v].handle); + return g.managedTextures[handle.value]; +} + template <> inline IntrusivePtr& get>(ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.buffers[handle.value]; } @@ -1528,7 +1656,7 @@ inline IntrusivePtr& get>(ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.textures[handle.value]; } @@ -1537,7 +1665,7 @@ inline IntrusivePtr& get>(ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.framebuffers[handle.value]; } @@ -1546,7 +1674,7 @@ inline RenderSwapchain& get(ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.swapchains[handle.value]; } @@ -1559,16 +1687,34 @@ inline const ManagedResource& get(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.resources[handle.value]; } +template <> +inline const ManagedBuffer& +get(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { + const auto& handle = ccstd::get< + impl::ValueHandle>( + g._vertices[v].handle); + return g.managedBuffers[handle.value]; +} + +template <> +inline const ManagedTexture& +get(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { + const auto& handle = ccstd::get< + impl::ValueHandle>( + g._vertices[v].handle); + return g.managedTextures[handle.value]; +} + template <> inline const IntrusivePtr& get>(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.buffers[handle.value]; } @@ -1577,7 +1723,7 @@ inline const IntrusivePtr& get>(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.textures[handle.value]; } @@ -1586,7 +1732,7 @@ inline const IntrusivePtr& get>(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.framebuffers[handle.value]; } @@ -1595,7 +1741,7 @@ inline const RenderSwapchain& get(ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.swapchains[handle.value]; } @@ -1603,15 +1749,31 @@ inline ManagedResource& get(ManagedTag /*tag*/, ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.resources[handle.value]; } +inline ManagedBuffer& +get(ManagedBufferTag /*tag*/, ResourceGraph::vertex_descriptor v, ResourceGraph& g) { + auto& handle = ccstd::get< + impl::ValueHandle>( + g._vertices[v].handle); + return g.managedBuffers[handle.value]; +} + +inline ManagedTexture& +get(ManagedTextureTag /*tag*/, ResourceGraph::vertex_descriptor v, ResourceGraph& g) { + auto& handle = ccstd::get< + impl::ValueHandle>( + g._vertices[v].handle); + return g.managedTextures[handle.value]; +} + inline IntrusivePtr& get(PersistentBufferTag /*tag*/, ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.buffers[handle.value]; } @@ -1619,7 +1781,7 @@ inline IntrusivePtr& get(PersistentTextureTag /*tag*/, ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.textures[handle.value]; } @@ -1627,7 +1789,7 @@ inline IntrusivePtr& get(FramebufferTag /*tag*/, ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.framebuffers[handle.value]; } @@ -1635,7 +1797,7 @@ inline RenderSwapchain& get(SwapchainTag /*tag*/, ResourceGraph::vertex_descriptor v, ResourceGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.swapchains[handle.value]; } @@ -1643,15 +1805,31 @@ inline const ManagedResource& get(ManagedTag /*tag*/, ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.resources[handle.value]; } +inline const ManagedBuffer& +get(ManagedBufferTag /*tag*/, ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { + const auto& handle = ccstd::get< + impl::ValueHandle>( + g._vertices[v].handle); + return g.managedBuffers[handle.value]; +} + +inline const ManagedTexture& +get(ManagedTextureTag /*tag*/, ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { + const auto& handle = ccstd::get< + impl::ValueHandle>( + g._vertices[v].handle); + return g.managedTextures[handle.value]; +} + inline const IntrusivePtr& get(PersistentBufferTag /*tag*/, ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.buffers[handle.value]; } @@ -1659,7 +1837,7 @@ inline const IntrusivePtr& get(PersistentTextureTag /*tag*/, ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.textures[handle.value]; } @@ -1667,7 +1845,7 @@ inline const IntrusivePtr& get(FramebufferTag /*tag*/, ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.framebuffers[handle.value]; } @@ -1675,7 +1853,7 @@ inline const RenderSwapchain& get(SwapchainTag /*tag*/, ResourceGraph::vertex_descriptor v, const ResourceGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.swapchains[handle.value]; } @@ -1693,13 +1871,47 @@ get_if(ResourceGraph::vertex_descriptor v, ResourceGraph* pGrap auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.resources[pHandle->value]; } return ptr; } +template <> +inline ManagedBuffer* +get_if(ResourceGraph::vertex_descriptor v, ResourceGraph* pGraph) noexcept { // NOLINT + ManagedBuffer* ptr = nullptr; + if (!pGraph) { + return ptr; + } + auto& g = *pGraph; + auto* pHandle = ccstd::get_if< + impl::ValueHandle>( + &g._vertices[v].handle); + if (pHandle) { + ptr = &g.managedBuffers[pHandle->value]; + } + return ptr; +} + +template <> +inline ManagedTexture* +get_if(ResourceGraph::vertex_descriptor v, ResourceGraph* pGraph) noexcept { // NOLINT + ManagedTexture* ptr = nullptr; + if (!pGraph) { + return ptr; + } + auto& g = *pGraph; + auto* pHandle = ccstd::get_if< + impl::ValueHandle>( + &g._vertices[v].handle); + if (pHandle) { + ptr = &g.managedTextures[pHandle->value]; + } + return ptr; +} + template <> inline IntrusivePtr* get_if>(ResourceGraph::vertex_descriptor v, ResourceGraph* pGraph) noexcept { // NOLINT @@ -1710,7 +1922,7 @@ get_if>(ResourceGraph::vertex_descriptor v, ResourceGr auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.buffers[pHandle->value]; } @@ -1727,7 +1939,7 @@ get_if>(ResourceGraph::vertex_descriptor v, ResourceG auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.textures[pHandle->value]; } @@ -1744,7 +1956,7 @@ get_if>(ResourceGraph::vertex_descriptor v, Resou auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.framebuffers[pHandle->value]; } @@ -1761,7 +1973,7 @@ get_if(ResourceGraph::vertex_descriptor v, ResourceGraph* pGrap auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.swapchains[pHandle->value]; } @@ -1782,13 +1994,47 @@ get_if(ResourceGraph::vertex_descriptor v, const ResourceGraph* const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.resources[pHandle->value]; } return ptr; } +template <> +inline const ManagedBuffer* +get_if(ResourceGraph::vertex_descriptor v, const ResourceGraph* pGraph) noexcept { // NOLINT + const ManagedBuffer* ptr = nullptr; + if (!pGraph) { + return ptr; + } + const auto& g = *pGraph; + const auto* pHandle = ccstd::get_if< + impl::ValueHandle>( + &g._vertices[v].handle); + if (pHandle) { + ptr = &g.managedBuffers[pHandle->value]; + } + return ptr; +} + +template <> +inline const ManagedTexture* +get_if(ResourceGraph::vertex_descriptor v, const ResourceGraph* pGraph) noexcept { // NOLINT + const ManagedTexture* ptr = nullptr; + if (!pGraph) { + return ptr; + } + const auto& g = *pGraph; + const auto* pHandle = ccstd::get_if< + impl::ValueHandle>( + &g._vertices[v].handle); + if (pHandle) { + ptr = &g.managedTextures[pHandle->value]; + } + return ptr; +} + template <> inline const IntrusivePtr* get_if>(ResourceGraph::vertex_descriptor v, const ResourceGraph* pGraph) noexcept { // NOLINT @@ -1799,7 +2045,7 @@ get_if>(ResourceGraph::vertex_descriptor v, const Reso const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.buffers[pHandle->value]; } @@ -1816,7 +2062,7 @@ get_if>(ResourceGraph::vertex_descriptor v, const Res const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.textures[pHandle->value]; } @@ -1833,7 +2079,7 @@ get_if>(ResourceGraph::vertex_descriptor v, const const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.framebuffers[pHandle->value]; } @@ -1850,7 +2096,7 @@ get_if(ResourceGraph::vertex_descriptor v, const ResourceGraph* const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.swapchains[pHandle->value]; } @@ -2168,7 +2414,7 @@ id(RenderGraph::vertex_descriptor u, const RenderGraph& g) noexcept { [](const impl::ValueHandle& h) { return h.value; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline RenderGraph::VertexTag @@ -2212,7 +2458,7 @@ tag(RenderGraph::vertex_descriptor u, const RenderGraph& g) noexcept { [](const impl::ValueHandle&) { return RenderGraph::VertexTag{ViewportTag{}}; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline RenderGraph::VertexValue @@ -2256,7 +2502,7 @@ value(RenderGraph::vertex_descriptor u, RenderGraph& g) noexcept { [&](const impl::ValueHandle& h) { return RenderGraph::VertexValue{&g.viewports[h.value]}; }), - g.vertices[u].handle); + g._vertices[u].handle); } inline RenderGraph::VertexConstValue @@ -2300,7 +2546,7 @@ value(RenderGraph::vertex_descriptor u, const RenderGraph& g) noexcept { [&](const impl::ValueHandle& h) { return RenderGraph::VertexConstValue{&g.viewports[h.value]}; }), - g.vertices[u].handle); + g._vertices[u].handle); } template @@ -2312,7 +2558,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2320,7 +2566,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2328,7 +2574,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2336,7 +2582,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2344,7 +2590,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2352,7 +2598,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2360,7 +2606,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2368,7 +2614,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2376,7 +2622,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2384,7 +2630,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2392,7 +2638,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2400,7 +2646,7 @@ inline bool holds(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template @@ -2412,7 +2658,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2420,7 +2666,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2428,7 +2674,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2436,7 +2682,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2444,7 +2690,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2452,7 +2698,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2460,7 +2706,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2468,7 +2714,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2476,7 +2722,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2484,7 +2730,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2492,7 +2738,7 @@ inline bool holds_alternative>(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template <> @@ -2500,7 +2746,7 @@ inline bool holds_alternative(RenderGraph::vertex_descriptor v, const RenderGraph& g) noexcept { // NOLINT return ccstd::holds_alternative< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); } template @@ -2512,7 +2758,7 @@ inline RasterPass& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.rasterPasses[handle.value]; } @@ -2521,7 +2767,7 @@ inline ComputePass& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.computePasses[handle.value]; } @@ -2530,7 +2776,7 @@ inline CopyPass& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.copyPasses[handle.value]; } @@ -2539,7 +2785,7 @@ inline MovePass& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.movePasses[handle.value]; } @@ -2548,7 +2794,7 @@ inline PresentPass& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.presentPasses[handle.value]; } @@ -2557,7 +2803,7 @@ inline RaytracePass& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.raytracePasses[handle.value]; } @@ -2566,7 +2812,7 @@ inline RenderQueue& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.renderQueues[handle.value]; } @@ -2575,7 +2821,7 @@ inline SceneData& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.scenes[handle.value]; } @@ -2584,7 +2830,7 @@ inline Blit& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.blits[handle.value]; } @@ -2593,7 +2839,7 @@ inline Dispatch& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.dispatches[handle.value]; } @@ -2602,7 +2848,7 @@ inline ccstd::pmr::vector& get>(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.clearViews[handle.value]; } @@ -2611,7 +2857,7 @@ inline gfx::Viewport& get(RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.viewports[handle.value]; } @@ -2624,7 +2870,7 @@ inline const RasterPass& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.rasterPasses[handle.value]; } @@ -2633,7 +2879,7 @@ inline const ComputePass& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.computePasses[handle.value]; } @@ -2642,7 +2888,7 @@ inline const CopyPass& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.copyPasses[handle.value]; } @@ -2651,7 +2897,7 @@ inline const MovePass& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.movePasses[handle.value]; } @@ -2660,7 +2906,7 @@ inline const PresentPass& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.presentPasses[handle.value]; } @@ -2669,7 +2915,7 @@ inline const RaytracePass& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.raytracePasses[handle.value]; } @@ -2678,7 +2924,7 @@ inline const RenderQueue& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.renderQueues[handle.value]; } @@ -2687,7 +2933,7 @@ inline const SceneData& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.scenes[handle.value]; } @@ -2696,7 +2942,7 @@ inline const Blit& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.blits[handle.value]; } @@ -2705,7 +2951,7 @@ inline const Dispatch& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.dispatches[handle.value]; } @@ -2714,7 +2960,7 @@ inline const ccstd::pmr::vector& get>(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.clearViews[handle.value]; } @@ -2723,7 +2969,7 @@ inline const gfx::Viewport& get(RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.viewports[handle.value]; } @@ -2731,7 +2977,7 @@ inline RasterPass& get(RasterTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.rasterPasses[handle.value]; } @@ -2739,7 +2985,7 @@ inline ComputePass& get(ComputeTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.computePasses[handle.value]; } @@ -2747,7 +2993,7 @@ inline CopyPass& get(CopyTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.copyPasses[handle.value]; } @@ -2755,7 +3001,7 @@ inline MovePass& get(MoveTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.movePasses[handle.value]; } @@ -2763,7 +3009,7 @@ inline PresentPass& get(PresentTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.presentPasses[handle.value]; } @@ -2771,7 +3017,7 @@ inline RaytracePass& get(RaytraceTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.raytracePasses[handle.value]; } @@ -2779,7 +3025,7 @@ inline RenderQueue& get(QueueTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.renderQueues[handle.value]; } @@ -2787,7 +3033,7 @@ inline SceneData& get(SceneTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.scenes[handle.value]; } @@ -2795,7 +3041,7 @@ inline Blit& get(BlitTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.blits[handle.value]; } @@ -2803,7 +3049,7 @@ inline Dispatch& get(DispatchTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.dispatches[handle.value]; } @@ -2811,7 +3057,7 @@ inline ccstd::pmr::vector& get(ClearTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.clearViews[handle.value]; } @@ -2819,7 +3065,7 @@ inline gfx::Viewport& get(ViewportTag /*tag*/, RenderGraph::vertex_descriptor v, RenderGraph& g) { auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.viewports[handle.value]; } @@ -2827,7 +3073,7 @@ inline const RasterPass& get(RasterTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.rasterPasses[handle.value]; } @@ -2835,7 +3081,7 @@ inline const ComputePass& get(ComputeTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.computePasses[handle.value]; } @@ -2843,7 +3089,7 @@ inline const CopyPass& get(CopyTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.copyPasses[handle.value]; } @@ -2851,7 +3097,7 @@ inline const MovePass& get(MoveTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.movePasses[handle.value]; } @@ -2859,7 +3105,7 @@ inline const PresentPass& get(PresentTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.presentPasses[handle.value]; } @@ -2867,7 +3113,7 @@ inline const RaytracePass& get(RaytraceTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.raytracePasses[handle.value]; } @@ -2875,7 +3121,7 @@ inline const RenderQueue& get(QueueTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.renderQueues[handle.value]; } @@ -2883,7 +3129,7 @@ inline const SceneData& get(SceneTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.scenes[handle.value]; } @@ -2891,7 +3137,7 @@ inline const Blit& get(BlitTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.blits[handle.value]; } @@ -2899,7 +3145,7 @@ inline const Dispatch& get(DispatchTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.dispatches[handle.value]; } @@ -2907,7 +3153,7 @@ inline const ccstd::pmr::vector& get(ClearTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.clearViews[handle.value]; } @@ -2915,7 +3161,7 @@ inline const gfx::Viewport& get(ViewportTag /*tag*/, RenderGraph::vertex_descriptor v, const RenderGraph& g) { const auto& handle = ccstd::get< impl::ValueHandle>( - g.vertices[v].handle); + g._vertices[v].handle); return g.viewports[handle.value]; } @@ -2933,7 +3179,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noexce auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.rasterPasses[pHandle->value]; } @@ -2950,7 +3196,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noexc auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.computePasses[pHandle->value]; } @@ -2967,7 +3213,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noexcept auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.copyPasses[pHandle->value]; } @@ -2984,7 +3230,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noexcept auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.movePasses[pHandle->value]; } @@ -3001,7 +3247,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noexc auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.presentPasses[pHandle->value]; } @@ -3018,7 +3264,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noex auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.raytracePasses[pHandle->value]; } @@ -3035,7 +3281,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noexc auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.renderQueues[pHandle->value]; } @@ -3052,7 +3298,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noexcep auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.scenes[pHandle->value]; } @@ -3069,7 +3315,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noexcept { / auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.blits[pHandle->value]; } @@ -3086,7 +3332,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noexcept auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.dispatches[pHandle->value]; } @@ -3103,7 +3349,7 @@ get_if>(RenderGraph::vertex_descriptor v, RenderGr auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.clearViews[pHandle->value]; } @@ -3120,7 +3366,7 @@ get_if(RenderGraph::vertex_descriptor v, RenderGraph* pGraph) noe auto& g = *pGraph; auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.viewports[pHandle->value]; } @@ -3141,7 +3387,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph) const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.rasterPasses[pHandle->value]; } @@ -3158,7 +3404,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph) const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.computePasses[pHandle->value]; } @@ -3175,7 +3421,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph) no const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.copyPasses[pHandle->value]; } @@ -3192,7 +3438,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph) no const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.movePasses[pHandle->value]; } @@ -3209,7 +3455,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph) const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.presentPasses[pHandle->value]; } @@ -3226,7 +3472,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.raytracePasses[pHandle->value]; } @@ -3243,7 +3489,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph) const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.renderQueues[pHandle->value]; } @@ -3260,7 +3506,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph) n const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.scenes[pHandle->value]; } @@ -3277,7 +3523,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph) noexce const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.blits[pHandle->value]; } @@ -3294,7 +3540,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGraph) no const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.dispatches[pHandle->value]; } @@ -3311,7 +3557,7 @@ get_if>(RenderGraph::vertex_descriptor v, const Re const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.clearViews[pHandle->value]; } @@ -3328,7 +3574,7 @@ get_if(RenderGraph::vertex_descriptor v, const RenderGraph* pGrap const auto& g = *pGraph; const auto* pHandle = ccstd::get_if< impl::ValueHandle>( - &g.vertices[v].handle); + &g._vertices[v].handle); if (pHandle) { ptr = &g.viewports[pHandle->value]; } @@ -3412,91 +3658,91 @@ inline void remove_vertex_value_impl(const RenderGraph::VertexHandle& h, RenderG if (h.value == g.rasterPasses.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.computePasses.erase(g.computePasses.begin() + std::ptrdiff_t(h.value)); if (h.value == g.computePasses.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.copyPasses.erase(g.copyPasses.begin() + std::ptrdiff_t(h.value)); if (h.value == g.copyPasses.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.movePasses.erase(g.movePasses.begin() + std::ptrdiff_t(h.value)); if (h.value == g.movePasses.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.presentPasses.erase(g.presentPasses.begin() + std::ptrdiff_t(h.value)); if (h.value == g.presentPasses.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.raytracePasses.erase(g.raytracePasses.begin() + std::ptrdiff_t(h.value)); if (h.value == g.raytracePasses.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.renderQueues.erase(g.renderQueues.begin() + std::ptrdiff_t(h.value)); if (h.value == g.renderQueues.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.scenes.erase(g.scenes.begin() + std::ptrdiff_t(h.value)); if (h.value == g.scenes.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.blits.erase(g.blits.begin() + std::ptrdiff_t(h.value)); if (h.value == g.blits.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.dispatches.erase(g.dispatches.begin() + std::ptrdiff_t(h.value)); if (h.value == g.dispatches.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.clearViews.erase(g.clearViews.begin() + std::ptrdiff_t(h.value)); if (h.value == g.clearViews.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }, [&](const impl::ValueHandle& h) { g.viewports.erase(g.viewports.begin() + std::ptrdiff_t(h.value)); if (h.value == g.viewports.size()) { return; } - impl::reindexVectorHandle(g.vertices, h.value); + impl::reindexVectorHandle(g._vertices, h.value); }), h); } inline void remove_vertex(RenderGraph::vertex_descriptor u, RenderGraph& g) noexcept { // NOLINT // preserve vertex' iterators - auto& vert = g.vertices[u]; + auto& vert = g._vertices[u]; remove_vertex_value_impl(vert.handle, g); impl::removeVectorVertex(const_cast(g), u, RenderGraph::directed_category{}); @@ -3619,12 +3865,12 @@ void addVertexImpl( // NOLINT template inline RenderGraph::vertex_descriptor addVertex(Component0&& c0, Component1&& c1, Component2&& c2, Component3&& c3, ValueT&& val, RenderGraph& g, RenderGraph::vertex_descriptor u = RenderGraph::null_vertex()) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); g.objects.emplace_back(); - g.vertices.emplace_back(); - auto& vert = g.vertices.back(); + g._vertices.emplace_back(); + auto& vert = g._vertices.back(); g.names.emplace_back(std::forward(c0)); g.layoutNodes.emplace_back(std::forward(c1)); g.data.emplace_back(std::forward(c2)); @@ -3775,12 +4021,12 @@ void addVertexImpl(ViewportTag /*tag*/, Tuple &&val, RenderGraph &g, RenderGraph template inline RenderGraph::vertex_descriptor addVertex(Tag tag, Component0&& c0, Component1&& c1, Component2&& c2, Component3&& c3, ValueT&& val, RenderGraph& g, RenderGraph::vertex_descriptor u = RenderGraph::null_vertex()) { - auto v = gsl::narrow_cast(g.vertices.size()); + auto v = gsl::narrow_cast(g._vertices.size()); g.objects.emplace_back(); - g.vertices.emplace_back(); - auto& vert = g.vertices.back(); + g._vertices.emplace_back(); + auto& vert = g._vertices.back(); std::apply( [&](auto&&... args) { diff --git a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.cpp b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.cpp index 849084a63d..5990a191e7 100644 --- a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.cpp +++ b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.cpp @@ -36,12 +36,14 @@ namespace cc { namespace render { ResourceGraph::ResourceGraph(const allocator_type& alloc) noexcept -: vertices(alloc), +: _vertices(alloc), names(alloc), descs(alloc), traits(alloc), states(alloc), resources(alloc), + managedBuffers(alloc), + managedTextures(alloc), buffers(alloc), textures(alloc), framebuffers(alloc), @@ -49,12 +51,14 @@ ResourceGraph::ResourceGraph(const allocator_type& alloc) noexcept valueIndex(alloc) {} ResourceGraph::ResourceGraph(ResourceGraph&& rhs, const allocator_type& alloc) -: vertices(std::move(rhs.vertices), alloc), +: _vertices(std::move(rhs._vertices), alloc), names(std::move(rhs.names), alloc), descs(std::move(rhs.descs), alloc), traits(std::move(rhs.traits), alloc), states(std::move(rhs.states), alloc), resources(std::move(rhs.resources), alloc), + managedBuffers(std::move(rhs.managedBuffers), alloc), + managedTextures(std::move(rhs.managedTextures), alloc), buffers(std::move(rhs.buffers), alloc), textures(std::move(rhs.textures), alloc), framebuffers(std::move(rhs.framebuffers), alloc), @@ -63,12 +67,14 @@ ResourceGraph::ResourceGraph(ResourceGraph&& rhs, const allocator_type& alloc) nextFenceValue(rhs.nextFenceValue) {} ResourceGraph::ResourceGraph(ResourceGraph const& rhs, const allocator_type& alloc) -: vertices(rhs.vertices, alloc), +: _vertices(rhs._vertices, alloc), names(rhs.names, alloc), descs(rhs.descs, alloc), traits(rhs.traits, alloc), states(rhs.states, alloc), resources(rhs.resources, alloc), + managedBuffers(rhs.managedBuffers, alloc), + managedTextures(rhs.managedTextures, alloc), buffers(rhs.buffers, alloc), textures(rhs.textures, alloc), framebuffers(rhs.framebuffers, alloc), @@ -78,7 +84,7 @@ ResourceGraph::ResourceGraph(ResourceGraph const& rhs, const allocator_type& all // ContinuousContainer void ResourceGraph::reserve(vertices_size_type sz) { - vertices.reserve(sz); + _vertices.reserve(sz); names.reserve(sz); descs.reserve(sz); traits.reserve(sz); @@ -112,23 +118,23 @@ RasterSubpass::RasterSubpass(RasterSubpass const& rhs, const allocator_type& all computeViews(rhs.computeViews, alloc) {} SubpassGraph::SubpassGraph(const allocator_type& alloc) noexcept -: vertices(alloc), +: _vertices(alloc), names(alloc), subpasses(alloc) {} SubpassGraph::SubpassGraph(SubpassGraph&& rhs, const allocator_type& alloc) -: vertices(std::move(rhs.vertices), alloc), +: _vertices(std::move(rhs._vertices), alloc), names(std::move(rhs.names), alloc), subpasses(std::move(rhs.subpasses), alloc) {} SubpassGraph::SubpassGraph(SubpassGraph const& rhs, const allocator_type& alloc) -: vertices(rhs.vertices, alloc), +: _vertices(rhs._vertices, alloc), names(rhs.names, alloc), subpasses(rhs.subpasses, alloc) {} // ContinuousContainer void SubpassGraph::reserve(vertices_size_type sz) { - vertices.reserve(sz); + _vertices.reserve(sz); names.reserve(sz); subpasses.reserve(sz); } @@ -359,7 +365,7 @@ RenderData::RenderData(RenderData&& rhs, const allocator_type& alloc) RenderGraph::RenderGraph(const allocator_type& alloc) noexcept : objects(alloc), - vertices(alloc), + _vertices(alloc), names(alloc), layoutNodes(alloc), data(alloc), @@ -380,7 +386,7 @@ RenderGraph::RenderGraph(const allocator_type& alloc) noexcept RenderGraph::RenderGraph(RenderGraph&& rhs, const allocator_type& alloc) : objects(std::move(rhs.objects), alloc), - vertices(std::move(rhs.vertices), alloc), + _vertices(std::move(rhs._vertices), alloc), names(std::move(rhs.names), alloc), layoutNodes(std::move(rhs.layoutNodes), alloc), data(std::move(rhs.data), alloc), @@ -402,7 +408,7 @@ RenderGraph::RenderGraph(RenderGraph&& rhs, const allocator_type& alloc) // ContinuousContainer void RenderGraph::reserve(vertices_size_type sz) { objects.reserve(sz); - vertices.reserve(sz); + _vertices.reserve(sz); names.reserve(sz); layoutNodes.reserve(sz); data.reserve(sz); diff --git a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h index c7bf9c1fa8..86679ee08b 100644 --- a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h +++ b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h @@ -129,7 +129,7 @@ struct SwapchainTag {}; struct ResourceGraph { using allocator_type = boost::container::pmr::polymorphic_allocator; allocator_type get_allocator() const noexcept { // NOLINT - return {vertices.get_allocator().resource()}; + return {_vertices.get_allocator().resource()}; } inline boost::container::pmr::memory_resource* resource() const noexcept { @@ -184,29 +184,29 @@ struct ResourceGraph { // VertexList help functions inline ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline const ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline const ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline boost::integer_range getVertexList() const noexcept { - return {0, static_cast(vertices.size())}; + return {0, static_cast(_vertices.size())}; } inline vertex_descriptor getCurrentID() const noexcept { - return static_cast(vertices.size()); + return static_cast(_vertices.size()); } inline ccstd::pmr::vector colors(boost::container::pmr::memory_resource* mr) const { - return ccstd::pmr::vector(vertices.size(), mr); + return ccstd::pmr::vector(_vertices.size(), mr); } // EdgeListGraph @@ -214,11 +214,13 @@ struct ResourceGraph { using edges_size_type = uint32_t; // PolymorphicGraph - using VertexTag = ccstd::variant; - using VertexValue = ccstd::variant*, IntrusivePtr*, IntrusivePtr*, RenderSwapchain*>; - using VertexConstValue = ccstd::variant*, const IntrusivePtr*, const IntrusivePtr*, const RenderSwapchain*>; + using VertexTag = ccstd::variant; + using VertexValue = ccstd::variant*, IntrusivePtr*, IntrusivePtr*, RenderSwapchain*>; + using VertexConstValue = ccstd::variant*, const IntrusivePtr*, const IntrusivePtr*, const RenderSwapchain*>; using VertexHandle = ccstd::variant< impl::ValueHandle, + impl::ValueHandle, + impl::ValueHandle, impl::ValueHandle, impl::ValueHandle, impl::ValueHandle, @@ -261,7 +263,7 @@ struct ResourceGraph { } static constexpr States{}; // NOLINT // Vertices - ccstd::pmr::vector vertices; + ccstd::pmr::vector _vertices; // Components ccstd::pmr::vector names; ccstd::pmr::vector descs; @@ -269,6 +271,8 @@ struct ResourceGraph { ccstd::pmr::vector states; // PolymorphicGraph ccstd::pmr::vector resources; + ccstd::pmr::vector managedBuffers; + ccstd::pmr::vector managedTextures; ccstd::pmr::vector> buffers; ccstd::pmr::vector> textures; ccstd::pmr::vector> framebuffers; @@ -310,7 +314,7 @@ inline bool operator!=(const RasterSubpass& lhs, const RasterSubpass& rhs) noexc struct SubpassGraph { using allocator_type = boost::container::pmr::polymorphic_allocator; allocator_type get_allocator() const noexcept { // NOLINT - return {vertices.get_allocator().resource()}; + return {_vertices.get_allocator().resource()}; } inline boost::container::pmr::memory_resource* resource() const noexcept { @@ -365,29 +369,29 @@ struct SubpassGraph { // VertexList help functions inline ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline const ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline const ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline boost::integer_range getVertexList() const noexcept { - return {0, static_cast(vertices.size())}; + return {0, static_cast(_vertices.size())}; } inline vertex_descriptor getCurrentID() const noexcept { - return static_cast(vertices.size()); + return static_cast(_vertices.size()); } inline ccstd::pmr::vector colors(boost::container::pmr::memory_resource* mr) const { - return ccstd::pmr::vector(vertices.size(), mr); + return ccstd::pmr::vector(_vertices.size(), mr); } // EdgeListGraph @@ -423,7 +427,7 @@ struct SubpassGraph { } static constexpr Subpass{}; // NOLINT // Vertices - ccstd::pmr::vector vertices; + ccstd::pmr::vector _vertices; // Components ccstd::pmr::vector names; ccstd::pmr::vector subpasses; @@ -796,29 +800,29 @@ struct RenderGraph { // VertexList help functions inline ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline const ccstd::pmr::vector& getOutEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].outEdges; + return _vertices[v].outEdges; } inline ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline const ccstd::pmr::vector& getInEdgeList(vertex_descriptor v) const noexcept { - return vertices[v].inEdges; + return _vertices[v].inEdges; } inline boost::integer_range getVertexList() const noexcept { - return {0, static_cast(vertices.size())}; + return {0, static_cast(_vertices.size())}; } inline vertex_descriptor getCurrentID() const noexcept { - return static_cast(vertices.size()); + return static_cast(_vertices.size()); } inline ccstd::pmr::vector colors(boost::container::pmr::memory_resource* mr) const { - return ccstd::pmr::vector(vertices.size(), mr); + return ccstd::pmr::vector(_vertices.size(), mr); } // EdgeListGraph @@ -930,7 +934,7 @@ struct RenderGraph { // Owners ccstd::pmr::vector objects; // Vertices - ccstd::pmr::vector vertices; + ccstd::pmr::vector _vertices; // Components ccstd::pmr::vector names; ccstd::pmr::vector layoutNodes; diff --git a/native/tests/unit-test/src/complicated_barrier_case.cpp b/native/tests/unit-test/src/complicated_barrier_case.cpp index 90c4324014..802d10450f 100644 --- a/native/tests/unit-test/src/complicated_barrier_case.cpp +++ b/native/tests/unit-test/src/complicated_barrier_case.cpp @@ -48,7 +48,7 @@ TEST(complicatedBarrierTest, test12) { const auto& barrierMap = fgDispatcher.getBarriers(); const auto& rag = fgDispatcher.resourceAccessGraph; - ExpectEq(rag.vertices.size() == 17, true); + ExpectEq(rag._vertices.size() == 17, true); // head const auto& head = barrierMap.at(0); diff --git a/native/tests/unit-test/src/simple_barrier_test.cpp b/native/tests/unit-test/src/simple_barrier_test.cpp index 4e2dbea1ef..b8a3eb2813 100644 --- a/native/tests/unit-test/src/simple_barrier_test.cpp +++ b/native/tests/unit-test/src/simple_barrier_test.cpp @@ -42,7 +42,7 @@ TEST(barrierTest, test10) { const auto& barrierMap = fgDispatcher.getBarriers(); const auto& rag = fgDispatcher.resourceAccessGraph; - ExpectEq(rag.vertices.size() == 4, true); + ExpectEq(rag._vertices.size() == 4, true); // head const auto& head = barrierMap.at(0); diff --git a/native/tests/unit-test/src/simple_closed_barrier_test.cpp b/native/tests/unit-test/src/simple_closed_barrier_test.cpp index 093a0c7960..bb189e0d64 100644 --- a/native/tests/unit-test/src/simple_closed_barrier_test.cpp +++ b/native/tests/unit-test/src/simple_closed_barrier_test.cpp @@ -42,7 +42,7 @@ TEST(simpleClosedBarrierTest, test11) { const auto& barrierMap = fgDispatcher.getBarriers(); const auto& rag = fgDispatcher.resourceAccessGraph; - ExpectEq(rag.vertices.size() == 10, true); + ExpectEq(rag._vertices.size() == 10, true); // head const auto& head = barrierMap.at(0);