Skip to content

Commit

Permalink
Asset file for trimmed captures (#1644)
Browse files Browse the repository at this point in the history
* Asset file for trimmed captures

* PreloadFileProcessor::ReadBytes should update butes_read_

* Demote WriteState's timing printfs to INFO

* plumb filename instead of attaching to FileOutputStream

---------

Co-authored-by: Brad Grantham <[email protected]>
  • Loading branch information
panos-lunarg and bradgrantham-lunarg authored Oct 27, 2024
1 parent bc72f0c commit 31e59f5
Show file tree
Hide file tree
Showing 48 changed files with 5,259 additions and 486 deletions.
13 changes: 13 additions & 0 deletions USAGE_android.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,8 @@ 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. |
| 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` |
| Capture File Timestamp | debug.gfxrecon.capture_file_timestamp | BOOL | Add a timestamp to the capture file as described by [Timestamps](#timestamps). Default is: `true` |
| Capture File Flush After Write | debug.gfxrecon.capture_file_flush | BOOL | Flush output stream after each packet is written to the capture file. Default is: `false` |
Expand Down Expand Up @@ -468,6 +470,17 @@ An existing capture file can be trimmed by replaying the capture with the captur
enabled and a trimming frame range or capture trigger enabled. (However, replay for
some content may be fast enough using the trigger property may be difficult.)

### Asset files

When doing a trimmed capture, `debug.gfxrecon.capture_use_asset_file` gives the
option to dump all assets (images, buffers and descriptors) separetly in a
different capture file called the asset file. When this option is enabled
assets are tracked and only those that are changed during a tracking period
(outside of a trim range) are dumped into the asset file. This first time a
trim range is encountered (or the hotkey is pressed) all assets will be dumped,
but the next time this happens only the assets that have been changed will be
dumped. This should speed up the dumping process.

### Capture Limitations

#### Conflicts With Crash Detection Libraries
Expand Down
18 changes: 14 additions & 4 deletions USAGE_desktop_Vulkan.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,9 @@ option values.
| Capture Specific Frames | 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 | GFXRECON_QUIT_AFTER_CAPTURE_FRAMES | BOOL | Setting it to `true` will force the application to terminate once all frame ranges specified by `GFXRECON_CAPTURE_FRAMES` have been captured. Default is: `false` |
| Hotkey Capture Trigger | GFXRECON_CAPTURE_TRIGGER | STRING | Specify a hotkey (any one of F1-F12, TAB, CONTROL) that will be used to start/stop capture. Example: `F3` will set the capture trigger to F3 hotkey. One capture file will be generated for each pair of start/stop hotkey presses. Default is: Empty string (hotkey capture trigger is disabled). |
| Hotkey Capture Trigger Frames | GFXRECON_CAPTURE_TRIGGER_FRAMES | STRING | Specify a limit on the number of frames to be captured via hotkey. Example: `1` will capture exactly one frame when the trigger key is pressed. Default is: Empty string (no limit) |
| Hotkey Capture Trigger Frames | GFXRECON_CAPTURE_TRIGGER_FRAMES | STRING | Specify a limit on the number of frames to be captured via hotkey. Example: `1` will capture exactly one frame when the trigger key is pressed. Default is: Empty string (no limit)

| Use asset file | 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. |
| Capture Specific GPU Queue Submits | GFXRECON_CAPTURE_QUEUE_SUBMITS | STRING | Specify one or more comma-separated GPU queue submit call ranges to capture. Queue submit calls are `vkQueueSubmit` for Vulkan and `ID3D12CommandQueue::ExecuteCommandLists` for DX12. Queue submit ranges work as described above in `GFXRECON_CAPTURE_FRAMES` but on GPU queue submit calls instead of frames. The index is 0-based. Default is: Empty string (all queue submits are captured). |
| Capture File Compression Type | GFXRECON_CAPTURE_COMPRESSION_TYPE | STRING | Compression format to use with the capture file. Valid values are: `LZ4`, `ZLIB`, `ZSTD`, and `NONE`. Default is: `LZ4` |
| Capture File Timestamp | GFXRECON_CAPTURE_FILE_TIMESTAMP | BOOL | Add a timestamp to the capture file as described by [Timestamps](#timestamps). Default is: `true` |
Expand Down Expand Up @@ -431,6 +433,17 @@ configured to capture only from frame 100 through frame 200 into a new capture f

`gfxrecon-capture.py -f 100-200 gfxrecon-replay gfxrecon-example-capture.gfxr``

### Asset files

When doing a trimmed capture, `GFXRECON_CAPTURE_USE_ASSET_FILE` gives the option to
dump all assets (images, buffers and descriptors) separetly in a different capture
file called the asset file. When this option is enabled assets are tracked and
only those that are changed during a tracking period (outside of a trim range) are
dumped into the asset file. This first time a trim range is encountered (or the
hotkey is pressed) all assets will be dumped, but the next time this happens only
the assets that have been changed will be dumped. This should speed up the dumping
process.

### Capture Script

The `gfxrecon-capture-vulkan.py` tool is a convenience script that can be used to
Expand Down Expand Up @@ -542,7 +555,6 @@ gfxrecon-replay [-h | --help] [--version] [--gpu <index>]
[--dump-resources-dump-vertex-index-buffers]
[--dump-resources-json-output-per-command]
[--dump-resources-dump-immutable-resources]
[--dump-resources-dump-raw-images]
[--dump-resources-dump-all-image-subresources] <file>
[--pbi-all] [--pbis <index1,index2>]
[--pipeline-creation-jobs | --pcj <num_jobs>]
Expand Down Expand Up @@ -759,8 +771,6 @@ Optional arguments:
Enables dumping of resources that are used as inputs in the commands requested for dumping.
--dump-resources-dump-all-image-subresources
Enables dumping of all image sub resources (mip map levels and array layers).
--dump-resources-dump-raw-images
When enabled all image resources will be dumped verbatim as raw bin files.
--pbi-all
Print all block information.
--pbis <index1,index2>
Expand Down
5 changes: 5 additions & 0 deletions framework/decode/api_decoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ class ApiDecoder

virtual void DispatchGetDx12RuntimeInfo(const format::Dx12RuntimeInfoCommandHeader& runtime_info_header){};

virtual void DispatchExecuteBlocksFromFile(format::ThreadId thread_id,
uint32_t n_blocks,
int64_t offset,
const std::string& filename){};

virtual void SetCurrentBlockIndex(uint64_t block_index){};

virtual void SetCurrentApiCallId(format::ApiCallId api_call_id){};
Expand Down
Loading

0 comments on commit 31e59f5

Please sign in to comment.