Skip to content

Sync with LunarG version#5

Merged
olehkuznetsov merged 37 commits into
android-graphics:devfrom
olehkuznetsov:sync-upstream-next
Jun 24, 2026
Merged

Sync with LunarG version#5
olehkuznetsov merged 37 commits into
android-graphics:devfrom
olehkuznetsov:sync-upstream-next

Conversation

@olehkuznetsov

Copy link
Copy Markdown

No description provided.

wzchu-lunarg and others added 30 commits June 9, 2026 16:04
…tWithTemplate` (LunarG#3012)

* Add guard for  `dst_sampler_ids`

Add bind type guard for `dst_sampler_ids` as it was being unconditionally set.

We see that later in this loop, we only utilize `dst_sampler_ids` if the binding types were VK_DESCRIPTOR_TYPE_SAMPLER or VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER.

Since it was being unconditionally assigned, there were cases where `binding.handle_ids` would be nullptr as it wasn't the corresponding binding type, resulting in LunarG#2880 as we try to index `binding.handle_ids`.

* Change assert to GFXRECON_ASSERT
* put braces around clauses

* fix style
…LunarG#2935)

* simplify + bugfig

* Partial impl of new descriptor handling strategy

* First draft of new descriptor pool/set strategy

* format

* format2

* format3

* document new fields

* decode: Pointer decoder GetSpan()

* Use span-based iteration

* free resources on final iteration of loop range

* Skip calling vkFreeDescriptorSets on first iteration if any sets are found to be dangling

* skip pool reset when any child descriptor set is dangling

* second round of feedback

* Split descriptor set tracking into two sets

* Gather all dangling descriptor sets in Process_vkFreeDescriptorSets, not just one

* Move RemovePoolDanglingCreateDescriptors() to before VulkanReplayConsumer::Process_vkFreeDescriptorSets()

---------

Co-authored-by: Antonio Caggiano <antonio@lunarg.com>
…looping frame (LunarG#2936)

* simplify + bugfig

* First draft of new descriptor pool/set strategy

* format2

* second round of feedback

* Split descriptor set tracking into two sets

* Gather all dangling descriptor sets in Process_vkFreeDescriptorSets, not just one

* re-add handling for vkAcquireNextImageKHR()

* formatting
Enable easier expansion and better modularity by moving API-
specific functionality into separate features.
This is similar to the previous work done on both the
Convert and Info tools.
This should allow us to eventually add more APIs easily and possibly
allow us to eventually dynamically load only the APIs we're interested
in for a more streamlined and efficient replay.
This is due to a case where we are destroying multiple buffers. Each time we attempt to destroy a buffer, we iterate through all acceleration structures to find ones that are associated to that buffer's wrapper for tracking. After finding these associated structures, we free the buffer wrapper.

However, if we destroy multiple of these acceleration structure's buffers, on second pass, since we `VisitWrappers` for all the acceleration structures, we hit one where `acc_wrapper->buffer` is already deleted and is a dangling pointer, and therefore results in a read violation.

Instead of leaving `acc_wrapper->buffer` as dangling, set is as 'nullptr' which we can also later use to early exit out of processing this acceleration structure.
* Set GFXRECON_ENABLE_RELEASE_ASSERTS=ON for CI checks

Checks for build failures when GFXRECON_ENABLE_RELEASE_ASSERTS=ON

* Fix build error when release asserts are enabled
Add a Submit() helper that runs the plan's jobs without injecting
semaphores, and early-out to it when submit_infos is empty.
)

* Add null check and set to associated acc_wrappers

This is due to a case where we are destroying multiple buffers. Each time we attempt to destroy a buffer, we iterate through all acceleration structures to find ones that are associated to that buffer's wrapper for tracking. After finding these associated structures, we free the buffer wrapper.

However, if we destroy multiple of these acceleration structure's buffers, on second pass, since we `VisitWrappers` for all the acceleration structures, we hit one where `acc_wrapper->buffer` is already deleted and is a dangling pointer, and therefore results in a read violation.

Instead of leaving `acc_wrapper->buffer` as dangling, set is as 'nullptr' which we can also later use to early exit out of processing this acceleration structure.

* Change order of deferred operation pipeline wrapper setters

Motivated by issue when capturing "Doom: The Dark Ages" with trimming. This issue is due to writing a `vkGetRayTracingShaderGroupHandlesKHR` command with `data_size = 0`, which not only violates the Vulkan spec, but also causes an assertion error during replay in `VulkanReplayConsumerBase::OverrideGetRayTracingShaderGroupHandlesKHR` for having `pData` be null.

The writer's `data_size` is based off of the pipeline wrapper's `wrapper->num_shader_group_handles`, which happened to be 0. This was due to it not being set in `VulkanCaptureManager::DeferredOperationPostProcess` and defaulting to 0. However, why are we setting it in a `rayTracingPipelineShaderGroupHandleCaptureReplay` feature guard?

Move the set for `num_shader_group_handles` to be outside the feature guard, which also better mirrors the logic in `OverrideCreateRayTracingPipelinesKHR`.

Also remove the redundant `if (deferred_operation_wrapper)` guard.
LunarG#2679 indicates the loop is incorrect according to the spec.

After testing, there are validation errors on replay as the query pools aren't reset.

GFXR does the following when setting the state for replay:
- Create query pools
- Reset query pools
- Start "dummy" queries for the queries in active states

This fix will result in states being accurate to how they were tracked. However, GFXR simply acknowledges that queries can still read the dummy queries on the first frame after loading the state. Perhaps this will be changed eventually.
vkd3d can pass 64-bit buffer device addresses as a 2-component vectors of
unsigned 32-bit integers (uvec2). This is apparently a common lowering and
explicitly allowed by the GL_EXT_buffer_reference_uvec2 GLSL
extension. Therefore, treat uvec2 values (and arrays) as potential BDAs
in the forward SPIRV-reflect pass of
SpirVParsingUtil::ParseBufferReferences.

Add a test case to the SpirVParsingUtil for both uvec2 and uvec2[]
paths.
Prevent insertion of two EndRendering commands when dumping
resources of dynamic rendering traces

Use Begin/EndRendering aliases for internal calls when one
is available but the other isn't
* dump-resources: override query commands for replay dumps

Add dump-resources overrides for query-related Vulkan commands so generated replay code passes tracked object info into the dumper. The overrides replay query commands for dispatch/trace-rays dump contexts and avoid ending queries that were never begun, which fixes crashes during resource dumping.

* dump-resources: address query override review comments

Restore draw-call command-buffer forwarding in the query-related dump-resources overrides so they preserve the behavior that generated forwarding had before the commands moved to manual overrides.

Add the missing vkCmdCopyQueryPoolResultsToMemoryKHR override and regenerate the affected replay dump files.

* dump-resources: complete query override forwarding

Forward vkCmdBeginQuery and vkCmdEndQuery through both draw-call and dispatch/trace-rays dump command buffers, matching the indexed query overrides.

Also avoid shared_ptr ref-count churn in the forwarding helpers by iterating contexts by const reference.
…G#2972)

* Fix renderpass image layout tracking

Currently replay tracks render pass attachment finalLayout at vkCmdBeginRenderPass(2) and updates command-buffer image layout state before the render pass had actually ended.
This is problematic because:
* finalLayout only becomes valid when the render pass ends
* tracking it at begin made replay think attachments had already left their in-pass layout
* tracked image layout can be wrong while a render pass was still active
This showed up as incorrect layout state for render pass attachments and resulted in visual corruptions in rebind path.
This change:
* Keeps track of the active render pass, framebuffer, and resolved attachment image views during vkCmdBeginRenderPass(2)
* Applies attachment finalLayout to tracked image state only on vkCmdEndRenderPass(2).

Change-Id: I23b9c47f6374be3127f6f486ccb73b3fffc3dc72

* Add GetRenderPassAttachmentImageViewIds, avoid duplication

* Simplify ApplyRenderPassFinalLayouts

- Use begin-time attachment snapshot as single source of truth
- Drop dead framebuffer fallback (unreachable, begin populates vector)
- Remove now-unused framebuffer_info lookup and redundant null guards

---------

Co-authored-by: Fabian Schmidt <fabian@lunarg.com>
Carry the timeline value alongside the handle so injected waits use
the semaphore's actual value instead of a hardcoded 1.
…unarG#3026)

Move the per-submit semaphore backing storage out of
VulkanSubmitJobExecution into dedicated VulkanSubmitInfoHelper and
VulkanSubmitInfo2Helper classes. The executor now keeps one helper per
submit instead of several parallel maps keyed by submit pointer.
Split out the API-specific functionality into separate feature
classes (just like info and convert).

NOTE: This does not include OpenXR because it is not a graphics
but a compositing API.  So that feature is intentionally left out.
* Remove Android-specific build files

Merge Android and desktop build files where possible.

* Update copyright dates

* Adjust OpenXR+Android build arguments

* Remove more directories and patch a few cmake files.
vkQueueSubmit2[KHR] calls were not being handled when dumping resources
and as a result no resources were dumped at all from these queue
submissions
* VulkanResourcesUtil: Utilize maintenance10 when available

* Handle resolve with dynamic rendering

Implements an alternative for multisampled images which cannot be
resolve with vkCmdResolve. This is done by letting the driver handle the
operation by doing it via an empty dynamic rendering pass. Requires
VK_KHR_dynamic_rendering and VK_KHR_depth_stencil_resolve extensions

* Update test_suite.ref

* Incorporate new resolve changes in capture

The extensions are also enabled during capture and the new resolve path
is also enabled for capture too. This should allow dumping some
multisampled images in the trimming state setup block that were not
possible to dump before

* Address Claude's review comments

* Address code review comments

* Update test_suite.ref
MSVC emits a warning when building gfxr-consumer-library because
PageStatusTracker::SetAllBlocksActiveWrite() calls std::fill with the
integer literal 1, which gets deduced as int and then narrowed to the
vector's element type uint8_t.
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
bradgrantham-lunarg and others added 7 commits June 22, 2026 20:57
* Tighten wording around capture of API calls

* Clarify "api call" statement
This is a first pass at making Vulkan encode support optional by adding
a GFXRECON_ENABLE_VULKAN cmake option.
…2` (LunarG#3036)

* Fix crash in `VulkanReplayConsumerBase::OverrideCmdBindDescriptorSets2`

The function wrongly assumes that it can be called only after a call
to `vkCmdBindPipeline`

Change-Id: If5b8279a43b5a9e4cd1f3902632b946f91270133

* Move ShaderStageFlagsToPipelineBindPoints into graphics/vulkan_util

- relocate helper from decode/vulkan_replay_dump_resources_common to graphics::vulkan_util
- update call site in vulkan_replay_dump_resources.cpp with graphics:: qualifier
- refactoring, no behavior change

* Fix wrong pipeline selection in OverrideCmdBindDescriptorSets2

- derive pipeline bind points from VkBindDescriptorSetsInfo::stageFlags instead
  of bound_pipelines.begin()->first
- process every applicable bind point (compute was silently skipped when a
  graphics pipeline was also bound)
- per-bind-point bound check replaces the empty() guard and fixes the crash when
  no pipeline is bound yet

---------

Co-authored-by: Fabian Schmidt <fabian@lunarg.com>
* Frame looping: alloc/free of handle resources

Also manual implementation of frame looping for a
couple of additional functions

* Restructure if stmts for clearer code, changed a var name

* Several minor changes

- Changed VulkanReplayFrameLoopConsumer::Process_vkUnmapMemory to use
  same logic as generated functions

- Check for null pointers in generated functions

- Use "platform_type" rather than "Vulkan" in replay consumer function
  call names

- Moved some functions to list of funcs that allocate multiple handles

* Use contains() for sets

* Removed funcs inMappedLoopMemory and inAllocatedLoopResources

Replaced with mappedLoopMemory.contains() and allocatedLoopResources().contains()

* Fix frame looping handle retrieveal in multi-handle allocators

* Fix another handle retrieveal in multi-handle allocators, correct overrides list
Add the following cmake options for more control over which
platform-specific features are built:

- GFXRECON_ENABLE_USERFAULTFD
- GFXRECON_PLATFORM_SUPPORTS_GETTID
- GFXRECON_PLATFORM_SUPPORTS_TGKILL

This change also fixes builds without zlib.
Co-authored-by: Locke Lin <47329816+locke-lunarg@users.noreply.github.com>
Sync android-graphics/gfxreconstruct with LunarG/gfxreconstruct upstream/dev. This adds missing commits including frame looping descriptor and fence updates.

TAG=agy

CONV=a0864ce4-0126-408e-ad0b-5302cffe1ff3
@google-cla

google-cla Bot commented Jun 24, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@olehkuznetsov olehkuznetsov merged commit 5202c3b into android-graphics:dev Jun 24, 2026
15 of 16 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.