Replies: 8 comments 8 replies
-
Moving to FrameGraph is a big paradigm shift. It might be overwhelming at first but once you understand it you won't look back ;) I encourage you to watch/read: |
Beta Was this translation helpful? Give feedback.
-
Oh! I have generally finished reading your project and it wrote very well and clearly, Thank you very much~ :D. When I try to read If I create a FrameGraphResource FrameGraph::Builder::read(FrameGraphResource id) {
assert(m_frameGraph.isValid(id));
return m_passNode._read(id);
|_ assert(!creates(id) && !writes(id));
} It looks like If I want create an
constexpr auto kBackbufferId = 777;
FrameGraph fg;
const auto backbuffer = fg.import("Backbuffer", {1280, 720}, FrameGraphTexture{kBackbufferId}); In really case the code maybe looks like:
Is that right? or just create an |
Beta Was this translation helpful? Give feedback.
-
Yes, you need to rebuild the FrameGraph every frame.
Here I have a FrameGraph with 38 passes and 51 resources: (measured with Tracy Profiler).
Do you want to create a resource in a pass and read it immediately in the same pass? That will give you a garbage data.
It's up to you. Pass whatever you need to struct PassData {};
fg.addCallbackPass<PassData>("SimplePass",
[&](FrameGraph::Builder &builder, PassData &data) {
// ...
},
[=](const PassData &data, FrameGraphPassResources &resources, void *ctx) {
auto &rc = *static_cast<RenderContext *>(ctx);
rc.bindPipeline(/* whatever, could be a member variable */);
// ...
}
); Here you have an example:
Here, the SSAO pass is the owner of a noise texture and a kernel uniform buffer. Both are initialized by the constructor and then captured by the execution callback. To create a resource, the FrameGraph class uses given void execute(void *context = nullptr, void *allocator = nullptr); Take a look at here, for an example of a transient resource system. |
Beta Was this translation helpful? Give feedback.
-
Oh~ Thank you very very much~ :D |
Beta Was this translation helpful? Give feedback.
-
When to judge bool FrameGraph::isValid(FrameGraphResource id) const {
const auto &node = _getResourceNode(id);
auto &resource = m_resourceRegistry[node.m_resourceId];
return node.m_version == resource.m_version;
} the code compare the I know if different |
Beta Was this translation helpful? Give feedback.
-
It enforces a specific execution order of the render passes (prevents mistakes). Imagine that you have a pass P0, that writes to a resource R. I'm gonna convert this issue to a discussion (since it's not really an issue). The original question is about the |
Beta Was this translation helpful? Give feedback.
-
Hello I am coming again. //FrameGraphPass fgp = ...;
//FrameGraphPassResources fgpr = ...;
//void* custom_data = ...;
fgp(fgpr, custom_data); I only find the std::invoke(*pass.m_exec, resources, context); Is that means the |
Beta Was this translation helpful? Give feedback.
-
Once again it's type erasure, but this time for a function. FrameGraph fg;
struct PassData {};
fg.addCallbackPass<PassData>("SimplePass",
[&](auto &builder, PassData &data) {
// setup callback, called immediatly via fg.addCallback
},
[=](const PassData &data, FrameGraphPassResources &resources, void *) {
// this is an execution callback, it's execution is deferred.
// (see the very last line of this post)
}
); Execution callback is wrapped: FrameGraph/include/fg/FrameGraph.inl Line 15 in 326e676 fg.execute() Line 99 in 326e676 Here, a pass FrameGraph/include/fg/PassEntry.hpp Line 23 in 326e676 |
Beta Was this translation helpful? Give feedback.
-
When I read
test
intest.cpp
and
What is the
m_hasSideEffect
use for?And the
FrameGraph-Example
just a little complex, I am just a fresh hand. Can you update an example about how to draw a box with index buffer? :D Thanks~Beta Was this translation helpful? Give feedback.
All reactions