summaryrefslogtreecommitdiff
path: root/tools/gfx/vulkan/vk-device-queue.h
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2021-02-24 15:43:43 -0800
committerGitHub <noreply@github.com>2021-02-24 15:43:43 -0800
commit9b7a007c31072bc9aebd1134aa4f1bfd28a4c541 (patch)
treeb71a48eb30b3b09ab4e77e40dc1c68ecd854ef82 /tools/gfx/vulkan/vk-device-queue.h
parentd66b30729029bdb43892e05c9c80fd56ac95a24f (diff)
Explicit swapchain interface in `gfx`. (#1726)
* Explicit swapchain interface in `gfx`. * Correctly return nullptr when `IRenderer` creation failed. * Fix crashes on CUDA tests. * Cleanups.
Diffstat (limited to 'tools/gfx/vulkan/vk-device-queue.h')
-rw-r--r--tools/gfx/vulkan/vk-device-queue.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/tools/gfx/vulkan/vk-device-queue.h b/tools/gfx/vulkan/vk-device-queue.h
index cd53b6b9d..9869a3caf 100644
--- a/tools/gfx/vulkan/vk-device-queue.h
+++ b/tools/gfx/vulkan/vk-device-queue.h
@@ -2,6 +2,7 @@
#pragma once
#include "vk-api.h"
+#include "vk-descriptor-allocator.h"
namespace gfx {
@@ -35,6 +36,7 @@ struct VulkanDeviceQueue
/// Make the specified event 'current' - meaning it's semaphore must be waited on
VkSemaphore makeCurrent(EventType eventType);
+ VkSemaphore getSemaphore(EventType eventType);
/// Makes the event no longer required to be waited on
void makeCompleted(EventType eventType);
/// Returns true if the event is already current
@@ -43,6 +45,11 @@ struct VulkanDeviceQueue
/// Get the command buffer
VkCommandBuffer getCommandBuffer() const { return m_commandBuffer; }
+ VulkanDescriptorSet allocTransientDescriptorSet(VkDescriptorSetLayout layout)
+ {
+ return m_descSetAllocator[m_commandBufferIndex].allocate(layout);
+ }
+
/// Get the queue
VkQueue getQueue() const { return m_queue; }
@@ -76,19 +83,21 @@ struct VulkanDeviceQueue
VkQueue m_queue = VK_NULL_HANDLE;
- VkCommandPool m_commandPool = VK_NULL_HANDLE;
int m_numCommandBuffers = 0;
int m_commandBufferIndex = 0;
// There are the same amount of command buffers as fences
+ VkCommandPool m_commandPools[kMaxCommandBuffers] = {VK_NULL_HANDLE};
VkCommandBuffer m_commandBuffers[kMaxCommandBuffers] = { VK_NULL_HANDLE };
Fence m_fences[kMaxCommandBuffers] = { {VK_NULL_HANDLE, 0, 0u} };
VkCommandBuffer m_commandBuffer = VK_NULL_HANDLE;
-
+ VkCommandPool m_commandPool = VK_NULL_HANDLE;
VkSemaphore m_semaphores[int(EventType::CountOf)];
VkSemaphore m_currentSemaphores[int(EventType::CountOf)];
+ DescriptorSetAllocator m_descSetAllocator[kMaxCommandBuffers];
+
uint64_t m_lastFenceCompleted = 1;
uint64_t m_nextFenceValue = 2;