Skip to content

Commit

Permalink
Add Renderdoc scope classes
Browse files Browse the repository at this point in the history
  • Loading branch information
wheremyfoodat committed Aug 25, 2024
1 parent 0c2ae1b commit 0e7697d
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion include/renderdoc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,35 @@ namespace Renderdoc {
static void setOutputDir(const std::string& path, const std::string& prefix) {}
static constexpr bool isSupported() { return false; }
} // namespace Renderdoc
#endif
#endif

namespace Renderdoc {
// RAII scope class that encloses a Renderdoc capture, as long as it's triggered by triggerCapture
struct Scope {
Scope() { Renderdoc::startCapture(); }
~Scope() { Renderdoc::endCapture(); }

Scope(const Scope&) = delete;
Scope& operator=(const Scope&) = delete;

Scope(Scope&&) = delete;
Scope& operator=(const Scope&&) = delete;
};

// RAII scope class that encloses a Renderdoc capture. Unlike regular Scope it doesn't wait for a trigger, it will always issue the capture
// trigger on its own and take a capture
struct InstantScope {
InstantScope() {
Renderdoc::triggerCapture();
Renderdoc::startCapture();
}

~InstantScope() { Renderdoc::endCapture(); }

InstantScope(const InstantScope&) = delete;
InstantScope& operator=(const InstantScope&) = delete;

InstantScope(InstantScope&&) = delete;
InstantScope& operator=(const InstantScope&&) = delete;
};
} // namespace Renderdoc

0 comments on commit 0e7697d

Please sign in to comment.