Merge pull request #6071 from aws-lumberyard-dev/Atom/PixMarkers

Add CLI option to enable PIX GPU events without expressing loading the Pix runtime
This commit is contained in:
Jeremy Ong
2021-12-01 17:01:38 -07:00
committed by GitHub
4 changed files with 20 additions and 4 deletions
@@ -112,6 +112,9 @@ namespace AZ
//! Returns true if Pix dll is loaded
static bool IsPixModuleLoaded();
//! Returns true if Pix GPU events should be emitted
static bool PixGpuEventsEnabled();
//! Returns true if Warp is enabled
static bool UsingWarpDevice();
+13
View File
@@ -26,6 +26,7 @@ static bool s_isRenderDocDllLoaded = false;
#if defined(USE_PIX)
static AZStd::unique_ptr<AZ::DynamicModuleHandle> s_pixModule;
static bool s_isPixGpuCaptureDllLoaded = false;
static bool s_pixGpuMarkersEnabled = false;
#endif
static bool s_usingWarpDevice = false;
@@ -62,6 +63,7 @@ namespace AZ
#if defined(USE_RENDERDOC)
// If RenderDoc is requested, we need to load the library as early as possible (before device queries/factories are made)
bool enableRenderDoc = RHI::QueryCommandLineOption("enableRenderDoc");
s_pixGpuMarkersEnabled = s_pixGpuMarkersEnabled || enableRenderDoc;
if (enableRenderDoc && AZ_TRAIT_RENDERDOC_MODULE && !s_renderDocModule)
{
@@ -119,6 +121,8 @@ namespace AZ
//Pix dll can still be injected even if we do not pass in enablePixGPU. This can be done if we launch the app from Pix.
s_isPixGpuCaptureDllLoaded = Platform::IsPixDllInjected(AZ_TRAIT_PIX_MODULE);
s_pixGpuMarkersEnabled = s_pixGpuMarkersEnabled || RHI::QueryCommandLineOption("enablePixGpuMarkers");
#endif
}
@@ -202,6 +206,15 @@ namespace AZ
#endif
}
bool Factory::PixGpuEventsEnabled()
{
#if defined(USE_PIX)
return s_pixGpuMarkersEnabled;
#else
return false;
#endif
}
bool Factory::UsingWarpDevice()
{
return s_usingWarpDevice;
@@ -97,7 +97,7 @@ namespace AZ
SetName(name);
PIXBeginEvent(PIX_MARKER_CMDLIST_COL, name.GetCStr());
if (RHI::Factory::Get().IsPixModuleLoaded() || RHI::Factory::Get().IsRenderDocModuleLoaded())
if (RHI::Factory::Get().PixGpuEventsEnabled())
{
PIXBeginEvent(GetCommandList(), PIX_MARKER_CMDLIST_COL, name.GetCStr());
}
@@ -107,7 +107,7 @@ namespace AZ
{
FlushBarriers();
PIXEndEvent();
if (RHI::Factory::Get().IsPixModuleLoaded() || RHI::Factory::Get().IsRenderDocModuleLoaded())
if (RHI::Factory::Get().PixGpuEventsEnabled())
{
PIXEndEvent(GetCommandList());
}
+2 -2
View File
@@ -311,7 +311,7 @@ namespace AZ
PIXBeginEvent(0xFFFF00FF, GetId().GetCStr());
if (RHI::Factory::Get().IsPixModuleLoaded() || RHI::Factory::Get().IsRenderDocModuleLoaded())
if (RHI::Factory::Get().PixGpuEventsEnabled())
{
PIXBeginEvent(commandList.GetCommandList(), 0xFFFF00FF, GetId().GetCStr());
}
@@ -428,7 +428,7 @@ namespace AZ
}
}
if (RHI::Factory::Get().IsPixModuleLoaded() || RHI::Factory::Get().IsRenderDocModuleLoaded())
if (RHI::Factory::Get().PixGpuEventsEnabled())
{
PIXEndEvent(commandList.GetCommandList());
}