Skip to content

Commit

Permalink
Fixes a crash on replaying a fastforwarded trace
Browse files Browse the repository at this point in the history
If acceleration structure is updated with template, the pNext was not filled, as it is not used for update with template. The state recreation, however, uses ordinary descriptor update call, so pNext must be filled. This changes creates relevant struct and copies it's contents to pNext for state recreation.

Change-Id: If42324ff887db6d591b55c10072f5f5ad81d6f2e
  • Loading branch information
naomipappe committed Dec 4, 2023
1 parent e3f0197 commit 7a5681d
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions framework/encode/vulkan_state_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,12 +1080,23 @@ void VulkanStateTracker::TrackUpdateDescriptorSetWithTemplate(VkDescriptorSet

for (uint32_t i = 0; i < current_writes; ++i)
{
auto accel_struct = reinterpret_cast<const VkAccelerationStructureKHR*>(src_address);
dst_view_ids[i] = GetWrappedId<AccelerationStructureKHRWrapper>(*accel_struct);
dst_info[i] = *accel_struct;
const auto* accel_struct = reinterpret_cast<const VkAccelerationStructureKHR*>(src_address);
dst_view_ids[i] = GetWrappedId<AccelerationStructureKHRWrapper>(*accel_struct);
dst_info[i] = *accel_struct;

src_address += entry.stride;
}
// Because UpdateWithTemplate does not require pNext to update acceleration structures
// but state recreation uses UpdateDescriptorSets which does require pNext to update acceleration
// structures we create a relevant pNext
const VkWriteDescriptorSetAccelerationStructureKHR p_next{
VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR,
nullptr,
current_writes,
binding.acceleration_structures.get()
};

binding.write_pnext = TrackStruct(&p_next, &binding.write_pnext_memory);

// Check for consecutive update.
if (current_count == current_writes)
Expand Down

0 comments on commit 7a5681d

Please sign in to comment.