renderdoc.BinaryPath

renderdoc.BinaryPath

#Overview

name: renderdoc.BinaryPath

This variable is created as a Console Variable (cvar).

It is referenced in 8 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of renderdoc.BinaryPath is to specify the path to the main RenderDoc executable. RenderDoc is a graphics debugging tool used for capturing and analyzing frames from graphics applications.

This setting variable is primarily used by the RenderDoc plugin for Unreal Engine. It’s part of the rendering and debugging system, specifically for integrating RenderDoc functionality into the engine.

The value of this variable is set through several methods:

  1. It can be manually set by users.
  2. It’s automatically set when the plugin finds a valid RenderDoc installation path.
  3. On Windows, it can be set based on the RenderDoc system installation found in the registry.
  4. On Linux, it’s set based on the found librenderdoc.so path.

The associated variable CVarRenderDocBinaryPath interacts directly with renderdoc.BinaryPath. It’s a console variable that holds the same value and is used throughout the code to access and modify the RenderDoc binary path.

Developers should be aware that:

  1. This variable is crucial for the RenderDoc plugin to function correctly.
  2. The path should point to the directory containing the main RenderDoc executable (qrenderdoc on Linux, renderdoc.exe on Windows).
  3. If not set correctly, the plugin may fail to load RenderDoc, impacting debugging capabilities.

Best practices when using this variable include:

  1. Ensure the path is set correctly for your development environment.
  2. Use absolute paths to avoid any ambiguity.
  3. Update the path if you change your RenderDoc installation.
  4. Be aware of platform differences (Linux vs Windows) in how the path is used and set.

Regarding the associated variable CVarRenderDocBinaryPath: Its purpose is to provide a programmatic way to access and modify the renderdoc.BinaryPath value within the C++ code. It’s used throughout the RenderDoc plugin code to retrieve and set the binary path. The same considerations and best practices apply to this variable as to renderdoc.BinaryPath. Developers should use this variable when they need to interact with the RenderDoc binary path in their C++ code within the plugin.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginLoader.cpp:38

Scope: file

Source code excerpt:

// CVarRenderDocBinaryPath would be `/home/user/dev/renderdoc_1.18/bin' in this case
static TAutoConsoleVariable<FString> CVarRenderDocBinaryPath(
	TEXT("renderdoc.BinaryPath"),
	TEXT(""),
	TEXT("Path to the main RenderDoc executable to use."));

#if PLATFORM_LINUX
	static const FString RenderDocDllName = TEXT("librenderdoc.so");
#else

#Associated Variable and Callsites

This variable is associated with another variable named CVarRenderDocBinaryPath. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginLoader.cpp:36

Scope: file

Source code excerpt:

//   /home/user/dev/renderdoc_1.18/bin/qrenderdoc
//   /home/user/dev/renderdoc_1.18/lib/librenderdoc.so
// CVarRenderDocBinaryPath would be `/home/user/dev/renderdoc_1.18/bin' in this case
static TAutoConsoleVariable<FString> CVarRenderDocBinaryPath(
	TEXT("renderdoc.BinaryPath"),
	TEXT(""),
	TEXT("Path to the main RenderDoc executable to use."));

#if PLATFORM_LINUX
	static const FString RenderDocDllName = TEXT("librenderdoc.so");

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginLoader.cpp:145

Scope (from outer to inner):

file
function     static FString GetRenderDocLibPath

Source code excerpt:

				FPaths::CollapseRelativeDirectories(LibRenderDocSO);

				// Set CVarRenderDocBinaryPath to "/home/user/dev/renderdoc_1.18/bin"
				CVarRenderDocBinaryPath.AsVariable()->Set(*FPaths::GetPath(QRenderDocBin), ECVF_SetByProjectSetting);

				// Return "/home/user/dev/renderdoc_1.18/lib/librenderdoc.so"
				return LibRenderDocSO;
			}
		}
	}

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginLoader.cpp:157

Scope: file

Source code excerpt:

}

// Search CVarRenderDocBinaryPath and PATH env for qrenderdoc and return appropriate librenderdoc.so directory.
//
// From https://renderdoc.org/docs/getting_started/faq.html
//  On linux the binary tarball comes with files to place under /usr/share to associate RenderDoc with files.
//  This obviously also requires qrenderdoc to be available in your PATH.
static FString FindRenderDocLibPath()
{
	// Check if we have a valid path for qrenderdoc binary already set
	FString RenderDocLibPath = GetRenderDocLibPath(CVarRenderDocBinaryPath.GetValueOnAnyThread());

	if (RenderDocLibPath.IsEmpty())
	{
		TArray<FString> PathArray;
		FPlatformMisc::GetEnvironmentVariable(TEXT("PATH")).ParseIntoArray(PathArray, FPlatformMisc::GetPathVarDelimiter());

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginLoader.cpp:216

Scope (from outer to inner):

file
function     void FRenderDocPluginLoader::Initialize

Source code excerpt:


	// 1) Get binary path  from CVar:
	RenderDocDLL = LoadAndCheckRenderDocLibrary(RenderDocAPI, CVarRenderDocBinaryPath.GetValueOnAnyThread());

#if PLATFORM_WINDOWS
	// 2) Check for a RenderDoc system installation in the registry:
	if (RenderDocDLL == nullptr)
	{
		FString RenderDocPath;

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginLoader.cpp:228

Scope (from outer to inner):

file
function     void FRenderDocPluginLoader::Initialize

Source code excerpt:

		if (RenderDocDLL)
		{
			CVarRenderDocBinaryPath.AsVariable()->Set(*RenderDocPath, ECVF_SetByProjectSetting);
		}
	}
#elif PLATFORM_LINUX
	// 2) No registry, so do whatever else we can on Linux to try and find a librenderdoc.so
	if (RenderDocDLL == nullptr)
	{

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginLoader.cpp:274

Scope (from outer to inner):

file
function     void FRenderDocPluginLoader::Initialize

Source code excerpt:

		if (RenderDocDLL)
		{
			CVarRenderDocBinaryPath.AsVariable()->Set(*RenderDocPath, ECVF_SetByProjectSetting);
		}
	}
#endif

	// 4) All bets are off; aborting...
	if (RenderDocDLL == nullptr)

#Loc: <Workspace>/Engine/Plugins/Developer/RenderDocPlugin/Source/RenderDocPlugin/Private/RenderDocPluginLoader.cpp:322

Scope (from outer to inner):

file
function     void* FRenderDocPluginLoader::GetRenderDocLibrary

Source code excerpt:


#if PLATFORM_LINUX
	FString PathToRenderDocDLL = GetRenderDocLibPath(CVarRenderDocBinaryPath.GetValueOnAnyThread());
#else
	FString PathToRenderDocDLL = FPaths::Combine(*CVarRenderDocBinaryPath.GetValueOnAnyThread(), *RenderDocDllName);
#endif

	RenderDocDLL = FPlatformProcess::GetDllHandle(*PathToRenderDocDLL);

	return RenderDocDLL;
}