Namespace refactoring to avoid prefixing everything with Vulkan
This commit is contained in:
@@ -64,8 +64,6 @@ target_link_libraries(SeeleEngine ${Vulkan_LIBRARY})
|
|||||||
target_link_libraries(SeeleEngine glfw ${GLFW_LIBRARIES})
|
target_link_libraries(SeeleEngine glfw ${GLFW_LIBRARIES})
|
||||||
target_link_libraries(SeeleEngine ${SLANG_LIBRARY})
|
target_link_libraries(SeeleEngine ${SLANG_LIBRARY})
|
||||||
|
|
||||||
message(Libs: ${GLFW_LIBRARIES})
|
|
||||||
|
|
||||||
add_subdirectory(test/)
|
add_subdirectory(test/)
|
||||||
|
|
||||||
add_custom_command(TARGET SeeleEngine POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEPENDENT_BINARIES} $<TARGET_FILE_DIR:SeeleEngine>)
|
add_custom_command(TARGET SeeleEngine POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${DEPENDENT_BINARIES} $<TARGET_FILE_DIR:SeeleEngine>)
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
#include "Graphics.h"
|
#include "Graphics.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
Seele::Graphics::Graphics()
|
using namespace Seele::Gfx;
|
||||||
|
|
||||||
|
Graphics::Graphics()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Seele::Graphics::~Graphics()
|
Graphics::~Graphics()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,8 @@
|
|||||||
#include "Containers/Array.h"
|
#include "Containers/Array.h"
|
||||||
|
|
||||||
namespace Seele {
|
namespace Seele {
|
||||||
|
namespace Gfx
|
||||||
|
{
|
||||||
class Window;
|
class Window;
|
||||||
class Graphics
|
class Graphics
|
||||||
{
|
{
|
||||||
@@ -18,4 +20,5 @@ namespace Seele {
|
|||||||
friend class Window;
|
friend class Window;
|
||||||
};
|
};
|
||||||
DEFINE_REF(Graphics);
|
DEFINE_REF(Graphics);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,8 @@
|
|||||||
#include "MinimalEngine.h"
|
#include "MinimalEngine.h"
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
|
namespace Gfx
|
||||||
|
{
|
||||||
typedef uint32_t SeFlags;
|
typedef uint32_t SeFlags;
|
||||||
typedef uint32_t SeBool32;
|
typedef uint32_t SeBool32;
|
||||||
typedef uint64_t SeDeviceSize;
|
typedef uint64_t SeDeviceSize;
|
||||||
@@ -1765,4 +1767,5 @@ namespace Seele
|
|||||||
SE_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
SE_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||||
} SeStencilFaceFlagBits;
|
} SeStencilFaceFlagBits;
|
||||||
typedef SeFlags SeStencilFaceFlags;
|
typedef SeFlags SeStencilFaceFlags;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "GraphicsResources.h"
|
#include "GraphicsResources.h"
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele::Gfx;
|
||||||
|
|
||||||
void Seele::DescriptorLayout::addDescriptorBinding(uint32 bindingIndex, SeDescriptorType type, uint32 arrayCount)
|
void DescriptorLayout::addDescriptorBinding(uint32 bindingIndex, SeDescriptorType type, uint32 arrayCount)
|
||||||
{
|
{
|
||||||
if (descriptorBindings.size() <= bindingIndex)
|
if (descriptorBindings.size() <= bindingIndex)
|
||||||
{
|
{
|
||||||
@@ -15,14 +15,14 @@ void Seele::DescriptorLayout::addDescriptorBinding(uint32 bindingIndex, SeDescri
|
|||||||
descriptorBindings[bindingIndex] = binding;
|
descriptorBindings[bindingIndex] = binding;
|
||||||
}
|
}
|
||||||
|
|
||||||
PDescriptorSet Seele::DescriptorLayout::allocatedDescriptorSet()
|
PDescriptorSet DescriptorLayout::allocatedDescriptorSet()
|
||||||
{
|
{
|
||||||
PDescriptorSet result;
|
PDescriptorSet result;
|
||||||
allocator->allocateDescriptorSet(result);
|
allocator->allocateDescriptorSet(result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayout layout)
|
void PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayout layout)
|
||||||
{
|
{
|
||||||
if (descriptorSetLayouts.size() <= setIndex)
|
if (descriptorSetLayouts.size() <= setIndex)
|
||||||
{
|
{
|
||||||
@@ -48,7 +48,7 @@ void Seele::PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::PipelineLayout::addPushConstants(const SePushConstantRange& pushConstant)
|
void PipelineLayout::addPushConstants(const SePushConstantRange& pushConstant)
|
||||||
{
|
{
|
||||||
pushConstants.add(pushConstant);
|
pushConstants.add(pushConstant);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,6 @@
|
|||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
struct SePushConstantRange {
|
|
||||||
SeShaderStageFlags stageFlags;
|
|
||||||
uint32_t offset;
|
|
||||||
uint32_t size;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct GraphicsInitializer
|
struct GraphicsInitializer
|
||||||
{
|
{
|
||||||
const char* windowLayoutFile;
|
const char* windowLayoutFile;
|
||||||
@@ -46,7 +40,6 @@ namespace Seele
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
DECLARE_REF(Graphics);
|
|
||||||
struct WindowCreateInfo
|
struct WindowCreateInfo
|
||||||
{
|
{
|
||||||
int32 width;
|
int32 width;
|
||||||
@@ -54,12 +47,22 @@ namespace Seele
|
|||||||
const char* title;
|
const char* title;
|
||||||
bool bFullscreen;
|
bool bFullscreen;
|
||||||
};
|
};
|
||||||
|
namespace Gfx
|
||||||
|
{
|
||||||
|
struct SePushConstantRange {
|
||||||
|
SeShaderStageFlags stageFlags;
|
||||||
|
uint32_t offset;
|
||||||
|
uint32_t size;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class RenderCommandBase
|
class RenderCommandBase
|
||||||
{
|
{
|
||||||
|
|
||||||
};
|
};
|
||||||
DEFINE_REF(RenderCommandBase);
|
DEFINE_REF(RenderCommandBase);
|
||||||
|
|
||||||
class SamplerState
|
class SamplerState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -127,7 +130,7 @@ namespace Seele
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DescriptorLayout() {}
|
DescriptorLayout() {}
|
||||||
virtual ~DescriptorLayout(){}
|
virtual ~DescriptorLayout() {}
|
||||||
void operator=(const DescriptorLayout& other)
|
void operator=(const DescriptorLayout& other)
|
||||||
{
|
{
|
||||||
descriptorBindings.resize(other.descriptorBindings.size());
|
descriptorBindings.resize(other.descriptorBindings.size());
|
||||||
@@ -220,4 +223,5 @@ namespace Seele
|
|||||||
|
|
||||||
};
|
};
|
||||||
DEFINE_REF(RenderPass);
|
DEFINE_REF(RenderPass);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "RenderPath.h"
|
#include "RenderPath.h"
|
||||||
|
|
||||||
Seele::RenderPath::RenderPath(PGraphics graphics)
|
Seele::RenderPath::RenderPath(Gfx::PGraphics graphics)
|
||||||
: graphics(graphics)
|
: graphics(graphics)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace Seele
|
|||||||
class RenderPath
|
class RenderPath
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RenderPath(PGraphics graphics);
|
RenderPath(Gfx::PGraphics graphics);
|
||||||
virtual ~RenderPath();
|
virtual ~RenderPath();
|
||||||
virtual void applyArea(Rect area) = 0;
|
virtual void applyArea(Rect area) = 0;
|
||||||
virtual void init() = 0;
|
virtual void init() = 0;
|
||||||
@@ -14,7 +14,7 @@ namespace Seele
|
|||||||
virtual void render() = 0;
|
virtual void render() = 0;
|
||||||
virtual void endFrame() = 0;
|
virtual void endFrame() = 0;
|
||||||
protected:
|
protected:
|
||||||
PGraphics graphics;
|
Gfx::PGraphics graphics;
|
||||||
Rect area;
|
Rect area;
|
||||||
};
|
};
|
||||||
DEFINE_REF(RenderPath);
|
DEFINE_REF(RenderPath);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "SceneRenderPath.h"
|
#include "SceneRenderPath.h"
|
||||||
|
|
||||||
Seele::SceneRenderPath::SceneRenderPath(PGraphics graphics)
|
Seele::SceneRenderPath::SceneRenderPath(Gfx::PGraphics graphics)
|
||||||
: RenderPath(graphics)
|
: RenderPath(graphics)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace Seele
|
|||||||
class SceneRenderPath : public RenderPath
|
class SceneRenderPath : public RenderPath
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SceneRenderPath(PGraphics graphics);
|
SceneRenderPath(Gfx::PGraphics graphics);
|
||||||
virtual ~SceneRenderPath();
|
virtual ~SceneRenderPath();
|
||||||
virtual void applyArea(Rect area) override;
|
virtual void applyArea(Rect area) override;
|
||||||
virtual void init() override;
|
virtual void init() override;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "SceneView.h"
|
#include "SceneView.h"
|
||||||
#include "SceneRenderPath.h"
|
#include "SceneRenderPath.h"
|
||||||
|
|
||||||
Seele::SceneView::SceneView(PGraphics graphics)
|
Seele::SceneView::SceneView(Gfx::PGraphics graphics)
|
||||||
: View(graphics)
|
: View(graphics)
|
||||||
{
|
{
|
||||||
renderer = new SceneRenderPath(graphics);
|
renderer = new SceneRenderPath(graphics);
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace Seele
|
|||||||
class SceneView : public View
|
class SceneView : public View
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SceneView(PGraphics graphics);
|
SceneView(Gfx::PGraphics graphics);
|
||||||
~SceneView();
|
~SceneView();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "View.h"
|
#include "View.h"
|
||||||
|
|
||||||
Seele::View::View(PGraphics graphics)
|
Seele::View::View(Gfx::PGraphics graphics)
|
||||||
: graphics(graphics)
|
: graphics(graphics)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,18 +2,17 @@
|
|||||||
#include "RenderPath.h"
|
#include "RenderPath.h"
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
DECLARE_REF(Graphics);
|
|
||||||
// A view is a part of the window, which can be anything from a viewport to an editor
|
// A view is a part of the window, which can be anything from a viewport to an editor
|
||||||
class View
|
class View
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
View(PGraphics graphics);
|
View(Gfx::PGraphics graphics);
|
||||||
virtual ~View();
|
virtual ~View();
|
||||||
void beginFrame();
|
void beginFrame();
|
||||||
void endFrame();
|
void endFrame();
|
||||||
void applyArea(Rect area);
|
void applyArea(Rect area);
|
||||||
protected:
|
protected:
|
||||||
PGraphics graphics;
|
Gfx::PGraphics graphics;
|
||||||
PRenderPath renderer;
|
PRenderPath renderer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ target_sources(SeeleEngine
|
|||||||
PRIVATE
|
PRIVATE
|
||||||
VulkanAllocator.h
|
VulkanAllocator.h
|
||||||
VulkanAllocator.cpp
|
VulkanAllocator.cpp
|
||||||
|
VulkanBuffer.cpp
|
||||||
VulkanGraphics.h
|
VulkanGraphics.h
|
||||||
VulkanGraphics.cpp
|
VulkanGraphics.cpp
|
||||||
VulkanGraphicsResources.h
|
VulkanGraphicsResources.h
|
||||||
|
|||||||
@@ -1,6 +1,80 @@
|
|||||||
#include "VulkanAllocator.h"
|
#include "VulkanAllocator.h"
|
||||||
#include "VulkanGraphics.h"
|
#include "VulkanGraphics.h"
|
||||||
Seele::VulkanAllocator::VulkanAllocator(PVulkanGraphics graphics)
|
#include "VulkanInitializer.h"
|
||||||
|
#include "Math/MemCRC.h"
|
||||||
|
|
||||||
|
using namespace Seele::Vulkan;
|
||||||
|
|
||||||
|
SubAllocation::SubAllocation(Allocation* owner, uint32 allocatedOffset, uint32 size, uint32 alignedOffset, uint32 allocatedSize)
|
||||||
|
: owner(owner)
|
||||||
|
, size(size)
|
||||||
|
, allocatedOffset(allocatedOffset)
|
||||||
|
, alignedOffset(alignedOffset)
|
||||||
|
, allocatedSize(allocatedSize)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Allocation::Allocation(PGraphics graphics, Allocator* allocator, uint32 size, uint32 memoryTypeIndex, VkMemoryPropertyFlags properties, bool isDedicated)
|
||||||
|
: device(graphics->getDevice())
|
||||||
|
, allocator(allocator)
|
||||||
|
, bytesAllocated(0)
|
||||||
|
, bytesUsed(0)
|
||||||
|
, properties(properties)
|
||||||
|
, memoryTypeIndex(memoryTypeIndex)
|
||||||
|
{
|
||||||
|
VkMemoryAllocateInfo allocInfo =
|
||||||
|
init::MemoryAllocateInfo();
|
||||||
|
allocInfo.allocationSize = size;
|
||||||
|
allocInfo.memoryTypeIndex = memoryTypeIndex;
|
||||||
|
VK_CHECK(vkAllocateMemory(device, &allocInfo, nullptr, &allocatedMemory));
|
||||||
|
bytesAllocated = size;
|
||||||
|
PSubAllocation freeRange = new SubAllocation(this, 0, size, 0, size);
|
||||||
|
freeRanges.add(freeRange);
|
||||||
|
}
|
||||||
|
|
||||||
|
PSubAllocation Allocation::getSuballocation(uint32 size, uint32 alignment)
|
||||||
|
{
|
||||||
|
if (isDedicated)
|
||||||
|
{
|
||||||
|
if (activeAllocations.size() == 0)
|
||||||
|
{
|
||||||
|
assert(size == bytesAllocated);
|
||||||
|
activeAllocations.add(freeRanges.back());
|
||||||
|
freeRanges.clear();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (int i = 0; i < freeRanges.size(); ++i)
|
||||||
|
{
|
||||||
|
PSubAllocation freeAllocation = freeRanges[i];
|
||||||
|
uint32 allocatedOffset = freeAllocation->allocatedOffset;
|
||||||
|
uint32 alignedOffset = align(allocatedOffset, alignment);
|
||||||
|
uint32 alignmentAdjustment = alignedOffset - allocatedOffset;
|
||||||
|
uint32 size = alignmentAdjustment + size;
|
||||||
|
if (freeAllocation->size == size)
|
||||||
|
{
|
||||||
|
freeRanges.remove(i);
|
||||||
|
activeAllocations.add(freeAllocation);
|
||||||
|
return freeAllocation;
|
||||||
|
}
|
||||||
|
else if (size < freeAllocation->allocatedSize)
|
||||||
|
{
|
||||||
|
freeAllocation->size -= size;
|
||||||
|
freeAllocation->allocatedSize -= size;
|
||||||
|
freeAllocation->allocatedOffset += allocatedOffset;
|
||||||
|
freeAllocation->alignedOffset += allocatedOffset;
|
||||||
|
PSubAllocation subAlloc = new VulkanSubAllocation(this, allocatedOffset, size, alignedOffset, size);
|
||||||
|
activeAllocations.add(subAlloc);
|
||||||
|
return subAlloc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
Allocator::Allocator(PGraphics graphics)
|
||||||
: graphics(graphics)
|
: graphics(graphics)
|
||||||
{
|
{
|
||||||
vkGetPhysicalDeviceMemoryProperties(graphics->getPhysicalDevice(), &memProperties);
|
vkGetPhysicalDeviceMemoryProperties(graphics->getPhysicalDevice(), &memProperties);
|
||||||
@@ -11,19 +85,39 @@ Seele::VulkanAllocator::VulkanAllocator(PVulkanGraphics graphics)
|
|||||||
HeapInfo& heapInfo = heaps[i];
|
HeapInfo& heapInfo = heaps[i];
|
||||||
heapInfo.maxSize = memoryHeap.size;
|
heapInfo.maxSize = memoryHeap.size;
|
||||||
}
|
}
|
||||||
for (size_t i = 0; i < memProperties.memoryTypeCount; i++)
|
}
|
||||||
|
|
||||||
|
Allocator::~Allocator()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
PSubAllocation Allocator::allocate(uint64 size, const VkMemoryRequirements2& memRequirements2, VkMemoryPropertyFlags properties)
|
||||||
|
{
|
||||||
|
// no suitable allocations found, allocate new block
|
||||||
|
const VkMemoryRequirements& requirements = memRequirements2.memoryRequirements;
|
||||||
|
uint32 memoryTypeIndex;
|
||||||
|
VK_CHECK(findMemoryType(requirements.memoryTypeBits, properties, &memoryTypeIndex));
|
||||||
|
|
||||||
|
bool isDedicated = memRequirements2.pNext != nullptr;
|
||||||
|
PAllocation newAllocation = new Allocation(graphics, this, MemoryBlockSize, memoryTypeIndex, properties, isDedicated);
|
||||||
|
uint32 heapIndex = memProperties.memoryTypes[memoryTypeIndex].heapIndex;
|
||||||
|
heaps[heapIndex].allocations.add(newAllocation);
|
||||||
|
return newAllocation->getSuballocation(size, requirements.alignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
VkResult Allocator::findMemoryType(uint32 typeBits, VkMemoryPropertyFlags properties, uint32* typeIndex)
|
||||||
|
{
|
||||||
|
for (int memoryIndex = 0; memoryIndex < memProperties.memoryTypeCount && typeBits; ++memoryIndex)
|
||||||
{
|
{
|
||||||
VkMemoryType& type = memProperties.memoryTypes[i];
|
if ((typeBits & 1) == 1)
|
||||||
HeapInfo& heapInfo = heaps[type.heapIndex];
|
{
|
||||||
heapInfo.types.add(type);
|
if ((memProperties.memoryTypes[memoryIndex].propertyFlags & properties) == properties)
|
||||||
|
{
|
||||||
|
*typeIndex = memoryIndex;
|
||||||
|
return VK_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
typeBits >>= 1;
|
||||||
Seele::VulkanAllocator::~VulkanAllocator()
|
}
|
||||||
{
|
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||||
}
|
|
||||||
|
|
||||||
Seele::PVulkanSubAllocation Seele::VulkanAllocator::allocate(uint64 size, VkMemoryPropertyFlags properties)
|
|
||||||
{
|
|
||||||
return PVulkanSubAllocation();
|
|
||||||
}
|
}
|
||||||
@@ -6,38 +6,69 @@
|
|||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
DECLARE_REF(VulkanGraphics);
|
namespace Vulkan
|
||||||
class VulkanSubAllocation
|
|
||||||
{
|
{
|
||||||
|
DECLARE_REF(Graphics);
|
||||||
};
|
class Allocation;
|
||||||
DEFINE_REF(VulkanSubAllocation);
|
class Allocator;
|
||||||
class VulkanAllocation
|
class SubAllocation
|
||||||
{
|
{
|
||||||
|
public:
|
||||||
|
SubAllocation(Allocation* owner, uint32 allocatedOffset, uint32 size, uint32 alignedOffset, uint32 allocatedSize);
|
||||||
private:
|
private:
|
||||||
|
Allocation* owner;
|
||||||
|
uint32 allocatedOffset;
|
||||||
|
uint32 size;
|
||||||
|
uint32 alignedOffset;
|
||||||
|
uint32 allocatedSize;
|
||||||
|
friend class Allocation;
|
||||||
|
friend class Allocator;
|
||||||
|
};
|
||||||
|
DEFINE_REF(SubAllocation);
|
||||||
|
class Allocation
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Allocation(PGraphics graphics, Allocator* allocator, uint32 size, uint32 memoryTypeIndex, VkMemoryPropertyFlags properties, bool isDedicated);
|
||||||
|
PSubAllocation getSuballocation(uint32 size, uint32 alignment);
|
||||||
|
private:
|
||||||
|
Allocator* allocator;
|
||||||
|
VkDevice device;
|
||||||
VkDeviceMemory allocatedMemory;
|
VkDeviceMemory allocatedMemory;
|
||||||
VkDeviceSize bytesAllocated;
|
VkDeviceSize bytesAllocated;
|
||||||
VkDeviceSize bytesUsed;
|
VkDeviceSize bytesUsed;
|
||||||
uint8 isDedicated;
|
VkMemoryPropertyFlags properties;
|
||||||
|
Array<PSubAllocation> activeAllocations;
|
||||||
|
Array<PSubAllocation> freeRanges;
|
||||||
|
void* mappedPointer;
|
||||||
|
uint8 isDedicated : 1;
|
||||||
|
uint8 canMap : 1;
|
||||||
|
uint8 memoryTypeIndex;
|
||||||
|
friend class Allocator;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanAllocation);
|
DEFINE_REF(Allocation);
|
||||||
|
|
||||||
class VulkanAllocator
|
class Allocator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VulkanAllocator(PVulkanGraphics graphics);
|
Allocator(PGraphics graphics);
|
||||||
~VulkanAllocator();
|
~Allocator();
|
||||||
PVulkanSubAllocation allocate(uint64 size, VkMemoryPropertyFlags properties);
|
PSubAllocation allocate(uint64 size, const VkMemoryRequirements2& requirements, VkMemoryPropertyFlags props);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
MemoryBlockSize = 64 * 1024 * 1024 // 64MB
|
||||||
|
};
|
||||||
struct HeapInfo
|
struct HeapInfo
|
||||||
{
|
{
|
||||||
uint32 maxSize = 0;
|
uint32 maxSize = 0;
|
||||||
Array<VulkanAllocation> allocations;
|
Array<PAllocation> allocations;
|
||||||
Array<VkMemoryType> types;
|
|
||||||
};
|
};
|
||||||
Array<HeapInfo> heaps;
|
Array<HeapInfo> heaps;
|
||||||
PVulkanGraphics graphics;
|
VkResult findMemoryType(uint32 typeBits, VkMemoryPropertyFlags properties, uint32* typeIndex);
|
||||||
|
PGraphics graphics;
|
||||||
VkPhysicalDeviceMemoryProperties memProperties;
|
VkPhysicalDeviceMemoryProperties memProperties;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanAllocator);
|
DEFINE_REF(Allocator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
#include "VulkanGraphicsResources.h"
|
||||||
|
|
||||||
|
using namespace Seele::Vulkan;
|
||||||
|
|
||||||
|
void Buffer::executeOwnershipBarrier(QueueType newOwner)
|
||||||
|
{
|
||||||
|
VkBufferMemoryBarrier barrier =
|
||||||
|
init::BufferMemoryBarrier();
|
||||||
|
CommandBufferManager* sourceManager = getCommands();
|
||||||
|
CommandBufferManager* dstManager = nullptr;
|
||||||
|
VkPipelineStageFlags srcStage = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
|
||||||
|
VkPipelineStageFlags dstStage = VK_PIPELINE_STAGE_ALL_COMMANDS_BIT;
|
||||||
|
if (currentOwner == QueueType::TRANSFER)
|
||||||
|
{
|
||||||
|
barrier.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
|
||||||
|
barrier.srcQueueFamilyIndex = device->getTransferQueue()->getFamilyIndex();
|
||||||
|
srcStage = VK_PIPELINE_STAGE_TRANSFER_BIT;
|
||||||
|
}
|
||||||
|
else if (currentOwner == QueueType::COMPUTE)
|
||||||
|
{
|
||||||
|
barrier.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT;
|
||||||
|
barrier.srcQueueFamilyIndex = device->getComputeQueue()->getFamilyIndex();
|
||||||
|
srcStage = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||||
|
}
|
||||||
|
else if (currentOwner == QueueType::GRAPHICS)
|
||||||
|
{
|
||||||
|
barrier.srcAccessMask = getSourceAccessMask();
|
||||||
|
barrier.srcQueueFamilyIndex = device->getGraphicsQueue()->getFamilyIndex();
|
||||||
|
srcStage = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT;
|
||||||
|
}
|
||||||
|
if (newOwner == QueueType::TRANSFER)
|
||||||
|
{
|
||||||
|
barrier.dstAccessMask = VK_ACCESS_TRANSFER_READ_BIT;
|
||||||
|
barrier.dstQueueFamilyIndex = device->getTransferQueue()->getFamilyIndex();
|
||||||
|
dstStage = VK_PIPELINE_STAGE_TRANSFER_BIT;
|
||||||
|
dstManager = device->getRHIDevice().getTransferCommands();
|
||||||
|
}
|
||||||
|
else if (newOwner == QueueType::COMPUTE)
|
||||||
|
{
|
||||||
|
barrier.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
|
||||||
|
barrier.dstQueueFamilyIndex = device->getComputeQueue()->getFamilyIndex();
|
||||||
|
dstStage = VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT;
|
||||||
|
dstManager = device->getRHIDevice().getComputeCommands();
|
||||||
|
}
|
||||||
|
else if (newOwner == QueueType::GRAPHICS)
|
||||||
|
{
|
||||||
|
barrier.dstAccessMask = getDestAccessMask();
|
||||||
|
barrier.dstQueueFamilyIndex = device->getGraphicsQueue()->getFamilyIndex();
|
||||||
|
dstStage = VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT;
|
||||||
|
dstManager = device->getRHIDevice().getGraphicsCommands();
|
||||||
|
}
|
||||||
|
VkCommandBuffer srcCommand = sourceManager->getCmdBuffer()->getHandle();
|
||||||
|
VkCommandBuffer dstCommand = dstManager->getCmdBuffer()->getHandle();
|
||||||
|
const bool bDynamic = (rhiUsage & BUF_Dynamic) != 0;
|
||||||
|
uint32_t numBuffers = bDynamic ? NUM_BUFFERS : 1;
|
||||||
|
VkBufferMemoryBarrier dynamicBarriers[NUM_BUFFERS];
|
||||||
|
for (uint32_t i = 0; i < numBuffers; ++i)
|
||||||
|
{
|
||||||
|
dynamicBarriers[i] = barrier;
|
||||||
|
dynamicBarriers[i].buffer = buffers[i]->getHandle();
|
||||||
|
dynamicBarriers[i].offset = buffers[i]->getOffset();
|
||||||
|
dynamicBarriers[i].size = buffers[i]->getSize();
|
||||||
|
}
|
||||||
|
vkCmdPipelineBarrier(srcCommand, srcStage, dstStage, 0, 0, nullptr, numBuffers, dynamicBarriers, 0, nullptr);
|
||||||
|
vkCmdPipelineBarrier(dstCommand, srcStage, dstStage, 0, 0, nullptr, numBuffers, dynamicBarriers, 0, nullptr);
|
||||||
|
sourceManager->submitCommands();
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#include "VulkanGraphicsResources.h"
|
||||||
|
|
||||||
|
namespace Seele
|
||||||
|
{
|
||||||
|
namespace Vulkan
|
||||||
|
{
|
||||||
|
class CmdBufferBase : public RenderCommandBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
private:
|
||||||
|
VkCommandBuffer handle;
|
||||||
|
};
|
||||||
|
DEFINE_REF(CmdBuffer);
|
||||||
|
|
||||||
|
class CmdBuffer : public CmdBufferBase
|
||||||
|
{
|
||||||
|
|
||||||
|
};
|
||||||
|
DEFINE_REF(CmdBuffer);
|
||||||
|
|
||||||
|
class CommandBufferManager
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CommandBufferManager(Vulkan::PGraphics graphics, PVulkanQueue queue);
|
||||||
|
virtual ~CommandBufferManager();
|
||||||
|
PCmdBuffer getCommands();
|
||||||
|
PSecondaryCommandBuffer createSecondaryCmdBuffer();
|
||||||
|
void submitCommands(PSemaphore signalSemaphore = nullptr);
|
||||||
|
void waitForBuffer(PCommandbuffer cmdBuffer, float timeToWait = 1.0f);
|
||||||
|
private:
|
||||||
|
VkCommandPool commandPool;
|
||||||
|
QueueType queueType;
|
||||||
|
uint32 queueFamilyIndex;
|
||||||
|
Array<Vulkan::PCmdBuffer> allocatedBuffers;
|
||||||
|
};
|
||||||
|
DEFINE_REF(VulkanCommandBufferManager);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,7 +3,10 @@
|
|||||||
#include "VulkanGraphics.h"
|
#include "VulkanGraphics.h"
|
||||||
#include "VulkanInitializer.h"
|
#include "VulkanInitializer.h"
|
||||||
|
|
||||||
Seele::VulkanDescriptorLayout::~VulkanDescriptorLayout()
|
using namespace Seele;
|
||||||
|
using namespace Seele::Vulkan;
|
||||||
|
|
||||||
|
DescriptorLayout::~DescriptorLayout()
|
||||||
{
|
{
|
||||||
if (layoutHandle != VK_NULL_HANDLE)
|
if (layoutHandle != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
@@ -11,7 +14,7 @@ Seele::VulkanDescriptorLayout::~VulkanDescriptorLayout()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanDescriptorLayout::create()
|
void DescriptorLayout::create()
|
||||||
{
|
{
|
||||||
if (layoutHandle != VK_NULL_HANDLE)
|
if (layoutHandle != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
@@ -21,7 +24,7 @@ void Seele::VulkanDescriptorLayout::create()
|
|||||||
for (size_t i = 0; i < descriptorBindings.size(); ++i)
|
for (size_t i = 0; i < descriptorBindings.size(); ++i)
|
||||||
{
|
{
|
||||||
VkDescriptorSetLayoutBinding& binding = bindings[i];
|
VkDescriptorSetLayoutBinding& binding = bindings[i];
|
||||||
const DescriptorBinding& rhiBinding = descriptorBindings[i];
|
const Gfx::DescriptorBinding& rhiBinding = descriptorBindings[i];
|
||||||
binding.binding = rhiBinding.binding;
|
binding.binding = rhiBinding.binding;
|
||||||
binding.descriptorCount = rhiBinding.descriptorCount;
|
binding.descriptorCount = rhiBinding.descriptorCount;
|
||||||
binding.descriptorType = cast(rhiBinding.descriptorType);
|
binding.descriptorType = cast(rhiBinding.descriptorType);
|
||||||
@@ -32,10 +35,10 @@ void Seele::VulkanDescriptorLayout::create()
|
|||||||
init::DescriptorSetLayoutCreateInfo(bindings.data(), bindings.size());
|
init::DescriptorSetLayoutCreateInfo(bindings.data(), bindings.size());
|
||||||
VK_CHECK(vkCreateDescriptorSetLayout(graphics->getDevice(), &createInfo, nullptr, &layoutHandle));
|
VK_CHECK(vkCreateDescriptorSetLayout(graphics->getDevice(), &createInfo, nullptr, &layoutHandle));
|
||||||
|
|
||||||
allocator = new VulkanDescriptorAllocator(graphics, *this);
|
allocator = new DescriptorAllocator(graphics, *this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Seele::VulkanPipelineLayout::~VulkanPipelineLayout()
|
PipelineLayout::~PipelineLayout()
|
||||||
{
|
{
|
||||||
if (layoutHandle != VK_NULL_HANDLE)
|
if (layoutHandle != VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
@@ -43,12 +46,12 @@ Seele::VulkanPipelineLayout::~VulkanPipelineLayout()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanPipelineLayout::create()
|
void PipelineLayout::create()
|
||||||
{
|
{
|
||||||
vulkanDescriptorLayouts.resize(descriptorSetLayouts.size());
|
vulkanDescriptorLayouts.resize(descriptorSetLayouts.size());
|
||||||
for (size_t i = 0; i < descriptorSetLayouts.size(); ++i)
|
for (size_t i = 0; i < descriptorSetLayouts.size(); ++i)
|
||||||
{
|
{
|
||||||
PVulkanDescriptorLayout layout = descriptorSetLayouts[i].cast<VulkanDescriptorLayout>();
|
PDescriptorLayout layout = descriptorSetLayouts[i].cast<DescriptorLayout>();
|
||||||
layout->create();
|
layout->create();
|
||||||
vulkanDescriptorLayouts[i] = layout->getHandle();
|
vulkanDescriptorLayouts[i] = layout->getHandle();
|
||||||
}
|
}
|
||||||
@@ -68,13 +71,13 @@ void Seele::VulkanPipelineLayout::create()
|
|||||||
layoutHash = memCrc32(&createInfo, sizeof(VkPipelineLayoutCreateInfo), 0);
|
layoutHash = memCrc32(&createInfo, sizeof(VkPipelineLayoutCreateInfo), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Seele::VulkanDescriptorSet::~VulkanDescriptorSet()
|
DescriptorSet::~DescriptorSet()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanDescriptorSet::updateBuffer(uint32_t binding, PUniformBuffer uniformBuffer)
|
void DescriptorSet::updateBuffer(uint32_t binding, Gfx::PUniformBuffer uniformBuffer)
|
||||||
{
|
{
|
||||||
PVulkanUniformBuffer vulkanBuffer = uniformBuffer.cast<VulkanUniformBuffer>();
|
PUniformBuffer vulkanBuffer = uniformBuffer.cast<UniformBuffer>();
|
||||||
// VkDescriptorBufferInfo bufferInfo = init::DescriptorBufferInfo(vulkanBuffer->getHandle(), vulkanBuffer->getOffset(), vulkanBuffer->getSize());
|
// VkDescriptorBufferInfo bufferInfo = init::DescriptorBufferInfo(vulkanBuffer->getHandle(), vulkanBuffer->getOffset(), vulkanBuffer->getSize());
|
||||||
// bufferInfos.add(bufferInfo);
|
// bufferInfos.add(bufferInfo);
|
||||||
|
|
||||||
@@ -82,9 +85,9 @@ void Seele::VulkanDescriptorSet::updateBuffer(uint32_t binding, PUniformBuffer u
|
|||||||
writeDescriptors.add(writeDescriptor);
|
writeDescriptors.add(writeDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanDescriptorSet::updateBuffer(uint32_t binding, PStructuredBuffer uniformBuffer)
|
void DescriptorSet::updateBuffer(uint32_t binding, Gfx::PStructuredBuffer uniformBuffer)
|
||||||
{
|
{
|
||||||
PVulkanStructuredBuffer vulkanBuffer = uniformBuffer.cast<VulkanStructuredBuffer>();
|
PStructuredBuffer vulkanBuffer = uniformBuffer.cast<StructuredBuffer>();
|
||||||
// VkDescriptorBufferInfo bufferInfo = init::DescriptorBufferInfo(vulkanBuffer->getHandle(), vulkanBuffer->getOffset(), vulkanBuffer->getSize());
|
// VkDescriptorBufferInfo bufferInfo = init::DescriptorBufferInfo(vulkanBuffer->getHandle(), vulkanBuffer->getOffset(), vulkanBuffer->getSize());
|
||||||
// bufferInfos.add(bufferInfo);
|
// bufferInfos.add(bufferInfo);
|
||||||
|
|
||||||
@@ -92,9 +95,9 @@ void Seele::VulkanDescriptorSet::updateBuffer(uint32_t binding, PStructuredBuffe
|
|||||||
writeDescriptors.add(writeDescriptor);
|
writeDescriptors.add(writeDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanDescriptorSet::updateSampler(uint32_t binding, PSamplerState samplerState)
|
void DescriptorSet::updateSampler(uint32_t binding, Gfx::PSamplerState samplerState)
|
||||||
{
|
{
|
||||||
PVulkanSamplerState vulkanSampler = samplerState.cast<VulkanSamplerState>();
|
PSamplerState vulkanSampler = samplerState.cast<SamplerState>();
|
||||||
VkDescriptorImageInfo imageInfo =
|
VkDescriptorImageInfo imageInfo =
|
||||||
init::DescriptorImageInfo(
|
init::DescriptorImageInfo(
|
||||||
vulkanSampler->sampler,
|
vulkanSampler->sampler,
|
||||||
@@ -106,7 +109,7 @@ void Seele::VulkanDescriptorSet::updateSampler(uint32_t binding, PSamplerState s
|
|||||||
writeDescriptors.add(writeDescriptor);
|
writeDescriptors.add(writeDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanDescriptorSet::updateTexture(uint32_t binding, PTexture texture, PSamplerState samplerState)
|
void DescriptorSet::updateTexture(uint32_t binding, Gfx::PTexture texture, Gfx::PSamplerState samplerState)
|
||||||
{
|
{
|
||||||
// VulkanTextureBase* vulkanTexture = VulkanTextureBase::cast(texture);
|
// VulkanTextureBase* vulkanTexture = VulkanTextureBase::cast(texture);
|
||||||
//It is assumed that the image is in the correct layout
|
//It is assumed that the image is in the correct layout
|
||||||
@@ -129,13 +132,13 @@ void Seele::VulkanDescriptorSet::updateTexture(uint32_t binding, PTexture textur
|
|||||||
writeDescriptors.add(writeDescriptor);
|
writeDescriptors.add(writeDescriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Seele::VulkanDescriptorSet::operator<(PDescriptorSet other)
|
bool DescriptorSet::operator<(Gfx::PDescriptorSet other)
|
||||||
{
|
{
|
||||||
PVulkanDescriptorSet otherSet = other.cast<VulkanDescriptorSet>();
|
PDescriptorSet otherSet = other.cast<DescriptorSet>();
|
||||||
return setHandle < otherSet->setHandle;
|
return setHandle < otherSet->setHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanDescriptorSet::writeChanges()
|
void DescriptorSet::writeChanges()
|
||||||
{
|
{
|
||||||
if (writeDescriptors.size() > 0)
|
if (writeDescriptors.size() > 0)
|
||||||
{
|
{
|
||||||
@@ -146,7 +149,7 @@ void Seele::VulkanDescriptorSet::writeChanges()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Seele::VulkanDescriptorAllocator::VulkanDescriptorAllocator(PVulkanGraphics graphics, VulkanDescriptorLayout& layout)
|
DescriptorAllocator::DescriptorAllocator(PGraphics graphics, DescriptorLayout& layout)
|
||||||
: layout(layout)
|
: layout(layout)
|
||||||
, graphics(graphics)
|
, graphics(graphics)
|
||||||
{
|
{
|
||||||
@@ -173,15 +176,15 @@ Seele::VulkanDescriptorAllocator::VulkanDescriptorAllocator(PVulkanGraphics grap
|
|||||||
VK_CHECK(vkCreateDescriptorPool(graphics->getDevice(), &createInfo, nullptr, &poolHandle));
|
VK_CHECK(vkCreateDescriptorPool(graphics->getDevice(), &createInfo, nullptr, &poolHandle));
|
||||||
}
|
}
|
||||||
|
|
||||||
Seele::VulkanDescriptorAllocator::~VulkanDescriptorAllocator()
|
DescriptorAllocator::~DescriptorAllocator()
|
||||||
{
|
{
|
||||||
vkDestroyDescriptorPool(graphics->getDevice(), poolHandle, nullptr);
|
vkDestroyDescriptorPool(graphics->getDevice(), poolHandle, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanDescriptorAllocator::allocateDescriptorSet(PDescriptorSet& descriptorSet)
|
void DescriptorAllocator::allocateDescriptorSet(Gfx::PDescriptorSet& descriptorSet)
|
||||||
{
|
{
|
||||||
descriptorSet = new VulkanDescriptorSet(graphics, this);
|
descriptorSet = new DescriptorSet(graphics, this);
|
||||||
PVulkanDescriptorSet vulkanSet = descriptorSet.cast<VulkanDescriptorSet>();
|
PDescriptorSet vulkanSet = descriptorSet.cast<DescriptorSet>();
|
||||||
VkDescriptorSetLayout layoutHandle = layout.getHandle();
|
VkDescriptorSetLayout layoutHandle = layout.getHandle();
|
||||||
VkDescriptorSetAllocateInfo allocInfo =
|
VkDescriptorSetAllocateInfo allocInfo =
|
||||||
init::DescriptorSetAllocateInfo(poolHandle, &layoutHandle, 1);
|
init::DescriptorSetAllocateInfo(poolHandle, &layoutHandle, 1);
|
||||||
|
|||||||
@@ -4,8 +4,9 @@
|
|||||||
#include "VulkanInitializer.h"
|
#include "VulkanInitializer.h"
|
||||||
#include <GLFW/glfw3.h>
|
#include <GLFW/glfw3.h>
|
||||||
|
|
||||||
|
using namespace Seele::Vulkan;
|
||||||
|
|
||||||
Seele::VulkanGraphics::VulkanGraphics()
|
Graphics::Graphics()
|
||||||
: callback(VK_NULL_HANDLE)
|
: callback(VK_NULL_HANDLE)
|
||||||
, handle(VK_NULL_HANDLE)
|
, handle(VK_NULL_HANDLE)
|
||||||
, instance(VK_NULL_HANDLE)
|
, instance(VK_NULL_HANDLE)
|
||||||
@@ -15,12 +16,12 @@ Seele::VulkanGraphics::VulkanGraphics()
|
|||||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||||
}
|
}
|
||||||
|
|
||||||
Seele::VulkanGraphics::~VulkanGraphics()
|
Graphics::~Graphics()
|
||||||
{
|
{
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanGraphics::init(GraphicsInitializer initInfo)
|
void Graphics::init(GraphicsInitializer initInfo)
|
||||||
{
|
{
|
||||||
initInstance(initInfo);
|
initInstance(initInfo);
|
||||||
setupDebugCallback();
|
setupDebugCallback();
|
||||||
@@ -28,34 +29,34 @@ void Seele::VulkanGraphics::init(GraphicsInitializer initInfo)
|
|||||||
allocator = new VulkanAllocator(this);
|
allocator = new VulkanAllocator(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanGraphics::beginFrame(void* windowHandle)
|
void Graphics::beginFrame(void* windowHandle)
|
||||||
{
|
{
|
||||||
GLFWwindow* window = static_cast<GLFWwindow*>(windowHandle);
|
GLFWwindow* window = static_cast<GLFWwindow*>(windowHandle);
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanGraphics::endFrame(void* windowHandle)
|
void Graphics::endFrame(void* windowHandle)
|
||||||
{
|
{
|
||||||
GLFWwindow* window = static_cast<GLFWwindow*>(windowHandle);
|
GLFWwindow* window = static_cast<GLFWwindow*>(windowHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
void* Seele::VulkanGraphics::createWindow(const WindowCreateInfo& createInfo)
|
void* Graphics::createWindow(const WindowCreateInfo& createInfo)
|
||||||
{
|
{
|
||||||
GLFWwindow* window = glfwCreateWindow(createInfo.width, createInfo.height, createInfo.title, createInfo.bFullscreen ? glfwGetPrimaryMonitor() : nullptr, nullptr);
|
GLFWwindow* window = glfwCreateWindow(createInfo.width, createInfo.height, createInfo.title, createInfo.bFullscreen ? glfwGetPrimaryMonitor() : nullptr, nullptr);
|
||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDevice Seele::VulkanGraphics::getDevice() const
|
VkDevice Graphics::getDevice() const
|
||||||
{
|
{
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPhysicalDevice Seele::VulkanGraphics::getPhysicalDevice() const
|
VkPhysicalDevice Graphics::getPhysicalDevice() const
|
||||||
{
|
{
|
||||||
return physicalDevice;
|
return physicalDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
Seele::Array<const char*> Seele::VulkanGraphics::getRequiredExtensions()
|
Array<const char*> Graphics::getRequiredExtensions()
|
||||||
{
|
{
|
||||||
Array<const char*> extensions;
|
Array<const char*> extensions;
|
||||||
|
|
||||||
@@ -70,7 +71,7 @@ Seele::Array<const char*> Seele::VulkanGraphics::getRequiredExtensions()
|
|||||||
#endif // ENABLE_VALIDATION
|
#endif // ENABLE_VALIDATION
|
||||||
return extensions;
|
return extensions;
|
||||||
}
|
}
|
||||||
void Seele::VulkanGraphics::initInstance(GraphicsInitializer initInfo)
|
void Graphics::initInstance(GraphicsInitializer initInfo)
|
||||||
{
|
{
|
||||||
VkApplicationInfo appInfo = {};
|
VkApplicationInfo appInfo = {};
|
||||||
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||||
@@ -98,7 +99,7 @@ void Seele::VulkanGraphics::initInstance(GraphicsInitializer initInfo)
|
|||||||
#endif
|
#endif
|
||||||
VK_CHECK(vkCreateInstance(&info, nullptr, &instance));
|
VK_CHECK(vkCreateInstance(&info, nullptr, &instance));
|
||||||
}
|
}
|
||||||
void Seele::VulkanGraphics::setupDebugCallback()
|
void Graphics::setupDebugCallback()
|
||||||
{
|
{
|
||||||
VkDebugReportCallbackCreateInfoEXT createInfo =
|
VkDebugReportCallbackCreateInfoEXT createInfo =
|
||||||
init::DebugReportCallbackCreateInfo(
|
init::DebugReportCallbackCreateInfo(
|
||||||
@@ -107,7 +108,7 @@ void Seele::VulkanGraphics::setupDebugCallback()
|
|||||||
VK_CHECK(CreateDebugReportCallbackEXT(instance, &createInfo, nullptr, &callback));
|
VK_CHECK(CreateDebugReportCallbackEXT(instance, &createInfo, nullptr, &callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanGraphics::pickPhysicalDevice()
|
void Graphics::pickPhysicalDevice()
|
||||||
{
|
{
|
||||||
uint32 physicalDeviceCount;
|
uint32 physicalDeviceCount;
|
||||||
vkEnumeratePhysicalDevices(instance, &physicalDeviceCount, nullptr);
|
vkEnumeratePhysicalDevices(instance, &physicalDeviceCount, nullptr);
|
||||||
@@ -137,7 +138,7 @@ void Seele::VulkanGraphics::pickPhysicalDevice()
|
|||||||
this->physicalDevice = bestDevice;
|
this->physicalDevice = bestDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::VulkanGraphics::createDevice()
|
void Graphics::createDevice()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,14 @@
|
|||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
DECLARE_REF(VulkanAllocator);
|
namespace Vulkan
|
||||||
class VulkanGraphics : public Graphics
|
{
|
||||||
|
DECLARE_REF(Allocator);
|
||||||
|
class Graphics : public Gfx::Graphics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VulkanGraphics();
|
Graphics();
|
||||||
virtual ~VulkanGraphics();
|
virtual ~Graphics();
|
||||||
VkDevice getDevice() const;
|
VkDevice getDevice() const;
|
||||||
VkPhysicalDevice getPhysicalDevice() const;
|
VkPhysicalDevice getPhysicalDevice() const;
|
||||||
|
|
||||||
@@ -28,9 +30,10 @@ namespace Seele
|
|||||||
VkPhysicalDevice physicalDevice;
|
VkPhysicalDevice physicalDevice;
|
||||||
VkInstance instance;
|
VkInstance instance;
|
||||||
VkDebugReportCallbackEXT callback;
|
VkDebugReportCallbackEXT callback;
|
||||||
Array<PVulkanViewport> viewports;
|
Array<PViewport> viewports;
|
||||||
PVulkanAllocator allocator;
|
PAllocator allocator;
|
||||||
friend class Window;
|
friend class Window;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanGraphics);
|
DEFINE_REF(Graphics);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
#include "VulkanGraphicsEnums.h"
|
#include "VulkanGraphicsEnums.h"
|
||||||
|
|
||||||
using namespace Seele;
|
using namespace Seele::Vulkan;
|
||||||
|
using namespace Seele::Gfx;
|
||||||
|
|
||||||
VkDescriptorType Seele::cast(const SeDescriptorType& descriptorType)
|
VkDescriptorType cast(const Seele::Gfx::SeDescriptorType& descriptorType)
|
||||||
{
|
{
|
||||||
switch (descriptorType)
|
switch (descriptorType)
|
||||||
{
|
{
|
||||||
@@ -40,7 +41,7 @@ VkDescriptorType Seele::cast(const SeDescriptorType& descriptorType)
|
|||||||
return VK_DESCRIPTOR_TYPE_MAX_ENUM;
|
return VK_DESCRIPTOR_TYPE_MAX_ENUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
SeDescriptorType Seele::cast(const VkDescriptorType& descriptorType)
|
Seele::Gfx::SeDescriptorType cast(const VkDescriptorType& descriptorType)
|
||||||
{
|
{
|
||||||
switch (descriptorType)
|
switch (descriptorType)
|
||||||
{
|
{
|
||||||
@@ -79,7 +80,7 @@ SeDescriptorType Seele::cast(const VkDescriptorType& descriptorType)
|
|||||||
return SE_DESCRIPTOR_TYPE_MAX_ENUM;
|
return SE_DESCRIPTOR_TYPE_MAX_ENUM;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkShaderStageFlagBits Seele::cast(const SeShaderStageFlagBits& stage)
|
VkShaderStageFlagBits cast(const Seele::Gfx::SeShaderStageFlagBits& stage)
|
||||||
{
|
{
|
||||||
switch (stage)
|
switch (stage)
|
||||||
{
|
{
|
||||||
@@ -124,7 +125,7 @@ VkShaderStageFlagBits Seele::cast(const SeShaderStageFlagBits& stage)
|
|||||||
return VK_SHADER_STAGE_ALL;
|
return VK_SHADER_STAGE_ALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SeShaderStageFlagBits Seele::cast(const VkShaderStageFlagBits& stage)
|
Seele::Gfx::SeShaderStageFlagBits cast(const VkShaderStageFlagBits& stage)
|
||||||
{
|
{
|
||||||
switch (stage)
|
switch (stage)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -14,8 +14,11 @@
|
|||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
VkDescriptorType cast(const SeDescriptorType& descriptorType);
|
namespace Vulkan
|
||||||
SeDescriptorType cast(const VkDescriptorType& descriptorType);
|
{
|
||||||
VkShaderStageFlagBits cast(const SeShaderStageFlagBits& stage);
|
VkDescriptorType cast(const Gfx::SeDescriptorType& descriptorType);
|
||||||
SeShaderStageFlagBits cast(const VkShaderStageFlagBits& stage);
|
Gfx::SeDescriptorType cast(const VkDescriptorType& descriptorType);
|
||||||
|
VkShaderStageFlagBits cast(const Gfx::SeShaderStageFlagBits& stage);
|
||||||
|
Gfx::SeShaderStageFlagBits cast(const VkShaderStageFlagBits& stage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -4,37 +4,39 @@
|
|||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
DECLARE_REF(VulkanDescriptorAllocator);
|
namespace Vulkan
|
||||||
DECLARE_REF(VulkanGraphics);
|
{
|
||||||
class VulkanDescriptorLayout : public DescriptorLayout
|
DECLARE_REF(DescriptorAllocator);
|
||||||
|
DECLARE_REF(Graphics);
|
||||||
|
class DescriptorLayout : public Gfx::DescriptorLayout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VulkanDescriptorLayout(PVulkanGraphics graphics)
|
DescriptorLayout(PGraphics graphics)
|
||||||
: graphics(graphics)
|
: graphics(graphics)
|
||||||
, layoutHandle(VK_NULL_HANDLE)
|
, layoutHandle(VK_NULL_HANDLE)
|
||||||
{}
|
{}
|
||||||
virtual ~VulkanDescriptorLayout();
|
virtual ~DescriptorLayout();
|
||||||
virtual void create();
|
virtual void create();
|
||||||
inline VkDescriptorSetLayout getHandle() const
|
inline VkDescriptorSetLayout getHandle() const
|
||||||
{
|
{
|
||||||
return layoutHandle;
|
return layoutHandle;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
PVulkanGraphics graphics;
|
PGraphics graphics;
|
||||||
Array<VkDescriptorSetLayoutBinding> bindings;
|
Array<VkDescriptorSetLayoutBinding> bindings;
|
||||||
VkDescriptorSetLayout layoutHandle;
|
VkDescriptorSetLayout layoutHandle;
|
||||||
friend class VulkanPipelineStateCacheManager;
|
friend class PipelineStateCacheManager;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanDescriptorLayout);
|
DEFINE_REF(DescriptorLayout);
|
||||||
class VulkanPipelineLayout : public PipelineLayout
|
class PipelineLayout : public Gfx::PipelineLayout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VulkanPipelineLayout(PVulkanGraphics graphics)
|
PipelineLayout(PGraphics graphics)
|
||||||
: graphics(graphics)
|
: graphics(graphics)
|
||||||
, layoutHash(0)
|
, layoutHash(0)
|
||||||
, layoutHandle(VK_NULL_HANDLE)
|
, layoutHandle(VK_NULL_HANDLE)
|
||||||
{}
|
{}
|
||||||
virtual ~VulkanPipelineLayout();
|
virtual ~PipelineLayout();
|
||||||
virtual void create();
|
virtual void create();
|
||||||
inline VkPipelineLayout getHandle() const
|
inline VkPipelineLayout getHandle() const
|
||||||
{
|
{
|
||||||
@@ -48,25 +50,25 @@ namespace Seele
|
|||||||
Array<VkDescriptorSetLayout> vulkanDescriptorLayouts;
|
Array<VkDescriptorSetLayout> vulkanDescriptorLayouts;
|
||||||
uint32 layoutHash;
|
uint32 layoutHash;
|
||||||
VkPipelineLayout layoutHandle;
|
VkPipelineLayout layoutHandle;
|
||||||
PVulkanGraphics graphics;
|
PGraphics graphics;
|
||||||
friend class VulkanPipelineStateCacheManager;
|
friend class PipelineStateCacheManager;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanPipelineLayout);
|
DEFINE_REF(PipelineLayout);
|
||||||
|
|
||||||
class VulkanDescriptorSet : public DescriptorSet
|
class DescriptorSet : public Gfx::DescriptorSet
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VulkanDescriptorSet(PVulkanGraphics graphics, PVulkanDescriptorAllocator owner)
|
DescriptorSet(PGraphics graphics, PDescriptorAllocator owner)
|
||||||
: graphics(graphics)
|
: graphics(graphics)
|
||||||
, owner(owner)
|
, owner(owner)
|
||||||
, setHandle(VK_NULL_HANDLE)
|
, setHandle(VK_NULL_HANDLE)
|
||||||
{}
|
{}
|
||||||
virtual ~VulkanDescriptorSet();
|
virtual ~DescriptorSet();
|
||||||
virtual void updateBuffer(uint32_t binding, PUniformBuffer uniformBuffer);
|
virtual void updateBuffer(uint32_t binding, Gfx::PUniformBuffer uniformBuffer);
|
||||||
virtual void updateBuffer(uint32_t binding, PStructuredBuffer uniformBuffer);
|
virtual void updateBuffer(uint32_t binding, Gfx::PStructuredBuffer uniformBuffer);
|
||||||
virtual void updateSampler(uint32_t binding, PSamplerState samplerState);
|
virtual void updateSampler(uint32_t binding, Gfx::PSamplerState samplerState);
|
||||||
virtual void updateTexture(uint32_t binding, PTexture texture, PSamplerState sampler = nullptr);
|
virtual void updateTexture(uint32_t binding, Gfx::PTexture texture, Gfx::PSamplerState sampler = nullptr);
|
||||||
virtual bool operator<(PDescriptorSet other);
|
virtual bool operator<(Gfx::PDescriptorSet other);
|
||||||
inline VkDescriptorSet getHandle() const
|
inline VkDescriptorSet getHandle() const
|
||||||
{
|
{
|
||||||
return setHandle;
|
return setHandle;
|
||||||
@@ -77,44 +79,78 @@ namespace Seele
|
|||||||
Array<VkDescriptorBufferInfo> bufferInfos;
|
Array<VkDescriptorBufferInfo> bufferInfos;
|
||||||
Array<VkWriteDescriptorSet> writeDescriptors;
|
Array<VkWriteDescriptorSet> writeDescriptors;
|
||||||
VkDescriptorSet setHandle;
|
VkDescriptorSet setHandle;
|
||||||
PVulkanDescriptorAllocator owner;
|
PDescriptorAllocator owner;
|
||||||
PVulkanGraphics graphics;
|
PGraphics graphics;
|
||||||
friend class VulkanDescriptorAllocator;
|
friend class DescriptorAllocator;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanDescriptorSet);
|
DEFINE_REF(DescriptorSet);
|
||||||
|
|
||||||
class VulkanDescriptorAllocator : public DescriptorAllocator
|
class DescriptorAllocator : public Gfx::DescriptorAllocator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VulkanDescriptorAllocator(PVulkanGraphics graphics, VulkanDescriptorLayout& layout);
|
DescriptorAllocator(PGraphics graphics, DescriptorLayout& layout);
|
||||||
~VulkanDescriptorAllocator();
|
~DescriptorAllocator();
|
||||||
virtual void allocateDescriptorSet(PDescriptorSet& descriptorSet);
|
virtual void allocateDescriptorSet(Gfx::PDescriptorSet& descriptorSet);
|
||||||
|
|
||||||
inline VkDescriptorPool getHandle()
|
inline VkDescriptorPool getHandle()
|
||||||
{
|
{
|
||||||
return poolHandle;
|
return poolHandle;
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
PVulkanGraphics graphics;
|
PGraphics graphics;
|
||||||
int maxSets = 512;
|
int maxSets = 512;
|
||||||
VkDescriptorPool poolHandle;
|
VkDescriptorPool poolHandle;
|
||||||
VulkanDescriptorLayout& layout;
|
DescriptorLayout& layout;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanDescriptorAllocator);
|
DEFINE_REF(DescriptorAllocator);
|
||||||
|
enum class QueueType
|
||||||
|
{
|
||||||
|
GRAPHICS = 1,
|
||||||
|
COMPUTE = 2,
|
||||||
|
TRANSFER = 3
|
||||||
|
};
|
||||||
|
class QueueOwnedResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
QueueOwnedResource(PGraphics graphics, QueueType startQueueType);
|
||||||
|
~QueueOwnedResource();
|
||||||
|
CommandBufferManager* getCommands();
|
||||||
|
//Preliminary checks to see if the barrier should be executed at all
|
||||||
|
void transferOwnership(QueueType newOwner);
|
||||||
|
protected:
|
||||||
|
virtual void executeOwnershipBarrier(QueueType newOwner) = 0;
|
||||||
|
QueueType currentOwner;
|
||||||
|
PGraphics graphics;
|
||||||
|
CommandBufferManager* cachedCmdBufferManager;
|
||||||
|
};
|
||||||
|
DEFINE_REF(QueueOwnedResource);
|
||||||
|
|
||||||
class VulkanUniformBuffer : public UniformBuffer
|
class Buffer : public QueueOwnedResource
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Buffer(PGraphics graphics, uint32 size, VkBufferUsageFlags usage);
|
||||||
|
virtual ~Buffer();
|
||||||
|
private:
|
||||||
|
virtual VkAccessFlags getSourceAccessMask() = 0;
|
||||||
|
virtual VkAccessFlags getDestAccessMask() = 0;
|
||||||
|
// Inherited via QueueOwnedResource
|
||||||
|
virtual void executeOwnershipBarrier(QueueType newOwner);
|
||||||
|
};
|
||||||
|
DEFINE_REF(Buffer);
|
||||||
|
|
||||||
|
class UniformBuffer : public Gfx::UniformBuffer
|
||||||
{
|
{
|
||||||
|
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanUniformBuffer);
|
DEFINE_REF(UniformBuffer);
|
||||||
|
|
||||||
class VulkanStructuredBuffer : public StructuredBuffer
|
class StructuredBuffer : public Gfx::StructuredBuffer
|
||||||
{
|
{
|
||||||
|
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanStructuredBuffer);
|
DEFINE_REF(StructuredBuffer);
|
||||||
|
|
||||||
class VulkanTextureBase
|
class TextureBase
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
uint32 sizeX;
|
uint32 sizeX;
|
||||||
@@ -123,24 +159,24 @@ namespace Seele
|
|||||||
uint32 arrayCount;
|
uint32 arrayCount;
|
||||||
uint32 layerCount;
|
uint32 layerCount;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanTextureBase);
|
DEFINE_REF(TextureBase);
|
||||||
|
|
||||||
class VulkanTexture2D : public Texture2D
|
class Texture2D : public Gfx::Texture2D
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
private:
|
private:
|
||||||
PVulkanTextureBase textureHandle;
|
PTextureBase textureHandle;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanTexture2D);
|
DEFINE_REF(Texture2D);
|
||||||
|
|
||||||
class VulkanSamplerState
|
class SamplerState
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
VkSampler sampler;
|
VkSampler sampler;
|
||||||
};
|
};
|
||||||
DEFINE_REF(VulkanSamplerState);
|
DEFINE_REF(SamplerState);
|
||||||
|
|
||||||
class VulkanViewport : public Viewport
|
class Viewport : public Gfx::Viewport
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
private:
|
private:
|
||||||
@@ -151,5 +187,6 @@ namespace Seele
|
|||||||
VkSwapchainKHR swapchain;
|
VkSwapchainKHR swapchain;
|
||||||
void* windowHandle;
|
void* windowHandle;
|
||||||
};
|
};
|
||||||
DECLARE_REF(VulkanViewport);
|
DECLARE_REF(Viewport);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "VulkanInitializer.h"
|
#include "VulkanInitializer.h"
|
||||||
|
|
||||||
VkApplicationInfo Seele::init::ApplicationInfo(const char* appName, uint32_t appVersion, const char* engineName, uint32_t engineVersion, uint32_t apiVersion)
|
using namespace Seele::Vulkan;
|
||||||
|
|
||||||
|
VkApplicationInfo init::ApplicationInfo(const char* appName, uint32_t appVersion, const char* engineName, uint32_t engineVersion, uint32_t apiVersion)
|
||||||
{
|
{
|
||||||
VkApplicationInfo info = {};
|
VkApplicationInfo info = {};
|
||||||
info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||||
@@ -11,7 +13,7 @@ VkApplicationInfo Seele::init::ApplicationInfo(const char* appName, uint32_t app
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkInstanceCreateInfo Seele::init::InstanceCreateInfo(VkApplicationInfo* appInfo, const Array<const char*>& extensions, const Array<const char*>& layers)
|
VkInstanceCreateInfo init::InstanceCreateInfo(VkApplicationInfo* appInfo, const Array<const char*>& extensions, const Array<const char*>& layers)
|
||||||
{
|
{
|
||||||
VkInstanceCreateInfo info = {};
|
VkInstanceCreateInfo info = {};
|
||||||
info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
@@ -23,7 +25,7 @@ VkInstanceCreateInfo Seele::init::InstanceCreateInfo(VkApplicationInfo* appInfo,
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDebugReportCallbackCreateInfoEXT Seele::init::DebugReportCallbackCreateInfo(VkDebugReportFlagsEXT flags)
|
VkDebugReportCallbackCreateInfoEXT init::DebugReportCallbackCreateInfo(VkDebugReportFlagsEXT flags)
|
||||||
{
|
{
|
||||||
VkDebugReportCallbackCreateInfoEXT createInfo = {};
|
VkDebugReportCallbackCreateInfoEXT createInfo = {};
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
|
createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
|
||||||
@@ -32,13 +34,13 @@ VkDebugReportCallbackCreateInfoEXT Seele::init::DebugReportCallbackCreateInfo(Vk
|
|||||||
return createInfo;
|
return createInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDeviceQueueCreateInfo Seele::init::DeviceQueueCreateInfo(int queueFamilyIndex, int queueCount)
|
VkDeviceQueueCreateInfo init::DeviceQueueCreateInfo(int queueFamilyIndex, int queueCount)
|
||||||
{
|
{
|
||||||
float priority = 1.0f;
|
float priority = 1.0f;
|
||||||
return DeviceQueueCreateInfo(queueFamilyIndex, queueCount, &priority);
|
return DeviceQueueCreateInfo(queueFamilyIndex, queueCount, &priority);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDeviceQueueCreateInfo Seele::init::DeviceQueueCreateInfo(int queueFamilyIndex, int queueCount, float* queuePriority)
|
VkDeviceQueueCreateInfo init::DeviceQueueCreateInfo(int queueFamilyIndex, int queueCount, float* queuePriority)
|
||||||
{
|
{
|
||||||
VkDeviceQueueCreateInfo createInfo = {};
|
VkDeviceQueueCreateInfo createInfo = {};
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||||
@@ -48,12 +50,12 @@ VkDeviceQueueCreateInfo Seele::init::DeviceQueueCreateInfo(int queueFamilyIndex,
|
|||||||
return createInfo;
|
return createInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDeviceCreateInfo Seele::init::DeviceCreateInfo(VkDeviceQueueCreateInfo* queueInfos, uint32_t queueCount, VkPhysicalDeviceFeatures* features)
|
VkDeviceCreateInfo init::DeviceCreateInfo(VkDeviceQueueCreateInfo* queueInfos, uint32_t queueCount, VkPhysicalDeviceFeatures* features)
|
||||||
{
|
{
|
||||||
return DeviceCreateInfo(queueInfos, queueCount, features, nullptr, 0, nullptr, 0);
|
return DeviceCreateInfo(queueInfos, queueCount, features, nullptr, 0, nullptr, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
VkSwapchainCreateInfoKHR Seele::init::SwapchainCreateInfo(VkSurfaceKHR surface, uint32_t minImageCount, VkFormat imageFormat, VkColorSpaceKHR colorSpace, VkExtent2D extent, uint32_t arrayLayers, VkImageUsageFlags usage, VkSurfaceTransformFlagBitsKHR Transform, VkCompositeAlphaFlagBitsKHR alpha, VkPresentModeKHR presentMode, VkBool32 clipped)
|
VkSwapchainCreateInfoKHR init::SwapchainCreateInfo(VkSurfaceKHR surface, uint32_t minImageCount, VkFormat imageFormat, VkColorSpaceKHR colorSpace, VkExtent2D extent, uint32_t arrayLayers, VkImageUsageFlags usage, VkSurfaceTransformFlagBitsKHR Transform, VkCompositeAlphaFlagBitsKHR alpha, VkPresentModeKHR presentMode, VkBool32 clipped)
|
||||||
{
|
{
|
||||||
VkSwapchainCreateInfoKHR createInfo = {};
|
VkSwapchainCreateInfoKHR createInfo = {};
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||||
@@ -71,7 +73,7 @@ VkSwapchainCreateInfoKHR Seele::init::SwapchainCreateInfo(VkSurfaceKHR surface,
|
|||||||
return createInfo;
|
return createInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkSwapchainCreateInfoKHR Seele::init::SwapchainCreateInfo(VkSurfaceKHR surface, uint32_t minImageCount, VkFormat imageFormat, VkColorSpaceKHR colorSpace, uint32_t width, uint32_t height, uint32_t arrayLayers, VkImageUsageFlags usage, VkSurfaceTransformFlagBitsKHR Transform, VkCompositeAlphaFlagBitsKHR alpha, VkPresentModeKHR presentMode, VkBool32 clipped)
|
VkSwapchainCreateInfoKHR init::SwapchainCreateInfo(VkSurfaceKHR surface, uint32_t minImageCount, VkFormat imageFormat, VkColorSpaceKHR colorSpace, uint32_t width, uint32_t height, uint32_t arrayLayers, VkImageUsageFlags usage, VkSurfaceTransformFlagBitsKHR Transform, VkCompositeAlphaFlagBitsKHR alpha, VkPresentModeKHR presentMode, VkBool32 clipped)
|
||||||
{
|
{
|
||||||
VkSwapchainCreateInfoKHR createInfo = {};
|
VkSwapchainCreateInfoKHR createInfo = {};
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||||
@@ -90,7 +92,7 @@ VkSwapchainCreateInfoKHR Seele::init::SwapchainCreateInfo(VkSurfaceKHR surface,
|
|||||||
return createInfo;
|
return createInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkFramebufferCreateInfo Seele::init::FramebufferCreateInfo(VkRenderPass renderPass, uint32_t attachmentCount, VkImageView* attachments, uint32_t width, uint32_t height, uint32_t layers)
|
VkFramebufferCreateInfo init::FramebufferCreateInfo(VkRenderPass renderPass, uint32_t attachmentCount, VkImageView* attachments, uint32_t width, uint32_t height, uint32_t layers)
|
||||||
{
|
{
|
||||||
VkFramebufferCreateInfo frameBufferCreateInfo = {};
|
VkFramebufferCreateInfo frameBufferCreateInfo = {};
|
||||||
frameBufferCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
|
frameBufferCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
|
||||||
@@ -104,7 +106,7 @@ VkFramebufferCreateInfo Seele::init::FramebufferCreateInfo(VkRenderPass renderPa
|
|||||||
return frameBufferCreateInfo;
|
return frameBufferCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkAttachmentDescription Seele::init::AttachmentDescription(VkFormat format, VkSampleCountFlagBits sample, VkAttachmentLoadOp loadOp, VkAttachmentStoreOp storeOp, VkAttachmentLoadOp stencilLoadOp, VkAttachmentStoreOp stencilStoreOp, VkImageLayout imageLayout, VkImageLayout finalLayout)
|
VkAttachmentDescription init::AttachmentDescription(VkFormat format, VkSampleCountFlagBits sample, VkAttachmentLoadOp loadOp, VkAttachmentStoreOp storeOp, VkAttachmentLoadOp stencilLoadOp, VkAttachmentStoreOp stencilStoreOp, VkImageLayout imageLayout, VkImageLayout finalLayout)
|
||||||
{
|
{
|
||||||
VkAttachmentDescription desc = {};
|
VkAttachmentDescription desc = {};
|
||||||
desc.format = format;
|
desc.format = format;
|
||||||
@@ -118,7 +120,7 @@ VkAttachmentDescription Seele::init::AttachmentDescription(VkFormat format, VkSa
|
|||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkSubpassDescription Seele::init::SubpassDescription(VkPipelineBindPoint bindPoint, uint32_t colorAttachmentCount, VkAttachmentReference* colorReference, uint32_t depthAttachmentCount, VkAttachmentReference* depthReference, uint32_t inputAttachmentCount, VkAttachmentReference* inputReference, uint32_t resolveAttachmentCount, VkAttachmentReference* resolveReference, uint32_t preserveAttachmentCount, VkAttachmentReference* preserveReference)
|
VkSubpassDescription init::SubpassDescription(VkPipelineBindPoint bindPoint, uint32_t colorAttachmentCount, VkAttachmentReference* colorReference, uint32_t depthAttachmentCount, VkAttachmentReference* depthReference, uint32_t inputAttachmentCount, VkAttachmentReference* inputReference, uint32_t resolveAttachmentCount, VkAttachmentReference* resolveReference, uint32_t preserveAttachmentCount, VkAttachmentReference* preserveReference)
|
||||||
{
|
{
|
||||||
VkSubpassDescription desc = {};
|
VkSubpassDescription desc = {};
|
||||||
desc.pipelineBindPoint = bindPoint;
|
desc.pipelineBindPoint = bindPoint;
|
||||||
@@ -127,7 +129,7 @@ VkSubpassDescription Seele::init::SubpassDescription(VkPipelineBindPoint bindPoi
|
|||||||
return desc;
|
return desc;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkRenderPassCreateInfo Seele::init::RenderPassCreateInfo(uint32_t attachmentCount, const VkAttachmentDescription* attachments, uint32_t subpassCount, const VkSubpassDescription* subpasses, uint32_t dependencyCount, const VkSubpassDependency* subpassDependencies)
|
VkRenderPassCreateInfo init::RenderPassCreateInfo(uint32_t attachmentCount, const VkAttachmentDescription* attachments, uint32_t subpassCount, const VkSubpassDescription* subpasses, uint32_t dependencyCount, const VkSubpassDependency* subpassDependencies)
|
||||||
{
|
{
|
||||||
VkRenderPassCreateInfo info = {};
|
VkRenderPassCreateInfo info = {};
|
||||||
info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||||
@@ -140,7 +142,7 @@ VkRenderPassCreateInfo Seele::init::RenderPassCreateInfo(uint32_t attachmentCoun
|
|||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
VkDeviceCreateInfo Seele::init::DeviceCreateInfo(VkDeviceQueueCreateInfo* queueInfos, uint32_t queueCount, VkPhysicalDeviceFeatures* features, const char* const* deviceExtensions, uint32_t deviceExtensionCount, const char* const* layers, uint32_t layerCount)
|
VkDeviceCreateInfo init::DeviceCreateInfo(VkDeviceQueueCreateInfo* queueInfos, uint32_t queueCount, VkPhysicalDeviceFeatures* features, const char* const* deviceExtensions, uint32_t deviceExtensionCount, const char* const* layers, uint32_t layerCount)
|
||||||
{
|
{
|
||||||
VkDeviceCreateInfo createInfo = {};
|
VkDeviceCreateInfo createInfo = {};
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||||
@@ -162,7 +164,7 @@ VkDeviceCreateInfo Seele::init::DeviceCreateInfo(VkDeviceQueueCreateInfo* queueI
|
|||||||
return createInfo;
|
return createInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkMemoryAllocateInfo Seele::init::MemoryAllocateInfo()
|
VkMemoryAllocateInfo init::MemoryAllocateInfo()
|
||||||
{
|
{
|
||||||
VkMemoryAllocateInfo memAllocInfo = {};
|
VkMemoryAllocateInfo memAllocInfo = {};
|
||||||
memAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
memAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
||||||
@@ -170,7 +172,7 @@ VkMemoryAllocateInfo Seele::init::MemoryAllocateInfo()
|
|||||||
return memAllocInfo;
|
return memAllocInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkCommandBufferAllocateInfo Seele::init::CommandBufferAllocateInfo(VkCommandPool commandPool, VkCommandBufferLevel level, uint32_t bufferCount)
|
VkCommandBufferAllocateInfo init::CommandBufferAllocateInfo(VkCommandPool commandPool, VkCommandBufferLevel level, uint32_t bufferCount)
|
||||||
{
|
{
|
||||||
VkCommandBufferAllocateInfo commandBufferAllocateInfo = {};
|
VkCommandBufferAllocateInfo commandBufferAllocateInfo = {};
|
||||||
commandBufferAllocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
commandBufferAllocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||||
@@ -180,14 +182,14 @@ VkCommandBufferAllocateInfo Seele::init::CommandBufferAllocateInfo(VkCommandPool
|
|||||||
return commandBufferAllocateInfo;
|
return commandBufferAllocateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkCommandPoolCreateInfo Seele::init::CommandPoolCreateInfo()
|
VkCommandPoolCreateInfo init::CommandPoolCreateInfo()
|
||||||
{
|
{
|
||||||
VkCommandPoolCreateInfo cmdPoolCreateInfo = {};
|
VkCommandPoolCreateInfo cmdPoolCreateInfo = {};
|
||||||
cmdPoolCreateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
cmdPoolCreateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
||||||
return cmdPoolCreateInfo;
|
return cmdPoolCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkCommandBufferBeginInfo Seele::init::CommandBufferBeginInfo()
|
VkCommandBufferBeginInfo init::CommandBufferBeginInfo()
|
||||||
{
|
{
|
||||||
VkCommandBufferBeginInfo cmdBufferBeginInfo = {};
|
VkCommandBufferBeginInfo cmdBufferBeginInfo = {};
|
||||||
cmdBufferBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
cmdBufferBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||||
@@ -195,14 +197,14 @@ VkCommandBufferBeginInfo Seele::init::CommandBufferBeginInfo()
|
|||||||
return cmdBufferBeginInfo;
|
return cmdBufferBeginInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkCommandBufferInheritanceInfo Seele::init::CommandBufferInheritanceInfo()
|
VkCommandBufferInheritanceInfo init::CommandBufferInheritanceInfo()
|
||||||
{
|
{
|
||||||
VkCommandBufferInheritanceInfo cmdBufferInheritanceInfo = {};
|
VkCommandBufferInheritanceInfo cmdBufferInheritanceInfo = {};
|
||||||
cmdBufferInheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
|
cmdBufferInheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
|
||||||
return cmdBufferInheritanceInfo;
|
return cmdBufferInheritanceInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkRenderPassBeginInfo Seele::init::RenderPassBeginInfo()
|
VkRenderPassBeginInfo init::RenderPassBeginInfo()
|
||||||
{
|
{
|
||||||
VkRenderPassBeginInfo renderPassBeginInfo = {};
|
VkRenderPassBeginInfo renderPassBeginInfo = {};
|
||||||
renderPassBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
renderPassBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
||||||
@@ -210,7 +212,7 @@ VkRenderPassBeginInfo Seele::init::RenderPassBeginInfo()
|
|||||||
return renderPassBeginInfo;
|
return renderPassBeginInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkRenderPassCreateInfo Seele::init::RenderPassCreateInfo()
|
VkRenderPassCreateInfo init::RenderPassCreateInfo()
|
||||||
{
|
{
|
||||||
VkRenderPassCreateInfo renderPassCreateInfo = {};
|
VkRenderPassCreateInfo renderPassCreateInfo = {};
|
||||||
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||||
@@ -218,7 +220,7 @@ VkRenderPassCreateInfo Seele::init::RenderPassCreateInfo()
|
|||||||
return renderPassCreateInfo;
|
return renderPassCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageMemoryBarrier Seele::init::ImageMemoryBarrier(VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t srcQueue, uint32_t dstQueue)
|
VkImageMemoryBarrier init::ImageMemoryBarrier(VkImage image, VkImageLayout oldLayout, VkImageLayout newLayout, uint32_t srcQueue, uint32_t dstQueue)
|
||||||
{
|
{
|
||||||
VkImageMemoryBarrier barrier = {};
|
VkImageMemoryBarrier barrier = {};
|
||||||
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||||
@@ -260,7 +262,7 @@ VkImageMemoryBarrier Seele::init::ImageMemoryBarrier(VkImage image, VkImageLayou
|
|||||||
return barrier;
|
return barrier;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageMemoryBarrier Seele::init::ImageMemoryBarrier()
|
VkImageMemoryBarrier init::ImageMemoryBarrier()
|
||||||
{
|
{
|
||||||
VkImageMemoryBarrier barrier = {};
|
VkImageMemoryBarrier barrier = {};
|
||||||
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||||
@@ -268,7 +270,7 @@ VkImageMemoryBarrier Seele::init::ImageMemoryBarrier()
|
|||||||
return barrier;
|
return barrier;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkBufferMemoryBarrier Seele::init::BufferMemoryBarrier()
|
VkBufferMemoryBarrier init::BufferMemoryBarrier()
|
||||||
{
|
{
|
||||||
VkBufferMemoryBarrier bufferMemoryBarrier = {};
|
VkBufferMemoryBarrier bufferMemoryBarrier = {};
|
||||||
bufferMemoryBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
bufferMemoryBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
||||||
@@ -276,7 +278,7 @@ VkBufferMemoryBarrier Seele::init::BufferMemoryBarrier()
|
|||||||
return bufferMemoryBarrier;
|
return bufferMemoryBarrier;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkMemoryBarrier Seele::init::MemoryBarrier()
|
VkMemoryBarrier init::MemoryBarrier()
|
||||||
{
|
{
|
||||||
VkMemoryBarrier memoryBarrier = {};
|
VkMemoryBarrier memoryBarrier = {};
|
||||||
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
|
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
|
||||||
@@ -284,7 +286,7 @@ VkMemoryBarrier Seele::init::MemoryBarrier()
|
|||||||
return memoryBarrier;
|
return memoryBarrier;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageCreateInfo Seele::init::ImageCreateInfo()
|
VkImageCreateInfo init::ImageCreateInfo()
|
||||||
{
|
{
|
||||||
VkImageCreateInfo imageCreateInfo = {};
|
VkImageCreateInfo imageCreateInfo = {};
|
||||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||||
@@ -292,7 +294,7 @@ VkImageCreateInfo Seele::init::ImageCreateInfo()
|
|||||||
return imageCreateInfo;
|
return imageCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkSamplerCreateInfo Seele::init::SamplerCreateInfo()
|
VkSamplerCreateInfo init::SamplerCreateInfo()
|
||||||
{
|
{
|
||||||
VkSamplerCreateInfo samplerCreateInfo = {};
|
VkSamplerCreateInfo samplerCreateInfo = {};
|
||||||
samplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
samplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
||||||
@@ -317,7 +319,7 @@ VkSamplerCreateInfo Seele::init::SamplerCreateInfo()
|
|||||||
return samplerCreateInfo;
|
return samplerCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageViewCreateInfo Seele::init::ImageViewCreateInfo()
|
VkImageViewCreateInfo init::ImageViewCreateInfo()
|
||||||
{
|
{
|
||||||
VkImageViewCreateInfo imageViewCreateInfo = {};
|
VkImageViewCreateInfo imageViewCreateInfo = {};
|
||||||
imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||||
@@ -325,7 +327,7 @@ VkImageViewCreateInfo Seele::init::ImageViewCreateInfo()
|
|||||||
return imageViewCreateInfo;
|
return imageViewCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkSemaphoreCreateInfo Seele::init::SemaphoreCreateInfo()
|
VkSemaphoreCreateInfo init::SemaphoreCreateInfo()
|
||||||
{
|
{
|
||||||
VkSemaphoreCreateInfo semaphoreCreateInfo = {};
|
VkSemaphoreCreateInfo semaphoreCreateInfo = {};
|
||||||
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||||
@@ -334,7 +336,7 @@ VkSemaphoreCreateInfo Seele::init::SemaphoreCreateInfo()
|
|||||||
return semaphoreCreateInfo;
|
return semaphoreCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkFenceCreateInfo Seele::init::FenceCreateInfo(VkFenceCreateFlags flags)
|
VkFenceCreateInfo init::FenceCreateInfo(VkFenceCreateFlags flags)
|
||||||
{
|
{
|
||||||
VkFenceCreateInfo fenceCreateInfo = {};
|
VkFenceCreateInfo fenceCreateInfo = {};
|
||||||
fenceCreateInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
fenceCreateInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||||
@@ -342,14 +344,14 @@ VkFenceCreateInfo Seele::init::FenceCreateInfo(VkFenceCreateFlags flags)
|
|||||||
return fenceCreateInfo;
|
return fenceCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkEventCreateInfo Seele::init::EventCreateInfo()
|
VkEventCreateInfo init::EventCreateInfo()
|
||||||
{
|
{
|
||||||
VkEventCreateInfo eventCreateInfo = {};
|
VkEventCreateInfo eventCreateInfo = {};
|
||||||
eventCreateInfo.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
|
eventCreateInfo.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
|
||||||
return eventCreateInfo;
|
return eventCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkSubmitInfo Seele::init::SubmitInfo()
|
VkSubmitInfo init::SubmitInfo()
|
||||||
{
|
{
|
||||||
VkSubmitInfo submitInfo = {};
|
VkSubmitInfo submitInfo = {};
|
||||||
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||||
@@ -357,7 +359,7 @@ VkSubmitInfo Seele::init::SubmitInfo()
|
|||||||
return submitInfo;
|
return submitInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkImageSubresourceRange Seele::init::ImageSubresourceRange(VkImageAspectFlags aspect, uint32_t startMip)
|
VkImageSubresourceRange init::ImageSubresourceRange(VkImageAspectFlags aspect, uint32_t startMip)
|
||||||
{
|
{
|
||||||
VkImageSubresourceRange range;
|
VkImageSubresourceRange range;
|
||||||
std::memset(&range, 0, sizeof(VkImageSubresourceRange));
|
std::memset(&range, 0, sizeof(VkImageSubresourceRange));
|
||||||
@@ -369,7 +371,7 @@ VkImageSubresourceRange Seele::init::ImageSubresourceRange(VkImageAspectFlags as
|
|||||||
return range;
|
return range;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkViewport Seele::init::Viewport(
|
VkViewport init::Viewport(
|
||||||
float width,
|
float width,
|
||||||
float height,
|
float height,
|
||||||
float minDepth,
|
float minDepth,
|
||||||
@@ -383,7 +385,7 @@ VkViewport Seele::init::Viewport(
|
|||||||
return viewport;
|
return viewport;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkRect2D Seele::init::Rect2D(
|
VkRect2D init::Rect2D(
|
||||||
int32_t width,
|
int32_t width,
|
||||||
int32_t height,
|
int32_t height,
|
||||||
int32_t offsetX,
|
int32_t offsetX,
|
||||||
@@ -397,14 +399,14 @@ VkRect2D Seele::init::Rect2D(
|
|||||||
return rect2D;
|
return rect2D;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkBufferCreateInfo Seele::init::BufferCreateInfo()
|
VkBufferCreateInfo init::BufferCreateInfo()
|
||||||
{
|
{
|
||||||
VkBufferCreateInfo bufCreateInfo = {};
|
VkBufferCreateInfo bufCreateInfo = {};
|
||||||
bufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
bufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
||||||
return bufCreateInfo;
|
return bufCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkBufferCreateInfo Seele::init::BufferCreateInfo(
|
VkBufferCreateInfo init::BufferCreateInfo(
|
||||||
VkBufferUsageFlags usage,
|
VkBufferUsageFlags usage,
|
||||||
VkDeviceSize size)
|
VkDeviceSize size)
|
||||||
{
|
{
|
||||||
@@ -417,7 +419,7 @@ VkBufferCreateInfo Seele::init::BufferCreateInfo(
|
|||||||
return bufCreateInfo;
|
return bufCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDescriptorPoolCreateInfo Seele::init::DescriptorPoolCreateInfo(
|
VkDescriptorPoolCreateInfo init::DescriptorPoolCreateInfo(
|
||||||
uint32_t poolSizeCount,
|
uint32_t poolSizeCount,
|
||||||
VkDescriptorPoolSize* pPoolSizes,
|
VkDescriptorPoolSize* pPoolSizes,
|
||||||
uint32_t maxSets)
|
uint32_t maxSets)
|
||||||
@@ -431,7 +433,7 @@ VkDescriptorPoolCreateInfo Seele::init::DescriptorPoolCreateInfo(
|
|||||||
return descriptorPoolInfo;
|
return descriptorPoolInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDescriptorPoolSize Seele::init::DescriptorPoolSize(
|
VkDescriptorPoolSize init::DescriptorPoolSize(
|
||||||
VkDescriptorType type,
|
VkDescriptorType type,
|
||||||
uint32_t descriptorCount)
|
uint32_t descriptorCount)
|
||||||
{
|
{
|
||||||
@@ -441,7 +443,7 @@ VkDescriptorPoolSize Seele::init::DescriptorPoolSize(
|
|||||||
return descriptorPoolSize;
|
return descriptorPoolSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDescriptorSetLayoutBinding Seele::init::DescriptorSetLayoutBinding(
|
VkDescriptorSetLayoutBinding init::DescriptorSetLayoutBinding(
|
||||||
VkDescriptorType type,
|
VkDescriptorType type,
|
||||||
VkShaderStageFlags stageFlags,
|
VkShaderStageFlags stageFlags,
|
||||||
uint32_t binding,
|
uint32_t binding,
|
||||||
@@ -455,7 +457,7 @@ VkDescriptorSetLayoutBinding Seele::init::DescriptorSetLayoutBinding(
|
|||||||
return setLayoutBinding;
|
return setLayoutBinding;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDescriptorSetLayoutCreateInfo Seele::init::DescriptorSetLayoutCreateInfo(
|
VkDescriptorSetLayoutCreateInfo init::DescriptorSetLayoutCreateInfo(
|
||||||
const VkDescriptorSetLayoutBinding* pBindings,
|
const VkDescriptorSetLayoutBinding* pBindings,
|
||||||
uint32_t bindingCount)
|
uint32_t bindingCount)
|
||||||
{
|
{
|
||||||
@@ -467,7 +469,7 @@ VkDescriptorSetLayoutCreateInfo Seele::init::DescriptorSetLayoutCreateInfo(
|
|||||||
return descriptorSetLayoutCreateInfo;
|
return descriptorSetLayoutCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineLayoutCreateInfo Seele::init::PipelineLayoutCreateInfo(
|
VkPipelineLayoutCreateInfo init::PipelineLayoutCreateInfo(
|
||||||
const VkDescriptorSetLayout* pSetLayouts,
|
const VkDescriptorSetLayout* pSetLayouts,
|
||||||
uint32_t setLayoutCount)
|
uint32_t setLayoutCount)
|
||||||
{
|
{
|
||||||
@@ -479,7 +481,7 @@ VkPipelineLayoutCreateInfo Seele::init::PipelineLayoutCreateInfo(
|
|||||||
return pipelineLayoutCreateInfo;
|
return pipelineLayoutCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDescriptorSetAllocateInfo Seele::init::DescriptorSetAllocateInfo(
|
VkDescriptorSetAllocateInfo init::DescriptorSetAllocateInfo(
|
||||||
VkDescriptorPool descriptorPool,
|
VkDescriptorPool descriptorPool,
|
||||||
const VkDescriptorSetLayout* pSetLayouts,
|
const VkDescriptorSetLayout* pSetLayouts,
|
||||||
uint32_t descriptorSetCount)
|
uint32_t descriptorSetCount)
|
||||||
@@ -493,7 +495,7 @@ VkDescriptorSetAllocateInfo Seele::init::DescriptorSetAllocateInfo(
|
|||||||
return descriptorSetAllocateInfo;
|
return descriptorSetAllocateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDescriptorBufferInfo Seele::init::DescriptorBufferInfo(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range)
|
VkDescriptorBufferInfo init::DescriptorBufferInfo(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range)
|
||||||
{
|
{
|
||||||
VkDescriptorBufferInfo bufferInfo = {};
|
VkDescriptorBufferInfo bufferInfo = {};
|
||||||
bufferInfo.buffer = buffer;
|
bufferInfo.buffer = buffer;
|
||||||
@@ -503,7 +505,7 @@ VkDescriptorBufferInfo Seele::init::DescriptorBufferInfo(VkBuffer buffer, VkDevi
|
|||||||
return bufferInfo;
|
return bufferInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkDescriptorImageInfo Seele::init::DescriptorImageInfo(
|
VkDescriptorImageInfo init::DescriptorImageInfo(
|
||||||
VkSampler sampler,
|
VkSampler sampler,
|
||||||
VkImageView imageView,
|
VkImageView imageView,
|
||||||
VkImageLayout imageLayout)
|
VkImageLayout imageLayout)
|
||||||
@@ -515,7 +517,7 @@ VkDescriptorImageInfo Seele::init::DescriptorImageInfo(
|
|||||||
return descriptorImageInfo;
|
return descriptorImageInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkWriteDescriptorSet Seele::init::WriteDescriptorSet(
|
VkWriteDescriptorSet init::WriteDescriptorSet(
|
||||||
VkDescriptorSet dstSet,
|
VkDescriptorSet dstSet,
|
||||||
VkDescriptorType type,
|
VkDescriptorType type,
|
||||||
uint32_t binding,
|
uint32_t binding,
|
||||||
@@ -533,7 +535,7 @@ VkWriteDescriptorSet Seele::init::WriteDescriptorSet(
|
|||||||
return writeDescriptorSet;
|
return writeDescriptorSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkWriteDescriptorSet Seele::init::WriteDescriptorSet(
|
VkWriteDescriptorSet init::WriteDescriptorSet(
|
||||||
VkDescriptorSet dstSet,
|
VkDescriptorSet dstSet,
|
||||||
VkDescriptorType type,
|
VkDescriptorType type,
|
||||||
uint32_t binding,
|
uint32_t binding,
|
||||||
@@ -551,7 +553,7 @@ VkWriteDescriptorSet Seele::init::WriteDescriptorSet(
|
|||||||
return writeDescriptorSet;
|
return writeDescriptorSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkVertexInputBindingDescription Seele::init::VertexInputBindingDescription(
|
VkVertexInputBindingDescription init::VertexInputBindingDescription(
|
||||||
uint32_t binding,
|
uint32_t binding,
|
||||||
uint32_t stride,
|
uint32_t stride,
|
||||||
VkVertexInputRate inputRate)
|
VkVertexInputRate inputRate)
|
||||||
@@ -563,7 +565,7 @@ VkVertexInputBindingDescription Seele::init::VertexInputBindingDescription(
|
|||||||
return vInputBindDescription;
|
return vInputBindDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkVertexInputAttributeDescription Seele::init::VertexInputAttributeDescription(
|
VkVertexInputAttributeDescription init::VertexInputAttributeDescription(
|
||||||
uint32_t binding,
|
uint32_t binding,
|
||||||
uint32_t location,
|
uint32_t location,
|
||||||
VkFormat format,
|
VkFormat format,
|
||||||
@@ -577,7 +579,7 @@ VkVertexInputAttributeDescription Seele::init::VertexInputAttributeDescription(
|
|||||||
return vInputAttribDescription;
|
return vInputAttribDescription;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineVertexInputStateCreateInfo Seele::init::PipelineVertexInputStateCreateInfo()
|
VkPipelineVertexInputStateCreateInfo init::PipelineVertexInputStateCreateInfo()
|
||||||
{
|
{
|
||||||
VkPipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo = {};
|
VkPipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo = {};
|
||||||
pipelineVertexInputStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
|
pipelineVertexInputStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
|
||||||
@@ -585,7 +587,7 @@ VkPipelineVertexInputStateCreateInfo Seele::init::PipelineVertexInputStateCreate
|
|||||||
return pipelineVertexInputStateCreateInfo;
|
return pipelineVertexInputStateCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineInputAssemblyStateCreateInfo Seele::init::PipelineInputAssemblyStateCreateInfo(
|
VkPipelineInputAssemblyStateCreateInfo init::PipelineInputAssemblyStateCreateInfo(
|
||||||
VkPrimitiveTopology topology,
|
VkPrimitiveTopology topology,
|
||||||
VkPipelineInputAssemblyStateCreateFlags flags,
|
VkPipelineInputAssemblyStateCreateFlags flags,
|
||||||
VkBool32 primitiveRestartEnable)
|
VkBool32 primitiveRestartEnable)
|
||||||
@@ -598,7 +600,7 @@ VkPipelineInputAssemblyStateCreateInfo Seele::init::PipelineInputAssemblyStateCr
|
|||||||
return pipelineInputAssemblyStateCreateInfo;
|
return pipelineInputAssemblyStateCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineRasterizationStateCreateInfo Seele::init::PipelineRasterizationStateCreateInfo(
|
VkPipelineRasterizationStateCreateInfo init::PipelineRasterizationStateCreateInfo(
|
||||||
VkPolygonMode polygonMode,
|
VkPolygonMode polygonMode,
|
||||||
VkCullModeFlags cullMode,
|
VkCullModeFlags cullMode,
|
||||||
VkFrontFace frontFace,
|
VkFrontFace frontFace,
|
||||||
@@ -615,7 +617,7 @@ VkPipelineRasterizationStateCreateInfo Seele::init::PipelineRasterizationStateCr
|
|||||||
return pipelineRasterizationStateCreateInfo;
|
return pipelineRasterizationStateCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineColorBlendAttachmentState Seele::init::PipelineColorBlendAttachmentState(
|
VkPipelineColorBlendAttachmentState init::PipelineColorBlendAttachmentState(
|
||||||
VkColorComponentFlags colorWriteMask,
|
VkColorComponentFlags colorWriteMask,
|
||||||
VkBool32 blendEnable)
|
VkBool32 blendEnable)
|
||||||
{
|
{
|
||||||
@@ -625,7 +627,7 @@ VkPipelineColorBlendAttachmentState Seele::init::PipelineColorBlendAttachmentSta
|
|||||||
return pipelineColorBlendAttachmentState;
|
return pipelineColorBlendAttachmentState;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineColorBlendStateCreateInfo Seele::init::PipelineColorBlendStateCreateInfo(
|
VkPipelineColorBlendStateCreateInfo init::PipelineColorBlendStateCreateInfo(
|
||||||
uint32_t attachmentCount,
|
uint32_t attachmentCount,
|
||||||
const VkPipelineColorBlendAttachmentState* pAttachments)
|
const VkPipelineColorBlendAttachmentState* pAttachments)
|
||||||
{
|
{
|
||||||
@@ -637,7 +639,7 @@ VkPipelineColorBlendStateCreateInfo Seele::init::PipelineColorBlendStateCreateIn
|
|||||||
return pipelineColorBlendStateCreateInfo;
|
return pipelineColorBlendStateCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineDepthStencilStateCreateInfo Seele::init::PipelineDepthStencilStateCreateInfo(
|
VkPipelineDepthStencilStateCreateInfo init::PipelineDepthStencilStateCreateInfo(
|
||||||
VkBool32 depthTestEnable,
|
VkBool32 depthTestEnable,
|
||||||
VkBool32 depthWriteEnable,
|
VkBool32 depthWriteEnable,
|
||||||
VkCompareOp depthCompareOp)
|
VkCompareOp depthCompareOp)
|
||||||
@@ -652,7 +654,7 @@ VkPipelineDepthStencilStateCreateInfo Seele::init::PipelineDepthStencilStateCrea
|
|||||||
return pipelineDepthStencilStateCreateInfo;
|
return pipelineDepthStencilStateCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineViewportStateCreateInfo Seele::init::PipelineViewportStateCreateInfo(
|
VkPipelineViewportStateCreateInfo init::PipelineViewportStateCreateInfo(
|
||||||
uint32_t viewportCount,
|
uint32_t viewportCount,
|
||||||
uint32_t scissorCount,
|
uint32_t scissorCount,
|
||||||
VkPipelineViewportStateCreateFlags flags)
|
VkPipelineViewportStateCreateFlags flags)
|
||||||
@@ -665,7 +667,7 @@ VkPipelineViewportStateCreateInfo Seele::init::PipelineViewportStateCreateInfo(
|
|||||||
return pipelineViewportStateCreateInfo;
|
return pipelineViewportStateCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineMultisampleStateCreateInfo Seele::init::PipelineMultisampleStateCreateInfo(
|
VkPipelineMultisampleStateCreateInfo init::PipelineMultisampleStateCreateInfo(
|
||||||
VkSampleCountFlagBits rasterizationSamples,
|
VkSampleCountFlagBits rasterizationSamples,
|
||||||
VkPipelineMultisampleStateCreateFlags flags)
|
VkPipelineMultisampleStateCreateFlags flags)
|
||||||
{
|
{
|
||||||
@@ -675,7 +677,7 @@ VkPipelineMultisampleStateCreateInfo Seele::init::PipelineMultisampleStateCreate
|
|||||||
return pipelineMultisampleStateCreateInfo;
|
return pipelineMultisampleStateCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineDynamicStateCreateInfo Seele::init::PipelineDynamicStateCreateInfo(
|
VkPipelineDynamicStateCreateInfo init::PipelineDynamicStateCreateInfo(
|
||||||
const VkDynamicState* pDynamicStates,
|
const VkDynamicState* pDynamicStates,
|
||||||
uint32_t dynamicStateCount,
|
uint32_t dynamicStateCount,
|
||||||
VkPipelineDynamicStateCreateFlags flags)
|
VkPipelineDynamicStateCreateFlags flags)
|
||||||
@@ -687,7 +689,7 @@ VkPipelineDynamicStateCreateInfo Seele::init::PipelineDynamicStateCreateInfo(
|
|||||||
return pipelineDynamicStateCreateInfo;
|
return pipelineDynamicStateCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineTessellationStateCreateInfo Seele::init::PipelineTessellationStateCreateInfo(uint32_t patchControlPoints)
|
VkPipelineTessellationStateCreateInfo init::PipelineTessellationStateCreateInfo(uint32_t patchControlPoints)
|
||||||
{
|
{
|
||||||
VkPipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo = {};
|
VkPipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo = {};
|
||||||
pipelineTessellationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
pipelineTessellationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
||||||
@@ -695,7 +697,7 @@ VkPipelineTessellationStateCreateInfo Seele::init::PipelineTessellationStateCrea
|
|||||||
return pipelineTessellationStateCreateInfo;
|
return pipelineTessellationStateCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkGraphicsPipelineCreateInfo Seele::init::PipelineCreateInfo(
|
VkGraphicsPipelineCreateInfo init::PipelineCreateInfo(
|
||||||
VkPipelineLayout layout,
|
VkPipelineLayout layout,
|
||||||
VkRenderPass renderPass,
|
VkRenderPass renderPass,
|
||||||
VkPipelineCreateFlags flags)
|
VkPipelineCreateFlags flags)
|
||||||
@@ -709,7 +711,7 @@ VkGraphicsPipelineCreateInfo Seele::init::PipelineCreateInfo(
|
|||||||
return pipelineCreateInfo;
|
return pipelineCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkComputePipelineCreateInfo Seele::init::ComputePipelineCreateInfo(VkPipelineLayout layout, VkPipelineCreateFlags flags)
|
VkComputePipelineCreateInfo init::ComputePipelineCreateInfo(VkPipelineLayout layout, VkPipelineCreateFlags flags)
|
||||||
{
|
{
|
||||||
VkComputePipelineCreateInfo computePipelineCreateInfo = {};
|
VkComputePipelineCreateInfo computePipelineCreateInfo = {};
|
||||||
computePipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
|
computePipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
|
||||||
@@ -718,7 +720,7 @@ VkComputePipelineCreateInfo Seele::init::ComputePipelineCreateInfo(VkPipelineLay
|
|||||||
return computePipelineCreateInfo;
|
return computePipelineCreateInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPushConstantRange Seele::init::PushConstantRange(
|
VkPushConstantRange init::PushConstantRange(
|
||||||
VkShaderStageFlags stageFlags,
|
VkShaderStageFlags stageFlags,
|
||||||
uint32_t size,
|
uint32_t size,
|
||||||
uint32_t offset)
|
uint32_t offset)
|
||||||
@@ -730,7 +732,7 @@ VkPushConstantRange Seele::init::PushConstantRange(
|
|||||||
return pushConstantRange;
|
return pushConstantRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
VkPipelineShaderStageCreateInfo Seele::init::PipelineShaderStageCreateInfo(VkShaderStageFlagBits stage, VkShaderModule module, const char* entryName)
|
VkPipelineShaderStageCreateInfo init::PipelineShaderStageCreateInfo(VkShaderStageFlagBits stage, VkShaderModule module, const char* entryName)
|
||||||
{
|
{
|
||||||
VkPipelineShaderStageCreateInfo info = {};
|
VkPipelineShaderStageCreateInfo info = {};
|
||||||
info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
info.sType = VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO;
|
||||||
@@ -741,11 +743,11 @@ VkPipelineShaderStageCreateInfo Seele::init::PipelineShaderStageCreateInfo(VkSha
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VkBool32 Seele::debugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t obj, size_t location, int32_t code, const char* layerPrefix, const char* msg, void* userDataManager) {
|
VkBool32 debugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t obj, size_t location, int32_t code, const char* layerPrefix, const char* msg, void* userDataManager) {
|
||||||
std::cerr << layerPrefix << ": " << msg << std::endl;
|
std::cerr << layerPrefix << ": " << msg << std::endl;
|
||||||
return VK_FALSE;
|
return VK_FALSE;
|
||||||
}
|
}
|
||||||
VkResult Seele::CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback) {
|
VkResult CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback) {
|
||||||
auto func = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT");
|
auto func = (PFN_vkCreateDebugReportCallbackEXT)vkGetInstanceProcAddr(instance, "vkCreateDebugReportCallbackEXT");
|
||||||
if (func != nullptr) {
|
if (func != nullptr) {
|
||||||
return func(instance, pCreateInfo, pAllocator, pCallback);
|
return func(instance, pCreateInfo, pAllocator, pCallback);
|
||||||
@@ -755,7 +757,7 @@ VkResult Seele::CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Seele::DestroyDebugReportCallbackEXT(VkInstance instance, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT pCallback)
|
void DestroyDebugReportCallbackEXT(VkInstance instance, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT pCallback)
|
||||||
{
|
{
|
||||||
auto func = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT");
|
auto func = (PFN_vkDestroyDebugReportCallbackEXT)vkGetInstanceProcAddr(instance, "vkDestroyDebugReportCallbackEXT");
|
||||||
if (func != nullptr) {
|
if (func != nullptr) {
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
namespace Seele
|
namespace Seele
|
||||||
{
|
{
|
||||||
|
namespace Vulkan
|
||||||
|
{
|
||||||
VkBool32 debugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t obj, size_t location, int32_t code, const char* layerPrefix, const char* msg, void* userData);
|
VkBool32 debugCallback(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objType, uint64_t obj, size_t location, int32_t code, const char* layerPrefix, const char* msg, void* userData);
|
||||||
|
|
||||||
VkResult CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
|
VkResult CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
|
||||||
@@ -298,4 +300,5 @@ namespace Seele
|
|||||||
VkShaderModule module,
|
VkShaderModule module,
|
||||||
const char* entryName);
|
const char* entryName);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
#include "SceneView.h"
|
#include "SceneView.h"
|
||||||
|
|
||||||
Seele::Window::Window(const WindowCreateInfo& createInfo, PGraphics graphics)
|
Seele::Window::Window(const WindowCreateInfo& createInfo, Gfx::PGraphics graphics)
|
||||||
: width(createInfo.width)
|
: width(createInfo.width)
|
||||||
, height(createInfo.height)
|
, height(createInfo.height)
|
||||||
, graphics(graphics)
|
, graphics(graphics)
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ namespace Seele {
|
|||||||
Array<PView> views;
|
Array<PView> views;
|
||||||
};
|
};
|
||||||
DEFINE_REF(Section)
|
DEFINE_REF(Section)
|
||||||
class Graphics;
|
class Gfx::Graphics;
|
||||||
class Window
|
class Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Window(const WindowCreateInfo& createInfo, PGraphics graphics);
|
Window(const WindowCreateInfo& createInfo, Gfx::PGraphics graphics);
|
||||||
~Window();
|
~Window();
|
||||||
void beginFrame();
|
void beginFrame();
|
||||||
void endFrame();
|
void endFrame();
|
||||||
@@ -62,7 +62,7 @@ namespace Seele {
|
|||||||
PSection center;
|
PSection center;
|
||||||
uint32 width;
|
uint32 width;
|
||||||
uint32 height;
|
uint32 height;
|
||||||
PGraphics graphics;
|
Gfx::PGraphics graphics;
|
||||||
};
|
};
|
||||||
DEFINE_REF(Window)
|
DEFINE_REF(Window)
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@ namespace Seele
|
|||||||
void endFrame();
|
void endFrame();
|
||||||
private:
|
private:
|
||||||
Array<PWindow> windows;
|
Array<PWindow> windows;
|
||||||
PGraphics graphics;
|
Gfx::PGraphics graphics;
|
||||||
};
|
};
|
||||||
DEFINE_REF(WindowManager);
|
DEFINE_REF(WindowManager);
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
namespace Seele
|
||||||
static uint32_t CRCTablesSB8[8][256] = {
|
{
|
||||||
|
static uint32_t CRCTablesSB8[8][256] = {
|
||||||
{
|
{
|
||||||
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
|
0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91,
|
||||||
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
|
0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5,
|
||||||
@@ -146,16 +147,16 @@ static uint32_t CRCTablesSB8[8][256] = {
|
|||||||
0x83d02561, 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd,
|
0x83d02561, 0x4f7a25ff, 0xc1f5221c, 0x0d5f2282, 0x079a2b9b, 0xcb302b05, 0x45bf2ce6, 0x89152c78, 0x50353ed4, 0x9c9f3e4a, 0x121039a9, 0xdeba3937, 0xd47f302e, 0x18d530b0, 0x965a3753, 0x5af037cd,
|
||||||
0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, 0x264b06e6
|
0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, 0x264b06e6
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline constexpr T align(const T ptr, int64_t alignment)
|
inline constexpr T align(const T ptr, int64_t alignment)
|
||||||
{
|
{
|
||||||
return (T)(((uint64_t)ptr + alignment - 1) & ~(alignment - 1));
|
return (T)(((uint64_t)ptr + alignment - 1) & ~(alignment - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
inline uint32_t memCrc32(const void* InData, int32_t Length, uint32_t CRC = 0)
|
inline uint32_t memCrc32(const void* InData, int32_t Length, uint32_t CRC = 0)
|
||||||
{
|
{
|
||||||
// Based on the Slicing-by-8 implementation found here:
|
// Based on the Slicing-by-8 implementation found here:
|
||||||
// http://slicing-by-8.sourceforge.net/
|
// http://slicing-by-8.sourceforge.net/
|
||||||
|
|
||||||
@@ -201,4 +202,5 @@ inline uint32_t memCrc32(const void* InData, int32_t Length, uint32_t CRC = 0)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ~CRC;
|
return ~CRC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -224,3 +224,5 @@ namespace Seele
|
|||||||
T* handle;
|
T* handle;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using namespace Seele;
|
||||||
Reference in New Issue
Block a user