Repository navigation
Expand file tree
/
Copy pathnode.h
More file actions
59 lines (49 loc) · 1.33 KB
/
Copy pathnode.h
File metadata and controls
59 lines (49 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
////////////////////////////////////////////////////////////////////////////////
// Distributed under the Boost Software License, Version 1.0. //
// (See accompanying file LICENSE or copy at //
// https://www.boost.org/LICENSE_1_0.txt) //
////////////////////////////////////////////////////////////////////////////////
#pragma once
#include <cstddef>
#include <functional>
namespace iris
{
// forward declaration
class ShaderCompiler;
/**
* This is an interface for Node, which forms part of a render graph. Node
* implementations can be connected together to describe what a shader should
* do.
*/
class Node
{
public:
virtual ~Node() = default;
/**
* Accept a compiler visitor.
*
* @param compiler
* Compiler to accept.
*/
virtual void accept(ShaderCompiler &compiler) const = 0;
/**
* Compute hash of node. Implementations should combine hashes of any child nodes.
*
* @return
* Hash of node.
*/
virtual std::size_t hash() const = 0;
};
}
// specialise std::hash for node pointer
namespace std
{
template <>
struct hash<iris::Node *>
{
size_t operator()(const iris::Node *node) const
{
return node == nullptr ? std::hash<nullptr_t>{}(nullptr) : node->hash();
}
};
}