Commit WIP about RenderSurface

This commit is contained in:
Lynix
2016-11-10 12:54:10 +01:00
parent 86b892c3bc
commit c136f8eddc
22 changed files with 321 additions and 37 deletions

View File

@@ -39,13 +39,12 @@ namespace Nz
void BuildPreRenderCommands(UInt32 imageIndex, Vk::CommandBuffer& commandBuffer) override;
void BuildPostRenderCommands(UInt32 imageIndex, Vk::CommandBuffer& commandBuffer) override;
bool Create(WindowHandle handle, const Vector2ui& size, const RenderWindowParameters& parameters) override;
bool Create(RenderSurface* surface, const Vector2ui& size, const RenderWindowParameters& parameters) override;
inline const Vk::Framebuffer& GetFrameBuffer(UInt32 imageIndex) const override;
inline UInt32 GetFramebufferCount() const;
inline const Vk::DeviceHandle& GetDevice() const;
inline UInt32 GetPresentableFamilyQueue() const;
inline const Vk::Surface& GetSurface() const;
inline const Vk::Swapchain& GetSwapchain() const;
void Present(UInt32 imageIndex) override;
@@ -56,7 +55,7 @@ namespace Nz
private:
bool SetupDepthBuffer(const Vector2ui& size);
bool SetupRenderPass(const Vector2ui& size);
bool SetupSwapchain(const Vector2ui& size);
bool SetupSwapchain(Vk::Surface& surface, const Vector2ui& size);
Clock m_clock;
VkColorSpaceKHR m_colorSpace;
@@ -69,7 +68,6 @@ namespace Nz
Vk::Image m_depthBuffer;
Vk::ImageView m_depthBufferView;
Vk::Queue m_presentQueue;
Vk::Surface m_surface;
Vk::Swapchain m_swapchain;
UInt32 m_presentableFamilyQueue;
};

View File

@@ -27,11 +27,6 @@ namespace Nz
return m_presentableFamilyQueue;
}
inline const Vk::Surface& VkRenderWindow::GetSurface() const
{
return m_surface;
}
inline const Vk::Swapchain& VkRenderWindow::GetSwapchain() const
{
return m_swapchain;

View File

@@ -0,0 +1,35 @@
// 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_VULKANDEVICE_HPP
#define NAZARA_VULKANRENDERER_VULKANDEVICE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Renderer/RenderDeviceInstance.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Device.hpp>
#include <vector>
namespace Nz
{
//TODO: Move all the software stuff to the Renderer
class NAZARA_VULKANRENDERER_API VulkanDevice : public RenderDeviceInstance
{
public:
VulkanDevice(Vk::DeviceHandle device);
~VulkanDevice();
VulkanDevice& operator=(const VulkanDevice&) = delete;
VulkanDevice& operator=(VulkanDevice&&) = delete; ///TODO
private:
Vk::DeviceHandle m_device;
};
}
#include <Nazara/VulkanRenderer/VulkanDevice.inl>
#endif // NAZARA_VULKANRENDERER_VULKANDEVICE_HPP

View File

@@ -0,0 +1,12 @@
// 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/VulkanDevice.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>

View File

@@ -25,8 +25,12 @@ namespace Nz
VulkanRenderer() = default;
~VulkanRenderer();
std::unique_ptr<AbstractBuffer> CreateHardwareBufferImpl(Buffer* parent, BufferType type) override;
std::unique_ptr<RenderSurface> CreateRenderSurfaceImpl() override;
std::unique_ptr<RenderWindowImpl> CreateRenderWindowImpl() override;
std::unique_ptr<RenderDeviceInstance> InstanciateRenderDevice(std::size_t deviceIndex) override;
bool IsBetterThan(const RendererImpl* other) const override;
RenderAPI QueryAPI() const override;

View File

@@ -0,0 +1,40 @@
// 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_SURFACE_HPP
#define NAZARA_VULKANRENDERER_SURFACE_HPP
#include <Nazara/Prerequesites.hpp>
#include <Nazara/Renderer/RenderSurface.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Surface.hpp>
#include <Nazara/VulkanRenderer/Wrapper/Swapchain.hpp>
namespace Nz
{
class NAZARA_VULKANRENDERER_API VulkanSurface : public RenderSurface
{
public:
VulkanSurface();
VulkanSurface(const VulkanSurface&) = delete;
VulkanSurface(VulkanSurface&&) = delete; ///TODO
virtual ~VulkanSurface();
bool Create(WindowHandle handle) override;
void Destroy() override;
inline Vk::Surface& GetSurface();
VulkanSurface& operator=(const VulkanSurface&) = delete;
VulkanSurface& operator=(VulkanSurface&&) = delete; ///TODO
private:
Vk::Surface m_surface;
};
}
#include <Nazara/VulkanRenderer/VulkanSurface.inl>
#endif // NAZARA_VULKANRENDERER_SURFACE_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/VulkanSurface.hpp>
#include <Nazara/VulkanRenderer/Debug.hpp>
namespace Nz
{
inline Vk::Surface& VulkanSurface::GetSurface()
{
return m_surface;
}
}
#include <Nazara/VulkanRenderer/DebugOff.hpp>