[pipeline] rename graph _vertices (#12802)

This commit is contained in:
hyde zhou
2022-09-20 14:43:44 +08:00
committed by GitHub
parent 85708b98d2
commit bb5aa2523f
18 changed files with 747 additions and 384 deletions
+7 -1
View File
@@ -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) {
}
+7 -1
View File
@@ -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) {
+42
View File
@@ -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;
@@ -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 <class Component0, class Component1>
inline ResourceAccessGraph::vertex_descriptor
addVertex(Component0&& c0, Component1&& c1, ResourceAccessGraph& g) {
auto v = gsl::narrow_cast<ResourceAccessGraph::vertex_descriptor>(g.vertices.size());
auto v = gsl::narrow_cast<ResourceAccessGraph::vertex_descriptor>(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 <class Component0, class Component1>
inline ResourceAccessGraph::vertex_descriptor
addVertex(std::piecewise_construct_t /*tag*/, Component0&& c0, Component1&& c1, ResourceAccessGraph& g) {
auto v = gsl::narrow_cast<ResourceAccessGraph::vertex_descriptor>(g.vertices.size());
auto v = gsl::narrow_cast<ResourceAccessGraph::vertex_descriptor>(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<boost::default_color_type>& colors, const EmptyGraph& /*g
// MutableGraph(Vertex)
inline EmptyGraph::vertex_descriptor
addVertex(EmptyGraph& g) {
auto v = gsl::narrow_cast<EmptyGraph::vertex_descriptor>(g.vertices.size());
auto v = gsl::narrow_cast<EmptyGraph::vertex_descriptor>(g._vertices.size());
g.vertices.emplace_back();
g._vertices.emplace_back();
return v;
}
@@ -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);
}
@@ -94,7 +94,7 @@ struct ResourceAccessNode {
struct ResourceAccessGraph {
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
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<OutEdge>& getOutEdgeList(vertex_descriptor v) noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline const ccstd::pmr::vector<OutEdge>& getOutEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline const ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
return {0, static_cast<vertices_size_type>(vertices.size())};
return {0, static_cast<vertices_size_type>(_vertices.size())};
}
inline vertex_descriptor getCurrentID() const noexcept {
return static_cast<vertex_descriptor>(vertices.size());
return static_cast<vertex_descriptor>(_vertices.size());
}
inline ccstd::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
return ccstd::pmr::vector<boost::default_color_type>(vertices.size(), mr);
return ccstd::pmr::vector<boost::default_color_type>(_vertices.size(), mr);
}
// EdgeListGraph
@@ -218,7 +218,7 @@ struct ResourceAccessGraph {
} static constexpr AccessNode{}; // NOLINT
// Vertices
ccstd::pmr::vector<Vertex> vertices;
ccstd::pmr::vector<Vertex> _vertices;
// Components
ccstd::pmr::vector<RenderGraph::vertex_descriptor> passID;
ccstd::pmr::vector<ResourceAccessNode> access;
@@ -278,29 +278,29 @@ struct EmptyGraph {
// VertexList help functions
inline std::vector<OutEdge>& getOutEdgeList(vertex_descriptor v) noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline const std::vector<OutEdge>& getOutEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline std::vector<InEdge>& getInEdgeList(vertex_descriptor v) noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline const std::vector<InEdge>& getInEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
return {0, static_cast<vertices_size_type>(vertices.size())};
return {0, static_cast<vertices_size_type>(_vertices.size())};
}
inline vertex_descriptor getCurrentID() const noexcept {
return static_cast<vertex_descriptor>(vertices.size());
return static_cast<vertex_descriptor>(_vertices.size());
}
inline ccstd::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
return ccstd::pmr::vector<boost::default_color_type>(vertices.size(), mr);
return ccstd::pmr::vector<boost::default_color_type>(_vertices.size(), mr);
}
// EdgeListGraph
@@ -316,7 +316,7 @@ struct EmptyGraph {
std::vector<InEdge> inEdges;
};
// Vertices
std::vector<Vertex> vertices;
std::vector<Vertex> _vertices;
};
struct Barrier {
@@ -1160,12 +1160,12 @@ void passReorder(FrameGraphDispatcher &fgDispatcher) {
}
// topological sort
bool empty = relationGraph.vertices.empty();
bool empty = relationGraph._vertices.empty();
ScoreMap scoreMap;
std::queue<EmptyVert> 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<uint32_t>(i), relationGraph) == 0) {
if (std::find(candidates.begin(), candidates.end(), i) == candidates.end()) {
candidates.push_back(static_cast<uint32_t>(i));
@@ -1175,7 +1175,7 @@ void passReorder(FrameGraphDispatcher &fgDispatcher) {
std::vector<EmptyVert> 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};
@@ -511,7 +511,7 @@ inline void reindexVectorHandle(Container &container, HandleDescriptor u) {
template <class Graph, class VertexDescriptor>
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 <class Graph, class VertexDescriptor>
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 <class Graph, class VertexDescriptor>
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 <class Graph, class VertexDescriptor, class EdgeList>
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) {
@@ -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<RenderPhaseTag, vertex_descriptor>& 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<RenderPhaseTag, vertex_descriptor>&) {
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<RenderPhaseTag, vertex_descriptor>& 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<RenderPhaseTag, vertex_descriptor>& h) {
return LayoutGraph::VertexConstValue{&g.phases[h.value]};
}),
g.vertices[u].handle);
g._vertices[u].handle);
}
template <class Tag>
@@ -778,7 +778,7 @@ inline bool
holds<RenderStageTag>(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) noexcept {
return ccstd::holds_alternative<
impl::ValueHandle<RenderStageTag, LayoutGraph::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
}
template <>
@@ -786,7 +786,7 @@ inline bool
holds<RenderPhaseTag>(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) noexcept {
return ccstd::holds_alternative<
impl::ValueHandle<RenderPhaseTag, LayoutGraph::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
}
template <class ValueT>
@@ -798,7 +798,7 @@ inline bool
holds_alternative<uint32_t>(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) noexcept { // NOLINT
return ccstd::holds_alternative<
impl::ValueHandle<RenderStageTag, LayoutGraph::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
}
template <>
@@ -806,7 +806,7 @@ inline bool
holds_alternative<RenderPhase>(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) noexcept { // NOLINT
return ccstd::holds_alternative<
impl::ValueHandle<RenderPhaseTag, LayoutGraph::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
}
template <class ValueT>
@@ -818,7 +818,7 @@ inline uint32_t&
get<uint32_t>(LayoutGraph::vertex_descriptor v, LayoutGraph& g) {
auto& handle = ccstd::get<
impl::ValueHandle<RenderStageTag, LayoutGraph::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
return g.stages[handle.value];
}
@@ -827,7 +827,7 @@ inline RenderPhase&
get<RenderPhase>(LayoutGraph::vertex_descriptor v, LayoutGraph& g) {
auto& handle = ccstd::get<
impl::ValueHandle<RenderPhaseTag, LayoutGraph::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
return g.phases[handle.value];
}
@@ -840,7 +840,7 @@ inline const uint32_t&
get<uint32_t>(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) {
const auto& handle = ccstd::get<
impl::ValueHandle<RenderStageTag, LayoutGraph::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
return g.stages[handle.value];
}
@@ -849,7 +849,7 @@ inline const RenderPhase&
get<RenderPhase>(LayoutGraph::vertex_descriptor v, const LayoutGraph& g) {
const auto& handle = ccstd::get<
impl::ValueHandle<RenderPhaseTag, LayoutGraph::vertex_descriptor>>(
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<RenderStageTag, LayoutGraph::vertex_descriptor>>(
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<RenderPhaseTag, LayoutGraph::vertex_descriptor>>(
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<RenderStageTag, LayoutGraph::vertex_descriptor>>(
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<RenderPhaseTag, LayoutGraph::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
return g.phases[handle.value];
}
@@ -899,7 +899,7 @@ get_if<uint32_t>(LayoutGraph::vertex_descriptor v, LayoutGraph* pGraph) noexcept
auto& g = *pGraph;
auto* pHandle = ccstd::get_if<
impl::ValueHandle<RenderStageTag, LayoutGraph::vertex_descriptor>>(
&g.vertices[v].handle);
&g._vertices[v].handle);
if (pHandle) {
ptr = &g.stages[pHandle->value];
}
@@ -916,7 +916,7 @@ get_if<RenderPhase>(LayoutGraph::vertex_descriptor v, LayoutGraph* pGraph) noexc
auto& g = *pGraph;
auto* pHandle = ccstd::get_if<
impl::ValueHandle<RenderPhaseTag, LayoutGraph::vertex_descriptor>>(
&g.vertices[v].handle);
&g._vertices[v].handle);
if (pHandle) {
ptr = &g.phases[pHandle->value];
}
@@ -937,7 +937,7 @@ get_if<uint32_t>(LayoutGraph::vertex_descriptor v, const LayoutGraph* pGraph) no
const auto& g = *pGraph;
const auto* pHandle = ccstd::get_if<
impl::ValueHandle<RenderStageTag, LayoutGraph::vertex_descriptor>>(
&g.vertices[v].handle);
&g._vertices[v].handle);
if (pHandle) {
ptr = &g.stages[pHandle->value];
}
@@ -954,7 +954,7 @@ get_if<RenderPhase>(LayoutGraph::vertex_descriptor v, const LayoutGraph* pGraph)
const auto& g = *pGraph;
const auto* pHandle = ccstd::get_if<
impl::ValueHandle<RenderPhaseTag, LayoutGraph::vertex_descriptor>>(
&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<RenderStageTag>(g.vertices, h.value);
impl::reindexVectorHandle<RenderStageTag>(g._vertices, h.value);
},
[&](const impl::ValueHandle<RenderPhaseTag, vertex_descriptor>& h) {
g.phases.erase(g.phases.begin() + std::ptrdiff_t(h.value));
if (h.value == g.phases.size()) {
return;
}
impl::reindexVectorHandle<RenderPhaseTag>(g.vertices, h.value);
impl::reindexVectorHandle<RenderPhaseTag>(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<LayoutGraph&>(g), u, LayoutGraph::directed_category{});
@@ -1252,10 +1252,10 @@ void addVertexImpl( // NOLINT
template <class Component0, class Component1, class ValueT>
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<LayoutGraph::vertex_descriptor>(g.vertices.size());
auto v = gsl::narrow_cast<LayoutGraph::vertex_descriptor>(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<Component0>(c0));
g.descriptors.emplace_back(std::forward<Component1>(c1));
@@ -1294,10 +1294,10 @@ void addVertexImpl(RenderPhaseTag /*tag*/, Tuple &&val, LayoutGraph &g, LayoutGr
template <class Component0, class Component1, class Tag, class ValueT>
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<LayoutGraph::vertex_descriptor>(g.vertices.size());
auto v = gsl::narrow_cast<LayoutGraph::vertex_descriptor>(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<RenderPhaseTag, vertex_descriptor>& 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<RenderPhaseTag, vertex_descriptor>&) {
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<RenderPhaseTag, vertex_descriptor>& 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<RenderPhaseTag, vertex_descriptor>& h) {
return LayoutGraphData::VertexConstValue{&g.phases[h.value]};
}),
g.vertices[u].handle);
g._vertices[u].handle);
}
template <class Tag>
@@ -1478,7 +1478,7 @@ inline bool
holds<RenderStageTag>(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) noexcept {
return ccstd::holds_alternative<
impl::ValueHandle<RenderStageTag, LayoutGraphData::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
}
template <>
@@ -1486,7 +1486,7 @@ inline bool
holds<RenderPhaseTag>(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) noexcept {
return ccstd::holds_alternative<
impl::ValueHandle<RenderPhaseTag, LayoutGraphData::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
}
template <class ValueT>
@@ -1498,7 +1498,7 @@ inline bool
holds_alternative<RenderStageData>(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) noexcept { // NOLINT
return ccstd::holds_alternative<
impl::ValueHandle<RenderStageTag, LayoutGraphData::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
}
template <>
@@ -1506,7 +1506,7 @@ inline bool
holds_alternative<RenderPhaseData>(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) noexcept { // NOLINT
return ccstd::holds_alternative<
impl::ValueHandle<RenderPhaseTag, LayoutGraphData::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
}
template <class ValueT>
@@ -1518,7 +1518,7 @@ inline RenderStageData&
get<RenderStageData>(LayoutGraphData::vertex_descriptor v, LayoutGraphData& g) {
auto& handle = ccstd::get<
impl::ValueHandle<RenderStageTag, LayoutGraphData::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
return g.stages[handle.value];
}
@@ -1527,7 +1527,7 @@ inline RenderPhaseData&
get<RenderPhaseData>(LayoutGraphData::vertex_descriptor v, LayoutGraphData& g) {
auto& handle = ccstd::get<
impl::ValueHandle<RenderPhaseTag, LayoutGraphData::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
return g.phases[handle.value];
}
@@ -1540,7 +1540,7 @@ inline const RenderStageData&
get<RenderStageData>(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) {
const auto& handle = ccstd::get<
impl::ValueHandle<RenderStageTag, LayoutGraphData::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
return g.stages[handle.value];
}
@@ -1549,7 +1549,7 @@ inline const RenderPhaseData&
get<RenderPhaseData>(LayoutGraphData::vertex_descriptor v, const LayoutGraphData& g) {
const auto& handle = ccstd::get<
impl::ValueHandle<RenderPhaseTag, LayoutGraphData::vertex_descriptor>>(
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<RenderStageTag, LayoutGraphData::vertex_descriptor>>(
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<RenderPhaseTag, LayoutGraphData::vertex_descriptor>>(
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<RenderStageTag, LayoutGraphData::vertex_descriptor>>(
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<RenderPhaseTag, LayoutGraphData::vertex_descriptor>>(
g.vertices[v].handle);
g._vertices[v].handle);
return g.phases[handle.value];
}
@@ -1599,7 +1599,7 @@ get_if<RenderStageData>(LayoutGraphData::vertex_descriptor v, LayoutGraphData* p
auto& g = *pGraph;
auto* pHandle = ccstd::get_if<
impl::ValueHandle<RenderStageTag, LayoutGraphData::vertex_descriptor>>(
&g.vertices[v].handle);
&g._vertices[v].handle);
if (pHandle) {
ptr = &g.stages[pHandle->value];
}
@@ -1616,7 +1616,7 @@ get_if<RenderPhaseData>(LayoutGraphData::vertex_descriptor v, LayoutGraphData* p
auto& g = *pGraph;
auto* pHandle = ccstd::get_if<
impl::ValueHandle<RenderPhaseTag, LayoutGraphData::vertex_descriptor>>(
&g.vertices[v].handle);
&g._vertices[v].handle);
if (pHandle) {
ptr = &g.phases[pHandle->value];
}
@@ -1637,7 +1637,7 @@ get_if<RenderStageData>(LayoutGraphData::vertex_descriptor v, const LayoutGraphD
const auto& g = *pGraph;
const auto* pHandle = ccstd::get_if<
impl::ValueHandle<RenderStageTag, LayoutGraphData::vertex_descriptor>>(
&g.vertices[v].handle);
&g._vertices[v].handle);
if (pHandle) {
ptr = &g.stages[pHandle->value];
}
@@ -1654,7 +1654,7 @@ get_if<RenderPhaseData>(LayoutGraphData::vertex_descriptor v, const LayoutGraphD
const auto& g = *pGraph;
const auto* pHandle = ccstd::get_if<
impl::ValueHandle<RenderPhaseTag, LayoutGraphData::vertex_descriptor>>(
&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<RenderStageTag>(g.vertices, h.value);
impl::reindexVectorHandle<RenderStageTag>(g._vertices, h.value);
},
[&](const impl::ValueHandle<RenderPhaseTag, vertex_descriptor>& h) {
g.phases.erase(g.phases.begin() + std::ptrdiff_t(h.value));
if (h.value == g.phases.size()) {
return;
}
impl::reindexVectorHandle<RenderPhaseTag>(g.vertices, h.value);
impl::reindexVectorHandle<RenderPhaseTag>(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<LayoutGraphData&>(g), u, LayoutGraphData::directed_category{});
@@ -1953,10 +1953,10 @@ void addVertexImpl( // NOLINT
template <class Component0, class Component1, class Component2, class ValueT>
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<LayoutGraphData::vertex_descriptor>(g.vertices.size());
auto v = gsl::narrow_cast<LayoutGraphData::vertex_descriptor>(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<Component0>(c0));
g.updateFrequencies.emplace_back(std::forward<Component1>(c1));
g.layouts.emplace_back(std::forward<Component2>(c2));
@@ -1996,10 +1996,10 @@ void addVertexImpl(RenderPhaseTag /*tag*/, Tuple &&val, LayoutGraphData &g, Layo
template <class Component0, class Component1, class Component2, class Tag, class ValueT>
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<LayoutGraphData::vertex_descriptor>(g.vertices.size());
auto v = gsl::narrow_cast<LayoutGraphData::vertex_descriptor>(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) {
@@ -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);
@@ -149,7 +149,7 @@ struct RenderPhase {
struct LayoutGraph {
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
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<OutEdge>& getOutEdgeList(vertex_descriptor v) noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline const ccstd::pmr::vector<OutEdge>& getOutEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline const ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
return {0, static_cast<vertices_size_type>(vertices.size())};
return {0, static_cast<vertices_size_type>(_vertices.size())};
}
inline vertex_descriptor getCurrentID() const noexcept {
return static_cast<vertex_descriptor>(vertices.size());
return static_cast<vertex_descriptor>(_vertices.size());
}
inline ccstd::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
return ccstd::pmr::vector<boost::default_color_type>(vertices.size(), mr);
return ccstd::pmr::vector<boost::default_color_type>(_vertices.size(), mr);
}
// EdgeListGraph
@@ -252,17 +252,17 @@ struct LayoutGraph {
// AddressableGraph help functions
inline ccstd::pmr::vector<OutEdge>& getChildrenList(vertex_descriptor v) noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline const ccstd::pmr::vector<OutEdge>& getChildrenList(vertex_descriptor v) const noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline ccstd::pmr::vector<InEdge>& getParentsList(vertex_descriptor v) noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline const ccstd::pmr::vector<InEdge>& 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<Vertex> vertices;
ccstd::pmr::vector<Vertex> _vertices;
// Components
ccstd::pmr::vector<ccstd::pmr::string> names;
ccstd::pmr::vector<DescriptorDB> descriptors;
@@ -509,7 +509,7 @@ struct RenderPhaseData {
struct LayoutGraphData {
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
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<OutEdge>& getOutEdgeList(vertex_descriptor v) noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline const ccstd::pmr::vector<OutEdge>& getOutEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline const ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
return {0, static_cast<vertices_size_type>(vertices.size())};
return {0, static_cast<vertices_size_type>(_vertices.size())};
}
inline vertex_descriptor getCurrentID() const noexcept {
return static_cast<vertex_descriptor>(vertices.size());
return static_cast<vertex_descriptor>(_vertices.size());
}
inline ccstd::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
return ccstd::pmr::vector<boost::default_color_type>(vertices.size(), mr);
return ccstd::pmr::vector<boost::default_color_type>(_vertices.size(), mr);
}
// EdgeListGraph
@@ -611,17 +611,17 @@ struct LayoutGraphData {
// AddressableGraph help functions
inline ccstd::pmr::vector<OutEdge>& getChildrenList(vertex_descriptor v) noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline const ccstd::pmr::vector<OutEdge>& getChildrenList(vertex_descriptor v) const noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline ccstd::pmr::vector<InEdge>& getParentsList(vertex_descriptor v) noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline const ccstd::pmr::vector<InEdge>& 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<Vertex> vertices;
ccstd::pmr::vector<Vertex> _vertices;
// Components
ccstd::pmr::vector<ccstd::pmr::string> names;
ccstd::pmr::vector<UpdateFrequency> updateFrequencies;
@@ -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<vertex_descriptor>& 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<gfx::Buffer>& pass) {
},
[&](const IntrusivePtr<gfx::Texture>& pass) {
},
[&](const IntrusivePtr<gfx::Framebuffer>& 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<gfx::Buffer>& pass) {
},
[&](const IntrusivePtr<gfx::Texture>& pass) {
},
[&](const IntrusivePtr<gfx::Framebuffer>& pass) {
},
[&](const RenderSwapchain& queue) {
});
}
}
} // namespace render
File diff suppressed because it is too large Load Diff
@@ -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);
@@ -129,7 +129,7 @@ struct SwapchainTag {};
struct ResourceGraph {
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
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<OutEdge>& getOutEdgeList(vertex_descriptor v) noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline const ccstd::pmr::vector<OutEdge>& getOutEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline const ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
return {0, static_cast<vertices_size_type>(vertices.size())};
return {0, static_cast<vertices_size_type>(_vertices.size())};
}
inline vertex_descriptor getCurrentID() const noexcept {
return static_cast<vertex_descriptor>(vertices.size());
return static_cast<vertex_descriptor>(_vertices.size());
}
inline ccstd::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
return ccstd::pmr::vector<boost::default_color_type>(vertices.size(), mr);
return ccstd::pmr::vector<boost::default_color_type>(_vertices.size(), mr);
}
// EdgeListGraph
@@ -214,11 +214,13 @@ struct ResourceGraph {
using edges_size_type = uint32_t;
// PolymorphicGraph
using VertexTag = ccstd::variant<ManagedTag, PersistentBufferTag, PersistentTextureTag, FramebufferTag, SwapchainTag>;
using VertexValue = ccstd::variant<ManagedResource*, IntrusivePtr<gfx::Buffer>*, IntrusivePtr<gfx::Texture>*, IntrusivePtr<gfx::Framebuffer>*, RenderSwapchain*>;
using VertexConstValue = ccstd::variant<const ManagedResource*, const IntrusivePtr<gfx::Buffer>*, const IntrusivePtr<gfx::Texture>*, const IntrusivePtr<gfx::Framebuffer>*, const RenderSwapchain*>;
using VertexTag = ccstd::variant<ManagedTag, ManagedBufferTag, ManagedTextureTag, PersistentBufferTag, PersistentTextureTag, FramebufferTag, SwapchainTag>;
using VertexValue = ccstd::variant<ManagedResource*, ManagedBuffer*, ManagedTexture*, IntrusivePtr<gfx::Buffer>*, IntrusivePtr<gfx::Texture>*, IntrusivePtr<gfx::Framebuffer>*, RenderSwapchain*>;
using VertexConstValue = ccstd::variant<const ManagedResource*, const ManagedBuffer*, const ManagedTexture*, const IntrusivePtr<gfx::Buffer>*, const IntrusivePtr<gfx::Texture>*, const IntrusivePtr<gfx::Framebuffer>*, const RenderSwapchain*>;
using VertexHandle = ccstd::variant<
impl::ValueHandle<ManagedTag, vertex_descriptor>,
impl::ValueHandle<ManagedBufferTag, vertex_descriptor>,
impl::ValueHandle<ManagedTextureTag, vertex_descriptor>,
impl::ValueHandle<PersistentBufferTag, vertex_descriptor>,
impl::ValueHandle<PersistentTextureTag, vertex_descriptor>,
impl::ValueHandle<FramebufferTag, vertex_descriptor>,
@@ -261,7 +263,7 @@ struct ResourceGraph {
} static constexpr States{}; // NOLINT
// Vertices
ccstd::pmr::vector<Vertex> vertices;
ccstd::pmr::vector<Vertex> _vertices;
// Components
ccstd::pmr::vector<ccstd::pmr::string> names;
ccstd::pmr::vector<ResourceDesc> descs;
@@ -269,6 +271,8 @@ struct ResourceGraph {
ccstd::pmr::vector<ResourceStates> states;
// PolymorphicGraph
ccstd::pmr::vector<ManagedResource> resources;
ccstd::pmr::vector<ManagedBuffer> managedBuffers;
ccstd::pmr::vector<ManagedTexture> managedTextures;
ccstd::pmr::vector<IntrusivePtr<gfx::Buffer>> buffers;
ccstd::pmr::vector<IntrusivePtr<gfx::Texture>> textures;
ccstd::pmr::vector<IntrusivePtr<gfx::Framebuffer>> 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<char>;
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<OutEdge>& getOutEdgeList(vertex_descriptor v) noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline const ccstd::pmr::vector<OutEdge>& getOutEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline const ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
return {0, static_cast<vertices_size_type>(vertices.size())};
return {0, static_cast<vertices_size_type>(_vertices.size())};
}
inline vertex_descriptor getCurrentID() const noexcept {
return static_cast<vertex_descriptor>(vertices.size());
return static_cast<vertex_descriptor>(_vertices.size());
}
inline ccstd::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
return ccstd::pmr::vector<boost::default_color_type>(vertices.size(), mr);
return ccstd::pmr::vector<boost::default_color_type>(_vertices.size(), mr);
}
// EdgeListGraph
@@ -423,7 +427,7 @@ struct SubpassGraph {
} static constexpr Subpass{}; // NOLINT
// Vertices
ccstd::pmr::vector<Vertex> vertices;
ccstd::pmr::vector<Vertex> _vertices;
// Components
ccstd::pmr::vector<ccstd::pmr::string> names;
ccstd::pmr::vector<RasterSubpass> subpasses;
@@ -796,29 +800,29 @@ struct RenderGraph {
// VertexList help functions
inline ccstd::pmr::vector<OutEdge>& getOutEdgeList(vertex_descriptor v) noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline const ccstd::pmr::vector<OutEdge>& getOutEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].outEdges;
return _vertices[v].outEdges;
}
inline ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline const ccstd::pmr::vector<InEdge>& getInEdgeList(vertex_descriptor v) const noexcept {
return vertices[v].inEdges;
return _vertices[v].inEdges;
}
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
return {0, static_cast<vertices_size_type>(vertices.size())};
return {0, static_cast<vertices_size_type>(_vertices.size())};
}
inline vertex_descriptor getCurrentID() const noexcept {
return static_cast<vertex_descriptor>(vertices.size());
return static_cast<vertex_descriptor>(_vertices.size());
}
inline ccstd::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
return ccstd::pmr::vector<boost::default_color_type>(vertices.size(), mr);
return ccstd::pmr::vector<boost::default_color_type>(_vertices.size(), mr);
}
// EdgeListGraph
@@ -930,7 +934,7 @@ struct RenderGraph {
// Owners
ccstd::pmr::vector<Object> objects;
// Vertices
ccstd::pmr::vector<Vertex> vertices;
ccstd::pmr::vector<Vertex> _vertices;
// Components
ccstd::pmr::vector<ccstd::pmr::string> names;
ccstd::pmr::vector<ccstd::pmr::string> layoutNodes;
@@ -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);
@@ -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);
@@ -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);