mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
V3.6.0 pipeline (#10131)
This commit is contained in:
@@ -0,0 +1,407 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
/* eslint-disable max-len */
|
||||
import * as impl from './graph';
|
||||
import { Buffer, Texture } from '../../gfx/index';
|
||||
|
||||
//=================================================================
|
||||
// DeviceResourceGraph
|
||||
//=================================================================
|
||||
// PolymorphicGraph Concept
|
||||
export const enum DeviceResourceGraphValue {
|
||||
Buffer,
|
||||
Texture,
|
||||
}
|
||||
|
||||
interface DeviceResourceGraphValueType {
|
||||
[DeviceResourceGraphValue.Buffer]: Buffer
|
||||
[DeviceResourceGraphValue.Texture]: Texture
|
||||
}
|
||||
|
||||
export interface DeviceResourceGraphVisitor {
|
||||
buffer(value: Buffer): unknown;
|
||||
texture(value: Texture): unknown;
|
||||
}
|
||||
|
||||
type DeviceResourceGraphObject = Buffer | Texture;
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// Graph Concept
|
||||
export class DeviceResourceGraphVertex {
|
||||
constructor (
|
||||
readonly id: DeviceResourceGraphValue,
|
||||
readonly object: DeviceResourceGraphObject,
|
||||
) {
|
||||
this._id = id;
|
||||
this._object = object;
|
||||
}
|
||||
readonly _outEdges: impl.OutE[] = [];
|
||||
readonly _inEdges: impl.OutE[] = [];
|
||||
readonly _id: DeviceResourceGraphValue;
|
||||
readonly _object: DeviceResourceGraphObject;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// PropertyGraph Concept
|
||||
export class DeviceResourceGraphNameMap implements impl.PropertyMap {
|
||||
constructor (readonly names: string[]) {
|
||||
this._names = names;
|
||||
}
|
||||
get (v: number): string {
|
||||
return this._names[v];
|
||||
}
|
||||
readonly _names: string[];
|
||||
}
|
||||
|
||||
export class DeviceResourceGraphRefCountMap implements impl.PropertyMap {
|
||||
constructor (readonly refCounts: number[]) {
|
||||
this._refCounts = refCounts;
|
||||
}
|
||||
get (v: number): number {
|
||||
return this._refCounts[v];
|
||||
}
|
||||
readonly _refCounts: number[];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// ComponentGraph Concept
|
||||
export const enum DeviceResourceGraphComponent {
|
||||
Name,
|
||||
RefCount,
|
||||
}
|
||||
|
||||
interface DeviceResourceGraphComponentType {
|
||||
[DeviceResourceGraphComponent.Name]: string;
|
||||
[DeviceResourceGraphComponent.RefCount]: number;
|
||||
}
|
||||
|
||||
interface DeviceResourceGraphComponentPropertyMap {
|
||||
[DeviceResourceGraphComponent.Name]: DeviceResourceGraphNameMap;
|
||||
[DeviceResourceGraphComponent.RefCount]: DeviceResourceGraphRefCountMap;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// DeviceResourceGraph Implementation
|
||||
export class DeviceResourceGraph implements impl.BidirectionalGraph
|
||||
, impl.AdjacencyGraph
|
||||
, impl.VertexListGraph
|
||||
, impl.MutableGraph
|
||||
, impl.PropertyGraph
|
||||
, impl.NamedGraph
|
||||
, impl.ComponentGraph
|
||||
, impl.PolymorphicGraph {
|
||||
//-----------------------------------------------------------------
|
||||
// Graph
|
||||
// type vertex_descriptor = number;
|
||||
nullVertex (): number { return 0xFFFFFFFF; }
|
||||
// type edge_descriptor = impl.ED;
|
||||
readonly directed_category: impl.directional = impl.directional.bidirectional;
|
||||
readonly edge_parallel_category: impl.parallel = impl.parallel.allow;
|
||||
readonly traversal_category: impl.traversal = impl.traversal.incidence
|
||||
| impl.traversal.bidirectional
|
||||
| impl.traversal.adjacency
|
||||
| impl.traversal.vertex_list;
|
||||
//-----------------------------------------------------------------
|
||||
// IncidenceGraph
|
||||
// type out_edge_iterator = impl.OutEI;
|
||||
// type degree_size_type = number;
|
||||
edge (u: number, v: number): boolean {
|
||||
for (const oe of this._vertices[u]._outEdges) {
|
||||
if (v === oe.target as number) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
source (e: impl.ED): number {
|
||||
return e.source as number;
|
||||
}
|
||||
target (e: impl.ED): number {
|
||||
return e.target as number;
|
||||
}
|
||||
outEdges (v: number): impl.OutEI {
|
||||
return new impl.OutEI(this._vertices[v]._outEdges.values(), v);
|
||||
}
|
||||
outDegree (v: number): number {
|
||||
return this._vertices[v]._outEdges.length;
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// BidirectionalGraph
|
||||
// type in_edge_iterator = impl.InEI;
|
||||
inEdges (v: number): impl.InEI {
|
||||
return new impl.InEI(this._vertices[v]._inEdges.values(), v);
|
||||
}
|
||||
inDegree (v: number): number {
|
||||
return this._vertices[v]._inEdges.length;
|
||||
}
|
||||
degree (v: number): number {
|
||||
return this.outDegree(v) + this.inDegree(v);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// AdjacencyGraph
|
||||
// type adjacency_iterator = impl.AdjI;
|
||||
adjacentVertices (v: number): impl.AdjI {
|
||||
return new impl.AdjI(this, this.outEdges(v));
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// VertexListGraph
|
||||
vertices (): IterableIterator<number> {
|
||||
return this._vertices.keys();
|
||||
}
|
||||
numVertices (): number {
|
||||
return this._vertices.length;
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// MutableGraph
|
||||
addVertex<T extends DeviceResourceGraphValue> (
|
||||
id: DeviceResourceGraphValue,
|
||||
object: DeviceResourceGraphValueType[T],
|
||||
name: string,
|
||||
refCount: number,
|
||||
): number {
|
||||
const vert = new DeviceResourceGraphVertex(id, object);
|
||||
const v = this._vertices.length;
|
||||
this._vertices.push(vert);
|
||||
this._names.push(name);
|
||||
this._refCounts.push(refCount);
|
||||
return v;
|
||||
}
|
||||
clearVertex (v: number): void {
|
||||
const vert = this._vertices[v];
|
||||
// clear out edges
|
||||
for (const oe of vert._outEdges) {
|
||||
const target = this._vertices[oe.target as number];
|
||||
for (let i = 0; i !== target._inEdges.length;) { // remove all edges
|
||||
if (target._inEdges[i].target === v) {
|
||||
target._inEdges.splice(i, 1);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
vert._outEdges.length = 0;
|
||||
|
||||
// clear in edges
|
||||
for (const ie of vert._inEdges) {
|
||||
const source = this._vertices[ie.target as number];
|
||||
for (let i = 0; i !== source._outEdges.length;) { // remove all edges
|
||||
if (source._outEdges[i].target === v) {
|
||||
source._outEdges.splice(i, 1);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
vert._inEdges.length = 0;
|
||||
}
|
||||
removeVertex (u: number): void {
|
||||
this._vertices.splice(u, 1);
|
||||
this._names.splice(u, 1);
|
||||
this._refCounts.splice(u, 1);
|
||||
|
||||
const sz = this._vertices.length;
|
||||
if (u === sz) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let v = 0; v !== sz; ++v) {
|
||||
const vert = this._vertices[v];
|
||||
impl.reindexEdgeList(vert._outEdges, u);
|
||||
impl.reindexEdgeList(vert._inEdges, u);
|
||||
}
|
||||
}
|
||||
addEdge (u: number, v: number): impl.ED | null {
|
||||
// update in/out edge list
|
||||
this._vertices[u]._outEdges.push(new impl.OutE(v));
|
||||
this._vertices[v]._inEdges.push(new impl.OutE(u));
|
||||
return new impl.ED(u, v);
|
||||
}
|
||||
removeEdges (u: number, v: number): void {
|
||||
const source = this._vertices[u];
|
||||
// remove out edges of u
|
||||
for (let i = 0; i !== source._outEdges.length;) { // remove all edges
|
||||
if (source._outEdges[i].target === v) {
|
||||
source._outEdges.splice(i, 1);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
// remove in edges of v
|
||||
const target = this._vertices[v];
|
||||
for (let i = 0; i !== target._inEdges.length;) { // remove all edges
|
||||
if (target._inEdges[i].target === u) {
|
||||
target._inEdges.splice(i, 1);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
removeEdge (e: impl.ED): void {
|
||||
const u = e.source as number;
|
||||
const v = e.target as number;
|
||||
const source = this._vertices[u];
|
||||
for (let i = 0; i !== source._outEdges.length;) {
|
||||
if (source._outEdges[i].target === v) {
|
||||
source._outEdges.splice(i, 1);
|
||||
break; // remove one edge
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
const target = this._vertices[v];
|
||||
for (let i = 0; i !== target._inEdges.length;) {
|
||||
if (target._inEdges[i].target === u) {
|
||||
target._inEdges.splice(i, 1);
|
||||
break; // remove one edge
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// NamedGraph
|
||||
vertexName (v: number): string {
|
||||
return this._names[v];
|
||||
}
|
||||
vertexNameMap (): DeviceResourceGraphNameMap {
|
||||
return new DeviceResourceGraphNameMap(this._names);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// PropertyGraph
|
||||
get (tag: string): DeviceResourceGraphNameMap | DeviceResourceGraphRefCountMap {
|
||||
switch (tag) {
|
||||
// Components
|
||||
case 'Name':
|
||||
return new DeviceResourceGraphNameMap(this._names);
|
||||
case 'RefCount':
|
||||
return new DeviceResourceGraphRefCountMap(this._refCounts);
|
||||
default:
|
||||
throw Error('property map not found');
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// ComponentGraph
|
||||
component<T extends DeviceResourceGraphComponent> (id: T, v: number): DeviceResourceGraphComponentType[T] {
|
||||
switch (id) {
|
||||
case DeviceResourceGraphComponent.Name:
|
||||
return this._names[v] as DeviceResourceGraphComponentType[T];
|
||||
case DeviceResourceGraphComponent.RefCount:
|
||||
return this._refCounts[v] as DeviceResourceGraphComponentType[T];
|
||||
default:
|
||||
throw Error('component not found');
|
||||
}
|
||||
}
|
||||
componentMap<T extends DeviceResourceGraphComponent> (id: T): DeviceResourceGraphComponentPropertyMap[T] {
|
||||
switch (id) {
|
||||
case DeviceResourceGraphComponent.Name:
|
||||
return new DeviceResourceGraphNameMap(this._names) as DeviceResourceGraphComponentPropertyMap[T];
|
||||
case DeviceResourceGraphComponent.RefCount:
|
||||
return new DeviceResourceGraphRefCountMap(this._refCounts) as DeviceResourceGraphComponentPropertyMap[T];
|
||||
default:
|
||||
throw Error('component map not found');
|
||||
}
|
||||
}
|
||||
getName (v: number): string {
|
||||
return this._names[v];
|
||||
}
|
||||
getRefCount (v: number): number {
|
||||
return this._refCounts[v];
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// PolymorphicGraph
|
||||
holds (id: DeviceResourceGraphValue, v: number): boolean {
|
||||
return this._vertices[v]._id === id;
|
||||
}
|
||||
id (v: number): DeviceResourceGraphValue {
|
||||
return this._vertices[v]._id;
|
||||
}
|
||||
object (v: number): DeviceResourceGraphObject {
|
||||
return this._vertices[v]._object;
|
||||
}
|
||||
value<T extends DeviceResourceGraphValue> (id: T, v: number): DeviceResourceGraphValueType[T] {
|
||||
if (this._vertices[v]._id === id) {
|
||||
return this._vertices[v]._object as DeviceResourceGraphValueType[T];
|
||||
} else {
|
||||
throw Error('value id not match');
|
||||
}
|
||||
}
|
||||
tryValue<T extends DeviceResourceGraphValue> (id: T, v: number): DeviceResourceGraphValueType[T] | null {
|
||||
if (this._vertices[v]._id === id) {
|
||||
return this._vertices[v]._object as DeviceResourceGraphValueType[T];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
visitVertex (visitor: DeviceResourceGraphVisitor, v: number): unknown {
|
||||
const vert = this._vertices[v];
|
||||
switch (vert._id) {
|
||||
case DeviceResourceGraphValue.Buffer:
|
||||
return visitor.buffer(vert._object as Buffer);
|
||||
case DeviceResourceGraphValue.Texture:
|
||||
return visitor.texture(vert._object as Texture);
|
||||
default:
|
||||
throw Error('polymorphic type not found');
|
||||
}
|
||||
}
|
||||
getBuffer (v: number): Buffer {
|
||||
if (this._vertices[v]._id === DeviceResourceGraphValue.Buffer) {
|
||||
return this._vertices[v]._object as Buffer;
|
||||
} else {
|
||||
throw Error('value id not match');
|
||||
}
|
||||
}
|
||||
getTexture (v: number): Texture {
|
||||
if (this._vertices[v]._id === DeviceResourceGraphValue.Texture) {
|
||||
return this._vertices[v]._object as Texture;
|
||||
} else {
|
||||
throw Error('value id not match');
|
||||
}
|
||||
}
|
||||
tryGetBuffer (v: number): Buffer | null {
|
||||
if (this._vertices[v]._id === DeviceResourceGraphValue.Buffer) {
|
||||
return this._vertices[v]._object as Buffer;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
tryGetTexture (v: number): Texture | null {
|
||||
if (this._vertices[v]._id === DeviceResourceGraphValue.Texture) {
|
||||
return this._vertices[v]._object as Texture;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
readonly components: string[] = ['Name', 'RefCount'];
|
||||
readonly _vertices: DeviceResourceGraphVertex[] = [];
|
||||
readonly _names: string[] = [];
|
||||
readonly _refCounts: number[] = [];
|
||||
}
|
||||
@@ -0,0 +1,512 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
export const enum directional {
|
||||
undirected = 0,
|
||||
directed = 1,
|
||||
bidirectional = 2,
|
||||
}
|
||||
|
||||
export const enum parallel {
|
||||
disallow = 0,
|
||||
allow = 1,
|
||||
}
|
||||
|
||||
export const enum traversal {
|
||||
none = 0,
|
||||
incidence = 1 << 0,
|
||||
bidirectional = 1 << 1,
|
||||
adjacency = 1 << 2,
|
||||
vertex_list = 1 << 3,
|
||||
edge_list = 1 << 4,
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Vertex
|
||||
//--------------------------------------------------------------------------
|
||||
export interface Vertex {
|
||||
nullVertex (): Vertex | null;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Vertex Descriptor
|
||||
//--------------------------------------------------------------------------
|
||||
export type vertex_descriptor = number | Vertex;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Edge
|
||||
//--------------------------------------------------------------------------
|
||||
export interface Edge {
|
||||
getProperty (): unknown;
|
||||
source: vertex_descriptor;
|
||||
target: vertex_descriptor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Edge Descriptor
|
||||
//--------------------------------------------------------------------------
|
||||
export class ED {
|
||||
constructor (source: vertex_descriptor, target: vertex_descriptor) {
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
}
|
||||
equals (rhs: ED): boolean {
|
||||
return this.source === rhs.source
|
||||
&& this.target === rhs.target;
|
||||
}
|
||||
source: vertex_descriptor;
|
||||
target: vertex_descriptor;
|
||||
}
|
||||
|
||||
// Edge Descriptor with Property
|
||||
export class EPD {
|
||||
constructor (source: vertex_descriptor, target: vertex_descriptor, edge: Edge) {
|
||||
this.source = source;
|
||||
this.target = target;
|
||||
this.edge = edge;
|
||||
}
|
||||
equals (rhs: EPD): boolean {
|
||||
return this.edge === rhs.edge;
|
||||
}
|
||||
source: vertex_descriptor;
|
||||
target: vertex_descriptor;
|
||||
readonly edge: Edge;
|
||||
}
|
||||
|
||||
// Edge Descriptor
|
||||
export type edge_descriptor = ED | EPD;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// OutEdge
|
||||
//--------------------------------------------------------------------------
|
||||
// OutEdge
|
||||
export class OutE {
|
||||
constructor (target: vertex_descriptor) {
|
||||
this.target = target;
|
||||
}
|
||||
equals (rhs: OutE): boolean {
|
||||
return this.target === rhs.target;
|
||||
}
|
||||
target: vertex_descriptor;
|
||||
}
|
||||
|
||||
// OutEdge(Property)
|
||||
export class OutEP {
|
||||
constructor (target: vertex_descriptor, edge: Edge) {
|
||||
this.target = target;
|
||||
this.edge = edge;
|
||||
}
|
||||
equals (rhs: OutEP): boolean {
|
||||
return this.target === rhs.target;
|
||||
}
|
||||
getProperty (): unknown {
|
||||
return this.edge.getProperty();
|
||||
}
|
||||
target: vertex_descriptor;
|
||||
readonly edge: Edge;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// OutEdge Iterator
|
||||
//--------------------------------------------------------------------------
|
||||
export class OutEI implements IterableIterator<ED> {
|
||||
constructor (iterator: IterableIterator<OutE>, source: vertex_descriptor) {
|
||||
this.iterator = iterator;
|
||||
this.source = source;
|
||||
}
|
||||
[Symbol.iterator] () {
|
||||
return this;
|
||||
}
|
||||
next (): IteratorResult<ED> {
|
||||
const res = this.iterator.next();
|
||||
if (res.done) {
|
||||
return { value: undefined, done: true };
|
||||
} else {
|
||||
return { value: new ED(this.source, res.value.target), done: false };
|
||||
}
|
||||
}
|
||||
readonly iterator: IterableIterator<OutE>;
|
||||
readonly source: vertex_descriptor;
|
||||
}
|
||||
|
||||
// OutEdge(Property) Iterator
|
||||
export class OutEPI implements IterableIterator<EPD> {
|
||||
constructor (iterator: IterableIterator<OutEP>, source: vertex_descriptor) {
|
||||
this.iterator = iterator;
|
||||
this.source = source;
|
||||
}
|
||||
[Symbol.iterator] () {
|
||||
return this;
|
||||
}
|
||||
next (): IteratorResult<EPD> {
|
||||
const res = this.iterator.next();
|
||||
if (res.done) {
|
||||
return { value: undefined, done: true };
|
||||
} else {
|
||||
return { value: new EPD(this.source, res.value.target, res.value.edge), done: false };
|
||||
}
|
||||
}
|
||||
readonly iterator: IterableIterator<OutEP>;
|
||||
readonly source: vertex_descriptor;
|
||||
}
|
||||
|
||||
// OutEdge Iterator
|
||||
export type out_edge_iterator = OutEI | OutEPI;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// InEdge Iterator
|
||||
//--------------------------------------------------------------------------
|
||||
// InEdge Iterator
|
||||
export class InEI implements IterableIterator<ED> {
|
||||
constructor (iterator: IterableIterator<OutE>, source: vertex_descriptor) {
|
||||
this.iterator = iterator;
|
||||
this.source = source;
|
||||
}
|
||||
[Symbol.iterator] () {
|
||||
return this;
|
||||
}
|
||||
next (): IteratorResult<ED> {
|
||||
const res = this.iterator.next();
|
||||
if (res.done) {
|
||||
return { value: undefined, done: true };
|
||||
} else {
|
||||
return { value: new ED(res.value.target, this.source), done: false };
|
||||
}
|
||||
}
|
||||
readonly iterator: IterableIterator<OutE>;
|
||||
readonly source: vertex_descriptor;
|
||||
}
|
||||
|
||||
// InEdge(Property) Iterator
|
||||
export class InEPI implements IterableIterator<EPD> {
|
||||
constructor (iterator: IterableIterator<OutEP>, source: vertex_descriptor) {
|
||||
this.iterator = iterator;
|
||||
this.source = source;
|
||||
}
|
||||
[Symbol.iterator] () {
|
||||
return this;
|
||||
}
|
||||
next (): IteratorResult<EPD> {
|
||||
const res = this.iterator.next();
|
||||
if (res.done) {
|
||||
return { value: undefined, done: true };
|
||||
} else {
|
||||
return { value: new EPD(res.value.target, this.source, res.value.edge), done: false };
|
||||
}
|
||||
}
|
||||
readonly iterator: IterableIterator<OutEP>;
|
||||
readonly source: vertex_descriptor;
|
||||
}
|
||||
|
||||
// InEdge Iterator
|
||||
export type in_edge_iterator = InEI | InEPI;
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Graph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface Graph {
|
||||
readonly directed_category: directional;
|
||||
readonly edge_parallel_category: parallel;
|
||||
readonly traversal_category: traversal;
|
||||
|
||||
nullVertex (): vertex_descriptor | null;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// IncidenceGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface IncidenceGraph extends Graph {
|
||||
edge (u: vertex_descriptor, v: vertex_descriptor): boolean;
|
||||
source (e: edge_descriptor): vertex_descriptor;
|
||||
target (e: edge_descriptor): vertex_descriptor;
|
||||
outEdges (v: vertex_descriptor): out_edge_iterator;
|
||||
outDegree (v: vertex_descriptor): number;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// BidirectionalGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface BidirectionalGraph extends IncidenceGraph {
|
||||
inEdges (v: vertex_descriptor): in_edge_iterator;
|
||||
inDegree (v: vertex_descriptor): number;
|
||||
degree (v: vertex_descriptor) : number;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// AdjacencyGraph
|
||||
//--------------------------------------------------------------------------
|
||||
// Adjacency Iterator
|
||||
export class AdjI implements IterableIterator<vertex_descriptor> {
|
||||
constructor (graph: IncidenceGraph, iterator: OutEI) {
|
||||
this.graph = graph;
|
||||
this.iterator = iterator;
|
||||
}
|
||||
[Symbol.iterator] () {
|
||||
return this;
|
||||
}
|
||||
next (): IteratorResult<vertex_descriptor> {
|
||||
const res = this.iterator.next();
|
||||
if (res.done) {
|
||||
return { value: undefined, done: true };
|
||||
} else {
|
||||
return { value: this.graph.target(res.value), done: false };
|
||||
}
|
||||
}
|
||||
readonly graph: IncidenceGraph;
|
||||
readonly iterator: OutEI;
|
||||
}
|
||||
|
||||
export class AdjPI implements IterableIterator<vertex_descriptor> {
|
||||
constructor (graph: IncidenceGraph, iterator: OutEPI) {
|
||||
this.graph = graph;
|
||||
this.iterator = iterator;
|
||||
}
|
||||
[Symbol.iterator] () {
|
||||
return this;
|
||||
}
|
||||
next (): IteratorResult<vertex_descriptor> {
|
||||
const res = this.iterator.next();
|
||||
if (res.done) {
|
||||
return { value: undefined, done: true };
|
||||
} else {
|
||||
return { value: this.graph.target(res.value), done: false };
|
||||
}
|
||||
}
|
||||
readonly graph: IncidenceGraph;
|
||||
readonly iterator: OutEPI;
|
||||
}
|
||||
|
||||
// Adjacency Iterator
|
||||
export type adjacency_iterator = AdjI | AdjPI;
|
||||
|
||||
// AdjacencyGraph
|
||||
export interface AdjacencyGraph extends Graph {
|
||||
adjacentVertices (v: vertex_descriptor): adjacency_iterator;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// VertexListGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface VertexListGraph extends Graph {
|
||||
vertices (): IterableIterator<vertex_descriptor>;
|
||||
numVertices (): number;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// EdgeListGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface EdgeListGraph extends Graph {
|
||||
edges (): IterableIterator<edge_descriptor>;
|
||||
numEdges (): number;
|
||||
source (e: edge_descriptor): vertex_descriptor;
|
||||
target (e: edge_descriptor): vertex_descriptor;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// MutableGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface MutableGraph extends Graph {
|
||||
addVertex (...args): vertex_descriptor;
|
||||
clearVertex (v: vertex_descriptor): void;
|
||||
removeVertex (v: vertex_descriptor): void;
|
||||
addEdge (u: vertex_descriptor, v: vertex_descriptor, p?: unknown): edge_descriptor | null;
|
||||
removeEdges (u: vertex_descriptor, v: vertex_descriptor): void;
|
||||
removeEdge (e: edge_descriptor): void;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// PropertyMap
|
||||
//--------------------------------------------------------------------------
|
||||
export interface PropertyMap {
|
||||
get (x: vertex_descriptor | edge_descriptor): unknown;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// PropertyGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface PropertyGraph extends Graph {
|
||||
get (tag: string): PropertyMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// NamedGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface NamedGraph extends Graph {
|
||||
vertexName (v: vertex_descriptor): string;
|
||||
vertexNameMap (): PropertyMap;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ComponentGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface ComponentGraph extends Graph {
|
||||
readonly components: string[];
|
||||
component (id: number, v: vertex_descriptor): unknown;
|
||||
componentMap (id: number): unknown; // should be PropertyMap
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// PolymorphicGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface PolymorphicGraph extends Graph {
|
||||
holds (id: number, v: vertex_descriptor): boolean;
|
||||
id (v: vertex_descriptor): number;
|
||||
object (v: vertex_descriptor): unknown;
|
||||
value (id: number, v: vertex_descriptor): unknown;
|
||||
tryValue(id: number, v: vertex_descriptor): unknown;
|
||||
visitVertex (visitor: unknown, v: vertex_descriptor): void;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ReferenceGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export type reference_descriptor = ED | EPD;
|
||||
export type child_iterator = OutEI | OutEPI;
|
||||
export type parent_iterator = InEI | InEPI;
|
||||
|
||||
export interface ReferenceGraph extends Graph {
|
||||
reference (u: vertex_descriptor, v: vertex_descriptor): boolean;
|
||||
parent (e: reference_descriptor): vertex_descriptor;
|
||||
child (e: reference_descriptor): vertex_descriptor;
|
||||
parents (v: vertex_descriptor): parent_iterator;
|
||||
children (v: vertex_descriptor): child_iterator;
|
||||
numParents (v: vertex_descriptor): number;
|
||||
numChildren (v: vertex_descriptor): number;
|
||||
getParent (v: vertex_descriptor): vertex_descriptor | null;
|
||||
isAncestor (ancestor: vertex_descriptor, descendent: vertex_descriptor): boolean;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// MutableReferenceGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface MutableReferenceGraph extends ReferenceGraph {
|
||||
addReference (u: vertex_descriptor, v: vertex_descriptor, p?: unknown): reference_descriptor | null;
|
||||
removeReference (e: reference_descriptor): void;
|
||||
removeReferences (u: vertex_descriptor, v: vertex_descriptor): void;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// ParentGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface ParentGraph extends ReferenceGraph, NamedGraph {
|
||||
locateChild (v: vertex_descriptor | null, name: string): vertex_descriptor | null;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// AddressableGraph
|
||||
//--------------------------------------------------------------------------
|
||||
export interface AddressableGraph extends ParentGraph {
|
||||
contains (absPath: string): boolean;
|
||||
locate (absPath: string): vertex_descriptor | null;
|
||||
locateRelative (path: string, start?: vertex_descriptor | null): vertex_descriptor | null;
|
||||
path (v: vertex_descriptor) : string;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Help Functions
|
||||
//--------------------------------------------------------------------------
|
||||
export function reindexEdgeList (el: (OutE|OutEP)[], u: number): void {
|
||||
for (const e of el) {
|
||||
if (e.target as number > u) {
|
||||
--(e.target as number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function removeAllEdgesFromList (edges: Set<Edge>, el: OutEP[], v: vertex_descriptor): void {
|
||||
const sz = el.length;
|
||||
for (let i = 0; i !== sz; ++i) {
|
||||
const oe = el[i];
|
||||
if (oe.target === v) {
|
||||
// NOTE: Wihtout this skip, this loop will double-delete
|
||||
// properties of loop edges. This solution is based on the
|
||||
// observation that the incidence edges of a vertex with a loop
|
||||
// are adjacent in the out edge list. This *may* actually hold
|
||||
// for multisets also.
|
||||
const skip = (i + 1 !== sz && oe.edge === el[i + 1].edge);
|
||||
edges.delete(oe.edge);
|
||||
if (skip) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getPath (g: ReferenceGraph & NamedGraph, v: vertex_descriptor | null): string {
|
||||
if (v === g.nullVertex()) {
|
||||
return '';
|
||||
}
|
||||
const paths: string[] = [];
|
||||
for (; v !== g.nullVertex(); v = g.getParent(v as vertex_descriptor)) {
|
||||
paths.push(g.vertexName(v as vertex_descriptor));
|
||||
}
|
||||
let path = '';
|
||||
for (let i = paths.length; i-- > 0;) {
|
||||
path += '/';
|
||||
path += paths[i];
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
export function findRelative (g: ParentGraph, v: vertex_descriptor | null, path: string): vertex_descriptor | null {
|
||||
const pseudo = g.nullVertex();
|
||||
const names = path.split('/');
|
||||
|
||||
if (names.length === 0) { // empty string
|
||||
return v;
|
||||
}
|
||||
|
||||
let curr = v;
|
||||
let start = 0;
|
||||
if (names[0] === '') { // absolute path
|
||||
// reset v to pseudo root
|
||||
curr = pseudo;
|
||||
// skip pseudo root
|
||||
++start;
|
||||
}
|
||||
// locating begins
|
||||
for (let i = start; i !== names.length; ++i) {
|
||||
const name = names[i];
|
||||
if (name === '') { // empty name, do nothing
|
||||
continue;
|
||||
}
|
||||
if (name === '.') { // current node, do nothing
|
||||
continue;
|
||||
}
|
||||
if (name === '..') { // parent node
|
||||
if (curr === pseudo) {
|
||||
// current node is pseudo already, return not found
|
||||
return pseudo;
|
||||
}
|
||||
curr = g.getParent(curr as vertex_descriptor);
|
||||
continue;
|
||||
}
|
||||
curr = g.locateChild(curr, name);
|
||||
if (curr === pseudo) { // child not found
|
||||
return pseudo;
|
||||
}
|
||||
}
|
||||
return curr;
|
||||
}
|
||||
@@ -0,0 +1,621 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
/* eslint-disable max-len */
|
||||
import * as impl from './graph';
|
||||
import { NodeType, ParameterType, UpdateFrequency, ValueType } from './types';
|
||||
|
||||
export class Constant {
|
||||
type: ValueType = ValueType.Typeless;
|
||||
valueID = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
export class ConstantBuffer {
|
||||
size = 0;
|
||||
constants: Constant[] = [];
|
||||
}
|
||||
|
||||
export const enum DescriptorType {
|
||||
CBuffer,
|
||||
RWBuffer,
|
||||
RWTexture,
|
||||
Buffer,
|
||||
Texture,
|
||||
Sampler,
|
||||
}
|
||||
|
||||
export class DescriptorBlock {
|
||||
type: DescriptorType = DescriptorType.CBuffer;
|
||||
capacity = 0;
|
||||
attributeIDs: Uint32Array = new Uint32Array(0);
|
||||
}
|
||||
|
||||
export class DescriptorArray {
|
||||
capacity = 0;
|
||||
attributeID = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
export class UnboundedDescriptor {
|
||||
type: DescriptorType = DescriptorType.CBuffer;
|
||||
descriptors: DescriptorArray[] = [];
|
||||
}
|
||||
|
||||
export class DescriptorTable {
|
||||
slot = 0;
|
||||
capacity = 0;
|
||||
blocks: DescriptorBlock[] = [];
|
||||
}
|
||||
|
||||
export class DescriptorSet {
|
||||
tables: DescriptorTable[] = [];
|
||||
unbounded: UnboundedDescriptor = new UnboundedDescriptor();
|
||||
}
|
||||
|
||||
export class LayoutData {
|
||||
constantBuffers: Map<ParameterType, ConstantBuffer> = new Map<ParameterType, ConstantBuffer>();
|
||||
descriptorSets: Map<ParameterType, DescriptorSet> = new Map<ParameterType, DescriptorSet>();
|
||||
}
|
||||
|
||||
export class ShaderProgramData {
|
||||
layouts: Map<UpdateFrequency, LayoutData> = new Map<UpdateFrequency, LayoutData>();
|
||||
}
|
||||
|
||||
export class GroupNodeData {
|
||||
constructor (nodeType: NodeType = NodeType.INTERNAL) {
|
||||
this.nodeType = nodeType;
|
||||
}
|
||||
nodeType: NodeType;
|
||||
}
|
||||
|
||||
export class ShaderNodeData {
|
||||
rootSignature = '';
|
||||
shaderPrograms: ShaderProgramData[] = [];
|
||||
shaderIndex: Map<string, number> = new Map<string, number>();
|
||||
}
|
||||
|
||||
//=================================================================
|
||||
// LayoutGraphData
|
||||
//=================================================================
|
||||
// PolymorphicGraph Concept
|
||||
export const enum LayoutGraphDataValue {
|
||||
Group,
|
||||
Shader,
|
||||
}
|
||||
|
||||
interface LayoutGraphDataValueType {
|
||||
[LayoutGraphDataValue.Group]: GroupNodeData
|
||||
[LayoutGraphDataValue.Shader]: ShaderNodeData
|
||||
}
|
||||
|
||||
export interface LayoutGraphDataVisitor {
|
||||
group(value: GroupNodeData): unknown;
|
||||
shader(value: ShaderNodeData): unknown;
|
||||
}
|
||||
|
||||
type LayoutGraphDataObject = GroupNodeData | ShaderNodeData;
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// Graph Concept
|
||||
export class LayoutGraphDataVertex {
|
||||
constructor (
|
||||
readonly id: LayoutGraphDataValue,
|
||||
readonly object: LayoutGraphDataObject,
|
||||
) {
|
||||
this._id = id;
|
||||
this._object = object;
|
||||
}
|
||||
readonly _outEdges: impl.OutE[] = [];
|
||||
readonly _inEdges: impl.OutE[] = [];
|
||||
readonly _id: LayoutGraphDataValue;
|
||||
readonly _object: LayoutGraphDataObject;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// PropertyGraph Concept
|
||||
export class LayoutGraphDataNameMap implements impl.PropertyMap {
|
||||
constructor (readonly names: string[]) {
|
||||
this._names = names;
|
||||
}
|
||||
get (v: number): string {
|
||||
return this._names[v];
|
||||
}
|
||||
readonly _names: string[];
|
||||
}
|
||||
|
||||
export class LayoutGraphDataUpdateMap implements impl.PropertyMap {
|
||||
constructor (readonly updateFrequencies: UpdateFrequency[]) {
|
||||
this._updateFrequencies = updateFrequencies;
|
||||
}
|
||||
get (v: number): UpdateFrequency {
|
||||
return this._updateFrequencies[v];
|
||||
}
|
||||
readonly _updateFrequencies: UpdateFrequency[];
|
||||
}
|
||||
|
||||
export class LayoutGraphDataLayoutMap implements impl.PropertyMap {
|
||||
constructor (readonly layouts: LayoutData[]) {
|
||||
this._layouts = layouts;
|
||||
}
|
||||
get (v: number): LayoutData {
|
||||
return this._layouts[v];
|
||||
}
|
||||
readonly _layouts: LayoutData[];
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// ComponentGraph Concept
|
||||
export const enum LayoutGraphDataComponent {
|
||||
Name,
|
||||
Update,
|
||||
Layout,
|
||||
}
|
||||
|
||||
interface LayoutGraphDataComponentType {
|
||||
[LayoutGraphDataComponent.Name]: string;
|
||||
[LayoutGraphDataComponent.Update]: UpdateFrequency;
|
||||
[LayoutGraphDataComponent.Layout]: LayoutData;
|
||||
}
|
||||
|
||||
interface LayoutGraphDataComponentPropertyMap {
|
||||
[LayoutGraphDataComponent.Name]: LayoutGraphDataNameMap;
|
||||
[LayoutGraphDataComponent.Update]: LayoutGraphDataUpdateMap;
|
||||
[LayoutGraphDataComponent.Layout]: LayoutGraphDataLayoutMap;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
// LayoutGraphData Implementation
|
||||
export class LayoutGraphData implements impl.BidirectionalGraph
|
||||
, impl.AdjacencyGraph
|
||||
, impl.VertexListGraph
|
||||
, impl.MutableGraph
|
||||
, impl.PropertyGraph
|
||||
, impl.NamedGraph
|
||||
, impl.ComponentGraph
|
||||
, impl.PolymorphicGraph
|
||||
, impl.ReferenceGraph
|
||||
, impl.MutableReferenceGraph
|
||||
, impl.AddressableGraph {
|
||||
//-----------------------------------------------------------------
|
||||
// Graph
|
||||
// type vertex_descriptor = number;
|
||||
nullVertex (): number { return 0xFFFFFFFF; }
|
||||
// type edge_descriptor = impl.ED;
|
||||
readonly directed_category: impl.directional = impl.directional.bidirectional;
|
||||
readonly edge_parallel_category: impl.parallel = impl.parallel.allow;
|
||||
readonly traversal_category: impl.traversal = impl.traversal.incidence
|
||||
| impl.traversal.bidirectional
|
||||
| impl.traversal.adjacency
|
||||
| impl.traversal.vertex_list;
|
||||
//-----------------------------------------------------------------
|
||||
// IncidenceGraph
|
||||
// type out_edge_iterator = impl.OutEI;
|
||||
// type degree_size_type = number;
|
||||
edge (u: number, v: number): boolean {
|
||||
for (const oe of this._vertices[u]._outEdges) {
|
||||
if (v === oe.target as number) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
source (e: impl.ED): number {
|
||||
return e.source as number;
|
||||
}
|
||||
target (e: impl.ED): number {
|
||||
return e.target as number;
|
||||
}
|
||||
outEdges (v: number): impl.OutEI {
|
||||
return new impl.OutEI(this._vertices[v]._outEdges.values(), v);
|
||||
}
|
||||
outDegree (v: number): number {
|
||||
return this._vertices[v]._outEdges.length;
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// BidirectionalGraph
|
||||
// type in_edge_iterator = impl.InEI;
|
||||
inEdges (v: number): impl.InEI {
|
||||
return new impl.InEI(this._vertices[v]._inEdges.values(), v);
|
||||
}
|
||||
inDegree (v: number): number {
|
||||
return this._vertices[v]._inEdges.length;
|
||||
}
|
||||
degree (v: number): number {
|
||||
return this.outDegree(v) + this.inDegree(v);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// AdjacencyGraph
|
||||
// type adjacency_iterator = impl.AdjI;
|
||||
adjacentVertices (v: number): impl.AdjI {
|
||||
return new impl.AdjI(this, this.outEdges(v));
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// VertexListGraph
|
||||
vertices (): IterableIterator<number> {
|
||||
return this._vertices.keys();
|
||||
}
|
||||
numVertices (): number {
|
||||
return this._vertices.length;
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// MutableGraph
|
||||
addVertex<T extends LayoutGraphDataValue> (
|
||||
id: LayoutGraphDataValue,
|
||||
object: LayoutGraphDataValueType[T],
|
||||
name: string,
|
||||
update: UpdateFrequency,
|
||||
layout: LayoutData,
|
||||
u = 0xFFFFFFFF,
|
||||
): number {
|
||||
const vert = new LayoutGraphDataVertex(id, object);
|
||||
const v = this._vertices.length;
|
||||
this._vertices.push(vert);
|
||||
this._names.push(name);
|
||||
this._updateFrequencies.push(update);
|
||||
this._layouts.push(layout);
|
||||
|
||||
// ReferenceGraph
|
||||
if (u !== 0xFFFFFFFF) {
|
||||
this.addEdge(u, v);
|
||||
}
|
||||
|
||||
return v;
|
||||
}
|
||||
clearVertex (v: number): void {
|
||||
// ReferenceGraph(Alias)
|
||||
const vert = this._vertices[v];
|
||||
// clear out edges
|
||||
for (const oe of vert._outEdges) {
|
||||
const target = this._vertices[oe.target as number];
|
||||
for (let i = 0; i !== target._inEdges.length;) { // remove all edges
|
||||
if (target._inEdges[i].target === v) {
|
||||
target._inEdges.splice(i, 1);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
vert._outEdges.length = 0;
|
||||
|
||||
// clear in edges
|
||||
for (const ie of vert._inEdges) {
|
||||
const source = this._vertices[ie.target as number];
|
||||
for (let i = 0; i !== source._outEdges.length;) { // remove all edges
|
||||
if (source._outEdges[i].target === v) {
|
||||
source._outEdges.splice(i, 1);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
vert._inEdges.length = 0;
|
||||
}
|
||||
removeVertex (u: number): void {
|
||||
this._vertices.splice(u, 1);
|
||||
this._names.splice(u, 1);
|
||||
this._updateFrequencies.splice(u, 1);
|
||||
this._layouts.splice(u, 1);
|
||||
|
||||
const sz = this._vertices.length;
|
||||
if (u === sz) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let v = 0; v !== sz; ++v) {
|
||||
const vert = this._vertices[v];
|
||||
impl.reindexEdgeList(vert._outEdges, u);
|
||||
impl.reindexEdgeList(vert._inEdges, u);
|
||||
}
|
||||
}
|
||||
addEdge (u: number, v: number): impl.ED | null {
|
||||
// update in/out edge list
|
||||
this._vertices[u]._outEdges.push(new impl.OutE(v));
|
||||
this._vertices[v]._inEdges.push(new impl.OutE(u));
|
||||
return new impl.ED(u, v);
|
||||
}
|
||||
removeEdges (u: number, v: number): void {
|
||||
const source = this._vertices[u];
|
||||
// remove out edges of u
|
||||
for (let i = 0; i !== source._outEdges.length;) { // remove all edges
|
||||
if (source._outEdges[i].target === v) {
|
||||
source._outEdges.splice(i, 1);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
// remove in edges of v
|
||||
const target = this._vertices[v];
|
||||
for (let i = 0; i !== target._inEdges.length;) { // remove all edges
|
||||
if (target._inEdges[i].target === u) {
|
||||
target._inEdges.splice(i, 1);
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
removeEdge (e: impl.ED): void {
|
||||
const u = e.source as number;
|
||||
const v = e.target as number;
|
||||
const source = this._vertices[u];
|
||||
for (let i = 0; i !== source._outEdges.length;) {
|
||||
if (source._outEdges[i].target === v) {
|
||||
source._outEdges.splice(i, 1);
|
||||
break; // remove one edge
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
const target = this._vertices[v];
|
||||
for (let i = 0; i !== target._inEdges.length;) {
|
||||
if (target._inEdges[i].target === u) {
|
||||
target._inEdges.splice(i, 1);
|
||||
break; // remove one edge
|
||||
} else {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// NamedGraph
|
||||
vertexName (v: number): string {
|
||||
return this._names[v];
|
||||
}
|
||||
vertexNameMap (): LayoutGraphDataNameMap {
|
||||
return new LayoutGraphDataNameMap(this._names);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// PropertyGraph
|
||||
get (tag: string): LayoutGraphDataNameMap | LayoutGraphDataUpdateMap | LayoutGraphDataLayoutMap {
|
||||
switch (tag) {
|
||||
// Components
|
||||
case 'Name':
|
||||
return new LayoutGraphDataNameMap(this._names);
|
||||
case 'Update':
|
||||
return new LayoutGraphDataUpdateMap(this._updateFrequencies);
|
||||
case 'Layout':
|
||||
return new LayoutGraphDataLayoutMap(this._layouts);
|
||||
default:
|
||||
throw Error('property map not found');
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// ComponentGraph
|
||||
component<T extends LayoutGraphDataComponent> (id: T, v: number): LayoutGraphDataComponentType[T] {
|
||||
switch (id) {
|
||||
case LayoutGraphDataComponent.Name:
|
||||
return this._names[v] as LayoutGraphDataComponentType[T];
|
||||
case LayoutGraphDataComponent.Update:
|
||||
return this._updateFrequencies[v] as LayoutGraphDataComponentType[T];
|
||||
case LayoutGraphDataComponent.Layout:
|
||||
return this._layouts[v] as LayoutGraphDataComponentType[T];
|
||||
default:
|
||||
throw Error('component not found');
|
||||
}
|
||||
}
|
||||
componentMap<T extends LayoutGraphDataComponent> (id: T): LayoutGraphDataComponentPropertyMap[T] {
|
||||
switch (id) {
|
||||
case LayoutGraphDataComponent.Name:
|
||||
return new LayoutGraphDataNameMap(this._names) as LayoutGraphDataComponentPropertyMap[T];
|
||||
case LayoutGraphDataComponent.Update:
|
||||
return new LayoutGraphDataUpdateMap(this._updateFrequencies) as LayoutGraphDataComponentPropertyMap[T];
|
||||
case LayoutGraphDataComponent.Layout:
|
||||
return new LayoutGraphDataLayoutMap(this._layouts) as LayoutGraphDataComponentPropertyMap[T];
|
||||
default:
|
||||
throw Error('component map not found');
|
||||
}
|
||||
}
|
||||
getName (v: number): string {
|
||||
return this._names[v];
|
||||
}
|
||||
getUpdate (v: number): UpdateFrequency {
|
||||
return this._updateFrequencies[v];
|
||||
}
|
||||
getLayout (v: number): LayoutData {
|
||||
return this._layouts[v];
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// PolymorphicGraph
|
||||
holds (id: LayoutGraphDataValue, v: number): boolean {
|
||||
return this._vertices[v]._id === id;
|
||||
}
|
||||
id (v: number): LayoutGraphDataValue {
|
||||
return this._vertices[v]._id;
|
||||
}
|
||||
object (v: number): LayoutGraphDataObject {
|
||||
return this._vertices[v]._object;
|
||||
}
|
||||
value<T extends LayoutGraphDataValue> (id: T, v: number): LayoutGraphDataValueType[T] {
|
||||
if (this._vertices[v]._id === id) {
|
||||
return this._vertices[v]._object as LayoutGraphDataValueType[T];
|
||||
} else {
|
||||
throw Error('value id not match');
|
||||
}
|
||||
}
|
||||
tryValue<T extends LayoutGraphDataValue> (id: T, v: number): LayoutGraphDataValueType[T] | null {
|
||||
if (this._vertices[v]._id === id) {
|
||||
return this._vertices[v]._object as LayoutGraphDataValueType[T];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
visitVertex (visitor: LayoutGraphDataVisitor, v: number): unknown {
|
||||
const vert = this._vertices[v];
|
||||
switch (vert._id) {
|
||||
case LayoutGraphDataValue.Group:
|
||||
return visitor.group(vert._object as GroupNodeData);
|
||||
case LayoutGraphDataValue.Shader:
|
||||
return visitor.shader(vert._object as ShaderNodeData);
|
||||
default:
|
||||
throw Error('polymorphic type not found');
|
||||
}
|
||||
}
|
||||
getGroup (v: number): GroupNodeData {
|
||||
if (this._vertices[v]._id === LayoutGraphDataValue.Group) {
|
||||
return this._vertices[v]._object as GroupNodeData;
|
||||
} else {
|
||||
throw Error('value id not match');
|
||||
}
|
||||
}
|
||||
getShader (v: number): ShaderNodeData {
|
||||
if (this._vertices[v]._id === LayoutGraphDataValue.Shader) {
|
||||
return this._vertices[v]._object as ShaderNodeData;
|
||||
} else {
|
||||
throw Error('value id not match');
|
||||
}
|
||||
}
|
||||
tryGetGroup (v: number): GroupNodeData | null {
|
||||
if (this._vertices[v]._id === LayoutGraphDataValue.Group) {
|
||||
return this._vertices[v]._object as GroupNodeData;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
tryGetShader (v: number): ShaderNodeData | null {
|
||||
if (this._vertices[v]._id === LayoutGraphDataValue.Shader) {
|
||||
return this._vertices[v]._object as ShaderNodeData;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// ReferenceGraph
|
||||
// type reference_descriptor = impl.ED;
|
||||
// type child_iterator = impl.OutEI;
|
||||
// type parent_iterator = impl.InEI;
|
||||
reference (u: number, v: number): boolean {
|
||||
for (const oe of this._vertices[u]._outEdges) {
|
||||
if (v === oe.target as number) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
parent (e: impl.ED): number {
|
||||
return e.source as number;
|
||||
}
|
||||
child (e: impl.ED): number {
|
||||
return e.target as number;
|
||||
}
|
||||
parents (v: number): impl.InEI {
|
||||
return new impl.InEI(this._vertices[v]._inEdges.values(), v);
|
||||
}
|
||||
children (v: number): impl.OutEI {
|
||||
return new impl.OutEI(this._vertices[v]._outEdges.values(), v);
|
||||
}
|
||||
numParents (v: number): number {
|
||||
return this._vertices[v]._inEdges.length;
|
||||
}
|
||||
numChildren (v: number): number {
|
||||
return this._vertices[v]._outEdges.length;
|
||||
}
|
||||
getParent (v: number): number {
|
||||
if (v === 0xFFFFFFFF) {
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
const list = this._vertices[v]._inEdges;
|
||||
if (list.length === 0) {
|
||||
return 0xFFFFFFFF;
|
||||
} else {
|
||||
return list[0].target as number;
|
||||
}
|
||||
}
|
||||
isAncestor (ancestor: number, descendent: number): boolean {
|
||||
const pseudo = 0xFFFFFFFF;
|
||||
if (ancestor === descendent) {
|
||||
// when ancestor === descendent, is_ancestor is defined as false
|
||||
return false;
|
||||
}
|
||||
if (ancestor === pseudo) {
|
||||
// special case: pseudo root is always ancestor
|
||||
return true;
|
||||
}
|
||||
if (descendent === pseudo) {
|
||||
// special case: pseudo root is never descendent
|
||||
return false;
|
||||
}
|
||||
for (let parent = this.getParent(descendent); parent !== pseudo;) {
|
||||
if (ancestor === parent) {
|
||||
return true;
|
||||
}
|
||||
parent = this.getParent(parent);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// MutableReferenceGraph
|
||||
addReference (u: number, v: number): impl.ED | null {
|
||||
return this.addEdge(u, v);
|
||||
}
|
||||
removeReference (e: impl.ED): void {
|
||||
return this.removeEdge(e);
|
||||
}
|
||||
removeReferences (u: number, v: number): void {
|
||||
return this.removeEdges(u, v);
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// ParentGraph
|
||||
locateChild (u: number, name: string): number {
|
||||
if (u === 0xFFFFFFFF) {
|
||||
for (const v of this._vertices.keys()) {
|
||||
const vert = this._vertices[v];
|
||||
if (vert._inEdges.length === 0 && this._names[v] === name) {
|
||||
return v;
|
||||
}
|
||||
}
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
for (const oe of this._vertices[u]._outEdges) {
|
||||
const child = oe.target as number;
|
||||
if (name === this._names[child]) {
|
||||
return child;
|
||||
}
|
||||
}
|
||||
return 0xFFFFFFFF;
|
||||
}
|
||||
//-----------------------------------------------------------------
|
||||
// AddressableGraph
|
||||
contains (absPath: string): boolean {
|
||||
return impl.findRelative(this, 0xFFFFFFFF, absPath) as number !== 0xFFFFFFFF;
|
||||
}
|
||||
locate (absPath: string): number {
|
||||
return impl.findRelative(this, 0xFFFFFFFF, absPath) as number;
|
||||
}
|
||||
locateRelative (path: string, start = 0xFFFFFFFF): number {
|
||||
return impl.findRelative(this, start, path) as number;
|
||||
}
|
||||
path (v: number): string {
|
||||
return impl.getPath(this, v);
|
||||
}
|
||||
|
||||
readonly components: string[] = ['Name', 'Update', 'Layout'];
|
||||
readonly _vertices: LayoutGraphDataVertex[] = [];
|
||||
readonly _names: string[] = [];
|
||||
readonly _updateFrequencies: UpdateFrequency[] = [];
|
||||
readonly _layouts: LayoutData[] = [];
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
/* eslint-disable max-len */
|
||||
import { EffectAsset } from '../../assets';
|
||||
import { Camera } from '../../renderer/scene/camera';
|
||||
import { Buffer, Format, Sampler, Texture } from '../../gfx/index';
|
||||
import { Color, Mat4, Quat, Vec2, Vec4 } from '../../math';
|
||||
import { PipelineSceneData } from '../pipeline-scene-data';
|
||||
import { QueueHint } from './types';
|
||||
import { ComputeView, CopyPair, MovePair, RasterView } from './render-graph';
|
||||
|
||||
export abstract class DescriptorHierarchy {
|
||||
public abstract addEffect(asset: EffectAsset): void;
|
||||
}
|
||||
|
||||
export abstract class Setter {
|
||||
public abstract setMat4(name: string, mat: Mat4): void;
|
||||
public abstract setQuaternion(name: string, quat: Quat): void;
|
||||
public abstract setColor(name: string, color: Color): void;
|
||||
public abstract setVec4(name: string, vec: Vec4): void;
|
||||
public abstract setVec2(name: string, vec: Vec2): void;
|
||||
public abstract setFloat(name: string, v: number): void;
|
||||
public abstract setBuffer(name: string, buffer: Buffer): void;
|
||||
public abstract setTexture(name: string, texture: Texture): void;
|
||||
public abstract setReadWriteBuffer(name: string, buffer: Buffer): void;
|
||||
public abstract setReadWriteTexture(name: string, texture: Texture): void;
|
||||
public abstract setSampler(name: string, sampler: Sampler): void;
|
||||
}
|
||||
|
||||
export abstract class RasterQueueBuilder {
|
||||
public abstract addSceneOfCamera(camera: Camera, name: string): void;
|
||||
public abstract addSceneOfCamera(camera: Camera): void;
|
||||
public abstract addScene(name: string): void;
|
||||
public abstract addFullscreenQuad(shader: string, name: string): void;
|
||||
public abstract addFullscreenQuad(shader: string): void;
|
||||
}
|
||||
|
||||
export abstract class RasterPassBuilder {
|
||||
public abstract addRasterView(name: string, view: RasterView): void;
|
||||
public abstract addComputeView(name: string, view: ComputeView): void;
|
||||
public abstract addQueue(hint: QueueHint, layoutName: string, name: string): RasterQueueBuilder;
|
||||
public abstract addQueue(hint: QueueHint, layoutName: string): RasterQueueBuilder;
|
||||
public abstract addQueue(hint: QueueHint): RasterQueueBuilder;
|
||||
public abstract addFullscreenQuad(shader: string, layoutName: string, name: string): void;
|
||||
public abstract addFullscreenQuad(shader: string, layoutName: string): void;
|
||||
public abstract addFullscreenQuad(shader: string): void;
|
||||
}
|
||||
|
||||
export abstract class ComputeQueueBuilder {
|
||||
public abstract addDispatch(shader: string, threadGroupCountX: number, threadGroupCountY: number, threadGroupCountZ: number, layoutName: string, name: string): void;
|
||||
public abstract addDispatch(shader: string, threadGroupCountX: number, threadGroupCountY: number, threadGroupCountZ: number, layoutName: string): void;
|
||||
public abstract addDispatch(shader: string, threadGroupCountX: number, threadGroupCountY: number, threadGroupCountZ: number): void;
|
||||
}
|
||||
|
||||
export abstract class ComputePassBuilder {
|
||||
public abstract addComputeView(name: string, view: ComputeView): void;
|
||||
public abstract addQueue(layoutName: string, name: string): ComputeQueueBuilder;
|
||||
public abstract addQueue(layoutName: string): ComputeQueueBuilder;
|
||||
public abstract addQueue(): ComputeQueueBuilder;
|
||||
public abstract addDispatch(shader: string, threadGroupCountX: number, threadGroupCountY: number, threadGroupCountZ: number, layoutName: string, name: string): void;
|
||||
public abstract addDispatch(shader: string, threadGroupCountX: number, threadGroupCountY: number, threadGroupCountZ: number, layoutName: string): void;
|
||||
public abstract addDispatch(shader: string, threadGroupCountX: number, threadGroupCountY: number, threadGroupCountZ: number): void;
|
||||
}
|
||||
|
||||
export abstract class MovePassBuilder {
|
||||
public abstract addPair(pair: MovePair): void;
|
||||
}
|
||||
|
||||
export abstract class CopyPassBuilder {
|
||||
public abstract addPair(pair: CopyPair): void;
|
||||
}
|
||||
|
||||
export abstract class Pipeline {
|
||||
public abstract addRenderTexture(name: string, format: Format, width: number, height: number): number;
|
||||
public abstract addRenderTarget(name: string, format: Format, width: number, height: number): number;
|
||||
public abstract addDepthStencil(name: string, format: Format, width: number, height: number): number;
|
||||
public abstract beginFrame(pplScene: PipelineSceneData): void;
|
||||
public abstract endFrame(): void;
|
||||
public abstract addRasterPass(width: number, height: number, layoutName: string, name: string): RasterPassBuilder;
|
||||
public abstract addRasterPass(width: number, height: number, layoutName: string): RasterPassBuilder;
|
||||
public abstract addComputePass(layoutName: string, name: string): ComputePassBuilder;
|
||||
public abstract addComputePass(layoutName: string): ComputePassBuilder;
|
||||
public abstract addMovePass(name: string): MovePassBuilder;
|
||||
public abstract addCopyPass(name: string): CopyPassBuilder;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,129 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
/* eslint-disable max-len */
|
||||
export const enum UpdateFrequency {
|
||||
PER_INSTANCE,
|
||||
PER_BATCH,
|
||||
PER_QUEUE,
|
||||
PER_PASS,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
export const enum ParameterType {
|
||||
Constants,
|
||||
CBV,
|
||||
UAV,
|
||||
SRV,
|
||||
Table,
|
||||
SSV,
|
||||
}
|
||||
|
||||
export const enum Boundedness {
|
||||
Bounded,
|
||||
Unbounded,
|
||||
}
|
||||
|
||||
export const enum ResourceType {
|
||||
Constants,
|
||||
Buffer,
|
||||
Texture1D,
|
||||
Texture1DArray,
|
||||
Texture2D,
|
||||
Texture2DArray,
|
||||
Texture2DMS,
|
||||
Texture2DMSArray,
|
||||
Texture3D,
|
||||
TextureCube,
|
||||
TextureCubeArray,
|
||||
RaytracingAccelerationStructure,
|
||||
SamplerState,
|
||||
SamplerComparisonState,
|
||||
}
|
||||
|
||||
export const enum ValueType {
|
||||
Typeless,
|
||||
Float4,
|
||||
Float3,
|
||||
Float2,
|
||||
Float1,
|
||||
Half4,
|
||||
Half3,
|
||||
Half2,
|
||||
Half1,
|
||||
Fixed4,
|
||||
Fixed3,
|
||||
Fixed2,
|
||||
Fixed1,
|
||||
Uint4,
|
||||
Uint3,
|
||||
Uint2,
|
||||
Uint1,
|
||||
Int4,
|
||||
Int3,
|
||||
Int2,
|
||||
Int1,
|
||||
Bool4,
|
||||
Bool3,
|
||||
Bool2,
|
||||
Bool1,
|
||||
}
|
||||
|
||||
export const enum ResourceResidency {
|
||||
Managed,
|
||||
Persistent,
|
||||
Backbuffer,
|
||||
Memoryless,
|
||||
}
|
||||
|
||||
export const enum QueueHint {
|
||||
NONE,
|
||||
RENDER_OPAQUE,
|
||||
RENDER_CUTOUT,
|
||||
RENDER_TRANSPARENT,
|
||||
COUNT,
|
||||
}
|
||||
|
||||
export const enum ResourceDimension {
|
||||
BUFFER,
|
||||
TEXTURE1D,
|
||||
TEXTURE2D,
|
||||
TEXTURE3D,
|
||||
}
|
||||
|
||||
export class SampleDesc {
|
||||
count = 1;
|
||||
quality = 0;
|
||||
}
|
||||
|
||||
export const enum NodeType {
|
||||
INTERNAL,
|
||||
LEAF,
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
import { EffectAsset } from '../../assets';
|
||||
import { DescriptorHierarchy } from './pipeline';
|
||||
|
||||
export class WebDescriptorHierarchy extends DescriptorHierarchy {
|
||||
constructor () {
|
||||
super();
|
||||
}
|
||||
public addEffect (asset: EffectAsset): void {
|
||||
const sz = asset.shaders.length;
|
||||
for (let i = 0; i !== sz; ++i) {
|
||||
const shader = asset.shaders[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,386 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/* eslint-disable max-len */
|
||||
import { Camera } from '../../renderer/scene/camera';
|
||||
import { Buffer, Format, Sampler, Texture } from '../../gfx/index';
|
||||
import { Color, Mat4, Quat, Vec2, Vec4 } from '../../math';
|
||||
import { QueueHint, ResourceDimension, ResourceResidency } from './types';
|
||||
import { Blit, ComputePass, ComputeView, CopyPair, CopyPass, Dispatch, MovePair, MovePass, RasterPass, RasterView, RenderData, RenderGraph, RenderGraphValue, RenderQueue, ResourceDesc, ResourceFlags, ResourceGraph, ResourceTraits, SceneData } from './render-graph';
|
||||
import { ComputePassBuilder, ComputeQueueBuilder, CopyPassBuilder, MovePassBuilder, Pipeline, RasterPassBuilder, RasterQueueBuilder, Setter } from './pipeline';
|
||||
import { PipelineSceneData } from '../pipeline-scene-data';
|
||||
import { RenderScene } from '../../renderer/scene';
|
||||
import { legacyCC } from '../../global-exports';
|
||||
import { LayoutGraphData } from './layout-graph';
|
||||
|
||||
export class WebSetter extends Setter {
|
||||
constructor (data: RenderData) {
|
||||
super();
|
||||
this._data = data;
|
||||
}
|
||||
public setMat4 (name: string, mat: Mat4): void {}
|
||||
public setQuaternion (name: string, quat: Quat): void {}
|
||||
public setColor (name: string, color: Color): void {}
|
||||
public setVec4 (name: string, vec: Vec4): void {}
|
||||
public setVec2 (name: string, vec: Vec2): void {}
|
||||
public setFloat (name: string, v: number): void {}
|
||||
public setBuffer (name: string, buffer: Buffer): void {}
|
||||
public setTexture (name: string, texture: Texture): void {}
|
||||
public setReadWriteBuffer (name: string, buffer: Buffer): void {}
|
||||
public setReadWriteTexture (name: string, texture: Texture): void {}
|
||||
public setSampler (name: string, sampler: Sampler): void {}
|
||||
|
||||
// protected
|
||||
private readonly _data: RenderData;
|
||||
}
|
||||
|
||||
function setCameraValues (setter: Setter,
|
||||
camera: Readonly<Camera>, cfg: Readonly<PipelineSceneData>,
|
||||
scene: Readonly<RenderScene>) {
|
||||
setter.setMat4('cc_matView', camera.matView);
|
||||
setter.setMat4('cc_matViewInv', camera.node.worldMatrix);
|
||||
setter.setMat4('cc_matProj', camera.matProj);
|
||||
setter.setMat4('cc_matProjInv', camera.matProjInv);
|
||||
setter.setMat4('cc_matViewProj', camera.matViewProj);
|
||||
setter.setMat4('cc_matViewProjInv', camera.matViewProjInv);
|
||||
setter.setVec4('cc_cameraPos', new Vec4(camera.position.x, camera.position.y, camera.position.z, 0.0));
|
||||
setter.setVec4('cc_screenScale', new Vec4(cfg.shadingScale, cfg.shadingScale, 1.0 / cfg.shadingScale, 1.0 / cfg.shadingScale));
|
||||
setter.setVec4('cc_exposure', new Vec4(camera.exposure, 1.0 / camera.exposure, cfg.isHDR ? 1.0 : 0.0, 0.0));
|
||||
|
||||
const mainLight = scene.mainLight;
|
||||
if (mainLight) {
|
||||
setter.setVec4('cc_mainLitDir', new Vec4(mainLight.direction.x, mainLight.direction.y, mainLight.direction.z, 0.0));
|
||||
let r = mainLight.color.x;
|
||||
let g = mainLight.color.y;
|
||||
let b = mainLight.color.z;
|
||||
if (mainLight.useColorTemperature) {
|
||||
r *= mainLight.colorTemperatureRGB.x;
|
||||
g *= mainLight.colorTemperatureRGB.y;
|
||||
b *= mainLight.colorTemperatureRGB.z;
|
||||
}
|
||||
let w = mainLight.illuminance;
|
||||
if (cfg.isHDR) {
|
||||
w *= camera.exposure;
|
||||
}
|
||||
setter.setVec4('cc_mainLitColor', new Vec4(r, g, b, w));
|
||||
} else {
|
||||
setter.setVec4('cc_mainLitDir', new Vec4(0, 0, 1, 0));
|
||||
setter.setVec4('cc_mainLitColor', new Vec4(0, 0, 0, 0));
|
||||
}
|
||||
|
||||
const ambient = cfg.ambient;
|
||||
const skyColor = ambient.skyColor;
|
||||
if (cfg.isHDR) {
|
||||
skyColor.w = ambient.skyIllum * camera.exposure;
|
||||
} else {
|
||||
skyColor.w = ambient.skyIllum;
|
||||
}
|
||||
setter.setVec4('cc_ambientSky', new Vec4(skyColor.x, skyColor.y, skyColor.z, skyColor.w));
|
||||
setter.setVec4('cc_ambientGround', new Vec4(ambient.groundAlbedo.x, ambient.groundAlbedo.y, ambient.groundAlbedo.z, ambient.groundAlbedo.w));
|
||||
|
||||
const fog = cfg.fog;
|
||||
const colorTempRGB = fog.colorArray;
|
||||
setter.setVec4('cc_fogColor', new Vec4(colorTempRGB.x, colorTempRGB.y, colorTempRGB.z, colorTempRGB.w));
|
||||
setter.setVec4('cc_fogBase', new Vec4(fog.fogStart, fog.fogEnd, fog.fogDensity, 0.0));
|
||||
setter.setVec4('cc_fogAdd', new Vec4(fog.fogTop, fog.fogRange, fog.fogAtten, 0.0));
|
||||
setter.setVec4('cc_nearFar', new Vec4(camera.nearClip, camera.farClip, 0.0, 0.0));
|
||||
setter.setVec4('cc_viewPort', new Vec4(camera.viewport.x, camera.viewport.y, camera.viewport.z, camera.viewport.w));
|
||||
}
|
||||
|
||||
export class WebRasterQueueBuilder extends WebSetter implements RasterQueueBuilder {
|
||||
constructor (data: RenderData, renderGraph: RenderGraph, vertID: number, queue: RenderQueue, pipeline: PipelineSceneData) {
|
||||
super(data);
|
||||
this._renderGraph = renderGraph;
|
||||
this._vertID = vertID;
|
||||
this._queue = queue;
|
||||
this._pipeline = pipeline;
|
||||
}
|
||||
addSceneOfCamera (camera: Camera, name = 'Camera'): void {
|
||||
const sceneData = new SceneData(name);
|
||||
sceneData.camera = camera;
|
||||
this._renderGraph.addVertex<RenderGraphValue.Scene>(
|
||||
RenderGraphValue.Scene, sceneData, name, '', new RenderData(), this._vertID,
|
||||
);
|
||||
setCameraValues(this, camera, this._pipeline,
|
||||
camera.scene ? camera.scene : legacyCC.director.getScene().renderScene);
|
||||
}
|
||||
addScene (sceneName: string): void {
|
||||
const sceneData = new SceneData(sceneName);
|
||||
this._renderGraph.addVertex<RenderGraphValue.Scene>(
|
||||
RenderGraphValue.Scene, sceneData, sceneName, '', new RenderData(), this._vertID,
|
||||
);
|
||||
}
|
||||
addFullscreenQuad (shader: string, layoutName = '', name = 'Quad'): void {
|
||||
this._renderGraph.addVertex<RenderGraphValue.Blit>(
|
||||
RenderGraphValue.Blit, new Blit(shader), name, '', new RenderData(), this._vertID,
|
||||
);
|
||||
}
|
||||
private readonly _renderGraph: RenderGraph;
|
||||
private readonly _vertID: number;
|
||||
private readonly _queue: RenderQueue;
|
||||
private readonly _pipeline: PipelineSceneData;
|
||||
}
|
||||
|
||||
export class WebRasterPassBuilder extends WebSetter implements RasterPassBuilder {
|
||||
constructor (data: RenderData, renderGraph: RenderGraph, vertID: number, pass: RasterPass, pipeline: PipelineSceneData) {
|
||||
super(data);
|
||||
this._renderGraph = renderGraph;
|
||||
this._vertID = vertID;
|
||||
this._pass = pass;
|
||||
this._pipeline = pipeline;
|
||||
}
|
||||
addRasterView (name: string, view: RasterView) {
|
||||
this._pass.rasterViews.set(name, view);
|
||||
}
|
||||
addComputeView (name: string, view: ComputeView) {
|
||||
if (this._pass.computeViews.has(name)) {
|
||||
this._pass.computeViews.get(name)?.push(view);
|
||||
} else {
|
||||
this._pass.computeViews.set(name, [view]);
|
||||
}
|
||||
}
|
||||
addQueue (hint: QueueHint = QueueHint.RENDER_OPAQUE, layoutName = '', name = 'Queue') {
|
||||
if (layoutName === '') {
|
||||
switch (hint) {
|
||||
case QueueHint.RENDER_OPAQUE:
|
||||
layoutName = 'Opaque';
|
||||
break;
|
||||
case QueueHint.RENDER_CUTOUT:
|
||||
layoutName = 'Cutout';
|
||||
break;
|
||||
case QueueHint.RENDER_TRANSPARENT:
|
||||
layoutName = 'Transparent';
|
||||
break;
|
||||
default:
|
||||
throw Error('cannot infer layoutName from QueueHint');
|
||||
}
|
||||
}
|
||||
const queue = new RenderQueue(hint);
|
||||
const data = new RenderData();
|
||||
const queueID = this._renderGraph.addVertex<RenderGraphValue.Queue>(
|
||||
RenderGraphValue.Queue, queue, name, layoutName, data, this._vertID,
|
||||
);
|
||||
return new WebRasterQueueBuilder(data, this._renderGraph, queueID, queue, this._pipeline);
|
||||
}
|
||||
addFullscreenQuad (shader: string, layoutName = '', name = 'Quad') {
|
||||
this._renderGraph.addVertex<RenderGraphValue.Blit>(
|
||||
RenderGraphValue.Blit,
|
||||
new Blit(shader),
|
||||
name, layoutName, new RenderData(), this._vertID,
|
||||
);
|
||||
}
|
||||
private readonly _renderGraph: RenderGraph;
|
||||
private readonly _vertID: number;
|
||||
private readonly _pass: RasterPass;
|
||||
private readonly _pipeline: PipelineSceneData;
|
||||
}
|
||||
|
||||
export class WebComputeQueueBuilder extends WebSetter implements ComputeQueueBuilder {
|
||||
constructor (data: RenderData, renderGraph: RenderGraph, vertID: number, queue: RenderQueue, pipeline: PipelineSceneData) {
|
||||
super(data);
|
||||
this._renderGraph = renderGraph;
|
||||
this._vertID = vertID;
|
||||
this._queue = queue;
|
||||
this._pipeline = pipeline;
|
||||
}
|
||||
addDispatch (shader: string,
|
||||
threadGroupCountX: number,
|
||||
threadGroupCountY: number,
|
||||
threadGroupCountZ: number,
|
||||
layoutName = '',
|
||||
name = 'Dispatch') {
|
||||
this._renderGraph.addVertex<RenderGraphValue.Dispatch>(
|
||||
RenderGraphValue.Dispatch,
|
||||
new Dispatch(shader, threadGroupCountX, threadGroupCountY, threadGroupCountZ),
|
||||
name, layoutName, new RenderData(), this._vertID,
|
||||
);
|
||||
}
|
||||
private readonly _renderGraph: RenderGraph;
|
||||
private readonly _vertID: number;
|
||||
private readonly _queue: RenderQueue;
|
||||
private readonly _pipeline: PipelineSceneData;
|
||||
}
|
||||
|
||||
export class WebComputePassBuilder extends WebSetter implements ComputePassBuilder {
|
||||
constructor (data: RenderData, renderGraph: RenderGraph, vertID: number, pass: ComputePass, pipeline: PipelineSceneData) {
|
||||
super(data);
|
||||
this._renderGraph = renderGraph;
|
||||
this._vertID = vertID;
|
||||
this._pass = pass;
|
||||
this._pipeline = pipeline;
|
||||
}
|
||||
addComputeView (name: string, view: ComputeView) {
|
||||
if (this._pass.computeViews.has(name)) {
|
||||
this._pass.computeViews.get(name)?.push(view);
|
||||
} else {
|
||||
this._pass.computeViews.set(name, [view]);
|
||||
}
|
||||
}
|
||||
addQueue (layoutName = '', name = 'Queue') {
|
||||
const queue = new RenderQueue();
|
||||
const data = new RenderData();
|
||||
const queueID = this._renderGraph.addVertex<RenderGraphValue.Queue>(
|
||||
RenderGraphValue.Queue, queue, name, layoutName, data, this._vertID,
|
||||
);
|
||||
return new WebComputeQueueBuilder(data, this._renderGraph, queueID, queue, this._pipeline);
|
||||
}
|
||||
addDispatch (shader: string,
|
||||
threadGroupCountX: number,
|
||||
threadGroupCountY: number,
|
||||
threadGroupCountZ: number,
|
||||
layoutName = '',
|
||||
name = 'Dispatch') {
|
||||
this._renderGraph.addVertex<RenderGraphValue.Dispatch>(
|
||||
RenderGraphValue.Dispatch,
|
||||
new Dispatch(shader, threadGroupCountX, threadGroupCountY, threadGroupCountZ),
|
||||
name, layoutName, new RenderData(), this._vertID,
|
||||
);
|
||||
}
|
||||
private readonly _renderGraph: RenderGraph;
|
||||
private readonly _vertID: number;
|
||||
private readonly _pass: ComputePass;
|
||||
private readonly _pipeline: PipelineSceneData;
|
||||
}
|
||||
|
||||
export class WebMovePassBuilder extends MovePassBuilder {
|
||||
constructor (renderGraph: RenderGraph, vertID: number, pass: MovePass) {
|
||||
super();
|
||||
this._renderGraph = renderGraph;
|
||||
this._vertID = vertID;
|
||||
this._pass = pass;
|
||||
}
|
||||
addPair (pair: MovePair) {
|
||||
this._pass.movePairs.push(pair);
|
||||
}
|
||||
private readonly _renderGraph: RenderGraph;
|
||||
private readonly _vertID: number;
|
||||
private readonly _pass: MovePass;
|
||||
}
|
||||
|
||||
export class WebCopyPassBuilder extends CopyPassBuilder {
|
||||
constructor (renderGraph: RenderGraph, vertID: number, pass: CopyPass) {
|
||||
super();
|
||||
this._renderGraph = renderGraph;
|
||||
this._vertID = vertID;
|
||||
this._pass = pass;
|
||||
}
|
||||
addPair (pair: CopyPair) {
|
||||
this._pass.copyPairs.push(pair);
|
||||
}
|
||||
private readonly _renderGraph: RenderGraph;
|
||||
private readonly _vertID: number;
|
||||
private readonly _pass: CopyPass;
|
||||
}
|
||||
|
||||
export class WebPipeline extends Pipeline {
|
||||
addRenderTexture (name: string, format: Format, width: number, height: number) {
|
||||
const desc = new ResourceDesc();
|
||||
desc.dimension = ResourceDimension.TEXTURE2D;
|
||||
desc.width = width;
|
||||
desc.height = height;
|
||||
desc.depthOrArraySize = 1;
|
||||
desc.mipLevels = 1;
|
||||
desc.format = format;
|
||||
desc.flags = ResourceFlags.ALLOW_RENDER_TARGET | ResourceFlags.ALLOW_UNORDERED_ACCESS;
|
||||
|
||||
return this._resourceGraph.addVertex(name, desc, new ResourceTraits(ResourceResidency.Persistent));
|
||||
}
|
||||
addRenderTarget (name: string, format: Format, width: number, height: number) {
|
||||
const desc = new ResourceDesc();
|
||||
desc.dimension = ResourceDimension.TEXTURE2D;
|
||||
desc.width = width;
|
||||
desc.height = height;
|
||||
desc.depthOrArraySize = 1;
|
||||
desc.mipLevels = 1;
|
||||
desc.format = format;
|
||||
desc.flags = ResourceFlags.ALLOW_RENDER_TARGET | ResourceFlags.ALLOW_UNORDERED_ACCESS;
|
||||
return this._resourceGraph.addVertex(name, desc, new ResourceTraits());
|
||||
}
|
||||
addDepthStencil (name: string, format: Format, width: number, height: number) {
|
||||
const desc = new ResourceDesc();
|
||||
desc.dimension = ResourceDimension.TEXTURE2D;
|
||||
desc.width = width;
|
||||
desc.height = height;
|
||||
desc.depthOrArraySize = 1;
|
||||
desc.mipLevels = 1;
|
||||
desc.format = format;
|
||||
desc.flags = ResourceFlags.ALLOW_DEPTH_STENCIL;
|
||||
return this._resourceGraph.addVertex(name, desc, new ResourceTraits());
|
||||
}
|
||||
beginFrame (pplScene: PipelineSceneData) {
|
||||
this._renderGraph = new RenderGraph();
|
||||
this._pipelineSceneData = pplScene;
|
||||
}
|
||||
endFrame () {
|
||||
this._renderGraph = null;
|
||||
this._pipelineSceneData = null;
|
||||
}
|
||||
addRasterPass (width: number, height: number, layoutName: string, name = 'Raster'): RasterPassBuilder {
|
||||
const pass = new RasterPass();
|
||||
const data = new RenderData();
|
||||
const vertID = this._renderGraph!.addVertex<RenderGraphValue.Raster>(
|
||||
RenderGraphValue.Raster, pass, name, layoutName, data,
|
||||
);
|
||||
const result = new WebRasterPassBuilder(data, this._renderGraph!, vertID, pass, this._pipelineSceneData!);
|
||||
this._updateRasterPassConstants(result, width, height);
|
||||
return result;
|
||||
}
|
||||
addComputePass (layoutName: string, name = 'Compute'): ComputePassBuilder {
|
||||
const pass = new ComputePass();
|
||||
const data = new RenderData();
|
||||
const vertID = this._renderGraph!.addVertex<RenderGraphValue.Compute>(
|
||||
RenderGraphValue.Compute, pass, name, layoutName, new RenderData(),
|
||||
);
|
||||
return new WebComputePassBuilder(data, this._renderGraph!, vertID, pass, this._pipelineSceneData!);
|
||||
}
|
||||
addMovePass (name = 'Move'): MovePassBuilder {
|
||||
const pass = new MovePass();
|
||||
const vertID = this._renderGraph!.addVertex<RenderGraphValue.Move>(RenderGraphValue.Move, pass, name, '', new RenderData());
|
||||
return new WebMovePassBuilder(this._renderGraph!, vertID, pass);
|
||||
}
|
||||
addCopyPass (name = 'Copy'): CopyPassBuilder {
|
||||
const pass = new CopyPass();
|
||||
const vertID = this._renderGraph!.addVertex<RenderGraphValue.Copy>(RenderGraphValue.Copy, pass, name, '', new RenderData());
|
||||
return new WebCopyPassBuilder(this._renderGraph!, vertID, pass);
|
||||
}
|
||||
get renderGraph () {
|
||||
return this._renderGraph;
|
||||
}
|
||||
protected _updateRasterPassConstants (pass: Setter, width: number, height: number) {
|
||||
const shadingWidth = width;
|
||||
const shadingHeight = height;
|
||||
const root = legacyCC.director.root;
|
||||
pass.setVec4('cc_time',
|
||||
new Vec4(root.cumulativeTime, root.frameTime, legacyCC.director.getTotalFrames(), 0.0));
|
||||
pass.setVec4('cc_screenSize',
|
||||
new Vec4(shadingWidth, shadingHeight, 1.0 / shadingWidth, 1.0 / shadingHeight));
|
||||
pass.setVec4('cc_nativeSize',
|
||||
new Vec4(shadingWidth, shadingHeight, 1.0 / shadingWidth, 1.0 / shadingHeight));
|
||||
}
|
||||
private readonly _layoutGraph: LayoutGraphData = new LayoutGraphData();
|
||||
private readonly _resourceGraph: ResourceGraph = new ResourceGraph();
|
||||
private _renderGraph: RenderGraph | null = null;
|
||||
private _pipelineSceneData: PipelineSceneData | null = null;
|
||||
}
|
||||
@@ -41,6 +41,12 @@ import { Texture2D } from '../../assets/texture-2d';
|
||||
import { Camera } from '../../renderer/scene';
|
||||
import { errorID } from '../../platform/debug';
|
||||
import { PipelineSceneData } from '../pipeline-scene-data';
|
||||
import { RenderGraph } from '../custom/render-graph';
|
||||
import { LayoutGraphData } from '../custom/layout-graph';
|
||||
import { DeviceResourceGraph } from '../custom/executor';
|
||||
import { Pipeline } from '../custom/pipeline';
|
||||
import { WebPipeline } from '../custom/web-pipeline';
|
||||
import { WebDescriptorHierarchy } from '../custom/web-descriptor-hierarchy';
|
||||
|
||||
const PIPELINE_TYPE = 0;
|
||||
|
||||
|
||||
@@ -1147,6 +1147,60 @@ cocos_source_files(
|
||||
cocos/renderer/pipeline/GeometryRenderer.cpp
|
||||
cocos/renderer/pipeline/helper/Utils.h
|
||||
cocos/renderer/pipeline/helper/Utils.cpp
|
||||
cocos/renderer/pipeline/custom/LayoutGraphFwd.h
|
||||
cocos/renderer/pipeline/custom/LayoutGraphGraphs.h
|
||||
cocos/renderer/pipeline/custom/LayoutGraphJsb.cpp
|
||||
cocos/renderer/pipeline/custom/LayoutGraphJsb.h
|
||||
cocos/renderer/pipeline/custom/LayoutGraphNames.h
|
||||
cocos/renderer/pipeline/custom/LayoutGraphReflection.cpp
|
||||
cocos/renderer/pipeline/custom/LayoutGraphReflection.h
|
||||
cocos/renderer/pipeline/custom/LayoutGraphTypes.cpp
|
||||
cocos/renderer/pipeline/custom/LayoutGraphTypes.h
|
||||
cocos/renderer/pipeline/custom/RenderCommonFwd.h
|
||||
cocos/renderer/pipeline/custom/RenderCommonJsb.cpp
|
||||
cocos/renderer/pipeline/custom/RenderCommonJsb.h
|
||||
cocos/renderer/pipeline/custom/RenderCommonNames.h
|
||||
cocos/renderer/pipeline/custom/RenderCommonReflection.cpp
|
||||
cocos/renderer/pipeline/custom/RenderCommonReflection.h
|
||||
cocos/renderer/pipeline/custom/RenderCommonTypes.cpp
|
||||
cocos/renderer/pipeline/custom/RenderCommonTypes.h
|
||||
cocos/renderer/pipeline/custom/RenderCompilerFwd.h
|
||||
cocos/renderer/pipeline/custom/RenderCompilerGraphs.h
|
||||
cocos/renderer/pipeline/custom/RenderCompilerImpl.cpp
|
||||
cocos/renderer/pipeline/custom/RenderCompilerNames.h
|
||||
cocos/renderer/pipeline/custom/RenderCompilerReflection.cpp
|
||||
cocos/renderer/pipeline/custom/RenderCompilerReflection.h
|
||||
cocos/renderer/pipeline/custom/RenderCompilerTypes.cpp
|
||||
cocos/renderer/pipeline/custom/RenderCompilerTypes.h
|
||||
cocos/renderer/pipeline/custom/RenderExampleFwd.h
|
||||
cocos/renderer/pipeline/custom/RenderExampleGraphs.h
|
||||
cocos/renderer/pipeline/custom/RenderExampleImpl.cpp
|
||||
cocos/renderer/pipeline/custom/RenderExampleNames.h
|
||||
cocos/renderer/pipeline/custom/RenderExampleReflection.cpp
|
||||
cocos/renderer/pipeline/custom/RenderExampleReflection.h
|
||||
cocos/renderer/pipeline/custom/RenderExampleTypes.cpp
|
||||
cocos/renderer/pipeline/custom/RenderExampleTypes.h
|
||||
cocos/renderer/pipeline/custom/RenderExecutorFwd.h
|
||||
cocos/renderer/pipeline/custom/RenderExecutorGraphs.h
|
||||
cocos/renderer/pipeline/custom/RenderExecutorJsb.cpp
|
||||
cocos/renderer/pipeline/custom/RenderExecutorJsb.h
|
||||
cocos/renderer/pipeline/custom/RenderExecutorNames.h
|
||||
cocos/renderer/pipeline/custom/RenderExecutorReflection.cpp
|
||||
cocos/renderer/pipeline/custom/RenderExecutorReflection.h
|
||||
cocos/renderer/pipeline/custom/RenderExecutorTypes.cpp
|
||||
cocos/renderer/pipeline/custom/RenderExecutorTypes.h
|
||||
cocos/renderer/pipeline/custom/RenderGraphFwd.h
|
||||
cocos/renderer/pipeline/custom/RenderGraphGraphs.h
|
||||
cocos/renderer/pipeline/custom/RenderGraphJsb.cpp
|
||||
cocos/renderer/pipeline/custom/RenderGraphJsb.h
|
||||
cocos/renderer/pipeline/custom/RenderGraphNames.h
|
||||
cocos/renderer/pipeline/custom/RenderGraphReflection.cpp
|
||||
cocos/renderer/pipeline/custom/RenderGraphReflection.h
|
||||
cocos/renderer/pipeline/custom/RenderGraphTypes.cpp
|
||||
cocos/renderer/pipeline/custom/RenderGraphTypes.h
|
||||
cocos/renderer/pipeline/custom/RenderInterfaceFwd.h
|
||||
cocos/renderer/pipeline/custom/RenderInterfaceTypes.cpp
|
||||
cocos/renderer/pipeline/custom/RenderInterfaceTypes.h
|
||||
)
|
||||
|
||||
##### terrain
|
||||
@@ -1894,6 +1948,8 @@ cocos_source_files(
|
||||
cocos/bindings/auto/jsb_assets_auto.h
|
||||
NO_WERROR NO_UBUILD cocos/bindings/auto/jsb_geometry_auto.cpp
|
||||
cocos/bindings/auto/jsb_geometry_auto.h
|
||||
NO_WERROR NO_UBUILD cocos/bindings/auto/jsb_render_auto.cpp
|
||||
cocos/bindings/auto/jsb_render_auto.h
|
||||
)
|
||||
|
||||
if(USE_AUDIO)
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,109 @@
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "base/Config.h"
|
||||
#include <type_traits>
|
||||
#include "cocos/bindings/jswrapper/SeApi.h"
|
||||
#include "cocos/bindings/manual/jsb_conversions.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderInterfaceTypes.h"
|
||||
|
||||
bool register_all_render(se::Object *obj); // NOLINT
|
||||
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::render::DescriptorHierarchy);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::render::Setter);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::render::RasterQueueBuilder);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::render::RasterPassBuilder);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::render::ComputeQueueBuilder);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::render::ComputePassBuilder);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::render::MovePassBuilder);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::render::CopyPassBuilder);
|
||||
JSB_REGISTER_OBJECT_TYPE(cc::render::Pipeline);
|
||||
|
||||
|
||||
extern se::Object *__jsb_cc_render_DescriptorHierarchy_proto; // NOLINT
|
||||
extern se::Class * __jsb_cc_render_DescriptorHierarchy_class; // NOLINT
|
||||
|
||||
bool js_register_cc_render_DescriptorHierarchy(se::Object *obj); // NOLINT
|
||||
|
||||
SE_DECLARE_FUNC(js_render_DescriptorHierarchy_addEffect);
|
||||
|
||||
extern se::Object *__jsb_cc_render_Setter_proto; // NOLINT
|
||||
extern se::Class * __jsb_cc_render_Setter_class; // NOLINT
|
||||
|
||||
bool js_register_cc_render_Setter(se::Object *obj); // NOLINT
|
||||
|
||||
SE_DECLARE_FUNC(js_render_Setter_setBuffer);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setColor);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setFloat);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setMat4);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setQuaternion);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setReadWriteBuffer);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setReadWriteTexture);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setSampler);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setTexture);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setVec2);
|
||||
SE_DECLARE_FUNC(js_render_Setter_setVec4);
|
||||
|
||||
extern se::Object *__jsb_cc_render_RasterQueueBuilder_proto; // NOLINT
|
||||
extern se::Class * __jsb_cc_render_RasterQueueBuilder_class; // NOLINT
|
||||
|
||||
bool js_register_cc_render_RasterQueueBuilder(se::Object *obj); // NOLINT
|
||||
|
||||
SE_DECLARE_FUNC(js_render_RasterQueueBuilder_addFullscreenQuad);
|
||||
SE_DECLARE_FUNC(js_render_RasterQueueBuilder_addScene);
|
||||
SE_DECLARE_FUNC(js_render_RasterQueueBuilder_addSceneOfCamera);
|
||||
|
||||
extern se::Object *__jsb_cc_render_RasterPassBuilder_proto; // NOLINT
|
||||
extern se::Class * __jsb_cc_render_RasterPassBuilder_class; // NOLINT
|
||||
|
||||
bool js_register_cc_render_RasterPassBuilder(se::Object *obj); // NOLINT
|
||||
|
||||
SE_DECLARE_FUNC(js_render_RasterPassBuilder_addComputeView);
|
||||
SE_DECLARE_FUNC(js_render_RasterPassBuilder_addFullscreenQuad);
|
||||
SE_DECLARE_FUNC(js_render_RasterPassBuilder_addQueue);
|
||||
SE_DECLARE_FUNC(js_render_RasterPassBuilder_addRasterView);
|
||||
|
||||
extern se::Object *__jsb_cc_render_ComputeQueueBuilder_proto; // NOLINT
|
||||
extern se::Class * __jsb_cc_render_ComputeQueueBuilder_class; // NOLINT
|
||||
|
||||
bool js_register_cc_render_ComputeQueueBuilder(se::Object *obj); // NOLINT
|
||||
|
||||
SE_DECLARE_FUNC(js_render_ComputeQueueBuilder_addDispatch);
|
||||
|
||||
extern se::Object *__jsb_cc_render_ComputePassBuilder_proto; // NOLINT
|
||||
extern se::Class * __jsb_cc_render_ComputePassBuilder_class; // NOLINT
|
||||
|
||||
bool js_register_cc_render_ComputePassBuilder(se::Object *obj); // NOLINT
|
||||
|
||||
SE_DECLARE_FUNC(js_render_ComputePassBuilder_addComputeView);
|
||||
SE_DECLARE_FUNC(js_render_ComputePassBuilder_addDispatch);
|
||||
SE_DECLARE_FUNC(js_render_ComputePassBuilder_addQueue);
|
||||
|
||||
extern se::Object *__jsb_cc_render_MovePassBuilder_proto; // NOLINT
|
||||
extern se::Class * __jsb_cc_render_MovePassBuilder_class; // NOLINT
|
||||
|
||||
bool js_register_cc_render_MovePassBuilder(se::Object *obj); // NOLINT
|
||||
|
||||
SE_DECLARE_FUNC(js_render_MovePassBuilder_addPair);
|
||||
|
||||
extern se::Object *__jsb_cc_render_CopyPassBuilder_proto; // NOLINT
|
||||
extern se::Class * __jsb_cc_render_CopyPassBuilder_class; // NOLINT
|
||||
|
||||
bool js_register_cc_render_CopyPassBuilder(se::Object *obj); // NOLINT
|
||||
|
||||
SE_DECLARE_FUNC(js_render_CopyPassBuilder_addPair);
|
||||
|
||||
extern se::Object *__jsb_cc_render_Pipeline_proto; // NOLINT
|
||||
extern se::Class * __jsb_cc_render_Pipeline_class; // NOLINT
|
||||
|
||||
bool js_register_cc_render_Pipeline(se::Object *obj); // NOLINT
|
||||
|
||||
SE_DECLARE_FUNC(js_render_Pipeline_addComputePass);
|
||||
SE_DECLARE_FUNC(js_render_Pipeline_addCopyPass);
|
||||
SE_DECLARE_FUNC(js_render_Pipeline_addDepthStencil);
|
||||
SE_DECLARE_FUNC(js_render_Pipeline_addMovePass);
|
||||
SE_DECLARE_FUNC(js_render_Pipeline_addRasterPass);
|
||||
SE_DECLARE_FUNC(js_render_Pipeline_addRenderTarget);
|
||||
SE_DECLARE_FUNC(js_render_Pipeline_addRenderTexture);
|
||||
SE_DECLARE_FUNC(js_render_Pipeline_beginFrame);
|
||||
SE_DECLARE_FUNC(js_render_Pipeline_endFrame);
|
||||
// clang-format on
|
||||
@@ -0,0 +1,679 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <cocos/renderer/pipeline/custom/GraphTypes.h>
|
||||
#include <cocos/renderer/pipeline/custom/GslUtils.h>
|
||||
#include <boost/container/pmr/vector.hpp>
|
||||
#include <boost/graph/adjacency_iterator.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include <functional>
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
namespace impl {
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// PropertyMap
|
||||
//--------------------------------------------------------------------
|
||||
template <class Category, class Graph, class Value, class Reference>
|
||||
struct VectorVertexBundlePropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, VectorVertexBundlePropertyMap<Category, Graph, Value, Reference>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::vertex_descriptor;
|
||||
using category = Category;
|
||||
|
||||
VectorVertexBundlePropertyMap(Graph &g) noexcept // NOLINT(google-explicit-constructor)
|
||||
: graph(&g) {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
return graph->mVertices[v].property;
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
Graph *graph{};
|
||||
};
|
||||
|
||||
template <class Category, class Graph, class Value, class Reference>
|
||||
struct PointerVertexBundlePropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, PointerVertexBundlePropertyMap<Category, Graph, Value, Reference>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::vertex_descriptor;
|
||||
using category = Category;
|
||||
|
||||
PointerVertexBundlePropertyMap(Graph &g) noexcept // NOLINT(google-explicit-constructor)
|
||||
: graph(&g) {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
auto *sv = static_cast<typename Graph::vertex_type *>(v);
|
||||
return sv->property;
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
Graph *graph{};
|
||||
};
|
||||
|
||||
template <class Category, class Graph, class Value, class Reference, class MemberPointer>
|
||||
struct VectorVertexBundleMemberPropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, VectorVertexBundleMemberPropertyMap<Category, Graph, Value, Reference, MemberPointer>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::vertex_descriptor;
|
||||
using category = Category;
|
||||
|
||||
VectorVertexBundleMemberPropertyMap(Graph &g, MemberPointer ptr) noexcept
|
||||
: graph(&g), memberPointer(ptr) {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
return graph->mVertices[v].property.*memberPointer;
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
Graph *graph{};
|
||||
MemberPointer memberPointer{};
|
||||
};
|
||||
|
||||
template <class Category, class Graph, class Value, class Reference, class MemberPointer>
|
||||
struct PointerVertexBundleMemberPropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, PointerVertexBundleMemberPropertyMap<Category, Graph, Value, Reference, MemberPointer>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::vertex_descriptor;
|
||||
using category = Category;
|
||||
|
||||
PointerVertexBundleMemberPropertyMap(Graph &g, MemberPointer ptr) noexcept
|
||||
: graph(&g), memberPointer(ptr) {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
auto *sv = static_cast<typename Graph::vertex_type *>(v);
|
||||
return sv->property.*memberPointer;
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
Graph *graph{};
|
||||
MemberPointer memberPointer{};
|
||||
};
|
||||
|
||||
template <class Category, class Graph, class Container, class Value, class Reference>
|
||||
struct VectorVertexComponentPropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, VectorVertexComponentPropertyMap<Category, Graph, Container, Value, Reference>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::vertex_descriptor;
|
||||
using category = Category;
|
||||
|
||||
VectorVertexComponentPropertyMap(Container &c) noexcept // NOLINT(google-explicit-constructor)
|
||||
: container(&c) {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
return (*container)[v];
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
Container *container{};
|
||||
};
|
||||
|
||||
template <class Category, class Graph, class Container, class Value, class Reference, class MemberPointer>
|
||||
struct VectorVertexComponentMemberPropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, VectorVertexComponentMemberPropertyMap<Category, Graph, Container, Value, Reference, MemberPointer>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::vertex_descriptor;
|
||||
using category = Category;
|
||||
|
||||
VectorVertexComponentMemberPropertyMap(Container &c, MemberPointer ptr) noexcept
|
||||
: container(&c), memberPointer(ptr) {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
return (*container)[v].*memberPointer;
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
Container *container{};
|
||||
MemberPointer memberPointer{};
|
||||
};
|
||||
|
||||
template <class Category, class Graph, class ComponentPointer, class Value, class Reference>
|
||||
struct VectorVertexIteratorComponentPropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, VectorVertexIteratorComponentPropertyMap<Category, Graph, ComponentPointer, Value, Reference>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::vertex_descriptor;
|
||||
using category = Category;
|
||||
|
||||
VectorVertexIteratorComponentPropertyMap(Graph &g, ComponentPointer component) noexcept
|
||||
: graph(&g), componentPointer(component) {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
return *(graph->mVertices[v].*componentPointer);
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
Graph *graph{};
|
||||
ComponentPointer componentPointer{};
|
||||
};
|
||||
|
||||
template <class Category, class Graph, class ComponentPointer, class Value, class Reference, class MemberPointer>
|
||||
struct VectorVertexIteratorComponentMemberPropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, VectorVertexIteratorComponentMemberPropertyMap<Category, Graph, ComponentPointer, Value, Reference, MemberPointer>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::vertex_descriptor;
|
||||
using category = Category;
|
||||
|
||||
VectorVertexIteratorComponentMemberPropertyMap(Graph &g, ComponentPointer component, MemberPointer ptr) noexcept
|
||||
: graph(&g), componentPointer(component), memberPointer(ptr) {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
return (*(graph->mVertices[v].*componentPointer)).*memberPointer;
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
Graph *graph{};
|
||||
ComponentPointer componentPointer{};
|
||||
MemberPointer memberPointer{};
|
||||
};
|
||||
|
||||
template <class Category, class VertexDescriptor, class Container, class Value, class Reference>
|
||||
struct VectorPathPropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, VectorPathPropertyMap<Category, VertexDescriptor, Container, Value, Reference>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = VertexDescriptor;
|
||||
using category = Category;
|
||||
|
||||
VectorPathPropertyMap(Container &c) noexcept // NOLINT(google-explicit-constructor)
|
||||
: container(&c) {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
return (*container)[v].mPathIterator->first;
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
Container *container{};
|
||||
};
|
||||
|
||||
template <class Category, class Graph, class Value, class Reference>
|
||||
struct EdgeBundlePropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, EdgeBundlePropertyMap<Category, Graph, Value, Reference>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::edge_descriptor;
|
||||
using category = Category;
|
||||
|
||||
EdgeBundlePropertyMap(Graph &g) noexcept // NOLINT(google-explicit-constructor)
|
||||
: graph(&g) {}
|
||||
|
||||
inline reference operator[](const key_type &e) const noexcept {
|
||||
return *static_cast<typename Graph::edge_property_type *>(e.get_property());
|
||||
}
|
||||
inline reference operator()(const key_type &e) const noexcept {
|
||||
return operator[](e);
|
||||
}
|
||||
|
||||
Graph *graph{};
|
||||
};
|
||||
|
||||
template <class Category, class Graph, class Value, class Reference, class MemberPointer>
|
||||
struct EdgeBundleMemberPropertyMap
|
||||
: public boost::put_get_helper<
|
||||
Reference, EdgeBundleMemberPropertyMap<Category, Graph, Value, Reference, MemberPointer>> {
|
||||
using value_type = Value;
|
||||
using reference = Reference;
|
||||
using key_type = typename Graph::edge_descriptor;
|
||||
using category = Category;
|
||||
|
||||
EdgeBundleMemberPropertyMap(Graph &g, MemberPointer ptr) noexcept
|
||||
: graph(&g), memberPointer(ptr) {}
|
||||
|
||||
inline reference operator[](const key_type &e) const noexcept {
|
||||
auto &p = *static_cast<typename Graph::edge_property_type *>(e.get_property());
|
||||
return p.*memberPointer;
|
||||
}
|
||||
inline reference operator()(const key_type &e) const noexcept {
|
||||
return operator[](e);
|
||||
}
|
||||
|
||||
Graph *graph{};
|
||||
MemberPointer memberPointer{};
|
||||
};
|
||||
|
||||
template <class Sequence, class Predicate>
|
||||
void sequenceEraseIf(Sequence &c, Predicate &&p) noexcept {
|
||||
if (!c.empty()) {
|
||||
c.erase(std::remove_if(c.begin(), c.end(), p), c.end());
|
||||
}
|
||||
}
|
||||
|
||||
// notice: Predicate might be different from associative key
|
||||
// when Predicate is associative key, it is slower than erase [lower_bound, upper_bound)
|
||||
template <class AssociativeContainer, class Predicate>
|
||||
void associativeEraseIf(AssociativeContainer &c, Predicate &&p) noexcept {
|
||||
auto next = c.begin();
|
||||
for (auto i = next; next != c.end(); i = next) {
|
||||
++next;
|
||||
if (p(*i)) {
|
||||
c.erase(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// notice: Predicate might be different from associative key
|
||||
// when Predicate is associative key, it is slower than erase [lower_bound, upper_bound)
|
||||
template <class AssociativeContainer, class Predicate>
|
||||
void unstableAssociativeEraseIf(AssociativeContainer &c, Predicate &&p) noexcept {
|
||||
auto n = c.size();
|
||||
while (n--) {
|
||||
for (auto i = c.begin(); i != c.end(); ++i) {
|
||||
if (p(*i)) {
|
||||
c.erase(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class EdgeDescriptor, class IncidenceList>
|
||||
inline void removeIncidenceEdge(EdgeDescriptor e, IncidenceList &el) noexcept {
|
||||
e.expectsNoProperty();
|
||||
for (auto i = el.begin(); i != el.end(); ++i) {
|
||||
if ((*i).get_target() == e.target) {
|
||||
el.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class DirectedCategory, class VertexDescriptor, class IncidenceList, class EdgeProperty>
|
||||
inline void removeIncidenceEdge(
|
||||
EdgeDescriptorWithProperty<DirectedCategory, VertexDescriptor> e, IncidenceList &el) noexcept {
|
||||
for (auto i = el.begin(); i != el.end(); ++i) {
|
||||
if (static_cast<void *>(&(*i).get_property()) == e.get_property()) {
|
||||
el.erase(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class Graph, class IncidenceList, class VertexDescriptor>
|
||||
inline void removeDirectedAllEdgeProperties(Graph &g, IncidenceList &el, VertexDescriptor v) noexcept {
|
||||
auto i = el.begin();
|
||||
auto end = el.end();
|
||||
for (; i != end; ++i) {
|
||||
if ((*i).get_target() == v) {
|
||||
// NOTE: Wihtout this skip, this loop will double-delete
|
||||
// properties of loop edges. This solution is based on the
|
||||
// observation that the incidence edges of a vertex with a loop
|
||||
// are adjacent in the out edge list. This *may* actually hold
|
||||
// for multisets also.
|
||||
bool skip = (std::next(i) != end && i->get_iter() == std::next(i)->get_iter());
|
||||
g.edges.erase((*i).get_iter());
|
||||
if (skip) {
|
||||
++i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class IncidenceIterator, class IncidenceList, class Predicate>
|
||||
inline void sequenceRemoveIncidenceEdgeIf(IncidenceIterator first, IncidenceIterator last,
|
||||
IncidenceList &el, Predicate &&pred) noexcept {
|
||||
// remove_if
|
||||
while (first != last && !pred(*first)) {
|
||||
++first;
|
||||
}
|
||||
auto i = first;
|
||||
if (first != last) {
|
||||
for (++i; i != last; ++i) {
|
||||
if (!pred(*i)) {
|
||||
*first.base() = std::move(*i.base());
|
||||
++first;
|
||||
}
|
||||
}
|
||||
}
|
||||
el.erase(first.base(), el.end());
|
||||
}
|
||||
|
||||
template <class IncidenceIterator, class IncidenceList, class Predicate>
|
||||
inline void associativeRemoveIncidenceEdgeIf(IncidenceIterator first, IncidenceIterator last,
|
||||
IncidenceList &el, Predicate &&pred) noexcept {
|
||||
for (auto next = first; first != last; first = next) {
|
||||
++next;
|
||||
if (pred(*first)) {
|
||||
el.erase(first.base());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class Graph, class EdgeDescriptor, class EdgeProperty>
|
||||
inline void removeUndirectedEdge(Graph &g, EdgeDescriptor e, EdgeProperty &p) noexcept {
|
||||
auto &outEdgeList = g.getOutEdgeList(source(e, g));
|
||||
auto outEdgeIter = outEdgeList.begin();
|
||||
decltype((*outEdgeIter).get_iter()) edgeIterToErase;
|
||||
for (; outEdgeIter != outEdgeList.end(); ++outEdgeIter) {
|
||||
if (&(*outEdgeIter).get_property() == &p) {
|
||||
edgeIterToErase = (*outEdgeIter).get_iter();
|
||||
outEdgeList.erase(outEdgeIter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
auto &inEdgeList = g.getOutEdgeList(target(e, g));
|
||||
auto inEdgeIter = inEdgeList.begin();
|
||||
for (; inEdgeIter != inEdgeList.end(); ++inEdgeIter) {
|
||||
if (&(*inEdgeIter).get_property() == &p) {
|
||||
inEdgeList.erase(inEdgeIter);
|
||||
break;
|
||||
}
|
||||
}
|
||||
g.edges.erase(edgeIterToErase);
|
||||
}
|
||||
|
||||
template <class Graph, class IncidenceIterator, class IncidenceList, class Predicate>
|
||||
inline void sequenceRemoveUndirectedOutEdgeIf(Graph &g,
|
||||
IncidenceIterator first, IncidenceIterator last, IncidenceList &el,
|
||||
Predicate &&pred) noexcept {
|
||||
// remove_if
|
||||
while (first != last && !pred(*first)) {
|
||||
++first;
|
||||
}
|
||||
auto i = first;
|
||||
bool selfLoopRemoved = false;
|
||||
if (first != last) {
|
||||
for (; i != last; ++i) {
|
||||
if (selfLoopRemoved) {
|
||||
/* With self loops, the descriptor will show up
|
||||
* twice. The first time it will be removed, and now it
|
||||
* will be skipped.
|
||||
*/
|
||||
selfLoopRemoved = false;
|
||||
} else if (!pred(*i)) {
|
||||
*first.base() = std::move(*i.base());
|
||||
++first;
|
||||
} else {
|
||||
if (source(*i, g) == target(*i, g)) {
|
||||
selfLoopRemoved = true;
|
||||
} else {
|
||||
// Remove the edge from the target
|
||||
removeIncidenceEdge(*i, g.getOutEdgeList(target(*i, g)));
|
||||
}
|
||||
|
||||
// Erase the edge property
|
||||
g.edges.erase((*i.base()).get_iter());
|
||||
}
|
||||
}
|
||||
}
|
||||
el.erase(first.base(), el.end());
|
||||
}
|
||||
|
||||
template <class Graph, class IncidenceIterator, class IncidenceList, class Predicate>
|
||||
inline void associativeRemoveUndirectedOutEdgeIf(Graph &g,
|
||||
IncidenceIterator first, IncidenceIterator last, IncidenceList &el,
|
||||
Predicate &&pred) noexcept {
|
||||
for (auto next = first; first != last; first = next) {
|
||||
++next;
|
||||
if (pred(*first)) {
|
||||
if (source(*first, g) != target(*first, g)) {
|
||||
// Remove the edge from the target
|
||||
removeIncidenceEdge(*first, g.getOutEdgeList(target(*first, g)));
|
||||
}
|
||||
|
||||
// Erase the edge property
|
||||
g.edges.erase((*first.base()).get_iter());
|
||||
|
||||
// Erase the edge in the source
|
||||
el.erase(first.base());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// list/vector out_edge_list
|
||||
template <class IncidenceList, class VertexDescriptor>
|
||||
inline void reindexEdgeList(IncidenceList &el, VertexDescriptor u) {
|
||||
auto ei = el.begin();
|
||||
auto eEnd = el.end();
|
||||
for (; ei != eEnd; ++ei) {
|
||||
if ((*ei).get_target() > u) {
|
||||
--(*ei).get_target();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class Tag, class Container, class HandleDescriptor>
|
||||
inline void reindexVectorHandle(Container &container, HandleDescriptor u) {
|
||||
static_assert(std::is_arithmetic<HandleDescriptor>::value, "reindexVectorHandle");
|
||||
|
||||
using handle_type = ValueHandle<Tag, HandleDescriptor>;
|
||||
for (auto &vert : container) {
|
||||
if (boost::variant2::holds_alternative<handle_type>(vert.handle)) {
|
||||
auto &v = boost::variant2::get<handle_type>(vert.handle).value;
|
||||
if (v > u) {
|
||||
--v;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class Graph, class VertexDescriptor>
|
||||
inline void removeVectorVertex(Graph &g, VertexDescriptor u, boost::directed_tag /*tag*/) {
|
||||
g.vertices.erase(g.vertices.begin() + u);
|
||||
auto numV = num_vertices(g);
|
||||
if (u != numV) {
|
||||
for (VertexDescriptor v = 0; v < numV; ++v) {
|
||||
reindexEdgeList(g.getOutEdgeList(v), u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class Graph, class VertexDescriptor>
|
||||
inline void removeVectorVertex(Graph &g, VertexDescriptor u, boost::undirected_tag /*tag*/) {
|
||||
g.vertices.erase(g.vertices.begin() + u);
|
||||
VertexDescriptor numV = num_vertices(g);
|
||||
for (VertexDescriptor v = 0; v < numV; ++v) {
|
||||
reindexEdgeList(g.getOutEdgeList(v), u);
|
||||
}
|
||||
|
||||
auto ei = g.edges.begin();
|
||||
auto eiEnd = g.edges.end();
|
||||
for (; ei != eiEnd; ++ei) {
|
||||
if (ei->source > u) {
|
||||
--ei->source;
|
||||
}
|
||||
if (ei->target > u) {
|
||||
--ei->target;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class Graph, class VertexDescriptor>
|
||||
inline void removeVectorVertex(Graph &g, VertexDescriptor u, boost::bidirectional_tag /*tag*/) {
|
||||
g.vertices.erase(g.vertices.begin() + u);
|
||||
VertexDescriptor numV = num_vertices(g);
|
||||
VertexDescriptor v;
|
||||
if (u != numV) {
|
||||
for (v = 0; v < numV; ++v) {
|
||||
reindexEdgeList(g.getOutEdgeList(v), u);
|
||||
}
|
||||
|
||||
for (v = 0; v < numV; ++v) {
|
||||
reindexEdgeList(g.getInEdgeList(v), u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
VertexDescriptor numV = num_vertices(g);
|
||||
VertexDescriptor v;
|
||||
if (u != numV) {
|
||||
for (v = 0; v < numV; ++v) {
|
||||
reindexEdgeList(g.getOutEdgeList(v), u);
|
||||
}
|
||||
|
||||
for (v = 0; v < numV; ++v) {
|
||||
reindexEdgeList(g.getInEdgeList(v), u);
|
||||
}
|
||||
|
||||
auto ei = g.edges.begin();
|
||||
auto eiEnd = g.edges.end();
|
||||
for (; ei != eiEnd; ++ei) {
|
||||
if (ei->source > u) {
|
||||
--ei->source;
|
||||
}
|
||||
if (ei->target > u) {
|
||||
--ei->target;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <class Graph>
|
||||
inline void removeVectorOwner(Graph &g, typename Graph::vertex_descriptor u) {
|
||||
// might make children detached
|
||||
g.mObjects.erase(g.mObjects.begin() + u);
|
||||
auto numV = num_vertices(g);
|
||||
if (u != numV) {
|
||||
for (typename Graph::vertex_descriptor v = 0; v < numV; ++v) {
|
||||
reindexEdgeList(g.getChildrenList(v), u);
|
||||
}
|
||||
|
||||
for (typename Graph::vertex_descriptor v = 0; v < numV; ++v) {
|
||||
reindexEdgeList(g.getParentsList(v), u);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// AddressableGraph
|
||||
template <class AddressableGraph>
|
||||
inline std::ptrdiff_t pathLength(typename AddressableGraph::vertex_descriptor u, const AddressableGraph &g,
|
||||
typename AddressableGraph::vertex_descriptor parentID = AddressableGraph::null_vertex()) noexcept {
|
||||
if (u == parentID) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const auto &pmap = get(boost::vertex_name, g);
|
||||
|
||||
std::ptrdiff_t sz = 0;
|
||||
while (u != parentID) {
|
||||
sz += static_cast<std::ptrdiff_t>(get(pmap, u).size()) + 1;
|
||||
u = parent(u, g);
|
||||
}
|
||||
|
||||
return sz;
|
||||
}
|
||||
|
||||
template <class AddressableGraph, class CharT, class Allocator>
|
||||
inline void pathComposite(
|
||||
std::basic_string<CharT, std::char_traits<CharT>, Allocator> &str,
|
||||
std::ptrdiff_t &sz,
|
||||
typename AddressableGraph::vertex_descriptor u, const AddressableGraph &g,
|
||||
typename AddressableGraph::vertex_descriptor parentID = AddressableGraph::null_vertex()) noexcept {
|
||||
const auto &pmap = get(boost::vertex_name, g);
|
||||
|
||||
while (u != parentID) {
|
||||
CC_EXPECTS(sz <= static_cast<std::ptrdiff_t>(str.size()));
|
||||
|
||||
const auto &name = get(pmap, u);
|
||||
sz -= static_cast<std::ptrdiff_t>(name.size()) + 1;
|
||||
CC_ENSURES(sz >= 0);
|
||||
str[sz] = '/';
|
||||
std::copy(name.begin(), name.end(), str.begin() + sz + 1);
|
||||
|
||||
u = parent(u, g);
|
||||
}
|
||||
CC_ENSURES(sz == 0);
|
||||
}
|
||||
|
||||
template <class Key>
|
||||
struct ColorMap : public boost::put_get_helper<boost::default_color_type &, ColorMap<Key>> {
|
||||
using value_type = boost::default_color_type;
|
||||
using reference = boost::default_color_type &;
|
||||
using key_type = Key;
|
||||
using category = boost::lvalue_property_map_tag;
|
||||
|
||||
ColorMap(boost::container::pmr::vector<boost::default_color_type> &vec) noexcept // NOLINT(google-explicit-constructor)
|
||||
: container{&vec} {}
|
||||
|
||||
inline reference operator[](const key_type &v) const noexcept {
|
||||
return (*container)[v];
|
||||
}
|
||||
inline reference operator()(const key_type &v) const noexcept {
|
||||
return operator[](v);
|
||||
}
|
||||
|
||||
boost::container::pmr::vector<boost::default_color_type> *container{};
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
namespace std {
|
||||
|
||||
template <class DirectedCategory, class VertexDescriptor>
|
||||
struct hash<cc::render::impl::EdgeDescriptor<DirectedCategory, VertexDescriptor>> {
|
||||
size_t operator()(const cc::render::impl::EdgeDescriptor<DirectedCategory, VertexDescriptor> &e) const noexcept {
|
||||
return boost::hash_value(e.get_property());
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
@@ -0,0 +1,625 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <cocos/base/Variant.h>
|
||||
#include <cocos/renderer/pipeline/custom/Overload.h>
|
||||
#include <boost/container/pmr/polymorphic_allocator.hpp>
|
||||
#include <boost/iterator/iterator_adaptor.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <type_traits>
|
||||
|
||||
namespace boost {
|
||||
|
||||
struct use_default;
|
||||
|
||||
struct directed_tag;
|
||||
struct undirected_tag;
|
||||
struct bidirectional_tag;
|
||||
|
||||
struct no_property;
|
||||
|
||||
} // namespace boost
|
||||
|
||||
namespace cc {
|
||||
|
||||
template <class T>
|
||||
using PmrList = std::list<T, boost::container::pmr::polymorphic_allocator<T>>;
|
||||
|
||||
namespace render {
|
||||
|
||||
template <class... Ts>
|
||||
struct VertexOverloaded : Overloaded<Ts...> {
|
||||
VertexOverloaded(Ts... ts) // NOLINT
|
||||
: Overloaded<Ts...>(std::move(ts)...) {}
|
||||
template <class T>
|
||||
auto operator()(T* ptr) {
|
||||
return this->Overloaded<Ts...>::operator()(*ptr);
|
||||
}
|
||||
};
|
||||
|
||||
template <class GraphT, class... Ts>
|
||||
auto visitObject(typename GraphT::vertex_descriptor v, GraphT& g, Ts... args) {
|
||||
return cc::visit(VertexOverloaded<Ts...>{ std::move(args)... }, value(v, g));
|
||||
}
|
||||
|
||||
namespace impl {
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// EdgeDescriptor
|
||||
//--------------------------------------------------------------------
|
||||
template <class DirectedCategory, class VertexDescriptor>
|
||||
struct EdgeDescriptor {
|
||||
EdgeDescriptor() = default;
|
||||
EdgeDescriptor(VertexDescriptor s, VertexDescriptor t) noexcept // NOLINT
|
||||
: source(s), target(t) {}
|
||||
|
||||
void expectsNoProperty() const noexcept {
|
||||
// CC_EXPECTS(false);
|
||||
}
|
||||
VertexDescriptor source{static_cast<VertexDescriptor>(-1)};
|
||||
VertexDescriptor target{static_cast<VertexDescriptor>(-1)};
|
||||
};
|
||||
|
||||
template <class VertexDescriptor>
|
||||
inline bool operator==(
|
||||
const EdgeDescriptor<boost::directed_tag, VertexDescriptor> &lhs,
|
||||
const EdgeDescriptor<boost::directed_tag, VertexDescriptor> &rhs) noexcept {
|
||||
return lhs.source == rhs.source &&
|
||||
lhs.target == rhs.target;
|
||||
}
|
||||
|
||||
template <class VertexDescriptor>
|
||||
inline bool operator==(
|
||||
const EdgeDescriptor<boost::bidirectional_tag, VertexDescriptor> &lhs,
|
||||
const EdgeDescriptor<boost::bidirectional_tag, VertexDescriptor> &rhs) noexcept {
|
||||
return lhs.source == rhs.source &&
|
||||
lhs.target == rhs.target;
|
||||
}
|
||||
|
||||
template <class VertexDescriptor>
|
||||
inline bool operator!=(
|
||||
const EdgeDescriptor<boost::directed_tag, VertexDescriptor> &lhs,
|
||||
const EdgeDescriptor<boost::directed_tag, VertexDescriptor> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <class VertexDescriptor>
|
||||
inline bool operator!=(
|
||||
const EdgeDescriptor<boost::bidirectional_tag, VertexDescriptor> &lhs,
|
||||
const EdgeDescriptor<boost::bidirectional_tag, VertexDescriptor> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <class DirectedCategory, class VertexDescriptor>
|
||||
struct EdgeDescriptorWithProperty : EdgeDescriptor<DirectedCategory, VertexDescriptor> {
|
||||
using property_type = void;
|
||||
|
||||
EdgeDescriptorWithProperty() = default;
|
||||
EdgeDescriptorWithProperty(VertexDescriptor s, VertexDescriptor t, const property_type *p) noexcept
|
||||
: EdgeDescriptor<DirectedCategory, VertexDescriptor>(s, t), edgeProperty(const_cast<property_type *>(p)) {}
|
||||
|
||||
property_type *get_property() const noexcept { // NOLINT
|
||||
return edgeProperty;
|
||||
}
|
||||
|
||||
property_type *edgeProperty{};
|
||||
};
|
||||
|
||||
template <class DirectedCategory, class VertexDescriptor>
|
||||
inline bool operator==(
|
||||
const EdgeDescriptorWithProperty<DirectedCategory, VertexDescriptor> &lhs,
|
||||
const EdgeDescriptorWithProperty<DirectedCategory, VertexDescriptor> &rhs) noexcept {
|
||||
return lhs.edgeProperty == rhs.edgeProperty;
|
||||
}
|
||||
|
||||
template <class DirectedCategory, class VertexDescriptor>
|
||||
inline bool operator!=(
|
||||
const EdgeDescriptorWithProperty<DirectedCategory, VertexDescriptor> &lhs,
|
||||
const EdgeDescriptorWithProperty<DirectedCategory, VertexDescriptor> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <class DirectedCategory, class VertexDescriptor>
|
||||
inline bool operator<(
|
||||
const EdgeDescriptorWithProperty<DirectedCategory, VertexDescriptor> &lhs,
|
||||
const EdgeDescriptorWithProperty<DirectedCategory, VertexDescriptor> &rhs) noexcept {
|
||||
return lhs.edgeProperty < rhs.edgeProperty;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// StoredEdge
|
||||
//--------------------------------------------------------------------
|
||||
template <class VertexDescriptor>
|
||||
class StoredEdge {
|
||||
public:
|
||||
StoredEdge(VertexDescriptor target) noexcept // NOLINT(google-explicit-constructor)
|
||||
: target(target) {}
|
||||
const VertexDescriptor &get_target() const noexcept { // NOLINT
|
||||
return target;
|
||||
}
|
||||
VertexDescriptor &get_target() noexcept { // NOLINT
|
||||
return target;
|
||||
}
|
||||
// auto operator<=>(const StoredEdge&) const noexcept = default;
|
||||
|
||||
VertexDescriptor target;
|
||||
};
|
||||
|
||||
template <class VertexDescriptor>
|
||||
inline bool operator==(
|
||||
const StoredEdge<VertexDescriptor> &lhs,
|
||||
const StoredEdge<VertexDescriptor> &rhs) noexcept {
|
||||
return lhs.target == rhs.target;
|
||||
}
|
||||
|
||||
template <class VertexDescriptor>
|
||||
inline bool operator!=(
|
||||
const StoredEdge<VertexDescriptor> &lhs,
|
||||
const StoredEdge<VertexDescriptor> &rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
template <class VertexDescriptor>
|
||||
inline bool operator<(
|
||||
const StoredEdge<VertexDescriptor> &lhs,
|
||||
const StoredEdge<VertexDescriptor> &rhs) noexcept {
|
||||
return lhs.target < rhs.target;
|
||||
}
|
||||
|
||||
template <class VertexDescriptor, class EdgeProperty>
|
||||
class StoredEdgeWithProperty : public StoredEdge<VertexDescriptor> {
|
||||
public:
|
||||
StoredEdgeWithProperty(VertexDescriptor target, const EdgeProperty &p)
|
||||
: StoredEdge<VertexDescriptor>(target), property(new EdgeProperty(p)) {}
|
||||
StoredEdgeWithProperty(VertexDescriptor target, std::unique_ptr<EdgeProperty> &&ptr)
|
||||
: StoredEdge<VertexDescriptor>(target), property(std::move(ptr)) {}
|
||||
StoredEdgeWithProperty(VertexDescriptor target) // NOLINT(google-explicit-constructor)
|
||||
: StoredEdge<VertexDescriptor>(target) {}
|
||||
|
||||
StoredEdgeWithProperty(StoredEdgeWithProperty &&) noexcept = default;
|
||||
StoredEdgeWithProperty &operator=(StoredEdgeWithProperty &&) noexcept = default;
|
||||
|
||||
EdgeProperty &get_property() noexcept { // NOLINT
|
||||
CC_EXPECTS(property);
|
||||
return *property;
|
||||
}
|
||||
const EdgeProperty &get_property() const noexcept { // NOLINT
|
||||
CC_EXPECTS(property);
|
||||
return *property;
|
||||
}
|
||||
std::unique_ptr<EdgeProperty> property;
|
||||
};
|
||||
|
||||
template <class VertexDescriptor, class EdgeListIter, class EdgeProperty = boost::no_property>
|
||||
class StoredEdgeWithEdgeIter : public StoredEdge<VertexDescriptor> {
|
||||
public:
|
||||
StoredEdgeWithEdgeIter(VertexDescriptor v, EdgeListIter iter) noexcept
|
||||
: StoredEdge<VertexDescriptor>(v), _edgeListIter(iter) {}
|
||||
StoredEdgeWithEdgeIter(VertexDescriptor v) noexcept // NOLINT(google-explicit-constructor)
|
||||
: StoredEdge<VertexDescriptor>(v) {}
|
||||
|
||||
EdgeListIter get_iter() const noexcept { // NOLINT
|
||||
return _edgeListIter;
|
||||
}
|
||||
EdgeProperty &get_property() noexcept { // NOLINT
|
||||
return _edgeListIter->get_property();
|
||||
}
|
||||
const EdgeProperty &get_property() const noexcept { // NOLINT
|
||||
return _edgeListIter->get_property();
|
||||
}
|
||||
|
||||
protected:
|
||||
EdgeListIter _edgeListIter{};
|
||||
};
|
||||
|
||||
template <class VertexDescriptor, class EdgeVec, class EdgeProperty = boost::no_property>
|
||||
class StoredEdgeWithRandomAccessEdgeIter : public StoredEdge<VertexDescriptor> {
|
||||
public:
|
||||
StoredEdgeWithRandomAccessEdgeIter(
|
||||
VertexDescriptor v, typename EdgeVec::iterator i, EdgeVec *edgeVec) noexcept
|
||||
: StoredEdge<VertexDescriptor>(v), _id(i - edgeVec->begin()), _vector(edgeVec) {}
|
||||
|
||||
typename EdgeVec::iterator get_iter() const noexcept { // NOLINT
|
||||
CC_EXPECTS(_vector);
|
||||
return _vector->begin() + _id;
|
||||
}
|
||||
EdgeProperty &get_property() noexcept { // NOLINT
|
||||
CC_EXPECTS(_vector);
|
||||
return (*_vector)[_id].get_property();
|
||||
}
|
||||
const EdgeProperty &get_property() const noexcept { // NOLINT
|
||||
CC_EXPECTS(_vector);
|
||||
return (*_vector)[_id].get_property();
|
||||
}
|
||||
|
||||
protected:
|
||||
size_t _id{static_cast<size_t>(-1)};
|
||||
EdgeVec *_vector{};
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// VertexIterator
|
||||
//--------------------------------------------------------------------
|
||||
template <class BaseIter, class VertexDescriptor, class Difference>
|
||||
struct VertexIter : boost::iterator_adaptor<
|
||||
VertexIter<BaseIter, VertexDescriptor, Difference>,
|
||||
BaseIter, VertexDescriptor, boost::use_default, VertexDescriptor, Difference> {
|
||||
using Base = boost::iterator_adaptor<
|
||||
VertexIter<BaseIter, VertexDescriptor, Difference>,
|
||||
BaseIter, VertexDescriptor, boost::use_default, VertexDescriptor, Difference>;
|
||||
|
||||
VertexIter() = default;
|
||||
VertexIter(const BaseIter &i) noexcept // NOLINT(google-explicit-constructor)
|
||||
: Base(i) {}
|
||||
|
||||
VertexDescriptor dereference() const noexcept {
|
||||
return VertexDescriptor{&(*this->base())};
|
||||
}
|
||||
};
|
||||
|
||||
template <class BaseIter, class VertexDescriptor, class Difference>
|
||||
struct VertexMapPtrIter : boost::iterator_adaptor<
|
||||
VertexMapPtrIter<BaseIter, VertexDescriptor, Difference>,
|
||||
BaseIter, VertexDescriptor, boost::use_default, VertexDescriptor, Difference> {
|
||||
using Base = boost::iterator_adaptor<
|
||||
VertexMapPtrIter<BaseIter, VertexDescriptor, Difference>,
|
||||
BaseIter, VertexDescriptor, boost::use_default, VertexDescriptor, Difference>;
|
||||
|
||||
VertexMapPtrIter() = default;
|
||||
VertexMapPtrIter(const BaseIter &i) noexcept // NOLINT(google-explicit-constructor)
|
||||
: Base(i) {}
|
||||
|
||||
VertexDescriptor dereference() const noexcept {
|
||||
return VertexDescriptor{this->base()->second.get()};
|
||||
}
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// OutEdgeIterator
|
||||
//--------------------------------------------------------------------
|
||||
template <class BaseIter, class VertexDescriptor, class EdgeDescriptor, class Difference>
|
||||
struct OutEdgeIter : boost::iterator_adaptor<
|
||||
OutEdgeIter<BaseIter, VertexDescriptor, EdgeDescriptor, Difference>,
|
||||
BaseIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference> {
|
||||
using Base = boost::iterator_adaptor<
|
||||
OutEdgeIter<BaseIter, VertexDescriptor, EdgeDescriptor, Difference>,
|
||||
BaseIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference>;
|
||||
|
||||
OutEdgeIter() = default;
|
||||
OutEdgeIter(const BaseIter &i, const VertexDescriptor &src) noexcept
|
||||
: Base(i), source(src) {}
|
||||
|
||||
EdgeDescriptor dereference() const noexcept {
|
||||
// this->base() return out edge list iterator
|
||||
return EdgeDescriptor{
|
||||
source, (*this->base()).get_target()};
|
||||
}
|
||||
VertexDescriptor source{};
|
||||
};
|
||||
|
||||
template <class BaseIter, class VertexDescriptor, class EdgeDescriptor, class Difference>
|
||||
struct OutPropertyEdgeIter : boost::iterator_adaptor<
|
||||
OutPropertyEdgeIter<BaseIter, VertexDescriptor, EdgeDescriptor, Difference>,
|
||||
BaseIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference> {
|
||||
using Base = boost::iterator_adaptor<
|
||||
OutPropertyEdgeIter<BaseIter, VertexDescriptor, EdgeDescriptor, Difference>,
|
||||
BaseIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference>;
|
||||
|
||||
OutPropertyEdgeIter() = default;
|
||||
OutPropertyEdgeIter(const BaseIter &i, const VertexDescriptor &src) noexcept
|
||||
: Base(i), source(src) {}
|
||||
|
||||
EdgeDescriptor dereference() const noexcept {
|
||||
// this->base() return out edge list iterator
|
||||
return EdgeDescriptor{
|
||||
source, (*this->base()).get_target(), &(*this->base()).get_property()};
|
||||
}
|
||||
VertexDescriptor source{};
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// InEdgeIterator
|
||||
//--------------------------------------------------------------------
|
||||
template <class BaseIter, class VertexDescriptor, class EdgeDescriptor, class Difference>
|
||||
struct InEdgeIter : boost::iterator_adaptor<
|
||||
InEdgeIter<BaseIter, VertexDescriptor, EdgeDescriptor, Difference>,
|
||||
BaseIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference> {
|
||||
using Base = boost::iterator_adaptor<
|
||||
InEdgeIter<BaseIter, VertexDescriptor, EdgeDescriptor, Difference>,
|
||||
BaseIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference>;
|
||||
|
||||
InEdgeIter() = default;
|
||||
InEdgeIter(const BaseIter &i, const VertexDescriptor &src) noexcept
|
||||
: Base(i), source(src) {}
|
||||
|
||||
EdgeDescriptor dereference() const noexcept {
|
||||
return EdgeDescriptor{
|
||||
(*this->base()).get_target(), source};
|
||||
}
|
||||
VertexDescriptor source{};
|
||||
};
|
||||
|
||||
template <class BaseIter, class VertexDescriptor, class EdgeDescriptor, class Difference>
|
||||
struct InPropertyEdgeIter : boost::iterator_adaptor<
|
||||
InPropertyEdgeIter<BaseIter, VertexDescriptor, EdgeDescriptor, Difference>,
|
||||
BaseIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference> {
|
||||
using Base = boost::iterator_adaptor<
|
||||
InPropertyEdgeIter<BaseIter, VertexDescriptor, EdgeDescriptor, Difference>,
|
||||
BaseIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference>;
|
||||
|
||||
InPropertyEdgeIter() = default;
|
||||
InPropertyEdgeIter(const BaseIter &i, const VertexDescriptor &src) noexcept
|
||||
: Base(i), source(src) {}
|
||||
|
||||
EdgeDescriptor dereference() const noexcept {
|
||||
return EdgeDescriptor{
|
||||
(*this->base()).get_target(), source, &this->base()->get_property()};
|
||||
}
|
||||
VertexDescriptor source{};
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// EdgeIterator
|
||||
//--------------------------------------------------------------------
|
||||
// UndirectedEdgeIter (Bidirectional || Undirected)
|
||||
template <class EdgeIter, class EdgeDescriptor, class Difference>
|
||||
struct UndirectedEdgeIter : boost::iterator_adaptor<
|
||||
UndirectedEdgeIter<EdgeIter, EdgeDescriptor, Difference>,
|
||||
EdgeIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference> {
|
||||
using Base = boost::iterator_adaptor<
|
||||
UndirectedEdgeIter<EdgeIter, EdgeDescriptor, Difference>,
|
||||
EdgeIter, EdgeDescriptor, boost::use_default, EdgeDescriptor, Difference>;
|
||||
|
||||
UndirectedEdgeIter() = default;
|
||||
explicit UndirectedEdgeIter(EdgeIter i) noexcept : Base(i) {}
|
||||
|
||||
EdgeDescriptor dereference() const noexcept {
|
||||
return EdgeDescriptor{
|
||||
(*this->base()).source, (*this->base()).target, &this->base()->get_property()};
|
||||
}
|
||||
};
|
||||
|
||||
// DirectedEdgeIterator
|
||||
template <class VertexIterator, class OutEdgeIterator, class Graph>
|
||||
class DirectedEdgeIterator {
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = typename OutEdgeIterator::value_type;
|
||||
using reference = typename OutEdgeIterator::reference;
|
||||
using pointer = typename OutEdgeIterator::pointer;
|
||||
using difference_type = typename OutEdgeIterator::difference_type;
|
||||
using distance_type = difference_type;
|
||||
|
||||
DirectedEdgeIterator() = default;
|
||||
template <class G>
|
||||
DirectedEdgeIterator(VertexIterator b, VertexIterator c, VertexIterator e, const G &g) noexcept
|
||||
: _begin(b), _curr(c), _end(e), _g(&g) {
|
||||
if (_curr != _end) {
|
||||
while (_curr != _end && out_degree(*_curr, *_g) == 0) {
|
||||
++_curr;
|
||||
}
|
||||
if (_curr != _end) {
|
||||
_edges = out_edges(*_curr, *_g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DirectedEdgeIterator &operator++() noexcept {
|
||||
++_edges->first;
|
||||
if (_edges->first == _edges->second) {
|
||||
++_curr;
|
||||
while (_curr != _end && out_degree(*_curr, *_g) == 0) {
|
||||
++_curr;
|
||||
}
|
||||
if (_curr != _end) {
|
||||
_edges = out_edges(*_curr, *_g);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
DirectedEdgeIterator operator++(int) noexcept {
|
||||
DirectedEdgeIterator tmp = *this;
|
||||
++(*this);
|
||||
return tmp;
|
||||
}
|
||||
value_type operator*() const noexcept {
|
||||
return *_edges->first;
|
||||
}
|
||||
bool operator==(const DirectedEdgeIterator &x) const noexcept {
|
||||
return _curr == x._curr && (_curr == _end || _edges->first == x._edges->first);
|
||||
}
|
||||
bool operator!=(const DirectedEdgeIterator &x) const noexcept {
|
||||
return _curr != x._curr || (_curr != _end && _edges->first != x._edges->first);
|
||||
}
|
||||
|
||||
protected:
|
||||
VertexIterator _begin{};
|
||||
VertexIterator _curr{};
|
||||
VertexIterator _end{};
|
||||
boost::optional<std::pair<OutEdgeIterator, OutEdgeIterator>> _edges;
|
||||
const Graph *_g{};
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
// EdgeListGraph
|
||||
//--------------------------------------------------------------------
|
||||
template <class VertexDescriptor, class EdgeProperty = boost::no_property>
|
||||
struct ListEdge {
|
||||
ListEdge(VertexDescriptor s, VertexDescriptor t) // NOLINT
|
||||
: source(s), target(t) {}
|
||||
|
||||
ListEdge(VertexDescriptor s, VertexDescriptor t, EdgeProperty &&p) // NOLINT
|
||||
: source(s), target(t), property(std::move(p)) {}
|
||||
|
||||
ListEdge(VertexDescriptor s, VertexDescriptor t, const EdgeProperty &p) // NOLINT
|
||||
: source(s), target(t), property(p) {}
|
||||
|
||||
template <class... T>
|
||||
ListEdge(VertexDescriptor s, VertexDescriptor t, T &&...args) // NOLINT
|
||||
: source(s), target(t), property(std::forward<T>(args)...) {}
|
||||
|
||||
EdgeProperty &get_property() noexcept { return property; } // NOLINT
|
||||
const EdgeProperty &get_property() const noexcept { return property; } // NOLINT
|
||||
|
||||
VertexDescriptor source{};
|
||||
VertexDescriptor target{};
|
||||
EdgeProperty property;
|
||||
};
|
||||
|
||||
// template<class VertexDescriptor, PmrAllocatorUserClass_ EdgeProperty>
|
||||
template <class VertexDescriptor, class EdgeProperty>
|
||||
struct PmrListEdge {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return allocator_type{property.get_allocator().resource()};
|
||||
}
|
||||
// cntrs
|
||||
PmrListEdge(VertexDescriptor s, VertexDescriptor t, const allocator_type &alloc) // NOLINT
|
||||
: source(s), target(t), property(alloc) {}
|
||||
|
||||
PmrListEdge(VertexDescriptor s, VertexDescriptor t, EdgeProperty &&p, const allocator_type &alloc) // NOLINT
|
||||
: source(s), target(t), property(std::move(p), alloc) {}
|
||||
|
||||
PmrListEdge(VertexDescriptor s, VertexDescriptor t, const EdgeProperty &p, const allocator_type &alloc) // NOLINT
|
||||
: source(s), target(t), property(p, alloc) {}
|
||||
|
||||
template <class... T>
|
||||
PmrListEdge(VertexDescriptor s, VertexDescriptor t, T &&...args) // NOLINT
|
||||
: source(s), target(t), property(std::forward<T>(args)...) {}
|
||||
|
||||
// move/copy cntrs
|
||||
PmrListEdge(PmrListEdge &&rhs, const allocator_type &alloc)
|
||||
: source(std::move(rhs.source)), target(std::move(rhs.target)), property(std::move(rhs.property), alloc) {}
|
||||
PmrListEdge(const PmrListEdge &rhs, const allocator_type &alloc)
|
||||
: source(rhs.source), target(rhs.target), property(rhs.property, alloc) {}
|
||||
|
||||
PmrListEdge(const PmrListEdge &) = delete;
|
||||
|
||||
EdgeProperty &get_property() noexcept { return property; } // NOLINT
|
||||
const EdgeProperty &get_property() const noexcept { return property; } // NOLINT
|
||||
|
||||
VertexDescriptor source{};
|
||||
VertexDescriptor target{};
|
||||
EdgeProperty property;
|
||||
};
|
||||
|
||||
// Polymorphic Graph
|
||||
template <class Tag, class Handle>
|
||||
struct ValueHandle : Tag {
|
||||
ValueHandle() noexcept = default;
|
||||
ValueHandle(ValueHandle &&rhs) noexcept
|
||||
: value(std::move(rhs.value)) {}
|
||||
ValueHandle(const ValueHandle &rhs) noexcept
|
||||
: value(rhs.value) {}
|
||||
ValueHandle &operator=(ValueHandle &&rhs) noexcept {
|
||||
value = std::move(rhs.value);
|
||||
return *this;
|
||||
}
|
||||
ValueHandle &operator=(const ValueHandle &rhs) noexcept {
|
||||
value = rhs.value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
ValueHandle(const Handle &handle) noexcept // NOLINT(google-explicit-constructor)
|
||||
: value(handle) {}
|
||||
ValueHandle(Handle &&handle) noexcept // NOLINT(google-explicit-constructor)
|
||||
: value(std::move(handle)) {}
|
||||
template <class... Args>
|
||||
ValueHandle(Args &&...args) noexcept // NOLINT(google-explicit-constructor)
|
||||
: value(std::forward<Args>(args)...) {}
|
||||
|
||||
Handle value{};
|
||||
};
|
||||
|
||||
// Reference Graph
|
||||
// OwnershipIterator (Bidirectional, !EdgeProperty)
|
||||
template <class VertexIterator, class OutEdgeIterator, class Graph>
|
||||
class OwnershipIterator {
|
||||
public:
|
||||
using iterator_category = std::forward_iterator_tag;
|
||||
using value_type = typename OutEdgeIterator::value_type;
|
||||
using reference = typename OutEdgeIterator::reference;
|
||||
using pointer = typename OutEdgeIterator::pointer;
|
||||
using difference_type = typename OutEdgeIterator::difference_type;
|
||||
using distance_type = difference_type;
|
||||
|
||||
OwnershipIterator() = default;
|
||||
template <class G>
|
||||
OwnershipIterator(VertexIterator b, VertexIterator c, VertexIterator e, const G &g) noexcept
|
||||
: _begin(b), _curr(c), _end(e), _g(&g) {
|
||||
if (_curr != _end) {
|
||||
while (_curr != _end && num_children(*_curr, *_g) == 0) {
|
||||
++_curr;
|
||||
}
|
||||
if (_curr != _end) {
|
||||
_edges = children(*_curr, *_g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
OwnershipIterator &operator++() noexcept {
|
||||
++_edges->first;
|
||||
if (_edges->first == _edges->second) {
|
||||
++_curr;
|
||||
while (_curr != _end && num_children(*_curr, *_g) == 0) {
|
||||
++_curr;
|
||||
}
|
||||
if (_curr != _end) {
|
||||
_edges = children(*_curr, *_g);
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
OwnershipIterator operator++(int) noexcept {
|
||||
OwnershipIterator tmp = *this;
|
||||
++(*this);
|
||||
return tmp;
|
||||
}
|
||||
value_type operator*() const noexcept {
|
||||
return *_edges->first;
|
||||
}
|
||||
bool operator==(const OwnershipIterator &x) const noexcept {
|
||||
return _curr == x._curr && (_curr == _end || _edges->first == x._edges->first);
|
||||
}
|
||||
bool operator!=(const OwnershipIterator &x) const noexcept {
|
||||
return _curr != x._curr || (_curr != _end && _edges->first != x._edges->first);
|
||||
}
|
||||
|
||||
protected:
|
||||
VertexIterator _begin{};
|
||||
VertexIterator _curr{};
|
||||
VertexIterator _end{};
|
||||
boost::optional<std::pair<OutEdgeIterator, OutEdgeIterator>> _edges;
|
||||
const Graph *_g{};
|
||||
};
|
||||
|
||||
} // namespace impl
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,46 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <cocos/base/Macros.h>
|
||||
#include <utility>
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace gsl {
|
||||
|
||||
// narrow_cast(): a searchable way to do narrowing casts of values
|
||||
template <class T, class U>
|
||||
constexpr T narrow_cast(U &&u) noexcept { // NOLINT
|
||||
return static_cast<T>(std::forward<U>(u));
|
||||
}
|
||||
|
||||
#define CC_EXPECTS(cond) CC_ASSERT(cond) // NOLINT
|
||||
|
||||
#define CC_ENSURES(cond) CC_ASSERT(cond) // NOLINT
|
||||
|
||||
} // namespace gsl
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,98 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <cocos/bindings/manual/jsb_conversions.h>
|
||||
#include <cocos/renderer/pipeline/custom/Map.h>
|
||||
#include <cocos/renderer/pipeline/custom/String.h>
|
||||
#include <boost/container/vector.hpp>
|
||||
|
||||
template <typename T, typename allocator>
|
||||
inline bool nativevalue_to_se( // NOLINT(readability-identifier-naming)
|
||||
const boost::container::vector<T, allocator>& from,
|
||||
se::Value& to, se::Object* ctx) {
|
||||
se::Object* array = se::Object::createArrayObject(from.size());
|
||||
se::Value tmp;
|
||||
for (size_t i = 0; i < from.size(); i++) {
|
||||
nativevalue_to_se(from[i], tmp, ctx);
|
||||
array->setArrayElement(static_cast<uint32_t>(i), tmp);
|
||||
}
|
||||
to.setObject(array);
|
||||
array->decRef();
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool nativevalue_to_se( // NOLINT(readability-identifier-naming)
|
||||
const cc::PmrString& from, se::Value& to, se::Object* /*ctx*/) {
|
||||
to.setString(from.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename T, typename allocator>
|
||||
bool sevalue_to_native(const se::Value& from, boost::container::vector<T, allocator>* to, se::Object* ctx) { // NOLINT(readability-identifier-naming)
|
||||
if (from.isNullOrUndefined()) {
|
||||
to->clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
assert(from.toObject());
|
||||
se::Object *array = from.toObject();
|
||||
|
||||
if (array->isArray()) {
|
||||
uint32_t len = 0;
|
||||
array->getArrayLength(&len);
|
||||
to->resize(len);
|
||||
se::Value tmp;
|
||||
for (uint32_t i = 0; i < len; i++) {
|
||||
array->getArrayElement(i, &tmp);
|
||||
if (!sevalue_to_native(tmp, to->data() + i, ctx)) {
|
||||
SE_LOGE("vector %s convert error at %d\n", typeid(T).name(), i);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (array->isTypedArray()) {
|
||||
assert(std::is_arithmetic<T>::value);
|
||||
uint8_t *data = nullptr;
|
||||
size_t dataLen = 0;
|
||||
array->getTypedArrayData(&data, &dataLen);
|
||||
to->assign(reinterpret_cast<T *>(data), reinterpret_cast<T *>(data + dataLen));
|
||||
return true;
|
||||
}
|
||||
|
||||
SE_LOGE("[warn] failed to convert to boost::container::vector\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
inline bool sevalue_to_native(const se::Value& from, cc::PmrString* to, se::Object* /*ctx*/) { // NOLINT(readability-identifier-naming)
|
||||
if (!from.isNullOrUndefined()) {
|
||||
const auto& str = from.toString();
|
||||
to->assign(str.begin(), str.end());
|
||||
} else {
|
||||
to->clear();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonFwd.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
struct Constant;
|
||||
struct ConstantBuffer;
|
||||
|
||||
using DescriptorType = boost::variant2::variant<CBufferTag, RWBufferTag, RWTextureTag, BufferTag, TextureTag, SamplerTag>;
|
||||
|
||||
struct DescriptorBlock;
|
||||
struct DescriptorArray;
|
||||
struct UnboundedDescriptor;
|
||||
struct DescriptorTable;
|
||||
struct DescriptorSet;
|
||||
struct LayoutData;
|
||||
struct ShaderProgramData;
|
||||
struct GroupNodeData;
|
||||
struct ShaderNodeData;
|
||||
struct GroupTag;
|
||||
struct ShaderTag;
|
||||
struct LayoutGraphData;
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "cocos/renderer/pipeline/custom/JsbConversion.h"
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphJsb.h"
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,37 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/bindings/manual/jsb_conversions.h"
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonJsb.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,59 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonNames.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
inline const char* getName(const Constant& /*v*/) noexcept { return "Constant"; }
|
||||
inline const char* getName(const ConstantBuffer& /*v*/) noexcept { return "ConstantBuffer"; }
|
||||
inline const char* getName(const DescriptorBlock& /*v*/) noexcept { return "DescriptorBlock"; }
|
||||
inline const char* getName(const DescriptorArray& /*v*/) noexcept { return "DescriptorArray"; }
|
||||
inline const char* getName(const UnboundedDescriptor& /*v*/) noexcept { return "UnboundedDescriptor"; }
|
||||
inline const char* getName(const DescriptorTable& /*v*/) noexcept { return "DescriptorTable"; }
|
||||
inline const char* getName(const DescriptorSet& /*v*/) noexcept { return "DescriptorSet"; }
|
||||
inline const char* getName(const LayoutData& /*v*/) noexcept { return "LayoutData"; }
|
||||
inline const char* getName(const ShaderProgramData& /*v*/) noexcept { return "ShaderProgramData"; }
|
||||
inline const char* getName(const GroupNodeData& /*v*/) noexcept { return "GroupNodeData"; }
|
||||
inline const char* getName(const ShaderNodeData& /*v*/) noexcept { return "ShaderNodeData"; }
|
||||
inline const char* getName(const GroupTag& /*v*/) noexcept { return "Group"; }
|
||||
inline const char* getName(const ShaderTag& /*v*/) noexcept { return "Shader"; }
|
||||
inline const char* getName(const LayoutGraphData& /*v*/) noexcept { return "LayoutGraphData"; }
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "LayoutGraphReflection.h"
|
||||
#include "LayoutGraphTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonReflection.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,186 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "LayoutGraphTypes.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
ConstantBuffer::ConstantBuffer(const allocator_type& alloc) noexcept
|
||||
: constants(alloc) {}
|
||||
|
||||
ConstantBuffer::ConstantBuffer(ConstantBuffer&& rhs, const allocator_type& alloc)
|
||||
: size(rhs.size),
|
||||
constants(std::move(rhs.constants), alloc) {}
|
||||
|
||||
ConstantBuffer::ConstantBuffer(ConstantBuffer const& rhs, const allocator_type& alloc)
|
||||
: size(rhs.size),
|
||||
constants(rhs.constants, alloc) {}
|
||||
|
||||
DescriptorBlock::DescriptorBlock(const allocator_type& alloc) noexcept
|
||||
: attributeIDs(alloc) {}
|
||||
|
||||
DescriptorBlock::DescriptorBlock(DescriptorBlock&& rhs, const allocator_type& alloc)
|
||||
: type(rhs.type),
|
||||
capacity(rhs.capacity),
|
||||
attributeIDs(std::move(rhs.attributeIDs), alloc) {}
|
||||
|
||||
DescriptorBlock::DescriptorBlock(DescriptorBlock const& rhs, const allocator_type& alloc)
|
||||
: type(rhs.type),
|
||||
capacity(rhs.capacity),
|
||||
attributeIDs(rhs.attributeIDs, alloc) {}
|
||||
|
||||
UnboundedDescriptor::UnboundedDescriptor(const allocator_type& alloc) noexcept
|
||||
: descriptors(alloc) {}
|
||||
|
||||
UnboundedDescriptor::UnboundedDescriptor(UnboundedDescriptor&& rhs, const allocator_type& alloc)
|
||||
: type(rhs.type),
|
||||
descriptors(std::move(rhs.descriptors), alloc) {}
|
||||
|
||||
UnboundedDescriptor::UnboundedDescriptor(UnboundedDescriptor const& rhs, const allocator_type& alloc)
|
||||
: type(rhs.type),
|
||||
descriptors(rhs.descriptors, alloc) {}
|
||||
|
||||
DescriptorTable::DescriptorTable(const allocator_type& alloc) noexcept
|
||||
: blocks(alloc) {}
|
||||
|
||||
DescriptorTable::DescriptorTable(DescriptorTable&& rhs, const allocator_type& alloc)
|
||||
: slot(rhs.slot),
|
||||
capacity(rhs.capacity),
|
||||
blocks(std::move(rhs.blocks), alloc) {}
|
||||
|
||||
DescriptorTable::DescriptorTable(DescriptorTable const& rhs, const allocator_type& alloc)
|
||||
: slot(rhs.slot),
|
||||
capacity(rhs.capacity),
|
||||
blocks(rhs.blocks, alloc) {}
|
||||
|
||||
DescriptorSet::DescriptorSet(const allocator_type& alloc) noexcept
|
||||
: tables(alloc),
|
||||
unbounded(alloc) {}
|
||||
|
||||
DescriptorSet::DescriptorSet(DescriptorSet&& rhs, const allocator_type& alloc)
|
||||
: tables(std::move(rhs.tables), alloc),
|
||||
unbounded(std::move(rhs.unbounded), alloc) {}
|
||||
|
||||
DescriptorSet::DescriptorSet(DescriptorSet const& rhs, const allocator_type& alloc)
|
||||
: tables(rhs.tables, alloc),
|
||||
unbounded(rhs.unbounded, alloc) {}
|
||||
|
||||
LayoutData::LayoutData(const allocator_type& alloc) noexcept
|
||||
: constantBuffers(alloc),
|
||||
descriptorSets(alloc) {}
|
||||
|
||||
LayoutData::LayoutData(LayoutData&& rhs, const allocator_type& alloc)
|
||||
: constantBuffers(std::move(rhs.constantBuffers), alloc),
|
||||
descriptorSets(std::move(rhs.descriptorSets), alloc) {}
|
||||
|
||||
LayoutData::LayoutData(LayoutData const& rhs, const allocator_type& alloc)
|
||||
: constantBuffers(rhs.constantBuffers, alloc),
|
||||
descriptorSets(rhs.descriptorSets, alloc) {}
|
||||
|
||||
ShaderProgramData::ShaderProgramData(const allocator_type& alloc) noexcept
|
||||
: layouts(alloc) {}
|
||||
|
||||
ShaderProgramData::ShaderProgramData(ShaderProgramData&& rhs, const allocator_type& alloc)
|
||||
: layouts(std::move(rhs.layouts), alloc) {}
|
||||
|
||||
ShaderProgramData::ShaderProgramData(ShaderProgramData const& rhs, const allocator_type& alloc)
|
||||
: layouts(rhs.layouts, alloc) {}
|
||||
|
||||
ShaderNodeData::ShaderNodeData(const allocator_type& alloc) noexcept
|
||||
: shaderPrograms(alloc),
|
||||
shaderIndex(alloc) {}
|
||||
|
||||
ShaderNodeData::ShaderNodeData(ShaderNodeData&& rhs, const allocator_type& alloc)
|
||||
: rootSignature(std::move(rhs.rootSignature)),
|
||||
shaderPrograms(std::move(rhs.shaderPrograms), alloc),
|
||||
shaderIndex(std::move(rhs.shaderIndex), alloc) {}
|
||||
|
||||
ShaderNodeData::ShaderNodeData(ShaderNodeData const& rhs, const allocator_type& alloc)
|
||||
: rootSignature(rhs.rootSignature),
|
||||
shaderPrograms(rhs.shaderPrograms, alloc),
|
||||
shaderIndex(rhs.shaderIndex, alloc) {}
|
||||
|
||||
LayoutGraphData::LayoutGraphData(const allocator_type& alloc) noexcept
|
||||
: vertices(alloc),
|
||||
names(alloc),
|
||||
updateFrequencies(alloc),
|
||||
layouts(alloc),
|
||||
groupNodes(alloc),
|
||||
shaderNodes(alloc),
|
||||
pathIndex(alloc) {}
|
||||
|
||||
LayoutGraphData::LayoutGraphData(LayoutGraphData&& rhs, const allocator_type& 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),
|
||||
groupNodes(std::move(rhs.groupNodes), alloc),
|
||||
shaderNodes(std::move(rhs.shaderNodes), alloc),
|
||||
pathIndex(std::move(rhs.pathIndex), alloc) {}
|
||||
|
||||
LayoutGraphData::LayoutGraphData(LayoutGraphData const& rhs, const allocator_type& alloc)
|
||||
: vertices(rhs.vertices, alloc),
|
||||
names(rhs.names, alloc),
|
||||
updateFrequencies(rhs.updateFrequencies, alloc),
|
||||
layouts(rhs.layouts, alloc),
|
||||
groupNodes(rhs.groupNodes, alloc),
|
||||
shaderNodes(rhs.shaderNodes, alloc),
|
||||
pathIndex(rhs.pathIndex, alloc) {}
|
||||
|
||||
// ContinuousContainer
|
||||
void LayoutGraphData::reserve(vertices_size_type sz) {
|
||||
vertices.reserve(sz);
|
||||
names.reserve(sz);
|
||||
updateFrequencies.reserve(sz);
|
||||
layouts.reserve(sz);
|
||||
}
|
||||
|
||||
LayoutGraphData::vertex_type::vertex_type(const allocator_type& alloc) noexcept
|
||||
: outEdges(alloc),
|
||||
inEdges(alloc) {}
|
||||
|
||||
LayoutGraphData::vertex_type::vertex_type(vertex_type&& rhs, const allocator_type& alloc)
|
||||
: outEdges(std::move(rhs.outEdges), alloc),
|
||||
inEdges(std::move(rhs.inEdges), alloc),
|
||||
handle(std::move(rhs.handle)) {}
|
||||
|
||||
LayoutGraphData::vertex_type::vertex_type(vertex_type const& rhs, const allocator_type& alloc)
|
||||
: outEdges(rhs.outEdges, alloc),
|
||||
inEdges(rhs.inEdges, alloc),
|
||||
handle(rhs.handle) {}
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,411 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/container/pmr/vector.hpp>
|
||||
#include <boost/graph/adjacency_iterator.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/range/irange.hpp>
|
||||
#include "cocos/renderer/pipeline/custom/GraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/Map.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonTypes.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
struct Constant {
|
||||
ValueType type;
|
||||
uint32_t valueID{0xFFFFFFFF};
|
||||
};
|
||||
|
||||
struct ConstantBuffer {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {constants.get_allocator().resource()};
|
||||
}
|
||||
|
||||
ConstantBuffer(const allocator_type& alloc) noexcept; // NOLINT
|
||||
ConstantBuffer(ConstantBuffer&& rhs, const allocator_type& alloc);
|
||||
ConstantBuffer(ConstantBuffer const& rhs, const allocator_type& alloc);
|
||||
|
||||
ConstantBuffer(ConstantBuffer&& rhs) noexcept = default;
|
||||
ConstantBuffer(ConstantBuffer const& rhs) = delete;
|
||||
ConstantBuffer& operator=(ConstantBuffer&& rhs) = default;
|
||||
ConstantBuffer& operator=(ConstantBuffer const& rhs) = default;
|
||||
|
||||
uint32_t size{0};
|
||||
boost::container::pmr::vector<Constant> constants;
|
||||
};
|
||||
|
||||
using DescriptorType = boost::variant2::variant<CBufferTag, RWBufferTag, RWTextureTag, BufferTag, TextureTag, SamplerTag>;
|
||||
|
||||
inline bool operator<(const DescriptorType& lhs, const DescriptorType& rhs) noexcept {
|
||||
return lhs.index() < rhs.index();
|
||||
}
|
||||
|
||||
inline bool operator==(const DescriptorType& lhs, const DescriptorType& rhs) noexcept {
|
||||
return lhs.index() == rhs.index();
|
||||
}
|
||||
|
||||
inline bool operator!=(const DescriptorType& lhs, const DescriptorType& rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
struct DescriptorBlock {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {attributeIDs.get_allocator().resource()};
|
||||
}
|
||||
|
||||
DescriptorBlock(const allocator_type& alloc) noexcept; // NOLINT
|
||||
DescriptorBlock(DescriptorBlock&& rhs, const allocator_type& alloc);
|
||||
DescriptorBlock(DescriptorBlock const& rhs, const allocator_type& alloc);
|
||||
|
||||
DescriptorBlock(DescriptorBlock&& rhs) noexcept = default;
|
||||
DescriptorBlock(DescriptorBlock const& rhs) = delete;
|
||||
DescriptorBlock& operator=(DescriptorBlock&& rhs) = default;
|
||||
DescriptorBlock& operator=(DescriptorBlock const& rhs) = default;
|
||||
|
||||
DescriptorType type;
|
||||
uint32_t capacity{0};
|
||||
boost::container::pmr::vector<uint32_t> attributeIDs;
|
||||
};
|
||||
|
||||
struct DescriptorArray {
|
||||
uint32_t capacity{0};
|
||||
uint32_t attributeID{0xFFFFFFFF};
|
||||
};
|
||||
|
||||
struct UnboundedDescriptor {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {descriptors.get_allocator().resource()};
|
||||
}
|
||||
|
||||
UnboundedDescriptor(const allocator_type& alloc) noexcept; // NOLINT
|
||||
UnboundedDescriptor(UnboundedDescriptor&& rhs, const allocator_type& alloc);
|
||||
UnboundedDescriptor(UnboundedDescriptor const& rhs, const allocator_type& alloc);
|
||||
|
||||
UnboundedDescriptor(UnboundedDescriptor&& rhs) noexcept = default;
|
||||
UnboundedDescriptor(UnboundedDescriptor const& rhs) = delete;
|
||||
UnboundedDescriptor& operator=(UnboundedDescriptor&& rhs) = default;
|
||||
UnboundedDescriptor& operator=(UnboundedDescriptor const& rhs) = default;
|
||||
|
||||
DescriptorType type;
|
||||
boost::container::pmr::vector<DescriptorArray> descriptors;
|
||||
};
|
||||
|
||||
struct DescriptorTable {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {blocks.get_allocator().resource()};
|
||||
}
|
||||
|
||||
DescriptorTable(const allocator_type& alloc) noexcept; // NOLINT
|
||||
DescriptorTable(DescriptorTable&& rhs, const allocator_type& alloc);
|
||||
DescriptorTable(DescriptorTable const& rhs, const allocator_type& alloc);
|
||||
|
||||
DescriptorTable(DescriptorTable&& rhs) noexcept = default;
|
||||
DescriptorTable(DescriptorTable const& rhs) = delete;
|
||||
DescriptorTable& operator=(DescriptorTable&& rhs) = default;
|
||||
DescriptorTable& operator=(DescriptorTable const& rhs) = default;
|
||||
|
||||
uint32_t slot{0};
|
||||
uint32_t capacity{0};
|
||||
boost::container::pmr::vector<DescriptorBlock> blocks;
|
||||
};
|
||||
|
||||
struct DescriptorSet {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {tables.get_allocator().resource()};
|
||||
}
|
||||
|
||||
DescriptorSet(const allocator_type& alloc) noexcept; // NOLINT
|
||||
DescriptorSet(DescriptorSet&& rhs, const allocator_type& alloc);
|
||||
DescriptorSet(DescriptorSet const& rhs, const allocator_type& alloc);
|
||||
|
||||
DescriptorSet(DescriptorSet&& rhs) noexcept = default;
|
||||
DescriptorSet(DescriptorSet const& rhs) = delete;
|
||||
DescriptorSet& operator=(DescriptorSet&& rhs) = default;
|
||||
DescriptorSet& operator=(DescriptorSet const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<DescriptorTable> tables;
|
||||
UnboundedDescriptor unbounded;
|
||||
};
|
||||
|
||||
struct LayoutData {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {constantBuffers.get_allocator().resource()};
|
||||
}
|
||||
|
||||
LayoutData(const allocator_type& alloc) noexcept; // NOLINT
|
||||
LayoutData(LayoutData&& rhs, const allocator_type& alloc);
|
||||
LayoutData(LayoutData const& rhs, const allocator_type& alloc);
|
||||
|
||||
LayoutData(LayoutData&& rhs) noexcept = default;
|
||||
LayoutData(LayoutData const& rhs) = delete;
|
||||
LayoutData& operator=(LayoutData&& rhs) = default;
|
||||
LayoutData& operator=(LayoutData const& rhs) = default;
|
||||
|
||||
PmrTransparentMap<ParameterType, ConstantBuffer> constantBuffers;
|
||||
PmrTransparentMap<ParameterType, DescriptorSet> descriptorSets;
|
||||
};
|
||||
|
||||
struct ShaderProgramData {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {layouts.get_allocator().resource()};
|
||||
}
|
||||
|
||||
ShaderProgramData(const allocator_type& alloc) noexcept; // NOLINT
|
||||
ShaderProgramData(ShaderProgramData&& rhs, const allocator_type& alloc);
|
||||
ShaderProgramData(ShaderProgramData const& rhs, const allocator_type& alloc);
|
||||
|
||||
ShaderProgramData(ShaderProgramData&& rhs) noexcept = default;
|
||||
ShaderProgramData(ShaderProgramData const& rhs) = delete;
|
||||
ShaderProgramData& operator=(ShaderProgramData&& rhs) = default;
|
||||
ShaderProgramData& operator=(ShaderProgramData const& rhs) = default;
|
||||
|
||||
PmrTransparentMap<UpdateFrequency, LayoutData> layouts;
|
||||
};
|
||||
|
||||
struct GroupNodeData {
|
||||
GroupNodeData() = default;
|
||||
GroupNodeData(NodeType nodeTypeIn) noexcept // NOLINT
|
||||
: nodeType(nodeTypeIn) {}
|
||||
|
||||
NodeType nodeType{NodeType::INTERNAL};
|
||||
};
|
||||
|
||||
struct ShaderNodeData {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {shaderPrograms.get_allocator().resource()};
|
||||
}
|
||||
|
||||
ShaderNodeData(const allocator_type& alloc) noexcept; // NOLINT
|
||||
ShaderNodeData(ShaderNodeData&& rhs, const allocator_type& alloc);
|
||||
ShaderNodeData(ShaderNodeData const& rhs, const allocator_type& alloc);
|
||||
|
||||
ShaderNodeData(ShaderNodeData&& rhs) noexcept = default;
|
||||
ShaderNodeData(ShaderNodeData const& rhs) = delete;
|
||||
ShaderNodeData& operator=(ShaderNodeData&& rhs) = default;
|
||||
ShaderNodeData& operator=(ShaderNodeData const& rhs) = default;
|
||||
|
||||
std::string rootSignature;
|
||||
boost::container::pmr::vector<ShaderProgramData> shaderPrograms;
|
||||
PmrTransparentMap<std::string, uint32_t> shaderIndex;
|
||||
};
|
||||
|
||||
struct GroupTag {};
|
||||
struct ShaderTag {};
|
||||
|
||||
struct LayoutGraphData {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {vertices.get_allocator().resource()};
|
||||
}
|
||||
|
||||
inline boost::container::pmr::memory_resource* resource() const noexcept {
|
||||
return get_allocator().resource();
|
||||
}
|
||||
|
||||
LayoutGraphData(const allocator_type& alloc) noexcept; // NOLINT
|
||||
LayoutGraphData(LayoutGraphData&& rhs, const allocator_type& alloc);
|
||||
LayoutGraphData(LayoutGraphData const& rhs, const allocator_type& alloc);
|
||||
|
||||
LayoutGraphData(LayoutGraphData&& rhs) noexcept = default;
|
||||
LayoutGraphData(LayoutGraphData const& rhs) = delete;
|
||||
LayoutGraphData& operator=(LayoutGraphData&& rhs) = default;
|
||||
LayoutGraphData& operator=(LayoutGraphData const& rhs) = default;
|
||||
|
||||
// Graph
|
||||
using directed_category = boost::bidirectional_tag;
|
||||
using vertex_descriptor = uint32_t;
|
||||
using edge_descriptor = impl::EdgeDescriptor<directed_category, vertex_descriptor>;
|
||||
using edge_parallel_category = boost::allow_parallel_edge_tag;
|
||||
struct traversal_category // NOLINT
|
||||
: virtual boost::incidence_graph_tag,
|
||||
virtual boost::bidirectional_graph_tag,
|
||||
virtual boost::adjacency_graph_tag,
|
||||
virtual boost::vertex_list_graph_tag,
|
||||
virtual boost::edge_list_graph_tag {};
|
||||
|
||||
constexpr static vertex_descriptor null_vertex() noexcept { // NOLINT
|
||||
return std::numeric_limits<vertex_descriptor>::max();
|
||||
}
|
||||
|
||||
// IncidenceGraph
|
||||
using out_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using out_edge_iterator = impl::OutEdgeIter<
|
||||
boost::container::pmr::vector<out_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
using degree_size_type = uint32_t;
|
||||
|
||||
// BidirectionalGraph
|
||||
using in_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using in_edge_iterator = impl::InEdgeIter<
|
||||
boost::container::pmr::vector<in_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
|
||||
// AdjacencyGraph
|
||||
using adjacency_iterator = boost::adjacency_iterator_generator<
|
||||
LayoutGraphData, vertex_descriptor, out_edge_iterator>::type;
|
||||
|
||||
// VertexListGraph
|
||||
using vertex_iterator = boost::integer_range<vertex_descriptor>::iterator;
|
||||
using vertices_size_type = uint32_t;
|
||||
|
||||
// VertexList help functions
|
||||
inline boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
|
||||
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
|
||||
return {0, static_cast<vertices_size_type>(vertices.size())};
|
||||
}
|
||||
|
||||
inline vertex_descriptor getCurrentID() const noexcept {
|
||||
return static_cast<vertex_descriptor>(vertices.size());
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
|
||||
return boost::container::pmr::vector<boost::default_color_type>(vertices.size(), mr);
|
||||
}
|
||||
|
||||
// EdgeListGraph
|
||||
using edge_iterator = impl::DirectedEdgeIterator<vertex_iterator, out_edge_iterator, LayoutGraphData>;
|
||||
using edges_size_type = uint32_t;
|
||||
|
||||
// AddressableGraph (Alias)
|
||||
using ownership_descriptor = impl::EdgeDescriptor<boost::bidirectional_tag, vertex_descriptor>;
|
||||
|
||||
using children_edge_type = out_edge_type;
|
||||
using children_iterator = impl::OutEdgeIter<
|
||||
boost::container::pmr::vector<out_edge_type>::iterator,
|
||||
vertex_descriptor, ownership_descriptor, int32_t>;
|
||||
using children_size_type = uint32_t;
|
||||
|
||||
using parent_edge_type = in_edge_type;
|
||||
using parent_iterator = impl::InEdgeIter<
|
||||
boost::container::pmr::vector<in_edge_type>::iterator,
|
||||
vertex_descriptor, ownership_descriptor, int32_t>;
|
||||
|
||||
using ownership_iterator = impl::DirectedEdgeIterator<vertex_iterator, children_iterator, LayoutGraphData>;
|
||||
using ownerships_size_type = edges_size_type;
|
||||
|
||||
// AddressableGraph help functions
|
||||
inline boost::container::pmr::vector<out_edge_type>& getChildrenList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<out_edge_type>& getChildrenList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<in_edge_type>& getParentsList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<in_edge_type>& getParentsList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
|
||||
// PolymorphicGraph
|
||||
using vertex_tag_type = boost::variant2::variant<GroupTag, ShaderTag>;
|
||||
using vertex_value_type = boost::variant2::variant<GroupNodeData*, ShaderNodeData*>;
|
||||
using vertex_const_value_type = boost::variant2::variant<const GroupNodeData*, const ShaderNodeData*>;
|
||||
using vertex_handle_type = boost::variant2::variant<
|
||||
impl::ValueHandle<GroupTag, vertex_descriptor>,
|
||||
impl::ValueHandle<ShaderTag, vertex_descriptor>>;
|
||||
|
||||
// ContinuousContainer
|
||||
void reserve(vertices_size_type sz);
|
||||
|
||||
// Members
|
||||
struct vertex_type { // NOLINT
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {outEdges.get_allocator().resource()};
|
||||
}
|
||||
|
||||
vertex_type(const allocator_type& alloc) noexcept; // NOLINT
|
||||
vertex_type(vertex_type&& rhs, const allocator_type& alloc);
|
||||
vertex_type(vertex_type const& rhs, const allocator_type& alloc);
|
||||
|
||||
vertex_type(vertex_type&& rhs) noexcept = default;
|
||||
vertex_type(vertex_type const& rhs) = delete;
|
||||
vertex_type& operator=(vertex_type&& rhs) = default;
|
||||
vertex_type& operator=(vertex_type const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<out_edge_type> outEdges;
|
||||
boost::container::pmr::vector<in_edge_type> inEdges;
|
||||
vertex_handle_type handle;
|
||||
};
|
||||
|
||||
struct NameTag {
|
||||
} static constexpr Name{}; // NOLINT
|
||||
struct UpdateTag {
|
||||
} static constexpr Update{}; // NOLINT
|
||||
struct LayoutTag {
|
||||
} static constexpr Layout{}; // NOLINT
|
||||
|
||||
// Vertices
|
||||
boost::container::pmr::vector<vertex_type> vertices;
|
||||
// Components
|
||||
boost::container::pmr::vector<std::string> names;
|
||||
boost::container::pmr::vector<UpdateFrequency> updateFrequencies;
|
||||
boost::container::pmr::vector<LayoutData> layouts;
|
||||
// PolymorphicGraph
|
||||
boost::container::pmr::vector<GroupNodeData> groupNodes;
|
||||
boost::container::pmr::vector<ShaderNodeData> shaderNodes;
|
||||
// Path
|
||||
PmrTransparentMap<std::string, vertex_descriptor> pathIndex;
|
||||
};
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,102 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <cocos/renderer/pipeline/custom/Utility.h>
|
||||
#include <boost/container/flat_map.hpp>
|
||||
#include <boost/container/pmr/flat_map.hpp>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
|
||||
// for std::less<> the transparent comparator
|
||||
// see https://stackoverflow.com/questions/20317413/what-are-transparent-comparators
|
||||
|
||||
namespace cc {
|
||||
|
||||
// map
|
||||
template <class Key, class Value>
|
||||
using TransparentMap = std::map<Key, Value, std::less<>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using TransparentMultiMap = std::multimap<Key, Value, std::less<>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using PmrTransparentMap = std::map<
|
||||
Key, Value, std::less<>,
|
||||
boost::container::pmr::polymorphic_allocator<std::pair<const Key, Value>>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using PmrTransparentMultiMap = std::multimap<
|
||||
Key, Value, std::less<>,
|
||||
boost::container::pmr::polymorphic_allocator<std::pair<const Key, Value>>>;
|
||||
|
||||
// flat_map
|
||||
template <class Key, class Value>
|
||||
using FlatMap = boost::container::flat_map<Key, Value, std::less<>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using FlatMultiMap = boost::container::flat_multimap<Key, Value, std::less<>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using PmrFlatMap = boost::container::pmr::flat_map<Key, Value, std::less<>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using PmrFlatMultiMap = boost::container::pmr::flat_multimap<Key, Value, std::less<>>;
|
||||
|
||||
// unordered_map
|
||||
template <class Key, class Value>
|
||||
using PmrUnorderedMap = std::unordered_map<
|
||||
Key, Value, std::hash<Key>, std::equal_to<Key>,
|
||||
boost::container::pmr::polymorphic_allocator<std::pair<const Key, Value>>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using PmrUnorderedMultiMap = std::unordered_multimap<
|
||||
Key, Value, std::hash<Key>, std::equal_to<Key>,
|
||||
boost::container::pmr::polymorphic_allocator<std::pair<const Key, Value>>>;
|
||||
|
||||
// transparent string unordered_map
|
||||
template <class Key, class Value>
|
||||
using UnorderedStringMap = std::unordered_map<
|
||||
Key, Value,
|
||||
TransparentStringHash<typename Key::value_type>, std::equal_to<>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using UnorderedStringMultiMap = std::unordered_multimap<
|
||||
Key, Value,
|
||||
TransparentStringHash<typename Key::value_type>, std::equal_to<>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using PmrUnorderedStringMap = std::unordered_map<
|
||||
Key, Value,
|
||||
TransparentStringHash<typename Key::value_type>, std::equal_to<>,
|
||||
boost::container::pmr::polymorphic_allocator<std::pair<const Key, Value>>>;
|
||||
|
||||
template <class Key, class Value>
|
||||
using PmrUnorderedStringMultiMap = std::unordered_multimap<
|
||||
Key, Value,
|
||||
TransparentStringHash<typename Key::value_type>, std::equal_to<>,
|
||||
boost::container::pmr::polymorphic_allocator<std::pair<const Key, Value>>>;
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <cocos/base/Variant.h>
|
||||
#include <boost/mp11/algorithm.hpp>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
|
||||
namespace cc {
|
||||
|
||||
// https://stackoverflow.com/questions/50510122/stdvariant-with-overloaded-lambdas-alternative-with-msvc
|
||||
|
||||
template <class... Ts>
|
||||
struct Overloaded {}; // NOLINT
|
||||
|
||||
template <class T0>
|
||||
struct Overloaded<T0> : T0 {
|
||||
using T0::operator();
|
||||
Overloaded(T0 t0) // NOLINT
|
||||
: T0(std::move(t0)) {}
|
||||
};
|
||||
|
||||
template <class T0, class T1, class... Ts>
|
||||
struct Overloaded<T0, T1, Ts...> : T0, Overloaded<T1, Ts...> {
|
||||
using T0:: operator();
|
||||
using Overloaded<T1, Ts...>::operator();
|
||||
Overloaded(T0 t0, T1 t1, Ts... ts)
|
||||
: T0(std::move(t0)), Overloaded<T1, Ts...>(std::move(t1), std::move(ts)...) {}
|
||||
};
|
||||
|
||||
template <class... Ts>
|
||||
Overloaded<Ts...> overload(Ts... ts) {
|
||||
return {std::move(ts)...};
|
||||
}
|
||||
|
||||
template <typename V>
|
||||
auto variantFromIndex(size_t index) -> V { // NOLINT
|
||||
return boost::mp11::mp_with_index<boost::mp11::mp_size<V>>(index,
|
||||
[](auto i) { return V(boost::variant2::in_place_index<i>); });
|
||||
}
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,89 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <cocos/renderer/pipeline/custom/GslUtils.h>
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
namespace impl {
|
||||
|
||||
template <class CharT, class Allocator>
|
||||
inline void cleanPath(std::basic_string<CharT, std::char_traits<CharT>, Allocator> &str) noexcept {
|
||||
using string_t = std::basic_string<CharT, std::char_traits<CharT>, Allocator>;
|
||||
constexpr CharT slash[] = {'/', '\0'};
|
||||
constexpr CharT doubleSlash[] = {'/', '/', '\0'};
|
||||
|
||||
CC_EXPECTS(!str.empty());
|
||||
CC_EXPECTS(boost::algorithm::starts_with(str, boost::string_view(slash)));
|
||||
CC_EXPECTS(str.find(doubleSlash) == string_t::npos);
|
||||
CC_EXPECTS([&]() { // NOLINT
|
||||
bool valid = true;
|
||||
for (uint8_t c : str) {
|
||||
if (c < uint8_t('.'))
|
||||
valid = false;
|
||||
}
|
||||
return valid;
|
||||
}());
|
||||
|
||||
{ // remove all /./
|
||||
constexpr CharT current[] = {'/', '.', '/', '\0'};
|
||||
|
||||
auto pos = str.rfind(current);
|
||||
while (pos != string_t::npos) {
|
||||
str.erase(pos, 2);
|
||||
pos = str.rfind(current);
|
||||
}
|
||||
// remove tailing /.
|
||||
constexpr CharT ending[] = {'/', '.', '\0'};
|
||||
if (boost::algorithm::ends_with(str, boost::string_view(ending))) {
|
||||
str.resize(str.size() - 2);
|
||||
}
|
||||
}
|
||||
|
||||
// try remove /..
|
||||
constexpr std::array<CharT, 4> previous = {CharT('/'), CharT('.'), CharT('.'), CharT('\0')};
|
||||
auto pos = str.find(previous.data());
|
||||
while (pos != string_t::npos) {
|
||||
if (pos == 0) {
|
||||
// root element has not parent path
|
||||
str = {}; // slash;
|
||||
return;
|
||||
}
|
||||
auto beg = str.rfind(slash, pos - 1);
|
||||
CC_EXPECTS(beg != string_t::npos);
|
||||
str.erase(beg, pos - beg + previous.size() - 1);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace impl
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,37 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <boost/range/iterator_range.hpp>
|
||||
|
||||
namespace cc {
|
||||
|
||||
template <class IteratorT>
|
||||
inline boost::iterator_range<IteratorT>
|
||||
makeRange(const std::pair<IteratorT, IteratorT> &p) noexcept { // NOLINT
|
||||
return boost::make_iterator_range(p.first, p.second);
|
||||
}
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,132 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/variant2/variant.hpp>
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
enum class UpdateFrequency;
|
||||
|
||||
struct CBVTag;
|
||||
struct UAVTag;
|
||||
struct SRVTag;
|
||||
struct SSVTag;
|
||||
struct RTVTag;
|
||||
struct DSVTag;
|
||||
struct IBVTag;
|
||||
struct VBVTag;
|
||||
struct SOVTag;
|
||||
struct ConstantsTag;
|
||||
struct TableTag;
|
||||
|
||||
using ParameterType = boost::variant2::variant<ConstantsTag, CBVTag, UAVTag, SRVTag, TableTag, SSVTag>;
|
||||
|
||||
struct BoundedTag;
|
||||
struct UnboundedTag;
|
||||
|
||||
using Boundedness = boost::variant2::variant<BoundedTag, UnboundedTag>;
|
||||
|
||||
struct CBufferTag;
|
||||
struct BufferTag;
|
||||
struct TextureTag;
|
||||
struct RWBufferTag;
|
||||
struct RWTextureTag;
|
||||
struct SamplerTag;
|
||||
struct Texture1DTag;
|
||||
struct Texture1DArrayTag;
|
||||
struct Texture2DTag;
|
||||
struct Texture2DArrayTag;
|
||||
struct Texture2DMSTag;
|
||||
struct Texture2DMSArrayTag;
|
||||
struct Texture3DTag;
|
||||
struct TextureCubeTag;
|
||||
struct TextureCubeArrayTag;
|
||||
struct RaytracingAccelerationStructureTag;
|
||||
struct SamplerStateTag;
|
||||
struct SamplerComparisonStateTag;
|
||||
|
||||
using ResourceType = boost::variant2::variant<ConstantsTag, BufferTag, Texture1DTag, Texture1DArrayTag, Texture2DTag, Texture2DArrayTag, Texture2DMSTag, Texture2DMSArrayTag, Texture3DTag, TextureCubeTag, TextureCubeArrayTag, RaytracingAccelerationStructureTag, SamplerStateTag, SamplerComparisonStateTag>;
|
||||
|
||||
struct TypelessTag;
|
||||
struct Float4Tag;
|
||||
struct Float3Tag;
|
||||
struct Float2Tag;
|
||||
struct Float1Tag;
|
||||
struct Half4Tag;
|
||||
struct Half3Tag;
|
||||
struct Half2Tag;
|
||||
struct Half1Tag;
|
||||
struct Fixed4Tag;
|
||||
struct Fixed3Tag;
|
||||
struct Fixed2Tag;
|
||||
struct Fixed1Tag;
|
||||
struct Uint4Tag;
|
||||
struct Uint3Tag;
|
||||
struct Uint2Tag;
|
||||
struct Uint1Tag;
|
||||
struct Int4Tag;
|
||||
struct Int3Tag;
|
||||
struct Int2Tag;
|
||||
struct Int1Tag;
|
||||
struct Bool4Tag;
|
||||
struct Bool3Tag;
|
||||
struct Bool2Tag;
|
||||
struct Bool1Tag;
|
||||
|
||||
using ValueType = boost::variant2::variant<TypelessTag, Float4Tag, Float3Tag, Float2Tag, Float1Tag, Half4Tag, Half3Tag, Half2Tag, Half1Tag, Fixed4Tag, Fixed3Tag, Fixed2Tag, Fixed1Tag, Uint4Tag, Uint3Tag, Uint2Tag, Uint1Tag, Int4Tag, Int3Tag, Int2Tag, Int1Tag, Bool4Tag, Bool3Tag, Bool2Tag, Bool1Tag>;
|
||||
|
||||
struct RasterTag;
|
||||
struct ComputeTag;
|
||||
struct CopyTag;
|
||||
struct MoveTag;
|
||||
struct RaytraceTag;
|
||||
struct ManagedTag;
|
||||
struct PersistentTag;
|
||||
struct BackbufferTag;
|
||||
struct MemorylessTag;
|
||||
|
||||
using ResourceResidency = boost::variant2::variant<ManagedTag, PersistentTag, BackbufferTag, MemorylessTag>;
|
||||
|
||||
enum class QueueHint;
|
||||
enum class ResourceDimension;
|
||||
|
||||
struct SampleDesc;
|
||||
|
||||
enum class NodeType;
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "cocos/renderer/pipeline/custom/JsbConversion.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonJsb.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/bindings/manual/jsb_conversions.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonFwd.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,146 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonTypes.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
inline const char* getName(UpdateFrequency e) noexcept {
|
||||
switch (e) {
|
||||
case UpdateFrequency::PER_INSTANCE: return "PER_INSTANCE";
|
||||
case UpdateFrequency::PER_BATCH: return "PER_BATCH";
|
||||
case UpdateFrequency::PER_QUEUE: return "PER_QUEUE";
|
||||
case UpdateFrequency::PER_PASS: return "PER_PASS";
|
||||
case UpdateFrequency::COUNT: return "COUNT";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
inline const char* getName(const CBVTag& /*v*/) noexcept { return "CBV"; }
|
||||
inline const char* getName(const UAVTag& /*v*/) noexcept { return "UAV"; }
|
||||
inline const char* getName(const SRVTag& /*v*/) noexcept { return "SRV"; }
|
||||
inline const char* getName(const SSVTag& /*v*/) noexcept { return "SSV"; }
|
||||
inline const char* getName(const RTVTag& /*v*/) noexcept { return "RTV"; }
|
||||
inline const char* getName(const DSVTag& /*v*/) noexcept { return "DSV"; }
|
||||
inline const char* getName(const IBVTag& /*v*/) noexcept { return "IBV"; }
|
||||
inline const char* getName(const VBVTag& /*v*/) noexcept { return "VBV"; }
|
||||
inline const char* getName(const SOVTag& /*v*/) noexcept { return "SOV"; }
|
||||
inline const char* getName(const ConstantsTag& /*v*/) noexcept { return "Constants"; }
|
||||
inline const char* getName(const TableTag& /*v*/) noexcept { return "Table"; }
|
||||
inline const char* getName(const BoundedTag& /*v*/) noexcept { return "Bounded"; }
|
||||
inline const char* getName(const UnboundedTag& /*v*/) noexcept { return "Unbounded"; }
|
||||
inline const char* getName(const CBufferTag& /*v*/) noexcept { return "CBuffer"; }
|
||||
inline const char* getName(const BufferTag& /*v*/) noexcept { return "Buffer"; }
|
||||
inline const char* getName(const TextureTag& /*v*/) noexcept { return "Texture"; }
|
||||
inline const char* getName(const RWBufferTag& /*v*/) noexcept { return "RWBuffer"; }
|
||||
inline const char* getName(const RWTextureTag& /*v*/) noexcept { return "RWTexture"; }
|
||||
inline const char* getName(const SamplerTag& /*v*/) noexcept { return "Sampler"; }
|
||||
inline const char* getName(const Texture1DTag& /*v*/) noexcept { return "Texture1D"; }
|
||||
inline const char* getName(const Texture1DArrayTag& /*v*/) noexcept { return "Texture1DArray"; }
|
||||
inline const char* getName(const Texture2DTag& /*v*/) noexcept { return "Texture2D"; }
|
||||
inline const char* getName(const Texture2DArrayTag& /*v*/) noexcept { return "Texture2DArray"; }
|
||||
inline const char* getName(const Texture2DMSTag& /*v*/) noexcept { return "Texture2DMS"; }
|
||||
inline const char* getName(const Texture2DMSArrayTag& /*v*/) noexcept { return "Texture2DMSArray"; }
|
||||
inline const char* getName(const Texture3DTag& /*v*/) noexcept { return "Texture3D"; }
|
||||
inline const char* getName(const TextureCubeTag& /*v*/) noexcept { return "TextureCube"; }
|
||||
inline const char* getName(const TextureCubeArrayTag& /*v*/) noexcept { return "TextureCubeArray"; }
|
||||
inline const char* getName(const RaytracingAccelerationStructureTag& /*v*/) noexcept { return "RaytracingAccelerationStructure"; }
|
||||
inline const char* getName(const SamplerStateTag& /*v*/) noexcept { return "SamplerState"; }
|
||||
inline const char* getName(const SamplerComparisonStateTag& /*v*/) noexcept { return "SamplerComparisonState"; }
|
||||
inline const char* getName(const TypelessTag& /*v*/) noexcept { return "Typeless"; }
|
||||
inline const char* getName(const Float4Tag& /*v*/) noexcept { return "Float4"; }
|
||||
inline const char* getName(const Float3Tag& /*v*/) noexcept { return "Float3"; }
|
||||
inline const char* getName(const Float2Tag& /*v*/) noexcept { return "Float2"; }
|
||||
inline const char* getName(const Float1Tag& /*v*/) noexcept { return "Float1"; }
|
||||
inline const char* getName(const Half4Tag& /*v*/) noexcept { return "Half4"; }
|
||||
inline const char* getName(const Half3Tag& /*v*/) noexcept { return "Half3"; }
|
||||
inline const char* getName(const Half2Tag& /*v*/) noexcept { return "Half2"; }
|
||||
inline const char* getName(const Half1Tag& /*v*/) noexcept { return "Half1"; }
|
||||
inline const char* getName(const Fixed4Tag& /*v*/) noexcept { return "Fixed4"; }
|
||||
inline const char* getName(const Fixed3Tag& /*v*/) noexcept { return "Fixed3"; }
|
||||
inline const char* getName(const Fixed2Tag& /*v*/) noexcept { return "Fixed2"; }
|
||||
inline const char* getName(const Fixed1Tag& /*v*/) noexcept { return "Fixed1"; }
|
||||
inline const char* getName(const Uint4Tag& /*v*/) noexcept { return "Uint4"; }
|
||||
inline const char* getName(const Uint3Tag& /*v*/) noexcept { return "Uint3"; }
|
||||
inline const char* getName(const Uint2Tag& /*v*/) noexcept { return "Uint2"; }
|
||||
inline const char* getName(const Uint1Tag& /*v*/) noexcept { return "Uint1"; }
|
||||
inline const char* getName(const Int4Tag& /*v*/) noexcept { return "Int4"; }
|
||||
inline const char* getName(const Int3Tag& /*v*/) noexcept { return "Int3"; }
|
||||
inline const char* getName(const Int2Tag& /*v*/) noexcept { return "Int2"; }
|
||||
inline const char* getName(const Int1Tag& /*v*/) noexcept { return "Int1"; }
|
||||
inline const char* getName(const Bool4Tag& /*v*/) noexcept { return "Bool4"; }
|
||||
inline const char* getName(const Bool3Tag& /*v*/) noexcept { return "Bool3"; }
|
||||
inline const char* getName(const Bool2Tag& /*v*/) noexcept { return "Bool2"; }
|
||||
inline const char* getName(const Bool1Tag& /*v*/) noexcept { return "Bool1"; }
|
||||
inline const char* getName(const RasterTag& /*v*/) noexcept { return "Raster"; }
|
||||
inline const char* getName(const ComputeTag& /*v*/) noexcept { return "Compute"; }
|
||||
inline const char* getName(const CopyTag& /*v*/) noexcept { return "Copy"; }
|
||||
inline const char* getName(const MoveTag& /*v*/) noexcept { return "Move"; }
|
||||
inline const char* getName(const RaytraceTag& /*v*/) noexcept { return "Raytrace"; }
|
||||
inline const char* getName(const ManagedTag& /*v*/) noexcept { return "Managed"; }
|
||||
inline const char* getName(const PersistentTag& /*v*/) noexcept { return "Persistent"; }
|
||||
inline const char* getName(const BackbufferTag& /*v*/) noexcept { return "Backbuffer"; }
|
||||
inline const char* getName(const MemorylessTag& /*v*/) noexcept { return "Memoryless"; }
|
||||
inline const char* getName(QueueHint e) noexcept {
|
||||
switch (e) {
|
||||
case QueueHint::NONE: return "NONE";
|
||||
case QueueHint::RENDER_OPAQUE: return "RENDER_OPAQUE";
|
||||
case QueueHint::RENDER_CUTOUT: return "RENDER_CUTOUT";
|
||||
case QueueHint::RENDER_TRANSPARENT: return "RENDER_TRANSPARENT";
|
||||
case QueueHint::COUNT: return "COUNT";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
inline const char* getName(ResourceDimension e) noexcept {
|
||||
switch (e) {
|
||||
case ResourceDimension::BUFFER: return "BUFFER";
|
||||
case ResourceDimension::TEXTURE1D: return "TEXTURE1D";
|
||||
case ResourceDimension::TEXTURE2D: return "TEXTURE2D";
|
||||
case ResourceDimension::TEXTURE3D: return "TEXTURE3D";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
inline const char* getName(const SampleDesc& /*v*/) noexcept { return "SampleDesc"; }
|
||||
inline const char* getName(NodeType e) noexcept {
|
||||
switch (e) {
|
||||
case NodeType::INTERNAL: return "INTERNAL";
|
||||
case NodeType::LEAF: return "LEAF";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderCommonReflection.h"
|
||||
#include "RenderCommonTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonFwd.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,34 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderCommonTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,180 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonFwd.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
enum class UpdateFrequency {
|
||||
PER_INSTANCE,
|
||||
PER_BATCH,
|
||||
PER_QUEUE,
|
||||
PER_PASS,
|
||||
COUNT,
|
||||
};
|
||||
|
||||
struct CBVTag {};
|
||||
struct UAVTag {};
|
||||
struct SRVTag {};
|
||||
struct SSVTag {};
|
||||
struct RTVTag {};
|
||||
struct DSVTag {};
|
||||
struct IBVTag {};
|
||||
struct VBVTag {};
|
||||
struct SOVTag {};
|
||||
struct ConstantsTag {};
|
||||
struct TableTag {};
|
||||
|
||||
using ParameterType = boost::variant2::variant<ConstantsTag, CBVTag, UAVTag, SRVTag, TableTag, SSVTag>;
|
||||
|
||||
inline bool operator<(const ParameterType& lhs, const ParameterType& rhs) noexcept {
|
||||
return lhs.index() < rhs.index();
|
||||
}
|
||||
|
||||
inline bool operator==(const ParameterType& lhs, const ParameterType& rhs) noexcept {
|
||||
return lhs.index() == rhs.index();
|
||||
}
|
||||
|
||||
inline bool operator!=(const ParameterType& lhs, const ParameterType& rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
struct BoundedTag {};
|
||||
struct UnboundedTag {};
|
||||
|
||||
using Boundedness = boost::variant2::variant<BoundedTag, UnboundedTag>;
|
||||
|
||||
inline bool operator<(const Boundedness& lhs, const Boundedness& rhs) noexcept {
|
||||
return lhs.index() < rhs.index();
|
||||
}
|
||||
|
||||
inline bool operator==(const Boundedness& lhs, const Boundedness& rhs) noexcept {
|
||||
return lhs.index() == rhs.index();
|
||||
}
|
||||
|
||||
inline bool operator!=(const Boundedness& lhs, const Boundedness& rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
struct CBufferTag {};
|
||||
struct BufferTag {};
|
||||
struct TextureTag {};
|
||||
struct RWBufferTag {};
|
||||
struct RWTextureTag {};
|
||||
struct SamplerTag {};
|
||||
struct Texture1DTag {};
|
||||
struct Texture1DArrayTag {};
|
||||
struct Texture2DTag {};
|
||||
struct Texture2DArrayTag {};
|
||||
struct Texture2DMSTag {};
|
||||
struct Texture2DMSArrayTag {};
|
||||
struct Texture3DTag {};
|
||||
struct TextureCubeTag {};
|
||||
struct TextureCubeArrayTag {};
|
||||
struct RaytracingAccelerationStructureTag {};
|
||||
struct SamplerStateTag {};
|
||||
struct SamplerComparisonStateTag {};
|
||||
|
||||
using ResourceType = boost::variant2::variant<ConstantsTag, BufferTag, Texture1DTag, Texture1DArrayTag, Texture2DTag, Texture2DArrayTag, Texture2DMSTag, Texture2DMSArrayTag, Texture3DTag, TextureCubeTag, TextureCubeArrayTag, RaytracingAccelerationStructureTag, SamplerStateTag, SamplerComparisonStateTag>;
|
||||
|
||||
struct TypelessTag {};
|
||||
struct Float4Tag {};
|
||||
struct Float3Tag {};
|
||||
struct Float2Tag {};
|
||||
struct Float1Tag {};
|
||||
struct Half4Tag {};
|
||||
struct Half3Tag {};
|
||||
struct Half2Tag {};
|
||||
struct Half1Tag {};
|
||||
struct Fixed4Tag {};
|
||||
struct Fixed3Tag {};
|
||||
struct Fixed2Tag {};
|
||||
struct Fixed1Tag {};
|
||||
struct Uint4Tag {};
|
||||
struct Uint3Tag {};
|
||||
struct Uint2Tag {};
|
||||
struct Uint1Tag {};
|
||||
struct Int4Tag {};
|
||||
struct Int3Tag {};
|
||||
struct Int2Tag {};
|
||||
struct Int1Tag {};
|
||||
struct Bool4Tag {};
|
||||
struct Bool3Tag {};
|
||||
struct Bool2Tag {};
|
||||
struct Bool1Tag {};
|
||||
|
||||
using ValueType = boost::variant2::variant<TypelessTag, Float4Tag, Float3Tag, Float2Tag, Float1Tag, Half4Tag, Half3Tag, Half2Tag, Half1Tag, Fixed4Tag, Fixed3Tag, Fixed2Tag, Fixed1Tag, Uint4Tag, Uint3Tag, Uint2Tag, Uint1Tag, Int4Tag, Int3Tag, Int2Tag, Int1Tag, Bool4Tag, Bool3Tag, Bool2Tag, Bool1Tag>;
|
||||
|
||||
struct RasterTag {};
|
||||
struct ComputeTag {};
|
||||
struct CopyTag {};
|
||||
struct MoveTag {};
|
||||
struct RaytraceTag {};
|
||||
struct ManagedTag {};
|
||||
struct PersistentTag {};
|
||||
struct BackbufferTag {};
|
||||
struct MemorylessTag {};
|
||||
|
||||
using ResourceResidency = boost::variant2::variant<ManagedTag, PersistentTag, BackbufferTag, MemorylessTag>;
|
||||
|
||||
enum class QueueHint {
|
||||
NONE,
|
||||
RENDER_OPAQUE,
|
||||
RENDER_CUTOUT,
|
||||
RENDER_TRANSPARENT,
|
||||
COUNT,
|
||||
};
|
||||
|
||||
enum class ResourceDimension {
|
||||
BUFFER,
|
||||
TEXTURE1D,
|
||||
TEXTURE2D,
|
||||
TEXTURE3D,
|
||||
};
|
||||
|
||||
struct SampleDesc {
|
||||
uint32_t count{1};
|
||||
uint32_t quality{0};
|
||||
};
|
||||
|
||||
enum class NodeType {
|
||||
INTERNAL,
|
||||
LEAF,
|
||||
};
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,47 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphFwd.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
struct RenderCompiler;
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,41 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/utility/string_view.hpp>
|
||||
#include "cocos/renderer/pipeline/custom/GraphImpl.h"
|
||||
#include "cocos/renderer/pipeline/custom/GslUtils.h"
|
||||
#include "cocos/renderer/pipeline/custom/Overload.h"
|
||||
#include "cocos/renderer/pipeline/custom/PathUtils.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCompilerTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/invoke.hpp"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,41 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "RenderCompilerGraphs.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
int RenderCompiler::compile() {
|
||||
auto& rg = graph;
|
||||
const auto& resg = resourceGraph;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,47 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphNames.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCompilerTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphNames.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
inline const char* getName(const RenderCompiler& /*v*/) noexcept { return "RenderCompiler"; }
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderCompilerReflection.h"
|
||||
#include "RenderCompilerTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,37 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphReflection.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCompilerFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphReflection.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,34 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderCompilerTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,65 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCompilerFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/String.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
struct RenderCompiler {
|
||||
RenderCompiler(ResourceGraph& resourceGraphIn, RenderGraph& graphIn, LayoutGraphData& layoutGraphIn, boost::container::pmr::memory_resource* scratchIn) noexcept
|
||||
: resourceGraph(resourceGraphIn),
|
||||
graph(graphIn),
|
||||
layoutGraph(layoutGraphIn),
|
||||
scratch(scratchIn) {}
|
||||
RenderCompiler(RenderCompiler&& rhs) = delete;
|
||||
RenderCompiler(RenderCompiler const& rhs) = delete;
|
||||
RenderCompiler& operator=(RenderCompiler&& rhs) = delete;
|
||||
RenderCompiler& operator=(RenderCompiler const& rhs) = delete;
|
||||
|
||||
int compile();
|
||||
|
||||
ResourceGraph& resourceGraph;
|
||||
RenderGraph& graph;
|
||||
LayoutGraphData& layoutGraph;
|
||||
boost::container::pmr::memory_resource* scratch{nullptr};
|
||||
};
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,68 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphFwd.h"
|
||||
#include <functional>
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
namespace example {
|
||||
|
||||
enum class DependencyType;
|
||||
|
||||
struct RenderPassNode;
|
||||
struct RenderPassTraits;
|
||||
struct RenderDependencyGraph;
|
||||
struct RenderValueNode;
|
||||
struct RenderValueGraph;
|
||||
struct RenderCompiler;
|
||||
|
||||
} // namespace example
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
namespace std {
|
||||
|
||||
template <>
|
||||
struct hash<cc::render::example::RenderValueNode> {
|
||||
size_t operator()(const cc::render::example::RenderValueNode& v) const noexcept;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,505 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include <cocos/renderer/pipeline/custom/Range.h>
|
||||
#include <boost/graph/depth_first_search.hpp>
|
||||
#include <boost/graph/reverse_graph.hpp>
|
||||
#include <tuple>
|
||||
#include "RenderExampleGraphs.h"
|
||||
#include "RenderGraphGraphs.h"
|
||||
#include "LayoutGraphGraphs.h"
|
||||
#include "LayoutGraphTypes.h"
|
||||
#include "RenderCommonTypes.h"
|
||||
#include "RenderExampleTypes.h"
|
||||
#include "RenderGraphFwd.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
namespace example {
|
||||
|
||||
using RDG = RenderDependencyGraph;
|
||||
using RESG = ResourceGraph;
|
||||
|
||||
namespace {
|
||||
|
||||
// validation
|
||||
void checkComputeValue(const PmrTransparentMap<PmrString, boost::container::pmr::vector<ComputeView>>& values0) {
|
||||
for (const auto& pair : values0) {
|
||||
const auto& name = pair.first;
|
||||
const auto& values = pair.second;
|
||||
bool bWrite = false;
|
||||
int count = 0;
|
||||
for (const auto& v : values) {
|
||||
if (v.clearFlags != gfx::ClearFlagBit::NONE) {
|
||||
if (!v.isWrite()) {
|
||||
throw std::invalid_argument("only write state support uav clear");
|
||||
}
|
||||
}
|
||||
if (count++ == 0) {
|
||||
bWrite = v.isWrite();
|
||||
} else {
|
||||
if (v.isWrite() != bWrite) {
|
||||
throw std::invalid_argument("compute value read/write state inconsistent");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
int RenderCompiler::validate() const {
|
||||
const auto& rg = graph;
|
||||
const auto& lg = layoutGraph;
|
||||
try {
|
||||
for (const auto& vertID : makeRange(vertices(rg))) {
|
||||
visitObject(
|
||||
vertID, rg,
|
||||
[&](const RasterPass& pass) {
|
||||
checkComputeValue(pass.computeViews);
|
||||
},
|
||||
[&](const ComputePass& pass) {
|
||||
checkComputeValue(pass.computeViews);
|
||||
},
|
||||
[&](const auto& /*pass*/) {
|
||||
});
|
||||
}
|
||||
} catch (const std::invalid_argument&) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int RenderCompiler::audit(std::ostream& oss) const { // NOLINT
|
||||
return 0;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
void addPassNodeValue(RenderPassNode& node, PmrFlatSet<uint32_t>& values,
|
||||
const uint32_t valueID, AccessType type) {
|
||||
// add to values
|
||||
values.emplace(valueID);
|
||||
// add to inputs and outputs
|
||||
// inputs and outputs may overlap
|
||||
switch (type) {
|
||||
case AccessType::READ:
|
||||
node.inputs.emplace(valueID);
|
||||
break;
|
||||
case AccessType::READ_WRITE:
|
||||
node.outputs.emplace(valueID);
|
||||
node.inputs.emplace(valueID);
|
||||
break;
|
||||
case AccessType::WRITE:
|
||||
node.outputs.emplace(valueID);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void addPassNodeValue(RenderDependencyGraph& rdg,
|
||||
RenderPassNode& node, PmrFlatSet<uint32_t>& values,
|
||||
const PmrString& valueName, AccessType type) {
|
||||
auto iter = rdg.valueIndex.find(valueName);
|
||||
if (iter == rdg.valueIndex.end()) {
|
||||
rdg.valueIndex.emplace(valueName, uint32_t(rdg.valueNames.size()));
|
||||
rdg.valueNames.emplace_back(valueName);
|
||||
CC_ENSURES(rdg.valueIndex.size() == rdg.valueNames.size());
|
||||
}
|
||||
addPassNodeValue(node, values, iter->second, type);
|
||||
}
|
||||
|
||||
void buildRenderDependencyGraph(const RenderGraph& rg, RenderDependencyGraph& rdg) {
|
||||
size_t numPasses = 1; // additional init pass is the first pass
|
||||
numPasses += rg.rasterPasses.size();
|
||||
numPasses += rg.computePasses.size();
|
||||
numPasses += rg.copyPasses.size();
|
||||
numPasses += rg.movePasses.size();
|
||||
numPasses += rg.raytracePasses.size();
|
||||
rdg.passIDs.reserve(numPasses);
|
||||
rdg.valueIndex.reserve(128);
|
||||
rdg.valueNames.reserve(128);
|
||||
|
||||
// add initial pass, whose id must be 0
|
||||
auto startID = add_vertex(rdg, 0xFFFFFFFF);
|
||||
CC_EXPECTS(startID == 0);
|
||||
|
||||
auto makeAccessType = [](const boost::container::pmr::vector<ComputeView>& values) {
|
||||
CC_EXPECTS(!values.empty());
|
||||
AccessType type = values[0].accessType;
|
||||
for (uint32_t i = 1; i != values.size(); ++i) {
|
||||
const auto& value = values[i];
|
||||
if (value.isRead()) {
|
||||
if (type == AccessType::WRITE) {
|
||||
type = AccessType::READ_WRITE;
|
||||
}
|
||||
}
|
||||
if (value.isWrite()) {
|
||||
if (type == AccessType::READ) {
|
||||
type = AccessType::READ_WRITE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return type;
|
||||
};
|
||||
|
||||
for (const auto passID : makeRange(vertices(rg))) {
|
||||
visitObject(
|
||||
passID, rg,
|
||||
[&](const RasterPass& pass) {
|
||||
auto vertID = add_vertex(rdg, passID);
|
||||
auto& node = get(RDG::Pass, rdg, vertID);
|
||||
auto& valueIDs = get(RDG::ValueID, rdg, vertID);
|
||||
for (const auto& pair : pass.rasterViews) {
|
||||
const auto& valueName = pair.first;
|
||||
const auto& value = pair.second;
|
||||
addPassNodeValue(rdg, node, valueIDs, valueName, value.accessType);
|
||||
}
|
||||
for (const auto& pair : pass.computeViews) {
|
||||
const auto& valueName = pair.first;
|
||||
const auto& values = pair.second;
|
||||
addPassNodeValue(rdg, node, valueIDs, valueName, makeAccessType(values));
|
||||
}
|
||||
},
|
||||
[&](const ComputePass& pass) {
|
||||
auto vertID = add_vertex(rdg, passID);
|
||||
auto& node = get(RDG::Pass, rdg, vertID);
|
||||
auto& valueIDs = get(RDG::ValueID, rdg, vertID);
|
||||
for (const auto& pair : pass.computeViews) {
|
||||
const auto& valueName = pair.first;
|
||||
const auto& values = pair.second;
|
||||
addPassNodeValue(rdg, node, valueIDs, valueName, makeAccessType(values));
|
||||
}
|
||||
},
|
||||
[&](const CopyPass& pass) {
|
||||
auto vertID = add_vertex(rdg, passID);
|
||||
auto& node = get(RDG::Pass, rdg, vertID);
|
||||
auto& valueIDs = get(RDG::ValueID, rdg, vertID);
|
||||
|
||||
for (const auto& pair : pass.copyPairs) {
|
||||
addPassNodeValue(rdg, node, valueIDs, pair.source, AccessType::READ);
|
||||
addPassNodeValue(rdg, node, valueIDs, pair.target, AccessType::WRITE);
|
||||
}
|
||||
},
|
||||
[&](const MovePass& pass) {
|
||||
auto vertID = add_vertex(rdg, passID);
|
||||
auto& node = get(RDG::Pass, rdg, vertID);
|
||||
auto& valueIDs = get(RDG::ValueID, rdg, vertID);
|
||||
|
||||
for (const auto& pair : pass.movePairs) {
|
||||
addPassNodeValue(rdg, node, valueIDs, pair.source, AccessType::READ);
|
||||
addPassNodeValue(rdg, node, valueIDs, pair.target, AccessType::WRITE);
|
||||
}
|
||||
},
|
||||
[&](const RaytracePass& pass) {
|
||||
auto vertID = add_vertex(rdg, passID);
|
||||
auto& node = get(RDG::Pass, rdg, vertID);
|
||||
auto& valueIDs = get(RDG::ValueID, rdg, vertID);
|
||||
for (const auto& pair : pass.computeViews) {
|
||||
const auto& valueName = pair.first;
|
||||
const auto& values = pair.second;
|
||||
addPassNodeValue(rdg, node, valueIDs, valueName, makeAccessType(values));
|
||||
}
|
||||
},
|
||||
[&](const PresentPass& pass) {
|
||||
auto vertID = add_vertex(rdg, passID);
|
||||
auto& node = get(RDG::Pass, rdg, vertID);
|
||||
auto& valueIDs = get(RDG::ValueID, rdg, vertID);
|
||||
|
||||
addPassNodeValue(rdg, node, valueIDs, pass.resourceName, AccessType::READ);
|
||||
},
|
||||
[&](const auto& /*pass*/) {
|
||||
// do nothing
|
||||
});
|
||||
}
|
||||
CC_ENSURES(num_vertices(rdg) == numPasses);
|
||||
}
|
||||
|
||||
void buildRenderValueGraphAndInitialPass(RenderDependencyGraph& rdg, RenderValueGraph& rvg) {
|
||||
// add value graph nodes
|
||||
uint32_t numValues = 0;
|
||||
for (const auto& valueIDs : rdg.valueIDs) {
|
||||
numValues += gsl::narrow_cast<uint32_t>(valueIDs.size());
|
||||
}
|
||||
rvg.reserve(numValues);
|
||||
|
||||
for (const auto passID : makeRange(vertices(rdg))) {
|
||||
const auto& valueIDs = get(RDG::ValueID, rdg, passID);
|
||||
for (const auto& valueID : valueIDs) {
|
||||
CC_EXPECTS(!contains(RenderValueNode(passID, valueID), rvg));
|
||||
add_vertex(std::piecewise_construct,
|
||||
std::forward_as_tuple(passID, valueID), rvg);
|
||||
}
|
||||
}
|
||||
|
||||
// build value graph edges
|
||||
auto initPassID = vertex(0xFFFFFFFF, rdg);
|
||||
CC_EXPECTS(initPassID == 0);
|
||||
auto& initPass = get(RDG::Pass, rdg, initPassID);
|
||||
auto& initValueIDs = get(RDG::ValueID, rdg, initPassID);
|
||||
|
||||
for (uint32_t dstPassID = num_vertices(rdg); dstPassID-- > 0;) {
|
||||
auto& dstPass = get(RDG::Pass, rdg, dstPassID);
|
||||
for (const auto valueID : dstPass.inputs) {
|
||||
auto dstVertID = vertex(RenderValueNode(dstPassID, valueID), rvg);
|
||||
CC_EXPECTS(in_degree(dstVertID, rvg) == 0);
|
||||
// add value edge func
|
||||
auto addValueEdge = [&rdg, &rvg, dstVertID, valueID](
|
||||
RenderDependencyGraph::vertex_descriptor srcPassID,
|
||||
RenderDependencyGraph::vertex_descriptor dstPassID) {
|
||||
// get value node in value graph
|
||||
auto srcVertID = vertex(RenderValueNode(srcPassID, valueID), rvg);
|
||||
CC_EXPECTS(!edge(srcVertID, dstVertID, rvg).second); // edge shouldn't have been added
|
||||
// add value edge
|
||||
auto res = add_edge(srcVertID, dstVertID, rvg);
|
||||
CC_ENSURES(res.second); // edge must have been added
|
||||
// try get pass dependency edge
|
||||
auto e = edge(srcPassID, dstPassID, rdg);
|
||||
if (!e.second) { // no pass dependency edge, add one
|
||||
add_edge(srcPassID, dstPassID, rdg, DependencyType::DATA);
|
||||
} else {
|
||||
// upgrade dependency type to DependencyType::Value
|
||||
put(boost::edge_bundle, rdg, e.first, DependencyType::DATA);
|
||||
}
|
||||
};
|
||||
|
||||
// try finding matching value in upstream render passes
|
||||
bool found = false;
|
||||
for (uint32_t srcPassID = dstPassID; srcPassID-- > 0;) {
|
||||
auto& srcPass = get(RDG::Pass, rdg, srcPassID);
|
||||
// value not found in source pass
|
||||
if (!srcPass.outputs.contains(valueID)) {
|
||||
continue;
|
||||
}
|
||||
// value is in source pass
|
||||
addValueEdge(srcPassID, dstPassID);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
if (!found) { // input value not found, add it to initial pass
|
||||
// add init value nodes
|
||||
addPassNodeValue(initPass, initValueIDs, valueID, AccessType::WRITE);
|
||||
addValueEdge(initPassID, dstPassID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void buildRenderDependencyGraphResourceIndex(const ResourceGraph& resg, RenderDependencyGraph& rdg) {
|
||||
CC_EXPECTS(rdg.valueNames.size() == rdg.valueIndex.size());
|
||||
|
||||
rdg.resourceHandles.resize(rdg.valueNames.size());
|
||||
|
||||
uint32_t valueID = 0;
|
||||
for (const auto& valueName : rdg.valueNames) {
|
||||
auto handleID = vertex(valueName, resg);
|
||||
rdg.resourceHandles[valueID] = handleID;
|
||||
++valueID;
|
||||
}
|
||||
}
|
||||
|
||||
struct CullingVisitor : boost::dfs_visitor<> {
|
||||
CullingVisitor(
|
||||
const ResourceGraph& resg0,
|
||||
const RenderGraph& rg0,
|
||||
const RenderDependencyGraph& rdg0,
|
||||
|
||||
boost::property_map<RenderDependencyGraph, RenderDependencyGraph::PassTag>::const_type passes,
|
||||
boost::property_map<RenderDependencyGraph, RenderDependencyGraph::ValueIDTag>::const_type valueIDs,
|
||||
boost::property_map<RenderDependencyGraph, RenderDependencyGraph::PassIDTag>::const_type passIDs,
|
||||
boost::property_map<RenderDependencyGraph, RenderDependencyGraph::TraitsTag>::type traits,
|
||||
boost::property_map<ResourceGraph, ResourceGraph::TraitsTag>::const_type resourceTraits)
|
||||
: resg(resg0),
|
||||
rg(rg0),
|
||||
rdg(rdg0),
|
||||
mPasses(passes),
|
||||
valueIDs(valueIDs),
|
||||
passIDs(passIDs),
|
||||
traits(traits),
|
||||
mResourceTraits(resourceTraits) {}
|
||||
|
||||
// WARNING!!!
|
||||
// dfs visitor must NOT contain any state, it is copied every where
|
||||
using Graph = boost::reverse_graph<RenderDependencyGraph>;
|
||||
|
||||
void markVertex(Graph::edge_descriptor e, const Graph& g) const {
|
||||
auto sourceID = source(e, g);
|
||||
auto targetID = target(e, g);
|
||||
auto keep = get(traits, sourceID).keep;
|
||||
get(traits, targetID).keep |= keep;
|
||||
}
|
||||
|
||||
void start_vertex(Graph::vertex_descriptor u, const Graph& g) {
|
||||
// currently, do nothing
|
||||
}
|
||||
|
||||
void discover_vertex(Graph::vertex_descriptor u, const Graph& /*g*/) {
|
||||
auto& keep = get(traits, u).keep;
|
||||
if (keep) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto passID = rdg.passIDs.at(u);
|
||||
if (holds_tag<PresentTag>(passID, rg)) {
|
||||
keep = true;
|
||||
return;
|
||||
}
|
||||
|
||||
const auto& pass = get(mPasses, u);
|
||||
// output values has side effects
|
||||
for (const auto valueID : pass.outputs) {
|
||||
auto handleID = rdg.resourceHandles[valueID];
|
||||
if (get(mResourceTraits, handleID).hasSideEffects()) {
|
||||
keep = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tree_edge(Graph::edge_descriptor e, const Graph& g) { // NOLINT
|
||||
markVertex(e, g);
|
||||
}
|
||||
|
||||
void back_edge(Graph::edge_descriptor e, const Graph& g) { // NOLINT
|
||||
throw std::invalid_argument("rdg is not DAG");
|
||||
}
|
||||
|
||||
void forward_or_cross_edge(Graph::edge_descriptor e, const Graph& g) { // NOLINT
|
||||
markVertex(e, g);
|
||||
}
|
||||
|
||||
void finish_vertex(Graph::vertex_descriptor v, const Graph& g) { // NOLINT
|
||||
// currently, do nothing
|
||||
}
|
||||
|
||||
const ResourceGraph& resg;
|
||||
const RenderGraph& rg;
|
||||
const RenderDependencyGraph& rdg;
|
||||
|
||||
boost::property_map<RenderDependencyGraph, RenderDependencyGraph::PassTag>::const_type mPasses;
|
||||
boost::property_map<RenderDependencyGraph, RenderDependencyGraph::ValueIDTag>::const_type valueIDs;
|
||||
boost::property_map<RenderDependencyGraph, RenderDependencyGraph::PassIDTag>::const_type passIDs;
|
||||
boost::property_map<RenderDependencyGraph, RenderDependencyGraph::TraitsTag>::type traits;
|
||||
|
||||
boost::property_map<ResourceGraph, ResourceGraph::TraitsTag>::const_type mResourceTraits;
|
||||
};
|
||||
|
||||
} // namespace
|
||||
|
||||
int RenderCompiler::compile() {
|
||||
auto& rg = graph;
|
||||
const auto& resg = resourceGraph;
|
||||
|
||||
try {
|
||||
// per-condition:
|
||||
// 1. render graph is already sorted, which is ensured by the building rule.
|
||||
// 2. every render value can be found in resource graph
|
||||
// 3. every render value in a pass can be found in the corresponding layout graph node
|
||||
// 4. render value in a pass is read/write consistent, either read-only or readwrite/write
|
||||
// a) a render value can be bound to multiple shader input parameters,
|
||||
// so it might be read/write inconsistent.
|
||||
|
||||
// convert render graph to render dependency graph
|
||||
// rdg is a sub-graph of rg, it only contains render passes
|
||||
// rdg implementation doesn't contain any string, so it's relatively faster.
|
||||
RenderDependencyGraph rdg(scratch);
|
||||
buildRenderDependencyGraph(rg, rdg);
|
||||
|
||||
// try connect all render values, which are stored in RenderValueGraph (rvg)
|
||||
// compute inter-pass dependencies of rdg
|
||||
// if an input of render pass doesn't have any sources,
|
||||
// add this input value to the initial render pass
|
||||
RenderValueGraph rvg(scratch);
|
||||
buildRenderValueGraphAndInitialPass(rdg, rvg);
|
||||
|
||||
// build resource handle index
|
||||
buildRenderDependencyGraphResourceIndex(resg, rdg);
|
||||
|
||||
// rdg and rvg are now complete, we can do culling now
|
||||
// if an output of a pass has no out-edge, this output is called general rg-output
|
||||
// if a general rg-output is persistent or marked as output,
|
||||
// we call it rg-output. it's containing pass is called rg-output-pass
|
||||
// culling rules:
|
||||
// 1. if a pass is not culled, its upstream passes should not be culled
|
||||
// 2. rg-output-pass should not be culled
|
||||
// 3. any pass contains readwrite/write persistent value, should not be culled
|
||||
// 4. any pass contains side-effects not described here, should not be culled
|
||||
// algorithm:
|
||||
// 1. reversely search rdg
|
||||
// 2. do depth-first search
|
||||
// a) pass has rg-output, keep
|
||||
// b) pass has persistent write values, keep
|
||||
// c) any downstream pass is kept, keep
|
||||
// d) found back-edge, rdg is not DAG, abort
|
||||
// 3. any pass is not marked as keep, is culled
|
||||
{
|
||||
const auto& crdg = rdg;
|
||||
const auto& cresg = resg;
|
||||
|
||||
CullingVisitor visitor(
|
||||
resg, rg, rdg,
|
||||
get(RDG::Pass, crdg),
|
||||
get(RDG::ValueID, crdg),
|
||||
get(RDG::PassID, crdg),
|
||||
get(RDG::Traits, rdg),
|
||||
get(RESG::Traits, cresg));
|
||||
|
||||
auto colors = rdg.colors(scratch);
|
||||
auto reverseGraph = boost::make_reverse_graph(crdg);
|
||||
boost::depth_first_search(
|
||||
reverseGraph,
|
||||
visitor,
|
||||
get(colors, rdg));
|
||||
}
|
||||
} catch (const std::invalid_argument& /*e*/) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
add_vertex(
|
||||
"name",
|
||||
UpdateFrequency::PER_INSTANCE,
|
||||
LayoutData(scratch),
|
||||
GroupNodeData{},
|
||||
layoutGraph);
|
||||
|
||||
add_vertex(ShaderTag{},
|
||||
std::forward_as_tuple("name"),
|
||||
std::forward_as_tuple(UpdateFrequency::PER_INSTANCE),
|
||||
std::forward_as_tuple(),
|
||||
std::forward_as_tuple(),
|
||||
layoutGraph);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace example
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,63 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphNames.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExampleTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphNames.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
namespace example {
|
||||
|
||||
inline const char* getName(DependencyType e) noexcept {
|
||||
switch (e) {
|
||||
case DependencyType::ORDER: return "ORDER";
|
||||
case DependencyType::DATA: return "DATA";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
inline const char* getName(const RenderPassNode& /*v*/) noexcept { return "RenderPassNode"; }
|
||||
inline const char* getName(const RenderPassTraits& /*v*/) noexcept { return "RenderPassTraits"; }
|
||||
inline const char* getName(const RenderDependencyGraph& /*v*/) noexcept { return "RenderDependencyGraph"; }
|
||||
inline const char* getName(const RenderValueNode& /*v*/) noexcept { return "RenderValueNode"; }
|
||||
inline const char* getName(const RenderValueGraph& /*v*/) noexcept { return "RenderValueGraph"; }
|
||||
inline const char* getName(const RenderCompiler& /*v*/) noexcept { return "RenderCompiler"; }
|
||||
|
||||
} // namespace example
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderExampleReflection.h"
|
||||
#include "RenderExampleTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,37 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphReflection.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExampleFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphReflection.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,114 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderExampleTypes.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
namespace example {
|
||||
|
||||
RenderPassNode::RenderPassNode(const allocator_type& alloc) noexcept
|
||||
: outputs(alloc),
|
||||
inputs(alloc) {}
|
||||
|
||||
RenderPassNode::RenderPassNode(RenderPassNode&& rhs, const allocator_type& alloc)
|
||||
: outputs(std::move(rhs.outputs), alloc),
|
||||
inputs(std::move(rhs.inputs), alloc) {}
|
||||
|
||||
RenderPassNode::RenderPassNode(RenderPassNode const& rhs, const allocator_type& alloc)
|
||||
: outputs(rhs.outputs, alloc),
|
||||
inputs(rhs.inputs, alloc) {}
|
||||
|
||||
RenderDependencyGraph::RenderDependencyGraph(const allocator_type& alloc) noexcept
|
||||
: vertices(alloc),
|
||||
passes(alloc),
|
||||
valueIDs(alloc),
|
||||
passIDs(alloc),
|
||||
traits(alloc),
|
||||
edges(alloc),
|
||||
passIndex(alloc),
|
||||
valueIndex(alloc),
|
||||
valueNames(alloc),
|
||||
resourceHandles(alloc) {}
|
||||
|
||||
// ContinuousContainer
|
||||
void RenderDependencyGraph::reserve(vertices_size_type sz) {
|
||||
vertices.reserve(sz);
|
||||
passes.reserve(sz);
|
||||
valueIDs.reserve(sz);
|
||||
passIDs.reserve(sz);
|
||||
traits.reserve(sz);
|
||||
}
|
||||
|
||||
RenderDependencyGraph::vertex_type::vertex_type(const allocator_type& alloc) noexcept
|
||||
: outEdges(alloc),
|
||||
inEdges(alloc) {}
|
||||
|
||||
RenderDependencyGraph::vertex_type::vertex_type(vertex_type&& rhs, const allocator_type& alloc)
|
||||
: outEdges(std::move(rhs.outEdges), alloc),
|
||||
inEdges(std::move(rhs.inEdges), alloc) {}
|
||||
|
||||
RenderDependencyGraph::vertex_type::vertex_type(vertex_type const& rhs, const allocator_type& alloc)
|
||||
: outEdges(rhs.outEdges, alloc),
|
||||
inEdges(rhs.inEdges, alloc) {}
|
||||
|
||||
RenderValueGraph::RenderValueGraph(const allocator_type& alloc) noexcept
|
||||
: vertices(alloc),
|
||||
nodes(alloc),
|
||||
index(alloc) {}
|
||||
|
||||
// ContinuousContainer
|
||||
void RenderValueGraph::reserve(vertices_size_type sz) {
|
||||
vertices.reserve(sz);
|
||||
nodes.reserve(sz);
|
||||
}
|
||||
|
||||
RenderValueGraph::vertex_type::vertex_type(const allocator_type& alloc) noexcept
|
||||
: outEdges(alloc),
|
||||
inEdges(alloc) {}
|
||||
|
||||
RenderValueGraph::vertex_type::vertex_type(vertex_type&& rhs, const allocator_type& alloc)
|
||||
: outEdges(std::move(rhs.outEdges), alloc),
|
||||
inEdges(std::move(rhs.inEdges), alloc) {}
|
||||
|
||||
RenderValueGraph::vertex_type::vertex_type(vertex_type const& rhs, const allocator_type& alloc)
|
||||
: outEdges(rhs.outEdges, alloc),
|
||||
inEdges(rhs.inEdges, alloc) {}
|
||||
|
||||
} // namespace example
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,407 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/container/pmr/vector.hpp>
|
||||
#include <boost/graph/adjacency_iterator.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/range/irange.hpp>
|
||||
#include "cocos/renderer/pipeline/custom/GraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/LayoutGraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/Map.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExampleFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/Set.h"
|
||||
#include "cocos/renderer/pipeline/custom/String.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
namespace example {
|
||||
|
||||
enum class DependencyType {
|
||||
ORDER,
|
||||
DATA,
|
||||
};
|
||||
|
||||
struct RenderPassNode {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {outputs.get_allocator().resource()};
|
||||
}
|
||||
|
||||
RenderPassNode(const allocator_type& alloc) noexcept; // NOLINT
|
||||
RenderPassNode(RenderPassNode&& rhs, const allocator_type& alloc);
|
||||
RenderPassNode(RenderPassNode const& rhs, const allocator_type& alloc);
|
||||
|
||||
RenderPassNode(RenderPassNode&& rhs) noexcept = default;
|
||||
RenderPassNode(RenderPassNode const& rhs) = delete;
|
||||
RenderPassNode& operator=(RenderPassNode&& rhs) = default;
|
||||
RenderPassNode& operator=(RenderPassNode const& rhs) = default;
|
||||
|
||||
PmrFlatSet<uint32_t> outputs;
|
||||
PmrFlatSet<uint32_t> inputs;
|
||||
};
|
||||
|
||||
struct RenderPassTraits {
|
||||
bool keep{false};
|
||||
};
|
||||
|
||||
struct RenderDependencyGraph {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {vertices.get_allocator().resource()};
|
||||
}
|
||||
|
||||
inline boost::container::pmr::memory_resource* resource() const noexcept {
|
||||
return get_allocator().resource();
|
||||
}
|
||||
|
||||
RenderDependencyGraph(const allocator_type& alloc) noexcept; // NOLINT
|
||||
RenderDependencyGraph(RenderDependencyGraph&& rhs) = delete;
|
||||
RenderDependencyGraph(RenderDependencyGraph const& rhs) = delete;
|
||||
RenderDependencyGraph& operator=(RenderDependencyGraph&& rhs) = delete;
|
||||
RenderDependencyGraph& operator=(RenderDependencyGraph const& rhs) = delete;
|
||||
|
||||
// Graph
|
||||
using directed_category = boost::bidirectional_tag;
|
||||
using vertex_descriptor = uint32_t;
|
||||
using edge_descriptor = impl::EdgeDescriptorWithProperty<directed_category, vertex_descriptor>;
|
||||
using edge_parallel_category = boost::allow_parallel_edge_tag;
|
||||
struct traversal_category // NOLINT
|
||||
: virtual boost::incidence_graph_tag,
|
||||
virtual boost::bidirectional_graph_tag,
|
||||
virtual boost::adjacency_graph_tag,
|
||||
virtual boost::vertex_list_graph_tag,
|
||||
virtual boost::edge_list_graph_tag {};
|
||||
|
||||
constexpr static vertex_descriptor null_vertex() noexcept { // NOLINT
|
||||
return std::numeric_limits<vertex_descriptor>::max();
|
||||
}
|
||||
using edge_type = impl::ListEdge<vertex_descriptor, DependencyType>;
|
||||
|
||||
// IncidenceGraph
|
||||
using out_edge_type = impl::StoredEdgeWithEdgeIter<
|
||||
vertex_descriptor,
|
||||
PmrList<edge_type>::iterator,
|
||||
DependencyType>;
|
||||
using out_edge_iterator = impl::OutPropertyEdgeIter<
|
||||
boost::container::pmr::vector<out_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
using degree_size_type = uint32_t;
|
||||
|
||||
// BidirectionalGraph
|
||||
using in_edge_type = impl::StoredEdgeWithEdgeIter<
|
||||
vertex_descriptor,
|
||||
PmrList<edge_type>::iterator,
|
||||
DependencyType>;
|
||||
using in_edge_iterator = impl::InPropertyEdgeIter<
|
||||
boost::container::pmr::vector<in_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
|
||||
// AdjacencyGraph
|
||||
using adjacency_iterator = boost::adjacency_iterator_generator<
|
||||
RenderDependencyGraph, vertex_descriptor, out_edge_iterator>::type;
|
||||
|
||||
// VertexListGraph
|
||||
using vertex_iterator = boost::integer_range<vertex_descriptor>::iterator;
|
||||
using vertices_size_type = uint32_t;
|
||||
|
||||
// VertexList help functions
|
||||
inline boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
|
||||
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
|
||||
return {0, static_cast<vertices_size_type>(vertices.size())};
|
||||
}
|
||||
|
||||
inline vertex_descriptor getCurrentID() const noexcept {
|
||||
return static_cast<vertex_descriptor>(vertices.size());
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
|
||||
return boost::container::pmr::vector<boost::default_color_type>(vertices.size(), mr);
|
||||
}
|
||||
|
||||
// EdgeListGraph
|
||||
using edge_iterator = impl::UndirectedEdgeIter<
|
||||
PmrList<edge_type>::iterator,
|
||||
edge_descriptor, int32_t>;
|
||||
using edges_size_type = uint32_t;
|
||||
|
||||
using edge_property_type = DependencyType;
|
||||
|
||||
// PropertyGraph (Edge)
|
||||
const edge_property_type& operator[](const edge_descriptor& e) const noexcept {
|
||||
return *static_cast<edge_property_type*>(e.get_property());
|
||||
}
|
||||
edge_property_type& operator[](const edge_descriptor& e) noexcept {
|
||||
return *static_cast<edge_property_type*>(e.get_property());
|
||||
}
|
||||
|
||||
// ContinuousContainer
|
||||
void reserve(vertices_size_type sz);
|
||||
|
||||
// Members
|
||||
struct vertex_type { // NOLINT
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {outEdges.get_allocator().resource()};
|
||||
}
|
||||
|
||||
vertex_type(const allocator_type& alloc) noexcept; // NOLINT
|
||||
vertex_type(vertex_type&& rhs, const allocator_type& alloc);
|
||||
vertex_type(vertex_type const& rhs, const allocator_type& alloc);
|
||||
|
||||
vertex_type(vertex_type&& rhs) noexcept = default;
|
||||
vertex_type(vertex_type const& rhs) = delete;
|
||||
vertex_type& operator=(vertex_type&& rhs) = default;
|
||||
vertex_type& operator=(vertex_type const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<out_edge_type> outEdges;
|
||||
boost::container::pmr::vector<in_edge_type> inEdges;
|
||||
};
|
||||
|
||||
struct PassTag {
|
||||
} static constexpr Pass{}; // NOLINT
|
||||
struct ValueIDTag {
|
||||
} static constexpr ValueID{}; // NOLINT
|
||||
struct PassIDTag {
|
||||
} static constexpr PassID{}; // NOLINT
|
||||
struct TraitsTag {
|
||||
} static constexpr Traits{}; // NOLINT
|
||||
|
||||
// Vertices
|
||||
boost::container::pmr::vector<vertex_type> vertices;
|
||||
// Components
|
||||
boost::container::pmr::vector<RenderPassNode> passes;
|
||||
boost::container::pmr::vector<PmrFlatSet<uint32_t>> valueIDs;
|
||||
boost::container::pmr::vector<RenderGraph::vertex_descriptor> passIDs;
|
||||
boost::container::pmr::vector<RenderPassTraits> traits;
|
||||
// Edges
|
||||
PmrList<edge_type> edges;
|
||||
// UuidGraph
|
||||
PmrUnorderedMap<RenderGraph::vertex_descriptor, vertex_descriptor> passIndex;
|
||||
// Members
|
||||
PmrUnorderedMap<PmrString, uint32_t> valueIndex;
|
||||
boost::container::pmr::vector<PmrString> valueNames;
|
||||
boost::container::pmr::vector<ResourceGraph::vertex_descriptor> resourceHandles;
|
||||
};
|
||||
|
||||
struct RenderValueNode {
|
||||
RenderValueNode() = default;
|
||||
RenderValueNode(uint32_t passIDIn, uint32_t valueIDIn) noexcept // NOLINT
|
||||
: passID(passIDIn),
|
||||
valueID(valueIDIn) {}
|
||||
|
||||
uint32_t passID{0xFFFFFFFF};
|
||||
uint32_t valueID{0xFFFFFFFF};
|
||||
};
|
||||
|
||||
inline bool operator==(const RenderValueNode& lhs, const RenderValueNode& rhs) noexcept {
|
||||
return std::forward_as_tuple(lhs.passID, lhs.valueID) ==
|
||||
std::forward_as_tuple(rhs.passID, rhs.valueID);
|
||||
}
|
||||
|
||||
inline bool operator!=(const RenderValueNode& lhs, const RenderValueNode& rhs) noexcept {
|
||||
return !(lhs == rhs);
|
||||
}
|
||||
|
||||
struct RenderValueGraph {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {vertices.get_allocator().resource()};
|
||||
}
|
||||
|
||||
inline boost::container::pmr::memory_resource* resource() const noexcept {
|
||||
return get_allocator().resource();
|
||||
}
|
||||
|
||||
RenderValueGraph(const allocator_type& alloc) noexcept; // NOLINT
|
||||
RenderValueGraph(RenderValueGraph&& rhs) = delete;
|
||||
RenderValueGraph(RenderValueGraph const& rhs) = delete;
|
||||
RenderValueGraph& operator=(RenderValueGraph&& rhs) = delete;
|
||||
RenderValueGraph& operator=(RenderValueGraph const& rhs) = delete;
|
||||
|
||||
// Graph
|
||||
using directed_category = boost::bidirectional_tag;
|
||||
using vertex_descriptor = uint32_t;
|
||||
using edge_descriptor = impl::EdgeDescriptor<directed_category, vertex_descriptor>;
|
||||
using edge_parallel_category = boost::allow_parallel_edge_tag;
|
||||
struct traversal_category // NOLINT
|
||||
: virtual boost::incidence_graph_tag,
|
||||
virtual boost::bidirectional_graph_tag,
|
||||
virtual boost::adjacency_graph_tag,
|
||||
virtual boost::vertex_list_graph_tag,
|
||||
virtual boost::edge_list_graph_tag {};
|
||||
|
||||
constexpr static vertex_descriptor null_vertex() noexcept { // NOLINT
|
||||
return std::numeric_limits<vertex_descriptor>::max();
|
||||
}
|
||||
|
||||
// IncidenceGraph
|
||||
using out_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using out_edge_iterator = impl::OutEdgeIter<
|
||||
boost::container::pmr::vector<out_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
using degree_size_type = uint32_t;
|
||||
|
||||
// BidirectionalGraph
|
||||
using in_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using in_edge_iterator = impl::InEdgeIter<
|
||||
boost::container::pmr::vector<in_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
|
||||
// AdjacencyGraph
|
||||
using adjacency_iterator = boost::adjacency_iterator_generator<
|
||||
RenderValueGraph, vertex_descriptor, out_edge_iterator>::type;
|
||||
|
||||
// VertexListGraph
|
||||
using vertex_iterator = boost::integer_range<vertex_descriptor>::iterator;
|
||||
using vertices_size_type = uint32_t;
|
||||
|
||||
// VertexList help functions
|
||||
inline boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
|
||||
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
|
||||
return {0, static_cast<vertices_size_type>(vertices.size())};
|
||||
}
|
||||
|
||||
inline vertex_descriptor getCurrentID() const noexcept {
|
||||
return static_cast<vertex_descriptor>(vertices.size());
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
|
||||
return boost::container::pmr::vector<boost::default_color_type>(vertices.size(), mr);
|
||||
}
|
||||
|
||||
// EdgeListGraph
|
||||
using edge_iterator = impl::DirectedEdgeIterator<vertex_iterator, out_edge_iterator, RenderValueGraph>;
|
||||
using edges_size_type = uint32_t;
|
||||
|
||||
// ContinuousContainer
|
||||
void reserve(vertices_size_type sz);
|
||||
|
||||
// Members
|
||||
struct vertex_type { // NOLINT
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {outEdges.get_allocator().resource()};
|
||||
}
|
||||
|
||||
vertex_type(const allocator_type& alloc) noexcept; // NOLINT
|
||||
vertex_type(vertex_type&& rhs, const allocator_type& alloc);
|
||||
vertex_type(vertex_type const& rhs, const allocator_type& alloc);
|
||||
|
||||
vertex_type(vertex_type&& rhs) noexcept = default;
|
||||
vertex_type(vertex_type const& rhs) = delete;
|
||||
vertex_type& operator=(vertex_type&& rhs) = default;
|
||||
vertex_type& operator=(vertex_type const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<out_edge_type> outEdges;
|
||||
boost::container::pmr::vector<in_edge_type> inEdges;
|
||||
};
|
||||
|
||||
struct NodeTag {
|
||||
} static constexpr Node{}; // NOLINT
|
||||
|
||||
// Vertices
|
||||
boost::container::pmr::vector<vertex_type> vertices;
|
||||
// Components
|
||||
boost::container::pmr::vector<RenderValueNode> nodes;
|
||||
// UuidGraph
|
||||
PmrUnorderedMap<RenderValueNode, vertex_descriptor> index;
|
||||
};
|
||||
|
||||
struct RenderCompiler {
|
||||
RenderCompiler(ResourceGraph& resourceGraphIn, RenderGraph& graphIn, LayoutGraphData& layoutGraphIn, boost::container::pmr::memory_resource* scratchIn) noexcept
|
||||
: resourceGraph(resourceGraphIn),
|
||||
graph(graphIn),
|
||||
layoutGraph(layoutGraphIn),
|
||||
scratch(scratchIn) {}
|
||||
RenderCompiler(RenderCompiler&& rhs) = delete;
|
||||
RenderCompiler(RenderCompiler const& rhs) = delete;
|
||||
RenderCompiler& operator=(RenderCompiler&& rhs) = delete;
|
||||
RenderCompiler& operator=(RenderCompiler const& rhs) = delete;
|
||||
|
||||
int validate() const;
|
||||
int audit(std::ostream& oss) const;
|
||||
int compile();
|
||||
|
||||
ResourceGraph& resourceGraph;
|
||||
RenderGraph& graph;
|
||||
LayoutGraphData& layoutGraph;
|
||||
boost::container::pmr::memory_resource* scratch{nullptr};
|
||||
};
|
||||
|
||||
} // namespace example
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
namespace std {
|
||||
|
||||
inline size_t hash<cc::render::example::RenderValueNode>::operator()(const cc::render::example::RenderValueNode& v) const noexcept {
|
||||
size_t seed = 0;
|
||||
boost::hash_combine(seed, v.passID);
|
||||
boost::hash_combine(seed, v.valueID);
|
||||
return seed;
|
||||
}
|
||||
|
||||
} // namespace std
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,47 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include "cocos/renderer/gfx-base/GFXDef-common.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonFwd.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
struct DeviceResourceGraph;
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,791 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/utility/string_view.hpp>
|
||||
#include "cocos/renderer/pipeline/custom/GraphImpl.h"
|
||||
#include "cocos/renderer/pipeline/custom/GslUtils.h"
|
||||
#include "cocos/renderer/pipeline/custom/Overload.h"
|
||||
#include "cocos/renderer/pipeline/custom/PathUtils.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExecutorTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/invoke.hpp"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
// IncidenceGraph
|
||||
inline DeviceResourceGraph::vertex_descriptor
|
||||
source(const DeviceResourceGraph::edge_descriptor& e, const DeviceResourceGraph& /*g*/) noexcept {
|
||||
return e.source;
|
||||
}
|
||||
|
||||
inline DeviceResourceGraph::vertex_descriptor
|
||||
target(const DeviceResourceGraph::edge_descriptor& e, const DeviceResourceGraph& /*g*/) noexcept {
|
||||
return e.target;
|
||||
}
|
||||
|
||||
inline std::pair<DeviceResourceGraph::out_edge_iterator, DeviceResourceGraph::out_edge_iterator>
|
||||
out_edges(DeviceResourceGraph::vertex_descriptor u, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
return std::make_pair(
|
||||
DeviceResourceGraph::out_edge_iterator(const_cast<DeviceResourceGraph&>(g).getOutEdgeList(u).begin(), u),
|
||||
DeviceResourceGraph::out_edge_iterator(const_cast<DeviceResourceGraph&>(g).getOutEdgeList(u).end(), u));
|
||||
}
|
||||
|
||||
inline DeviceResourceGraph::degree_size_type
|
||||
out_degree(DeviceResourceGraph::vertex_descriptor u, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
return gsl::narrow_cast<DeviceResourceGraph::degree_size_type>(g.getOutEdgeList(u).size());
|
||||
}
|
||||
|
||||
inline std::pair<DeviceResourceGraph::edge_descriptor, bool>
|
||||
edge(DeviceResourceGraph::vertex_descriptor u, DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) noexcept {
|
||||
const auto& outEdgeList = g.getOutEdgeList(u);
|
||||
auto iter = std::find(outEdgeList.begin(), outEdgeList.end(), DeviceResourceGraph::out_edge_type(v));
|
||||
bool hasEdge = (iter != outEdgeList.end());
|
||||
return {DeviceResourceGraph::edge_descriptor(u, v), hasEdge};
|
||||
}
|
||||
|
||||
// BidirectionalGraph(Directed)
|
||||
inline std::pair<DeviceResourceGraph::in_edge_iterator, DeviceResourceGraph::in_edge_iterator>
|
||||
in_edges(DeviceResourceGraph::vertex_descriptor u, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
return std::make_pair(
|
||||
DeviceResourceGraph::in_edge_iterator(const_cast<DeviceResourceGraph&>(g).getInEdgeList(u).begin(), u),
|
||||
DeviceResourceGraph::in_edge_iterator(const_cast<DeviceResourceGraph&>(g).getInEdgeList(u).end(), u));
|
||||
}
|
||||
|
||||
inline DeviceResourceGraph::degree_size_type
|
||||
in_degree(DeviceResourceGraph::vertex_descriptor u, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
return gsl::narrow_cast<DeviceResourceGraph::degree_size_type>(g.getInEdgeList(u).size());
|
||||
}
|
||||
|
||||
inline DeviceResourceGraph::degree_size_type
|
||||
degree(DeviceResourceGraph::vertex_descriptor u, const DeviceResourceGraph& g) noexcept {
|
||||
return in_degree(u, g) + out_degree(u, g);
|
||||
}
|
||||
|
||||
// AdjacencyGraph
|
||||
inline std::pair<DeviceResourceGraph::adjacency_iterator, DeviceResourceGraph::adjacency_iterator>
|
||||
adjacent_vertices(DeviceResourceGraph::vertex_descriptor u, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
auto edges = out_edges(u, g);
|
||||
return std::make_pair(DeviceResourceGraph::adjacency_iterator(edges.first, &g), DeviceResourceGraph::adjacency_iterator(edges.second, &g));
|
||||
}
|
||||
|
||||
// VertexListGraph
|
||||
inline std::pair<DeviceResourceGraph::vertex_iterator, DeviceResourceGraph::vertex_iterator>
|
||||
vertices(const DeviceResourceGraph& g) noexcept {
|
||||
return std::make_pair(const_cast<DeviceResourceGraph&>(g).getVertexList().begin(), const_cast<DeviceResourceGraph&>(g).getVertexList().end());
|
||||
}
|
||||
|
||||
inline DeviceResourceGraph::vertices_size_type
|
||||
num_vertices(const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
return gsl::narrow_cast<DeviceResourceGraph::vertices_size_type>(g.getVertexList().size());
|
||||
}
|
||||
|
||||
// EdgeListGraph
|
||||
inline std::pair<DeviceResourceGraph::edge_iterator, DeviceResourceGraph::edge_iterator>
|
||||
edges(const DeviceResourceGraph& g0) noexcept {
|
||||
auto& g = const_cast<DeviceResourceGraph&>(g0);
|
||||
return std::make_pair(
|
||||
DeviceResourceGraph::edge_iterator(g.getVertexList().begin(), g.getVertexList().begin(), g.getVertexList().end(), g),
|
||||
DeviceResourceGraph::edge_iterator(g.getVertexList().begin(), g.getVertexList().end(), g.getVertexList().end(), g));
|
||||
}
|
||||
|
||||
inline DeviceResourceGraph::edges_size_type
|
||||
num_edges(const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
DeviceResourceGraph::edges_size_type numEdges = 0;
|
||||
|
||||
auto range = vertices(g);
|
||||
for (auto iter = range.first; iter != range.second; ++iter) {
|
||||
numEdges += out_degree(*iter, g);
|
||||
}
|
||||
return numEdges;
|
||||
}
|
||||
|
||||
// MutableGraph(Edge)
|
||||
inline std::pair<DeviceResourceGraph::edge_descriptor, bool>
|
||||
add_edge( // NOLINT
|
||||
DeviceResourceGraph::vertex_descriptor u,
|
||||
DeviceResourceGraph::vertex_descriptor v, DeviceResourceGraph& g) {
|
||||
auto& outEdgeList = g.getOutEdgeList(u);
|
||||
outEdgeList.emplace_back(v);
|
||||
|
||||
auto& inEdgeList = g.getInEdgeList(v);
|
||||
inEdgeList.emplace_back(u);
|
||||
|
||||
return std::make_pair(DeviceResourceGraph::edge_descriptor(u, v), true);
|
||||
}
|
||||
|
||||
inline void remove_edge(DeviceResourceGraph::vertex_descriptor u, DeviceResourceGraph::vertex_descriptor v, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
// remove out-edges
|
||||
auto& outEdgeList = g.getOutEdgeList(u);
|
||||
// eraseFromIncidenceList
|
||||
impl::sequenceEraseIf(outEdgeList, [v](const auto& e) {
|
||||
return e.get_target() == v;
|
||||
});
|
||||
|
||||
// remove reciprocal (bidirectional) in-edges
|
||||
auto& inEdgeList = g.getInEdgeList(v);
|
||||
// eraseFromIncidenceList
|
||||
impl::sequenceEraseIf(inEdgeList, [u](const auto& e) {
|
||||
return e.get_target() == u;
|
||||
});
|
||||
}
|
||||
|
||||
inline void remove_edge(DeviceResourceGraph::edge_descriptor e, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
// remove_edge need rewrite
|
||||
auto& outEdgeList = g.getOutEdgeList(source(e, g));
|
||||
impl::removeIncidenceEdge(e, outEdgeList);
|
||||
auto& inEdgeList = g.getInEdgeList(target(e, g));
|
||||
impl::removeIncidenceEdge(e, inEdgeList);
|
||||
}
|
||||
|
||||
inline void remove_edge(DeviceResourceGraph::out_edge_iterator iter, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
auto e = *iter;
|
||||
auto& outEdgeList = g.getOutEdgeList(source(e, g));
|
||||
auto& inEdgeList = g.getInEdgeList(target(e, g));
|
||||
impl::removeIncidenceEdge(e, inEdgeList);
|
||||
outEdgeList.erase(iter.base());
|
||||
}
|
||||
|
||||
template <class Predicate>
|
||||
inline void remove_out_edge_if(DeviceResourceGraph::vertex_descriptor u, Predicate&& pred, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
for (auto pair = out_edges(u, g); pair.first != pair.second; ++pair.first) {
|
||||
auto& outIter = pair.first;
|
||||
auto& outEnd = pair.second;
|
||||
if (pred(*outIter)) {
|
||||
auto& inEdgeList = g.getInEdgeList(target(*outIter, g));
|
||||
auto e = *outIter;
|
||||
impl::removeIncidenceEdge(e, inEdgeList);
|
||||
}
|
||||
}
|
||||
auto pair = out_edges(u, g);
|
||||
auto& first = pair.first;
|
||||
auto& last = pair.second;
|
||||
auto& outEdgeList = g.getOutEdgeList(u);
|
||||
impl::sequenceRemoveIncidenceEdgeIf(first, last, outEdgeList, std::forward<Predicate>(pred));
|
||||
}
|
||||
|
||||
template <class Predicate>
|
||||
inline void remove_in_edge_if(DeviceResourceGraph::vertex_descriptor v, Predicate&& pred, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
for (auto pair = in_edges(v, g); pair.first != pair.second; ++pair.first) {
|
||||
auto& inIter = pair.first;
|
||||
auto& inEnd = pair.second;
|
||||
if (pred(*inIter)) {
|
||||
auto& outEdgeList = g.getOutEdgeList(source(*inIter, g));
|
||||
auto e = *inIter;
|
||||
impl::removeIncidenceEdge(e, outEdgeList);
|
||||
}
|
||||
}
|
||||
auto pair = in_edges(v, g);
|
||||
auto& first = pair.first;
|
||||
auto& last = pair.second;
|
||||
auto& inEdgeList = g.getInEdgeList(v);
|
||||
impl::sequenceRemoveIncidenceEdgeIf(first, last, inEdgeList, std::forward<Predicate>(pred));
|
||||
}
|
||||
|
||||
template <class Predicate>
|
||||
inline void remove_edge_if(Predicate&& pred, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
auto pair = edges(g);
|
||||
auto& ei = pair.first;
|
||||
auto& eiEnd = pair.second;
|
||||
for (auto next = ei; ei != eiEnd; ei = next) {
|
||||
++next;
|
||||
if (pred(*ei)) {
|
||||
remove_edge(*ei, g);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// MutableGraph(Vertex)
|
||||
inline void clear_out_edges(DeviceResourceGraph::vertex_descriptor u, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
// Bidirectional (OutEdges)
|
||||
auto& outEdgeList = g.getOutEdgeList(u);
|
||||
auto outEnd = outEdgeList.end();
|
||||
for (auto iter = outEdgeList.begin(); iter != outEnd; ++iter) {
|
||||
auto& inEdgeList = g.getInEdgeList((*iter).get_target());
|
||||
// eraseFromIncidenceList
|
||||
impl::sequenceEraseIf(inEdgeList, [u](const auto& e) {
|
||||
return e.get_target() == u;
|
||||
});
|
||||
}
|
||||
outEdgeList.clear();
|
||||
}
|
||||
|
||||
inline void clear_in_edges(DeviceResourceGraph::vertex_descriptor u, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
// Bidirectional (InEdges)
|
||||
auto& inEdgeList = g.getInEdgeList(u);
|
||||
auto inEnd = inEdgeList.end();
|
||||
for (auto iter = inEdgeList.begin(); iter != inEnd; ++iter) {
|
||||
auto& outEdgeList = g.getOutEdgeList((*iter).get_target());
|
||||
// eraseFromIncidenceList
|
||||
impl::sequenceEraseIf(outEdgeList, [u](const auto& e) {
|
||||
return e.get_target() == u;
|
||||
});
|
||||
}
|
||||
inEdgeList.clear();
|
||||
}
|
||||
|
||||
inline void clear_vertex(DeviceResourceGraph::vertex_descriptor u, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
clear_out_edges(u, g);
|
||||
clear_in_edges(u, g);
|
||||
}
|
||||
|
||||
inline void remove_vertex_value_impl(const DeviceResourceGraph::vertex_handle_type& h, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
using vertex_descriptor = DeviceResourceGraph::vertex_descriptor;
|
||||
cc::visit(
|
||||
overload(
|
||||
[&](const impl::ValueHandle<BufferTag, vertex_descriptor>& h) {
|
||||
g.buffers.erase(g.buffers.begin() + std::ptrdiff_t(h.value));
|
||||
if (h.value == g.buffers.size()) {
|
||||
return;
|
||||
}
|
||||
impl::reindexVectorHandle<BufferTag>(g.vertices, h.value);
|
||||
},
|
||||
[&](const impl::ValueHandle<TextureTag, vertex_descriptor>& h) {
|
||||
g.textures.erase(g.textures.begin() + std::ptrdiff_t(h.value));
|
||||
if (h.value == g.textures.size()) {
|
||||
return;
|
||||
}
|
||||
impl::reindexVectorHandle<TextureTag>(g.vertices, h.value);
|
||||
}),
|
||||
h);
|
||||
}
|
||||
|
||||
inline void remove_vertex(DeviceResourceGraph::vertex_descriptor u, DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
// preserve vertex' iterators
|
||||
auto& vert = g.vertices[u];
|
||||
remove_vertex_value_impl(vert.handle, g);
|
||||
impl::removeVectorVertex(const_cast<DeviceResourceGraph&>(g), u, DeviceResourceGraph::directed_category{});
|
||||
|
||||
// remove components
|
||||
g.names.erase(g.names.begin() + std::ptrdiff_t(u));
|
||||
g.refCounts.erase(g.refCounts.begin() + std::ptrdiff_t(u));
|
||||
}
|
||||
|
||||
// MutablePropertyGraph(Vertex)
|
||||
template <class ValueT>
|
||||
void add_vertex_impl( // NOLINT
|
||||
ValueT &&val, DeviceResourceGraph &g, DeviceResourceGraph::vertex_type &vert, // NOLINT
|
||||
std::enable_if_t<std::is_same<std::decay_t<ValueT>, std::unique_ptr<gfx::Buffer>>::value>* dummy = nullptr) { // NOLINT
|
||||
vert.handle = impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>{
|
||||
gsl::narrow_cast<DeviceResourceGraph::vertex_descriptor>(g.buffers.size())};
|
||||
g.buffers.emplace_back(std::forward<ValueT>(val));
|
||||
}
|
||||
|
||||
template <class ValueT>
|
||||
void add_vertex_impl( // NOLINT
|
||||
ValueT &&val, DeviceResourceGraph &g, DeviceResourceGraph::vertex_type &vert, // NOLINT
|
||||
std::enable_if_t<std::is_same<std::decay_t<ValueT>, std::unique_ptr<gfx::Texture>>::value>* dummy = nullptr) { // NOLINT
|
||||
vert.handle = impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>{
|
||||
gsl::narrow_cast<DeviceResourceGraph::vertex_descriptor>(g.textures.size())};
|
||||
g.textures.emplace_back(std::forward<ValueT>(val));
|
||||
}
|
||||
|
||||
template <class Component0, class Component1, class ValueT>
|
||||
inline DeviceResourceGraph::vertex_descriptor
|
||||
add_vertex(Component0&& c0, Component1&& c1, ValueT&& val, DeviceResourceGraph& g) { // NOLINT
|
||||
auto v = gsl::narrow_cast<DeviceResourceGraph::vertex_descriptor>(g.vertices.size());
|
||||
|
||||
g.vertices.emplace_back();
|
||||
auto& vert = g.vertices.back();
|
||||
g.names.emplace_back(std::forward<Component0>(c0));
|
||||
g.refCounts.emplace_back(std::forward<Component1>(c1));
|
||||
|
||||
// PolymorphicGraph
|
||||
// if no matching overloaded function is found, Type is not supported by PolymorphicGraph
|
||||
add_vertex_impl(std::forward<ValueT>(val), g, vert);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
template <class Tuple>
|
||||
void add_vertex_impl(BufferTag /*tag*/, Tuple &&val, DeviceResourceGraph &g, DeviceResourceGraph::vertex_type &vert) { // NOLINT
|
||||
invoke_hpp::apply(
|
||||
[&](auto&&... args) {
|
||||
vert.handle = impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>{
|
||||
gsl::narrow_cast<DeviceResourceGraph::vertex_descriptor>(g.buffers.size())};
|
||||
g.buffers.emplace_back(std::forward<decltype(args)>(args)...);
|
||||
},
|
||||
std::forward<Tuple>(val));
|
||||
}
|
||||
|
||||
template <class Tuple>
|
||||
void add_vertex_impl(TextureTag /*tag*/, Tuple &&val, DeviceResourceGraph &g, DeviceResourceGraph::vertex_type &vert) { // NOLINT
|
||||
invoke_hpp::apply(
|
||||
[&](auto&&... args) {
|
||||
vert.handle = impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>{
|
||||
gsl::narrow_cast<DeviceResourceGraph::vertex_descriptor>(g.textures.size())};
|
||||
g.textures.emplace_back(std::forward<decltype(args)>(args)...);
|
||||
},
|
||||
std::forward<Tuple>(val));
|
||||
}
|
||||
|
||||
template <class Component0, class Component1, class Tag, class ValueT>
|
||||
inline DeviceResourceGraph::vertex_descriptor
|
||||
add_vertex(Tag tag, Component0&& c0, Component1&& c1, ValueT&& val, DeviceResourceGraph& g) { // NOLINT
|
||||
auto v = gsl::narrow_cast<DeviceResourceGraph::vertex_descriptor>(g.vertices.size());
|
||||
|
||||
g.vertices.emplace_back();
|
||||
auto& vert = g.vertices.back();
|
||||
|
||||
invoke_hpp::apply(
|
||||
[&](auto&&... args) {
|
||||
g.names.emplace_back(std::forward<decltype(args)>(args)...);
|
||||
},
|
||||
std::forward<Component0>(c0));
|
||||
|
||||
invoke_hpp::apply(
|
||||
[&](auto&&... args) {
|
||||
g.refCounts.emplace_back(std::forward<decltype(args)>(args)...);
|
||||
},
|
||||
std::forward<Component1>(c1));
|
||||
|
||||
// PolymorphicGraph
|
||||
// if no matching overloaded function is found, Type is not supported by PolymorphicGraph
|
||||
add_vertex_impl(tag, std::forward<ValueT>(val), g, vert);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
namespace boost {
|
||||
|
||||
// Vertex Index
|
||||
template <>
|
||||
struct property_map<cc::render::DeviceResourceGraph, vertex_index_t> {
|
||||
using const_type = identity_property_map;
|
||||
using type = identity_property_map;
|
||||
};
|
||||
|
||||
// Vertex Component
|
||||
template <>
|
||||
struct property_map<cc::render::DeviceResourceGraph, cc::render::DeviceResourceGraph::NameTag> {
|
||||
using const_type = cc::render::impl::VectorVertexComponentPropertyMap<
|
||||
read_write_property_map_tag,
|
||||
const cc::render::DeviceResourceGraph,
|
||||
const container::pmr::vector<std::string>,
|
||||
boost::string_view,
|
||||
const std::string&>;
|
||||
using type = cc::render::impl::VectorVertexComponentPropertyMap<
|
||||
read_write_property_map_tag,
|
||||
cc::render::DeviceResourceGraph,
|
||||
container::pmr::vector<std::string>,
|
||||
boost::string_view,
|
||||
std::string&>;
|
||||
};
|
||||
|
||||
// Vertex Name
|
||||
template <>
|
||||
struct property_map<cc::render::DeviceResourceGraph, vertex_name_t> {
|
||||
using const_type = cc::render::impl::VectorVertexComponentPropertyMap<
|
||||
read_write_property_map_tag,
|
||||
const cc::render::DeviceResourceGraph,
|
||||
const container::pmr::vector<std::string>,
|
||||
boost::string_view,
|
||||
const std::string&>;
|
||||
using type = cc::render::impl::VectorVertexComponentPropertyMap<
|
||||
read_write_property_map_tag,
|
||||
cc::render::DeviceResourceGraph,
|
||||
container::pmr::vector<std::string>,
|
||||
boost::string_view,
|
||||
std::string&>;
|
||||
};
|
||||
|
||||
// Vertex Component
|
||||
template <>
|
||||
struct property_map<cc::render::DeviceResourceGraph, cc::render::DeviceResourceGraph::RefCountTag> {
|
||||
using const_type = cc::render::impl::VectorVertexComponentPropertyMap<
|
||||
lvalue_property_map_tag,
|
||||
const cc::render::DeviceResourceGraph,
|
||||
const container::pmr::vector<int32_t>,
|
||||
int32_t,
|
||||
const int32_t&>;
|
||||
using type = cc::render::impl::VectorVertexComponentPropertyMap<
|
||||
lvalue_property_map_tag,
|
||||
cc::render::DeviceResourceGraph,
|
||||
container::pmr::vector<int32_t>,
|
||||
int32_t,
|
||||
int32_t&>;
|
||||
};
|
||||
|
||||
} // namespace boost
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
// Vertex Index
|
||||
inline boost::property_map<DeviceResourceGraph, boost::vertex_index_t>::const_type
|
||||
get(boost::vertex_index_t /*tag*/, const DeviceResourceGraph& /*g*/) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
inline boost::property_map<DeviceResourceGraph, boost::vertex_index_t>::type
|
||||
get(boost::vertex_index_t /*tag*/, DeviceResourceGraph& /*g*/) noexcept {
|
||||
return {};
|
||||
}
|
||||
|
||||
inline impl::ColorMap<DeviceResourceGraph::vertex_descriptor>
|
||||
get(boost::container::pmr::vector<boost::default_color_type>& colors, const DeviceResourceGraph& /*g*/) noexcept {
|
||||
return {colors};
|
||||
}
|
||||
|
||||
// Vertex Component
|
||||
inline typename boost::property_map<DeviceResourceGraph, DeviceResourceGraph::NameTag>::const_type
|
||||
get(DeviceResourceGraph::NameTag /*tag*/, const DeviceResourceGraph& g) noexcept {
|
||||
return {g.names};
|
||||
}
|
||||
|
||||
inline typename boost::property_map<DeviceResourceGraph, DeviceResourceGraph::NameTag>::type
|
||||
get(DeviceResourceGraph::NameTag /*tag*/, DeviceResourceGraph& g) noexcept {
|
||||
return {g.names};
|
||||
}
|
||||
|
||||
// Vertex Name
|
||||
inline boost::property_map<DeviceResourceGraph, boost::vertex_name_t>::const_type
|
||||
get(boost::vertex_name_t /*tag*/, const DeviceResourceGraph& g) noexcept {
|
||||
return {g.names};
|
||||
}
|
||||
|
||||
// Vertex Component
|
||||
inline typename boost::property_map<DeviceResourceGraph, DeviceResourceGraph::RefCountTag>::const_type
|
||||
get(DeviceResourceGraph::RefCountTag /*tag*/, const DeviceResourceGraph& g) noexcept {
|
||||
return {g.refCounts};
|
||||
}
|
||||
|
||||
inline typename boost::property_map<DeviceResourceGraph, DeviceResourceGraph::RefCountTag>::type
|
||||
get(DeviceResourceGraph::RefCountTag /*tag*/, DeviceResourceGraph& g) noexcept {
|
||||
return {g.refCounts};
|
||||
}
|
||||
|
||||
// PolymorphicGraph
|
||||
inline DeviceResourceGraph::vertices_size_type
|
||||
value_id(DeviceResourceGraph::vertex_descriptor u, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
using vertex_descriptor = DeviceResourceGraph::vertex_descriptor;
|
||||
return cc::visit(
|
||||
overload(
|
||||
[](const impl::ValueHandle<BufferTag, vertex_descriptor>& h) {
|
||||
return h.value;
|
||||
},
|
||||
[](const impl::ValueHandle<TextureTag, vertex_descriptor>& h) {
|
||||
return h.value;
|
||||
}),
|
||||
g.vertices[u].handle);
|
||||
}
|
||||
|
||||
inline DeviceResourceGraph::vertex_tag_type
|
||||
tag(DeviceResourceGraph::vertex_descriptor u, const DeviceResourceGraph& g) noexcept {
|
||||
using vertex_descriptor = DeviceResourceGraph::vertex_descriptor;
|
||||
return cc::visit(
|
||||
overload(
|
||||
[](const impl::ValueHandle<BufferTag, vertex_descriptor>&) {
|
||||
return DeviceResourceGraph::vertex_tag_type{BufferTag{}};
|
||||
},
|
||||
[](const impl::ValueHandle<TextureTag, vertex_descriptor>&) {
|
||||
return DeviceResourceGraph::vertex_tag_type{TextureTag{}};
|
||||
}),
|
||||
g.vertices[u].handle);
|
||||
}
|
||||
|
||||
inline DeviceResourceGraph::vertex_value_type
|
||||
value(DeviceResourceGraph::vertex_descriptor u, DeviceResourceGraph& g) noexcept {
|
||||
using vertex_descriptor = DeviceResourceGraph::vertex_descriptor;
|
||||
return cc::visit(
|
||||
overload(
|
||||
[&](const impl::ValueHandle<BufferTag, vertex_descriptor>& h) {
|
||||
return DeviceResourceGraph::vertex_value_type{&g.buffers[h.value]};
|
||||
},
|
||||
[&](const impl::ValueHandle<TextureTag, vertex_descriptor>& h) {
|
||||
return DeviceResourceGraph::vertex_value_type{&g.textures[h.value]};
|
||||
}),
|
||||
g.vertices[u].handle);
|
||||
}
|
||||
|
||||
inline DeviceResourceGraph::vertex_const_value_type
|
||||
value(DeviceResourceGraph::vertex_descriptor u, const DeviceResourceGraph& g) noexcept {
|
||||
using vertex_descriptor = DeviceResourceGraph::vertex_descriptor;
|
||||
return cc::visit(
|
||||
overload(
|
||||
[&](const impl::ValueHandle<BufferTag, vertex_descriptor>& h) {
|
||||
return DeviceResourceGraph::vertex_const_value_type{&g.buffers[h.value]};
|
||||
},
|
||||
[&](const impl::ValueHandle<TextureTag, vertex_descriptor>& h) {
|
||||
return DeviceResourceGraph::vertex_const_value_type{&g.textures[h.value]};
|
||||
}),
|
||||
g.vertices[u].handle);
|
||||
}
|
||||
|
||||
template <class Tag>
|
||||
inline bool
|
||||
holds_tag(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) noexcept; // NOLINT
|
||||
|
||||
template <>
|
||||
inline bool
|
||||
holds_tag<BufferTag>(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
return boost::variant2::holds_alternative<
|
||||
impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline bool
|
||||
holds_tag<TextureTag>(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
return boost::variant2::holds_alternative<
|
||||
impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
}
|
||||
|
||||
template <class ValueT>
|
||||
inline bool
|
||||
holds_alternative(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) noexcept; // NOLINT
|
||||
|
||||
template <>
|
||||
inline bool
|
||||
holds_alternative<std::unique_ptr<gfx::Buffer>>(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
return boost::variant2::holds_alternative<
|
||||
impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
}
|
||||
|
||||
template <>
|
||||
inline bool
|
||||
holds_alternative<std::unique_ptr<gfx::Texture>>(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) noexcept { // NOLINT
|
||||
return boost::variant2::holds_alternative<
|
||||
impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
}
|
||||
|
||||
template <class ValueT>
|
||||
inline ValueT&
|
||||
get(DeviceResourceGraph::vertex_descriptor /*v*/, DeviceResourceGraph& /*g*/);
|
||||
|
||||
template <>
|
||||
inline std::unique_ptr<gfx::Buffer>&
|
||||
get<std::unique_ptr<gfx::Buffer>>(DeviceResourceGraph::vertex_descriptor v, DeviceResourceGraph& g) {
|
||||
auto& handle = boost::variant2::get<
|
||||
impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
return g.buffers[handle.value];
|
||||
}
|
||||
|
||||
template <>
|
||||
inline std::unique_ptr<gfx::Texture>&
|
||||
get<std::unique_ptr<gfx::Texture>>(DeviceResourceGraph::vertex_descriptor v, DeviceResourceGraph& g) {
|
||||
auto& handle = boost::variant2::get<
|
||||
impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
return g.textures[handle.value];
|
||||
}
|
||||
|
||||
template <class ValueT>
|
||||
inline const ValueT&
|
||||
get(DeviceResourceGraph::vertex_descriptor /*v*/, const DeviceResourceGraph& /*g*/);
|
||||
|
||||
template <>
|
||||
inline const std::unique_ptr<gfx::Buffer>&
|
||||
get<std::unique_ptr<gfx::Buffer>>(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) {
|
||||
const auto& handle = boost::variant2::get<
|
||||
impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
return g.buffers[handle.value];
|
||||
}
|
||||
|
||||
template <>
|
||||
inline const std::unique_ptr<gfx::Texture>&
|
||||
get<std::unique_ptr<gfx::Texture>>(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) {
|
||||
const auto& handle = boost::variant2::get<
|
||||
impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
return g.textures[handle.value];
|
||||
}
|
||||
|
||||
inline std::unique_ptr<gfx::Buffer>&
|
||||
get(BufferTag /*tag*/, DeviceResourceGraph::vertex_descriptor v, DeviceResourceGraph& g) {
|
||||
auto& handle = boost::variant2::get<
|
||||
impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
return g.buffers[handle.value];
|
||||
}
|
||||
|
||||
inline std::unique_ptr<gfx::Texture>&
|
||||
get(TextureTag /*tag*/, DeviceResourceGraph::vertex_descriptor v, DeviceResourceGraph& g) {
|
||||
auto& handle = boost::variant2::get<
|
||||
impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
return g.textures[handle.value];
|
||||
}
|
||||
|
||||
inline const std::unique_ptr<gfx::Buffer>&
|
||||
get(BufferTag /*tag*/, DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) {
|
||||
const auto& handle = boost::variant2::get<
|
||||
impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
return g.buffers[handle.value];
|
||||
}
|
||||
|
||||
inline const std::unique_ptr<gfx::Texture>&
|
||||
get(TextureTag /*tag*/, DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph& g) {
|
||||
const auto& handle = boost::variant2::get<
|
||||
impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
g.vertices[v].handle);
|
||||
return g.textures[handle.value];
|
||||
}
|
||||
|
||||
template <class ValueT>
|
||||
inline ValueT*
|
||||
get_if(DeviceResourceGraph::vertex_descriptor v, DeviceResourceGraph* pGraph) noexcept; // NOLINT
|
||||
|
||||
template <>
|
||||
inline std::unique_ptr<gfx::Buffer>*
|
||||
get_if<std::unique_ptr<gfx::Buffer>>(DeviceResourceGraph::vertex_descriptor v, DeviceResourceGraph* pGraph) noexcept { // NOLINT
|
||||
std::unique_ptr<gfx::Buffer>* ptr = nullptr;
|
||||
if (!pGraph) {
|
||||
return ptr;
|
||||
}
|
||||
auto& g = *pGraph;
|
||||
auto* pHandle = boost::variant2::get_if<
|
||||
impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
&g.vertices[v].handle);
|
||||
if (pHandle) {
|
||||
ptr = &g.buffers[pHandle->value];
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline std::unique_ptr<gfx::Texture>*
|
||||
get_if<std::unique_ptr<gfx::Texture>>(DeviceResourceGraph::vertex_descriptor v, DeviceResourceGraph* pGraph) noexcept { // NOLINT
|
||||
std::unique_ptr<gfx::Texture>* ptr = nullptr;
|
||||
if (!pGraph) {
|
||||
return ptr;
|
||||
}
|
||||
auto& g = *pGraph;
|
||||
auto* pHandle = boost::variant2::get_if<
|
||||
impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
&g.vertices[v].handle);
|
||||
if (pHandle) {
|
||||
ptr = &g.textures[pHandle->value];
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <class ValueT>
|
||||
inline const ValueT*
|
||||
get_if(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph* pGraph) noexcept; // NOLINT
|
||||
|
||||
template <>
|
||||
inline const std::unique_ptr<gfx::Buffer>*
|
||||
get_if<std::unique_ptr<gfx::Buffer>>(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph* pGraph) noexcept { // NOLINT
|
||||
const std::unique_ptr<gfx::Buffer>* ptr = nullptr;
|
||||
if (!pGraph) {
|
||||
return ptr;
|
||||
}
|
||||
const auto& g = *pGraph;
|
||||
const auto* pHandle = boost::variant2::get_if<
|
||||
impl::ValueHandle<BufferTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
&g.vertices[v].handle);
|
||||
if (pHandle) {
|
||||
ptr = &g.buffers[pHandle->value];
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline const std::unique_ptr<gfx::Texture>*
|
||||
get_if<std::unique_ptr<gfx::Texture>>(DeviceResourceGraph::vertex_descriptor v, const DeviceResourceGraph* pGraph) noexcept { // NOLINT
|
||||
const std::unique_ptr<gfx::Texture>* ptr = nullptr;
|
||||
if (!pGraph) {
|
||||
return ptr;
|
||||
}
|
||||
const auto& g = *pGraph;
|
||||
const auto* pHandle = boost::variant2::get_if<
|
||||
impl::ValueHandle<TextureTag, DeviceResourceGraph::vertex_descriptor>>(
|
||||
&g.vertices[v].handle);
|
||||
if (pHandle) {
|
||||
ptr = &g.textures[pHandle->value];
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
||||
// Vertex Constant Getter
|
||||
template <class Tag>
|
||||
inline decltype(auto)
|
||||
get(Tag tag, const DeviceResourceGraph& g, DeviceResourceGraph::vertex_descriptor v) noexcept {
|
||||
return get(get(tag, g), v);
|
||||
}
|
||||
|
||||
// Vertex Mutable Getter
|
||||
template <class Tag>
|
||||
inline decltype(auto)
|
||||
get(Tag tag, DeviceResourceGraph& g, DeviceResourceGraph::vertex_descriptor v) noexcept {
|
||||
return get(get(tag, g), v);
|
||||
}
|
||||
|
||||
// Vertex Setter
|
||||
template <class Tag, class... Args>
|
||||
inline void put(
|
||||
Tag tag, DeviceResourceGraph& g,
|
||||
DeviceResourceGraph::vertex_descriptor v,
|
||||
Args&&... args) {
|
||||
put(get(tag, g), v, std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
// MutableGraph(Vertex)
|
||||
template <class Tag>
|
||||
inline DeviceResourceGraph::vertex_descriptor
|
||||
add_vertex(DeviceResourceGraph& g, Tag t, std::string&& name) { // NOLINT
|
||||
return add_vertex(
|
||||
t,
|
||||
std::forward_as_tuple(std::move(name)), // names
|
||||
std::forward_as_tuple(), // refCounts
|
||||
std::forward_as_tuple(), // PolymorphicType
|
||||
g);
|
||||
}
|
||||
|
||||
template <class Tag>
|
||||
inline DeviceResourceGraph::vertex_descriptor
|
||||
add_vertex(DeviceResourceGraph& g, Tag t, const char* name) { // NOLINT
|
||||
return add_vertex(
|
||||
t,
|
||||
std::forward_as_tuple(name), // names
|
||||
std::forward_as_tuple(), // refCounts
|
||||
std::forward_as_tuple(), // PolymorphicType
|
||||
g);
|
||||
}
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "cocos/renderer/pipeline/custom/JsbConversion.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExecutorJsb.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExecutorTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,37 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/bindings/manual/jsb_conversions.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonJsb.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExecutorFwd.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,46 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonNames.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExecutorTypes.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
inline const char* getName(const DeviceResourceGraph& /*v*/) noexcept { return "DeviceResourceGraph"; }
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderExecutorReflection.h"
|
||||
#include "RenderExecutorTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonReflection.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExecutorFwd.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,70 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderExecutorTypes.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
DeviceResourceGraph::DeviceResourceGraph(const allocator_type& alloc) noexcept
|
||||
: vertices(alloc),
|
||||
names(alloc),
|
||||
refCounts(alloc),
|
||||
buffers(alloc),
|
||||
textures(alloc) {}
|
||||
|
||||
// ContinuousContainer
|
||||
void DeviceResourceGraph::reserve(vertices_size_type sz) {
|
||||
vertices.reserve(sz);
|
||||
names.reserve(sz);
|
||||
refCounts.reserve(sz);
|
||||
}
|
||||
|
||||
DeviceResourceGraph::vertex_type::vertex_type(const allocator_type& alloc) noexcept
|
||||
: outEdges(alloc),
|
||||
inEdges(alloc) {}
|
||||
|
||||
DeviceResourceGraph::vertex_type::vertex_type(vertex_type&& rhs, const allocator_type& alloc)
|
||||
: outEdges(std::move(rhs.outEdges), alloc),
|
||||
inEdges(std::move(rhs.inEdges), alloc),
|
||||
handle(std::move(rhs.handle)) {}
|
||||
|
||||
DeviceResourceGraph::vertex_type::vertex_type(vertex_type const& rhs, const allocator_type& alloc)
|
||||
: outEdges(rhs.outEdges, alloc),
|
||||
inEdges(rhs.inEdges, alloc),
|
||||
handle(rhs.handle) {}
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,184 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/container/pmr/vector.hpp>
|
||||
#include <boost/graph/adjacency_iterator.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/range/irange.hpp>
|
||||
#include "cocos/renderer/gfx-base/GFXBuffer.h"
|
||||
#include "cocos/renderer/gfx-base/GFXDef-common.h"
|
||||
#include "cocos/renderer/gfx-base/GFXTexture.h"
|
||||
#include "cocos/renderer/pipeline/custom/GraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderExecutorFwd.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
struct DeviceResourceGraph {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {vertices.get_allocator().resource()};
|
||||
}
|
||||
|
||||
inline boost::container::pmr::memory_resource* resource() const noexcept {
|
||||
return get_allocator().resource();
|
||||
}
|
||||
|
||||
DeviceResourceGraph(const allocator_type& alloc) noexcept; // NOLINT
|
||||
DeviceResourceGraph(DeviceResourceGraph&& rhs) = delete;
|
||||
DeviceResourceGraph(DeviceResourceGraph const& rhs) = delete;
|
||||
DeviceResourceGraph& operator=(DeviceResourceGraph&& rhs) = delete;
|
||||
DeviceResourceGraph& operator=(DeviceResourceGraph const& rhs) = delete;
|
||||
|
||||
// Graph
|
||||
using directed_category = boost::bidirectional_tag;
|
||||
using vertex_descriptor = uint32_t;
|
||||
using edge_descriptor = impl::EdgeDescriptor<directed_category, vertex_descriptor>;
|
||||
using edge_parallel_category = boost::allow_parallel_edge_tag;
|
||||
struct traversal_category // NOLINT
|
||||
: virtual boost::incidence_graph_tag,
|
||||
virtual boost::bidirectional_graph_tag,
|
||||
virtual boost::adjacency_graph_tag,
|
||||
virtual boost::vertex_list_graph_tag,
|
||||
virtual boost::edge_list_graph_tag {};
|
||||
|
||||
constexpr static vertex_descriptor null_vertex() noexcept { // NOLINT
|
||||
return std::numeric_limits<vertex_descriptor>::max();
|
||||
}
|
||||
|
||||
// IncidenceGraph
|
||||
using out_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using out_edge_iterator = impl::OutEdgeIter<
|
||||
boost::container::pmr::vector<out_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
using degree_size_type = uint32_t;
|
||||
|
||||
// BidirectionalGraph
|
||||
using in_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using in_edge_iterator = impl::InEdgeIter<
|
||||
boost::container::pmr::vector<in_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
|
||||
// AdjacencyGraph
|
||||
using adjacency_iterator = boost::adjacency_iterator_generator<
|
||||
DeviceResourceGraph, vertex_descriptor, out_edge_iterator>::type;
|
||||
|
||||
// VertexListGraph
|
||||
using vertex_iterator = boost::integer_range<vertex_descriptor>::iterator;
|
||||
using vertices_size_type = uint32_t;
|
||||
|
||||
// VertexList help functions
|
||||
inline boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
|
||||
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
|
||||
return {0, static_cast<vertices_size_type>(vertices.size())};
|
||||
}
|
||||
|
||||
inline vertex_descriptor getCurrentID() const noexcept {
|
||||
return static_cast<vertex_descriptor>(vertices.size());
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
|
||||
return boost::container::pmr::vector<boost::default_color_type>(vertices.size(), mr);
|
||||
}
|
||||
|
||||
// EdgeListGraph
|
||||
using edge_iterator = impl::DirectedEdgeIterator<vertex_iterator, out_edge_iterator, DeviceResourceGraph>;
|
||||
using edges_size_type = uint32_t;
|
||||
|
||||
// PolymorphicGraph
|
||||
using vertex_tag_type = boost::variant2::variant<BufferTag, TextureTag>;
|
||||
using vertex_value_type = boost::variant2::variant<std::unique_ptr<gfx::Buffer>*, std::unique_ptr<gfx::Texture>*>;
|
||||
using vertex_const_value_type = boost::variant2::variant<const std::unique_ptr<gfx::Buffer>*, const std::unique_ptr<gfx::Texture>*>;
|
||||
using vertex_handle_type = boost::variant2::variant<
|
||||
impl::ValueHandle<BufferTag, vertex_descriptor>,
|
||||
impl::ValueHandle<TextureTag, vertex_descriptor>>;
|
||||
|
||||
// ContinuousContainer
|
||||
void reserve(vertices_size_type sz);
|
||||
|
||||
// Members
|
||||
struct vertex_type { // NOLINT
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {outEdges.get_allocator().resource()};
|
||||
}
|
||||
|
||||
vertex_type(const allocator_type& alloc) noexcept; // NOLINT
|
||||
vertex_type(vertex_type&& rhs, const allocator_type& alloc);
|
||||
vertex_type(vertex_type const& rhs, const allocator_type& alloc);
|
||||
|
||||
vertex_type(vertex_type&& rhs) noexcept = default;
|
||||
vertex_type(vertex_type const& rhs) = delete;
|
||||
vertex_type& operator=(vertex_type&& rhs) = default;
|
||||
vertex_type& operator=(vertex_type const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<out_edge_type> outEdges;
|
||||
boost::container::pmr::vector<in_edge_type> inEdges;
|
||||
vertex_handle_type handle;
|
||||
};
|
||||
|
||||
struct NameTag {
|
||||
} static constexpr Name{}; // NOLINT
|
||||
struct RefCountTag {
|
||||
} static constexpr RefCount{}; // NOLINT
|
||||
|
||||
// Vertices
|
||||
boost::container::pmr::vector<vertex_type> vertices;
|
||||
// Components
|
||||
boost::container::pmr::vector<std::string> names;
|
||||
boost::container::pmr::vector<int32_t> refCounts;
|
||||
// PolymorphicGraph
|
||||
boost::container::pmr::vector<std::unique_ptr<gfx::Buffer>> buffers;
|
||||
boost::container::pmr::vector<std::unique_ptr<gfx::Texture>> textures;
|
||||
};
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,84 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include "cocos/renderer/gfx-base/GFXDef-common.h"
|
||||
#include "cocos/renderer/pipeline/PipelineSceneData.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonFwd.h"
|
||||
#include "cocos/scene/Camera.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
enum class ResourceFlags : uint32_t;
|
||||
enum class TextureLayout;
|
||||
|
||||
struct ResourceDesc;
|
||||
struct ResourceTraits;
|
||||
struct ResourceGraph;
|
||||
|
||||
enum class AttachmentType;
|
||||
enum class AccessType;
|
||||
|
||||
struct RasterView;
|
||||
|
||||
enum class ClearValueType;
|
||||
|
||||
struct ComputeView;
|
||||
struct RasterSubpass;
|
||||
struct SubpassGraph;
|
||||
struct RasterPass;
|
||||
struct ComputePass;
|
||||
struct CopyPair;
|
||||
struct CopyPass;
|
||||
struct MovePair;
|
||||
struct MovePass;
|
||||
struct RaytracePass;
|
||||
struct QueueTag;
|
||||
struct SceneTag;
|
||||
struct DispatchTag;
|
||||
struct BlitTag;
|
||||
struct PresentTag;
|
||||
struct RenderQueue;
|
||||
struct SceneData;
|
||||
struct Dispatch;
|
||||
struct Blit;
|
||||
struct PresentPass;
|
||||
struct RenderData;
|
||||
struct RenderGraph;
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,312 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "cocos/bindings/auto/jsb_gfx_auto.h"
|
||||
#include "cocos/renderer/pipeline/custom/JsbConversion.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphJsb.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphTypes.h"
|
||||
|
||||
bool nativevalue_to_se(const cc::render::RasterView &from, se::Value &to, se::Object *ctx) { // NOLINT
|
||||
se::HandleObject obj(se::Object::createPlainObject());
|
||||
se::Value tmp;
|
||||
|
||||
nativevalue_to_se(from.slotName, tmp, ctx);
|
||||
obj->setProperty("slotName", tmp);
|
||||
|
||||
nativevalue_to_se(from.accessType, tmp, ctx);
|
||||
obj->setProperty("accessType", tmp);
|
||||
|
||||
nativevalue_to_se(from.attachmentType, tmp, ctx);
|
||||
obj->setProperty("attachmentType", tmp);
|
||||
|
||||
nativevalue_to_se(from.loadOp, tmp, ctx);
|
||||
obj->setProperty("loadOp", tmp);
|
||||
|
||||
nativevalue_to_se(from.storeOp, tmp, ctx);
|
||||
obj->setProperty("storeOp", tmp);
|
||||
|
||||
nativevalue_to_se(from.clearFlags, tmp, ctx);
|
||||
obj->setProperty("clearFlags", tmp);
|
||||
|
||||
nativevalue_to_se(from.clearColor, tmp, ctx);
|
||||
obj->setProperty("clearColor", tmp);
|
||||
|
||||
to.setObject(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool nativevalue_to_se(const cc::render::ComputeView &from, se::Value &to, se::Object *ctx) { // NOLINT
|
||||
se::HandleObject obj(se::Object::createPlainObject());
|
||||
se::Value tmp;
|
||||
|
||||
nativevalue_to_se(from.name, tmp, ctx);
|
||||
obj->setProperty("name", tmp);
|
||||
|
||||
nativevalue_to_se(from.accessType, tmp, ctx);
|
||||
obj->setProperty("accessType", tmp);
|
||||
|
||||
nativevalue_to_se(from.clearFlags, tmp, ctx);
|
||||
obj->setProperty("clearFlags", tmp);
|
||||
|
||||
nativevalue_to_se(from.clearColor, tmp, ctx);
|
||||
obj->setProperty("clearColor", tmp);
|
||||
|
||||
nativevalue_to_se(from.clearValueType, tmp, ctx);
|
||||
obj->setProperty("clearValueType", tmp);
|
||||
|
||||
to.setObject(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool nativevalue_to_se(const cc::render::CopyPair &from, se::Value &to, se::Object *ctx) { // NOLINT
|
||||
se::HandleObject obj(se::Object::createPlainObject());
|
||||
se::Value tmp;
|
||||
|
||||
nativevalue_to_se(from.source, tmp, ctx);
|
||||
obj->setProperty("source", tmp);
|
||||
|
||||
nativevalue_to_se(from.target, tmp, ctx);
|
||||
obj->setProperty("target", tmp);
|
||||
|
||||
nativevalue_to_se(from.mipLevels, tmp, ctx);
|
||||
obj->setProperty("mipLevels", tmp);
|
||||
|
||||
nativevalue_to_se(from.numSlices, tmp, ctx);
|
||||
obj->setProperty("numSlices", tmp);
|
||||
|
||||
nativevalue_to_se(from.sourceMostDetailedMip, tmp, ctx);
|
||||
obj->setProperty("sourceMostDetailedMip", tmp);
|
||||
|
||||
nativevalue_to_se(from.sourceFirstSlice, tmp, ctx);
|
||||
obj->setProperty("sourceFirstSlice", tmp);
|
||||
|
||||
nativevalue_to_se(from.sourcePlaneSlice, tmp, ctx);
|
||||
obj->setProperty("sourcePlaneSlice", tmp);
|
||||
|
||||
nativevalue_to_se(from.targetMostDetailedMip, tmp, ctx);
|
||||
obj->setProperty("targetMostDetailedMip", tmp);
|
||||
|
||||
nativevalue_to_se(from.targetFirstSlice, tmp, ctx);
|
||||
obj->setProperty("targetFirstSlice", tmp);
|
||||
|
||||
nativevalue_to_se(from.targetPlaneSlice, tmp, ctx);
|
||||
obj->setProperty("targetPlaneSlice", tmp);
|
||||
|
||||
to.setObject(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool nativevalue_to_se(const cc::render::MovePair &from, se::Value &to, se::Object *ctx) { // NOLINT
|
||||
se::HandleObject obj(se::Object::createPlainObject());
|
||||
se::Value tmp;
|
||||
|
||||
nativevalue_to_se(from.source, tmp, ctx);
|
||||
obj->setProperty("source", tmp);
|
||||
|
||||
nativevalue_to_se(from.target, tmp, ctx);
|
||||
obj->setProperty("target", tmp);
|
||||
|
||||
nativevalue_to_se(from.mipLevels, tmp, ctx);
|
||||
obj->setProperty("mipLevels", tmp);
|
||||
|
||||
nativevalue_to_se(from.numSlices, tmp, ctx);
|
||||
obj->setProperty("numSlices", tmp);
|
||||
|
||||
nativevalue_to_se(from.targetMostDetailedMip, tmp, ctx);
|
||||
obj->setProperty("targetMostDetailedMip", tmp);
|
||||
|
||||
nativevalue_to_se(from.targetFirstSlice, tmp, ctx);
|
||||
obj->setProperty("targetFirstSlice", tmp);
|
||||
|
||||
nativevalue_to_se(from.targetPlaneSlice, tmp, ctx);
|
||||
obj->setProperty("targetPlaneSlice", tmp);
|
||||
|
||||
to.setObject(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool sevalue_to_native<cc::render::RasterView>(const se::Value &from, cc::render::RasterView *to, se::Object *ctx) { // NOLINT
|
||||
SE_PRECONDITION2(from.isObject(), false, " Convert parameter to RasterView failed !");
|
||||
|
||||
auto *obj = const_cast<se::Object *>(from.toObject());
|
||||
bool ok = true;
|
||||
se::Value field;
|
||||
obj->getProperty("slotName", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->slotName), ctx);
|
||||
}
|
||||
obj->getProperty("accessType", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->accessType), ctx);
|
||||
}
|
||||
obj->getProperty("attachmentType", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->attachmentType), ctx);
|
||||
}
|
||||
obj->getProperty("loadOp", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->loadOp), ctx);
|
||||
}
|
||||
obj->getProperty("storeOp", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->storeOp), ctx);
|
||||
}
|
||||
obj->getProperty("clearFlags", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->clearFlags), ctx);
|
||||
}
|
||||
obj->getProperty("clearColor", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->clearColor), ctx);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool sevalue_to_native<cc::render::ComputeView>(const se::Value &from, cc::render::ComputeView *to, se::Object *ctx) { // NOLINT
|
||||
SE_PRECONDITION2(from.isObject(), false, " Convert parameter to ComputeView failed !");
|
||||
|
||||
auto *obj = const_cast<se::Object *>(from.toObject());
|
||||
bool ok = true;
|
||||
se::Value field;
|
||||
obj->getProperty("name", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->name), ctx);
|
||||
}
|
||||
obj->getProperty("accessType", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->accessType), ctx);
|
||||
}
|
||||
obj->getProperty("clearFlags", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->clearFlags), ctx);
|
||||
}
|
||||
obj->getProperty("clearColor", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->clearColor), ctx);
|
||||
}
|
||||
obj->getProperty("clearValueType", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->clearValueType), ctx);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool sevalue_to_native<cc::render::CopyPair>(const se::Value &from, cc::render::CopyPair *to, se::Object *ctx) { // NOLINT
|
||||
SE_PRECONDITION2(from.isObject(), false, " Convert parameter to CopyPair failed !");
|
||||
|
||||
auto *obj = const_cast<se::Object *>(from.toObject());
|
||||
bool ok = true;
|
||||
se::Value field;
|
||||
obj->getProperty("source", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->source), ctx);
|
||||
}
|
||||
obj->getProperty("target", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->target), ctx);
|
||||
}
|
||||
obj->getProperty("mipLevels", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->mipLevels), ctx);
|
||||
}
|
||||
obj->getProperty("numSlices", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->numSlices), ctx);
|
||||
}
|
||||
obj->getProperty("sourceMostDetailedMip", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->sourceMostDetailedMip), ctx);
|
||||
}
|
||||
obj->getProperty("sourceFirstSlice", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->sourceFirstSlice), ctx);
|
||||
}
|
||||
obj->getProperty("sourcePlaneSlice", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->sourcePlaneSlice), ctx);
|
||||
}
|
||||
obj->getProperty("targetMostDetailedMip", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->targetMostDetailedMip), ctx);
|
||||
}
|
||||
obj->getProperty("targetFirstSlice", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->targetFirstSlice), ctx);
|
||||
}
|
||||
obj->getProperty("targetPlaneSlice", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->targetPlaneSlice), ctx);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
template <>
|
||||
bool sevalue_to_native<cc::render::MovePair>(const se::Value &from, cc::render::MovePair *to, se::Object *ctx) { // NOLINT
|
||||
SE_PRECONDITION2(from.isObject(), false, " Convert parameter to MovePair failed !");
|
||||
|
||||
auto *obj = const_cast<se::Object *>(from.toObject());
|
||||
bool ok = true;
|
||||
se::Value field;
|
||||
obj->getProperty("source", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->source), ctx);
|
||||
}
|
||||
obj->getProperty("target", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->target), ctx);
|
||||
}
|
||||
obj->getProperty("mipLevels", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->mipLevels), ctx);
|
||||
}
|
||||
obj->getProperty("numSlices", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->numSlices), ctx);
|
||||
}
|
||||
obj->getProperty("targetMostDetailedMip", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->targetMostDetailedMip), ctx);
|
||||
}
|
||||
obj->getProperty("targetFirstSlice", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->targetFirstSlice), ctx);
|
||||
}
|
||||
obj->getProperty("targetPlaneSlice", &field, true);
|
||||
if(!field.isNullOrUndefined()) {
|
||||
ok &= sevalue_to_native(field, &(to->targetPlaneSlice), ctx);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,58 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/bindings/manual/jsb_conversions.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonJsb.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphFwd.h"
|
||||
|
||||
bool nativevalue_to_se(const cc::render::RasterView &from, se::Value &to, se::Object *ctx); // NOLINT
|
||||
|
||||
bool nativevalue_to_se(const cc::render::ComputeView &from, se::Value &to, se::Object *ctx); // NOLINT
|
||||
|
||||
bool nativevalue_to_se(const cc::render::CopyPair &from, se::Value &to, se::Object *ctx); // NOLINT
|
||||
|
||||
bool nativevalue_to_se(const cc::render::MovePair &from, se::Value &to, se::Object *ctx); // NOLINT
|
||||
|
||||
// if function overload is used, android build fails
|
||||
template <>
|
||||
bool sevalue_to_native(const se::Value &from, cc::render::RasterView *to, se::Object *ctx); // NOLINT
|
||||
|
||||
template <>
|
||||
bool sevalue_to_native(const se::Value &from, cc::render::ComputeView *to, se::Object *ctx); // NOLINT
|
||||
|
||||
template <>
|
||||
bool sevalue_to_native(const se::Value &from, cc::render::CopyPair *to, se::Object *ctx); // NOLINT
|
||||
|
||||
template <>
|
||||
bool sevalue_to_native(const se::Value &from, cc::render::MovePair *to, se::Object *ctx); // NOLINT
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,102 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonNames.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphTypes.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
inline const char* getName(TextureLayout e) noexcept {
|
||||
switch (e) {
|
||||
case TextureLayout::UNKNOWN: return "UNKNOWN";
|
||||
case TextureLayout::ROW_MAJOR: return "ROW_MAJOR";
|
||||
case TextureLayout::UNDEFINED_SWIZZLE: return "UNDEFINED_SWIZZLE";
|
||||
case TextureLayout::STANDARD_SWIZZLE: return "STANDARD_SWIZZLE";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
inline const char* getName(const ResourceDesc& /*v*/) noexcept { return "ResourceDesc"; }
|
||||
inline const char* getName(const ResourceTraits& /*v*/) noexcept { return "ResourceTraits"; }
|
||||
inline const char* getName(const ResourceGraph& /*v*/) noexcept { return "ResourceGraph"; }
|
||||
inline const char* getName(AttachmentType e) noexcept {
|
||||
switch (e) {
|
||||
case AttachmentType::RENDER_TARGET: return "RENDER_TARGET";
|
||||
case AttachmentType::DEPTH_STENCIL: return "DEPTH_STENCIL";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
inline const char* getName(AccessType e) noexcept {
|
||||
switch (e) {
|
||||
case AccessType::READ: return "READ";
|
||||
case AccessType::READ_WRITE: return "READ_WRITE";
|
||||
case AccessType::WRITE: return "WRITE";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
inline const char* getName(const RasterView& /*v*/) noexcept { return "RasterView"; }
|
||||
inline const char* getName(ClearValueType e) noexcept {
|
||||
switch (e) {
|
||||
case ClearValueType::FLOAT_TYPE: return "FLOAT_TYPE";
|
||||
case ClearValueType::INT_TYPE: return "INT_TYPE";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
inline const char* getName(const ComputeView& /*v*/) noexcept { return "ComputeView"; }
|
||||
inline const char* getName(const RasterSubpass& /*v*/) noexcept { return "RasterSubpass"; }
|
||||
inline const char* getName(const SubpassGraph& /*v*/) noexcept { return "SubpassGraph"; }
|
||||
inline const char* getName(const RasterPass& /*v*/) noexcept { return "RasterPass"; }
|
||||
inline const char* getName(const ComputePass& /*v*/) noexcept { return "ComputePass"; }
|
||||
inline const char* getName(const CopyPair& /*v*/) noexcept { return "CopyPair"; }
|
||||
inline const char* getName(const CopyPass& /*v*/) noexcept { return "CopyPass"; }
|
||||
inline const char* getName(const MovePair& /*v*/) noexcept { return "MovePair"; }
|
||||
inline const char* getName(const MovePass& /*v*/) noexcept { return "MovePass"; }
|
||||
inline const char* getName(const RaytracePass& /*v*/) noexcept { return "RaytracePass"; }
|
||||
inline const char* getName(const QueueTag& /*v*/) noexcept { return "Queue"; }
|
||||
inline const char* getName(const SceneTag& /*v*/) noexcept { return "Scene"; }
|
||||
inline const char* getName(const DispatchTag& /*v*/) noexcept { return "Dispatch"; }
|
||||
inline const char* getName(const BlitTag& /*v*/) noexcept { return "Blit"; }
|
||||
inline const char* getName(const PresentTag& /*v*/) noexcept { return "Present"; }
|
||||
inline const char* getName(const RenderQueue& /*v*/) noexcept { return "RenderQueue"; }
|
||||
inline const char* getName(const SceneData& /*v*/) noexcept { return "SceneData"; }
|
||||
inline const char* getName(const Dispatch& /*v*/) noexcept { return "Dispatch"; }
|
||||
inline const char* getName(const Blit& /*v*/) noexcept { return "Blit"; }
|
||||
inline const char* getName(const PresentPass& /*v*/) noexcept { return "PresentPass"; }
|
||||
inline const char* getName(const RenderData& /*v*/) noexcept { return "RenderData"; }
|
||||
inline const char* getName(const RenderGraph& /*v*/) noexcept { return "RenderGraph"; }
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,35 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderGraphReflection.h"
|
||||
#include "RenderGraphTypes.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonReflection.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphFwd.h"
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,450 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderGraphTypes.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
ResourceGraph::ResourceGraph(const allocator_type& alloc) noexcept
|
||||
: vertices(alloc),
|
||||
names(alloc),
|
||||
descs(alloc),
|
||||
traits(alloc),
|
||||
valueIndex(alloc) {}
|
||||
|
||||
ResourceGraph::ResourceGraph(ResourceGraph&& rhs, const allocator_type& 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),
|
||||
valueIndex(std::move(rhs.valueIndex), alloc) {}
|
||||
|
||||
ResourceGraph::ResourceGraph(ResourceGraph const& rhs, const allocator_type& alloc)
|
||||
: vertices(rhs.vertices, alloc),
|
||||
names(rhs.names, alloc),
|
||||
descs(rhs.descs, alloc),
|
||||
traits(rhs.traits, alloc),
|
||||
valueIndex(rhs.valueIndex, alloc) {}
|
||||
|
||||
// ContinuousContainer
|
||||
void ResourceGraph::reserve(vertices_size_type sz) {
|
||||
vertices.reserve(sz);
|
||||
names.reserve(sz);
|
||||
descs.reserve(sz);
|
||||
traits.reserve(sz);
|
||||
}
|
||||
|
||||
ResourceGraph::vertex_type::vertex_type(const allocator_type& alloc) noexcept
|
||||
: outEdges(alloc),
|
||||
inEdges(alloc) {}
|
||||
|
||||
ResourceGraph::vertex_type::vertex_type(vertex_type&& rhs, const allocator_type& alloc)
|
||||
: outEdges(std::move(rhs.outEdges), alloc),
|
||||
inEdges(std::move(rhs.inEdges), alloc) {}
|
||||
|
||||
ResourceGraph::vertex_type::vertex_type(vertex_type const& rhs, const allocator_type& alloc)
|
||||
: outEdges(rhs.outEdges, alloc),
|
||||
inEdges(rhs.inEdges, alloc) {}
|
||||
|
||||
RasterView::RasterView(const allocator_type& alloc) noexcept
|
||||
: slotName(alloc) {}
|
||||
|
||||
RasterView::RasterView(PmrString slotNameIn, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, const allocator_type& alloc) noexcept
|
||||
: slotName(std::move(slotNameIn), alloc),
|
||||
accessType(accessTypeIn),
|
||||
attachmentType(attachmentTypeIn),
|
||||
loadOp(loadOpIn),
|
||||
storeOp(storeOpIn),
|
||||
clearFlags(clearFlagsIn),
|
||||
clearColor(clearColorIn) {}
|
||||
|
||||
RasterView::RasterView(RasterView&& rhs, const allocator_type& alloc)
|
||||
: slotName(std::move(rhs.slotName), alloc),
|
||||
accessType(rhs.accessType),
|
||||
attachmentType(rhs.attachmentType),
|
||||
loadOp(rhs.loadOp),
|
||||
storeOp(rhs.storeOp),
|
||||
clearFlags(rhs.clearFlags),
|
||||
clearColor(rhs.clearColor) {}
|
||||
|
||||
RasterView::RasterView(RasterView const& rhs, const allocator_type& alloc)
|
||||
: slotName(rhs.slotName, alloc),
|
||||
accessType(rhs.accessType),
|
||||
attachmentType(rhs.attachmentType),
|
||||
loadOp(rhs.loadOp),
|
||||
storeOp(rhs.storeOp),
|
||||
clearFlags(rhs.clearFlags),
|
||||
clearColor(rhs.clearColor) {}
|
||||
|
||||
ComputeView::ComputeView(const allocator_type& alloc) noexcept
|
||||
: name(alloc) {}
|
||||
|
||||
ComputeView::ComputeView(ComputeView&& rhs, const allocator_type& alloc)
|
||||
: name(std::move(rhs.name), alloc),
|
||||
accessType(rhs.accessType),
|
||||
clearFlags(rhs.clearFlags),
|
||||
clearColor(rhs.clearColor),
|
||||
clearValueType(rhs.clearValueType) {}
|
||||
|
||||
ComputeView::ComputeView(ComputeView const& rhs, const allocator_type& alloc)
|
||||
: name(rhs.name, alloc),
|
||||
accessType(rhs.accessType),
|
||||
clearFlags(rhs.clearFlags),
|
||||
clearColor(rhs.clearColor),
|
||||
clearValueType(rhs.clearValueType) {}
|
||||
|
||||
RasterSubpass::RasterSubpass(const allocator_type& alloc) noexcept
|
||||
: rasterViews(alloc),
|
||||
computeViews(alloc) {}
|
||||
|
||||
RasterSubpass::RasterSubpass(RasterSubpass&& rhs, const allocator_type& alloc)
|
||||
: rasterViews(std::move(rhs.rasterViews), alloc),
|
||||
computeViews(std::move(rhs.computeViews), alloc) {}
|
||||
|
||||
RasterSubpass::RasterSubpass(RasterSubpass const& rhs, const allocator_type& alloc)
|
||||
: rasterViews(rhs.rasterViews, alloc),
|
||||
computeViews(rhs.computeViews, alloc) {}
|
||||
|
||||
SubpassGraph::SubpassGraph(const allocator_type& alloc) noexcept
|
||||
: vertices(alloc),
|
||||
names(alloc),
|
||||
subpasses(alloc) {}
|
||||
|
||||
SubpassGraph::SubpassGraph(SubpassGraph&& rhs, const allocator_type& 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),
|
||||
names(rhs.names, alloc),
|
||||
subpasses(rhs.subpasses, alloc) {}
|
||||
|
||||
// ContinuousContainer
|
||||
void SubpassGraph::reserve(vertices_size_type sz) {
|
||||
vertices.reserve(sz);
|
||||
names.reserve(sz);
|
||||
subpasses.reserve(sz);
|
||||
}
|
||||
|
||||
SubpassGraph::vertex_type::vertex_type(const allocator_type& alloc) noexcept
|
||||
: outEdges(alloc),
|
||||
inEdges(alloc) {}
|
||||
|
||||
SubpassGraph::vertex_type::vertex_type(vertex_type&& rhs, const allocator_type& alloc)
|
||||
: outEdges(std::move(rhs.outEdges), alloc),
|
||||
inEdges(std::move(rhs.inEdges), alloc) {}
|
||||
|
||||
SubpassGraph::vertex_type::vertex_type(vertex_type const& rhs, const allocator_type& alloc)
|
||||
: outEdges(rhs.outEdges, alloc),
|
||||
inEdges(rhs.inEdges, alloc) {}
|
||||
|
||||
RasterPass::RasterPass(const allocator_type& alloc) noexcept
|
||||
: rasterViews(alloc),
|
||||
computeViews(alloc),
|
||||
subpassGraph(alloc) {}
|
||||
|
||||
RasterPass::RasterPass(RasterPass&& rhs, const allocator_type& alloc)
|
||||
: rasterViews(std::move(rhs.rasterViews), alloc),
|
||||
computeViews(std::move(rhs.computeViews), alloc),
|
||||
subpassGraph(std::move(rhs.subpassGraph), alloc) {}
|
||||
|
||||
RasterPass::RasterPass(RasterPass const& rhs, const allocator_type& alloc)
|
||||
: rasterViews(rhs.rasterViews, alloc),
|
||||
computeViews(rhs.computeViews, alloc),
|
||||
subpassGraph(rhs.subpassGraph, alloc) {}
|
||||
|
||||
ComputePass::ComputePass(const allocator_type& alloc) noexcept
|
||||
: computeViews(alloc) {}
|
||||
|
||||
ComputePass::ComputePass(ComputePass&& rhs, const allocator_type& alloc)
|
||||
: computeViews(std::move(rhs.computeViews), alloc) {}
|
||||
|
||||
ComputePass::ComputePass(ComputePass const& rhs, const allocator_type& alloc)
|
||||
: computeViews(rhs.computeViews, alloc) {}
|
||||
|
||||
CopyPair::CopyPair(const allocator_type& alloc) noexcept
|
||||
: source(alloc),
|
||||
target(alloc) {}
|
||||
|
||||
CopyPair::CopyPair(PmrString sourceIn, PmrString targetIn, uint32_t mipLevelsIn, uint32_t numSlicesIn, uint32_t sourceMostDetailedMipIn, uint32_t sourceFirstSliceIn, uint32_t sourcePlaneSliceIn, uint32_t targetMostDetailedMipIn, uint32_t targetFirstSliceIn, uint32_t targetPlaneSliceIn, const allocator_type& alloc) noexcept // NOLINT
|
||||
: source(std::move(sourceIn), alloc),
|
||||
target(std::move(targetIn), alloc),
|
||||
mipLevels(mipLevelsIn),
|
||||
numSlices(numSlicesIn),
|
||||
sourceMostDetailedMip(sourceMostDetailedMipIn),
|
||||
sourceFirstSlice(sourceFirstSliceIn),
|
||||
sourcePlaneSlice(sourcePlaneSliceIn),
|
||||
targetMostDetailedMip(targetMostDetailedMipIn),
|
||||
targetFirstSlice(targetFirstSliceIn),
|
||||
targetPlaneSlice(targetPlaneSliceIn) {}
|
||||
|
||||
CopyPair::CopyPair(CopyPair&& rhs, const allocator_type& alloc)
|
||||
: source(std::move(rhs.source), alloc),
|
||||
target(std::move(rhs.target), alloc),
|
||||
mipLevels(rhs.mipLevels),
|
||||
numSlices(rhs.numSlices),
|
||||
sourceMostDetailedMip(rhs.sourceMostDetailedMip),
|
||||
sourceFirstSlice(rhs.sourceFirstSlice),
|
||||
sourcePlaneSlice(rhs.sourcePlaneSlice),
|
||||
targetMostDetailedMip(rhs.targetMostDetailedMip),
|
||||
targetFirstSlice(rhs.targetFirstSlice),
|
||||
targetPlaneSlice(rhs.targetPlaneSlice) {}
|
||||
|
||||
CopyPair::CopyPair(CopyPair const& rhs, const allocator_type& alloc)
|
||||
: source(rhs.source, alloc),
|
||||
target(rhs.target, alloc),
|
||||
mipLevels(rhs.mipLevels),
|
||||
numSlices(rhs.numSlices),
|
||||
sourceMostDetailedMip(rhs.sourceMostDetailedMip),
|
||||
sourceFirstSlice(rhs.sourceFirstSlice),
|
||||
sourcePlaneSlice(rhs.sourcePlaneSlice),
|
||||
targetMostDetailedMip(rhs.targetMostDetailedMip),
|
||||
targetFirstSlice(rhs.targetFirstSlice),
|
||||
targetPlaneSlice(rhs.targetPlaneSlice) {}
|
||||
|
||||
CopyPass::CopyPass(const allocator_type& alloc) noexcept
|
||||
: copyPairs(alloc) {}
|
||||
|
||||
CopyPass::CopyPass(CopyPass&& rhs, const allocator_type& alloc)
|
||||
: copyPairs(std::move(rhs.copyPairs), alloc) {}
|
||||
|
||||
CopyPass::CopyPass(CopyPass const& rhs, const allocator_type& alloc)
|
||||
: copyPairs(rhs.copyPairs, alloc) {}
|
||||
|
||||
MovePair::MovePair(const allocator_type& alloc) noexcept
|
||||
: source(alloc),
|
||||
target(alloc) {}
|
||||
|
||||
MovePair::MovePair(PmrString sourceIn, PmrString targetIn, uint32_t mipLevelsIn, uint32_t numSlicesIn, uint32_t targetMostDetailedMipIn, uint32_t targetFirstSliceIn, uint32_t targetPlaneSliceIn, const allocator_type& alloc) noexcept // NOLINT
|
||||
: source(std::move(sourceIn), alloc),
|
||||
target(std::move(targetIn), alloc),
|
||||
mipLevels(mipLevelsIn),
|
||||
numSlices(numSlicesIn),
|
||||
targetMostDetailedMip(targetMostDetailedMipIn),
|
||||
targetFirstSlice(targetFirstSliceIn),
|
||||
targetPlaneSlice(targetPlaneSliceIn) {}
|
||||
|
||||
MovePair::MovePair(MovePair&& rhs, const allocator_type& alloc)
|
||||
: source(std::move(rhs.source), alloc),
|
||||
target(std::move(rhs.target), alloc),
|
||||
mipLevels(rhs.mipLevels),
|
||||
numSlices(rhs.numSlices),
|
||||
targetMostDetailedMip(rhs.targetMostDetailedMip),
|
||||
targetFirstSlice(rhs.targetFirstSlice),
|
||||
targetPlaneSlice(rhs.targetPlaneSlice) {}
|
||||
|
||||
MovePair::MovePair(MovePair const& rhs, const allocator_type& alloc)
|
||||
: source(rhs.source, alloc),
|
||||
target(rhs.target, alloc),
|
||||
mipLevels(rhs.mipLevels),
|
||||
numSlices(rhs.numSlices),
|
||||
targetMostDetailedMip(rhs.targetMostDetailedMip),
|
||||
targetFirstSlice(rhs.targetFirstSlice),
|
||||
targetPlaneSlice(rhs.targetPlaneSlice) {}
|
||||
|
||||
MovePass::MovePass(const allocator_type& alloc) noexcept
|
||||
: movePairs(alloc) {}
|
||||
|
||||
MovePass::MovePass(MovePass&& rhs, const allocator_type& alloc)
|
||||
: movePairs(std::move(rhs.movePairs), alloc) {}
|
||||
|
||||
MovePass::MovePass(MovePass const& rhs, const allocator_type& alloc)
|
||||
: movePairs(rhs.movePairs, alloc) {}
|
||||
|
||||
RaytracePass::RaytracePass(const allocator_type& alloc) noexcept
|
||||
: computeViews(alloc) {}
|
||||
|
||||
RaytracePass::RaytracePass(RaytracePass&& rhs, const allocator_type& alloc)
|
||||
: computeViews(std::move(rhs.computeViews), alloc) {}
|
||||
|
||||
RaytracePass::RaytracePass(RaytracePass const& rhs, const allocator_type& alloc)
|
||||
: computeViews(rhs.computeViews, alloc) {}
|
||||
|
||||
SceneData::SceneData(const allocator_type& alloc) noexcept
|
||||
: name(alloc),
|
||||
scenes(alloc) {}
|
||||
|
||||
SceneData::SceneData(PmrString nameIn, const allocator_type& alloc) noexcept
|
||||
: name(std::move(nameIn), alloc),
|
||||
scenes(alloc) {}
|
||||
|
||||
SceneData::SceneData(SceneData&& rhs, const allocator_type& alloc)
|
||||
: name(std::move(rhs.name), alloc),
|
||||
camera(rhs.camera),
|
||||
scenes(std::move(rhs.scenes), alloc) {}
|
||||
|
||||
SceneData::SceneData(SceneData const& rhs, const allocator_type& alloc)
|
||||
: name(rhs.name, alloc),
|
||||
camera(rhs.camera),
|
||||
scenes(rhs.scenes, alloc) {}
|
||||
|
||||
Dispatch::Dispatch(const allocator_type& alloc) noexcept
|
||||
: shader(alloc) {}
|
||||
|
||||
Dispatch::Dispatch(PmrString shaderIn, uint32_t threadGroupCountXIn, uint32_t threadGroupCountYIn, uint32_t threadGroupCountZIn, const allocator_type& alloc) noexcept // NOLINT
|
||||
: shader(std::move(shaderIn), alloc),
|
||||
threadGroupCountX(threadGroupCountXIn),
|
||||
threadGroupCountY(threadGroupCountYIn),
|
||||
threadGroupCountZ(threadGroupCountZIn) {}
|
||||
|
||||
Dispatch::Dispatch(Dispatch&& rhs, const allocator_type& alloc)
|
||||
: shader(std::move(rhs.shader), alloc),
|
||||
threadGroupCountX(rhs.threadGroupCountX),
|
||||
threadGroupCountY(rhs.threadGroupCountY),
|
||||
threadGroupCountZ(rhs.threadGroupCountZ) {}
|
||||
|
||||
Dispatch::Dispatch(Dispatch const& rhs, const allocator_type& alloc)
|
||||
: shader(rhs.shader, alloc),
|
||||
threadGroupCountX(rhs.threadGroupCountX),
|
||||
threadGroupCountY(rhs.threadGroupCountY),
|
||||
threadGroupCountZ(rhs.threadGroupCountZ) {}
|
||||
|
||||
Blit::Blit(const allocator_type& alloc) noexcept
|
||||
: shader(alloc) {}
|
||||
|
||||
Blit::Blit(PmrString shaderIn, const allocator_type& alloc) noexcept
|
||||
: shader(std::move(shaderIn), alloc) {}
|
||||
|
||||
Blit::Blit(Blit&& rhs, const allocator_type& alloc)
|
||||
: shader(std::move(rhs.shader), alloc) {}
|
||||
|
||||
Blit::Blit(Blit const& rhs, const allocator_type& alloc)
|
||||
: shader(rhs.shader, alloc) {}
|
||||
|
||||
PresentPass::PresentPass(const allocator_type& alloc) noexcept
|
||||
: resourceName(alloc) {}
|
||||
|
||||
PresentPass::PresentPass(PmrString resourceNameIn, uint32_t syncIntervalIn, uint32_t flagsIn, const allocator_type& alloc) noexcept // NOLINT
|
||||
: resourceName(std::move(resourceNameIn), alloc),
|
||||
syncInterval(syncIntervalIn),
|
||||
flags(flagsIn) {}
|
||||
|
||||
PresentPass::PresentPass(PresentPass&& rhs, const allocator_type& alloc)
|
||||
: resourceName(std::move(rhs.resourceName), alloc),
|
||||
syncInterval(rhs.syncInterval),
|
||||
flags(rhs.flags) {}
|
||||
|
||||
PresentPass::PresentPass(PresentPass const& rhs, const allocator_type& alloc)
|
||||
: resourceName(rhs.resourceName, alloc),
|
||||
syncInterval(rhs.syncInterval),
|
||||
flags(rhs.flags) {}
|
||||
|
||||
RenderData::RenderData(const allocator_type& alloc) noexcept
|
||||
: constants(alloc),
|
||||
buffers(alloc),
|
||||
textures(alloc),
|
||||
samplers(alloc) {}
|
||||
|
||||
RenderData::RenderData(RenderData&& rhs, const allocator_type& alloc)
|
||||
: constants(std::move(rhs.constants), alloc),
|
||||
buffers(std::move(rhs.buffers), alloc),
|
||||
textures(std::move(rhs.textures), alloc),
|
||||
samplers(std::move(rhs.samplers), alloc) {}
|
||||
|
||||
RenderGraph::RenderGraph(const allocator_type& alloc) noexcept
|
||||
: objects(alloc),
|
||||
vertices(alloc),
|
||||
names(alloc),
|
||||
layoutNodes(alloc),
|
||||
data(alloc),
|
||||
rasterPasses(alloc),
|
||||
computePasses(alloc),
|
||||
copyPasses(alloc),
|
||||
movePasses(alloc),
|
||||
presentPasses(alloc),
|
||||
raytracePasses(alloc),
|
||||
renderQueues(alloc),
|
||||
scenes(alloc),
|
||||
blits(alloc),
|
||||
dispatches(alloc),
|
||||
index(alloc) {}
|
||||
|
||||
RenderGraph::RenderGraph(RenderGraph&& rhs, const allocator_type& alloc)
|
||||
: objects(std::move(rhs.objects), 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),
|
||||
rasterPasses(std::move(rhs.rasterPasses), alloc),
|
||||
computePasses(std::move(rhs.computePasses), alloc),
|
||||
copyPasses(std::move(rhs.copyPasses), alloc),
|
||||
movePasses(std::move(rhs.movePasses), alloc),
|
||||
presentPasses(std::move(rhs.presentPasses), alloc),
|
||||
raytracePasses(std::move(rhs.raytracePasses), alloc),
|
||||
renderQueues(std::move(rhs.renderQueues), alloc),
|
||||
scenes(std::move(rhs.scenes), alloc),
|
||||
blits(std::move(rhs.blits), alloc),
|
||||
dispatches(std::move(rhs.dispatches), alloc),
|
||||
index(std::move(rhs.index), alloc) {}
|
||||
|
||||
// ContinuousContainer
|
||||
void RenderGraph::reserve(vertices_size_type sz) {
|
||||
objects.reserve(sz);
|
||||
vertices.reserve(sz);
|
||||
names.reserve(sz);
|
||||
layoutNodes.reserve(sz);
|
||||
data.reserve(sz);
|
||||
}
|
||||
|
||||
RenderGraph::object_type::object_type(const allocator_type& alloc) noexcept
|
||||
: children(alloc),
|
||||
parents(alloc) {}
|
||||
|
||||
RenderGraph::object_type::object_type(object_type&& rhs, const allocator_type& alloc)
|
||||
: children(std::move(rhs.children), alloc),
|
||||
parents(std::move(rhs.parents), alloc) {}
|
||||
|
||||
RenderGraph::object_type::object_type(object_type const& rhs, const allocator_type& alloc)
|
||||
: children(rhs.children, alloc),
|
||||
parents(rhs.parents, alloc) {}
|
||||
|
||||
RenderGraph::vertex_type::vertex_type(const allocator_type& alloc) noexcept
|
||||
: outEdges(alloc),
|
||||
inEdges(alloc) {}
|
||||
|
||||
RenderGraph::vertex_type::vertex_type(vertex_type&& rhs, const allocator_type& alloc)
|
||||
: outEdges(std::move(rhs.outEdges), alloc),
|
||||
inEdges(std::move(rhs.inEdges), alloc),
|
||||
handle(std::move(rhs.handle)) {}
|
||||
|
||||
RenderGraph::vertex_type::vertex_type(vertex_type const& rhs, const allocator_type& alloc)
|
||||
: outEdges(rhs.outEdges, alloc),
|
||||
inEdges(rhs.inEdges, alloc),
|
||||
handle(rhs.handle) {}
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,933 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/container/pmr/vector.hpp>
|
||||
#include <boost/graph/adjacency_iterator.hpp>
|
||||
#include <boost/graph/graph_traits.hpp>
|
||||
#include <boost/graph/properties.hpp>
|
||||
#include <boost/range/irange.hpp>
|
||||
#include "cocos/renderer/gfx-base/GFXBuffer.h"
|
||||
#include "cocos/renderer/gfx-base/GFXDef-common.h"
|
||||
#include "cocos/renderer/gfx-base/GFXTexture.h"
|
||||
#include "cocos/renderer/gfx-base/states/GFXSampler.h"
|
||||
#include "cocos/renderer/pipeline/PipelineSceneData.h"
|
||||
#include "cocos/renderer/pipeline/custom/GraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/Map.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderCommonTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphFwd.h"
|
||||
#include "cocos/renderer/pipeline/custom/String.h"
|
||||
#include "cocos/scene/Camera.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
enum class ResourceFlags : uint32_t {
|
||||
NONE = 0,
|
||||
ALLOW_RENDER_TARGET = 0x1,
|
||||
ALLOW_DEPTH_STENCIL = 0x2,
|
||||
ALLOW_UNORDERED_ACCESS = 0x4,
|
||||
DENY_SHADER_RESOURCE = 0x8,
|
||||
ALLOW_CROSS_ADAPTER = 0x10,
|
||||
ALLOW_SIMULTANEOUS_ACCESS = 0x20,
|
||||
VIDEO_DECODE_REFERENCE_ONLY = 0x40,
|
||||
};
|
||||
|
||||
constexpr ResourceFlags operator|(const ResourceFlags lhs, const ResourceFlags rhs) noexcept {
|
||||
return static_cast<ResourceFlags>(static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs));
|
||||
}
|
||||
|
||||
constexpr ResourceFlags operator&(const ResourceFlags lhs, const ResourceFlags rhs) noexcept {
|
||||
return static_cast<ResourceFlags>(static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs));
|
||||
}
|
||||
|
||||
constexpr ResourceFlags& operator|=(ResourceFlags& lhs, const ResourceFlags rhs) noexcept {
|
||||
return lhs = lhs | rhs;
|
||||
}
|
||||
|
||||
constexpr ResourceFlags& operator&=(ResourceFlags& lhs, const ResourceFlags rhs) noexcept {
|
||||
return lhs = lhs & rhs;
|
||||
}
|
||||
|
||||
constexpr bool operator!(ResourceFlags e) noexcept {
|
||||
return e == static_cast<ResourceFlags>(0);
|
||||
}
|
||||
|
||||
constexpr bool any(ResourceFlags e) noexcept {
|
||||
return !!e;
|
||||
}
|
||||
|
||||
enum class TextureLayout {
|
||||
UNKNOWN,
|
||||
ROW_MAJOR,
|
||||
UNDEFINED_SWIZZLE,
|
||||
STANDARD_SWIZZLE,
|
||||
};
|
||||
|
||||
struct ResourceDesc {
|
||||
ResourceDimension dimension{ResourceDimension::BUFFER};
|
||||
uint32_t alignment{0};
|
||||
uint32_t width{0};
|
||||
uint32_t height{0};
|
||||
uint16_t depthOrArraySize{0};
|
||||
uint16_t mipLevels{0};
|
||||
gfx::Format format{gfx::Format::UNKNOWN};
|
||||
gfx::SampleCount sampleCount{gfx::SampleCount::ONE};
|
||||
TextureLayout layout{TextureLayout::UNKNOWN};
|
||||
ResourceFlags flags{ResourceFlags::NONE};
|
||||
};
|
||||
|
||||
struct ResourceTraits {
|
||||
ResourceTraits() = default;
|
||||
ResourceTraits(ResourceResidency residencyIn) noexcept // NOLINT
|
||||
: residency(residencyIn) {}
|
||||
|
||||
bool hasSideEffects() const noexcept {
|
||||
return boost::variant2::holds_alternative<PersistentTag>(residency) ||
|
||||
boost::variant2::holds_alternative<BackbufferTag>(residency);
|
||||
}
|
||||
|
||||
ResourceResidency residency;
|
||||
};
|
||||
|
||||
struct ResourceGraph {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {vertices.get_allocator().resource()};
|
||||
}
|
||||
|
||||
inline boost::container::pmr::memory_resource* resource() const noexcept {
|
||||
return get_allocator().resource();
|
||||
}
|
||||
|
||||
ResourceGraph(const allocator_type& alloc) noexcept; // NOLINT
|
||||
ResourceGraph(ResourceGraph&& rhs, const allocator_type& alloc);
|
||||
ResourceGraph(ResourceGraph const& rhs, const allocator_type& alloc);
|
||||
|
||||
ResourceGraph(ResourceGraph&& rhs) noexcept = default;
|
||||
ResourceGraph(ResourceGraph const& rhs) = delete;
|
||||
ResourceGraph& operator=(ResourceGraph&& rhs) = default;
|
||||
ResourceGraph& operator=(ResourceGraph const& rhs) = default;
|
||||
|
||||
// Graph
|
||||
using directed_category = boost::bidirectional_tag;
|
||||
using vertex_descriptor = uint32_t;
|
||||
using edge_descriptor = impl::EdgeDescriptor<directed_category, vertex_descriptor>;
|
||||
using edge_parallel_category = boost::allow_parallel_edge_tag;
|
||||
struct traversal_category // NOLINT
|
||||
: virtual boost::incidence_graph_tag,
|
||||
virtual boost::bidirectional_graph_tag,
|
||||
virtual boost::adjacency_graph_tag,
|
||||
virtual boost::vertex_list_graph_tag,
|
||||
virtual boost::edge_list_graph_tag {};
|
||||
|
||||
constexpr static vertex_descriptor null_vertex() noexcept { // NOLINT
|
||||
return std::numeric_limits<vertex_descriptor>::max();
|
||||
}
|
||||
|
||||
// IncidenceGraph
|
||||
using out_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using out_edge_iterator = impl::OutEdgeIter<
|
||||
boost::container::pmr::vector<out_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
using degree_size_type = uint32_t;
|
||||
|
||||
// BidirectionalGraph
|
||||
using in_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using in_edge_iterator = impl::InEdgeIter<
|
||||
boost::container::pmr::vector<in_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
|
||||
// AdjacencyGraph
|
||||
using adjacency_iterator = boost::adjacency_iterator_generator<
|
||||
ResourceGraph, vertex_descriptor, out_edge_iterator>::type;
|
||||
|
||||
// VertexListGraph
|
||||
using vertex_iterator = boost::integer_range<vertex_descriptor>::iterator;
|
||||
using vertices_size_type = uint32_t;
|
||||
|
||||
// VertexList help functions
|
||||
inline boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
|
||||
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
|
||||
return {0, static_cast<vertices_size_type>(vertices.size())};
|
||||
}
|
||||
|
||||
inline vertex_descriptor getCurrentID() const noexcept {
|
||||
return static_cast<vertex_descriptor>(vertices.size());
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
|
||||
return boost::container::pmr::vector<boost::default_color_type>(vertices.size(), mr);
|
||||
}
|
||||
|
||||
// EdgeListGraph
|
||||
using edge_iterator = impl::DirectedEdgeIterator<vertex_iterator, out_edge_iterator, ResourceGraph>;
|
||||
using edges_size_type = uint32_t;
|
||||
|
||||
// ContinuousContainer
|
||||
void reserve(vertices_size_type sz);
|
||||
|
||||
// Members
|
||||
struct vertex_type { // NOLINT
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {outEdges.get_allocator().resource()};
|
||||
}
|
||||
|
||||
vertex_type(const allocator_type& alloc) noexcept; // NOLINT
|
||||
vertex_type(vertex_type&& rhs, const allocator_type& alloc);
|
||||
vertex_type(vertex_type const& rhs, const allocator_type& alloc);
|
||||
|
||||
vertex_type(vertex_type&& rhs) noexcept = default;
|
||||
vertex_type(vertex_type const& rhs) = delete;
|
||||
vertex_type& operator=(vertex_type&& rhs) = default;
|
||||
vertex_type& operator=(vertex_type const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<out_edge_type> outEdges;
|
||||
boost::container::pmr::vector<in_edge_type> inEdges;
|
||||
};
|
||||
|
||||
struct NameTag {
|
||||
} static constexpr Name{}; // NOLINT
|
||||
struct DescTag {
|
||||
} static constexpr Desc{}; // NOLINT
|
||||
struct TraitsTag {
|
||||
} static constexpr Traits{}; // NOLINT
|
||||
|
||||
// Vertices
|
||||
boost::container::pmr::vector<vertex_type> vertices;
|
||||
// Components
|
||||
boost::container::pmr::vector<PmrString> names;
|
||||
boost::container::pmr::vector<ResourceDesc> descs;
|
||||
boost::container::pmr::vector<ResourceTraits> traits;
|
||||
// UuidGraph
|
||||
PmrUnorderedMap<PmrString, vertex_descriptor> valueIndex;
|
||||
};
|
||||
|
||||
enum class AttachmentType {
|
||||
RENDER_TARGET,
|
||||
DEPTH_STENCIL,
|
||||
};
|
||||
|
||||
enum class AccessType {
|
||||
READ,
|
||||
READ_WRITE,
|
||||
WRITE,
|
||||
};
|
||||
|
||||
struct RasterView {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {slotName.get_allocator().resource()};
|
||||
}
|
||||
|
||||
RasterView(const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; // NOLINT
|
||||
RasterView(PmrString slotNameIn, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept;
|
||||
RasterView(RasterView&& rhs, const allocator_type& alloc);
|
||||
RasterView(RasterView const& rhs, const allocator_type& alloc);
|
||||
|
||||
RasterView(RasterView&& rhs) noexcept = default;
|
||||
RasterView(RasterView const& rhs) = delete;
|
||||
RasterView& operator=(RasterView&& rhs) = default;
|
||||
RasterView& operator=(RasterView const& rhs) = default;
|
||||
|
||||
PmrString slotName;
|
||||
AccessType accessType{AccessType::WRITE};
|
||||
AttachmentType attachmentType{AttachmentType::RENDER_TARGET};
|
||||
gfx::LoadOp loadOp{gfx::LoadOp::LOAD};
|
||||
gfx::StoreOp storeOp{gfx::StoreOp::STORE};
|
||||
gfx::ClearFlagBit clearFlags{gfx::ClearFlagBit::ALL};
|
||||
gfx::Color clearColor;
|
||||
};
|
||||
|
||||
enum class ClearValueType {
|
||||
FLOAT_TYPE,
|
||||
INT_TYPE,
|
||||
};
|
||||
|
||||
struct ComputeView {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {name.get_allocator().resource()};
|
||||
}
|
||||
|
||||
ComputeView(const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; // NOLINT
|
||||
ComputeView(ComputeView&& rhs, const allocator_type& alloc);
|
||||
ComputeView(ComputeView const& rhs, const allocator_type& alloc);
|
||||
|
||||
ComputeView(ComputeView&& rhs) noexcept = default;
|
||||
ComputeView(ComputeView const& rhs) = delete;
|
||||
ComputeView& operator=(ComputeView&& rhs) = default;
|
||||
ComputeView& operator=(ComputeView const& rhs) = default;
|
||||
|
||||
bool isRead() const {
|
||||
return accessType != AccessType::WRITE;
|
||||
}
|
||||
bool isWrite() const {
|
||||
return accessType != AccessType::READ;
|
||||
}
|
||||
|
||||
PmrString name;
|
||||
AccessType accessType{AccessType::READ};
|
||||
gfx::ClearFlagBit clearFlags{gfx::ClearFlagBit::NONE};
|
||||
gfx::Color clearColor;
|
||||
ClearValueType clearValueType{ClearValueType::FLOAT_TYPE};
|
||||
};
|
||||
|
||||
struct RasterSubpass {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {rasterViews.get_allocator().resource()};
|
||||
}
|
||||
|
||||
RasterSubpass(const allocator_type& alloc) noexcept; // NOLINT
|
||||
RasterSubpass(RasterSubpass&& rhs, const allocator_type& alloc);
|
||||
RasterSubpass(RasterSubpass const& rhs, const allocator_type& alloc);
|
||||
|
||||
RasterSubpass(RasterSubpass&& rhs) noexcept = default;
|
||||
RasterSubpass(RasterSubpass const& rhs) = delete;
|
||||
RasterSubpass& operator=(RasterSubpass&& rhs) = default;
|
||||
RasterSubpass& operator=(RasterSubpass const& rhs) = default;
|
||||
|
||||
PmrTransparentMap<PmrString, RasterView> rasterViews;
|
||||
PmrTransparentMap<PmrString, boost::container::pmr::vector<ComputeView>> computeViews;
|
||||
};
|
||||
|
||||
struct SubpassGraph {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {vertices.get_allocator().resource()};
|
||||
}
|
||||
|
||||
inline boost::container::pmr::memory_resource* resource() const noexcept {
|
||||
return get_allocator().resource();
|
||||
}
|
||||
|
||||
SubpassGraph(const allocator_type& alloc) noexcept; // NOLINT
|
||||
SubpassGraph(SubpassGraph&& rhs, const allocator_type& alloc);
|
||||
SubpassGraph(SubpassGraph const& rhs, const allocator_type& alloc);
|
||||
|
||||
SubpassGraph(SubpassGraph&& rhs) noexcept = default;
|
||||
SubpassGraph(SubpassGraph const& rhs) = delete;
|
||||
SubpassGraph& operator=(SubpassGraph&& rhs) = default;
|
||||
SubpassGraph& operator=(SubpassGraph const& rhs) = default;
|
||||
|
||||
// Graph
|
||||
using directed_category = boost::bidirectional_tag;
|
||||
using vertex_descriptor = uint32_t;
|
||||
using edge_descriptor = impl::EdgeDescriptor<directed_category, vertex_descriptor>;
|
||||
using edge_parallel_category = boost::allow_parallel_edge_tag;
|
||||
struct traversal_category // NOLINT
|
||||
: virtual boost::incidence_graph_tag,
|
||||
virtual boost::bidirectional_graph_tag,
|
||||
virtual boost::adjacency_graph_tag,
|
||||
virtual boost::vertex_list_graph_tag,
|
||||
virtual boost::edge_list_graph_tag {};
|
||||
|
||||
constexpr static vertex_descriptor null_vertex() noexcept { // NOLINT
|
||||
return std::numeric_limits<vertex_descriptor>::max();
|
||||
}
|
||||
|
||||
// IncidenceGraph
|
||||
using out_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using out_edge_iterator = impl::OutEdgeIter<
|
||||
boost::container::pmr::vector<out_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
using degree_size_type = uint32_t;
|
||||
|
||||
// BidirectionalGraph
|
||||
using in_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using in_edge_iterator = impl::InEdgeIter<
|
||||
boost::container::pmr::vector<in_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
|
||||
// AdjacencyGraph
|
||||
using adjacency_iterator = boost::adjacency_iterator_generator<
|
||||
SubpassGraph, vertex_descriptor, out_edge_iterator>::type;
|
||||
|
||||
// VertexListGraph
|
||||
using vertex_iterator = boost::integer_range<vertex_descriptor>::iterator;
|
||||
using vertices_size_type = uint32_t;
|
||||
|
||||
// VertexList help functions
|
||||
inline boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
|
||||
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
|
||||
return {0, static_cast<vertices_size_type>(vertices.size())};
|
||||
}
|
||||
|
||||
inline vertex_descriptor getCurrentID() const noexcept {
|
||||
return static_cast<vertex_descriptor>(vertices.size());
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
|
||||
return boost::container::pmr::vector<boost::default_color_type>(vertices.size(), mr);
|
||||
}
|
||||
|
||||
// EdgeListGraph
|
||||
using edge_iterator = impl::DirectedEdgeIterator<vertex_iterator, out_edge_iterator, SubpassGraph>;
|
||||
using edges_size_type = uint32_t;
|
||||
|
||||
// ContinuousContainer
|
||||
void reserve(vertices_size_type sz);
|
||||
|
||||
// Members
|
||||
struct vertex_type { // NOLINT
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {outEdges.get_allocator().resource()};
|
||||
}
|
||||
|
||||
vertex_type(const allocator_type& alloc) noexcept; // NOLINT
|
||||
vertex_type(vertex_type&& rhs, const allocator_type& alloc);
|
||||
vertex_type(vertex_type const& rhs, const allocator_type& alloc);
|
||||
|
||||
vertex_type(vertex_type&& rhs) noexcept = default;
|
||||
vertex_type(vertex_type const& rhs) = delete;
|
||||
vertex_type& operator=(vertex_type&& rhs) = default;
|
||||
vertex_type& operator=(vertex_type const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<out_edge_type> outEdges;
|
||||
boost::container::pmr::vector<in_edge_type> inEdges;
|
||||
};
|
||||
|
||||
struct NameTag {
|
||||
} static constexpr Name{}; // NOLINT
|
||||
struct SubpassTag {
|
||||
} static constexpr Subpass{}; // NOLINT
|
||||
|
||||
// Vertices
|
||||
boost::container::pmr::vector<vertex_type> vertices;
|
||||
// Components
|
||||
boost::container::pmr::vector<PmrString> names;
|
||||
boost::container::pmr::vector<RasterSubpass> subpasses;
|
||||
};
|
||||
|
||||
struct RasterPass {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {rasterViews.get_allocator().resource()};
|
||||
}
|
||||
|
||||
RasterPass(const allocator_type& alloc) noexcept; // NOLINT
|
||||
RasterPass(RasterPass&& rhs, const allocator_type& alloc);
|
||||
RasterPass(RasterPass const& rhs, const allocator_type& alloc);
|
||||
|
||||
RasterPass(RasterPass&& rhs) noexcept = default;
|
||||
RasterPass(RasterPass const& rhs) = delete;
|
||||
RasterPass& operator=(RasterPass&& rhs) = default;
|
||||
RasterPass& operator=(RasterPass const& rhs) = default;
|
||||
|
||||
PmrTransparentMap<PmrString, RasterView> rasterViews;
|
||||
PmrTransparentMap<PmrString, boost::container::pmr::vector<ComputeView>> computeViews;
|
||||
SubpassGraph subpassGraph;
|
||||
};
|
||||
|
||||
struct ComputePass {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {computeViews.get_allocator().resource()};
|
||||
}
|
||||
|
||||
ComputePass(const allocator_type& alloc) noexcept; // NOLINT
|
||||
ComputePass(ComputePass&& rhs, const allocator_type& alloc);
|
||||
ComputePass(ComputePass const& rhs, const allocator_type& alloc);
|
||||
|
||||
ComputePass(ComputePass&& rhs) noexcept = default;
|
||||
ComputePass(ComputePass const& rhs) = delete;
|
||||
ComputePass& operator=(ComputePass&& rhs) = default;
|
||||
ComputePass& operator=(ComputePass const& rhs) = default;
|
||||
|
||||
PmrTransparentMap<PmrString, boost::container::pmr::vector<ComputeView>> computeViews;
|
||||
};
|
||||
|
||||
struct CopyPair {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {source.get_allocator().resource()};
|
||||
}
|
||||
|
||||
CopyPair(const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; // NOLINT
|
||||
CopyPair(PmrString sourceIn, PmrString targetIn, uint32_t mipLevelsIn, uint32_t numSlicesIn, uint32_t sourceMostDetailedMipIn, uint32_t sourceFirstSliceIn, uint32_t sourcePlaneSliceIn, uint32_t targetMostDetailedMipIn, uint32_t targetFirstSliceIn, uint32_t targetPlaneSliceIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept;
|
||||
CopyPair(CopyPair&& rhs, const allocator_type& alloc);
|
||||
CopyPair(CopyPair const& rhs, const allocator_type& alloc);
|
||||
|
||||
CopyPair(CopyPair&& rhs) noexcept = default;
|
||||
CopyPair(CopyPair const& rhs) = delete;
|
||||
CopyPair& operator=(CopyPair&& rhs) = default;
|
||||
CopyPair& operator=(CopyPair const& rhs) = default;
|
||||
|
||||
PmrString source;
|
||||
PmrString target;
|
||||
uint32_t mipLevels{0xFFFFFFFF};
|
||||
uint32_t numSlices{0xFFFFFFFF};
|
||||
uint32_t sourceMostDetailedMip{0};
|
||||
uint32_t sourceFirstSlice{0};
|
||||
uint32_t sourcePlaneSlice{0};
|
||||
uint32_t targetMostDetailedMip{0};
|
||||
uint32_t targetFirstSlice{0};
|
||||
uint32_t targetPlaneSlice{0};
|
||||
};
|
||||
|
||||
struct CopyPass {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {copyPairs.get_allocator().resource()};
|
||||
}
|
||||
|
||||
CopyPass(const allocator_type& alloc) noexcept; // NOLINT
|
||||
CopyPass(CopyPass&& rhs, const allocator_type& alloc);
|
||||
CopyPass(CopyPass const& rhs, const allocator_type& alloc);
|
||||
|
||||
CopyPass(CopyPass&& rhs) noexcept = default;
|
||||
CopyPass(CopyPass const& rhs) = delete;
|
||||
CopyPass& operator=(CopyPass&& rhs) = default;
|
||||
CopyPass& operator=(CopyPass const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<CopyPair> copyPairs;
|
||||
};
|
||||
|
||||
struct MovePair {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {source.get_allocator().resource()};
|
||||
}
|
||||
|
||||
MovePair(const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; // NOLINT
|
||||
MovePair(PmrString sourceIn, PmrString targetIn, uint32_t mipLevelsIn, uint32_t numSlicesIn, uint32_t targetMostDetailedMipIn, uint32_t targetFirstSliceIn, uint32_t targetPlaneSliceIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept;
|
||||
MovePair(MovePair&& rhs, const allocator_type& alloc);
|
||||
MovePair(MovePair const& rhs, const allocator_type& alloc);
|
||||
|
||||
MovePair(MovePair&& rhs) noexcept = default;
|
||||
MovePair(MovePair const& rhs) = delete;
|
||||
MovePair& operator=(MovePair&& rhs) = default;
|
||||
MovePair& operator=(MovePair const& rhs) = default;
|
||||
|
||||
PmrString source;
|
||||
PmrString target;
|
||||
uint32_t mipLevels{0xFFFFFFFF};
|
||||
uint32_t numSlices{0xFFFFFFFF};
|
||||
uint32_t targetMostDetailedMip{0};
|
||||
uint32_t targetFirstSlice{0};
|
||||
uint32_t targetPlaneSlice{0};
|
||||
};
|
||||
|
||||
struct MovePass {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {movePairs.get_allocator().resource()};
|
||||
}
|
||||
|
||||
MovePass(const allocator_type& alloc) noexcept; // NOLINT
|
||||
MovePass(MovePass&& rhs, const allocator_type& alloc);
|
||||
MovePass(MovePass const& rhs, const allocator_type& alloc);
|
||||
|
||||
MovePass(MovePass&& rhs) noexcept = default;
|
||||
MovePass(MovePass const& rhs) = delete;
|
||||
MovePass& operator=(MovePass&& rhs) = default;
|
||||
MovePass& operator=(MovePass const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<MovePair> movePairs;
|
||||
};
|
||||
|
||||
struct RaytracePass {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {computeViews.get_allocator().resource()};
|
||||
}
|
||||
|
||||
RaytracePass(const allocator_type& alloc) noexcept; // NOLINT
|
||||
RaytracePass(RaytracePass&& rhs, const allocator_type& alloc);
|
||||
RaytracePass(RaytracePass const& rhs, const allocator_type& alloc);
|
||||
|
||||
RaytracePass(RaytracePass&& rhs) noexcept = default;
|
||||
RaytracePass(RaytracePass const& rhs) = delete;
|
||||
RaytracePass& operator=(RaytracePass&& rhs) = default;
|
||||
RaytracePass& operator=(RaytracePass const& rhs) = default;
|
||||
|
||||
PmrTransparentMap<PmrString, boost::container::pmr::vector<ComputeView>> computeViews;
|
||||
};
|
||||
|
||||
struct QueueTag {};
|
||||
struct SceneTag {};
|
||||
struct DispatchTag {};
|
||||
struct BlitTag {};
|
||||
struct PresentTag {};
|
||||
|
||||
struct RenderQueue {
|
||||
RenderQueue() = default;
|
||||
RenderQueue(QueueHint hintIn) noexcept // NOLINT
|
||||
: hint(hintIn) {}
|
||||
|
||||
QueueHint hint{QueueHint::RENDER_OPAQUE};
|
||||
};
|
||||
|
||||
struct SceneData {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {name.get_allocator().resource()};
|
||||
}
|
||||
|
||||
SceneData(const allocator_type& alloc) noexcept; // NOLINT
|
||||
SceneData(PmrString nameIn, const allocator_type& alloc) noexcept;
|
||||
SceneData(SceneData&& rhs, const allocator_type& alloc);
|
||||
SceneData(SceneData const& rhs, const allocator_type& alloc);
|
||||
|
||||
SceneData(SceneData&& rhs) noexcept = default;
|
||||
SceneData(SceneData const& rhs) = delete;
|
||||
SceneData& operator=(SceneData&& rhs) = default;
|
||||
SceneData& operator=(SceneData const& rhs) = default;
|
||||
|
||||
PmrString name;
|
||||
scene::Camera* camera{nullptr};
|
||||
boost::container::pmr::vector<PmrString> scenes;
|
||||
};
|
||||
|
||||
struct Dispatch {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {shader.get_allocator().resource()};
|
||||
}
|
||||
|
||||
Dispatch(const allocator_type& alloc) noexcept; // NOLINT
|
||||
Dispatch(PmrString shaderIn, uint32_t threadGroupCountXIn, uint32_t threadGroupCountYIn, uint32_t threadGroupCountZIn, const allocator_type& alloc) noexcept;
|
||||
Dispatch(Dispatch&& rhs, const allocator_type& alloc);
|
||||
Dispatch(Dispatch const& rhs, const allocator_type& alloc);
|
||||
|
||||
Dispatch(Dispatch&& rhs) noexcept = default;
|
||||
Dispatch(Dispatch const& rhs) = delete;
|
||||
Dispatch& operator=(Dispatch&& rhs) = default;
|
||||
Dispatch& operator=(Dispatch const& rhs) = default;
|
||||
|
||||
PmrString shader;
|
||||
uint32_t threadGroupCountX{0};
|
||||
uint32_t threadGroupCountY{0};
|
||||
uint32_t threadGroupCountZ{0};
|
||||
};
|
||||
|
||||
struct Blit {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {shader.get_allocator().resource()};
|
||||
}
|
||||
|
||||
Blit(const allocator_type& alloc) noexcept; // NOLINT
|
||||
Blit(PmrString shaderIn, const allocator_type& alloc) noexcept;
|
||||
Blit(Blit&& rhs, const allocator_type& alloc);
|
||||
Blit(Blit const& rhs, const allocator_type& alloc);
|
||||
|
||||
Blit(Blit&& rhs) noexcept = default;
|
||||
Blit(Blit const& rhs) = delete;
|
||||
Blit& operator=(Blit&& rhs) = default;
|
||||
Blit& operator=(Blit const& rhs) = default;
|
||||
|
||||
PmrString shader;
|
||||
};
|
||||
|
||||
struct PresentPass {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {resourceName.get_allocator().resource()};
|
||||
}
|
||||
|
||||
PresentPass(const allocator_type& alloc) noexcept; // NOLINT
|
||||
PresentPass(PmrString resourceNameIn, uint32_t syncIntervalIn, uint32_t flagsIn, const allocator_type& alloc) noexcept;
|
||||
PresentPass(PresentPass&& rhs, const allocator_type& alloc);
|
||||
PresentPass(PresentPass const& rhs, const allocator_type& alloc);
|
||||
|
||||
PresentPass(PresentPass&& rhs) noexcept = default;
|
||||
PresentPass(PresentPass const& rhs) = delete;
|
||||
PresentPass& operator=(PresentPass&& rhs) = default;
|
||||
PresentPass& operator=(PresentPass const& rhs) = default;
|
||||
|
||||
PmrString resourceName;
|
||||
uint32_t syncInterval{0};
|
||||
uint32_t flags{0};
|
||||
};
|
||||
|
||||
struct RenderData {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {constants.get_allocator().resource()};
|
||||
}
|
||||
|
||||
RenderData(const allocator_type& alloc) noexcept; // NOLINT
|
||||
RenderData(RenderData&& rhs, const allocator_type& alloc);
|
||||
|
||||
RenderData(RenderData&& rhs) noexcept = default;
|
||||
RenderData(RenderData const& rhs) = delete;
|
||||
RenderData& operator=(RenderData&& rhs) = default;
|
||||
RenderData& operator=(RenderData const& rhs) = delete;
|
||||
|
||||
PmrUnorderedMap<uint32_t, boost::container::pmr::vector<uint8_t>> constants;
|
||||
PmrUnorderedMap<uint32_t, std::unique_ptr<gfx::Buffer>> buffers;
|
||||
PmrUnorderedMap<uint32_t, std::unique_ptr<gfx::Texture>> textures;
|
||||
PmrUnorderedMap<uint32_t, std::unique_ptr<gfx::Sampler>> samplers;
|
||||
};
|
||||
|
||||
struct RenderGraph {
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {objects.get_allocator().resource()};
|
||||
}
|
||||
|
||||
inline boost::container::pmr::memory_resource* resource() const noexcept {
|
||||
return get_allocator().resource();
|
||||
}
|
||||
|
||||
RenderGraph(const allocator_type& alloc) noexcept; // NOLINT
|
||||
RenderGraph(RenderGraph&& rhs, const allocator_type& alloc);
|
||||
|
||||
RenderGraph(RenderGraph&& rhs) noexcept = default;
|
||||
RenderGraph(RenderGraph const& rhs) = delete;
|
||||
RenderGraph& operator=(RenderGraph&& rhs) = default;
|
||||
RenderGraph& operator=(RenderGraph const& rhs) = delete;
|
||||
|
||||
// Graph
|
||||
using directed_category = boost::bidirectional_tag;
|
||||
using vertex_descriptor = uint32_t;
|
||||
using edge_descriptor = impl::EdgeDescriptor<directed_category, vertex_descriptor>;
|
||||
using edge_parallel_category = boost::allow_parallel_edge_tag;
|
||||
struct traversal_category // NOLINT
|
||||
: virtual boost::incidence_graph_tag,
|
||||
virtual boost::bidirectional_graph_tag,
|
||||
virtual boost::adjacency_graph_tag,
|
||||
virtual boost::vertex_list_graph_tag,
|
||||
virtual boost::edge_list_graph_tag {};
|
||||
|
||||
constexpr static vertex_descriptor null_vertex() noexcept { // NOLINT
|
||||
return std::numeric_limits<vertex_descriptor>::max();
|
||||
}
|
||||
|
||||
// IncidenceGraph
|
||||
using out_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using out_edge_iterator = impl::OutEdgeIter<
|
||||
boost::container::pmr::vector<out_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
using degree_size_type = uint32_t;
|
||||
|
||||
// BidirectionalGraph
|
||||
using in_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using in_edge_iterator = impl::InEdgeIter<
|
||||
boost::container::pmr::vector<in_edge_type>::iterator,
|
||||
vertex_descriptor, edge_descriptor, int32_t>;
|
||||
|
||||
// AdjacencyGraph
|
||||
using adjacency_iterator = boost::adjacency_iterator_generator<
|
||||
RenderGraph, vertex_descriptor, out_edge_iterator>::type;
|
||||
|
||||
// VertexListGraph
|
||||
using vertex_iterator = boost::integer_range<vertex_descriptor>::iterator;
|
||||
using vertices_size_type = uint32_t;
|
||||
|
||||
// VertexList help functions
|
||||
inline boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<out_edge_type>& getOutEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].outEdges;
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
inline const boost::container::pmr::vector<in_edge_type>& getInEdgeList(vertex_descriptor v) const noexcept {
|
||||
return vertices[v].inEdges;
|
||||
}
|
||||
|
||||
inline boost::integer_range<vertex_descriptor> getVertexList() const noexcept {
|
||||
return {0, static_cast<vertices_size_type>(vertices.size())};
|
||||
}
|
||||
|
||||
inline vertex_descriptor getCurrentID() const noexcept {
|
||||
return static_cast<vertex_descriptor>(vertices.size());
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<boost::default_color_type> colors(boost::container::pmr::memory_resource* mr) const {
|
||||
return boost::container::pmr::vector<boost::default_color_type>(vertices.size(), mr);
|
||||
}
|
||||
|
||||
// EdgeListGraph
|
||||
using edge_iterator = impl::DirectedEdgeIterator<vertex_iterator, out_edge_iterator, RenderGraph>;
|
||||
using edges_size_type = uint32_t;
|
||||
|
||||
// AddressableGraph (Separated)
|
||||
using ownership_descriptor = impl::EdgeDescriptor<boost::bidirectional_tag, vertex_descriptor>;
|
||||
|
||||
using children_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using children_iterator = impl::OutEdgeIter<
|
||||
boost::container::pmr::vector<children_edge_type>::iterator,
|
||||
vertex_descriptor, ownership_descriptor, int32_t>;
|
||||
using children_size_type = uint32_t;
|
||||
|
||||
using parent_edge_type = impl::StoredEdge<vertex_descriptor>;
|
||||
using parent_iterator = impl::InEdgeIter<
|
||||
boost::container::pmr::vector<parent_edge_type>::iterator,
|
||||
vertex_descriptor, ownership_descriptor, int32_t>;
|
||||
|
||||
using ownership_iterator = impl::OwnershipIterator<vertex_iterator, children_iterator, RenderGraph>;
|
||||
using ownerships_size_type = edges_size_type;
|
||||
|
||||
// AddressableGraph help functions
|
||||
inline boost::container::pmr::vector<children_edge_type>& getChildrenList(vertex_descriptor v) noexcept {
|
||||
return objects[v].children;
|
||||
}
|
||||
inline const boost::container::pmr::vector<children_edge_type>& getChildrenList(vertex_descriptor v) const noexcept {
|
||||
return objects[v].children;
|
||||
}
|
||||
|
||||
inline boost::container::pmr::vector<parent_edge_type>& getParentsList(vertex_descriptor v) noexcept {
|
||||
return objects[v].parents;
|
||||
}
|
||||
inline const boost::container::pmr::vector<parent_edge_type>& getParentsList(vertex_descriptor v) const noexcept {
|
||||
return objects[v].parents;
|
||||
}
|
||||
|
||||
// PolymorphicGraph
|
||||
using vertex_tag_type = boost::variant2::variant<RasterTag, ComputeTag, CopyTag, MoveTag, PresentTag, RaytraceTag, QueueTag, SceneTag, BlitTag, DispatchTag>;
|
||||
using vertex_value_type = boost::variant2::variant<RasterPass*, ComputePass*, CopyPass*, MovePass*, PresentPass*, RaytracePass*, RenderQueue*, SceneData*, Blit*, Dispatch*>;
|
||||
using vertex_const_value_type = boost::variant2::variant<const RasterPass*, const ComputePass*, const CopyPass*, const MovePass*, const PresentPass*, const RaytracePass*, const RenderQueue*, const SceneData*, const Blit*, const Dispatch*>;
|
||||
using vertex_handle_type = boost::variant2::variant<
|
||||
impl::ValueHandle<RasterTag, vertex_descriptor>,
|
||||
impl::ValueHandle<ComputeTag, vertex_descriptor>,
|
||||
impl::ValueHandle<CopyTag, vertex_descriptor>,
|
||||
impl::ValueHandle<MoveTag, vertex_descriptor>,
|
||||
impl::ValueHandle<PresentTag, vertex_descriptor>,
|
||||
impl::ValueHandle<RaytraceTag, vertex_descriptor>,
|
||||
impl::ValueHandle<QueueTag, vertex_descriptor>,
|
||||
impl::ValueHandle<SceneTag, vertex_descriptor>,
|
||||
impl::ValueHandle<BlitTag, vertex_descriptor>,
|
||||
impl::ValueHandle<DispatchTag, vertex_descriptor>>;
|
||||
|
||||
// ContinuousContainer
|
||||
void reserve(vertices_size_type sz);
|
||||
|
||||
// Members
|
||||
struct object_type { // NOLINT
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {children.get_allocator().resource()};
|
||||
}
|
||||
|
||||
object_type(const allocator_type& alloc) noexcept; // NOLINT
|
||||
object_type(object_type&& rhs, const allocator_type& alloc);
|
||||
object_type(object_type const& rhs, const allocator_type& alloc);
|
||||
|
||||
object_type(object_type&& rhs) noexcept = default;
|
||||
object_type(object_type const& rhs) = delete;
|
||||
object_type& operator=(object_type&& rhs) = default;
|
||||
object_type& operator=(object_type const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<children_edge_type> children;
|
||||
boost::container::pmr::vector<parent_edge_type> parents;
|
||||
};
|
||||
|
||||
struct vertex_type { // NOLINT
|
||||
using allocator_type = boost::container::pmr::polymorphic_allocator<char>;
|
||||
allocator_type get_allocator() const noexcept { // NOLINT
|
||||
return {outEdges.get_allocator().resource()};
|
||||
}
|
||||
|
||||
vertex_type(const allocator_type& alloc) noexcept; // NOLINT
|
||||
vertex_type(vertex_type&& rhs, const allocator_type& alloc);
|
||||
vertex_type(vertex_type const& rhs, const allocator_type& alloc);
|
||||
|
||||
vertex_type(vertex_type&& rhs) noexcept = default;
|
||||
vertex_type(vertex_type const& rhs) = delete;
|
||||
vertex_type& operator=(vertex_type&& rhs) = default;
|
||||
vertex_type& operator=(vertex_type const& rhs) = default;
|
||||
|
||||
boost::container::pmr::vector<out_edge_type> outEdges;
|
||||
boost::container::pmr::vector<in_edge_type> inEdges;
|
||||
vertex_handle_type handle;
|
||||
};
|
||||
|
||||
struct NameTag {
|
||||
} static constexpr Name{}; // NOLINT
|
||||
struct LayoutTag {
|
||||
} static constexpr Layout{}; // NOLINT
|
||||
struct DataTag {
|
||||
} static constexpr Data{}; // NOLINT
|
||||
|
||||
// Owners
|
||||
boost::container::pmr::vector<object_type> objects;
|
||||
// Vertices
|
||||
boost::container::pmr::vector<vertex_type> vertices;
|
||||
// Components
|
||||
boost::container::pmr::vector<PmrString> names;
|
||||
boost::container::pmr::vector<PmrString> layoutNodes;
|
||||
boost::container::pmr::vector<RenderData> data;
|
||||
// PolymorphicGraph
|
||||
boost::container::pmr::vector<RasterPass> rasterPasses;
|
||||
boost::container::pmr::vector<ComputePass> computePasses;
|
||||
boost::container::pmr::vector<CopyPass> copyPasses;
|
||||
boost::container::pmr::vector<MovePass> movePasses;
|
||||
boost::container::pmr::vector<PresentPass> presentPasses;
|
||||
boost::container::pmr::vector<RaytracePass> raytracePasses;
|
||||
boost::container::pmr::vector<RenderQueue> renderQueues;
|
||||
boost::container::pmr::vector<SceneData> scenes;
|
||||
boost::container::pmr::vector<Blit> blits;
|
||||
boost::container::pmr::vector<Dispatch> dispatches;
|
||||
// Members
|
||||
PmrUnorderedMap<PmrString, uint32_t> index;
|
||||
};
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,55 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include "cocos/core/assets/EffectAsset.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphFwd.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
class DescriptorHierarchy;
|
||||
class Setter;
|
||||
class RasterQueueBuilder;
|
||||
class RasterPassBuilder;
|
||||
class ComputeQueueBuilder;
|
||||
class ComputePassBuilder;
|
||||
class MovePassBuilder;
|
||||
class CopyPassBuilder;
|
||||
class Pipeline;
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,42 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#include "RenderInterfaceTypes.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,243 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/**
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
* The following section is auto-generated.
|
||||
* ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! =========================
|
||||
*/
|
||||
// clang-format off
|
||||
#pragma once
|
||||
#include "cocos/core/assets/EffectAsset.h"
|
||||
#include "cocos/renderer/gfx-base/GFXDef-common.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderGraphTypes.h"
|
||||
#include "cocos/renderer/pipeline/custom/RenderInterfaceFwd.h"
|
||||
|
||||
namespace cc {
|
||||
|
||||
class Mat4;
|
||||
class Mat4;
|
||||
class Quaternion;
|
||||
class Color;
|
||||
class Vec4;
|
||||
class Vec3;
|
||||
class Vec2;
|
||||
|
||||
class EffectAsset;
|
||||
|
||||
namespace pipeline {
|
||||
|
||||
class PipelineSceneData;
|
||||
|
||||
} // namespace pipeline
|
||||
|
||||
} // namespace cc
|
||||
|
||||
namespace cc {
|
||||
|
||||
namespace render {
|
||||
|
||||
class DescriptorHierarchy {
|
||||
public:
|
||||
DescriptorHierarchy() noexcept = default;
|
||||
DescriptorHierarchy(DescriptorHierarchy&& rhs) = delete;
|
||||
DescriptorHierarchy(DescriptorHierarchy const& rhs) = delete;
|
||||
DescriptorHierarchy& operator=(DescriptorHierarchy&& rhs) = delete;
|
||||
DescriptorHierarchy& operator=(DescriptorHierarchy const& rhs) = delete;
|
||||
|
||||
virtual ~DescriptorHierarchy() noexcept = 0;
|
||||
|
||||
virtual void addEffect(EffectAsset* asset) = 0;
|
||||
};
|
||||
|
||||
inline DescriptorHierarchy::~DescriptorHierarchy() noexcept = default;
|
||||
|
||||
class Setter {
|
||||
public:
|
||||
Setter() noexcept = default;
|
||||
Setter(Setter&& rhs) = delete;
|
||||
Setter(Setter const& rhs) = delete;
|
||||
Setter& operator=(Setter&& rhs) = delete;
|
||||
Setter& operator=(Setter const& rhs) = delete;
|
||||
|
||||
virtual ~Setter() noexcept = 0;
|
||||
|
||||
virtual void setMat4(const std::string& name, const cc::Mat4& mat) = 0;
|
||||
virtual void setQuaternion(const std::string& name, const cc::Quaternion& quat) = 0;
|
||||
virtual void setColor(const std::string& name, const cc::Color& color) = 0;
|
||||
virtual void setVec4(const std::string& name, const cc::Vec4& vec) = 0;
|
||||
virtual void setVec2(const std::string& name, const cc::Vec2& vec) = 0;
|
||||
virtual void setFloat(const std::string& name, float v) = 0;
|
||||
|
||||
virtual void setBuffer(const std::string& name, gfx::Buffer* buffer) = 0;
|
||||
virtual void setTexture(const std::string& name, gfx::Texture* texture) = 0;
|
||||
virtual void setReadWriteBuffer(const std::string& name, gfx::Buffer* buffer) = 0;
|
||||
virtual void setReadWriteTexture(const std::string& name, gfx::Texture* texture) = 0;
|
||||
virtual void setSampler(const std::string& name, gfx::Sampler* sampler) = 0;
|
||||
};
|
||||
|
||||
inline Setter::~Setter() noexcept = default;
|
||||
|
||||
class RasterQueueBuilder {
|
||||
public:
|
||||
RasterQueueBuilder() noexcept = default;
|
||||
RasterQueueBuilder(RasterQueueBuilder&& rhs) = delete;
|
||||
RasterQueueBuilder(RasterQueueBuilder const& rhs) = delete;
|
||||
RasterQueueBuilder& operator=(RasterQueueBuilder&& rhs) = delete;
|
||||
RasterQueueBuilder& operator=(RasterQueueBuilder const& rhs) = delete;
|
||||
|
||||
virtual ~RasterQueueBuilder() noexcept = 0;
|
||||
|
||||
virtual void addSceneOfCamera(scene::Camera* camera, const std::string& name) = 0;
|
||||
virtual void addSceneOfCamera(scene::Camera* camera) = 0;
|
||||
virtual void addScene(const std::string& name) = 0;
|
||||
virtual void addFullscreenQuad(const std::string& shader, const std::string& name) = 0;
|
||||
virtual void addFullscreenQuad(const std::string& shader) = 0;
|
||||
};
|
||||
|
||||
inline RasterQueueBuilder::~RasterQueueBuilder() noexcept = default;
|
||||
|
||||
class RasterPassBuilder {
|
||||
public:
|
||||
RasterPassBuilder() noexcept = default;
|
||||
RasterPassBuilder(RasterPassBuilder&& rhs) = delete;
|
||||
RasterPassBuilder(RasterPassBuilder const& rhs) = delete;
|
||||
RasterPassBuilder& operator=(RasterPassBuilder&& rhs) = delete;
|
||||
RasterPassBuilder& operator=(RasterPassBuilder const& rhs) = delete;
|
||||
|
||||
virtual ~RasterPassBuilder() noexcept = 0;
|
||||
|
||||
virtual void addRasterView(const std::string& name, const RasterView& view) = 0;
|
||||
virtual void addComputeView(const std::string& name, const ComputeView& view) = 0;
|
||||
virtual RasterQueueBuilder* addQueue(QueueHint hint, const std::string& layoutName, const std::string& name) = 0;
|
||||
virtual RasterQueueBuilder* addQueue(QueueHint hint, const std::string& layoutName) = 0;
|
||||
virtual RasterQueueBuilder* addQueue(QueueHint hint) = 0;
|
||||
virtual void addFullscreenQuad(const std::string& shader, const std::string& layoutName, const std::string& name) = 0;
|
||||
virtual void addFullscreenQuad(const std::string& shader, const std::string& layoutName) = 0;
|
||||
virtual void addFullscreenQuad(const std::string& shader) = 0;
|
||||
};
|
||||
|
||||
inline RasterPassBuilder::~RasterPassBuilder() noexcept = default;
|
||||
|
||||
class ComputeQueueBuilder {
|
||||
public:
|
||||
ComputeQueueBuilder() noexcept = default;
|
||||
ComputeQueueBuilder(ComputeQueueBuilder&& rhs) = delete;
|
||||
ComputeQueueBuilder(ComputeQueueBuilder const& rhs) = delete;
|
||||
ComputeQueueBuilder& operator=(ComputeQueueBuilder&& rhs) = delete;
|
||||
ComputeQueueBuilder& operator=(ComputeQueueBuilder const& rhs) = delete;
|
||||
|
||||
virtual ~ComputeQueueBuilder() noexcept = 0;
|
||||
|
||||
virtual void addDispatch(const std::string& shader, uint32_t threadGroupCountX, uint32_t threadGroupCountY, uint32_t threadGroupCountZ, const std::string& layoutName, const std::string& name) = 0;
|
||||
virtual void addDispatch(const std::string& shader, uint32_t threadGroupCountX, uint32_t threadGroupCountY, uint32_t threadGroupCountZ, const std::string& layoutName) = 0;
|
||||
virtual void addDispatch(const std::string& shader, uint32_t threadGroupCountX, uint32_t threadGroupCountY, uint32_t threadGroupCountZ) = 0;
|
||||
};
|
||||
|
||||
inline ComputeQueueBuilder::~ComputeQueueBuilder() noexcept = default;
|
||||
|
||||
class ComputePassBuilder {
|
||||
public:
|
||||
ComputePassBuilder() noexcept = default;
|
||||
ComputePassBuilder(ComputePassBuilder&& rhs) = delete;
|
||||
ComputePassBuilder(ComputePassBuilder const& rhs) = delete;
|
||||
ComputePassBuilder& operator=(ComputePassBuilder&& rhs) = delete;
|
||||
ComputePassBuilder& operator=(ComputePassBuilder const& rhs) = delete;
|
||||
|
||||
virtual ~ComputePassBuilder() noexcept = 0;
|
||||
|
||||
virtual void addComputeView(const std::string& name, const ComputeView& view) = 0;
|
||||
|
||||
virtual ComputeQueueBuilder* addQueue(const std::string& layoutName, const std::string& name) = 0;
|
||||
virtual ComputeQueueBuilder* addQueue(const std::string& layoutName) = 0;
|
||||
virtual ComputeQueueBuilder* addQueue() = 0;
|
||||
|
||||
virtual void addDispatch(const std::string& shader, uint32_t threadGroupCountX, uint32_t threadGroupCountY, uint32_t threadGroupCountZ, const std::string& layoutName, const std::string& name) = 0;
|
||||
virtual void addDispatch(const std::string& shader, uint32_t threadGroupCountX, uint32_t threadGroupCountY, uint32_t threadGroupCountZ, const std::string& layoutName) = 0;
|
||||
virtual void addDispatch(const std::string& shader, uint32_t threadGroupCountX, uint32_t threadGroupCountY, uint32_t threadGroupCountZ) = 0;
|
||||
};
|
||||
|
||||
inline ComputePassBuilder::~ComputePassBuilder() noexcept = default;
|
||||
|
||||
class MovePassBuilder {
|
||||
public:
|
||||
MovePassBuilder() noexcept = default;
|
||||
MovePassBuilder(MovePassBuilder&& rhs) = delete;
|
||||
MovePassBuilder(MovePassBuilder const& rhs) = delete;
|
||||
MovePassBuilder& operator=(MovePassBuilder&& rhs) = delete;
|
||||
MovePassBuilder& operator=(MovePassBuilder const& rhs) = delete;
|
||||
|
||||
virtual ~MovePassBuilder() noexcept = 0;
|
||||
|
||||
virtual void addPair(const MovePair& pair) = 0;
|
||||
};
|
||||
|
||||
inline MovePassBuilder::~MovePassBuilder() noexcept = default;
|
||||
|
||||
class CopyPassBuilder {
|
||||
public:
|
||||
CopyPassBuilder() noexcept = default;
|
||||
CopyPassBuilder(CopyPassBuilder&& rhs) = delete;
|
||||
CopyPassBuilder(CopyPassBuilder const& rhs) = delete;
|
||||
CopyPassBuilder& operator=(CopyPassBuilder&& rhs) = delete;
|
||||
CopyPassBuilder& operator=(CopyPassBuilder const& rhs) = delete;
|
||||
|
||||
virtual ~CopyPassBuilder() noexcept = 0;
|
||||
|
||||
virtual void addPair(const CopyPair& pair) = 0;
|
||||
};
|
||||
|
||||
inline CopyPassBuilder::~CopyPassBuilder() noexcept = default;
|
||||
|
||||
class Pipeline {
|
||||
public:
|
||||
Pipeline() noexcept = default;
|
||||
Pipeline(Pipeline&& rhs) = delete;
|
||||
Pipeline(Pipeline const& rhs) = delete;
|
||||
Pipeline& operator=(Pipeline&& rhs) = delete;
|
||||
Pipeline& operator=(Pipeline const& rhs) = delete;
|
||||
|
||||
virtual ~Pipeline() noexcept = 0;
|
||||
|
||||
virtual uint32_t addRenderTexture(const std::string& name, gfx::Format format, uint32_t width, uint32_t height) = 0;
|
||||
virtual uint32_t addRenderTarget(const std::string& name, gfx::Format format, uint32_t width, uint32_t height) = 0;
|
||||
virtual uint32_t addDepthStencil(const std::string& name, gfx::Format format, uint32_t width, uint32_t height) = 0;
|
||||
virtual void beginFrame(pipeline::PipelineSceneData* pplScene) = 0;
|
||||
virtual void endFrame() = 0;
|
||||
virtual RasterPassBuilder* addRasterPass(uint32_t width, uint32_t height, const std::string& layoutName, const std::string& name) = 0;
|
||||
virtual RasterPassBuilder* addRasterPass(uint32_t width, uint32_t height, const std::string& layoutName) = 0;
|
||||
virtual ComputePassBuilder* addComputePass(const std::string& layoutName, const std::string& name) = 0;
|
||||
virtual ComputePassBuilder* addComputePass(const std::string& layoutName) = 0;
|
||||
virtual MovePassBuilder* addMovePass(const std::string& name) = 0;
|
||||
virtual CopyPassBuilder* addCopyPass(const std::string& name) = 0;
|
||||
};
|
||||
|
||||
inline Pipeline::~Pipeline() noexcept = default;
|
||||
|
||||
} // namespace render
|
||||
|
||||
} // namespace cc
|
||||
|
||||
// clang-format on
|
||||
@@ -0,0 +1,102 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <cocos/renderer/pipeline/custom/Utility.h>
|
||||
#include <boost/container/flat_set.hpp>
|
||||
#include <boost/container/pmr/flat_set.hpp>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
|
||||
// for std::less<> the transparent comparator
|
||||
// see https://stackoverflow.com/questions/20317413/what-are-transparent-comparators
|
||||
|
||||
namespace cc {
|
||||
|
||||
// set
|
||||
template <class Value>
|
||||
using TransparentSet = std::set<Value, std::less<>>;
|
||||
|
||||
template <class Value>
|
||||
using TransparentMultiSet = std::multiset<Value, std::less<>>;
|
||||
|
||||
template <class Value>
|
||||
using PmrTransparentSet = std::set<
|
||||
Value, std::less<>,
|
||||
boost::container::pmr::polymorphic_allocator<Value>>;
|
||||
|
||||
template <class Value>
|
||||
using PmrTransparentMultiSet = std::multiset<
|
||||
Value, std::less<>,
|
||||
boost::container::pmr::polymorphic_allocator<Value>>;
|
||||
|
||||
// flat_set
|
||||
template <class Value>
|
||||
using FlatSet = boost::container::flat_set<Value, std::less<>>;
|
||||
|
||||
template <class Value>
|
||||
using FlatMultiSet = boost::container::flat_multiset<Value, std::less<>>;
|
||||
|
||||
template <class Value>
|
||||
using PmrFlatSet = boost::container::pmr::flat_set<Value, std::less<>>;
|
||||
|
||||
template <class Value>
|
||||
using PmrFlatMultiSet = boost::container::pmr::flat_multiset<Value, std::less<>>;
|
||||
|
||||
// unordered_set
|
||||
template <class Value>
|
||||
using PmrUnorderedSet = std::unordered_set<
|
||||
Value, std::hash<Value>, std::equal_to<Value>,
|
||||
boost::container::pmr::polymorphic_allocator<Value>>;
|
||||
|
||||
template <class Value>
|
||||
using PmrUnorderedMultiSet = std::unordered_multiset<
|
||||
Value, std::hash<Value>, std::equal_to<Value>,
|
||||
boost::container::pmr::polymorphic_allocator<Value>>;
|
||||
|
||||
// transparent string unordered_set
|
||||
template <class Value>
|
||||
using UnorderedStringSet = std::unordered_set<
|
||||
Value,
|
||||
TransparentStringHash<typename Value::value_type>, std::equal_to<>>;
|
||||
|
||||
template <class Value>
|
||||
using UnorderedStringMultiSet = std::unordered_multiset<
|
||||
Value,
|
||||
TransparentStringHash<typename Value::value_type>, std::equal_to<>>;
|
||||
|
||||
template <class Value>
|
||||
using PmrUnorderedStringSet = std::unordered_set<
|
||||
Value,
|
||||
TransparentStringHash<typename Value::value_type>, std::equal_to<>,
|
||||
boost::container::pmr::polymorphic_allocator<Value>>;
|
||||
|
||||
template <class Value>
|
||||
using PmrUnorderedStringMultiSet = std::unordered_multiset<
|
||||
Value,
|
||||
TransparentStringHash<typename Value::value_type>, std::equal_to<>,
|
||||
boost::container::pmr::polymorphic_allocator<Value>>;
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,36 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <boost/container/pmr/polymorphic_allocator.hpp>
|
||||
#include <string>
|
||||
|
||||
namespace cc {
|
||||
|
||||
using PmrString = std::basic_string<
|
||||
char, std::char_traits<char>,
|
||||
boost::container::pmr::polymorphic_allocator<char>>;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
#include <boost/utility/string_view.hpp>
|
||||
|
||||
// transparent hash
|
||||
// see https://stackoverflow.com/questions/20317413/what-are-transparent-comparators
|
||||
|
||||
namespace cc {
|
||||
|
||||
template <class Char>
|
||||
struct TransparentStringHash {
|
||||
using is_transparent = void;
|
||||
using string_view_type = boost::basic_string_view<Char>;
|
||||
|
||||
size_t operator()(string_view_type str) const noexcept {
|
||||
return boost::hash<string_view_type>{}(str);
|
||||
}
|
||||
size_t operator()(const Char* str) const noexcept {
|
||||
return boost::hash<string_view_type>{}(str);
|
||||
}
|
||||
template <class Alloc>
|
||||
size_t operator()(const std::basic_string<Char, std::char_traits<Char>, Alloc>& str) const noexcept {
|
||||
return boost::hash<string_view_type>{}(str);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace cc
|
||||
@@ -0,0 +1,305 @@
|
||||
/****************************************************************************
|
||||
Copyright (c) 2021-2022 Xiamen Yaji Software Co., Ltd.
|
||||
|
||||
http://www.cocos.com
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated engine source code (the "Software"), a limited,
|
||||
worldwide, royalty-free, non-assignable, revocable and non-exclusive license
|
||||
to use Cocos Creator solely to develop games on your target platforms. You shall
|
||||
not use Cocos Creator software for developing other software or tools that's
|
||||
used for developing games. You are not granted to publish, distribute,
|
||||
sublicense, and/or sell copies of Cocos Creator.
|
||||
|
||||
The software or tools in this License Agreement are licensed, not sold.
|
||||
Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
/*******************************************************************************
|
||||
* This file is part of the "https://github.com/blackmatov/invoke.hpp"
|
||||
* For conditions of distribution and use, see copyright notice in LICENSE.md
|
||||
* Copyright (C) 2018-2021, by Matvey Cherevko (blackmatov@gmail.com)
|
||||
******************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <tuple>
|
||||
#include <utility>
|
||||
#include <functional>
|
||||
#include <type_traits>
|
||||
|
||||
#define INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(...) \
|
||||
noexcept(noexcept(__VA_ARGS__)) -> decltype (__VA_ARGS__) { return __VA_ARGS__; }
|
||||
|
||||
//
|
||||
// void_t
|
||||
//
|
||||
|
||||
namespace invoke_hpp
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template < typename... Args >
|
||||
struct make_void { // NOLINT
|
||||
using type = void;
|
||||
};
|
||||
}
|
||||
|
||||
template < typename... Args >
|
||||
using void_t = typename impl::make_void<Args...>::type;
|
||||
} // namespace invoke_hpp
|
||||
|
||||
//
|
||||
// integer_sequence
|
||||
//
|
||||
|
||||
namespace invoke_hpp
|
||||
{
|
||||
template < typename T, T... Ints >
|
||||
struct integer_sequence { // NOLINT
|
||||
using value_type = T;
|
||||
static constexpr std::size_t size() noexcept { return sizeof...(Ints); }
|
||||
};
|
||||
|
||||
template < std::size_t... Ints >
|
||||
using index_sequence = integer_sequence<std::size_t, Ints...>;
|
||||
|
||||
namespace impl
|
||||
{
|
||||
template < typename T, std::size_t N, T... Ints >
|
||||
struct make_integer_sequence_impl // NOLINT
|
||||
: make_integer_sequence_impl<T, N - 1, N - 1, Ints...> {};
|
||||
|
||||
template < typename T, T... Ints >
|
||||
struct make_integer_sequence_impl<T, 0, Ints...>
|
||||
: integer_sequence<T, Ints...> {};
|
||||
}
|
||||
|
||||
template < typename T, std::size_t N >
|
||||
using make_integer_sequence = impl::make_integer_sequence_impl<T, N>;
|
||||
|
||||
template < std::size_t N >
|
||||
using make_index_sequence = make_integer_sequence<std::size_t, N>;
|
||||
|
||||
template < typename... Ts >
|
||||
using index_sequence_for = make_index_sequence<sizeof...(Ts)>;
|
||||
} // namespace invoke_hpp
|
||||
|
||||
//
|
||||
// is_reference_wrapper
|
||||
//
|
||||
|
||||
namespace invoke_hpp
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template < typename T >
|
||||
struct is_reference_wrapper_impl // NOLINT
|
||||
: std::false_type {};
|
||||
|
||||
template < typename U >
|
||||
struct is_reference_wrapper_impl<std::reference_wrapper<U>>
|
||||
: std::true_type {};
|
||||
}
|
||||
|
||||
template < typename T >
|
||||
struct is_reference_wrapper // NOLINT
|
||||
: impl::is_reference_wrapper_impl<typename std::remove_cv<T>::type> {};
|
||||
} // namespace invoke_hpp
|
||||
|
||||
//
|
||||
// invoke
|
||||
//
|
||||
|
||||
namespace invoke_hpp
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
//
|
||||
// invoke_member_object_impl
|
||||
//
|
||||
|
||||
template
|
||||
<
|
||||
typename Base, typename F, typename Derived,
|
||||
typename std::enable_if<std::is_base_of<Base, typename std::decay<Derived>::type>::value, int>::type = 0
|
||||
>
|
||||
constexpr auto invoke_member_object_impl(F Base::* f, Derived&& ref) // NOLINT
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
std::forward<Derived>(ref).*f)
|
||||
|
||||
template
|
||||
<
|
||||
typename Base, typename F, typename RefWrap,
|
||||
typename std::enable_if<is_reference_wrapper<typename std::decay<RefWrap>::type>::value, int>::type = 0
|
||||
>
|
||||
constexpr auto invoke_member_object_impl(F Base::* f, RefWrap&& ref) // NOLINT
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
ref.get().*f)
|
||||
|
||||
template
|
||||
<
|
||||
typename Base, typename F, typename Pointer,
|
||||
typename std::enable_if<
|
||||
!std::is_base_of<Base, typename std::decay<Pointer>::type>::value &&
|
||||
!is_reference_wrapper<typename std::decay<Pointer>::type>::value
|
||||
, int>::type = 0
|
||||
>
|
||||
constexpr auto invoke_member_object_impl(F Base::* f, Pointer&& ptr) // NOLINT
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
(*std::forward<Pointer>(ptr)).*f)
|
||||
|
||||
//
|
||||
// invoke_member_function_impl
|
||||
//
|
||||
|
||||
template
|
||||
<
|
||||
typename Base, typename F, typename Derived, typename... Args,
|
||||
typename std::enable_if<std::is_base_of<Base, typename std::decay<Derived>::type>::value, int>::type = 0
|
||||
>
|
||||
constexpr auto invoke_member_function_impl(F Base::* f, Derived&& ref, Args&&... args) // NOLINT
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
(std::forward<Derived>(ref).*f)(std::forward<Args>(args)...))
|
||||
|
||||
template
|
||||
<
|
||||
typename Base, typename F, typename RefWrap, typename... Args,
|
||||
typename std::enable_if<is_reference_wrapper<typename std::decay<RefWrap>::type>::value, int>::type = 0
|
||||
>
|
||||
constexpr auto invoke_member_function_impl(F Base::* f, RefWrap&& ref, Args&&... args) // NOLINT
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
(ref.get().*f)(std::forward<Args>(args)...))
|
||||
|
||||
template
|
||||
<
|
||||
typename Base, typename F, typename Pointer, typename... Args,
|
||||
typename std::enable_if<
|
||||
!std::is_base_of<Base, typename std::decay<Pointer>::type>::value &&
|
||||
!is_reference_wrapper<typename std::decay<Pointer>::type>::value
|
||||
, int>::type = 0
|
||||
>
|
||||
constexpr auto invoke_member_function_impl(F Base::* f, Pointer&& ptr, Args&&... args) // NOLINT
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
((*std::forward<Pointer>(ptr)).*f)(std::forward<Args>(args)...))
|
||||
} // namespace impl
|
||||
|
||||
template
|
||||
<
|
||||
typename F, typename... Args,
|
||||
typename std::enable_if<!std::is_member_pointer<typename std::decay<F>::type>::value, int>::type = 0
|
||||
>
|
||||
constexpr auto invoke(F&& f, Args&&... args)
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
std::forward<F>(f)(std::forward<Args>(args)...))
|
||||
|
||||
template
|
||||
<
|
||||
typename F, typename T,
|
||||
typename std::enable_if<std::is_member_object_pointer<typename std::decay<F>::type>::value, int>::type = 0
|
||||
>
|
||||
constexpr auto invoke(F&& f, T&& t)
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
impl::invoke_member_object_impl(std::forward<F>(f), std::forward<T>(t)))
|
||||
|
||||
template
|
||||
<
|
||||
typename F, typename... Args,
|
||||
typename std::enable_if<std::is_member_function_pointer<typename std::decay<F>::type>::value, int>::type = 0
|
||||
>
|
||||
constexpr auto invoke(F&& f, Args&&... args)
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
impl::invoke_member_function_impl(std::forward<F>(f), std::forward<Args>(args)...))
|
||||
} // namespace invoke_hpp
|
||||
|
||||
//
|
||||
// invoke_result
|
||||
//
|
||||
|
||||
namespace invoke_hpp
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct invoke_result_impl_tag {}; // NOLINT
|
||||
|
||||
template < typename Void, typename F, typename... Args >
|
||||
struct invoke_result_impl {}; // NOLINT
|
||||
|
||||
template < typename F, typename... Args >
|
||||
struct invoke_result_impl<void_t<invoke_result_impl_tag, decltype(invoke_hpp::invoke(std::declval<F>(), std::declval<Args>()...))>, F, Args...> {
|
||||
using type = decltype(invoke_hpp::invoke(std::declval<F>(), std::declval<Args>()...));
|
||||
};
|
||||
} // namespace impl
|
||||
|
||||
template < typename F, typename... Args >
|
||||
struct invoke_result // NOLINT
|
||||
: impl::invoke_result_impl<void, F, Args...> {};
|
||||
|
||||
template < typename F, typename... Args >
|
||||
using invoke_result_t = typename invoke_result<F, Args...>::type;
|
||||
} // namespace invoke_hpp
|
||||
|
||||
//
|
||||
// is_invocable
|
||||
//
|
||||
|
||||
namespace invoke_hpp
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
struct is_invocable_r_impl_tag {}; // NOLINT
|
||||
|
||||
template < typename Void, typename R, typename F, typename... Args >
|
||||
struct is_invocable_r_impl // NOLINT
|
||||
: std::false_type {};
|
||||
|
||||
template < typename R, typename F, typename... Args >
|
||||
struct is_invocable_r_impl<void_t<is_invocable_r_impl_tag, invoke_result_t<F, Args...>>, R, F, Args...>
|
||||
: std::conditional<
|
||||
std::is_void<R>::value,
|
||||
std::true_type,
|
||||
std::is_convertible<invoke_result_t<F, Args...>, R>>::type {};
|
||||
} // namespace impl
|
||||
|
||||
template < typename R, typename F, typename... Args >
|
||||
struct is_invocable_r // NOLINT
|
||||
: impl::is_invocable_r_impl<void, R, F, Args...> {};
|
||||
|
||||
template < typename F, typename... Args >
|
||||
using is_invocable = is_invocable_r<void, F, Args...>;
|
||||
} // namespace invoke_hpp
|
||||
|
||||
//
|
||||
// apply
|
||||
//
|
||||
|
||||
namespace invoke_hpp
|
||||
{
|
||||
namespace impl
|
||||
{
|
||||
template < typename F, typename Tuple, std::size_t... I >
|
||||
constexpr auto apply_impl(F&& f, Tuple&& args, index_sequence<I...>) // NOLINT
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
invoke_hpp::invoke(
|
||||
std::forward<F>(f),
|
||||
std::get<I>(std::forward<Tuple>(args))...))
|
||||
}
|
||||
|
||||
template < typename F, typename Tuple >
|
||||
constexpr auto apply(F&& f, Tuple&& args)
|
||||
INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN(
|
||||
impl::apply_impl(
|
||||
std::forward<F>(f),
|
||||
std::forward<Tuple>(args),
|
||||
make_index_sequence<std::tuple_size<typename std::decay<Tuple>::type>::value>()))
|
||||
} // namespace invoke_hpp
|
||||
|
||||
#undef INVOKE_HPP_NOEXCEPT_DECLTYPE_RETURN
|
||||
@@ -26,6 +26,7 @@ conversions:
|
||||
"dragonBones::": "dragonbones."
|
||||
"cc::gfx::": "gfx."
|
||||
"cc::pipeline::": "nr."
|
||||
"cc::render::": "render."
|
||||
"cc::scene::": "jsb."
|
||||
"cc::geometry::": "jsb."
|
||||
"cc::event::": "jsb."
|
||||
|
||||
@@ -21,6 +21,7 @@ defaultSections = [
|
||||
'network',
|
||||
'gfx',
|
||||
'pipeline',
|
||||
'render',
|
||||
'spine',
|
||||
'editor_support',
|
||||
'dragonbones',
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
[render]
|
||||
# the prefix to be added to the generated functions. You might or might not use this in your own
|
||||
# templates
|
||||
prefix = render
|
||||
|
||||
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
|
||||
# all classes will be embedded in that namespace
|
||||
target_namespace = render
|
||||
|
||||
macro_judgement =
|
||||
|
||||
android_headers =
|
||||
|
||||
android_flags = -target armv7-none-linux-androideabi -D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS -DANDROID -D__ANDROID_API__=14 -gcc-toolchain %(gcc_toolchain_dir)s --sysroot=%(androidndkdir)s/platforms/android-14/arch-arm -idirafter %(androidndkdir)s/sources/android/support/include -idirafter %(androidndkdir)s/sysroot/usr/include -idirafter %(androidndkdir)s/sysroot/usr/include/arm-linux-androideabi -idirafter %(clangllvmdir)s/lib64/clang/5.0/include -I%(androidndkdir)s/sources/cxx-stl/llvm-libc++/include
|
||||
|
||||
clang_headers =
|
||||
clang_flags = -nostdinc -x c++ -std=c++17 -fsigned-char -mfloat-abi=soft -U__SSE__
|
||||
|
||||
cocos_headers = -I%(cocosdir)s -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/renderer -I%(cocosdir)s/cocos/platform/android -I%(cocosdir)s/external/sources
|
||||
cocos_flags = -DANDROID -DCC_PLATFORM=3 -DCC_PLATFORM_MAC_IOS=1 -DCC_PLATFORM_MAC_OSX=4 -DCC_PLATFORM_WINDOWS=2 -DCC_PLATFORM_ANDROID=3
|
||||
|
||||
|
||||
cxxgenerator_headers =
|
||||
|
||||
# extra arguments for clang
|
||||
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
|
||||
|
||||
# what headers to parse
|
||||
headers = %(cocosdir)s/cocos/renderer/pipeline/custom/RenderInterfaceTypes.h
|
||||
|
||||
hpp_headers =
|
||||
|
||||
cpp_headers = cocos/bindings/auto/jsb_gfx_auto.h cocos/bindings/auto/jsb_scene_auto.h cocos/renderer/pipeline/custom/RenderCommonJsb.h cocos/renderer/pipeline/custom/RenderGraphJsb.h
|
||||
|
||||
replace_headers =
|
||||
|
||||
# what classes to produce code for. You can use regular expressions here. When testing the regular
|
||||
# expression, it will be enclosed in "^$", like this: "^Menu.*$".
|
||||
|
||||
classes = DescriptorHierarchy Setter RasterQueueBuilder RasterPassBuilder ComputeQueueBuilder ComputePassBuilder MovePassBuilder CopyPassBuilder Pipeline
|
||||
|
||||
classes_need_extend =
|
||||
|
||||
# what should we skip? in the format ClassName::[function function]
|
||||
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
|
||||
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
|
||||
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
|
||||
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
|
||||
# functions from all classes.
|
||||
|
||||
skip =
|
||||
|
||||
skip_public_fields =
|
||||
|
||||
getter_setter =
|
||||
|
||||
rename_functions =
|
||||
|
||||
rename_classes =
|
||||
|
||||
# for all class names, should we remove something when registering in the target VM?
|
||||
remove_prefix =
|
||||
|
||||
# classes for which there will be no "parent" lookup
|
||||
classes_have_no_parents =
|
||||
|
||||
# base classes which will be skipped when their sub-classes found them.
|
||||
base_classes_to_skip =
|
||||
|
||||
# classes that create no constructor
|
||||
# Set is special and we will use a hand-written constructor
|
||||
abstract_classes = DescriptorHierarchy Setter RasterQueueBuilder RasterPassBuilder ComputeQueueBuilder ComputePassBuilder MovePassBuilder CopyPassBuilder Pipeline
|
||||
|
||||
persistent_classes =
|
||||
|
||||
classes_owned_by_cpp =
|
||||
|
||||
obtain_return_value =
|
||||
Reference in New Issue
Block a user