Add ShaderBinding
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
|
||||
#include <Nazara/VulkanRenderer/Config.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanShaderBinding.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/DescriptorPool.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/DescriptorSet.hpp>
|
||||
@@ -25,10 +26,12 @@ namespace Nz
|
||||
VulkanRenderPipelineLayout() = default;
|
||||
~VulkanRenderPipelineLayout() = default;
|
||||
|
||||
Vk::DescriptorSet AllocateDescriptorSet();
|
||||
VulkanShaderBinding& AllocateShaderBinding() override;
|
||||
|
||||
bool Create(Vk::Device& device, RenderPipelineLayoutInfo layoutInfo);
|
||||
|
||||
inline Vk::Device* GetDevice() const;
|
||||
|
||||
inline const Vk::DescriptorSetLayout& GetDescriptorSetLayout() const;
|
||||
inline const Vk::PipelineLayout& GetPipelineLayout() const;
|
||||
|
||||
@@ -36,6 +39,7 @@ namespace Nz
|
||||
struct DescriptorPool
|
||||
{
|
||||
Vk::DescriptorPool descriptorPool;
|
||||
std::vector<VulkanShaderBinding> allocatedSets;
|
||||
};
|
||||
|
||||
MovablePtr<Vk::Device> m_device;
|
||||
|
||||
@@ -7,6 +7,11 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline Vk::Device* VulkanRenderPipelineLayout::GetDevice() const
|
||||
{
|
||||
return m_device.Get();
|
||||
}
|
||||
|
||||
inline const Vk::DescriptorSetLayout& VulkanRenderPipelineLayout::GetDescriptorSetLayout() const
|
||||
{
|
||||
return m_descriptorSetLayout;
|
||||
|
||||
41
include/Nazara/VulkanRenderer/VulkanShaderBinding.hpp
Normal file
41
include/Nazara/VulkanRenderer/VulkanShaderBinding.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_VULKANRENDERER_VULKANSHADERBINDING_HPP
|
||||
#define NAZARA_VULKANRENDERER_VULKANSHADERBINDING_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/ShaderBinding.hpp>
|
||||
#include <Nazara/VulkanRenderer/Wrapper/DescriptorSet.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class VulkanRenderPipelineLayout;
|
||||
|
||||
class NAZARA_VULKANRENDERER_API VulkanShaderBinding : public ShaderBinding
|
||||
{
|
||||
public:
|
||||
inline VulkanShaderBinding(VulkanRenderPipelineLayout& owner, Vk::DescriptorSet descriptorSet);
|
||||
VulkanShaderBinding(const VulkanShaderBinding&) = default;
|
||||
VulkanShaderBinding(VulkanShaderBinding&&) noexcept = default;
|
||||
~VulkanShaderBinding() = default;
|
||||
|
||||
inline Vk::DescriptorSet& GetDescriptorSet();
|
||||
|
||||
void Update(std::initializer_list<Binding> bindings) override;
|
||||
|
||||
VulkanShaderBinding& operator=(const VulkanShaderBinding&) = delete;
|
||||
VulkanShaderBinding& operator=(VulkanShaderBinding&&) = delete;
|
||||
|
||||
private:
|
||||
Vk::AutoDescriptorSet m_descriptorSet;
|
||||
VulkanRenderPipelineLayout& m_owner;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/VulkanShaderBinding.inl>
|
||||
|
||||
#endif // NAZARA_VULKANRENDERER_VULKANSHADERBINDING_HPP
|
||||
22
include/Nazara/VulkanRenderer/VulkanShaderBinding.inl
Normal file
22
include/Nazara/VulkanRenderer/VulkanShaderBinding.inl
Normal file
@@ -0,0 +1,22 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Vulkan Renderer"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/VulkanRenderer/VulkanShaderBinding.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
inline VulkanShaderBinding::VulkanShaderBinding(VulkanRenderPipelineLayout& owner, Vk::DescriptorSet descriptorSet) :
|
||||
m_descriptorSet(std::move(descriptorSet)),
|
||||
m_owner(owner)
|
||||
{
|
||||
}
|
||||
|
||||
inline Vk::DescriptorSet& VulkanShaderBinding::GetDescriptorSet()
|
||||
{
|
||||
return m_descriptorSet;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/VulkanRenderer/DebugOff.hpp>
|
||||
Reference in New Issue
Block a user