Skip to content

Commit

Permalink
use device from QueueInfo or as passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
bradgrantham-lunarg committed Oct 22, 2024
1 parent dcd6a4d commit 28ed423
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
1 change: 0 additions & 1 deletion framework/decode/vulkan_captured_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ VkResult VulkanCapturedSwapchain::CreateSwapchainKHR(VkResult
device = device_info->handle;
}
device_table_ = device_table;
device_ = device;
auto replay_swapchain = swapchain->GetHandlePointer();
return func(device, create_info, allocator, replay_swapchain);
}
Expand Down
1 change: 1 addition & 0 deletions framework/decode/vulkan_object_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ struct DeviceInfo : public VulkanObjectInfo<VkDevice>

struct QueueInfo : public VulkanObjectInfo<VkQueue>
{
VkDevice device;
std::unordered_map<uint32_t, size_t> array_counts;
uint32_t family_index;
uint32_t queue_index;
Expand Down
2 changes: 0 additions & 2 deletions framework/decode/vulkan_offscreen_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,6 @@ VkResult VulkanOffscreenSwapchain::CreateSwapchainKHR(VkResult
VkSwapchainKHR* replay_swapchain = swapchain->GetHandlePointer();
VkDevice device = device_info->handle;

device_ = device;

// Give swapchain a fake handle. It's handle id.
*replay_swapchain = UINT64_TO_VK_HANDLE(VkSwapchainKHR, *id);
if (!AddSwapchainResourceData(*replay_swapchain))
Expand Down
2 changes: 2 additions & 0 deletions framework/decode/vulkan_replay_consumer_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3015,6 +3015,7 @@ void VulkanReplayConsumerBase::OverrideGetDeviceQueue(PFN_vkGetDeviceQueue
// This is necessary for the virtual swapchain to determine which command buffer to use when
// Bliting the images on the Presenting Queue.
auto queue_info = reinterpret_cast<QueueInfo*>(pQueue->GetConsumerData(0));
queue_info->device = device;
queue_info->family_index = queueFamilyIndex;
queue_info->queue_index = queueIndex;
}
Expand All @@ -3038,6 +3039,7 @@ void VulkanReplayConsumerBase::OverrideGetDeviceQueue2(PFN_vkGetDeviceQueue2
// This is necessary for the virtual swapchain to determine which command buffer to use when
// Bliting the images on the Presenting Queue.
auto queue_info = reinterpret_cast<QueueInfo*>(pQueue->GetConsumerData(0));
queue_info->device = device;
queue_info->family_index = in_pQueueInfo->queueFamilyIndex;
queue_info->queue_index = in_pQueueInfo->queueIndex;
}
Expand Down
2 changes: 0 additions & 2 deletions framework/decode/vulkan_swapchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,6 @@ class VulkanSwapchain
const encode::VulkanInstanceTable* instance_table_{ nullptr };
const encode::VulkanDeviceTable* device_table_{ nullptr };

VkDevice device_{ VK_NULL_HANDLE };

application::Application* application_{ nullptr };
ActiveWindows active_windows_;
int32_t create_surface_count_{ 0 };
Expand Down
10 changes: 5 additions & 5 deletions framework/decode/vulkan_virtual_swapchain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ VkResult VulkanVirtualSwapchain::CreateSwapchainKHR(VkResult
device = device_info->handle;
}
device_table_ = device_table;
device_ = device;
VkPhysicalDevice physical_device = device_info->parent;

VkSwapchainCreateInfoKHR modified_create_info = *create_info;
Expand Down Expand Up @@ -463,12 +462,12 @@ VkResult VulkanVirtualSwapchain::CreateSwapchainResourceData(const DeviceInfo*
auto command_buffer = swapchain_resources->copy_cmd_data[copy_queue_family_index].command_buffers[0];
auto copy_fence = swapchain_resources->copy_cmd_data[copy_queue_family_index].fences[0];

result = device_table_->WaitForFences(device_, 1, &copy_fence, VK_TRUE, ~0UL);
result = device_table_->WaitForFences(device, 1, &copy_fence, VK_TRUE, ~0UL);
if (result != VK_SUCCESS)
{
return result;
}
result = device_table_->ResetFences(device_, 1, &copy_fence);
result = device_table_->ResetFences(device, 1, &copy_fence);
if (result != VK_SUCCESS)
{
return result;
Expand Down Expand Up @@ -714,6 +713,7 @@ VkResult VulkanVirtualSwapchain::QueuePresentKHR(VkResult
return func(queue_info->handle, present_info);
}

VkDevice device = queue_info->device;
VkQueue queue = queue_info->handle;
uint32_t queue_family_index = queue_info->family_index;

Expand Down Expand Up @@ -831,12 +831,12 @@ VkResult VulkanVirtualSwapchain::QueuePresentKHR(VkResult
present_wait_semaphores.emplace_back(copy_semaphore);
}

result = device_table_->WaitForFences(device_, 1, &copy_fence, VK_TRUE, ~0UL);
result = device_table_->WaitForFences(device, 1, &copy_fence, VK_TRUE, ~0UL);
if (result != VK_SUCCESS)
{
return result;
}
result = device_table_->ResetFences(device_, 1, &copy_fence);
result = device_table_->ResetFences(device, 1, &copy_fence);
if (result != VK_SUCCESS)
{
return result;
Expand Down

0 comments on commit 28ed423

Please sign in to comment.