Skip to content

Commit

Permalink
Fix capture_trigger_frames on Android
Browse files Browse the repository at this point in the history
This mostly already works, just needs a tweak to allow specifying the option
without capture_trigger since Android uses a different trigger method
(android_capture_trigger)
  • Loading branch information
mikes-lunarg committed Jan 23, 2025
1 parent e4b939e commit 554a54e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
1 change: 1 addition & 0 deletions USAGE_android.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ option values.
| Capture Specific Frames | debug.gfxrecon.capture_frames | STRING | Specify one or more comma-separated frame ranges to capture. Each range will be written to its own file. A frame range can be specified as a single value, to specify a single frame to capture, or as two hyphenated values, to specify the first and last frame to capture. Frame ranges should be specified in ascending order and cannot overlap. Note that frame numbering is 1-based (i.e. the first frame is frame 1). Example: `200,301-305` will create two capture files, one containing a single frame and one containing five frames. Default is: Empty string (all frames are captured). |
| Quit after capturing frame ranges | debug.gfxrecon.quit_after_capture_frames | BOOL | Setting it to `true` will force the application to terminate once all frame ranges specified by `debug.gfxrecon.capture_frames` have been captured. Default is: `false` |
| Capture trigger for Android | debug.gfxrecon.capture_android_trigger | BOOL | Set during runtime to `true` to start capturing and to `false` to stop. If not set at all then it is disabled (non-trimmed capture). Default is not set. |
| Capture Trigger Frames | debug.gfxrecon.capture_trigger_frames | STRING | Specify a limit on the number of frames to be captured via trim trigger. Example: `1` will capture exactly one frame when the trimming is triggered. Default is: Empty string (no limit) |
| Use asset file | debug.gfxrecon.capture_use_asset_file | BOOL | When set to `true` assets (images, buffers and descriptors) will be stored separately into an asset file instead of the capture file. |
| Dump asset file | debug.gfxrecon.capture_android_dump_assets | BOOL | Setting this triggers a dump of all assets into the asset file. Since android options cannot be set by the layer, dumping is done whenever this option switches between from `false` to `true` or from `true` to `false`. Default is: `false` |
| Capture File Compression Type | debug.gfxrecon.capture_compression_type | STRING | Compression format to use with the capture file. Valid values are: `LZ4`, `ZLIB`, `ZSTD`, and `NONE`. Default is: `LZ4` |
Expand Down
21 changes: 15 additions & 6 deletions framework/encode/capture_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,17 +580,12 @@ void CaptureSettings::ProcessOptions(OptionsMap* options, CaptureSettings* setti
}
}

std::string trim_key_option = FindOption(options, kOptionKeyCaptureTrigger);
std::string trim_key_frames_option = FindOption(options, kOptionKeyCaptureTriggerFrames);
std::string trim_key_option = FindOption(options, kOptionKeyCaptureTrigger);
if (!trim_key_option.empty())
{
if (settings->trace_settings_.trim_ranges.empty())
{
settings->trace_settings_.trim_key = ParseTrimKeyString(trim_key_option);
if (!trim_key_frames_option.empty())
{
settings->trace_settings_.trim_key_frames = ParseTrimKeyFramesString(trim_key_frames_option);
}
if (!settings->trace_settings_.trim_key.empty())
{
settings->trace_settings_.trim_boundary = TrimBoundary::kFrames;
Expand All @@ -602,6 +597,20 @@ void CaptureSettings::ProcessOptions(OptionsMap* options, CaptureSettings* setti
}
}

std::string trim_key_frames_option = FindOption(options, kOptionKeyCaptureTriggerFrames);
if (!trim_key_frames_option.empty())
{
if (settings->trace_settings_.trim_ranges.empty())
{
settings->trace_settings_.trim_key_frames = ParseTrimKeyFramesString(trim_key_frames_option);
}
else
{
GFXRECON_LOG_WARNING(
"Settings Loader: Ignoring trim trigger frames setting as trim ranges has been specified.");
}
}

settings->trace_settings_.quit_after_frame_ranges = ParseBoolString(
FindOption(options, kOptionKeyQuitAfterCaptureFrames), settings->trace_settings_.quit_after_frame_ranges);

Expand Down

0 comments on commit 554a54e

Please sign in to comment.