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: Ibc63fa4b910157479b9d4f8eee25468fcf9e33bb
  • Loading branch information
naomipappe committed Nov 28, 2023
1 parent be08673 commit ae41810
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 @@ -1119,12 +1119,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 ae41810

Please sign in to comment.