RenderDoc: Set Capture Title
Adds an option to set the capture title when using renderdoc `GPU_debug_capture_begin` has an optional `title` parameter to set the title of the renderdoc capture. Pull Request: https://projects.blender.org/blender/blender/pulls/118649
This commit is contained in:
parent
0209928647
commit
5698fb2049
@ -34,6 +34,7 @@ class Renderdoc {
|
|||||||
RENDERDOC_WindowHandle window_handle);
|
RENDERDOC_WindowHandle window_handle);
|
||||||
void end_frame_capture(RENDERDOC_DevicePointer device_handle,
|
void end_frame_capture(RENDERDOC_DevicePointer device_handle,
|
||||||
RENDERDOC_WindowHandle window_handle);
|
RENDERDOC_WindowHandle window_handle);
|
||||||
|
void set_frame_capture_title(const char *capture_title);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
@ -44,4 +45,4 @@ class Renderdoc {
|
|||||||
bool check_loaded();
|
bool check_loaded();
|
||||||
void load();
|
void load();
|
||||||
};
|
};
|
||||||
} // namespace renderdoc::api
|
} // namespace renderdoc::api
|
||||||
|
@ -33,6 +33,14 @@ void Renderdoc::end_frame_capture(RENDERDOC_DevicePointer device_handle,
|
|||||||
renderdoc_api_->EndFrameCapture(device_handle, window_handle);
|
renderdoc_api_->EndFrameCapture(device_handle, window_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Renderdoc::set_frame_capture_title(const char *title)
|
||||||
|
{
|
||||||
|
if (!check_loaded()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
renderdoc_api_->SetCaptureTitle(title);
|
||||||
|
}
|
||||||
|
|
||||||
bool Renderdoc::check_loaded()
|
bool Renderdoc::check_loaded()
|
||||||
{
|
{
|
||||||
switch (state_) {
|
switch (state_) {
|
||||||
@ -64,4 +72,4 @@ void Renderdoc::load()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace renderdoc::api
|
} // namespace renderdoc::api
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* #include "GPU_debug.h"
|
* #include "GPU_debug.h"
|
||||||
* static void do_render_engine(Render *re)
|
* static void do_render_engine(Render *re)
|
||||||
* {
|
* {
|
||||||
* GPU_debug_capture_begin();
|
* GPU_debug_capture_begin(__func__);
|
||||||
* RE_engine_render(re, false);
|
* RE_engine_render(re, false);
|
||||||
* GPU_debug_capture_end();
|
* GPU_debug_capture_end();
|
||||||
* }
|
* }
|
||||||
@ -68,8 +68,10 @@ bool GPU_debug_group_match(const char *ref);
|
|||||||
* GPU Frame capture support.
|
* GPU Frame capture support.
|
||||||
*
|
*
|
||||||
* Allows instantaneous frame capture of GPU calls between begin/end.
|
* Allows instantaneous frame capture of GPU calls between begin/end.
|
||||||
|
*
|
||||||
|
* \param title: Optional title to set for the frame capture.
|
||||||
*/
|
*/
|
||||||
void GPU_debug_capture_begin(void);
|
void GPU_debug_capture_begin(const char *title);
|
||||||
void GPU_debug_capture_end(void);
|
void GPU_debug_capture_end(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,7 @@ class DummyContext : public Context {
|
|||||||
|
|
||||||
void debug_group_begin(const char *, int) override {}
|
void debug_group_begin(const char *, int) override {}
|
||||||
void debug_group_end() override {}
|
void debug_group_end() override {}
|
||||||
bool debug_capture_begin() override
|
bool debug_capture_begin(const char * /*title*/) override
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ class Context {
|
|||||||
virtual void debug_group_end(){};
|
virtual void debug_group_end(){};
|
||||||
|
|
||||||
/* Returns true if capture successfully started. */
|
/* Returns true if capture successfully started. */
|
||||||
virtual bool debug_capture_begin() = 0;
|
virtual bool debug_capture_begin(const char *title) = 0;
|
||||||
virtual void debug_capture_end() = 0;
|
virtual void debug_capture_end() = 0;
|
||||||
virtual void *debug_capture_scope_create(const char *name) = 0;
|
virtual void *debug_capture_scope_create(const char *name) = 0;
|
||||||
virtual bool debug_capture_scope_begin(void *scope) = 0;
|
virtual bool debug_capture_scope_begin(void *scope) = 0;
|
||||||
|
@ -75,7 +75,7 @@ bool GPU_debug_group_match(const char *ref)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPU_debug_capture_begin()
|
void GPU_debug_capture_begin(const char *title)
|
||||||
{
|
{
|
||||||
/* GPU Frame capture is only enabled when --debug-gpu is specified. */
|
/* GPU Frame capture is only enabled when --debug-gpu is specified. */
|
||||||
if (!(G.debug & G_DEBUG_GPU)) {
|
if (!(G.debug & G_DEBUG_GPU)) {
|
||||||
@ -84,7 +84,7 @@ void GPU_debug_capture_begin()
|
|||||||
|
|
||||||
Context *ctx = Context::get();
|
Context *ctx = Context::get();
|
||||||
if (ctx && !ctx->debug_is_capturing) {
|
if (ctx && !ctx->debug_is_capturing) {
|
||||||
ctx->debug_is_capturing = ctx->debug_capture_begin();
|
ctx->debug_is_capturing = ctx->debug_capture_begin(title);
|
||||||
if (!ctx->debug_is_capturing) {
|
if (!ctx->debug_is_capturing) {
|
||||||
printf("Failed to start GPU frame capture!\n");
|
printf("Failed to start GPU frame capture!\n");
|
||||||
}
|
}
|
||||||
|
@ -780,7 +780,7 @@ class MTLContext : public Context {
|
|||||||
|
|
||||||
void debug_group_begin(const char *name, int index) override;
|
void debug_group_begin(const char *name, int index) override;
|
||||||
void debug_group_end() override;
|
void debug_group_end() override;
|
||||||
bool debug_capture_begin() override;
|
bool debug_capture_begin(const char *title) override;
|
||||||
void debug_capture_end() override;
|
void debug_capture_end() override;
|
||||||
void *debug_capture_scope_create(const char *name) override;
|
void *debug_capture_scope_create(const char *name) override;
|
||||||
bool debug_capture_scope_begin(void *scope) override;
|
bool debug_capture_scope_begin(void *scope) override;
|
||||||
|
@ -59,7 +59,7 @@ void MTLContext::debug_group_end()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MTLContext::debug_capture_begin()
|
bool MTLContext::debug_capture_begin(const char * /*title*/)
|
||||||
{
|
{
|
||||||
MTLCaptureManager *capture_manager = [MTLCaptureManager sharedCaptureManager];
|
MTLCaptureManager *capture_manager = [MTLCaptureManager sharedCaptureManager];
|
||||||
if (!capture_manager) {
|
if (!capture_manager) {
|
||||||
|
@ -163,7 +163,7 @@ class GLBackend : public GPUBackend {
|
|||||||
void render_end() override{};
|
void render_end() override{};
|
||||||
void render_step() override{};
|
void render_step() override{};
|
||||||
|
|
||||||
bool debug_capture_begin();
|
bool debug_capture_begin(const char *title);
|
||||||
void debug_capture_end();
|
void debug_capture_end();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -129,7 +129,7 @@ class GLContext : public Context {
|
|||||||
|
|
||||||
void debug_group_begin(const char *name, int index) override;
|
void debug_group_begin(const char *name, int index) override;
|
||||||
void debug_group_end() override;
|
void debug_group_end() override;
|
||||||
bool debug_capture_begin() override;
|
bool debug_capture_begin(const char *title) override;
|
||||||
void debug_capture_end() override;
|
void debug_capture_end() override;
|
||||||
void *debug_capture_scope_create(const char *name) override;
|
void *debug_capture_scope_create(const char *name) override;
|
||||||
bool debug_capture_scope_begin(void *scope) override;
|
bool debug_capture_scope_begin(void *scope) override;
|
||||||
|
@ -386,18 +386,23 @@ void GLContext::debug_group_end()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLContext::debug_capture_begin()
|
bool GLContext::debug_capture_begin(const char *title)
|
||||||
{
|
{
|
||||||
return GLBackend::get()->debug_capture_begin();
|
return GLBackend::get()->debug_capture_begin(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GLBackend::debug_capture_begin()
|
bool GLBackend::debug_capture_begin(const char *title)
|
||||||
{
|
{
|
||||||
#ifdef WITH_RENDERDOC
|
#ifdef WITH_RENDERDOC
|
||||||
if (G.debug & G_DEBUG_GPU_RENDERDOC) {
|
if (G.debug & G_DEBUG_GPU_RENDERDOC) {
|
||||||
return renderdoc_.start_frame_capture(nullptr, nullptr);
|
bool result = renderdoc_.start_frame_capture(nullptr, nullptr);
|
||||||
|
if (result && title) {
|
||||||
|
renderdoc_.set_frame_capture_title(title);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
UNUSED_VARS(title);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ void GPUTest::SetUp()
|
|||||||
|
|
||||||
GPU_render_begin();
|
GPU_render_begin();
|
||||||
GPU_context_begin_frame(context);
|
GPU_context_begin_frame(context);
|
||||||
GPU_debug_capture_begin();
|
GPU_debug_capture_begin(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GPUTest::TearDown()
|
void GPUTest::TearDown()
|
||||||
|
@ -72,7 +72,7 @@ class VKBackend : public GPUBackend {
|
|||||||
void render_end() override;
|
void render_end() override;
|
||||||
void render_step() override;
|
void render_step() override;
|
||||||
|
|
||||||
bool debug_capture_begin();
|
bool debug_capture_begin(const char *title);
|
||||||
void debug_capture_end();
|
void debug_capture_end();
|
||||||
|
|
||||||
shaderc::Compiler &get_shaderc_compiler();
|
shaderc::Compiler &get_shaderc_compiler();
|
||||||
|
@ -50,7 +50,7 @@ class VKContext : public Context, NonCopyable {
|
|||||||
|
|
||||||
void debug_group_begin(const char *, int) override;
|
void debug_group_begin(const char *, int) override;
|
||||||
void debug_group_end() override;
|
void debug_group_end() override;
|
||||||
bool debug_capture_begin() override;
|
bool debug_capture_begin(const char *title) override;
|
||||||
void debug_capture_end() override;
|
void debug_capture_end() override;
|
||||||
void *debug_capture_scope_create(const char *name) override;
|
void *debug_capture_scope_create(const char *name) override;
|
||||||
bool debug_capture_scope_begin(void *scope) override;
|
bool debug_capture_scope_begin(void *scope) override;
|
||||||
|
@ -30,16 +30,21 @@ void VKContext::debug_group_end()
|
|||||||
debug::pop_marker(device);
|
debug::pop_marker(device);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VKContext::debug_capture_begin()
|
bool VKContext::debug_capture_begin(const char *title)
|
||||||
{
|
{
|
||||||
return VKBackend::get().debug_capture_begin();
|
return VKBackend::get().debug_capture_begin(title);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool VKBackend::debug_capture_begin()
|
bool VKBackend::debug_capture_begin(const char *title)
|
||||||
{
|
{
|
||||||
#ifdef WITH_RENDERDOC
|
#ifdef WITH_RENDERDOC
|
||||||
return renderdoc_api_.start_frame_capture(device_get().instance_get(), nullptr);
|
bool result = renderdoc_api_.start_frame_capture(device_get().instance_get(), nullptr);
|
||||||
|
if (result && title) {
|
||||||
|
renderdoc_api_.set_frame_capture_title(title);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
#else
|
#else
|
||||||
|
UNUSED_VARS(title);
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user