Minor FrameGraph improvements

- write() is marked as [[nodiscard]] since it's
  generally an error to discard it

- graphviz export not display wether a texture resource is
an actual texture or renderbuffer
This commit is contained in:
Mathias Agopian
2020-01-10 16:11:41 -08:00
committed by Mathias Agopian
parent 00ba8c09f8
commit 8e1ecbb0ea
3 changed files with 21 additions and 14 deletions

View File

@@ -170,7 +170,7 @@ void OpenGLDriver::terminate() {
executeGpuCommandsCompleteOps();
// because we called glFinish(), all callbacks should have been executed
assert(!mGpuCommandCompleteOps.size());
assert(mGpuCommandCompleteOps.empty());
for (auto& item : mSamplerMap) {
mContext.unbindSampler(item.second);
@@ -1942,9 +1942,9 @@ void OpenGLDriver::beginRenderPass(Handle<HwRenderTarget> rth,
// Use scissor test if not told to ignore, and if the viewport doesn't cover the whole target.
const bool respectScissor = !ignoreScissor &&
(params.viewport.left != 0 ||
params.viewport.bottom != 0 ||
params.viewport.width != rt->width ||
params.viewport.height != rt->height);
params.viewport.bottom != 0 ||
params.viewport.width != rt->width ||
params.viewport.height != rt->height);
if (respectScissor) {
gl.setScissor(params.viewport.left, params.viewport.bottom,
params.viewport.width, params.viewport.height);

View File

@@ -696,15 +696,22 @@ void FrameGraph::export_graphviz(utils::io::ostream& out) {
out << "\n";
for (ResourceNode const& node : registry) {
ResourceEntryBase const* subresource = node.resource;
auto textureResource = dynamic_cast<ResourceEntry<FrameGraphTexture> const*>(subresource);
out << "\"R" << node.resource->id << "_" << +node.version << "\""
"[label=\"" << node.resource->name << "\\n(version: " << +node.version << ")"
"\\nid:" << node.resource->id <<
"\\nrefs:" << node.resource->refs << ", texture: **FIXME**" << /*bool(node.resource->usage & TextureUsage::SAMPLEABLE) <<*/
"\", style=filled, fillcolor="
<< ((subresource->imported) ?
(node.resource->refs ? "palegreen" : "palegreen4") :
(node.resource->refs ? "skyblue" : "skyblue4"))
<< "]\n";
"[label=\"" << node.resource->name << "\\n(version: " << +node.version << ")" "\\nid:" << node.resource->id <<
"\\nrefs:" << node.resource->refs;
if (textureResource) {
out << ", " << (bool(textureResource->descriptor.usage & TextureUsage::SAMPLEABLE) ? "texture" : "renderbuffer");
}
out << "\", style=filled, fillcolor="
<< ((subresource->imported) ?
(node.resource->refs ? "palegreen" : "palegreen4") :
(node.resource->refs ? "skyblue" : "skyblue4"))
<< "]\n";
}
// connect passes to resources

View File

@@ -93,7 +93,7 @@ public:
// Write to a resource (i.e. add a reference to that pass)
template<typename T>
FrameGraphId<T> write(FrameGraphId<T> output) {
[[nodiscard]] FrameGraphId<T> write(FrameGraphId<T> output) {
return FrameGraphId<T>(write(FrameGraphHandle(output)));
}
@@ -137,7 +137,7 @@ public:
Builder(FrameGraph& fg, fg::PassNode& pass) noexcept;
~Builder() noexcept;
FrameGraphHandle read(FrameGraphHandle input);
FrameGraphHandle write(FrameGraphHandle output);
[[nodiscard]] FrameGraphHandle write(FrameGraphHandle output);
FrameGraph& mFrameGraph;
fg::PassNode& mPass;
};