Skip to content

Commit

Permalink
discard-cached-psos renamed to use_cached_psos (#1207)
Browse files Browse the repository at this point in the history
* enable-dcp argument

* update menu

* update cached-psos logic

* use_cached_psos set as an option

* update PrintUsage()
  • Loading branch information
igorbrsn authored Aug 1, 2023
1 parent fd8f86e commit 51e3f59
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 23 deletions.
21 changes: 10 additions & 11 deletions USAGE_desktop_D3D12.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ Usage:
[--screenshot-dir <dir>] [--screenshot-prefix <file-prefix>]
[--sfa | --skip-failed-allocations] [--replace-shaders <dir>]
[--opcd | --omit-pipeline-cache-data] [--wsi <platform>]
[--dcp | --discard-cached-psos] [--surface-index <N>]
[--use-cached-psos] [--surface-index <N>]
[--remove-unsupported] [--validate]
[--onhb | --omit-null-hardware-buffers]
[-m <mode> | --memory-translation <mode>]
Expand Down Expand Up @@ -285,16 +285,15 @@ Vulkan-only:
and suballocations.
D3D12-only:
--dcp Force CachedPSO to null when creating graphics or compute PSOs.
Can help enable replay across changing driver installs.
(Same as --discard-cached-psos)
--debug-device-lost Enables automatic injection of breadcrumbs into command buffers
and page fault reporting.
Used to debug Direct3D 12 device removed problems.
--fw <width,height> Setup windowed and override resolution.
(Same as --force-windowed)
--create-dummy-allocations Enables creation of dummy heaps and resources
for replay validation.
--use-cached-psos Permit using cached PSOs when creating graphics or compute pipelines.
Using cached PSOs may reduce PSO creation time but may result in replay errors.
--debug-device-lost Enables automatic injection of breadcrumbs into command buffers
and page fault reporting.
Used to debug Direct3D 12 device removed problems.
--fw <width,height> Setup windowed and override resolution.
(Same as --force-windowed)
--create-dummy-allocations Enables creation of dummy heaps and resources
for replay validation.
--dx12-override-object-names Generates unique names for all ID3D12Objects and
assigns each object the generated name.
This is intended to assist replay debugging.
Expand Down
8 changes: 4 additions & 4 deletions framework/decode/dx12_replay_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2207,7 +2207,7 @@ HRESULT Dx12ReplayConsumerBase::OverrideLoadGraphicsPipeline(
(desc != nullptr) && (desc->GetPointer() != nullptr) && (state != nullptr));

auto desc2 = desc->GetPointer();
if (options_.discard_cached_psos)
if (!options_.use_cached_psos)
{
desc2->CachedPSO.pCachedBlob = nullptr;
desc2->CachedPSO.CachedBlobSizeInBytes = 0;
Expand Down Expand Up @@ -2240,7 +2240,7 @@ HRESULT Dx12ReplayConsumerBase::OverrideLoadComputePipeline(
(desc != nullptr) && (desc->GetPointer() != nullptr) && (state != nullptr));

auto desc2 = desc->GetPointer();
if (options_.discard_cached_psos)
if (!options_.use_cached_psos)
{
desc2->CachedPSO.pCachedBlob = nullptr;
desc2->CachedPSO.CachedBlobSizeInBytes = 0;
Expand Down Expand Up @@ -3107,7 +3107,7 @@ HRESULT Dx12ReplayConsumerBase::OverrideCreateGraphicsPipelineState(
auto device = static_cast<ID3D12Device*>(device_object_info->object);

auto pDesc2 = pDesc->GetPointer();
if (options_.discard_cached_psos)
if (!options_.use_cached_psos)
{
pDesc2->CachedPSO.pCachedBlob = nullptr;
pDesc2->CachedPSO.CachedBlobSizeInBytes = 0;
Expand All @@ -3134,7 +3134,7 @@ HRESULT Dx12ReplayConsumerBase::OverrideCreateComputePipelineState(
auto device = static_cast<ID3D12Device*>(device_object_info->object);

auto pDesc2 = pDesc->GetPointer();
if (options_.discard_cached_psos)
if (!options_.use_cached_psos)
{
pDesc2->CachedPSO.pCachedBlob = nullptr;
pDesc2->CachedPSO.CachedBlobSizeInBytes = 0;
Expand Down
2 changes: 1 addition & 1 deletion framework/decode/dx_replay_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct DxReplayOptions : public ReplayOptions
{
bool enable_d3d12{ true };
bool enable_d3d12_two_pass_replay{ false };
bool discard_cached_psos{ false };
bool use_cached_psos{ false };
std::vector<int32_t> AllowedDebugMessages;
std::vector<int32_t> DeniedDebugMessages;
bool override_object_names{ false };
Expand Down
1 change: 0 additions & 1 deletion tools/optimize/dx12_optimize_util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ void CreateResourceValueTrackingConsumer(

// Use default replay options, except dcp.
decode::DxReplayOptions dx_replay_options;
dx_replay_options.discard_cached_psos = true;

// Create the replay consumer.
dx12_replay_consumer = std::make_unique<decode::Dx12ResourceValueTrackingConsumer>(
Expand Down
11 changes: 6 additions & 5 deletions tools/replay/replay_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const char kOptions[] =
"opcd|--omit-pipeline-cache-data,--remove-unsupported,--validate,--debug-device-lost,--create-dummy-allocations,--"
"screenshot-all,--onhb|--omit-null-hardware-buffers,--qamr|--quit-after-measurement-"
"range,--fmr|--flush-measurement-range,--use-captured-swapchain-indices,--dcp,--discard-cached-psos,"
"--dx12-override-object-names";
"--use-cached-psos,--dx12-override-object-names";
const char kArguments[] =
"--log-level,--log-file,--gpu,--gpu-group,--pause-frame,--wsi,--surface-index,-m|--memory-translation,"
"--replace-shaders,--screenshots,--denied-messages,--allowed-messages,--screenshot-format,--"
Expand All @@ -55,7 +55,7 @@ static void PrintUsage(const char* exe_name)
GFXRECON_WRITE_CONSOLE("\t\t\t[--screenshot-dir <dir>] [--screenshot-prefix <file-prefix>]");
GFXRECON_WRITE_CONSOLE("\t\t\t[--sfa | --skip-failed-allocations] [--replace-shaders <dir>]");
GFXRECON_WRITE_CONSOLE("\t\t\t[--opcd | --omit-pipeline-cache-data] [--wsi <platform>]");
GFXRECON_WRITE_CONSOLE("\t\t\t[--surface-index <N>]");
GFXRECON_WRITE_CONSOLE("\t\t\t[--use-cached-psos] [--surface-index <N>]");
GFXRECON_WRITE_CONSOLE("\t\t\t[--remove-unsupported] [--validate]");
GFXRECON_WRITE_CONSOLE("\t\t\t[--onhb | --omit-null-hardware-buffers]");
GFXRECON_WRITE_CONSOLE("\t\t\t[-m <mode> | --memory-translation <mode>]");
Expand Down Expand Up @@ -200,9 +200,10 @@ static void PrintUsage(const char* exe_name)
#if defined(WIN32)
GFXRECON_WRITE_CONSOLE("")
GFXRECON_WRITE_CONSOLE("D3D12-only:")
GFXRECON_WRITE_CONSOLE(" --dcp\t\t\tForce CachedPSO to null when creating graphics or compute PSOs.");
GFXRECON_WRITE_CONSOLE(" \t\t\tCan help enable replay across changing driver installs.");
GFXRECON_WRITE_CONSOLE(" \t\t\t(Same as --discard-cached-psos)");
GFXRECON_WRITE_CONSOLE(
" --use-cached-psos \tPermit using cached PSOs when creating graphics or compute pipelines.");
GFXRECON_WRITE_CONSOLE(
" \t\t\tUsing cached PSOs may reduce PSO creation time but may result in replay errors.");
GFXRECON_WRITE_CONSOLE(" --debug-device-lost\tEnables automatic injection of breadcrumbs into command buffers");
GFXRECON_WRITE_CONSOLE(" \t\tand page fault reporting.");
GFXRECON_WRITE_CONSOLE(" \t\tUsed to debug Direct3D 12 device removed problems.");
Expand Down
9 changes: 8 additions & 1 deletion tools/tool_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ const char kSkipFailedAllocationShortOption[] = "--sfa";
const char kSkipFailedAllocationLongOption[] = "--skip-failed-allocations";
const char kDiscardCachedPsosShortOption[] = "--dcp";
const char kDiscardCachedPsosLongOption[] = "--discard-cached-psos";
const char kUseCachedPsosOption[] = "--use-cached-psos";
const char kOmitPipelineCacheDataShortOption[] = "--opcd";
const char kOmitPipelineCacheDataLongOption[] = "--omit-pipeline-cache-data";
const char kWsiArgument[] = "--wsi";
Expand Down Expand Up @@ -805,7 +806,13 @@ static gfxrecon::decode::DxReplayOptions GetDxReplayOptions(const gfxrecon::util

if (arg_parser.IsOptionSet(kDiscardCachedPsosLongOption) || arg_parser.IsOptionSet(kDiscardCachedPsosShortOption))
{
replay_options.discard_cached_psos = true;
GFXRECON_LOG_WARNING("The parameters --dcp and --discard-cached-psos have been deprecated in favor for "
"--use-cached-psos");
}

if (arg_parser.IsOptionSet(kUseCachedPsosOption))
{
replay_options.use_cached_psos = true;
}

if (arg_parser.IsOptionSet(kDxOverrideObjectNames))
Expand Down

0 comments on commit 51e3f59

Please sign in to comment.