diff --git a/intern/renderdoc_dynload/intern/renderdoc_api.cc b/intern/renderdoc_dynload/intern/renderdoc_api.cc index f34d6631fa0..c6eb079362f 100644 --- a/intern/renderdoc_dynload/intern/renderdoc_api.cc +++ b/intern/renderdoc_dynload/intern/renderdoc_api.cc @@ -61,17 +61,6 @@ void Renderdoc::load() RENDERDOC_GetAPI(eRENDERDOC_API_Version_1_1_2, (void **)&renderdoc_api_); } #endif - - if (renderdoc_api_ != nullptr) { - int major; - int minor; - int patch; - renderdoc_api_->GetAPIVersion(&major, &minor, &patch); - std::cout << "Found renderdoc API [" << major << "." << minor << "." << patch << "]"; - } - else { - std::cerr << "Unable to load renderdoc API.\n"; - } } } // namespace renderdoc::api \ No newline at end of file diff --git a/source/blender/blenkernel/BKE_global.h b/source/blender/blenkernel/BKE_global.h index 23cbd73cf36..58ed77559e5 100644 --- a/source/blender/blenkernel/BKE_global.h +++ b/source/blender/blenkernel/BKE_global.h @@ -201,11 +201,12 @@ enum { G_DEBUG_IO = (1 << 17), /* IO Debugging (for Collada, ...). */ G_DEBUG_GPU_FORCE_WORKAROUNDS = (1 << 18), /* force gpu workarounds bypassing detections. */ G_DEBUG_GPU_FORCE_DISABLE_SSBO = (1 << 19), /* force disabling usage of SSBO's */ - G_DEBUG_XR = (1 << 20), /* XR/OpenXR messages */ - G_DEBUG_XR_TIME = (1 << 21), /* XR/OpenXR timing messages */ + G_DEBUG_GPU_RENDERDOC = (1 << 20), /* Enable Renderdoc integration. */ + G_DEBUG_XR = (1 << 21), /* XR/OpenXR messages */ + G_DEBUG_XR_TIME = (1 << 22), /* XR/OpenXR timing messages */ - G_DEBUG_GHOST = (1 << 22), /* Debug GHOST module. */ - G_DEBUG_WINTAB = (1 << 23), /* Debug Wintab. */ + G_DEBUG_GHOST = (1 << 23), /* Debug GHOST module. */ + G_DEBUG_WINTAB = (1 << 24), /* Debug Wintab. */ }; #define G_DEBUG_ALL \ diff --git a/source/blender/gpu/opengl/gl_debug.cc b/source/blender/gpu/opengl/gl_debug.cc index f9a4439da56..799c62c30c3 100644 --- a/source/blender/gpu/opengl/gl_debug.cc +++ b/source/blender/gpu/opengl/gl_debug.cc @@ -389,10 +389,11 @@ bool GLContext::debug_capture_begin() bool GLBackend::debug_capture_begin() { #ifdef WITH_RENDERDOC - return renderdoc_.start_frame_capture(nullptr, nullptr); -#else - return false; + if (G.debug & G_DEBUG_GPU_RENDERDOC) { + return renderdoc_.start_frame_capture(nullptr, nullptr); + } #endif + return false; } void GLContext::debug_capture_end() @@ -403,7 +404,9 @@ void GLContext::debug_capture_end() void GLBackend::debug_capture_end() { #ifdef WITH_RENDERDOC - renderdoc_.end_frame_capture(nullptr, nullptr); + if (G.debug & G_DEBUG_GPU_RENDERDOC) { + renderdoc_.end_frame_capture(nullptr, nullptr); + } #endif } diff --git a/source/blender/gpu/tests/gpu_testing.cc b/source/blender/gpu/tests/gpu_testing.cc index b3570993d44..67c2d0cec77 100644 --- a/source/blender/gpu/tests/gpu_testing.cc +++ b/source/blender/gpu/tests/gpu_testing.cc @@ -18,7 +18,7 @@ namespace blender::gpu { void GPUTest::SetUp() { prev_g_debug_ = G.debug; - G.debug |= G_DEBUG_GPU; + G.debug |= G_DEBUG_GPU | G_DEBUG_GPU_RENDERDOC; CLG_init(); GPU_backend_type_selection_set(gpu_backend_type); diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt index f8a67171221..e3725fbc6a5 100644 --- a/source/creator/CMakeLists.txt +++ b/source/creator/CMakeLists.txt @@ -54,6 +54,10 @@ if(WITH_VULKAN_BACKEND) add_definitions(-DWITH_VULKAN_BACKEND) endif() +if(WITH_RENDERDOC) + add_definitions(-DWITH_RENDERDOC) +endif() + if(WITH_CODEC_FFMPEG) add_definitions(-DWITH_FFMPEG) endif() diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c index 85b7eb0d6a5..cd487103cab 100644 --- a/source/creator/creator_args.c +++ b/source/creator/creator_args.c @@ -582,6 +582,9 @@ static int arg_handle_print_help(int UNUSED(argc), const char **UNUSED(argv), vo BLI_args_print_arg_doc(ba, "--debug-gpu"); BLI_args_print_arg_doc(ba, "--debug-gpu-force-workarounds"); BLI_args_print_arg_doc(ba, "--debug-gpu-disable-ssbo"); +# ifdef WITH_RENDERDOC + BLI_args_print_arg_doc(ba, "--debug-gpu-renderdoc"); +# endif BLI_args_print_arg_doc(ba, "--debug-wm"); # ifdef WITH_XR_OPENXR BLI_args_print_arg_doc(ba, "--debug-xr"); @@ -1118,6 +1121,19 @@ static int arg_handle_debug_gpu_set(int UNUSED(argc), return 0; } +# ifdef WITH_RENDERDOC +static const char arg_handle_debug_gpu_renderdoc_set_doc[] = + "\n" + "\tEnable Renderdoc integration for GPU frame grabbing and debugging."; +static int arg_handle_debug_gpu_renderdoc_set(int UNUSED(argc), + const char **UNUSED(argv), + void *UNUSED(data)) +{ + G.debug |= G_DEBUG_GPU_RENDERDOC | G_DEBUG_GPU; + return 0; +} +# endif + static const char arg_handle_gpu_backend_set_doc[] = "\n" "\tForce to use a specific GPU backend. Valid options: " @@ -2245,6 +2261,9 @@ void main_args_setup(bContext *C, bArgs *ba) CB_EX(arg_handle_debug_mode_generic_set, jobs), (void *)G_DEBUG_JOBS); BLI_args_add(ba, NULL, "--debug-gpu", CB(arg_handle_debug_gpu_set), NULL); +# ifdef WITH_RENDERDOC + BLI_args_add(ba, NULL, "--debug-gpu-renderdoc", CB(arg_handle_debug_gpu_renderdoc_set), NULL); +# endif BLI_args_add(ba, NULL,