Fixing a boatload of warnings

This commit is contained in:
Stefan Högler
2021-04-01 16:40:14 +02:00
parent f042480540
commit d5f0fe644f
84 changed files with 496 additions and 407 deletions
+13 -3
View File
@@ -5,7 +5,11 @@
using namespace Seele::Vulkan;
SubAllocation::SubAllocation(Allocation *owner, VkDeviceSize allocatedOffset, VkDeviceSize size, VkDeviceSize alignedOffset, VkDeviceSize allocatedSize)
: owner(owner), size(size), allocatedOffset(allocatedOffset), alignedOffset(alignedOffset), allocatedSize(allocatedSize)
: owner(owner)
, size(size)
, allocatedOffset(allocatedOffset)
, alignedOffset(alignedOffset)
, allocatedSize(allocatedSize)
{
}
@@ -41,7 +45,13 @@ void SubAllocation::invalidateMemory()
Allocation::Allocation(PGraphics graphics, Allocator *allocator, VkDeviceSize size, uint8 memoryTypeIndex,
VkMemoryPropertyFlags properties, VkMemoryDedicatedAllocateInfo *dedicatedInfo)
: device(graphics->getDevice()), allocator(allocator), bytesAllocated(0), bytesUsed(0), readable(properties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT), properties(properties), memoryTypeIndex(memoryTypeIndex)
: device(graphics->getDevice())
, allocator(allocator)
, bytesAllocated(0)
, bytesUsed(0)
, readable(properties & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)
, properties(properties)
, memoryTypeIndex(memoryTypeIndex)
{
VkMemoryAllocateInfo allocInfo =
init::MemoryAllocateInfo();
@@ -224,7 +234,7 @@ PSubAllocation Allocator::allocate(const VkMemoryRequirements2 &memRequirements2
}
// no suitable allocations found, allocate new block
PAllocation newAllocation = new Allocation(graphics, this, (requirements.size > MemoryBlockSize) ? requirements.size : MemoryBlockSize, memoryTypeIndex, properties, nullptr);
PAllocation newAllocation = new Allocation(graphics, this, (requirements.size > MemoryBlockSize) ? requirements.size : (VkDeviceSize)MemoryBlockSize, memoryTypeIndex, properties, nullptr);
heaps[heapIndex].allocations.add(newAllocation);
return newAllocation->getSuballocation(requirements.size, requirements.alignment);
}
+11 -11
View File
@@ -9,7 +9,7 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(Graphics);
DECLARE_REF(Graphics)
class Allocation;
class Allocator;
class SubAllocation
@@ -33,14 +33,14 @@ public:
private:
Allocation *owner;
VkDeviceSize allocatedOffset;
VkDeviceSize size;
VkDeviceSize allocatedOffset;
VkDeviceSize alignedOffset;
VkDeviceSize allocatedSize;
friend class Allocation;
friend class Allocator;
};
DEFINE_REF(SubAllocation);
DEFINE_REF(SubAllocation)
class Allocation
{
public:
@@ -94,24 +94,24 @@ public:
}
private:
Allocator *allocator;
VkDevice device;
VkDeviceMemory allocatedMemory;
Allocator *allocator;
VkDeviceSize bytesAllocated;
VkDeviceSize bytesUsed;
VkMemoryPropertyFlags properties;
VkDeviceMemory allocatedMemory;
Map<VkDeviceSize, SubAllocation *> activeAllocations;
Map<VkDeviceSize, PSubAllocation> freeRanges;
std::mutex lock;
void *mappedPointer;
uint8 memoryTypeIndex;
uint8 isDedicated : 1;
uint8 canMap : 1;
uint8 isMapped : 1;
uint8 readable : 1;
VkMemoryPropertyFlags properties;
uint8 memoryTypeIndex;
friend class Allocator;
};
DEFINE_REF(Allocation);
DEFINE_REF(Allocation)
class Allocator
{
@@ -159,7 +159,7 @@ private:
PGraphics graphics;
VkPhysicalDeviceMemoryProperties memProperties;
};
DEFINE_REF(Allocator);
DEFINE_REF(Allocator)
class StagingBuffer
{
@@ -207,7 +207,7 @@ private:
uint8 bReadable;
friend class StagingManager;
};
DEFINE_REF(StagingBuffer);
DEFINE_REF(StagingBuffer)
class StagingManager
{
@@ -225,6 +225,6 @@ private:
Array<StagingBuffer *> activeBuffers;
std::mutex lock;
};
DEFINE_REF(StagingManager);
DEFINE_REF(StagingManager)
} // namespace Vulkan
} // namespace Seele
+12 -9
View File
@@ -17,7 +17,10 @@ struct PendingBuffer
static Map<ShaderBuffer *, PendingBuffer> pendingBuffers;
ShaderBuffer::ShaderBuffer(PGraphics graphics, uint32 size, VkBufferUsageFlags usage, Gfx::QueueType queueType)
: graphics(graphics), currentBuffer(0), size(size), currentOwner(queueType)
: graphics(graphics)
, currentBuffer(0)
, size(size)
, currentOwner(queueType)
{
if (usage & VK_BUFFER_USAGE_INDEX_BUFFER_BIT ||
usage & VK_BUFFER_USAGE_VERTEX_BUFFER_BIT ||
@@ -242,8 +245,8 @@ void ShaderBuffer::unlock()
}
UniformBuffer::UniformBuffer(PGraphics graphics, const UniformBufferCreateInfo &createInfo)
: Vulkan::ShaderBuffer(graphics, createInfo.resourceData.size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, createInfo.resourceData.owner)
, Gfx::UniformBuffer(graphics->getFamilyMapping(), createInfo.resourceData)
: Gfx::UniformBuffer(graphics->getFamilyMapping(), createInfo.resourceData)
, Vulkan::ShaderBuffer(graphics, createInfo.resourceData.size, VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT, createInfo.resourceData.owner)
, dedicatedStagingBuffer(nullptr)
{
if(createInfo.bDynamic)
@@ -313,8 +316,8 @@ VkAccessFlags UniformBuffer::getDestAccessMask()
}
StructuredBuffer::StructuredBuffer(PGraphics graphics, const BulkResourceData &resourceData)
: Vulkan::ShaderBuffer(graphics, resourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, resourceData.owner)
, Gfx::StructuredBuffer(graphics->getFamilyMapping(), resourceData.owner)
: Gfx::StructuredBuffer(graphics->getFamilyMapping(), resourceData.owner)
, Vulkan::ShaderBuffer(graphics, resourceData.size, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT, resourceData.owner)
{
if (resourceData.data != nullptr)
{
@@ -349,8 +352,8 @@ VkAccessFlags StructuredBuffer::getDestAccessMask()
}
VertexBuffer::VertexBuffer(PGraphics graphics, const VertexBufferCreateInfo &resourceData)
: Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, resourceData.resourceData.owner)
, Gfx::VertexBuffer(graphics->getFamilyMapping(), resourceData.numVertices, resourceData.vertexSize, resourceData.resourceData.owner)
: Gfx::VertexBuffer(graphics->getFamilyMapping(), resourceData.numVertices, resourceData.vertexSize, resourceData.resourceData.owner)
, Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, resourceData.resourceData.owner)
{
if (resourceData.resourceData.data != nullptr)
{
@@ -385,8 +388,8 @@ VkAccessFlags VertexBuffer::getDestAccessMask()
}
IndexBuffer::IndexBuffer(PGraphics graphics, const IndexBufferCreateInfo &resourceData)
: Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, resourceData.resourceData.owner)
, Gfx::IndexBuffer(graphics->getFamilyMapping(), resourceData.resourceData.size, resourceData.indexType, resourceData.resourceData.owner)
: Gfx::IndexBuffer(graphics->getFamilyMapping(), resourceData.resourceData.size, resourceData.indexType, resourceData.resourceData.owner)
, Vulkan::ShaderBuffer(graphics, resourceData.resourceData.size, VK_BUFFER_USAGE_INDEX_BUFFER_BIT, resourceData.resourceData.owner)
{
if (resourceData.resourceData.data != nullptr)
{
@@ -23,7 +23,11 @@ CmdBufferBase::~CmdBufferBase()
}
CmdBuffer::CmdBuffer(PGraphics graphics, VkCommandPool cmdPool, PCommandBufferManager manager)
: CmdBufferBase(graphics, cmdPool), renderPass(nullptr), framebuffer(nullptr), subpassIndex(0), manager(manager)
: CmdBufferBase(graphics, cmdPool)
, manager(manager)
, renderPass(nullptr)
, framebuffer(nullptr)
, subpassIndex(0)
{
VkCommandBufferAllocateInfo allocInfo =
init::CommandBufferAllocateInfo(cmdPool,
@@ -7,8 +7,8 @@ namespace Seele
struct VertexInputStream;
namespace Vulkan
{
DECLARE_REF(RenderPass);
DECLARE_REF(Framebuffer);
DECLARE_REF(RenderPass)
DECLARE_REF(Framebuffer)
class CmdBufferBase
{
public:
@@ -27,10 +27,10 @@ protected:
VkCommandBuffer handle;
VkCommandPool owner;
};
DEFINE_REF(CmdBufferBase);
DEFINE_REF(CmdBufferBase)
DECLARE_REF(SecondaryCmdBuffer);
DECLARE_REF(CommandBufferManager);
DECLARE_REF(SecondaryCmdBuffer)
DECLARE_REF(CommandBufferManager)
class CmdBuffer : public CmdBufferBase
{
public:
@@ -68,10 +68,10 @@ private:
friend class CommandBufferManager;
friend class Queue;
};
DEFINE_REF(CmdBuffer);
DEFINE_REF(CmdBuffer)
DECLARE_REF(GraphicsPipeline);
DECLARE_REF(DescriptorSet);
DECLARE_REF(GraphicsPipeline)
DECLARE_REF(DescriptorSet)
class SecondaryCmdBuffer : public Gfx::RenderCommand, public CmdBufferBase
{
public:
@@ -94,7 +94,7 @@ private:
Array<PDescriptorSet> boundDescriptors;
friend class CmdBuffer;
};
DEFINE_REF(SecondaryCmdBuffer);
DEFINE_REF(SecondaryCmdBuffer)
class CommandBufferManager
{
@@ -119,6 +119,6 @@ private:
std::mutex allocatedBufferLock;
Array<PCmdBuffer> allocatedBuffers;
};
DEFINE_REF(CommandBufferManager);
DEFINE_REF(CommandBufferManager)
} // namespace Vulkan
} // namespace Seele
@@ -218,7 +218,9 @@ void DescriptorSet::writeChanges()
}
DescriptorAllocator::DescriptorAllocator(PGraphics graphics, DescriptorLayout &layout)
: layout(layout), graphics(graphics), currentCachedIndex(0)
: graphics(graphics)
, layout(layout)
, currentCachedIndex(0)
{
std::memset(&cachedHandles, 0, sizeof(cachedHandles));
@@ -5,7 +5,7 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(Graphics);
DECLARE_REF(Graphics)
class DescriptorLayout : public Gfx::DescriptorLayout
{
public:
@@ -24,12 +24,14 @@ private:
VkDescriptorSetLayout layoutHandle;
friend class DescriptorAllocator;
};
DEFINE_REF(DescriptorLayout);
DEFINE_REF(DescriptorLayout)
class PipelineLayout : public Gfx::PipelineLayout
{
public:
PipelineLayout(PGraphics graphics)
: graphics(graphics), layoutHash(0), layoutHandle(VK_NULL_HANDLE)
: graphics(graphics)
, layoutHash(0)
, layoutHandle(VK_NULL_HANDLE)
{
}
virtual ~PipelineLayout();
@@ -46,11 +48,11 @@ public:
private:
Array<VkDescriptorSetLayout> vulkanDescriptorLayouts;
PGraphics graphics;
uint32 layoutHash;
VkPipelineLayout layoutHandle;
PGraphics graphics;
};
DEFINE_REF(PipelineLayout);
DEFINE_REF(PipelineLayout)
class DescriptorAllocator : public Gfx::DescriptorAllocator
{
@@ -71,13 +73,13 @@ public:
private:
PGraphics graphics;
DescriptorLayout &layout;
uint32 currentCachedIndex;
const static int maxSets = 512;
VkDescriptorSet cachedHandles[maxSets];
uint32 currentCachedIndex;
VkDescriptorPool poolHandle;
DescriptorLayout &layout;
};
DEFINE_REF(DescriptorAllocator);
DEFINE_REF(DescriptorAllocator)
class DescriptorSet : public Gfx::DescriptorSet
{
@@ -119,12 +121,12 @@ private:
// would not work anyways, so casts should be safe
Array<void*> cachedData[Gfx::numFramesBuffered];
VkDescriptorSet setHandle[Gfx::numFramesBuffered];
PGraphics graphics;
PDescriptorAllocator owner;
PCmdBuffer currentlyBound;
PGraphics graphics;
friend class DescriptorAllocator;
};
DEFINE_REF(DescriptorSet);
DEFINE_REF(DescriptorSet)
} // namespace Vulkan
} // namespace Seele
@@ -5,7 +5,7 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(RenderPass);
DECLARE_REF(RenderPass)
struct FramebufferDescription
{
VkImageView inputAttachments[16];
@@ -35,6 +35,6 @@ private:
Gfx::PRenderTargetLayout layout;
PRenderPass renderPass;
};
DEFINE_REF(Framebuffer);
DEFINE_REF(Framebuffer)
} // namespace Vulkan
} // namespace Seele
@@ -10,12 +10,15 @@
#include "VulkanDescriptorSets.h"
#include "VulkanShader.h"
#include "Graphics/GraphicsResources.h"
#include <glfw/glfw3.h>
#include <GLFW/glfw3.h>
using namespace Seele::Vulkan;
Graphics::Graphics()
: callback(VK_NULL_HANDLE), handle(VK_NULL_HANDLE), instance(VK_NULL_HANDLE), physicalDevice(VK_NULL_HANDLE)
: instance(VK_NULL_HANDLE)
, handle(VK_NULL_HANDLE)
, physicalDevice(VK_NULL_HANDLE)
, callback(VK_NULL_HANDLE)
{
}
@@ -161,7 +164,7 @@ Gfx::PGraphicsPipeline Graphics::createGraphicsPipeline(const GraphicsPipelineCr
return pipeline;
}
Gfx::PSamplerState Graphics::createSamplerState(const SamplerCreateInfo& createInfo)
Gfx::PSamplerState Graphics::createSamplerState(const SamplerCreateInfo&)
{
PSamplerState sampler = new SamplerState(); // TODO: proper sampler creation
VkSamplerCreateInfo vkInfo =
+9 -9
View File
@@ -6,13 +6,13 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(Allocator);
DECLARE_REF(StagingManager);
DECLARE_REF(CommandBufferManager);
DECLARE_REF(Queue);
DECLARE_REF(Framebuffer);
DECLARE_REF(RenderCommand);
DECLARE_REF(PipelineCache);
DECLARE_REF(Allocator)
DECLARE_REF(StagingManager)
DECLARE_REF(CommandBufferManager)
DECLARE_REF(Queue)
DECLARE_REF(Framebuffer)
DECLARE_REF(RenderCommand)
DECLARE_REF(PipelineCache)
class Graphics : public Gfx::Graphics
{
public:
@@ -72,9 +72,9 @@ protected:
void pickPhysicalDevice();
void createDevice(GraphicsInitializer initInfo);
VkInstance instance;
VkDevice handle;
VkPhysicalDevice physicalDevice;
VkInstance instance;
PQueue graphicsQueue;
PQueue computeQueue;
@@ -96,6 +96,6 @@ protected:
friend class Window;
};
DEFINE_REF(Graphics);
DEFINE_REF(Graphics)
} // namespace Vulkan
} // namespace Seele
@@ -72,7 +72,8 @@ Semaphore::~Semaphore()
}
Fence::Fence(PGraphics graphics)
: graphics(graphics), signaled(false)
: graphics(graphics)
, signaled(false)
{
VkFenceCreateInfo info =
init::FenceCreateInfo(0);
@@ -8,11 +8,11 @@ namespace Seele
namespace Vulkan
{
DECLARE_REF(DescriptorAllocator);
DECLARE_REF(CommandBufferManager);
DECLARE_REF(CmdBuffer);
DECLARE_REF(Graphics);
DECLARE_REF(SubAllocation);
DECLARE_REF(DescriptorAllocator)
DECLARE_REF(CommandBufferManager)
DECLARE_REF(CmdBuffer)
DECLARE_REF(Graphics)
DECLARE_REF(SubAllocation)
class Semaphore
{
public:
@@ -27,7 +27,7 @@ private:
VkSemaphore handle;
PGraphics graphics;
};
DEFINE_REF(Semaphore);
DEFINE_REF(Semaphore)
class Fence
{
@@ -47,11 +47,11 @@ public:
}
private:
PGraphics graphics;
bool signaled;
VkFence fence;
PGraphics graphics;
};
DEFINE_REF(Fence);
DEFINE_REF(Fence)
class VertexDeclaration : public Gfx::VertexDeclaration
{
@@ -62,7 +62,7 @@ public:
virtual ~VertexDeclaration();
private:
};
DEFINE_REF(VertexDeclaration);
DEFINE_REF(VertexDeclaration)
class QueueOwnedResourceDeletion
{
@@ -112,12 +112,12 @@ protected:
VkBuffer buffer;
PSubAllocation allocation;
};
BufferAllocation buffers[Gfx::numFramesBuffered];
uint32 numBuffers;
PGraphics graphics;
uint32 currentBuffer;
uint32 size;
PGraphics graphics;
Gfx::QueueType currentOwner;
BufferAllocation buffers[Gfx::numFramesBuffered];
uint32 numBuffers;
void executeOwnershipBarrier(Gfx::QueueType newOwner);
virtual void requestOwnershipTransfer(Gfx::QueueType newOwner) = 0;
@@ -125,9 +125,9 @@ protected:
virtual VkAccessFlags getSourceAccessMask() = 0;
virtual VkAccessFlags getDestAccessMask() = 0;
};
DEFINE_REF(ShaderBuffer);
DEFINE_REF(ShaderBuffer)
DECLARE_REF(StagingBuffer);
DECLARE_REF(StagingBuffer)
class UniformBuffer : public Gfx::UniformBuffer, public ShaderBuffer
{
public:
@@ -147,7 +147,7 @@ protected:
private:
PStagingBuffer dedicatedStagingBuffer;
};
DEFINE_REF(UniformBuffer);
DEFINE_REF(UniformBuffer)
class StructuredBuffer : public Gfx::StructuredBuffer, public ShaderBuffer
{
@@ -163,7 +163,7 @@ protected:
// Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
};
DEFINE_REF(StructuredBuffer);
DEFINE_REF(StructuredBuffer)
class VertexBuffer : public Gfx::VertexBuffer, public ShaderBuffer
{
@@ -179,7 +179,7 @@ protected:
// Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
};
DEFINE_REF(VertexBuffer);
DEFINE_REF(VertexBuffer)
class IndexBuffer : public Gfx::IndexBuffer, public ShaderBuffer
{
@@ -195,7 +195,7 @@ protected:
// Inherited via QueueOwnedResource
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
};
DEFINE_REF(IndexBuffer);
DEFINE_REF(IndexBuffer)
class TextureHandle
{
@@ -303,14 +303,14 @@ protected:
virtual void executeOwnershipBarrier(Gfx::QueueType newOwner);
};
DEFINE_REF(Texture2D);
DEFINE_REF(Texture2D)
class SamplerState : public Gfx::SamplerState
{
public:
VkSampler sampler;
};
DEFINE_REF(SamplerState);
DEFINE_REF(SamplerState)
class Window : public Gfx::Window
{
@@ -347,10 +347,11 @@ protected:
PSemaphore imageAcquiredSemaphore;
PGraphics graphics;
VkFormat pixelFormat;
VkSampleCountFlags numSamples;
VkPresentModeKHR presentMode;
VkInstance instance;
VkSwapchainKHR swapchain;
VkSampleCountFlags numSamples;
VkFormat pixelFormat;
VkPresentModeKHR presentMode;
VkSurfaceKHR surface;
VkSurfaceFormatKHR surfaceFormat;
void *windowHandle;
@@ -358,9 +359,8 @@ protected:
int32 acquiredImageIndex;
int32 preAcquiredImageIndex;
int32 semaphoreIndex;
VkInstance instance;
};
DEFINE_REF(Window);
DEFINE_REF(Window)
class Viewport : public Gfx::Viewport
{
@@ -375,6 +375,6 @@ private:
PGraphics graphics;
friend class Graphics;
};
DECLARE_REF(Viewport);
DECLARE_REF(Viewport)
} // namespace Vulkan
} // namespace Seele
+4 -4
View File
@@ -5,8 +5,8 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(PipelineLayout);
DECLARE_REF(Graphics);
DECLARE_REF(PipelineLayout)
DECLARE_REF(Graphics)
class GraphicsPipeline : public Gfx::GraphicsPipeline
{
public:
@@ -15,9 +15,9 @@ public:
void bind(VkCommandBuffer handle);
VkPipelineLayout getLayout() const;
private:
VkPipeline pipeline;
PGraphics graphics;
VkPipeline pipeline;
};
DEFINE_REF(GraphicsPipeline);
DEFINE_REF(GraphicsPipeline)
} // namespace Vulkan
} // namespace Seele
@@ -17,6 +17,6 @@ private:
std::string cacheFile;
Map<uint32, VkPipeline> createdPipelines;
};
DEFINE_REF(PipelineCache);
DEFINE_REF(PipelineCache)
} // namespace Vulkan
} // namespace Seele
+3 -1
View File
@@ -9,7 +9,9 @@ using namespace Seele;
using namespace Seele::Vulkan;
Queue::Queue(PGraphics graphics, Gfx::QueueType queueType, uint32 familyIndex, uint32 queueIndex)
: familyIndex(familyIndex), graphics(graphics), queueType(queueType)
: graphics(graphics)
, familyIndex(familyIndex)
, queueType(queueType)
{
vkGetDeviceQueue(graphics->getDevice(), familyIndex, queueIndex, &queue);
}
+2 -2
View File
@@ -5,8 +5,8 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(CmdBuffer);
DECLARE_REF(Graphics);
DECLARE_REF(CmdBuffer)
DECLARE_REF(Graphics)
class Queue
{
public:
@@ -38,6 +38,6 @@ private:
VkRect2D renderArea;
VkSubpassContents subpassContents;
};
DEFINE_REF(RenderPass);
DEFINE_REF(RenderPass)
} // namespace Vulkan
} // namespace Seele
+1 -2
View File
@@ -2,8 +2,7 @@
#include "VulkanGraphics.h"
#include "VulkanDescriptorSets.h"
#include "slang.h"
#include "spirv_cross/spirv_reflect.hpp"
#include <fstream>
//#include "spirv_cross/spirv_reflect.hpp"
using namespace slang;
using namespace Seele;
+10 -10
View File
@@ -6,8 +6,8 @@ namespace Seele
{
namespace Vulkan
{
DECLARE_REF(Graphics);
DECLARE_REF(DescriptorLayout);
DECLARE_REF(Graphics)
DECLARE_REF(DescriptorLayout)
class Shader
{
public:
@@ -31,12 +31,12 @@ private:
PGraphics graphics;
Map<uint32, PDescriptorLayout> descriptorSets;
VkShaderModule module;
VkShaderStageFlags stage;
ShaderType type;
VkShaderStageFlags stage;
std::string entryPointName;
uint32 hash;
};
DEFINE_REF(Shader);
DEFINE_REF(Shader)
template <typename Base, ShaderType shaderType, VkShaderStageFlags stageFlags>
class ShaderBase : public Base, public Shader
@@ -57,12 +57,12 @@ typedef ShaderBase<Gfx::GeometryShader, ShaderType::GEOMETRY, VK_SHADER_STAGE_GE
typedef ShaderBase<Gfx::FragmentShader, ShaderType::FRAGMENT, VK_SHADER_STAGE_FRAGMENT_BIT> FragmentShader;
typedef ShaderBase<Gfx::ComputeShader, ShaderType::COMPUTE, VK_SHADER_STAGE_COMPUTE_BIT> ComputeShader;
DEFINE_REF(VertexShader);
DEFINE_REF(ControlShader);
DEFINE_REF(EvaluationShader);
DEFINE_REF(GeometryShader);
DEFINE_REF(FragmentShader);
DEFINE_REF(ComputeShader);
DEFINE_REF(VertexShader)
DEFINE_REF(ControlShader)
DEFINE_REF(EvaluationShader)
DEFINE_REF(GeometryShader)
DEFINE_REF(FragmentShader)
DEFINE_REF(ComputeShader)
} // namespace Vulkan
}
+5 -5
View File
@@ -36,13 +36,13 @@ TextureHandle::TextureHandle(PGraphics graphics, VkImageViewType viewType,
, sizeX(createInfo.width)
, sizeY(createInfo.height)
, sizeZ(createInfo.depth)
, mipLevels(createInfo.mipLevels)
, format(createInfo.format)
, samples(createInfo.samples)
, usage(createInfo.usage)
, arrayCount(createInfo.bArray ? createInfo.arrayLayers : 1)
, aspect(getAspectFromFormat(createInfo.format))
, mipLevels(createInfo.mipLevels)
, samples(createInfo.samples)
, format(createInfo.format)
, usage(createInfo.usage)
, image(existingImage)
, aspect(getAspectFromFormat(createInfo.format))
, layout(VK_IMAGE_LAYOUT_UNDEFINED)
{
if (existingImage == VK_NULL_HANDLE)
@@ -3,12 +3,12 @@
#include "VulkanInitializer.h"
#include "VulkanGraphicsEnums.h"
#include "VulkanCommandBuffer.h"
#include <glfw/glfw3.h>
#include <GLFW/glfw3.h>
using namespace Seele;
using namespace Seele::Vulkan;
void glfwKeyCallback(GLFWwindow* handle, int key, int scancode, int action, int modifier)
void glfwKeyCallback(GLFWwindow* handle, int key, int action, int, int modifier)
{
Window* window = (Window*)glfwGetWindowUserPointer(handle);
window->keyCallback((KeyCode)key, (InputAction)action, (KeyModifier)modifier);
@@ -39,7 +39,12 @@ void glfwFileCallback(GLFWwindow* handle, int count, const char** paths)
}
Window::Window(PGraphics graphics, const WindowCreateInfo &createInfo)
: Gfx::Window(createInfo), graphics(graphics), instance(graphics->getInstance()), swapchain(VK_NULL_HANDLE), numSamples(createInfo.numSamples), pixelFormat(cast(createInfo.pixelFormat))
: Gfx::Window(createInfo)
, graphics(graphics)
, instance(graphics->getInstance())
, swapchain(VK_NULL_HANDLE)
, numSamples(createInfo.numSamples)
, pixelFormat(cast(createInfo.pixelFormat))
{
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
GLFWwindow *handle = glfwCreateWindow(createInfo.width, createInfo.height, createInfo.title, createInfo.bFullscreen ? glfwGetPrimaryMonitor() : nullptr, nullptr);
@@ -207,6 +212,7 @@ void Window::present()
{
presentResult = vkQueuePresentKHR(graphics->getGraphicsCommands()->getQueue()->getHandle(), &info);
}
Gfx::currentFrameIndex = (Gfx::currentFrameIndex + 1)%Gfx::numFramesBuffered;
}
void Window::createSwapchain()