VulkanRenderer: Replace ObjectHandle by std::shared_ptr/raw pointers
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Nz
|
||||
bool BindBufferMemory(VkDeviceMemory memory, VkDeviceSize offset = 0);
|
||||
|
||||
using DeviceObject::Create;
|
||||
inline bool Create(const DeviceHandle& device, VkBufferCreateFlags flags, VkDeviceSize size, VkBufferUsageFlags usage, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, VkBufferCreateFlags flags, VkDeviceSize size, VkBufferUsageFlags usage, const VkAllocationCallbacks* allocator = nullptr);
|
||||
|
||||
VkMemoryRequirements GetMemoryRequirements() const;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Nz
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool Buffer::Create(const DeviceHandle& device, VkBufferCreateFlags flags, VkDeviceSize size, VkBufferUsageFlags usage, const VkAllocationCallbacks* allocator)
|
||||
inline bool Buffer::Create(DeviceHandle device, VkBufferCreateFlags flags, VkDeviceSize size, VkBufferUsageFlags usage, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
VkBufferCreateInfo createInfo = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO, // VkStructureType sType;
|
||||
@@ -34,7 +34,7 @@ namespace Nz
|
||||
nullptr // const uint32_t* pQueueFamilyIndices;
|
||||
};
|
||||
|
||||
return Create(device, createInfo, allocator);
|
||||
return Create(std::move(device), createInfo, allocator);
|
||||
}
|
||||
|
||||
inline VkMemoryRequirements Buffer::GetMemoryRequirements() const
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace Nz
|
||||
private:
|
||||
inline CommandBuffer(CommandPool& pool, VkCommandBuffer handle);
|
||||
|
||||
CommandPoolHandle m_pool;
|
||||
CommandPool* m_pool;
|
||||
VkAllocationCallbacks m_allocator;
|
||||
VkCommandBuffer m_handle;
|
||||
VkResult m_lastErrorCode;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/VulkanRenderer/Wrapper/CommandBuffer.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
|
||||
#include <cassert>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -12,7 +13,7 @@ namespace Nz
|
||||
namespace Vk
|
||||
{
|
||||
inline CommandBuffer::CommandBuffer() :
|
||||
m_pool(),
|
||||
m_pool(nullptr),
|
||||
m_handle(VK_NULL_HANDLE)
|
||||
{
|
||||
}
|
||||
@@ -24,7 +25,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
inline CommandBuffer::CommandBuffer(CommandBuffer&& commandBuffer) :
|
||||
m_pool(std::move(commandBuffer.m_pool)),
|
||||
m_pool(commandBuffer.m_pool),
|
||||
m_allocator(commandBuffer.m_allocator),
|
||||
m_handle(commandBuffer.m_handle),
|
||||
m_lastErrorCode(commandBuffer.m_lastErrorCode)
|
||||
@@ -223,7 +224,10 @@ namespace Nz
|
||||
inline void CommandBuffer::Free()
|
||||
{
|
||||
if (m_handle)
|
||||
{
|
||||
assert(m_pool);
|
||||
m_pool->GetDevice()->vkFreeCommandBuffers(*m_pool->GetDevice(), *m_pool, 1, &m_handle);
|
||||
}
|
||||
}
|
||||
|
||||
inline void CommandBuffer::PipelineBarrier(VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, const VkImageMemoryBarrier& imageMemoryBarrier)
|
||||
@@ -401,7 +405,7 @@ namespace Nz
|
||||
m_allocator = commandBuffer.m_allocator;
|
||||
m_handle = commandBuffer.m_handle;
|
||||
m_lastErrorCode = commandBuffer.m_lastErrorCode;
|
||||
m_pool = std::move(commandBuffer.m_pool);
|
||||
m_pool = commandBuffer.m_pool;
|
||||
m_handle = commandBuffer.m_handle;
|
||||
|
||||
commandBuffer.m_handle = VK_NULL_HANDLE;
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#define NAZARA_VULKANRENDERER_VKCOMMANDPOOL_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/HandledObject.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/DeviceObject.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -16,11 +15,8 @@ namespace Nz
|
||||
namespace Vk
|
||||
{
|
||||
class CommandBuffer;
|
||||
class CommandPool;
|
||||
|
||||
using CommandPoolHandle = ObjectHandle<CommandPool>;
|
||||
|
||||
class NAZARA_VULKANRENDERER_API CommandPool : public DeviceObject<CommandPool, VkCommandPool, VkCommandPoolCreateInfo>, public HandledObject<CommandPool>
|
||||
class NAZARA_VULKANRENDERER_API CommandPool : public DeviceObject<CommandPool, VkCommandPool, VkCommandPoolCreateInfo>
|
||||
{
|
||||
friend DeviceObject;
|
||||
|
||||
@@ -34,7 +30,7 @@ namespace Nz
|
||||
std::vector<CommandBuffer> AllocateCommandBuffers(UInt32 commandBufferCount, VkCommandBufferLevel level);
|
||||
|
||||
using DeviceObject::Create;
|
||||
inline bool Create(const DeviceHandle& device, UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
|
||||
inline bool Reset(VkCommandPoolResetFlags flags);
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
inline bool CommandPool::Create(const DeviceHandle& device, UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
inline bool CommandPool::Create(DeviceHandle device, UInt32 queueFamilyIndex, VkCommandPoolCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
VkCommandPoolCreateInfo createInfo =
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace Nz
|
||||
queueFamilyIndex
|
||||
};
|
||||
|
||||
return Create(device, createInfo, allocator);
|
||||
return Create(std::move(device), createInfo, allocator);
|
||||
}
|
||||
|
||||
inline bool CommandPool::Reset(VkCommandPoolResetFlags flags)
|
||||
|
||||
@@ -8,19 +8,15 @@
|
||||
#define NAZARA_VULKANRENDERER_VKDESCRIPTORPOOL_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/HandledObject.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/DeviceObject.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
class DescriptorPool;
|
||||
class DescriptorSet;
|
||||
|
||||
using DescriptorPoolHandle = ObjectHandle<DescriptorPool>;
|
||||
|
||||
class NAZARA_VULKANRENDERER_API DescriptorPool : public DeviceObject<DescriptorPool, VkDescriptorPool, VkDescriptorPoolCreateInfo>, public HandledObject<DescriptorPool>
|
||||
class NAZARA_VULKANRENDERER_API DescriptorPool : public DeviceObject<DescriptorPool, VkDescriptorPool, VkDescriptorPoolCreateInfo>
|
||||
{
|
||||
friend DeviceObject;
|
||||
|
||||
@@ -34,8 +30,8 @@ namespace Nz
|
||||
std::vector<DescriptorSet> AllocateDescriptorSets(UInt32 descriptorSetCount, const VkDescriptorSetLayout* setLayouts);
|
||||
|
||||
using DeviceObject::Create;
|
||||
inline bool Create(const DeviceHandle& device, UInt32 maxSets, const VkDescriptorPoolSize& poolSize, VkDescriptorPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(const DeviceHandle& device, UInt32 maxSets, UInt32 poolSizeCount, const VkDescriptorPoolSize* poolSize, VkDescriptorPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, UInt32 maxSets, const VkDescriptorPoolSize& poolSize, VkDescriptorPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, UInt32 maxSets, UInt32 poolSizeCount, const VkDescriptorPoolSize* poolSize, VkDescriptorPoolCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
|
||||
DescriptorPool& operator=(const DescriptorPool&) = delete;
|
||||
DescriptorPool& operator=(DescriptorPool&&) = delete;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
inline bool DescriptorPool::Create(const DeviceHandle& device, UInt32 maxSets, const VkDescriptorPoolSize& poolSize, VkDescriptorPoolCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
inline bool DescriptorPool::Create(DeviceHandle device, UInt32 maxSets, const VkDescriptorPoolSize& poolSize, VkDescriptorPoolCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
VkDescriptorPoolCreateInfo createInfo =
|
||||
{
|
||||
@@ -21,10 +21,10 @@ namespace Nz
|
||||
&poolSize // const VkDescriptorPoolSize* pPoolSizes;
|
||||
};
|
||||
|
||||
return Create(device, createInfo, allocator);
|
||||
return Create(std::move(device), createInfo, allocator);
|
||||
}
|
||||
|
||||
inline bool DescriptorPool::Create(const DeviceHandle& device, UInt32 maxSets, UInt32 poolSizeCount, const VkDescriptorPoolSize* poolSize, VkDescriptorPoolCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
inline bool DescriptorPool::Create(DeviceHandle device, UInt32 maxSets, UInt32 poolSizeCount, const VkDescriptorPoolSize* poolSize, VkDescriptorPoolCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
VkDescriptorPoolCreateInfo createInfo =
|
||||
{
|
||||
@@ -36,7 +36,7 @@ namespace Nz
|
||||
poolSize // const VkDescriptorPoolSize* pPoolSizes;
|
||||
};
|
||||
|
||||
return Create(device, createInfo, allocator);
|
||||
return Create(std::move(device), createInfo, allocator);
|
||||
}
|
||||
|
||||
inline VkResult DescriptorPool::CreateHelper(const DeviceHandle& device, const VkDescriptorPoolCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkDescriptorPool* handle)
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace Nz
|
||||
private:
|
||||
inline DescriptorSet(DescriptorPool& pool, VkDescriptorSet handle);
|
||||
|
||||
DescriptorPoolHandle m_pool;
|
||||
DescriptorPool* m_pool;
|
||||
VkAllocationCallbacks m_allocator;
|
||||
VkDescriptorSet m_handle;
|
||||
VkResult m_lastErrorCode;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <Nazara/VulkanRenderer/Wrapper/DescriptorSet.hpp>
|
||||
#include <Nazara/Core/Error.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Instance.hpp>
|
||||
#include <cassert>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
@@ -12,7 +13,7 @@ namespace Nz
|
||||
namespace Vk
|
||||
{
|
||||
inline DescriptorSet::DescriptorSet() :
|
||||
m_pool(),
|
||||
m_pool(nullptr),
|
||||
m_handle(VK_NULL_HANDLE)
|
||||
{
|
||||
}
|
||||
@@ -24,7 +25,7 @@ namespace Nz
|
||||
}
|
||||
|
||||
inline DescriptorSet::DescriptorSet(DescriptorSet&& descriptorSet) :
|
||||
m_pool(std::move(descriptorSet.m_pool)),
|
||||
m_pool(descriptorSet.m_pool),
|
||||
m_allocator(descriptorSet.m_allocator),
|
||||
m_handle(descriptorSet.m_handle),
|
||||
m_lastErrorCode(descriptorSet.m_lastErrorCode)
|
||||
@@ -40,7 +41,10 @@ namespace Nz
|
||||
inline void DescriptorSet::Free()
|
||||
{
|
||||
if (m_handle)
|
||||
{
|
||||
assert(m_pool);
|
||||
m_pool->GetDevice()->vkFreeDescriptorSets(*m_pool->GetDevice(), *m_pool, 1, &m_handle);
|
||||
}
|
||||
}
|
||||
|
||||
inline VkResult DescriptorSet::GetLastErrorCode() const
|
||||
@@ -104,7 +108,7 @@ namespace Nz
|
||||
m_allocator = descriptorSet.m_allocator;
|
||||
m_handle = descriptorSet.m_handle;
|
||||
m_lastErrorCode = descriptorSet.m_lastErrorCode;
|
||||
m_pool = std::move(descriptorSet.m_pool);
|
||||
m_pool = descriptorSet.m_pool;
|
||||
m_handle = descriptorSet.m_handle;
|
||||
|
||||
descriptorSet.m_handle = VK_NULL_HANDLE;
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Nz
|
||||
~DescriptorSetLayout() = default;
|
||||
|
||||
using DeviceObject::Create;
|
||||
inline bool Create(const DeviceHandle& device, const VkDescriptorSetLayoutBinding& binding, VkDescriptorSetLayoutCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(const DeviceHandle& device, UInt32 bindingCount, const VkDescriptorSetLayoutBinding* binding, VkDescriptorSetLayoutCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, const VkDescriptorSetLayoutBinding& binding, VkDescriptorSetLayoutCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, UInt32 bindingCount, const VkDescriptorSetLayoutBinding* binding, VkDescriptorSetLayoutCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
|
||||
DescriptorSetLayout& operator=(const DescriptorSetLayout&) = delete;
|
||||
DescriptorSetLayout& operator=(DescriptorSetLayout&&) = delete;
|
||||
|
||||
@@ -9,12 +9,12 @@ namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
inline bool DescriptorSetLayout::Create(const DeviceHandle& device, const VkDescriptorSetLayoutBinding& binding, VkDescriptorSetLayoutCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
inline bool DescriptorSetLayout::Create(DeviceHandle device, const VkDescriptorSetLayoutBinding& binding, VkDescriptorSetLayoutCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
return Create(device, 1U, &binding, flags, allocator);
|
||||
return Create(std::move(device), 1U, &binding, flags, allocator);
|
||||
}
|
||||
|
||||
inline bool DescriptorSetLayout::Create(const DeviceHandle& device, UInt32 bindingCount, const VkDescriptorSetLayoutBinding* binding, VkDescriptorSetLayoutCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
inline bool DescriptorSetLayout::Create(DeviceHandle device, UInt32 bindingCount, const VkDescriptorSetLayoutBinding* binding, VkDescriptorSetLayoutCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
VkDescriptorSetLayoutCreateInfo createInfo =
|
||||
{
|
||||
@@ -25,7 +25,7 @@ namespace Nz
|
||||
binding // const VkDescriptorSetLayoutBinding* pBindings;
|
||||
};
|
||||
|
||||
return Create(device, createInfo, allocator);
|
||||
return Create(std::move(device), createInfo, allocator);
|
||||
}
|
||||
|
||||
inline VkResult DescriptorSetLayout::CreateHelper(const DeviceHandle& device, const VkDescriptorSetLayoutCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkDescriptorSetLayout* handle)
|
||||
|
||||
@@ -8,11 +8,10 @@
|
||||
#define NAZARA_VULKANRENDERER_VKDEVICE_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Core/HandledObject.hpp>
|
||||
#include <Nazara/Core/ObjectHandle.hpp>
|
||||
#include <Nazara/VulkanRenderer/Config.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <memory>
|
||||
#include <unordered_set>
|
||||
|
||||
namespace Nz
|
||||
@@ -23,9 +22,9 @@ namespace Nz
|
||||
class Instance;
|
||||
class Queue;
|
||||
|
||||
using DeviceHandle = ObjectHandle<Device>;
|
||||
using DeviceHandle = std::shared_ptr<Device>;
|
||||
|
||||
class NAZARA_VULKANRENDERER_API Device : public HandledObject<Device>
|
||||
class NAZARA_VULKANRENDERER_API Device : public std::enable_shared_from_this<Device>
|
||||
{
|
||||
public:
|
||||
struct QueueFamilyInfo;
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Nz
|
||||
~DeviceMemory() = default;
|
||||
|
||||
using DeviceObject::Create;
|
||||
inline bool Create(const DeviceHandle& device, VkDeviceSize size, UInt32 memoryType, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(const DeviceHandle& device, VkDeviceSize size, UInt32 typeBits, VkFlags properties, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, VkDeviceSize size, UInt32 memoryType, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, VkDeviceSize size, UInt32 typeBits, VkFlags properties, const VkAllocationCallbacks* allocator = nullptr);
|
||||
|
||||
inline void* GetMappedPointer();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Nz
|
||||
memory.m_mappedPtr = nullptr;
|
||||
}
|
||||
|
||||
inline bool DeviceMemory::Create(const DeviceHandle& device, VkDeviceSize size, UInt32 memoryType, const VkAllocationCallbacks* allocator)
|
||||
inline bool DeviceMemory::Create(DeviceHandle device, VkDeviceSize size, UInt32 memoryType, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
VkMemoryAllocateInfo allocInfo =
|
||||
{
|
||||
@@ -34,10 +34,10 @@ namespace Nz
|
||||
memoryType // uint32_t memoryTypeIndex;
|
||||
};
|
||||
|
||||
return Create(device, allocInfo, allocator);
|
||||
return Create(std::move(device), allocInfo, allocator);
|
||||
}
|
||||
|
||||
inline bool DeviceMemory::Create(const DeviceHandle& device, VkDeviceSize size, UInt32 typeBits, VkFlags properties, const VkAllocationCallbacks* allocator)
|
||||
inline bool DeviceMemory::Create(DeviceHandle device, VkDeviceSize size, UInt32 typeBits, VkFlags properties, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
const Vk::PhysicalDevice& deviceInfo = Vulkan::GetPhysicalDeviceInfo(device->GetPhysicalDevice());
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Nz
|
||||
if (typeBits & typeMask)
|
||||
{
|
||||
if ((deviceInfo.memoryProperties.memoryTypes[i].propertyFlags & properties) == properties)
|
||||
return Create(device, size, i, allocator);
|
||||
return Create(std::move(device), size, i, allocator);
|
||||
}
|
||||
|
||||
typeMask <<= 1;
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace Nz
|
||||
inline DeviceObject(DeviceObject&& object);
|
||||
inline ~DeviceObject();
|
||||
|
||||
inline bool Create(const DeviceHandle& device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline void Destroy();
|
||||
|
||||
inline bool IsValid() const;
|
||||
|
||||
@@ -36,9 +36,9 @@ namespace Nz
|
||||
}
|
||||
|
||||
template<typename C, typename VkType, typename CreateInfo>
|
||||
inline bool DeviceObject<C, VkType, CreateInfo>::Create(const DeviceHandle& device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator)
|
||||
inline bool DeviceObject<C, VkType, CreateInfo>::Create(DeviceHandle device, const CreateInfo& createInfo, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
m_device = device;
|
||||
m_device = std::move(device);
|
||||
m_lastErrorCode = C::CreateHelper(m_device, &createInfo, allocator, &m_handle);
|
||||
if (m_lastErrorCode != VkResult::VK_SUCCESS)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Nz
|
||||
inline operator VkPipeline() const;
|
||||
|
||||
protected:
|
||||
inline bool Create(const DeviceHandle& device, VkResult result, const VkAllocationCallbacks* allocator);
|
||||
inline bool Create(DeviceHandle device, VkResult result, const VkAllocationCallbacks* allocator);
|
||||
|
||||
DeviceHandle m_device;
|
||||
VkAllocationCallbacks m_allocator;
|
||||
|
||||
@@ -31,12 +31,12 @@ namespace Nz
|
||||
|
||||
inline bool Pipeline::CreateCompute(const DeviceHandle& device, const VkComputePipelineCreateInfo& createInfo, VkPipelineCache cache, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
return Create(device, device->vkCreateComputePipelines(*device, cache, 1U, &createInfo, allocator, &m_handle), allocator);
|
||||
return Create(std::move(device), device->vkCreateComputePipelines(*device, cache, 1U, &createInfo, allocator, &m_handle), allocator);
|
||||
}
|
||||
|
||||
inline bool Pipeline::CreateGraphics(const DeviceHandle& device, const VkGraphicsPipelineCreateInfo& createInfo, VkPipelineCache cache, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
return Create(device, device->vkCreateGraphicsPipelines(*device, cache, 1U, &createInfo, allocator, &m_handle), allocator);
|
||||
return Create(std::move(device), device->vkCreateGraphicsPipelines(*device, cache, 1U, &createInfo, allocator, &m_handle), allocator);
|
||||
}
|
||||
|
||||
inline void Pipeline::Destroy()
|
||||
@@ -63,7 +63,7 @@ namespace Nz
|
||||
return m_handle;
|
||||
}
|
||||
|
||||
inline bool Pipeline::Create(const DeviceHandle& device, VkResult result, const VkAllocationCallbacks* allocator)
|
||||
inline bool Pipeline::Create(DeviceHandle device, VkResult result, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
m_device = device;
|
||||
m_lastErrorCode = result;
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Nz
|
||||
~Semaphore() = default;
|
||||
|
||||
using DeviceObject::Create;
|
||||
inline bool Create(const DeviceHandle& device, VkSemaphoreCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, VkSemaphoreCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
|
||||
Semaphore& operator=(const Semaphore&) = delete;
|
||||
Semaphore& operator=(Semaphore&&) = delete;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
inline bool Semaphore::Create(const DeviceHandle& device, VkSemaphoreCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
inline bool Semaphore::Create(DeviceHandle device, VkSemaphoreCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
VkSemaphoreCreateInfo createInfo =
|
||||
{
|
||||
@@ -18,7 +18,7 @@ namespace Nz
|
||||
flags
|
||||
};
|
||||
|
||||
return Create(device, createInfo, allocator);
|
||||
return Create(std::move(device), createInfo, allocator);
|
||||
}
|
||||
|
||||
inline VkResult Semaphore::CreateHelper(const DeviceHandle& device, const VkSemaphoreCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkSemaphore* handle)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Nz
|
||||
~ShaderModule() = default;
|
||||
|
||||
using DeviceObject::Create;
|
||||
inline bool Create(const DeviceHandle& device, const UInt32* code, std::size_t size, VkShaderModuleCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, const UInt32* code, std::size_t size, VkShaderModuleCreateFlags flags = 0, const VkAllocationCallbacks* allocator = nullptr);
|
||||
|
||||
ShaderModule& operator=(const ShaderModule&) = delete;
|
||||
ShaderModule& operator=(ShaderModule&&) = delete;
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Nz
|
||||
{
|
||||
namespace Vk
|
||||
{
|
||||
inline bool ShaderModule::Create(const DeviceHandle& device, const UInt32* code, std::size_t size, VkShaderModuleCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
inline bool ShaderModule::Create(DeviceHandle device, const UInt32* code, std::size_t size, VkShaderModuleCreateFlags flags, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
VkShaderModuleCreateInfo createInfo =
|
||||
{
|
||||
@@ -20,7 +20,7 @@ namespace Nz
|
||||
code
|
||||
};
|
||||
|
||||
return Create(device, createInfo, allocator);
|
||||
return Create(std::move(device), createInfo, allocator);
|
||||
}
|
||||
|
||||
inline VkResult ShaderModule::CreateHelper(const DeviceHandle& device, const VkShaderModuleCreateInfo* createInfo, const VkAllocationCallbacks* allocator, VkShaderModule* handle)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Nz
|
||||
|
||||
inline bool AcquireNextImage(Nz::UInt64 timeout, VkSemaphore semaphore, VkFence fence, UInt32* imageIndex) const;
|
||||
|
||||
inline bool Create(const DeviceHandle& device, const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
||||
inline bool Create(DeviceHandle device, const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator = nullptr);
|
||||
|
||||
inline const Buffer& GetBuffer(UInt32 index) const;
|
||||
inline const std::vector<Buffer>& GetBuffers() const;
|
||||
|
||||
@@ -29,9 +29,9 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
|
||||
inline bool Swapchain::Create(const DeviceHandle& device, const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator)
|
||||
inline bool Swapchain::Create(DeviceHandle device, const VkSwapchainCreateInfoKHR& createInfo, const VkAllocationCallbacks* allocator)
|
||||
{
|
||||
if (!DeviceObject::Create(device, createInfo, allocator))
|
||||
if (!DeviceObject::Create(std::move(device), createInfo, allocator))
|
||||
return false;
|
||||
|
||||
UInt32 imageCount = 0;
|
||||
|
||||
Reference in New Issue
Block a user