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 ${SLANG_LIBRARY})
|
||||
|
||||
message(Libs: ${GLFW_LIBRARIES})
|
||||
|
||||
add_subdirectory(test/)
|
||||
|
||||
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 <map>
|
||||
|
||||
Seele::Graphics::Graphics()
|
||||
using namespace Seele::Gfx;
|
||||
|
||||
Graphics::Graphics()
|
||||
{
|
||||
}
|
||||
|
||||
Seele::Graphics::~Graphics()
|
||||
Graphics::~Graphics()
|
||||
{
|
||||
|
||||
}
|
||||
@@ -4,6 +4,8 @@
|
||||
#include "Containers/Array.h"
|
||||
|
||||
namespace Seele {
|
||||
namespace Gfx
|
||||
{
|
||||
class Window;
|
||||
class Graphics
|
||||
{
|
||||
@@ -18,4 +20,5 @@ namespace Seele {
|
||||
friend class Window;
|
||||
};
|
||||
DEFINE_REF(Graphics);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "MinimalEngine.h"
|
||||
namespace Seele
|
||||
{
|
||||
namespace Gfx
|
||||
{
|
||||
typedef uint32_t SeFlags;
|
||||
typedef uint32_t SeBool32;
|
||||
typedef uint64_t SeDeviceSize;
|
||||
@@ -1765,4 +1767,5 @@ namespace Seele
|
||||
SE_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF
|
||||
} SeStencilFaceFlagBits;
|
||||
typedef SeFlags SeStencilFaceFlags;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
#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)
|
||||
{
|
||||
@@ -15,14 +15,14 @@ void Seele::DescriptorLayout::addDescriptorBinding(uint32 bindingIndex, SeDescri
|
||||
descriptorBindings[bindingIndex] = binding;
|
||||
}
|
||||
|
||||
PDescriptorSet Seele::DescriptorLayout::allocatedDescriptorSet()
|
||||
PDescriptorSet DescriptorLayout::allocatedDescriptorSet()
|
||||
{
|
||||
PDescriptorSet result;
|
||||
allocator->allocateDescriptorSet(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void Seele::PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayout layout)
|
||||
void PipelineLayout::addDescriptorLayout(uint32 setIndex, PDescriptorLayout layout)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -9,12 +9,6 @@
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
struct SePushConstantRange {
|
||||
SeShaderStageFlags stageFlags;
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
struct GraphicsInitializer
|
||||
{
|
||||
const char* windowLayoutFile;
|
||||
@@ -46,7 +40,6 @@ namespace Seele
|
||||
{
|
||||
}
|
||||
};
|
||||
DECLARE_REF(Graphics);
|
||||
struct WindowCreateInfo
|
||||
{
|
||||
int32 width;
|
||||
@@ -54,12 +47,22 @@ namespace Seele
|
||||
const char* title;
|
||||
bool bFullscreen;
|
||||
};
|
||||
namespace Gfx
|
||||
{
|
||||
struct SePushConstantRange {
|
||||
SeShaderStageFlags stageFlags;
|
||||
uint32_t offset;
|
||||
uint32_t size;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class RenderCommandBase
|
||||
{
|
||||
|
||||
};
|
||||
DEFINE_REF(RenderCommandBase);
|
||||
|
||||
class SamplerState
|
||||
{
|
||||
public:
|
||||
@@ -127,7 +130,7 @@ namespace Seele
|
||||
{
|
||||
public:
|
||||
DescriptorLayout() {}
|
||||
virtual ~DescriptorLayout(){}
|
||||
virtual ~DescriptorLayout() {}
|
||||
void operator=(const DescriptorLayout& other)
|
||||
{
|
||||
descriptorBindings.resize(other.descriptorBindings.size());
|
||||
@@ -220,4 +223,5 @@ namespace Seele
|
||||
|
||||
};
|
||||
DEFINE_REF(RenderPass);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "RenderPath.h"
|
||||
|
||||
Seele::RenderPath::RenderPath(PGraphics graphics)
|
||||
Seele::RenderPath::RenderPath(Gfx::PGraphics graphics)
|
||||
: graphics(graphics)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Seele
|
||||
class RenderPath
|
||||
{
|
||||
public:
|
||||
RenderPath(PGraphics graphics);
|
||||
RenderPath(Gfx::PGraphics graphics);
|
||||
virtual ~RenderPath();
|
||||
virtual void applyArea(Rect area) = 0;
|
||||
virtual void init() = 0;
|
||||
@@ -14,7 +14,7 @@ namespace Seele
|
||||
virtual void render() = 0;
|
||||
virtual void endFrame() = 0;
|
||||
protected:
|
||||
PGraphics graphics;
|
||||
Gfx::PGraphics graphics;
|
||||
Rect area;
|
||||
};
|
||||
DEFINE_REF(RenderPath);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "SceneRenderPath.h"
|
||||
|
||||
Seele::SceneRenderPath::SceneRenderPath(PGraphics graphics)
|
||||
Seele::SceneRenderPath::SceneRenderPath(Gfx::PGraphics graphics)
|
||||
: RenderPath(graphics)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Seele
|
||||
class SceneRenderPath : public RenderPath
|
||||
{
|
||||
public:
|
||||
SceneRenderPath(PGraphics graphics);
|
||||
SceneRenderPath(Gfx::PGraphics graphics);
|
||||
virtual ~SceneRenderPath();
|
||||
virtual void applyArea(Rect area) override;
|
||||
virtual void init() override;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "SceneView.h"
|
||||
#include "SceneRenderPath.h"
|
||||
|
||||
Seele::SceneView::SceneView(PGraphics graphics)
|
||||
Seele::SceneView::SceneView(Gfx::PGraphics graphics)
|
||||
: View(graphics)
|
||||
{
|
||||
renderer = new SceneRenderPath(graphics);
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace Seele
|
||||
class SceneView : public View
|
||||
{
|
||||
public:
|
||||
SceneView(PGraphics graphics);
|
||||
SceneView(Gfx::PGraphics graphics);
|
||||
~SceneView();
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "View.h"
|
||||
|
||||
Seele::View::View(PGraphics graphics)
|
||||
Seele::View::View(Gfx::PGraphics graphics)
|
||||
: graphics(graphics)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -2,18 +2,17 @@
|
||||
#include "RenderPath.h"
|
||||
namespace Seele
|
||||
{
|
||||
DECLARE_REF(Graphics);
|
||||
// A view is a part of the window, which can be anything from a viewport to an editor
|
||||
class View
|
||||
{
|
||||
public:
|
||||
View(PGraphics graphics);
|
||||
View(Gfx::PGraphics graphics);
|
||||
virtual ~View();
|
||||
void beginFrame();
|
||||
void endFrame();
|
||||
void applyArea(Rect area);
|
||||
protected:
|
||||
PGraphics graphics;
|
||||
Gfx::PGraphics graphics;
|
||||
PRenderPath renderer;
|
||||
};
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ target_sources(SeeleEngine
|
||||
PRIVATE
|
||||
VulkanAllocator.h
|
||||
VulkanAllocator.cpp
|
||||
VulkanBuffer.cpp
|
||||
VulkanGraphics.h
|
||||
VulkanGraphics.cpp
|
||||
VulkanGraphicsResources.h
|
||||
|
||||
@@ -1,6 +1,80 @@
|
||||
#include "VulkanAllocator.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)
|
||||
{
|
||||
vkGetPhysicalDeviceMemoryProperties(graphics->getPhysicalDevice(), &memProperties);
|
||||
@@ -11,19 +85,39 @@ Seele::VulkanAllocator::VulkanAllocator(PVulkanGraphics graphics)
|
||||
HeapInfo& heapInfo = heaps[i];
|
||||
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];
|
||||
HeapInfo& heapInfo = heaps[type.heapIndex];
|
||||
heapInfo.types.add(type);
|
||||
if ((typeBits & 1) == 1)
|
||||
{
|
||||
if ((memProperties.memoryTypes[memoryIndex].propertyFlags & properties) == properties)
|
||||
{
|
||||
*typeIndex = memoryIndex;
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
Seele::VulkanAllocator::~VulkanAllocator()
|
||||
{
|
||||
}
|
||||
|
||||
Seele::PVulkanSubAllocation Seele::VulkanAllocator::allocate(uint64 size, VkMemoryPropertyFlags properties)
|
||||
{
|
||||
return PVulkanSubAllocation();
|
||||
}
|
||||
typeBits >>= 1;
|
||||
}
|
||||
return VK_ERROR_FORMAT_NOT_SUPPORTED;
|
||||
}
|
||||
@@ -6,38 +6,69 @@
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
DECLARE_REF(VulkanGraphics);
|
||||
class VulkanSubAllocation
|
||||
namespace Vulkan
|
||||
{
|
||||
|
||||
};
|
||||
DEFINE_REF(VulkanSubAllocation);
|
||||
class VulkanAllocation
|
||||
DECLARE_REF(Graphics);
|
||||
class Allocation;
|
||||
class Allocator;
|
||||
class SubAllocation
|
||||
{
|
||||
public:
|
||||
SubAllocation(Allocation* owner, uint32 allocatedOffset, uint32 size, uint32 alignedOffset, uint32 allocatedSize);
|
||||
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;
|
||||
VkDeviceSize bytesAllocated;
|
||||
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:
|
||||
VulkanAllocator(PVulkanGraphics graphics);
|
||||
~VulkanAllocator();
|
||||
PVulkanSubAllocation allocate(uint64 size, VkMemoryPropertyFlags properties);
|
||||
Allocator(PGraphics graphics);
|
||||
~Allocator();
|
||||
PSubAllocation allocate(uint64 size, const VkMemoryRequirements2& requirements, VkMemoryPropertyFlags props);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
MemoryBlockSize = 64 * 1024 * 1024 // 64MB
|
||||
};
|
||||
struct HeapInfo
|
||||
{
|
||||
uint32 maxSize = 0;
|
||||
Array<VulkanAllocation> allocations;
|
||||
Array<VkMemoryType> types;
|
||||
Array<PAllocation> allocations;
|
||||
};
|
||||
Array<HeapInfo> heaps;
|
||||
PVulkanGraphics graphics;
|
||||
VkResult findMemoryType(uint32 typeBits, VkMemoryPropertyFlags properties, uint32* typeIndex);
|
||||
PGraphics graphics;
|
||||
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 "VulkanInitializer.h"
|
||||
|
||||
Seele::VulkanDescriptorLayout::~VulkanDescriptorLayout()
|
||||
using namespace Seele;
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
DescriptorLayout::~DescriptorLayout()
|
||||
{
|
||||
if (layoutHandle != VK_NULL_HANDLE)
|
||||
{
|
||||
@@ -11,7 +14,7 @@ Seele::VulkanDescriptorLayout::~VulkanDescriptorLayout()
|
||||
}
|
||||
}
|
||||
|
||||
void Seele::VulkanDescriptorLayout::create()
|
||||
void DescriptorLayout::create()
|
||||
{
|
||||
if (layoutHandle != VK_NULL_HANDLE)
|
||||
{
|
||||
@@ -21,7 +24,7 @@ void Seele::VulkanDescriptorLayout::create()
|
||||
for (size_t i = 0; i < descriptorBindings.size(); ++i)
|
||||
{
|
||||
VkDescriptorSetLayoutBinding& binding = bindings[i];
|
||||
const DescriptorBinding& rhiBinding = descriptorBindings[i];
|
||||
const Gfx::DescriptorBinding& rhiBinding = descriptorBindings[i];
|
||||
binding.binding = rhiBinding.binding;
|
||||
binding.descriptorCount = rhiBinding.descriptorCount;
|
||||
binding.descriptorType = cast(rhiBinding.descriptorType);
|
||||
@@ -32,10 +35,10 @@ void Seele::VulkanDescriptorLayout::create()
|
||||
init::DescriptorSetLayoutCreateInfo(bindings.data(), bindings.size());
|
||||
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)
|
||||
{
|
||||
@@ -43,12 +46,12 @@ Seele::VulkanPipelineLayout::~VulkanPipelineLayout()
|
||||
}
|
||||
}
|
||||
|
||||
void Seele::VulkanPipelineLayout::create()
|
||||
void PipelineLayout::create()
|
||||
{
|
||||
vulkanDescriptorLayouts.resize(descriptorSetLayouts.size());
|
||||
for (size_t i = 0; i < descriptorSetLayouts.size(); ++i)
|
||||
{
|
||||
PVulkanDescriptorLayout layout = descriptorSetLayouts[i].cast<VulkanDescriptorLayout>();
|
||||
PDescriptorLayout layout = descriptorSetLayouts[i].cast<DescriptorLayout>();
|
||||
layout->create();
|
||||
vulkanDescriptorLayouts[i] = layout->getHandle();
|
||||
}
|
||||
@@ -68,13 +71,13 @@ void Seele::VulkanPipelineLayout::create()
|
||||
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());
|
||||
// bufferInfos.add(bufferInfo);
|
||||
|
||||
@@ -82,9 +85,9 @@ void Seele::VulkanDescriptorSet::updateBuffer(uint32_t binding, PUniformBuffer u
|
||||
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());
|
||||
// bufferInfos.add(bufferInfo);
|
||||
|
||||
@@ -92,9 +95,9 @@ void Seele::VulkanDescriptorSet::updateBuffer(uint32_t binding, PStructuredBuffe
|
||||
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 =
|
||||
init::DescriptorImageInfo(
|
||||
vulkanSampler->sampler,
|
||||
@@ -106,7 +109,7 @@ void Seele::VulkanDescriptorSet::updateSampler(uint32_t binding, PSamplerState s
|
||||
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);
|
||||
//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);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
void Seele::VulkanDescriptorSet::writeChanges()
|
||||
void DescriptorSet::writeChanges()
|
||||
{
|
||||
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)
|
||||
, graphics(graphics)
|
||||
{
|
||||
@@ -173,15 +176,15 @@ Seele::VulkanDescriptorAllocator::VulkanDescriptorAllocator(PVulkanGraphics grap
|
||||
VK_CHECK(vkCreateDescriptorPool(graphics->getDevice(), &createInfo, nullptr, &poolHandle));
|
||||
}
|
||||
|
||||
Seele::VulkanDescriptorAllocator::~VulkanDescriptorAllocator()
|
||||
DescriptorAllocator::~DescriptorAllocator()
|
||||
{
|
||||
vkDestroyDescriptorPool(graphics->getDevice(), poolHandle, nullptr);
|
||||
}
|
||||
|
||||
void Seele::VulkanDescriptorAllocator::allocateDescriptorSet(PDescriptorSet& descriptorSet)
|
||||
void DescriptorAllocator::allocateDescriptorSet(Gfx::PDescriptorSet& descriptorSet)
|
||||
{
|
||||
descriptorSet = new VulkanDescriptorSet(graphics, this);
|
||||
PVulkanDescriptorSet vulkanSet = descriptorSet.cast<VulkanDescriptorSet>();
|
||||
descriptorSet = new DescriptorSet(graphics, this);
|
||||
PDescriptorSet vulkanSet = descriptorSet.cast<DescriptorSet>();
|
||||
VkDescriptorSetLayout layoutHandle = layout.getHandle();
|
||||
VkDescriptorSetAllocateInfo allocInfo =
|
||||
init::DescriptorSetAllocateInfo(poolHandle, &layoutHandle, 1);
|
||||
|
||||
@@ -4,8 +4,9 @@
|
||||
#include "VulkanInitializer.h"
|
||||
#include <GLFW/glfw3.h>
|
||||
|
||||
using namespace Seele::Vulkan;
|
||||
|
||||
Seele::VulkanGraphics::VulkanGraphics()
|
||||
Graphics::Graphics()
|
||||
: callback(VK_NULL_HANDLE)
|
||||
, handle(VK_NULL_HANDLE)
|
||||
, instance(VK_NULL_HANDLE)
|
||||
@@ -15,12 +16,12 @@ Seele::VulkanGraphics::VulkanGraphics()
|
||||
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
|
||||
}
|
||||
|
||||
Seele::VulkanGraphics::~VulkanGraphics()
|
||||
Graphics::~Graphics()
|
||||
{
|
||||
glfwTerminate();
|
||||
}
|
||||
|
||||
void Seele::VulkanGraphics::init(GraphicsInitializer initInfo)
|
||||
void Graphics::init(GraphicsInitializer initInfo)
|
||||
{
|
||||
initInstance(initInfo);
|
||||
setupDebugCallback();
|
||||
@@ -28,34 +29,34 @@ void Seele::VulkanGraphics::init(GraphicsInitializer initInfo)
|
||||
allocator = new VulkanAllocator(this);
|
||||
}
|
||||
|
||||
void Seele::VulkanGraphics::beginFrame(void* windowHandle)
|
||||
void Graphics::beginFrame(void* windowHandle)
|
||||
{
|
||||
GLFWwindow* window = static_cast<GLFWwindow*>(windowHandle);
|
||||
glfwPollEvents();
|
||||
}
|
||||
|
||||
void Seele::VulkanGraphics::endFrame(void* windowHandle)
|
||||
void Graphics::endFrame(void* 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);
|
||||
return window;
|
||||
}
|
||||
|
||||
VkDevice Seele::VulkanGraphics::getDevice() const
|
||||
VkDevice Graphics::getDevice() const
|
||||
{
|
||||
return handle;
|
||||
}
|
||||
|
||||
VkPhysicalDevice Seele::VulkanGraphics::getPhysicalDevice() const
|
||||
VkPhysicalDevice Graphics::getPhysicalDevice() const
|
||||
{
|
||||
return physicalDevice;
|
||||
}
|
||||
|
||||
Seele::Array<const char*> Seele::VulkanGraphics::getRequiredExtensions()
|
||||
Array<const char*> Graphics::getRequiredExtensions()
|
||||
{
|
||||
Array<const char*> extensions;
|
||||
|
||||
@@ -70,7 +71,7 @@ Seele::Array<const char*> Seele::VulkanGraphics::getRequiredExtensions()
|
||||
#endif // ENABLE_VALIDATION
|
||||
return extensions;
|
||||
}
|
||||
void Seele::VulkanGraphics::initInstance(GraphicsInitializer initInfo)
|
||||
void Graphics::initInstance(GraphicsInitializer initInfo)
|
||||
{
|
||||
VkApplicationInfo appInfo = {};
|
||||
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||
@@ -98,7 +99,7 @@ void Seele::VulkanGraphics::initInstance(GraphicsInitializer initInfo)
|
||||
#endif
|
||||
VK_CHECK(vkCreateInstance(&info, nullptr, &instance));
|
||||
}
|
||||
void Seele::VulkanGraphics::setupDebugCallback()
|
||||
void Graphics::setupDebugCallback()
|
||||
{
|
||||
VkDebugReportCallbackCreateInfoEXT createInfo =
|
||||
init::DebugReportCallbackCreateInfo(
|
||||
@@ -107,7 +108,7 @@ void Seele::VulkanGraphics::setupDebugCallback()
|
||||
VK_CHECK(CreateDebugReportCallbackEXT(instance, &createInfo, nullptr, &callback));
|
||||
}
|
||||
|
||||
void Seele::VulkanGraphics::pickPhysicalDevice()
|
||||
void Graphics::pickPhysicalDevice()
|
||||
{
|
||||
uint32 physicalDeviceCount;
|
||||
vkEnumeratePhysicalDevices(instance, &physicalDeviceCount, nullptr);
|
||||
@@ -137,7 +138,7 @@ void Seele::VulkanGraphics::pickPhysicalDevice()
|
||||
this->physicalDevice = bestDevice;
|
||||
}
|
||||
|
||||
void Seele::VulkanGraphics::createDevice()
|
||||
void Graphics::createDevice()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@@ -3,12 +3,14 @@
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
DECLARE_REF(VulkanAllocator);
|
||||
class VulkanGraphics : public Graphics
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(Allocator);
|
||||
class Graphics : public Gfx::Graphics
|
||||
{
|
||||
public:
|
||||
VulkanGraphics();
|
||||
virtual ~VulkanGraphics();
|
||||
Graphics();
|
||||
virtual ~Graphics();
|
||||
VkDevice getDevice() const;
|
||||
VkPhysicalDevice getPhysicalDevice() const;
|
||||
|
||||
@@ -28,9 +30,10 @@ namespace Seele
|
||||
VkPhysicalDevice physicalDevice;
|
||||
VkInstance instance;
|
||||
VkDebugReportCallbackEXT callback;
|
||||
Array<PVulkanViewport> viewports;
|
||||
PVulkanAllocator allocator;
|
||||
Array<PViewport> viewports;
|
||||
PAllocator allocator;
|
||||
friend class Window;
|
||||
};
|
||||
DEFINE_REF(VulkanGraphics);
|
||||
DEFINE_REF(Graphics);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
#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)
|
||||
{
|
||||
@@ -40,7 +41,7 @@ VkDescriptorType Seele::cast(const SeDescriptorType& descriptorType)
|
||||
return VK_DESCRIPTOR_TYPE_MAX_ENUM;
|
||||
}
|
||||
|
||||
SeDescriptorType Seele::cast(const VkDescriptorType& descriptorType)
|
||||
Seele::Gfx::SeDescriptorType cast(const VkDescriptorType& descriptorType)
|
||||
{
|
||||
switch (descriptorType)
|
||||
{
|
||||
@@ -79,7 +80,7 @@ SeDescriptorType Seele::cast(const VkDescriptorType& descriptorType)
|
||||
return SE_DESCRIPTOR_TYPE_MAX_ENUM;
|
||||
}
|
||||
|
||||
VkShaderStageFlagBits Seele::cast(const SeShaderStageFlagBits& stage)
|
||||
VkShaderStageFlagBits cast(const Seele::Gfx::SeShaderStageFlagBits& stage)
|
||||
{
|
||||
switch (stage)
|
||||
{
|
||||
@@ -124,7 +125,7 @@ VkShaderStageFlagBits Seele::cast(const SeShaderStageFlagBits& stage)
|
||||
return VK_SHADER_STAGE_ALL;
|
||||
}
|
||||
|
||||
SeShaderStageFlagBits Seele::cast(const VkShaderStageFlagBits& stage)
|
||||
Seele::Gfx::SeShaderStageFlagBits cast(const VkShaderStageFlagBits& stage)
|
||||
{
|
||||
switch (stage)
|
||||
{
|
||||
|
||||
@@ -14,8 +14,11 @@
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
VkDescriptorType cast(const SeDescriptorType& descriptorType);
|
||||
SeDescriptorType cast(const VkDescriptorType& descriptorType);
|
||||
VkShaderStageFlagBits cast(const SeShaderStageFlagBits& stage);
|
||||
SeShaderStageFlagBits cast(const VkShaderStageFlagBits& stage);
|
||||
namespace Vulkan
|
||||
{
|
||||
VkDescriptorType cast(const Gfx::SeDescriptorType& descriptorType);
|
||||
Gfx::SeDescriptorType cast(const VkDescriptorType& descriptorType);
|
||||
VkShaderStageFlagBits cast(const Gfx::SeShaderStageFlagBits& stage);
|
||||
Gfx::SeShaderStageFlagBits cast(const VkShaderStageFlagBits& stage);
|
||||
}
|
||||
}
|
||||
@@ -4,37 +4,39 @@
|
||||
|
||||
namespace Seele
|
||||
{
|
||||
DECLARE_REF(VulkanDescriptorAllocator);
|
||||
DECLARE_REF(VulkanGraphics);
|
||||
class VulkanDescriptorLayout : public DescriptorLayout
|
||||
namespace Vulkan
|
||||
{
|
||||
DECLARE_REF(DescriptorAllocator);
|
||||
DECLARE_REF(Graphics);
|
||||
class DescriptorLayout : public Gfx::DescriptorLayout
|
||||
{
|
||||
public:
|
||||
VulkanDescriptorLayout(PVulkanGraphics graphics)
|
||||
DescriptorLayout(PGraphics graphics)
|
||||
: graphics(graphics)
|
||||
, layoutHandle(VK_NULL_HANDLE)
|
||||
{}
|
||||
virtual ~VulkanDescriptorLayout();
|
||||
virtual ~DescriptorLayout();
|
||||
virtual void create();
|
||||
inline VkDescriptorSetLayout getHandle() const
|
||||
{
|
||||
return layoutHandle;
|
||||
}
|
||||
private:
|
||||
PVulkanGraphics graphics;
|
||||
PGraphics graphics;
|
||||
Array<VkDescriptorSetLayoutBinding> bindings;
|
||||
VkDescriptorSetLayout layoutHandle;
|
||||
friend class VulkanPipelineStateCacheManager;
|
||||
friend class PipelineStateCacheManager;
|
||||
};
|
||||
DEFINE_REF(VulkanDescriptorLayout);
|
||||
class VulkanPipelineLayout : public PipelineLayout
|
||||
DEFINE_REF(DescriptorLayout);
|
||||
class PipelineLayout : public Gfx::PipelineLayout
|
||||
{
|
||||
public:
|
||||
VulkanPipelineLayout(PVulkanGraphics graphics)
|
||||
PipelineLayout(PGraphics graphics)
|
||||
: graphics(graphics)
|
||||
, layoutHash(0)
|
||||
, layoutHandle(VK_NULL_HANDLE)
|
||||
{}
|
||||
virtual ~VulkanPipelineLayout();
|
||||
virtual ~PipelineLayout();
|
||||
virtual void create();
|
||||
inline VkPipelineLayout getHandle() const
|
||||
{
|
||||
@@ -48,25 +50,25 @@ namespace Seele
|
||||
Array<VkDescriptorSetLayout> vulkanDescriptorLayouts;
|
||||
uint32 layoutHash;
|
||||
VkPipelineLayout layoutHandle;
|
||||
PVulkanGraphics graphics;
|
||||
friend class VulkanPipelineStateCacheManager;
|
||||
PGraphics graphics;
|
||||
friend class PipelineStateCacheManager;
|
||||
};
|
||||
DEFINE_REF(VulkanPipelineLayout);
|
||||
DEFINE_REF(PipelineLayout);
|
||||
|
||||
class VulkanDescriptorSet : public DescriptorSet
|
||||
class DescriptorSet : public Gfx::DescriptorSet
|
||||
{
|
||||
public:
|
||||
VulkanDescriptorSet(PVulkanGraphics graphics, PVulkanDescriptorAllocator owner)
|
||||
DescriptorSet(PGraphics graphics, PDescriptorAllocator owner)
|
||||
: graphics(graphics)
|
||||
, owner(owner)
|
||||
, setHandle(VK_NULL_HANDLE)
|
||||
{}
|
||||
virtual ~VulkanDescriptorSet();
|
||||
virtual void updateBuffer(uint32_t binding, PUniformBuffer uniformBuffer);
|
||||
virtual void updateBuffer(uint32_t binding, PStructuredBuffer uniformBuffer);
|
||||
virtual void updateSampler(uint32_t binding, PSamplerState samplerState);
|
||||
virtual void updateTexture(uint32_t binding, PTexture texture, PSamplerState sampler = nullptr);
|
||||
virtual bool operator<(PDescriptorSet other);
|
||||
virtual ~DescriptorSet();
|
||||
virtual void updateBuffer(uint32_t binding, Gfx::PUniformBuffer uniformBuffer);
|
||||
virtual void updateBuffer(uint32_t binding, Gfx::PStructuredBuffer uniformBuffer);
|
||||
virtual void updateSampler(uint32_t binding, Gfx::PSamplerState samplerState);
|
||||
virtual void updateTexture(uint32_t binding, Gfx::PTexture texture, Gfx::PSamplerState sampler = nullptr);
|
||||
virtual bool operator<(Gfx::PDescriptorSet other);
|
||||
inline VkDescriptorSet getHandle() const
|
||||
{
|
||||
return setHandle;
|
||||
@@ -77,44 +79,78 @@ namespace Seele
|
||||
Array<VkDescriptorBufferInfo> bufferInfos;
|
||||
Array<VkWriteDescriptorSet> writeDescriptors;
|
||||
VkDescriptorSet setHandle;
|
||||
PVulkanDescriptorAllocator owner;
|
||||
PVulkanGraphics graphics;
|
||||
friend class VulkanDescriptorAllocator;
|
||||
PDescriptorAllocator owner;
|
||||
PGraphics graphics;
|
||||
friend class DescriptorAllocator;
|
||||
};
|
||||
DEFINE_REF(VulkanDescriptorSet);
|
||||
DEFINE_REF(DescriptorSet);
|
||||
|
||||
class VulkanDescriptorAllocator : public DescriptorAllocator
|
||||
class DescriptorAllocator : public Gfx::DescriptorAllocator
|
||||
{
|
||||
public:
|
||||
VulkanDescriptorAllocator(PVulkanGraphics graphics, VulkanDescriptorLayout& layout);
|
||||
~VulkanDescriptorAllocator();
|
||||
virtual void allocateDescriptorSet(PDescriptorSet& descriptorSet);
|
||||
DescriptorAllocator(PGraphics graphics, DescriptorLayout& layout);
|
||||
~DescriptorAllocator();
|
||||
virtual void allocateDescriptorSet(Gfx::PDescriptorSet& descriptorSet);
|
||||
|
||||
inline VkDescriptorPool getHandle()
|
||||
{
|
||||
return poolHandle;
|
||||
}
|
||||
private:
|
||||
PVulkanGraphics graphics;
|
||||
PGraphics graphics;
|
||||
int maxSets = 512;
|
||||
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:
|
||||
uint32 sizeX;
|
||||
@@ -123,24 +159,24 @@ namespace Seele
|
||||
uint32 arrayCount;
|
||||
uint32 layerCount;
|
||||
};
|
||||
DEFINE_REF(VulkanTextureBase);
|
||||
DEFINE_REF(TextureBase);
|
||||
|
||||
class VulkanTexture2D : public Texture2D
|
||||
class Texture2D : public Gfx::Texture2D
|
||||
{
|
||||
public:
|
||||
private:
|
||||
PVulkanTextureBase textureHandle;
|
||||
PTextureBase textureHandle;
|
||||
};
|
||||
DEFINE_REF(VulkanTexture2D);
|
||||
DEFINE_REF(Texture2D);
|
||||
|
||||
class VulkanSamplerState
|
||||
class SamplerState
|
||||
{
|
||||
public:
|
||||
VkSampler sampler;
|
||||
};
|
||||
DEFINE_REF(VulkanSamplerState);
|
||||
DEFINE_REF(SamplerState);
|
||||
|
||||
class VulkanViewport : public Viewport
|
||||
class Viewport : public Gfx::Viewport
|
||||
{
|
||||
public:
|
||||
private:
|
||||
@@ -151,5 +187,6 @@ namespace Seele
|
||||
VkSwapchainKHR swapchain;
|
||||
void* windowHandle;
|
||||
};
|
||||
DECLARE_REF(VulkanViewport);
|
||||
DECLARE_REF(Viewport);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
#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 = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
|
||||
@@ -11,7 +13,7 @@ VkApplicationInfo Seele::init::ApplicationInfo(const char* appName, uint32_t app
|
||||
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 = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||
@@ -23,7 +25,7 @@ VkInstanceCreateInfo Seele::init::InstanceCreateInfo(VkApplicationInfo* appInfo,
|
||||
return info;
|
||||
}
|
||||
|
||||
VkDebugReportCallbackCreateInfoEXT Seele::init::DebugReportCallbackCreateInfo(VkDebugReportFlagsEXT flags)
|
||||
VkDebugReportCallbackCreateInfoEXT init::DebugReportCallbackCreateInfo(VkDebugReportFlagsEXT flags)
|
||||
{
|
||||
VkDebugReportCallbackCreateInfoEXT createInfo = {};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT;
|
||||
@@ -32,13 +34,13 @@ VkDebugReportCallbackCreateInfoEXT Seele::init::DebugReportCallbackCreateInfo(Vk
|
||||
return createInfo;
|
||||
}
|
||||
|
||||
VkDeviceQueueCreateInfo Seele::init::DeviceQueueCreateInfo(int queueFamilyIndex, int queueCount)
|
||||
VkDeviceQueueCreateInfo init::DeviceQueueCreateInfo(int queueFamilyIndex, int queueCount)
|
||||
{
|
||||
float priority = 1.0f;
|
||||
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 = {};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
|
||||
@@ -48,12 +50,12 @@ VkDeviceQueueCreateInfo Seele::init::DeviceQueueCreateInfo(int queueFamilyIndex,
|
||||
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);
|
||||
}
|
||||
|
||||
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 = {};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||
@@ -71,7 +73,7 @@ VkSwapchainCreateInfoKHR Seele::init::SwapchainCreateInfo(VkSurfaceKHR surface,
|
||||
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 = {};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR;
|
||||
@@ -90,7 +92,7 @@ VkSwapchainCreateInfoKHR Seele::init::SwapchainCreateInfo(VkSurfaceKHR surface,
|
||||
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 = {};
|
||||
frameBufferCreateInfo.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO;
|
||||
@@ -104,7 +106,7 @@ VkFramebufferCreateInfo Seele::init::FramebufferCreateInfo(VkRenderPass renderPa
|
||||
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 = {};
|
||||
desc.format = format;
|
||||
@@ -118,7 +120,7 @@ VkAttachmentDescription Seele::init::AttachmentDescription(VkFormat format, VkSa
|
||||
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 = {};
|
||||
desc.pipelineBindPoint = bindPoint;
|
||||
@@ -127,7 +129,7 @@ VkSubpassDescription Seele::init::SubpassDescription(VkPipelineBindPoint bindPoi
|
||||
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 = {};
|
||||
info.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||
@@ -140,7 +142,7 @@ VkRenderPassCreateInfo Seele::init::RenderPassCreateInfo(uint32_t attachmentCoun
|
||||
|
||||
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 = {};
|
||||
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
|
||||
@@ -162,7 +164,7 @@ VkDeviceCreateInfo Seele::init::DeviceCreateInfo(VkDeviceQueueCreateInfo* queueI
|
||||
return createInfo;
|
||||
}
|
||||
|
||||
VkMemoryAllocateInfo Seele::init::MemoryAllocateInfo()
|
||||
VkMemoryAllocateInfo init::MemoryAllocateInfo()
|
||||
{
|
||||
VkMemoryAllocateInfo memAllocInfo = {};
|
||||
memAllocInfo.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
||||
@@ -170,7 +172,7 @@ VkMemoryAllocateInfo Seele::init::MemoryAllocateInfo()
|
||||
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 = {};
|
||||
commandBufferAllocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
|
||||
@@ -180,14 +182,14 @@ VkCommandBufferAllocateInfo Seele::init::CommandBufferAllocateInfo(VkCommandPool
|
||||
return commandBufferAllocateInfo;
|
||||
}
|
||||
|
||||
VkCommandPoolCreateInfo Seele::init::CommandPoolCreateInfo()
|
||||
VkCommandPoolCreateInfo init::CommandPoolCreateInfo()
|
||||
{
|
||||
VkCommandPoolCreateInfo cmdPoolCreateInfo = {};
|
||||
cmdPoolCreateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO;
|
||||
return cmdPoolCreateInfo;
|
||||
}
|
||||
|
||||
VkCommandBufferBeginInfo Seele::init::CommandBufferBeginInfo()
|
||||
VkCommandBufferBeginInfo init::CommandBufferBeginInfo()
|
||||
{
|
||||
VkCommandBufferBeginInfo cmdBufferBeginInfo = {};
|
||||
cmdBufferBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
|
||||
@@ -195,14 +197,14 @@ VkCommandBufferBeginInfo Seele::init::CommandBufferBeginInfo()
|
||||
return cmdBufferBeginInfo;
|
||||
}
|
||||
|
||||
VkCommandBufferInheritanceInfo Seele::init::CommandBufferInheritanceInfo()
|
||||
VkCommandBufferInheritanceInfo init::CommandBufferInheritanceInfo()
|
||||
{
|
||||
VkCommandBufferInheritanceInfo cmdBufferInheritanceInfo = {};
|
||||
cmdBufferInheritanceInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO;
|
||||
return cmdBufferInheritanceInfo;
|
||||
}
|
||||
|
||||
VkRenderPassBeginInfo Seele::init::RenderPassBeginInfo()
|
||||
VkRenderPassBeginInfo init::RenderPassBeginInfo()
|
||||
{
|
||||
VkRenderPassBeginInfo renderPassBeginInfo = {};
|
||||
renderPassBeginInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
|
||||
@@ -210,7 +212,7 @@ VkRenderPassBeginInfo Seele::init::RenderPassBeginInfo()
|
||||
return renderPassBeginInfo;
|
||||
}
|
||||
|
||||
VkRenderPassCreateInfo Seele::init::RenderPassCreateInfo()
|
||||
VkRenderPassCreateInfo init::RenderPassCreateInfo()
|
||||
{
|
||||
VkRenderPassCreateInfo renderPassCreateInfo = {};
|
||||
renderPassCreateInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO;
|
||||
@@ -218,7 +220,7 @@ VkRenderPassCreateInfo Seele::init::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 = {};
|
||||
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
@@ -260,7 +262,7 @@ VkImageMemoryBarrier Seele::init::ImageMemoryBarrier(VkImage image, VkImageLayou
|
||||
return barrier;
|
||||
}
|
||||
|
||||
VkImageMemoryBarrier Seele::init::ImageMemoryBarrier()
|
||||
VkImageMemoryBarrier init::ImageMemoryBarrier()
|
||||
{
|
||||
VkImageMemoryBarrier barrier = {};
|
||||
barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER;
|
||||
@@ -268,7 +270,7 @@ VkImageMemoryBarrier Seele::init::ImageMemoryBarrier()
|
||||
return barrier;
|
||||
}
|
||||
|
||||
VkBufferMemoryBarrier Seele::init::BufferMemoryBarrier()
|
||||
VkBufferMemoryBarrier init::BufferMemoryBarrier()
|
||||
{
|
||||
VkBufferMemoryBarrier bufferMemoryBarrier = {};
|
||||
bufferMemoryBarrier.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
|
||||
@@ -276,7 +278,7 @@ VkBufferMemoryBarrier Seele::init::BufferMemoryBarrier()
|
||||
return bufferMemoryBarrier;
|
||||
}
|
||||
|
||||
VkMemoryBarrier Seele::init::MemoryBarrier()
|
||||
VkMemoryBarrier init::MemoryBarrier()
|
||||
{
|
||||
VkMemoryBarrier memoryBarrier = {};
|
||||
memoryBarrier.sType = VK_STRUCTURE_TYPE_MEMORY_BARRIER;
|
||||
@@ -284,7 +286,7 @@ VkMemoryBarrier Seele::init::MemoryBarrier()
|
||||
return memoryBarrier;
|
||||
}
|
||||
|
||||
VkImageCreateInfo Seele::init::ImageCreateInfo()
|
||||
VkImageCreateInfo init::ImageCreateInfo()
|
||||
{
|
||||
VkImageCreateInfo imageCreateInfo = {};
|
||||
imageCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO;
|
||||
@@ -292,7 +294,7 @@ VkImageCreateInfo Seele::init::ImageCreateInfo()
|
||||
return imageCreateInfo;
|
||||
}
|
||||
|
||||
VkSamplerCreateInfo Seele::init::SamplerCreateInfo()
|
||||
VkSamplerCreateInfo init::SamplerCreateInfo()
|
||||
{
|
||||
VkSamplerCreateInfo samplerCreateInfo = {};
|
||||
samplerCreateInfo.sType = VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO;
|
||||
@@ -317,7 +319,7 @@ VkSamplerCreateInfo Seele::init::SamplerCreateInfo()
|
||||
return samplerCreateInfo;
|
||||
}
|
||||
|
||||
VkImageViewCreateInfo Seele::init::ImageViewCreateInfo()
|
||||
VkImageViewCreateInfo init::ImageViewCreateInfo()
|
||||
{
|
||||
VkImageViewCreateInfo imageViewCreateInfo = {};
|
||||
imageViewCreateInfo.sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO;
|
||||
@@ -325,7 +327,7 @@ VkImageViewCreateInfo Seele::init::ImageViewCreateInfo()
|
||||
return imageViewCreateInfo;
|
||||
}
|
||||
|
||||
VkSemaphoreCreateInfo Seele::init::SemaphoreCreateInfo()
|
||||
VkSemaphoreCreateInfo init::SemaphoreCreateInfo()
|
||||
{
|
||||
VkSemaphoreCreateInfo semaphoreCreateInfo = {};
|
||||
semaphoreCreateInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO;
|
||||
@@ -334,7 +336,7 @@ VkSemaphoreCreateInfo Seele::init::SemaphoreCreateInfo()
|
||||
return semaphoreCreateInfo;
|
||||
}
|
||||
|
||||
VkFenceCreateInfo Seele::init::FenceCreateInfo(VkFenceCreateFlags flags)
|
||||
VkFenceCreateInfo init::FenceCreateInfo(VkFenceCreateFlags flags)
|
||||
{
|
||||
VkFenceCreateInfo fenceCreateInfo = {};
|
||||
fenceCreateInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO;
|
||||
@@ -342,14 +344,14 @@ VkFenceCreateInfo Seele::init::FenceCreateInfo(VkFenceCreateFlags flags)
|
||||
return fenceCreateInfo;
|
||||
}
|
||||
|
||||
VkEventCreateInfo Seele::init::EventCreateInfo()
|
||||
VkEventCreateInfo init::EventCreateInfo()
|
||||
{
|
||||
VkEventCreateInfo eventCreateInfo = {};
|
||||
eventCreateInfo.sType = VK_STRUCTURE_TYPE_EVENT_CREATE_INFO;
|
||||
return eventCreateInfo;
|
||||
}
|
||||
|
||||
VkSubmitInfo Seele::init::SubmitInfo()
|
||||
VkSubmitInfo init::SubmitInfo()
|
||||
{
|
||||
VkSubmitInfo submitInfo = {};
|
||||
submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO;
|
||||
@@ -357,7 +359,7 @@ VkSubmitInfo Seele::init::SubmitInfo()
|
||||
return submitInfo;
|
||||
}
|
||||
|
||||
VkImageSubresourceRange Seele::init::ImageSubresourceRange(VkImageAspectFlags aspect, uint32_t startMip)
|
||||
VkImageSubresourceRange init::ImageSubresourceRange(VkImageAspectFlags aspect, uint32_t startMip)
|
||||
{
|
||||
VkImageSubresourceRange range;
|
||||
std::memset(&range, 0, sizeof(VkImageSubresourceRange));
|
||||
@@ -369,7 +371,7 @@ VkImageSubresourceRange Seele::init::ImageSubresourceRange(VkImageAspectFlags as
|
||||
return range;
|
||||
}
|
||||
|
||||
VkViewport Seele::init::Viewport(
|
||||
VkViewport init::Viewport(
|
||||
float width,
|
||||
float height,
|
||||
float minDepth,
|
||||
@@ -383,7 +385,7 @@ VkViewport Seele::init::Viewport(
|
||||
return viewport;
|
||||
}
|
||||
|
||||
VkRect2D Seele::init::Rect2D(
|
||||
VkRect2D init::Rect2D(
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
int32_t offsetX,
|
||||
@@ -397,14 +399,14 @@ VkRect2D Seele::init::Rect2D(
|
||||
return rect2D;
|
||||
}
|
||||
|
||||
VkBufferCreateInfo Seele::init::BufferCreateInfo()
|
||||
VkBufferCreateInfo init::BufferCreateInfo()
|
||||
{
|
||||
VkBufferCreateInfo bufCreateInfo = {};
|
||||
bufCreateInfo.sType = VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO;
|
||||
return bufCreateInfo;
|
||||
}
|
||||
|
||||
VkBufferCreateInfo Seele::init::BufferCreateInfo(
|
||||
VkBufferCreateInfo init::BufferCreateInfo(
|
||||
VkBufferUsageFlags usage,
|
||||
VkDeviceSize size)
|
||||
{
|
||||
@@ -417,7 +419,7 @@ VkBufferCreateInfo Seele::init::BufferCreateInfo(
|
||||
return bufCreateInfo;
|
||||
}
|
||||
|
||||
VkDescriptorPoolCreateInfo Seele::init::DescriptorPoolCreateInfo(
|
||||
VkDescriptorPoolCreateInfo init::DescriptorPoolCreateInfo(
|
||||
uint32_t poolSizeCount,
|
||||
VkDescriptorPoolSize* pPoolSizes,
|
||||
uint32_t maxSets)
|
||||
@@ -431,7 +433,7 @@ VkDescriptorPoolCreateInfo Seele::init::DescriptorPoolCreateInfo(
|
||||
return descriptorPoolInfo;
|
||||
}
|
||||
|
||||
VkDescriptorPoolSize Seele::init::DescriptorPoolSize(
|
||||
VkDescriptorPoolSize init::DescriptorPoolSize(
|
||||
VkDescriptorType type,
|
||||
uint32_t descriptorCount)
|
||||
{
|
||||
@@ -441,7 +443,7 @@ VkDescriptorPoolSize Seele::init::DescriptorPoolSize(
|
||||
return descriptorPoolSize;
|
||||
}
|
||||
|
||||
VkDescriptorSetLayoutBinding Seele::init::DescriptorSetLayoutBinding(
|
||||
VkDescriptorSetLayoutBinding init::DescriptorSetLayoutBinding(
|
||||
VkDescriptorType type,
|
||||
VkShaderStageFlags stageFlags,
|
||||
uint32_t binding,
|
||||
@@ -455,7 +457,7 @@ VkDescriptorSetLayoutBinding Seele::init::DescriptorSetLayoutBinding(
|
||||
return setLayoutBinding;
|
||||
}
|
||||
|
||||
VkDescriptorSetLayoutCreateInfo Seele::init::DescriptorSetLayoutCreateInfo(
|
||||
VkDescriptorSetLayoutCreateInfo init::DescriptorSetLayoutCreateInfo(
|
||||
const VkDescriptorSetLayoutBinding* pBindings,
|
||||
uint32_t bindingCount)
|
||||
{
|
||||
@@ -467,7 +469,7 @@ VkDescriptorSetLayoutCreateInfo Seele::init::DescriptorSetLayoutCreateInfo(
|
||||
return descriptorSetLayoutCreateInfo;
|
||||
}
|
||||
|
||||
VkPipelineLayoutCreateInfo Seele::init::PipelineLayoutCreateInfo(
|
||||
VkPipelineLayoutCreateInfo init::PipelineLayoutCreateInfo(
|
||||
const VkDescriptorSetLayout* pSetLayouts,
|
||||
uint32_t setLayoutCount)
|
||||
{
|
||||
@@ -479,7 +481,7 @@ VkPipelineLayoutCreateInfo Seele::init::PipelineLayoutCreateInfo(
|
||||
return pipelineLayoutCreateInfo;
|
||||
}
|
||||
|
||||
VkDescriptorSetAllocateInfo Seele::init::DescriptorSetAllocateInfo(
|
||||
VkDescriptorSetAllocateInfo init::DescriptorSetAllocateInfo(
|
||||
VkDescriptorPool descriptorPool,
|
||||
const VkDescriptorSetLayout* pSetLayouts,
|
||||
uint32_t descriptorSetCount)
|
||||
@@ -493,7 +495,7 @@ VkDescriptorSetAllocateInfo Seele::init::DescriptorSetAllocateInfo(
|
||||
return descriptorSetAllocateInfo;
|
||||
}
|
||||
|
||||
VkDescriptorBufferInfo Seele::init::DescriptorBufferInfo(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range)
|
||||
VkDescriptorBufferInfo init::DescriptorBufferInfo(VkBuffer buffer, VkDeviceSize offset, VkDeviceSize range)
|
||||
{
|
||||
VkDescriptorBufferInfo bufferInfo = {};
|
||||
bufferInfo.buffer = buffer;
|
||||
@@ -503,7 +505,7 @@ VkDescriptorBufferInfo Seele::init::DescriptorBufferInfo(VkBuffer buffer, VkDevi
|
||||
return bufferInfo;
|
||||
}
|
||||
|
||||
VkDescriptorImageInfo Seele::init::DescriptorImageInfo(
|
||||
VkDescriptorImageInfo init::DescriptorImageInfo(
|
||||
VkSampler sampler,
|
||||
VkImageView imageView,
|
||||
VkImageLayout imageLayout)
|
||||
@@ -515,7 +517,7 @@ VkDescriptorImageInfo Seele::init::DescriptorImageInfo(
|
||||
return descriptorImageInfo;
|
||||
}
|
||||
|
||||
VkWriteDescriptorSet Seele::init::WriteDescriptorSet(
|
||||
VkWriteDescriptorSet init::WriteDescriptorSet(
|
||||
VkDescriptorSet dstSet,
|
||||
VkDescriptorType type,
|
||||
uint32_t binding,
|
||||
@@ -533,7 +535,7 @@ VkWriteDescriptorSet Seele::init::WriteDescriptorSet(
|
||||
return writeDescriptorSet;
|
||||
}
|
||||
|
||||
VkWriteDescriptorSet Seele::init::WriteDescriptorSet(
|
||||
VkWriteDescriptorSet init::WriteDescriptorSet(
|
||||
VkDescriptorSet dstSet,
|
||||
VkDescriptorType type,
|
||||
uint32_t binding,
|
||||
@@ -551,7 +553,7 @@ VkWriteDescriptorSet Seele::init::WriteDescriptorSet(
|
||||
return writeDescriptorSet;
|
||||
}
|
||||
|
||||
VkVertexInputBindingDescription Seele::init::VertexInputBindingDescription(
|
||||
VkVertexInputBindingDescription init::VertexInputBindingDescription(
|
||||
uint32_t binding,
|
||||
uint32_t stride,
|
||||
VkVertexInputRate inputRate)
|
||||
@@ -563,7 +565,7 @@ VkVertexInputBindingDescription Seele::init::VertexInputBindingDescription(
|
||||
return vInputBindDescription;
|
||||
}
|
||||
|
||||
VkVertexInputAttributeDescription Seele::init::VertexInputAttributeDescription(
|
||||
VkVertexInputAttributeDescription init::VertexInputAttributeDescription(
|
||||
uint32_t binding,
|
||||
uint32_t location,
|
||||
VkFormat format,
|
||||
@@ -577,7 +579,7 @@ VkVertexInputAttributeDescription Seele::init::VertexInputAttributeDescription(
|
||||
return vInputAttribDescription;
|
||||
}
|
||||
|
||||
VkPipelineVertexInputStateCreateInfo Seele::init::PipelineVertexInputStateCreateInfo()
|
||||
VkPipelineVertexInputStateCreateInfo init::PipelineVertexInputStateCreateInfo()
|
||||
{
|
||||
VkPipelineVertexInputStateCreateInfo pipelineVertexInputStateCreateInfo = {};
|
||||
pipelineVertexInputStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO;
|
||||
@@ -585,7 +587,7 @@ VkPipelineVertexInputStateCreateInfo Seele::init::PipelineVertexInputStateCreate
|
||||
return pipelineVertexInputStateCreateInfo;
|
||||
}
|
||||
|
||||
VkPipelineInputAssemblyStateCreateInfo Seele::init::PipelineInputAssemblyStateCreateInfo(
|
||||
VkPipelineInputAssemblyStateCreateInfo init::PipelineInputAssemblyStateCreateInfo(
|
||||
VkPrimitiveTopology topology,
|
||||
VkPipelineInputAssemblyStateCreateFlags flags,
|
||||
VkBool32 primitiveRestartEnable)
|
||||
@@ -598,7 +600,7 @@ VkPipelineInputAssemblyStateCreateInfo Seele::init::PipelineInputAssemblyStateCr
|
||||
return pipelineInputAssemblyStateCreateInfo;
|
||||
}
|
||||
|
||||
VkPipelineRasterizationStateCreateInfo Seele::init::PipelineRasterizationStateCreateInfo(
|
||||
VkPipelineRasterizationStateCreateInfo init::PipelineRasterizationStateCreateInfo(
|
||||
VkPolygonMode polygonMode,
|
||||
VkCullModeFlags cullMode,
|
||||
VkFrontFace frontFace,
|
||||
@@ -615,7 +617,7 @@ VkPipelineRasterizationStateCreateInfo Seele::init::PipelineRasterizationStateCr
|
||||
return pipelineRasterizationStateCreateInfo;
|
||||
}
|
||||
|
||||
VkPipelineColorBlendAttachmentState Seele::init::PipelineColorBlendAttachmentState(
|
||||
VkPipelineColorBlendAttachmentState init::PipelineColorBlendAttachmentState(
|
||||
VkColorComponentFlags colorWriteMask,
|
||||
VkBool32 blendEnable)
|
||||
{
|
||||
@@ -625,7 +627,7 @@ VkPipelineColorBlendAttachmentState Seele::init::PipelineColorBlendAttachmentSta
|
||||
return pipelineColorBlendAttachmentState;
|
||||
}
|
||||
|
||||
VkPipelineColorBlendStateCreateInfo Seele::init::PipelineColorBlendStateCreateInfo(
|
||||
VkPipelineColorBlendStateCreateInfo init::PipelineColorBlendStateCreateInfo(
|
||||
uint32_t attachmentCount,
|
||||
const VkPipelineColorBlendAttachmentState* pAttachments)
|
||||
{
|
||||
@@ -637,7 +639,7 @@ VkPipelineColorBlendStateCreateInfo Seele::init::PipelineColorBlendStateCreateIn
|
||||
return pipelineColorBlendStateCreateInfo;
|
||||
}
|
||||
|
||||
VkPipelineDepthStencilStateCreateInfo Seele::init::PipelineDepthStencilStateCreateInfo(
|
||||
VkPipelineDepthStencilStateCreateInfo init::PipelineDepthStencilStateCreateInfo(
|
||||
VkBool32 depthTestEnable,
|
||||
VkBool32 depthWriteEnable,
|
||||
VkCompareOp depthCompareOp)
|
||||
@@ -652,7 +654,7 @@ VkPipelineDepthStencilStateCreateInfo Seele::init::PipelineDepthStencilStateCrea
|
||||
return pipelineDepthStencilStateCreateInfo;
|
||||
}
|
||||
|
||||
VkPipelineViewportStateCreateInfo Seele::init::PipelineViewportStateCreateInfo(
|
||||
VkPipelineViewportStateCreateInfo init::PipelineViewportStateCreateInfo(
|
||||
uint32_t viewportCount,
|
||||
uint32_t scissorCount,
|
||||
VkPipelineViewportStateCreateFlags flags)
|
||||
@@ -665,7 +667,7 @@ VkPipelineViewportStateCreateInfo Seele::init::PipelineViewportStateCreateInfo(
|
||||
return pipelineViewportStateCreateInfo;
|
||||
}
|
||||
|
||||
VkPipelineMultisampleStateCreateInfo Seele::init::PipelineMultisampleStateCreateInfo(
|
||||
VkPipelineMultisampleStateCreateInfo init::PipelineMultisampleStateCreateInfo(
|
||||
VkSampleCountFlagBits rasterizationSamples,
|
||||
VkPipelineMultisampleStateCreateFlags flags)
|
||||
{
|
||||
@@ -675,7 +677,7 @@ VkPipelineMultisampleStateCreateInfo Seele::init::PipelineMultisampleStateCreate
|
||||
return pipelineMultisampleStateCreateInfo;
|
||||
}
|
||||
|
||||
VkPipelineDynamicStateCreateInfo Seele::init::PipelineDynamicStateCreateInfo(
|
||||
VkPipelineDynamicStateCreateInfo init::PipelineDynamicStateCreateInfo(
|
||||
const VkDynamicState* pDynamicStates,
|
||||
uint32_t dynamicStateCount,
|
||||
VkPipelineDynamicStateCreateFlags flags)
|
||||
@@ -687,7 +689,7 @@ VkPipelineDynamicStateCreateInfo Seele::init::PipelineDynamicStateCreateInfo(
|
||||
return pipelineDynamicStateCreateInfo;
|
||||
}
|
||||
|
||||
VkPipelineTessellationStateCreateInfo Seele::init::PipelineTessellationStateCreateInfo(uint32_t patchControlPoints)
|
||||
VkPipelineTessellationStateCreateInfo init::PipelineTessellationStateCreateInfo(uint32_t patchControlPoints)
|
||||
{
|
||||
VkPipelineTessellationStateCreateInfo pipelineTessellationStateCreateInfo = {};
|
||||
pipelineTessellationStateCreateInfo.sType = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO;
|
||||
@@ -695,7 +697,7 @@ VkPipelineTessellationStateCreateInfo Seele::init::PipelineTessellationStateCrea
|
||||
return pipelineTessellationStateCreateInfo;
|
||||
}
|
||||
|
||||
VkGraphicsPipelineCreateInfo Seele::init::PipelineCreateInfo(
|
||||
VkGraphicsPipelineCreateInfo init::PipelineCreateInfo(
|
||||
VkPipelineLayout layout,
|
||||
VkRenderPass renderPass,
|
||||
VkPipelineCreateFlags flags)
|
||||
@@ -709,7 +711,7 @@ VkGraphicsPipelineCreateInfo Seele::init::PipelineCreateInfo(
|
||||
return pipelineCreateInfo;
|
||||
}
|
||||
|
||||
VkComputePipelineCreateInfo Seele::init::ComputePipelineCreateInfo(VkPipelineLayout layout, VkPipelineCreateFlags flags)
|
||||
VkComputePipelineCreateInfo init::ComputePipelineCreateInfo(VkPipelineLayout layout, VkPipelineCreateFlags flags)
|
||||
{
|
||||
VkComputePipelineCreateInfo computePipelineCreateInfo = {};
|
||||
computePipelineCreateInfo.sType = VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO;
|
||||
@@ -718,7 +720,7 @@ VkComputePipelineCreateInfo Seele::init::ComputePipelineCreateInfo(VkPipelineLay
|
||||
return computePipelineCreateInfo;
|
||||
}
|
||||
|
||||
VkPushConstantRange Seele::init::PushConstantRange(
|
||||
VkPushConstantRange init::PushConstantRange(
|
||||
VkShaderStageFlags stageFlags,
|
||||
uint32_t size,
|
||||
uint32_t offset)
|
||||
@@ -730,7 +732,7 @@ VkPushConstantRange Seele::init::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 = {};
|
||||
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;
|
||||
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");
|
||||
if (func != nullptr) {
|
||||
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");
|
||||
if (func != nullptr) {
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
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);
|
||||
|
||||
VkResult CreateDebugReportCallbackEXT(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
|
||||
@@ -298,4 +300,5 @@ namespace Seele
|
||||
VkShaderModule module,
|
||||
const char* entryName);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Window.h"
|
||||
#include "SceneView.h"
|
||||
|
||||
Seele::Window::Window(const WindowCreateInfo& createInfo, PGraphics graphics)
|
||||
Seele::Window::Window(const WindowCreateInfo& createInfo, Gfx::PGraphics graphics)
|
||||
: width(createInfo.width)
|
||||
, height(createInfo.height)
|
||||
, graphics(graphics)
|
||||
|
||||
@@ -49,11 +49,11 @@ namespace Seele {
|
||||
Array<PView> views;
|
||||
};
|
||||
DEFINE_REF(Section)
|
||||
class Graphics;
|
||||
class Gfx::Graphics;
|
||||
class Window
|
||||
{
|
||||
public:
|
||||
Window(const WindowCreateInfo& createInfo, PGraphics graphics);
|
||||
Window(const WindowCreateInfo& createInfo, Gfx::PGraphics graphics);
|
||||
~Window();
|
||||
void beginFrame();
|
||||
void endFrame();
|
||||
@@ -62,7 +62,7 @@ namespace Seele {
|
||||
PSection center;
|
||||
uint32 width;
|
||||
uint32 height;
|
||||
PGraphics graphics;
|
||||
Gfx::PGraphics graphics;
|
||||
};
|
||||
DEFINE_REF(Window)
|
||||
}
|
||||
@@ -15,7 +15,7 @@ namespace Seele
|
||||
void endFrame();
|
||||
private:
|
||||
Array<PWindow> windows;
|
||||
PGraphics graphics;
|
||||
Gfx::PGraphics graphics;
|
||||
};
|
||||
DEFINE_REF(WindowManager);
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
|
||||
static uint32_t CRCTablesSB8[8][256] = {
|
||||
namespace Seele
|
||||
{
|
||||
static uint32_t CRCTablesSB8[8][256] = {
|
||||
{
|
||||
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,
|
||||
@@ -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,
|
||||
0xff6b144a, 0x33c114d4, 0xbd4e1337, 0x71e413a9, 0x7b211ab0, 0xb78b1a2e, 0x39041dcd, 0xf5ae1d53, 0x2c8e0fff, 0xe0240f61, 0x6eab0882, 0xa201081c, 0xa8c40105, 0x646e019b, 0xeae10678, 0x264b06e6
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline constexpr T align(const T ptr, int64_t alignment)
|
||||
{
|
||||
template<typename T>
|
||||
inline constexpr T align(const T ptr, int64_t alignment)
|
||||
{
|
||||
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:
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@@ -224,3 +224,5 @@ namespace Seele
|
||||
T* handle;
|
||||
};
|
||||
}
|
||||
|
||||
using namespace Seele;
|
||||
Reference in New Issue
Block a user