-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathFrameGraphHelper.cpp
More file actions
31 lines (29 loc) · 1.07 KB
/
FrameGraphHelper.cpp
File metadata and controls
31 lines (29 loc) · 1.07 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
#include "FrameGraphHelper.hpp"
#include "fg/FrameGraph.hpp"
#include "FrameGraphTexture.hpp"
#include "FrameGraphBuffer.hpp"
FrameGraphResource importTexture(FrameGraph &fg, const std::string_view name,
Texture *texture) {
assert(texture && *texture);
return fg.import<FrameGraphTexture>(
name,
{
.extent = texture->getExtent(),
.numMipLevels = texture->getNumMipLevels(),
.layers = texture->getNumLayers(),
.format = texture->getPixelFormat(),
},
{texture});
}
Texture &getTexture(FrameGraphPassResources &resources, FrameGraphResource id) {
return *resources.get<FrameGraphTexture>(id).texture;
}
FrameGraphResource importBuffer(FrameGraph &fg, const std::string_view name,
Buffer *buffer) {
assert(buffer && *buffer);
return fg.import<FrameGraphBuffer>(name, {.size = buffer->getSize()},
{buffer});
}
Buffer &getBuffer(FrameGraphPassResources &resources, FrameGraphResource id) {
return *resources.get<FrameGraphBuffer>(id).buffer;
}