Fixing a boatload of warnings
This commit is contained in:
@@ -61,6 +61,6 @@ protected:
|
||||
PShaderCompiler shaderCompiler;
|
||||
friend class Window;
|
||||
};
|
||||
DEFINE_REF(Graphics);
|
||||
DEFINE_REF(Graphics)
|
||||
} // namespace Gfx
|
||||
} // namespace Seele
|
||||
@@ -6,10 +6,9 @@ namespace Seele
|
||||
|
||||
struct GraphicsInitializer
|
||||
{
|
||||
const char *windowLayoutFile;
|
||||
const char *applicationName;
|
||||
const char *engineName;
|
||||
void *windowHandle;
|
||||
const char *windowLayoutFile;
|
||||
/**
|
||||
* layers defines the enabled Vulkan layers used in the instance,
|
||||
* if ENABLE_VALIDATION is defined, standard validation is already enabled
|
||||
@@ -18,12 +17,23 @@ struct GraphicsInitializer
|
||||
Array<const char *> layers;
|
||||
Array<const char *> instanceExtensions;
|
||||
Array<const char *> deviceExtensions;
|
||||
|
||||
void *windowHandle;
|
||||
GraphicsInitializer()
|
||||
: applicationName("SeeleEngine"), engineName("SeeleEngine"), layers{"VK_LAYER_KHRONOS_validation"}, instanceExtensions{}, deviceExtensions{"VK_KHR_swapchain"}, windowHandle(nullptr)
|
||||
: applicationName("SeeleEngine")
|
||||
, engineName("SeeleEngine")
|
||||
, layers{"VK_LAYER_KHRONOS_validation"}
|
||||
, instanceExtensions{}
|
||||
, deviceExtensions{"VK_KHR_swapchain"}
|
||||
, windowHandle(nullptr)
|
||||
{
|
||||
}
|
||||
GraphicsInitializer(const GraphicsInitializer &other)
|
||||
: applicationName(other.applicationName), engineName(other.engineName), layers(other.layers), instanceExtensions(other.instanceExtensions), deviceExtensions(other.deviceExtensions)
|
||||
: applicationName(other.applicationName)
|
||||
, engineName(other.engineName)
|
||||
, layers(other.layers)
|
||||
, instanceExtensions(other.instanceExtensions)
|
||||
, deviceExtensions(other.deviceExtensions)
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -191,14 +201,14 @@ struct ColorBlendState
|
||||
float blendConstants[4];
|
||||
};
|
||||
} // namespace Gfx
|
||||
DECLARE_NAME_REF(Gfx, VertexDeclaration);
|
||||
DECLARE_NAME_REF(Gfx, VertexShader);
|
||||
DECLARE_NAME_REF(Gfx, ControlShader);
|
||||
DECLARE_NAME_REF(Gfx, EvaluationShader);
|
||||
DECLARE_NAME_REF(Gfx, GeometryShader);
|
||||
DECLARE_NAME_REF(Gfx, FragmentShader);
|
||||
DECLARE_NAME_REF(Gfx, PipelineLayout);
|
||||
DECLARE_NAME_REF(Gfx, RenderPass);
|
||||
DECLARE_NAME_REF(Gfx, VertexDeclaration)
|
||||
DECLARE_NAME_REF(Gfx, VertexShader)
|
||||
DECLARE_NAME_REF(Gfx, ControlShader)
|
||||
DECLARE_NAME_REF(Gfx, EvaluationShader)
|
||||
DECLARE_NAME_REF(Gfx, GeometryShader)
|
||||
DECLARE_NAME_REF(Gfx, FragmentShader)
|
||||
DECLARE_NAME_REF(Gfx, PipelineLayout)
|
||||
DECLARE_NAME_REF(Gfx, RenderPass)
|
||||
struct GraphicsPipelineCreateInfo
|
||||
{
|
||||
Gfx::PVertexDeclaration vertexDeclaration;
|
||||
@@ -216,7 +226,7 @@ struct GraphicsPipelineCreateInfo
|
||||
Gfx::ColorBlendState colorBlend;
|
||||
GraphicsPipelineCreateInfo()
|
||||
{
|
||||
std::memset(this, 0, sizeof(*this));
|
||||
std::memset((void*)this, 0, sizeof(*this));
|
||||
topology = Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST;
|
||||
rasterizationState.cullMode = Gfx::SE_CULL_MODE_BACK_BIT;
|
||||
rasterizationState.polygonMode = Gfx::SE_POLYGON_MODE_FILL;
|
||||
|
||||
@@ -43,7 +43,7 @@ ShaderCollection& ShaderMap::createShaders(
|
||||
RenderPassType renderPass,
|
||||
PMaterial material,
|
||||
VertexInputType* vertexInput,
|
||||
bool bPositionOnly)
|
||||
bool /*bPositionOnly*/)
|
||||
{
|
||||
ShaderCollection& collection = shaders.add();
|
||||
//collection.vertexDeclaration = bPositionOnly ? vertexInput->getPositionDeclaration() : vertexInput->getDeclaration();
|
||||
@@ -139,8 +139,8 @@ void PipelineLayout::addPushConstants(const SePushConstantRange &pushConstant)
|
||||
}
|
||||
|
||||
QueueOwnedResource::QueueOwnedResource(QueueFamilyMapping mapping, QueueType startQueueType)
|
||||
: mapping(mapping)
|
||||
, currentOwner(startQueueType)
|
||||
: currentOwner(startQueueType)
|
||||
, mapping(mapping)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -224,7 +224,9 @@ IndexBuffer::~IndexBuffer()
|
||||
VertexStream::VertexStream()
|
||||
{}
|
||||
VertexStream::VertexStream(uint32 stride, uint32 offset, uint8 instanced)
|
||||
: stride(stride), instanced(instanced), offset(offset)
|
||||
: stride(stride)
|
||||
, offset(offset)
|
||||
, instanced(instanced)
|
||||
{
|
||||
}
|
||||
VertexStream::~VertexStream()
|
||||
@@ -294,31 +296,53 @@ RenderCommand::~RenderCommand()
|
||||
}
|
||||
|
||||
RenderTargetLayout::RenderTargetLayout()
|
||||
: inputAttachments(), colorAttachments(), depthAttachment()
|
||||
: inputAttachments()
|
||||
, colorAttachments()
|
||||
, depthAttachment()
|
||||
{
|
||||
}
|
||||
|
||||
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment depthAttachment)
|
||||
: inputAttachments(), colorAttachments(), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY())
|
||||
: inputAttachments()
|
||||
, colorAttachments()
|
||||
, depthAttachment(depthAttachment)
|
||||
, width(depthAttachment->getTexture()->getSizeX())
|
||||
, height(depthAttachment->getTexture()->getSizeY())
|
||||
{
|
||||
}
|
||||
|
||||
RenderTargetLayout::RenderTargetLayout(PRenderTargetAttachment colorAttachment, PRenderTargetAttachment depthAttachment)
|
||||
: inputAttachments(), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY())
|
||||
: inputAttachments()
|
||||
, depthAttachment(depthAttachment)
|
||||
, width(depthAttachment->getTexture()->getSizeX())
|
||||
, height(depthAttachment->getTexture()->getSizeY())
|
||||
{
|
||||
colorAttachments.add(colorAttachment);
|
||||
}
|
||||
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachmet)
|
||||
: inputAttachments(), colorAttachments(colorAttachments), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY())
|
||||
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachment)
|
||||
: inputAttachments()
|
||||
, colorAttachments(colorAttachments)
|
||||
, depthAttachment(depthAttachment)
|
||||
, width(depthAttachment->getTexture()->getSizeX())
|
||||
, height(depthAttachment->getTexture()->getSizeY())
|
||||
{
|
||||
}
|
||||
RenderTargetLayout::RenderTargetLayout(Array<PRenderTargetAttachment> inputAttachments, Array<PRenderTargetAttachment> colorAttachments, PRenderTargetAttachment depthAttachment)
|
||||
: inputAttachments(inputAttachments), colorAttachments(colorAttachments), depthAttachment(depthAttachment), width(depthAttachment->getTexture()->getSizeX()), height(depthAttachment->getTexture()->getSizeY())
|
||||
: inputAttachments(inputAttachments)
|
||||
, colorAttachments(colorAttachments)
|
||||
, depthAttachment(depthAttachment)
|
||||
, width(depthAttachment->getTexture()->getSizeX())
|
||||
, height(depthAttachment->getTexture()->getSizeY())
|
||||
{
|
||||
}
|
||||
|
||||
Window::Window(const WindowCreateInfo &createInfo)
|
||||
: sizeX(createInfo.width), sizeY(createInfo.height), bFullscreen(createInfo.bFullscreen), title(createInfo.title), pixelFormat(createInfo.pixelFormat), samples(createInfo.numSamples)
|
||||
: sizeX(createInfo.width)
|
||||
, sizeY(createInfo.height)
|
||||
, bFullscreen(createInfo.bFullscreen)
|
||||
, title(createInfo.title)
|
||||
, pixelFormat(createInfo.pixelFormat)
|
||||
, samples(createInfo.numSamples)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -327,7 +351,11 @@ Window::~Window()
|
||||
}
|
||||
|
||||
Viewport::Viewport(PWindow owner, const ViewportCreateInfo &viewportInfo)
|
||||
: sizeX(viewportInfo.sizeX), sizeY(viewportInfo.sizeY), offsetX(viewportInfo.offsetX), offsetY(viewportInfo.offsetY), owner(owner)
|
||||
: sizeX(viewportInfo.sizeX)
|
||||
, sizeY(viewportInfo.sizeY)
|
||||
, offsetX(viewportInfo.offsetX)
|
||||
, offsetY(viewportInfo.offsetY)
|
||||
, owner(owner)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ class VertexInputType;
|
||||
DECLARE_REF(Material)
|
||||
namespace Gfx
|
||||
{
|
||||
DECLARE_REF(Graphics);
|
||||
DECLARE_REF(Graphics)
|
||||
|
||||
class SamplerState
|
||||
{
|
||||
@@ -29,11 +29,11 @@ public:
|
||||
{
|
||||
}
|
||||
};
|
||||
DEFINE_REF(SamplerState);
|
||||
DEFINE_REF(SamplerState)
|
||||
|
||||
class Shader
|
||||
{};
|
||||
DEFINE_REF(Shader);
|
||||
DEFINE_REF(Shader)
|
||||
|
||||
class VertexShader
|
||||
{
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
VertexShader() {}
|
||||
virtual ~VertexShader() {}
|
||||
};
|
||||
DEFINE_REF(VertexShader);
|
||||
DEFINE_REF(VertexShader)
|
||||
class ControlShader
|
||||
{
|
||||
public:
|
||||
@@ -52,28 +52,28 @@ public:
|
||||
protected:
|
||||
uint32 numPatchPoints;
|
||||
};
|
||||
DEFINE_REF(ControlShader);
|
||||
DEFINE_REF(ControlShader)
|
||||
class EvaluationShader
|
||||
{
|
||||
public:
|
||||
EvaluationShader() {}
|
||||
virtual ~EvaluationShader() {}
|
||||
};
|
||||
DEFINE_REF(EvaluationShader);
|
||||
DEFINE_REF(EvaluationShader)
|
||||
class GeometryShader
|
||||
{
|
||||
public:
|
||||
GeometryShader() {}
|
||||
virtual ~GeometryShader() {}
|
||||
};
|
||||
DEFINE_REF(GeometryShader);
|
||||
DEFINE_REF(GeometryShader)
|
||||
class FragmentShader
|
||||
{
|
||||
public:
|
||||
FragmentShader() {}
|
||||
virtual ~FragmentShader() {}
|
||||
};
|
||||
DEFINE_REF(FragmentShader);
|
||||
DEFINE_REF(FragmentShader)
|
||||
|
||||
//Uniquely identifies a permutation of shaders
|
||||
//using the type parameters used to generate it
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
private:
|
||||
Array<ShaderCollection> shaders;
|
||||
};
|
||||
DEFINE_REF(ShaderMap);
|
||||
DEFINE_REF(ShaderMap)
|
||||
|
||||
class ComputeShader
|
||||
{
|
||||
@@ -146,7 +146,7 @@ public:
|
||||
ComputeShader() {}
|
||||
virtual ~ComputeShader() {}
|
||||
};
|
||||
DEFINE_REF(ComputeShader);
|
||||
DEFINE_REF(ComputeShader)
|
||||
|
||||
class DescriptorBinding
|
||||
{
|
||||
@@ -171,9 +171,9 @@ public:
|
||||
uint32_t descriptorCount;
|
||||
SeShaderStageFlags shaderStages;
|
||||
};
|
||||
DEFINE_REF(DescriptorBinding);
|
||||
DEFINE_REF(DescriptorBinding)
|
||||
|
||||
DECLARE_REF(DescriptorSet);
|
||||
DECLARE_REF(DescriptorSet)
|
||||
class DescriptorAllocator
|
||||
{
|
||||
public:
|
||||
@@ -182,10 +182,10 @@ public:
|
||||
virtual void allocateDescriptorSet(PDescriptorSet &descriptorSet) = 0;
|
||||
virtual void reset() = 0;
|
||||
};
|
||||
DEFINE_REF(DescriptorAllocator);
|
||||
DECLARE_REF(UniformBuffer);
|
||||
DECLARE_REF(StructuredBuffer);
|
||||
DECLARE_REF(Texture);
|
||||
DEFINE_REF(DescriptorAllocator)
|
||||
DECLARE_REF(UniformBuffer)
|
||||
DECLARE_REF(StructuredBuffer)
|
||||
DECLARE_REF(Texture)
|
||||
class DescriptorSet
|
||||
{
|
||||
public:
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
|
||||
virtual uint32 getSetIndex() const = 0;
|
||||
};
|
||||
DEFINE_REF(DescriptorSet);
|
||||
DEFINE_REF(DescriptorSet)
|
||||
|
||||
class DescriptorLayout
|
||||
{
|
||||
@@ -209,10 +209,17 @@ public:
|
||||
{
|
||||
}
|
||||
virtual ~DescriptorLayout() {}
|
||||
void operator=(const DescriptorLayout &other)
|
||||
DescriptorLayout& operator=(const DescriptorLayout &other)
|
||||
{
|
||||
descriptorBindings.resize(other.descriptorBindings.size());
|
||||
std::memcpy(descriptorBindings.data(), other.descriptorBindings.data(), sizeof(DescriptorLayout) * descriptorBindings.size());
|
||||
if(this != &other)
|
||||
{
|
||||
descriptorBindings.resize(other.descriptorBindings.size());
|
||||
for(uint32 i = 0; i < descriptorBindings.size(); ++i)
|
||||
{
|
||||
descriptorBindings[i] = other.descriptorBindings[i];
|
||||
}
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
virtual void create() = 0;
|
||||
virtual void addDescriptorBinding(uint32 binding, SeDescriptorType type, uint32 arrayCount = 1);
|
||||
@@ -228,7 +235,7 @@ protected:
|
||||
friend class PipelineLayout;
|
||||
friend class DescriptorAllocator;
|
||||
};
|
||||
DEFINE_REF(DescriptorLayout);
|
||||
DEFINE_REF(DescriptorLayout)
|
||||
class PipelineLayout
|
||||
{
|
||||
public:
|
||||
@@ -244,7 +251,7 @@ protected:
|
||||
Array<PDescriptorLayout> descriptorSetLayouts;
|
||||
Array<SePushConstantRange> pushConstants;
|
||||
};
|
||||
DEFINE_REF(PipelineLayout);
|
||||
DEFINE_REF(PipelineLayout)
|
||||
|
||||
struct QueueFamilyMapping
|
||||
{
|
||||
@@ -290,7 +297,7 @@ protected:
|
||||
Gfx::QueueType currentOwner;
|
||||
QueueFamilyMapping mapping;
|
||||
};
|
||||
DEFINE_REF(QueueOwnedResource);
|
||||
DEFINE_REF(QueueOwnedResource)
|
||||
|
||||
// IMPORTANT!!
|
||||
// WHEN DERIVING FROM ANY Gfx:: BASE CLASSES WITH MULTIPLE INHERITANCE
|
||||
@@ -337,7 +344,7 @@ protected:
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
|
||||
};
|
||||
DEFINE_REF(UniformBuffer);
|
||||
DEFINE_REF(UniformBuffer)
|
||||
|
||||
class VertexBuffer : public Buffer
|
||||
{
|
||||
@@ -360,7 +367,7 @@ protected:
|
||||
uint32 numVertices;
|
||||
uint32 vertexSize;
|
||||
};
|
||||
DEFINE_REF(VertexBuffer);
|
||||
DEFINE_REF(VertexBuffer)
|
||||
|
||||
class IndexBuffer : public Buffer
|
||||
{
|
||||
@@ -382,7 +389,7 @@ protected:
|
||||
Gfx::SeIndexType indexType;
|
||||
uint32 numIndices;
|
||||
};
|
||||
DEFINE_REF(IndexBuffer);
|
||||
DEFINE_REF(IndexBuffer)
|
||||
|
||||
class StructuredBuffer : public Buffer
|
||||
{
|
||||
@@ -393,7 +400,7 @@ protected:
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
|
||||
};
|
||||
DEFINE_REF(StructuredBuffer);
|
||||
DEFINE_REF(StructuredBuffer)
|
||||
|
||||
class VertexStream
|
||||
{
|
||||
@@ -410,7 +417,7 @@ public:
|
||||
Array<VertexElement> vertexDescription;
|
||||
uint8 instanced;
|
||||
};
|
||||
DEFINE_REF(VertexStream);
|
||||
DEFINE_REF(VertexStream)
|
||||
class VertexDeclaration
|
||||
{
|
||||
public:
|
||||
@@ -420,7 +427,7 @@ public:
|
||||
static PVertexDeclaration createDeclaration(PGraphics graphics, const Array<VertexElement>& elementList);
|
||||
private:
|
||||
};
|
||||
DEFINE_REF(VertexDeclaration);
|
||||
DEFINE_REF(VertexDeclaration)
|
||||
class GraphicsPipeline
|
||||
{
|
||||
public:
|
||||
@@ -429,10 +436,10 @@ public:
|
||||
const GraphicsPipelineCreateInfo& getCreateInfo() const {return createInfo;}
|
||||
PPipelineLayout getPipelineLayout() const { return layout; }
|
||||
protected:
|
||||
PPipelineLayout layout;
|
||||
GraphicsPipelineCreateInfo createInfo;
|
||||
PPipelineLayout layout;
|
||||
};
|
||||
DEFINE_REF(GraphicsPipeline);
|
||||
DEFINE_REF(GraphicsPipeline)
|
||||
|
||||
// IMPORTANT!!
|
||||
// WHEN DERIVING FROM ANY Gfx:: BASE CLASSES WITH MULTIPLE INHERITANCE
|
||||
@@ -455,7 +462,7 @@ protected:
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
|
||||
};
|
||||
DEFINE_REF(Texture);
|
||||
DEFINE_REF(Texture)
|
||||
class Texture2D : public Texture
|
||||
{
|
||||
public:
|
||||
@@ -471,9 +478,9 @@ protected:
|
||||
//Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
|
||||
};
|
||||
DEFINE_REF(Texture2D);
|
||||
DEFINE_REF(Texture2D)
|
||||
|
||||
DECLARE_REF(Viewport);
|
||||
DECLARE_REF(Viewport)
|
||||
class RenderCommand
|
||||
{
|
||||
public:
|
||||
@@ -488,7 +495,7 @@ public:
|
||||
virtual void bindIndexBuffer(Gfx::PIndexBuffer indexBuffer) = 0;
|
||||
virtual void draw(const MeshBatchElement& data) = 0;
|
||||
};
|
||||
DEFINE_REF(RenderCommand);
|
||||
DEFINE_REF(RenderCommand)
|
||||
|
||||
class Window
|
||||
{
|
||||
@@ -521,7 +528,7 @@ protected:
|
||||
SeFormat pixelFormat;
|
||||
uint32 samples;
|
||||
};
|
||||
DEFINE_REF(Window);
|
||||
DEFINE_REF(Window)
|
||||
|
||||
class Viewport
|
||||
{
|
||||
@@ -542,7 +549,7 @@ protected:
|
||||
uint32 offsetY;
|
||||
PWindow owner;
|
||||
};
|
||||
DEFINE_REF(Viewport);
|
||||
DEFINE_REF(Viewport)
|
||||
|
||||
class RenderTargetAttachment
|
||||
{
|
||||
@@ -583,7 +590,7 @@ protected:
|
||||
SeAttachmentLoadOp stencilLoadOp;
|
||||
SeAttachmentStoreOp stencilStoreOp;
|
||||
};
|
||||
DEFINE_REF(RenderTargetAttachment);
|
||||
DEFINE_REF(RenderTargetAttachment)
|
||||
|
||||
class SwapchainAttachment : public RenderTargetAttachment
|
||||
{
|
||||
@@ -617,7 +624,7 @@ public:
|
||||
private:
|
||||
PWindow owner;
|
||||
};
|
||||
DEFINE_REF(SwapchainAttachment);
|
||||
DEFINE_REF(SwapchainAttachment)
|
||||
|
||||
class RenderTargetLayout
|
||||
{
|
||||
@@ -633,7 +640,7 @@ public:
|
||||
uint32 width;
|
||||
uint32 height;
|
||||
};
|
||||
DEFINE_REF(RenderTargetLayout);
|
||||
DEFINE_REF(RenderTargetLayout)
|
||||
|
||||
class RenderPass
|
||||
{
|
||||
@@ -645,6 +652,6 @@ public:
|
||||
protected:
|
||||
PRenderTargetLayout layout;
|
||||
};
|
||||
DEFINE_REF(RenderPass);
|
||||
DEFINE_REF(RenderPass)
|
||||
} // namespace Gfx
|
||||
} // namespace Seele
|
||||
@@ -3,8 +3,8 @@
|
||||
using namespace Seele;
|
||||
|
||||
Mesh::Mesh(PVertexShaderInput vertexInput, Gfx::PIndexBuffer indexBuffer)
|
||||
: vertexInput(vertexInput)
|
||||
, indexBuffer(indexBuffer)
|
||||
: indexBuffer(indexBuffer)
|
||||
, vertexInput(vertexInput)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ struct MeshDescription
|
||||
//TODO declaration
|
||||
}
|
||||
};*/
|
||||
DECLARE_REF(MaterialAsset);
|
||||
DECLARE_REF(MaterialAsset)
|
||||
class Mesh
|
||||
{
|
||||
public:
|
||||
@@ -55,11 +55,9 @@ public:
|
||||
private:
|
||||
friend class boost::serialization::access;
|
||||
template<class Archive>
|
||||
void serialize(Archive& ar, const unsigned int version)
|
||||
void serialize(Archive&, const unsigned int)
|
||||
{
|
||||
//ar & referencedMaterial->getFullPath();
|
||||
//TODO:
|
||||
}
|
||||
}
|
||||
};
|
||||
DEFINE_REF(Mesh);
|
||||
DEFINE_REF(Mesh)
|
||||
} // namespace Seele
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
DECLARE_REF(MaterialAsset);
|
||||
DECLARE_REF(VertexShaderInput);
|
||||
DECLARE_NAME_REF(Gfx, VertexBuffer);
|
||||
DECLARE_NAME_REF(Gfx, IndexBuffer);
|
||||
DECLARE_NAME_REF(Gfx, UniformBuffer);
|
||||
DECLARE_REF(MaterialAsset)
|
||||
DECLARE_REF(VertexShaderInput)
|
||||
DECLARE_NAME_REF(Gfx, VertexBuffer)
|
||||
DECLARE_NAME_REF(Gfx, IndexBuffer)
|
||||
DECLARE_NAME_REF(Gfx, UniformBuffer)
|
||||
struct MeshBatchElement
|
||||
{
|
||||
public:
|
||||
@@ -32,13 +32,13 @@ public:
|
||||
MeshBatchElement()
|
||||
: uniformBuffer(nullptr)
|
||||
, indexBuffer(nullptr)
|
||||
, indirectArgsBuffer(nullptr)
|
||||
, firstIndex(0)
|
||||
, numPrimitives(0)
|
||||
, numInstances(1)
|
||||
, baseVertexIndex(0)
|
||||
, minVertexIndex(0)
|
||||
, maxVertexIndex(0)
|
||||
, indirectArgsBuffer(nullptr)
|
||||
{}
|
||||
};
|
||||
struct MeshBatch
|
||||
@@ -81,13 +81,13 @@ struct MeshBatch
|
||||
, isBackfaceCullingDisabled(false)
|
||||
, isCastingShadow(true)
|
||||
, useWireframe(false)
|
||||
, topology(Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST)
|
||||
, vertexInput(nullptr)
|
||||
, material(nullptr)
|
||||
, topology(Gfx::SE_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST)
|
||||
{
|
||||
}
|
||||
};
|
||||
DECLARE_REF(PrimitiveComponent);
|
||||
DECLARE_REF(PrimitiveComponent)
|
||||
struct StaticMeshBatch : public MeshBatch
|
||||
{
|
||||
uint32 index;
|
||||
|
||||
@@ -26,10 +26,10 @@ void BasePassMeshProcessor::addMeshBatch(
|
||||
Gfx::PPipelineLayout pipelineLayout,
|
||||
Gfx::PDescriptorLayout primitiveLayout,
|
||||
Array<Gfx::PDescriptorSet>& descriptorSets,
|
||||
int32 staticMeshId)
|
||||
int32 /*staticMeshId*/)
|
||||
{
|
||||
const PMaterialAsset material = batch.material;
|
||||
const Gfx::MaterialShadingModel shadingModel = material->getShadingModel();
|
||||
//const Gfx::MaterialShadingModel shadingModel = material->getShadingModel();
|
||||
|
||||
const PVertexShaderInput vertexInput = batch.vertexInput;
|
||||
|
||||
|
||||
@@ -24,13 +24,13 @@ private:
|
||||
Array<Gfx::PRenderCommand> renderCommands;
|
||||
Array<Gfx::PRenderCommand> cachedCommandBuffers;
|
||||
Array<Gfx::PDescriptorSet> cachedPrimitiveSets;
|
||||
uint32 cachedPrimitiveIndex;
|
||||
Gfx::PViewport target;
|
||||
uint8 translucentBasePass;
|
||||
uint32 cachedPrimitiveIndex;
|
||||
};
|
||||
DEFINE_REF(BasePassMeshProcessor);
|
||||
DECLARE_REF(CameraActor);
|
||||
DECLARE_REF(CameraComponent);
|
||||
DEFINE_REF(BasePassMeshProcessor)
|
||||
DECLARE_REF(CameraActor)
|
||||
DECLARE_REF(CameraComponent)
|
||||
class BasePass
|
||||
{
|
||||
public:
|
||||
@@ -54,8 +54,12 @@ private:
|
||||
|
||||
Gfx::PRenderPass renderPass;
|
||||
Gfx::PTexture2D depthBuffer;
|
||||
const PScene scene;
|
||||
UPBasePassMeshProcessor processor;
|
||||
const PScene scene;
|
||||
Gfx::PGraphics graphics;
|
||||
Gfx::PViewport viewport;
|
||||
Array<Gfx::PDescriptorSet> descriptorSets;
|
||||
PCameraComponent source;
|
||||
Gfx::PPipelineLayout basePassLayout;
|
||||
// Set 0: Light environment
|
||||
Gfx::PDescriptorLayout lightLayout;
|
||||
@@ -68,10 +72,6 @@ private:
|
||||
// Set 3: primitive scene data
|
||||
Gfx::PDescriptorLayout primitiveLayout;
|
||||
Gfx::PUniformBuffer primitiveUniformBuffer;
|
||||
Array<Gfx::PDescriptorSet> descriptorSets;
|
||||
Gfx::PGraphics graphics;
|
||||
PCameraComponent source;
|
||||
Gfx::PViewport viewport;
|
||||
};
|
||||
DEFINE_REF(BasePass);
|
||||
DEFINE_REF(BasePass)
|
||||
} // namespace Seele
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
DECLARE_REF(Material);
|
||||
DECLARE_NAME_REF(Gfx, Graphics);
|
||||
DECLARE_REF(Material)
|
||||
DECLARE_NAME_REF(Gfx, Graphics)
|
||||
namespace Gfx
|
||||
{
|
||||
class ShaderCompiler
|
||||
@@ -17,6 +17,6 @@ private:
|
||||
Array<PMaterial> pendingCompiles;
|
||||
PGraphics graphics;
|
||||
};
|
||||
DEFINE_REF(ShaderCompiler);
|
||||
DEFINE_REF(ShaderCompiler)
|
||||
} // namespace Gfx
|
||||
} // namespace Seele
|
||||
@@ -66,4 +66,4 @@ void StaticMeshVertexInput::setData(StaticMeshDataType&& data)
|
||||
this->data = std::move(data);
|
||||
}
|
||||
|
||||
IMPLEMENT_VERTEX_INPUT_TYPE(StaticMeshVertexInput, "StaticMeshVertexInput");
|
||||
IMPLEMENT_VERTEX_INPUT_TYPE(StaticMeshVertexInput, "StaticMeshVertexInput")
|
||||
@@ -16,7 +16,7 @@ struct StaticMeshDataType
|
||||
};
|
||||
class StaticMeshVertexInput : public VertexShaderInput
|
||||
{
|
||||
DECLARE_VERTEX_INPUT_TYPE(StaticMeshVertexInput);
|
||||
DECLARE_VERTEX_INPUT_TYPE(StaticMeshVertexInput)
|
||||
public:
|
||||
StaticMeshVertexInput(std::string name);
|
||||
virtual ~StaticMeshVertexInput();
|
||||
@@ -25,5 +25,5 @@ public:
|
||||
private:
|
||||
StaticMeshDataType data;
|
||||
};
|
||||
DEFINE_REF(StaticMeshVertexInput);
|
||||
DEFINE_REF(StaticMeshVertexInput)
|
||||
}
|
||||
@@ -111,13 +111,13 @@ private:
|
||||
VertexInputType* inputClass::getType() const { return &staticType; }
|
||||
|
||||
struct MeshDescription;
|
||||
DECLARE_REF(VertexShaderInput);
|
||||
DECLARE_REF(VertexShaderInput)
|
||||
class VertexShaderInput
|
||||
{
|
||||
public:
|
||||
VertexShaderInput(std::string name);
|
||||
virtual ~VertexShaderInput();
|
||||
virtual void init(Gfx::PGraphics graphics) {};
|
||||
virtual void init(Gfx::PGraphics) {}
|
||||
void getStreams(VertexInputStreamArray& outVertexStreams) const;
|
||||
void getPositionOnlyStream(VertexInputStreamArray& outVertexStreams) const;
|
||||
virtual bool supportsTesselation() { return false; }
|
||||
@@ -158,5 +158,5 @@ protected:
|
||||
Gfx::PVertexDeclaration positionDeclaration;
|
||||
std::string name;
|
||||
};
|
||||
DEFINE_REF(VertexShaderInput);
|
||||
DEFINE_REF(VertexShaderInput)
|
||||
} // namespace Seele
|
||||
|
||||
@@ -5,7 +5,11 @@
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
SubAllocation::SubAllocation(Allocation *owner, VkDeviceSize allocatedOffset, VkDeviceSize size, VkDeviceSize alignedOffset, VkDeviceSize allocatedSize)
|
||||
: owner(owner), size(size), allocatedOffset(allocatedOffset), alignedOffset(alignedOffset), allocatedSize(allocatedSize)
|
||||
: owner(owner)
|
||||
, size(size)
|
||||
, allocatedOffset(allocatedOffset)
|
||||
, alignedOffset(alignedOffset)
|
||||
, allocatedSize(allocatedSize)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -41,7 +45,13 @@ void SubAllocation::invalidateMemory()
|
||||
|
||||
Allocation::Allocation(PGraphics graphics, Allocator *allocator, VkDeviceSize size, uint8 memoryTypeIndex,
|
||||
VkMemoryPropertyFlags properties, VkMemoryDedicatedAllocateInfo *dedicatedInfo)
|
||||
: device(graphics->getDevice()), allocator(allocator), bytesAllocated(0), bytesUsed(0), readable(properties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT), properties(properties), memoryTypeIndex(memoryTypeIndex)
|
||||
: device(graphics->getDevice())
|
||||
, allocator(allocator)
|
||||
, bytesAllocated(0)
|
||||
, bytesUsed(0)
|
||||
, readable(properties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
|
||||
, properties(properties)
|
||||
, memoryTypeIndex(memoryTypeIndex)
|
||||
{
|
||||
VkMemoryAllocateInfo allocInfo =
|
||||
init::MemoryAllocateInfo();
|
||||
@@ -224,7 +234,7 @@ PSubAllocation Allocator::allocate(const VkMemoryRequirements2 &memRequirements2
|
||||
}
|
||||
|
||||
// no suitable allocations found, allocate new block
|
||||
PAllocation newAllocation = new Allocation(graphics, this, (requirements.size > MemoryBlockSize) ? requirements.size : MemoryBlockSize, memoryTypeIndex, properties, nullptr);
|
||||
PAllocation newAllocation = new Allocation(graphics, this, (requirements.size > MemoryBlockSize) ? requirements.size : (VkDeviceSize)MemoryBlockSize, memoryTypeIndex, properties, nullptr);
|
||||
heaps[heapIndex].allocations.add(newAllocation);
|
||||
return newAllocation->getSuballocation(requirements.size, requirements.alignment);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace Seele
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(Graphics);
|
||||
DECLARE_REF(Graphics)
|
||||
class Allocation;
|
||||
class Allocator;
|
||||
class SubAllocation
|
||||
@@ -33,14 +33,14 @@ public:
|
||||
|
||||
private:
|
||||
Allocation *owner;
|
||||
VkDeviceSize allocatedOffset;
|
||||
VkDeviceSize size;
|
||||
VkDeviceSize allocatedOffset;
|
||||
VkDeviceSize alignedOffset;
|
||||
VkDeviceSize allocatedSize;
|
||||
friend class Allocation;
|
||||
friend class Allocator;
|
||||
};
|
||||
DEFINE_REF(SubAllocation);
|
||||
DEFINE_REF(SubAllocation)
|
||||
class Allocation
|
||||
{
|
||||
public:
|
||||
@@ -94,24 +94,24 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
Allocator *allocator;
|
||||
VkDevice device;
|
||||
VkDeviceMemory allocatedMemory;
|
||||
Allocator *allocator;
|
||||
VkDeviceSize bytesAllocated;
|
||||
VkDeviceSize bytesUsed;
|
||||
VkMemoryPropertyFlags properties;
|
||||
VkDeviceMemory allocatedMemory;
|
||||
Map<VkDeviceSize, SubAllocation *> activeAllocations;
|
||||
Map<VkDeviceSize, PSubAllocation> freeRanges;
|
||||
std::mutex lock;
|
||||
void *mappedPointer;
|
||||
uint8 memoryTypeIndex;
|
||||
uint8 isDedicated : 1;
|
||||
uint8 canMap : 1;
|
||||
uint8 isMapped : 1;
|
||||
uint8 readable : 1;
|
||||
VkMemoryPropertyFlags properties;
|
||||
uint8 memoryTypeIndex;
|
||||
friend class Allocator;
|
||||
};
|
||||
DEFINE_REF(Allocation);
|
||||
DEFINE_REF(Allocation)
|
||||
|
||||
class Allocator
|
||||
{
|
||||
@@ -159,7 +159,7 @@ private:
|
||||
PGraphics graphics;
|
||||
VkPhysicalDeviceMemoryProperties memProperties;
|
||||
};
|
||||
DEFINE_REF(Allocator);
|
||||
DEFINE_REF(Allocator)
|
||||
|
||||
class StagingBuffer
|
||||
{
|
||||
@@ -207,7 +207,7 @@ private:
|
||||
uint8 bReadable;
|
||||
friend class StagingManager;
|
||||
};
|
||||
DEFINE_REF(StagingBuffer);
|
||||
DEFINE_REF(StagingBuffer)
|
||||
|
||||
class StagingManager
|
||||
{
|
||||
@@ -225,6 +225,6 @@ private:
|
||||
Array<StagingBuffer *> activeBuffers;
|
||||
std::mutex lock;
|
||||
};
|
||||
DEFINE_REF(StagingManager);
|
||||
DEFINE_REF(StagingManager)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
@@ -17,7 +17,10 @@ struct PendingBuffer
|
||||
static Map<ShaderBuffer *, PendingBuffer> pendingBuffers;
|
||||
|
||||
ShaderBuffer::ShaderBuffer(PGraphics graphics, uint32 size, VkBufferUsageFlags usage, Gfx::QueueType queueType)
|
||||
: graphics(graphics), currentBuffer(0), size(size), currentOwner(queueType)
|
||||
: graphics(graphics)
|
||||
, currentBuffer(0)
|
||||
, size(size)
|
||||
, currentOwner(queueType)
|
||||
{
|
||||
if (usage & VK_BUFFER_USAGE_INDEX_BUFFER_BIT ||
|
||||
usage & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT ||
|
||||
@@ -242,8 +245,8 @@ void ShaderBuffer::unlock()
|
||||
}
|
||||
|
||||
UniformBuffer::UniformBuffer(PGraphics graphics, const UniformBufferCreateInfo &createInfo)
|
||||
: Vulkan::ShaderBuffer(graphics, createInfo.resourceData.size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, createInfo.resourceData.owner)
|
||||
, Gfx::UniformBuffer(graphics->getFamilyMapping(), createInfo.resourceData)
|
||||
: Gfx::UniformBuffer(graphics->getFamilyMapping(), createInfo.resourceData)
|
||||
, Vulkan::ShaderBuffer(graphics, createInfo.resourceData.size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, createInfo.resourceData.owner)
|
||||
, dedicatedStagingBuffer(nullptr)
|
||||
{
|
||||
if(createInfo.bDynamic)
|
||||
@@ -313,8 +316,8 @@ VkAccessFlags UniformBuffer::getDestAccessMask()
|
||||
}
|
||||
|
||||
StructuredBuffer::StructuredBuffer(PGraphics graphics, const BulkResourceData &resourceData)
|
||||
: Vulkan::ShaderBuffer(graphics, resourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, resourceData.owner)
|
||||
, Gfx::StructuredBuffer(graphics->getFamilyMapping(), resourceData.owner)
|
||||
: Gfx::StructuredBuffer(graphics->getFamilyMapping(), resourceData.owner)
|
||||
, Vulkan::ShaderBuffer(graphics, resourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, resourceData.owner)
|
||||
{
|
||||
if (resourceData.data != nullptr)
|
||||
{
|
||||
@@ -349,8 +352,8 @@ VkAccessFlags StructuredBuffer::getDestAccessMask()
|
||||
}
|
||||
|
||||
VertexBuffer::VertexBuffer(PGraphics graphics, const VertexBufferCreateInfo &resourceData)
|
||||
: Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, resourceData.resourceData.owner)
|
||||
, Gfx::VertexBuffer(graphics->getFamilyMapping(), resourceData.numVertices, resourceData.vertexSize, resourceData.resourceData.owner)
|
||||
: Gfx::VertexBuffer(graphics->getFamilyMapping(), resourceData.numVertices, resourceData.vertexSize, resourceData.resourceData.owner)
|
||||
, Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, resourceData.resourceData.owner)
|
||||
{
|
||||
if (resourceData.resourceData.data != nullptr)
|
||||
{
|
||||
@@ -385,8 +388,8 @@ VkAccessFlags VertexBuffer::getDestAccessMask()
|
||||
}
|
||||
|
||||
IndexBuffer::IndexBuffer(PGraphics graphics, const IndexBufferCreateInfo &resourceData)
|
||||
: Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, resourceData.resourceData.owner)
|
||||
, Gfx::IndexBuffer(graphics->getFamilyMapping(), resourceData.resourceData.size, resourceData.indexType, resourceData.resourceData.owner)
|
||||
: Gfx::IndexBuffer(graphics->getFamilyMapping(), resourceData.resourceData.size, resourceData.indexType, resourceData.resourceData.owner)
|
||||
, Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, resourceData.resourceData.owner)
|
||||
{
|
||||
if (resourceData.resourceData.data != nullptr)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,11 @@ CmdBufferBase::~CmdBufferBase()
|
||||
}
|
||||
|
||||
CmdBuffer::CmdBuffer(PGraphics graphics, VkCommandPool cmdPool, PCommandBufferManager manager)
|
||||
: CmdBufferBase(graphics, cmdPool), renderPass(nullptr), framebuffer(nullptr), subpassIndex(0), manager(manager)
|
||||
: CmdBufferBase(graphics, cmdPool)
|
||||
, manager(manager)
|
||||
, renderPass(nullptr)
|
||||
, framebuffer(nullptr)
|
||||
, subpassIndex(0)
|
||||
{
|
||||
VkCommandBufferAllocateInfo allocInfo =
|
||||
init::CommandBufferAllocateInfo(cmdPool,
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace Seele
|
||||
struct VertexInputStream;
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(RenderPass);
|
||||
DECLARE_REF(Framebuffer);
|
||||
DECLARE_REF(RenderPass)
|
||||
DECLARE_REF(Framebuffer)
|
||||
class CmdBufferBase
|
||||
{
|
||||
public:
|
||||
@@ -27,10 +27,10 @@ protected:
|
||||
VkCommandBuffer handle;
|
||||
VkCommandPool owner;
|
||||
};
|
||||
DEFINE_REF(CmdBufferBase);
|
||||
DEFINE_REF(CmdBufferBase)
|
||||
|
||||
DECLARE_REF(SecondaryCmdBuffer);
|
||||
DECLARE_REF(CommandBufferManager);
|
||||
DECLARE_REF(SecondaryCmdBuffer)
|
||||
DECLARE_REF(CommandBufferManager)
|
||||
class CmdBuffer : public CmdBufferBase
|
||||
{
|
||||
public:
|
||||
@@ -68,10 +68,10 @@ private:
|
||||
friend class CommandBufferManager;
|
||||
friend class Queue;
|
||||
};
|
||||
DEFINE_REF(CmdBuffer);
|
||||
DEFINE_REF(CmdBuffer)
|
||||
|
||||
DECLARE_REF(GraphicsPipeline);
|
||||
DECLARE_REF(DescriptorSet);
|
||||
DECLARE_REF(GraphicsPipeline)
|
||||
DECLARE_REF(DescriptorSet)
|
||||
class SecondaryCmdBuffer : public Gfx::RenderCommand, public CmdBufferBase
|
||||
{
|
||||
public:
|
||||
@@ -94,7 +94,7 @@ private:
|
||||
Array<PDescriptorSet> boundDescriptors;
|
||||
friend class CmdBuffer;
|
||||
};
|
||||
DEFINE_REF(SecondaryCmdBuffer);
|
||||
DEFINE_REF(SecondaryCmdBuffer)
|
||||
|
||||
class CommandBufferManager
|
||||
{
|
||||
@@ -119,6 +119,6 @@ private:
|
||||
std::mutex allocatedBufferLock;
|
||||
Array<PCmdBuffer> allocatedBuffers;
|
||||
};
|
||||
DEFINE_REF(CommandBufferManager);
|
||||
DEFINE_REF(CommandBufferManager)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
@@ -218,7 +218,9 @@ void DescriptorSet::writeChanges()
|
||||
}
|
||||
|
||||
DescriptorAllocator::DescriptorAllocator(PGraphics graphics, DescriptorLayout &layout)
|
||||
: layout(layout), graphics(graphics), currentCachedIndex(0)
|
||||
: graphics(graphics)
|
||||
, layout(layout)
|
||||
, currentCachedIndex(0)
|
||||
{
|
||||
std::memset(&cachedHandles, 0, sizeof(cachedHandles));
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Seele
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(Graphics);
|
||||
DECLARE_REF(Graphics)
|
||||
class DescriptorLayout : public Gfx::DescriptorLayout
|
||||
{
|
||||
public:
|
||||
@@ -24,12 +24,14 @@ private:
|
||||
VkDescriptorSetLayout layoutHandle;
|
||||
friend class DescriptorAllocator;
|
||||
};
|
||||
DEFINE_REF(DescriptorLayout);
|
||||
DEFINE_REF(DescriptorLayout)
|
||||
class PipelineLayout : public Gfx::PipelineLayout
|
||||
{
|
||||
public:
|
||||
PipelineLayout(PGraphics graphics)
|
||||
: graphics(graphics), layoutHash(0), layoutHandle(VK_NULL_HANDLE)
|
||||
: graphics(graphics)
|
||||
, layoutHash(0)
|
||||
, layoutHandle(VK_NULL_HANDLE)
|
||||
{
|
||||
}
|
||||
virtual ~PipelineLayout();
|
||||
@@ -46,11 +48,11 @@ public:
|
||||
|
||||
private:
|
||||
Array<VkDescriptorSetLayout> vulkanDescriptorLayouts;
|
||||
PGraphics graphics;
|
||||
uint32 layoutHash;
|
||||
VkPipelineLayout layoutHandle;
|
||||
PGraphics graphics;
|
||||
};
|
||||
DEFINE_REF(PipelineLayout);
|
||||
DEFINE_REF(PipelineLayout)
|
||||
|
||||
class DescriptorAllocator : public Gfx::DescriptorAllocator
|
||||
{
|
||||
@@ -71,13 +73,13 @@ public:
|
||||
|
||||
private:
|
||||
PGraphics graphics;
|
||||
DescriptorLayout &layout;
|
||||
uint32 currentCachedIndex;
|
||||
const static int maxSets = 512;
|
||||
VkDescriptorSet cachedHandles[maxSets];
|
||||
uint32 currentCachedIndex;
|
||||
VkDescriptorPool poolHandle;
|
||||
DescriptorLayout &layout;
|
||||
};
|
||||
DEFINE_REF(DescriptorAllocator);
|
||||
DEFINE_REF(DescriptorAllocator)
|
||||
|
||||
class DescriptorSet : public Gfx::DescriptorSet
|
||||
{
|
||||
@@ -119,12 +121,12 @@ private:
|
||||
// would not work anyways, so casts should be safe
|
||||
Array<void*> cachedData[Gfx::numFramesBuffered];
|
||||
VkDescriptorSet setHandle[Gfx::numFramesBuffered];
|
||||
PGraphics graphics;
|
||||
PDescriptorAllocator owner;
|
||||
PCmdBuffer currentlyBound;
|
||||
PGraphics graphics;
|
||||
friend class DescriptorAllocator;
|
||||
};
|
||||
DEFINE_REF(DescriptorSet);
|
||||
DEFINE_REF(DescriptorSet)
|
||||
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
@@ -5,7 +5,7 @@ namespace Seele
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(RenderPass);
|
||||
DECLARE_REF(RenderPass)
|
||||
struct FramebufferDescription
|
||||
{
|
||||
VkImageView inputAttachments[16];
|
||||
@@ -35,6 +35,6 @@ private:
|
||||
Gfx::PRenderTargetLayout layout;
|
||||
PRenderPass renderPass;
|
||||
};
|
||||
DEFINE_REF(Framebuffer);
|
||||
DEFINE_REF(Framebuffer)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
@@ -10,12 +10,15 @@
|
||||
#include "VulkanDescriptorSets.h"
|
||||
#include "VulkanShader.h"
|
||||
#include "Graphics/GraphicsResources.h"
|
||||
#include <glfw/glfw3.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
Graphics::Graphics()
|
||||
: callback(VK_NULL_HANDLE), handle(VK_NULL_HANDLE), instance(VK_NULL_HANDLE), physicalDevice(VK_NULL_HANDLE)
|
||||
: instance(VK_NULL_HANDLE)
|
||||
, handle(VK_NULL_HANDLE)
|
||||
, physicalDevice(VK_NULL_HANDLE)
|
||||
, callback(VK_NULL_HANDLE)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -161,7 +164,7 @@ Gfx::PGraphicsPipeline Graphics::createGraphicsPipeline(const GraphicsPipelineCr
|
||||
return pipeline;
|
||||
}
|
||||
|
||||
Gfx::PSamplerState Graphics::createSamplerState(const SamplerCreateInfo& createInfo)
|
||||
Gfx::PSamplerState Graphics::createSamplerState(const SamplerCreateInfo&)
|
||||
{
|
||||
PSamplerState sampler = new SamplerState(); // TODO: proper sampler creation
|
||||
VkSamplerCreateInfo vkInfo =
|
||||
|
||||
@@ -6,13 +6,13 @@ namespace Seele
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(Allocator);
|
||||
DECLARE_REF(StagingManager);
|
||||
DECLARE_REF(CommandBufferManager);
|
||||
DECLARE_REF(Queue);
|
||||
DECLARE_REF(Framebuffer);
|
||||
DECLARE_REF(RenderCommand);
|
||||
DECLARE_REF(PipelineCache);
|
||||
DECLARE_REF(Allocator)
|
||||
DECLARE_REF(StagingManager)
|
||||
DECLARE_REF(CommandBufferManager)
|
||||
DECLARE_REF(Queue)
|
||||
DECLARE_REF(Framebuffer)
|
||||
DECLARE_REF(RenderCommand)
|
||||
DECLARE_REF(PipelineCache)
|
||||
class Graphics : public Gfx::Graphics
|
||||
{
|
||||
public:
|
||||
@@ -72,9 +72,9 @@ protected:
|
||||
void pickPhysicalDevice();
|
||||
void createDevice(GraphicsInitializer initInfo);
|
||||
|
||||
VkInstance instance;
|
||||
VkDevice handle;
|
||||
VkPhysicalDevice physicalDevice;
|
||||
VkInstance instance;
|
||||
|
||||
PQueue graphicsQueue;
|
||||
PQueue computeQueue;
|
||||
@@ -96,6 +96,6 @@ protected:
|
||||
|
||||
friend class Window;
|
||||
};
|
||||
DEFINE_REF(Graphics);
|
||||
DEFINE_REF(Graphics)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
@@ -72,7 +72,8 @@ Semaphore::~Semaphore()
|
||||
}
|
||||
|
||||
Fence::Fence(PGraphics graphics)
|
||||
: graphics(graphics), signaled(false)
|
||||
: graphics(graphics)
|
||||
, signaled(false)
|
||||
{
|
||||
VkFenceCreateInfo info =
|
||||
init::FenceCreateInfo(0);
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace Seele
|
||||
namespace Vulkan
|
||||
{
|
||||
|
||||
DECLARE_REF(DescriptorAllocator);
|
||||
DECLARE_REF(CommandBufferManager);
|
||||
DECLARE_REF(CmdBuffer);
|
||||
DECLARE_REF(Graphics);
|
||||
DECLARE_REF(SubAllocation);
|
||||
DECLARE_REF(DescriptorAllocator)
|
||||
DECLARE_REF(CommandBufferManager)
|
||||
DECLARE_REF(CmdBuffer)
|
||||
DECLARE_REF(Graphics)
|
||||
DECLARE_REF(SubAllocation)
|
||||
class Semaphore
|
||||
{
|
||||
public:
|
||||
@@ -27,7 +27,7 @@ private:
|
||||
VkSemaphore handle;
|
||||
PGraphics graphics;
|
||||
};
|
||||
DEFINE_REF(Semaphore);
|
||||
DEFINE_REF(Semaphore)
|
||||
|
||||
class Fence
|
||||
{
|
||||
@@ -47,11 +47,11 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
PGraphics graphics;
|
||||
bool signaled;
|
||||
VkFence fence;
|
||||
PGraphics graphics;
|
||||
};
|
||||
DEFINE_REF(Fence);
|
||||
DEFINE_REF(Fence)
|
||||
|
||||
class VertexDeclaration : public Gfx::VertexDeclaration
|
||||
{
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
virtual ~VertexDeclaration();
|
||||
private:
|
||||
};
|
||||
DEFINE_REF(VertexDeclaration);
|
||||
DEFINE_REF(VertexDeclaration)
|
||||
|
||||
class QueueOwnedResourceDeletion
|
||||
{
|
||||
@@ -112,12 +112,12 @@ protected:
|
||||
VkBuffer buffer;
|
||||
PSubAllocation allocation;
|
||||
};
|
||||
BufferAllocation buffers[Gfx::numFramesBuffered];
|
||||
uint32 numBuffers;
|
||||
PGraphics graphics;
|
||||
uint32 currentBuffer;
|
||||
uint32 size;
|
||||
PGraphics graphics;
|
||||
Gfx::QueueType currentOwner;
|
||||
BufferAllocation buffers[Gfx::numFramesBuffered];
|
||||
uint32 numBuffers;
|
||||
|
||||
void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner) = 0;
|
||||
@@ -125,9 +125,9 @@ protected:
|
||||
virtual VkAccessFlags getSourceAccessMask() = 0;
|
||||
virtual VkAccessFlags getDestAccessMask() = 0;
|
||||
};
|
||||
DEFINE_REF(ShaderBuffer);
|
||||
DEFINE_REF(ShaderBuffer)
|
||||
|
||||
DECLARE_REF(StagingBuffer);
|
||||
DECLARE_REF(StagingBuffer)
|
||||
class UniformBuffer : public Gfx::UniformBuffer, public ShaderBuffer
|
||||
{
|
||||
public:
|
||||
@@ -147,7 +147,7 @@ protected:
|
||||
private:
|
||||
PStagingBuffer dedicatedStagingBuffer;
|
||||
};
|
||||
DEFINE_REF(UniformBuffer);
|
||||
DEFINE_REF(UniformBuffer)
|
||||
|
||||
class StructuredBuffer : public Gfx::StructuredBuffer, public ShaderBuffer
|
||||
{
|
||||
@@ -163,7 +163,7 @@ protected:
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
};
|
||||
DEFINE_REF(StructuredBuffer);
|
||||
DEFINE_REF(StructuredBuffer)
|
||||
|
||||
class VertexBuffer : public Gfx::VertexBuffer, public ShaderBuffer
|
||||
{
|
||||
@@ -179,7 +179,7 @@ protected:
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
};
|
||||
DEFINE_REF(VertexBuffer);
|
||||
DEFINE_REF(VertexBuffer)
|
||||
|
||||
class IndexBuffer : public Gfx::IndexBuffer, public ShaderBuffer
|
||||
{
|
||||
@@ -195,7 +195,7 @@ protected:
|
||||
// Inherited via QueueOwnedResource
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
};
|
||||
DEFINE_REF(IndexBuffer);
|
||||
DEFINE_REF(IndexBuffer)
|
||||
|
||||
class TextureHandle
|
||||
{
|
||||
@@ -303,14 +303,14 @@ protected:
|
||||
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
|
||||
|
||||
};
|
||||
DEFINE_REF(Texture2D);
|
||||
DEFINE_REF(Texture2D)
|
||||
|
||||
class SamplerState : public Gfx::SamplerState
|
||||
{
|
||||
public:
|
||||
VkSampler sampler;
|
||||
};
|
||||
DEFINE_REF(SamplerState);
|
||||
DEFINE_REF(SamplerState)
|
||||
|
||||
class Window : public Gfx::Window
|
||||
{
|
||||
@@ -347,10 +347,11 @@ protected:
|
||||
PSemaphore imageAcquiredSemaphore;
|
||||
|
||||
PGraphics graphics;
|
||||
VkFormat pixelFormat;
|
||||
VkSampleCountFlags numSamples;
|
||||
VkPresentModeKHR presentMode;
|
||||
VkInstance instance;
|
||||
VkSwapchainKHR swapchain;
|
||||
VkSampleCountFlags numSamples;
|
||||
VkFormat pixelFormat;
|
||||
VkPresentModeKHR presentMode;
|
||||
VkSurfaceKHR surface;
|
||||
VkSurfaceFormatKHR surfaceFormat;
|
||||
void *windowHandle;
|
||||
@@ -358,9 +359,8 @@ protected:
|
||||
int32 acquiredImageIndex;
|
||||
int32 preAcquiredImageIndex;
|
||||
int32 semaphoreIndex;
|
||||
VkInstance instance;
|
||||
};
|
||||
DEFINE_REF(Window);
|
||||
DEFINE_REF(Window)
|
||||
|
||||
class Viewport : public Gfx::Viewport
|
||||
{
|
||||
@@ -375,6 +375,6 @@ private:
|
||||
PGraphics graphics;
|
||||
friend class Graphics;
|
||||
};
|
||||
DECLARE_REF(Viewport);
|
||||
DECLARE_REF(Viewport)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Seele
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(PipelineLayout);
|
||||
DECLARE_REF(Graphics);
|
||||
DECLARE_REF(PipelineLayout)
|
||||
DECLARE_REF(Graphics)
|
||||
class GraphicsPipeline : public Gfx::GraphicsPipeline
|
||||
{
|
||||
public:
|
||||
@@ -15,9 +15,9 @@ public:
|
||||
void bind(VkCommandBuffer handle);
|
||||
VkPipelineLayout getLayout() const;
|
||||
private:
|
||||
VkPipeline pipeline;
|
||||
PGraphics graphics;
|
||||
VkPipeline pipeline;
|
||||
};
|
||||
DEFINE_REF(GraphicsPipeline);
|
||||
DEFINE_REF(GraphicsPipeline)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
@@ -17,6 +17,6 @@ private:
|
||||
std::string cacheFile;
|
||||
Map<uint32, VkPipeline> createdPipelines;
|
||||
};
|
||||
DEFINE_REF(PipelineCache);
|
||||
DEFINE_REF(PipelineCache)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
@@ -9,7 +9,9 @@ using namespace Seele;
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
Queue::Queue(PGraphics graphics, Gfx::QueueType queueType, uint32 familyIndex, uint32 queueIndex)
|
||||
: familyIndex(familyIndex), graphics(graphics), queueType(queueType)
|
||||
: graphics(graphics)
|
||||
, familyIndex(familyIndex)
|
||||
, queueType(queueType)
|
||||
{
|
||||
vkGetDeviceQueue(graphics->getDevice(), familyIndex, queueIndex, &queue);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ namespace Seele
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(CmdBuffer);
|
||||
DECLARE_REF(Graphics);
|
||||
DECLARE_REF(CmdBuffer)
|
||||
DECLARE_REF(Graphics)
|
||||
class Queue
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -38,6 +38,6 @@ private:
|
||||
VkRect2D renderArea;
|
||||
VkSubpassContents subpassContents;
|
||||
};
|
||||
DEFINE_REF(RenderPass);
|
||||
DEFINE_REF(RenderPass)
|
||||
} // namespace Vulkan
|
||||
} // namespace Seele
|
||||
@@ -2,8 +2,7 @@
|
||||
#include "VulkanGraphics.h"
|
||||
#include "VulkanDescriptorSets.h"
|
||||
#include "slang.h"
|
||||
#include "spirv_cross/spirv_reflect.hpp"
|
||||
#include <fstream>
|
||||
//#include "spirv_cross/spirv_reflect.hpp"
|
||||
|
||||
using namespace slang;
|
||||
using namespace Seele;
|
||||
|
||||
@@ -6,8 +6,8 @@ namespace Seele
|
||||
{
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(Graphics);
|
||||
DECLARE_REF(DescriptorLayout);
|
||||
DECLARE_REF(Graphics)
|
||||
DECLARE_REF(DescriptorLayout)
|
||||
class Shader
|
||||
{
|
||||
public:
|
||||
@@ -31,12 +31,12 @@ private:
|
||||
PGraphics graphics;
|
||||
Map<uint32, PDescriptorLayout> descriptorSets;
|
||||
VkShaderModule module;
|
||||
VkShaderStageFlags stage;
|
||||
ShaderType type;
|
||||
VkShaderStageFlags stage;
|
||||
std::string entryPointName;
|
||||
uint32 hash;
|
||||
};
|
||||
DEFINE_REF(Shader);
|
||||
DEFINE_REF(Shader)
|
||||
|
||||
template <typename Base, ShaderType shaderType, VkShaderStageFlags stageFlags>
|
||||
class ShaderBase : public Base, public Shader
|
||||
@@ -57,12 +57,12 @@ typedef ShaderBase<Gfx::GeometryShader, ShaderType::GEOMETRY, VK_SHADER_STAGE_GE
|
||||
typedef ShaderBase<Gfx::FragmentShader, ShaderType::FRAGMENT, VK_SHADER_STAGE_FRAGMENT_BIT> FragmentShader;
|
||||
typedef ShaderBase<Gfx::ComputeShader, ShaderType::COMPUTE, VK_SHADER_STAGE_COMPUTE_BIT> ComputeShader;
|
||||
|
||||
DEFINE_REF(VertexShader);
|
||||
DEFINE_REF(ControlShader);
|
||||
DEFINE_REF(EvaluationShader);
|
||||
DEFINE_REF(GeometryShader);
|
||||
DEFINE_REF(FragmentShader);
|
||||
DEFINE_REF(ComputeShader);
|
||||
DEFINE_REF(VertexShader)
|
||||
DEFINE_REF(ControlShader)
|
||||
DEFINE_REF(EvaluationShader)
|
||||
DEFINE_REF(GeometryShader)
|
||||
DEFINE_REF(FragmentShader)
|
||||
DEFINE_REF(ComputeShader)
|
||||
|
||||
} // namespace Vulkan
|
||||
}
|
||||
@@ -36,13 +36,13 @@ TextureHandle::TextureHandle(PGraphics graphics, VkImageViewType viewType,
|
||||
, sizeX(createInfo.width)
|
||||
, sizeY(createInfo.height)
|
||||
, sizeZ(createInfo.depth)
|
||||
, mipLevels(createInfo.mipLevels)
|
||||
, format(createInfo.format)
|
||||
, samples(createInfo.samples)
|
||||
, usage(createInfo.usage)
|
||||
, arrayCount(createInfo.bArray ? createInfo.arrayLayers : 1)
|
||||
, aspect(getAspectFromFormat(createInfo.format))
|
||||
, mipLevels(createInfo.mipLevels)
|
||||
, samples(createInfo.samples)
|
||||
, format(createInfo.format)
|
||||
, usage(createInfo.usage)
|
||||
, image(existingImage)
|
||||
, aspect(getAspectFromFormat(createInfo.format))
|
||||
, layout(VK_IMAGE_LAYOUT_UNDEFINED)
|
||||
{
|
||||
if (existingImage == VK_NULL_HANDLE)
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
#include "VulkanInitializer.h"
|
||||
#include "VulkanGraphicsEnums.h"
|
||||
#include "VulkanCommandBuffer.h"
|
||||
#include <glfw/glfw3.h>
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
using namespace Seele;
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
void glfwKeyCallback(GLFWwindow* handle, int key, int scancode, int action, int modifier)
|
||||
void glfwKeyCallback(GLFWwindow* handle, int key, int action, int, int modifier)
|
||||
{
|
||||
Window* window = (Window*)glfwGetWindowUserPointer(handle);
|
||||
window->keyCallback((KeyCode)key, (InputAction)action, (KeyModifier)modifier);
|
||||
@@ -39,7 +39,12 @@ void glfwFileCallback(GLFWwindow* handle, int count, const char** paths)
|
||||
}
|
||||
|
||||
Window::Window(PGraphics graphics, const WindowCreateInfo &createInfo)
|
||||
: Gfx::Window(createInfo), graphics(graphics), instance(graphics->getInstance()), swapchain(VK_NULL_HANDLE), numSamples(createInfo.numSamples), pixelFormat(cast(createInfo.pixelFormat))
|
||||
: Gfx::Window(createInfo)
|
||||
, graphics(graphics)
|
||||
, instance(graphics->getInstance())
|
||||
, swapchain(VK_NULL_HANDLE)
|
||||
, numSamples(createInfo.numSamples)
|
||||
, pixelFormat(cast(createInfo.pixelFormat))
|
||||
{
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
GLFWwindow *handle = glfwCreateWindow(createInfo.width, createInfo.height, createInfo.title, createInfo.bFullscreen ? glfwGetPrimaryMonitor() : nullptr, nullptr);
|
||||
@@ -207,6 +212,7 @@ void Window::present()
|
||||
{
|
||||
presentResult = vkQueuePresentKHR(graphics->getGraphicsCommands()->getQueue()->getHandle(), &info);
|
||||
}
|
||||
Gfx::currentFrameIndex = (Gfx::currentFrameIndex + 1)%Gfx::numFramesBuffered;
|
||||
}
|
||||
|
||||
void Window::createSwapchain()
|
||||
|
||||
Reference in New Issue
Block a user