Add command buffers (WIP)
This commit is contained in:
@@ -55,7 +55,7 @@ namespace Nz
|
||||
inline void ClearDepthStencilImage(VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue& depthStencil, const VkImageSubresourceRange& range);
|
||||
inline void ClearDepthStencilImage(VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue& depthStencil, UInt32 rangeCount, const VkImageSubresourceRange* ranges);
|
||||
|
||||
inline void CopyBuffer(VkBuffer source, VkBuffer target, UInt32 size, UInt32 sourceOffset = 0, UInt32 targetOffset = 0);
|
||||
inline void CopyBuffer(VkBuffer source, VkBuffer target, UInt64 size, UInt64 sourceOffset = 0, UInt64 targetOffset = 0);
|
||||
inline void CopyBufferToImage(VkBuffer source, VkImage target, VkImageLayout targetLayout, UInt32 width, UInt32 height, UInt32 depth = 1);
|
||||
|
||||
inline void Draw(UInt32 vertexCount, UInt32 instanceCount = 1, UInt32 firstVertex = 0, UInt32 firstInstance = 0);
|
||||
@@ -68,6 +68,8 @@ namespace Nz
|
||||
|
||||
inline void Free();
|
||||
|
||||
inline CommandPool& GetPool();
|
||||
|
||||
inline void InsertDebugLabel(const char* label);
|
||||
inline void InsertDebugLabel(const char* label, Nz::Color color);
|
||||
|
||||
|
||||
@@ -216,7 +216,7 @@ namespace Nz
|
||||
return m_pool->GetDevice()->vkCmdClearDepthStencilImage(m_handle, image, imageLayout, &depthStencil, rangeCount, ranges);
|
||||
}
|
||||
|
||||
inline void CommandBuffer::CopyBuffer(VkBuffer source, VkBuffer target, UInt32 size, UInt32 sourceOffset, UInt32 targetOffset)
|
||||
inline void CommandBuffer::CopyBuffer(VkBuffer source, VkBuffer target, UInt64 size, UInt64 sourceOffset, UInt64 targetOffset)
|
||||
{
|
||||
VkBufferCopy region;
|
||||
region.dstOffset = targetOffset;
|
||||
@@ -292,6 +292,11 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
inline CommandPool& CommandBuffer::GetPool()
|
||||
{
|
||||
return *m_pool;
|
||||
}
|
||||
|
||||
inline void CommandBuffer::InsertDebugLabel(const char* label)
|
||||
{
|
||||
Vk::Device* device = m_pool->GetDevice();
|
||||
|
||||
@@ -20,13 +20,14 @@ namespace Nz
|
||||
{
|
||||
public:
|
||||
inline QueueHandle();
|
||||
inline QueueHandle(Device& device, VkQueue queue);
|
||||
inline QueueHandle(Device& device, VkQueue queue, UInt32 queueFamilyIndex);
|
||||
QueueHandle(const QueueHandle& queue) = delete;
|
||||
QueueHandle(QueueHandle&& queue) noexcept = default;
|
||||
~QueueHandle() = default;
|
||||
|
||||
inline Device& GetDevice() const;
|
||||
inline VkResult GetLastErrorCode() const;
|
||||
inline UInt32 GetQueueFamilyIndex() const;
|
||||
|
||||
inline bool Present(const VkPresentInfoKHR& presentInfo) const;
|
||||
inline bool Present(VkSwapchainKHR swapchain, UInt32 imageIndex, VkSemaphore waitSemaphore = VK_NULL_HANDLE) const;
|
||||
@@ -51,6 +52,7 @@ namespace Nz
|
||||
MovablePtr<Device> m_device;
|
||||
VkQueue m_handle;
|
||||
mutable VkResult m_lastErrorCode;
|
||||
UInt32 m_queueFamilyIndex;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,10 +18,11 @@ namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
inline QueueHandle::QueueHandle(Device& device, VkQueue queue) :
|
||||
inline QueueHandle::QueueHandle(Device& device, VkQueue queue, UInt32 queueFamilyIndex) :
|
||||
m_device(&device),
|
||||
m_handle(queue),
|
||||
m_lastErrorCode(VkResult::VK_SUCCESS)
|
||||
m_lastErrorCode(VkResult::VK_SUCCESS),
|
||||
m_queueFamilyIndex(queueFamilyIndex)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -35,6 +36,11 @@ namespace Nz
|
||||
return m_lastErrorCode;
|
||||
}
|
||||
|
||||
inline UInt32 QueueHandle::GetQueueFamilyIndex() const
|
||||
{
|
||||
return m_queueFamilyIndex;
|
||||
}
|
||||
|
||||
inline bool QueueHandle::Present(const VkPresentInfoKHR& presentInfo) const
|
||||
{
|
||||
m_lastErrorCode = m_device->vkQueuePresentKHR(m_handle, &presentInfo);
|
||||
|
||||
Reference in New Issue
Block a user