Vulkan: Add buffer placeholder

This commit is contained in:
Lynix 2017-08-06 12:13:08 +02:00
parent 29cad19253
commit 5b922cf52f
5 changed files with 105 additions and 3 deletions

View File

@ -13,12 +13,12 @@
#include <Nazara/Renderer/Config.hpp>
#include <Nazara/Renderer/Enums.hpp>
#include <Nazara/Renderer/RenderDevice.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
#include <Nazara/Utility/Enums.hpp>
#include <vector>
namespace Nz
{
class AbstractBuffer;
class Buffer;
class RendererImpl;
class RenderDeviceInstance;

View File

@ -0,0 +1,49 @@
// Copyright (C) 2015 Jérôme Leclercq
// This file is part of the "Nazara Engine - Vulkan Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_VULKANRENDERER_BUFFER_HPP
#define NAZARA_VULKANRENDERER_BUFFER_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Utility/AbstractBuffer.hpp>
#include <Nazara/Utility/SoftwareBuffer.hpp>
#include <Nazara/VulkanRenderer/Config.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Buffer.hpp>
#include <vector>
namespace Nz
{
//TODO: Move all the software stuff to the Renderer
class NAZARA_VULKANRENDERER_API VulkanBuffer : public AbstractBuffer
{
public:
inline VulkanBuffer(Buffer* parent, BufferType type);
VulkanBuffer(const VulkanBuffer&) = delete;
VulkanBuffer(VulkanBuffer&&) = delete; ///TODO
virtual ~VulkanBuffer();
bool Fill(const void* data, UInt32 offset, UInt32 size) override;
bool Initialize(UInt32 size, BufferUsageFlags usage) override;
DataStorage GetStorage() const override;
void* Map(BufferAccess access, UInt32 offset = 0, UInt32 size = 0) override;
bool Unmap() override;
VulkanBuffer& operator=(const VulkanBuffer&) = delete;
VulkanBuffer& operator=(VulkanBuffer&&) = delete; ///TODO
private:
BufferUsageFlags m_usage;
SoftwareBuffer m_softwareData;
};
}
#include <Nazara/VulkanRenderer/VulkanBuffer.inl>
#endif // NAZARA_VULKANRENDERER_BUFFER_HPP

View File

@ -0,0 +1,16 @@
// Copyright (C) 2016 Jérôme Leclercq
// This file is part of the "Nazara Engine - Vulkan Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/VulkanRenderer/VulkanBuffer.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
inline VulkanBuffer::VulkanBuffer(Buffer* parent, BufferType type) :
m_softwareData(parent, type)
{
}
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>

View File

@ -0,0 +1,37 @@
// Copyright (C) 2016 Jérôme Leclercq
// This file is part of the "Nazara Engine - Vulkan Renderer"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/VulkanRenderer/VulkanBuffer.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
VulkanBuffer::~VulkanBuffer() = default;
bool VulkanBuffer::Fill(const void* data, UInt32 offset, UInt32 size)
{
return m_softwareData.Fill(data, offset, size);
}
bool VulkanBuffer::Initialize(UInt32 size, BufferUsageFlags usage)
{
m_usage = usage;
return m_softwareData.Initialize(size, usage);
}
DataStorage VulkanBuffer::GetStorage() const
{
return DataStorage_Hardware;
}
void* VulkanBuffer::Map(BufferAccess access, UInt32 offset, UInt32 size)
{
return m_softwareData.Map(access, offset, size);
}
bool VulkanBuffer::Unmap()
{
return m_softwareData.Unmap();
}
}

View File

@ -5,7 +5,7 @@
#include <Nazara/VulkanRenderer/VulkanRenderer.hpp>
#include <Nazara/Core/ErrorFlags.hpp>
#include <Nazara/Renderer/RenderDeviceInstance.hpp>
//#include <Nazara/VulkanRenderer/VulkanBuffer.hpp>
#include <Nazara/VulkanRenderer/VulkanBuffer.hpp>
#include <Nazara/VulkanRenderer/VulkanSurface.hpp>
#include <Nazara/VulkanRenderer/VkRenderWindow.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Loader.hpp>
@ -20,7 +20,7 @@ namespace Nz
std::unique_ptr<AbstractBuffer> VulkanRenderer::CreateHardwareBufferImpl(Buffer* parent, BufferType type)
{
return nullptr; //< TODO
return std::make_unique<VulkanBuffer>(parent, type); //< TODO
}
std::unique_ptr<RenderSurface> VulkanRenderer::CreateRenderSurfaceImpl()