Separating declaration and definition of RefPtr
This commit is contained in:
@@ -1,7 +1,15 @@
|
||||
#pragma once
|
||||
#include "MinimalEngine.h"
|
||||
#include "GraphicsEnums.h"
|
||||
#include "Containers/Array.h"
|
||||
#include <vulkan/vulkan.h>
|
||||
namespace Seele
|
||||
{
|
||||
struct SePushConstantRange {
|
||||
SeShaderStageFlags stageFlags;
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
struct GraphicsInitializer
|
||||
{
|
||||
const char* windowLayoutFile;
|
||||
@@ -18,16 +26,20 @@ namespace Seele
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(RenderCommandBase);
|
||||
DEFINE_REF(RenderCommandBase);
|
||||
class SamplerState
|
||||
{
|
||||
|
||||
};
|
||||
DEFINE_REF(SamplerState);
|
||||
class DescriptorBinding
|
||||
{
|
||||
public:
|
||||
DescriptorBinding()
|
||||
: binding(0)
|
||||
, descriptorType(VK_DESCRIPTOR_TYPE_MAX_ENUM)
|
||||
, descriptorType(SE_DESCRIPTOR_TYPE_MAX_ENUM)
|
||||
, descriptorCount(-1)
|
||||
, shaderStages(VK_SHADER_STAGE_ALL)
|
||||
, shaderStages(SE_SHADER_STAGE_ALL)
|
||||
{}
|
||||
DescriptorBinding(const DescriptorBinding& other)
|
||||
: binding(other.binding)
|
||||
@@ -43,83 +55,120 @@ namespace Seele
|
||||
shaderStages = other.shaderStages;
|
||||
}
|
||||
uint32_t binding;
|
||||
//TODO make generic enum
|
||||
VkDescriptorType descriptorType;
|
||||
SeDescriptorType descriptorType;
|
||||
uint32_t descriptorCount;
|
||||
VkShaderStageFlags shaderStages;
|
||||
SeShaderStageFlags shaderStages;
|
||||
};
|
||||
DECLARE_REF(DescriptorBinding);
|
||||
DEFINE_REF(DescriptorBinding);
|
||||
|
||||
DECLARE_REF(DescriptorSet);
|
||||
class DescriptorAllocator
|
||||
{
|
||||
|
||||
public:
|
||||
DescriptorAllocator() {}
|
||||
~DescriptorAllocator() {}
|
||||
virtual void allocateDescriptorSet(PDescriptorSet& descriptorSet) = 0;
|
||||
};
|
||||
DECLARE_REF(DescriptorAllocator);
|
||||
|
||||
DEFINE_REF(DescriptorAllocator);
|
||||
DECLARE_REF(UniformBuffer);
|
||||
DECLARE_REF(StructuredBuffer);
|
||||
DECLARE_REF(Texture);
|
||||
class DescriptorSet
|
||||
{
|
||||
|
||||
public:
|
||||
virtual ~DescriptorSet() {}
|
||||
virtual void writeChanges() = 0;
|
||||
virtual void updateBuffer(uint32 binding, PUniformBuffer uniformBuffer) = 0;
|
||||
virtual void updateBuffer(uint32 binding, PStructuredBuffer structuredBuffer) = 0;
|
||||
virtual void updateSampler(uint32 binding, PSamplerState samplerState) = 0;
|
||||
virtual void updateTexture(uint32 binding, PTexture texture, PSamplerState samplerState = nullptr) = 0;
|
||||
virtual bool operator<(PDescriptorSet other) = 0;
|
||||
};
|
||||
DECLARE_REF(DescriptorSet);
|
||||
DEFINE_REF(DescriptorSet);
|
||||
|
||||
class DescriptorLayout
|
||||
{
|
||||
|
||||
public:
|
||||
DescriptorLayout() {}
|
||||
virtual ~DescriptorLayout(){}
|
||||
void operator=(const DescriptorLayout& other)
|
||||
{
|
||||
descriptorBindings.resize(other.descriptorBindings.size());
|
||||
std::memcpy(descriptorBindings.data(), other.descriptorBindings.data(), sizeof(DescriptorLayout) * descriptorBindings.size());
|
||||
}
|
||||
virtual void create() = 0;
|
||||
virtual void addDescriptorBinding(uint32 binding, SeDescriptorType type, uint32 arrayCount = 1);
|
||||
virtual PDescriptorSet allocatedDescriptorSet();
|
||||
const Array<DescriptorBinding>& getBindings() const { return descriptorBindings; }
|
||||
protected:
|
||||
Array<DescriptorBinding> descriptorBindings;
|
||||
PDescriptorAllocator allocator;
|
||||
friend class PipelineLayout;
|
||||
friend class DescriptorAllocator;
|
||||
};
|
||||
DECLARE_REF(DescriptorLayout);
|
||||
DEFINE_REF(DescriptorLayout);
|
||||
class PipelineLayout
|
||||
{
|
||||
|
||||
public:
|
||||
PipelineLayout() {}
|
||||
virtual ~PipelineLayout() {}
|
||||
virtual void create() = 0;
|
||||
void addDescriptorLayout(uint32 setIndex, PDescriptorLayout layout);
|
||||
void addPushConstants(const SePushConstantRange& pushConstants);
|
||||
virtual uint32 getHash() const = 0;
|
||||
protected:
|
||||
Array<PDescriptorLayout> descriptorSetLayouts;
|
||||
Array<SePushConstantRange> pushConstants;
|
||||
};
|
||||
DECLARE_REF(PipelineLayout);
|
||||
DEFINE_REF(PipelineLayout);
|
||||
class VertexDeclaration
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(VertexDeclaration);
|
||||
DEFINE_REF(VertexDeclaration);
|
||||
class GraphicsPipeline
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(GraphicsPipeline);
|
||||
DEFINE_REF(GraphicsPipeline);
|
||||
class UniformBuffer
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(UniformBuffer);
|
||||
DEFINE_REF(UniformBuffer);
|
||||
class Viewport
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(Viewport);
|
||||
DEFINE_REF(Viewport);
|
||||
class VertexBuffer
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(VertexBuffer);
|
||||
DEFINE_REF(VertexBuffer);
|
||||
class IndexBuffer
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(IndexBuffer);
|
||||
DEFINE_REF(IndexBuffer);
|
||||
class StructuredBuffer
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(StructuredBuffer);
|
||||
DEFINE_REF(StructuredBuffer);
|
||||
class Texture
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(Texture);
|
||||
DEFINE_REF(Texture);
|
||||
class Texture2D : public Texture
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(Texture2D);
|
||||
DEFINE_REF(Texture2D);
|
||||
class RenderPass
|
||||
{
|
||||
|
||||
};
|
||||
DECLARE_REF(RenderPass);
|
||||
DEFINE_REF(RenderPass);
|
||||
}
|
||||
Reference in New Issue
Block a user