Skip to content

Sync upstream and add required atrace events#3

Merged
olehkuznetsov merged 261 commits into
android-graphics:devfrom
olehkuznetsov:sync-upstream
Jun 8, 2026
Merged

Sync upstream and add required atrace events#3
olehkuznetsov merged 261 commits into
android-graphics:devfrom
olehkuznetsov:sync-upstream

Conversation

@olehkuznetsov

Copy link
Copy Markdown

No description provided.

ziga-lunarg and others added 30 commits February 13, 2026 18:05
Attemptying to clone AS which are built with
VkAccelerationStructureBuildRangeInfoKHR.primitiveCount equal to 0 lead
to crashed.
Replay storage is vector of ParsedBlocks moved from ad deque of parsed
blocks

Also fixes corner cases in 1st, 2nd, and stutter frames, and extra frame
when --quit-after-measurment range.
Some macOS SDK headers may trigger several warnings treated as errors in
our build. We can't do much other than ignoring them.
…t `VK_EXT_frame_boundary` is not supported
LunarG#2687)

When these errors/warnings occur, it usually does several tens/hundreds
of time in a single replay, flooding the logs with these messages.

I think logging these once is enough to know that corruptions could be
due to this particular area of the code.

Change-Id: I12f5f4dfa7d57b86ba73aa2d38c8dafcd67d48c3
* Set Python to 3.10 to match CONTRIBUTING
* fail on sub-generator failure
* Update Agility SDK to 1.618.5

* Generate code

* Update SDK version

* New function ids and classes

* Fix typo

* Unsupport functions

* Custom union D3D12_VERSION_NUMBER

* Other custom union json

* Encode function pointers

* Add warning

* New feature struct

* Set Alignment = 0 for TIGHT_ALIGNMENT

* Add missing comma

* clang-format

---------

Co-authored-by: bradgrantham-lunarg <50641407+bradgrantham-lunarg@users.noreply.github.com>
* Correct differing function definitions

In the d3d12/dxgi dll_main.cpp files, these release-capture functions
have WINAPI in their definition, but they do not elsewhere. Adding
WINAPI elsewhere to fix the conflict, which causes exceptions in x86

* Add WINAPI for PFN_ReleaseAgsCapture

---------

Co-authored-by: Ryan Necas <rnecas@qti.qualcomm.com>
* Update test suite reference hash
* Update hash in test.ref
Leap-frog many changes to VulkanTests
This change allows testing commits that are currently PRs in
ci-gfxr-suite or the VulkanTests repo. Cloning a repo doesn't pull in
PR related information, so without this change, testing a PR commit for
test_suite.ref (ci-gfxr-suite) or test.ref (VulkanTests) isn't possible.

ci/runJob.sh
ci/runJob.bat
ci/runJobAndroid.sh
- configure and fetch VulkanTests and ci-gfxr-suite repos to pull PR data
Usually only debug builds are allowed to load external Vulkan layers on
Android, which can be useful for validation/re-capture/etc. This change should
allow release builds to also load external Vulkan layers for cases where
performance is more important.
14e2e48 removed usage of std::format but didn't remove the header
currently gfxrecon-optimize does two things:
- removes unused format::MetaDataType::kInitBufferCommand and unused format::MetaDataType::kInitImageCommand
- only trimmed captures can be optimized

-> this does already account for the bulk of possible file-size reduction, which was the primary (only) benefit when using gfxrecon-optimize

this PR builds on top of existing resource-usage-tracking and adds additional capabilities:
- removes unused VkCommandBuffer (primary&secondary) incl. all blocks recording commands into those
- removes unused VkPipeline, incl. all calls to VkCreateXXXPipelines
- "removing" a block is done by replacing it with a label-block. this is done to keep block-indices intact and matches the previous behavior
- trimmed and non-trimmed captures can be processed by gfxrecon-optimize

closes LunarG#2436
* VDR: Handle replaced addresses

AccelerationStructureDumpResourcesContext needs to take into account
whether the VulkanDeviceAddressTracker has been invoked. In this case
for the VkDeviceAddress -> VulkanBufferInfo search it needs to call
GetBufferByReplayDeviceAddress instead of
GetBufferByCaptureDeviceAddress

* VDR: Fix copy/paste bugs

* Fix for VulkanDeviceAddressTracker

Convert GetAccelerationStructuresByCaptureDeviceAddress from using
capture-time device addresses into using replay-time addresses

* VDR: Fix a VVL error

AS backing buffer is used as a transfer source and destination buffer.
Updating creation VkBufferUsageFlags to reflect this

* VDR: Updating cloned AS info

Updating of VulkanAccelerationStructureKHRInfo after the AS has been
cloned is moved into CopiedAccelerationStructure

* VDR: Move function's implementation

AccelerationStructureDumpResourcesContext::ReleaseResources()
implementation is moved to the right source file

* Adding a new function to Vulkan address tracker

Adding GetAccelerationStructuresByCaptureDeviceAddress which is very
similar to GetAccelerationStructuresByReplayDeviceAddress

* VDR: Replay vs capture time AS device addresses

Address replace is not handling vkCmdCopyAccelerationStructures yet. For
that reason we need to take this into consideration when parsing TLAS
instance buffers as they will contain capture-time BLASS device
addresses.

* VDR: Fix vulkan objects leaking

AccelerationStructureDumpResourcesContext resources are released each
time AS are dumped

* Add a new VDR test

* VDR: Fix release of transfer content resources

Destructors of TransferParamsBase derived classes were not being called.
This happend for two reasons:
- ReleaseDumpingContexts was taking a copy of the dumping context
instead of a reference/pointer.
- TransferParamsBase needed a virtual destructor

* VDR: Fix CopyAccelerationStructure for AS context

Instead pointing to the source AS, all resources are cloned into the
destination AS context.
For handle mapping and extension struct (pNext/next) struct walking
during encode/decode, support ANY struct with the corresponding
fields.  This is because application's may add structs in a way
that appears erroneous to the spec, but may be supported by an
underlying driver.
1) Update missing struct mappers/wrapperes.
2) Split out core functionality for replay of vkCreatePipelineBinariesKHR
   into an override
3) Allocate space for the pipeline binary handles to be written
   if capture passed in a valid count and array.

Also  update pipeline binary test
* Covert enum string

* Add enum value to Unhandled string

* Convert GUID
marius-pelegrin-arm and others added 29 commits May 28, 2026 08:11
At replay time, the `VulkanVirtualSwapchain` creates it's underlying
swapchain by adding `VK_IMAGE_USAGE_TRANSFER_SRC_BIT` and
`VK_IMAGE_USAGE_TRANSFER_DST_BIT`.

`DST` is necessary because of the copy from the virtual image to the
actual swapchain image.
However, `SRC` is not useful, as the swapchain image are never read
back. In particular, I think this was set for screenshot handling,
but screenshot is done on the virtual image, not the actual swapchain
image.

Change-Id: I7547331fd36a1914e6abd215fb2de7557d6c7542
For Vulkan function that follows the following usage:
```
// Get objectCount value from the driver
uint32_t objectCount;
vkGetObject(..., &objectCount, nullptr);

// Get objects from the driver
VkObject objects[objectCount]
vkGetObject(..., &objectCount, objects);
```

The override in VulkanReplayConsumer base should ALWAYS use the
corresponding `GetOutputPointer()` for the replay time count/object
and `GetPointer()` to get the capture time count/object.

Some functions were badly using `GetPointer()` for the replay time
count/object leading to errors when using the queried lists.

Change-Id: Id90c1672da558fe0c6d7aefe36b35e6e21b58539
…2991)

Openxr's decoder was missing the `DispatchSetEnvironmentVariablesCommand` which causes convert for `\\nas\smb_traces\vulkan\GFXR\android\adreno\openxr-tutorial-chapter-4\tutorial4_capture_frames_1_through_500.gfxr` to be missing block 2 completely, as it had meta function `SetEnvironmentVariablesCommand`.

Replicate the same `DispatchSetEnvironmentVariablesCommand` found in the vulkan decoder in the openxr decoder.
* Simplify GetImageResourceSizesOptimal

There are no callers that set all_layers_per_level to true.

* Use graphics::ScaleToMipLevel where applicable

* VDR: Dump z indices of 3D images as separate sub resource

* Simplify CopyImageBuffer

CopyImageBuffer is never used to do a CopyBufferToImage. Removing the
dead code paths and renaming the function accordingly.

* VDR: Control image depth indices to dump

Allows to conntrol of which z indices of 3D images to dump

* VDR: More robust image subresource json parsing

Image subresource entries are now optional. Missing entries are now
assigned default values: 0 for Base* and ~0U for *Count

* VDR: Fix calculation of subresource indices

* VDR: Do not scale depth of 3D images

* Update test_suite.ref

* VDR: Fix handling of multi-mip 3D images

* VDR: Include 3d image's subresource depth index in output json

* Update test_suite.ref

* Address code review comments
Add an option to specify the number of parallel jobs.
Detection of transfer contexts for primary and secondary command buffers
is simplified in QueueSubmit
* Fixes for external pipeline cache file

When --load-pipeline-cache and --save-pipeline-cache point to the same
file then the file is not emptied. Logic attempts to incrementally
accumulate all caches when multiple incomplete runs are done by marking
which caches have been loaded from the file and which not and only
storing these in the file.

* Address code review comments
DX12 AS trim metadata payloads now include serialized D3D12 build-input
structs to preserve OMM and OMM-array behavior:
  - Add a new meta id kInitDx12AccelerationStructureCommand, deprecate the old.
  - Encode and write full AS build inputs from state tracking and writer paths.
  - Decode and route structured build inputs through DX12 consumers.
  - Update DX12 utility and builder logic for OMM triangles and OMM-array
      input buffer entry handling.
* Segregate FileProcessor nested types and visitors.

Move ProcessBlockState to file_processor_types.h and visitor classes
(DecoderAllocGuard, DecoderSupportsDispatch, SetDecoderApiCallId,
DispatchVisitor, ProcessVisitor) to file_processor_visitors.h to
reduce the include weight of file_processor.h. Remove vestigial
file_processor.h includes from fps_info.h and vulkan_cpp_consumer_base.h.

* Async Replay support

Split block_index_ and current_frame_ into dipatch time and process times versions

Add async playback framework, implemented preload on framework

Encapsulated Aynsc instrumentation

Single consumer ThreadSafeQueue (reduced locking)

Cacheline usage/alignment for thread specific data

Only flush current batch on full or wait

Flat block traversal for looping

Refactor ProcessBlock to use policy/traits

Segregated process_ and dispatch_ by cacheline
…md (LunarG#2985)

* Update test_suite for reenabling traces in commit-suite for windows-amd

* Update test_suite.ref to master merge
…unarG#2998)

relevant when using '-m rebind'.
If an app calls vkCmdPushConstants before vkCmdBindPipeline, the address
replacer had no pipeline to consult and emitted the original capture-time
buffer-device-addresses verbatim. Fixed by adding ProcessCmdBindPipeline to
VulkanAddressReplacer. re-process stored push-constant data against
the newly bound pipeline and injects a corrective vkCmdPushConstants
into the command buffer if anything got changed/corrected.

Fixes LunarG#2899
* VDR: Simplify image copy regions

The interall CopyRegion structs were redundant

* VDR: Dump whole destination image of transfer commands

* Update test_suite.ref

* VDR: Limit dumped image subresources from transfer

Dump sub resources depending on the value of DumpAllImageSubresources

* VDR: Remove unused type
Updated artifact names for Android release and added debug artifact upload step.
Those don't have arguments:
--idle-before-submit
--serialize-render-passes
--serialize-queue-submissions

So, they should be in kOptions list otherwise next command line argument is ignored
@olehkuznetsov olehkuznetsov merged commit 5b10c05 into android-graphics:dev Jun 8, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.