Add red color to Tracy profiler zones that cause CPU waiting to improve profiling

This commit is contained in:
Wojtek Figat
2025-06-11 14:56:43 +02:00
parent d6eb647d59
commit e9835766bc
10 changed files with 24 additions and 3 deletions

View File

@@ -3,11 +3,12 @@
#if GRAPHICS_API_DIRECTX11
#include "GPUSwapChainDX11.h"
#include "GPUContextDX11.h"
#include "Engine/Platform/Window.h"
#include "Engine/Graphics/RenderTools.h"
#include "Engine/GraphicsDevice/DirectX/RenderToolsDX.h"
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Profiler/ProfilerMemory.h"
#include "GPUContextDX11.h"
GPUSwapChainDX11::GPUSwapChainDX11(GPUDeviceDX11* device, Window* window)
: GPUResourceDX11(device, StringView::Empty)
@@ -140,6 +141,9 @@ GPUTextureView* GPUSwapChainDX11::GetBackBufferView()
void GPUSwapChainDX11::Present(bool vsync)
{
PROFILE_CPU();
ZoneColor(TracyWaitZoneColor);
// Present frame
ASSERT(_swapChain);
UINT presentFlags = 0;

View File

@@ -6,6 +6,7 @@
#include "GPUDeviceDX12.h"
#include "Engine/Threading/Threading.h"
#include "Engine/GraphicsDevice/DirectX/RenderToolsDX.h"
#include "Engine/Profiler/ProfilerCPU.h"
FenceDX12::FenceDX12(GPUDeviceDX12* device)
: _currentValue(1)
@@ -64,12 +65,12 @@ void FenceDX12::WaitCPU(uint64 value)
{
if (IsFenceComplete(value))
return;
PROFILE_CPU();
ZoneColor(TracyWaitZoneColor);
ScopeLock lock(_locker);
_fence->SetEventOnCompletion(value, _event);
WaitForSingleObject(_event, INFINITE);
_lastCompletedValue = _fence->GetCompletedValue();
}

View File

@@ -6,6 +6,7 @@
#include "GPUContextDX12.h"
#include "../IncludeDirectXHeaders.h"
#include "Engine/GraphicsDevice/DirectX/RenderToolsDX.h"
#include "Engine/Profiler/ProfilerCPU.h"
#include "Engine/Profiler/ProfilerMemory.h"
void BackBufferDX12::Setup(GPUSwapChainDX12* window, ID3D12Resource* backbuffer)
@@ -364,6 +365,8 @@ void GPUSwapChainDX12::End(RenderTask* task)
void GPUSwapChainDX12::Present(bool vsync)
{
PROFILE_CPU();
ZoneColor(TracyWaitZoneColor);
#if PLATFORM_XBOX_SCARLETT || PLATFORM_XBOX_ONE
ID3D12Resource* backBuffer = _backBuffers[_currentFrameIndex].GetResource();
D3D12XBOX_PRESENT_PLANE_PARAMETERS planeParameters = {};