Get GPU Visualizer info

I want to read some info from the GPU Visualizer widget and use it in my plugin, but I have no idea how.

I guess this code is responsible for running the ProfileGPU console command:

// Create and display profile visualizer data
		if (RHIConfig::ShouldShowProfilerAfterProfilingGPU())

		// execute on main thread
				struct FDisplayProfilerVisualizer
					void Thread( TSharedPtr<FVisualizerEvent> InVisualizerData, const FText InVsyncEnabledWarningText )
						static FName TaskGraphModule(TEXT("TaskGraph"));			
						if (FModuleManager::Get().IsModuleLoaded(TaskGraphModule))
							IProfileVisualizerModule& ProfileVisualizer = FModuleManager::GetModuleChecked<IProfileVisualizerModule>(TaskGraphModule);
							// Display a warning if this is a GPU profile and the GPU was profiled with v-sync enabled (otherwise InVsyncEnabledWarningText is empty)
							ProfileVisualizer.DisplayProfileVisualizer( InVisualizerData, TEXT("GPU"), InVsyncEnabledWarningText, FLinearColor::Red );
				} DisplayProfilerVisualizer;

				TSharedPtr<FVisualizerEvent> VisualizerData = CreateVisualizerData( EventTree );


					FSimpleDelegateGraphTask::FDelegate::CreateRaw(&DisplayProfilerVisualizer, &FDisplayProfilerVisualizer::Thread, VisualizerData, VsyncEnabledWarningText),
					GET_STATID(STAT_FSimpleDelegateGraphTask_DisplayProfilerVisualizer), nullptr, ENamedThreads::GameThread


Any ideas on how to get the widget? Or maybe there is an easier way to get that info?


I made some investigation. RHI handles GPU profiling logic, and it is done inside the FGPUProfiler structure. However, the structure itself does not give any information, so it must be given by the rendering API. DirectX12 rendering module runs the profiler after rendering a frame. It stores some data on frame start and overrides it with another on frame end. On frame end, it can run the profiler if some boolean is true. I suppose that I need either get that whole dx class and simply run some method or maybe there are just methods to render a frame with info suitable for the FGPUProfiler structure.

I think I am close to understanding how to make it work.

Hello, did You get that working?

I’ve figured it out. This tutorial describes how to get shadowcasting lights from the profile but you can get anything you want this way.