Commit WIP about RenderSurface
This commit is contained in:
26
include/Nazara/Renderer/RenderDeviceInstance.hpp
Normal file
26
include/Nazara/Renderer/RenderDeviceInstance.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_RENDERDEVICEINSTANCE_HPP
|
||||
#define NAZARA_RENDERDEVICEINSTANCE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
///TODO: Rename
|
||||
class NAZARA_RENDERER_API RenderDeviceInstance
|
||||
{
|
||||
public:
|
||||
RenderDeviceInstance() = default;
|
||||
virtual ~RenderDeviceInstance();
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/RenderDeviceInstance.inl>
|
||||
|
||||
#endif // NAZARA_RENDERDEVICEINSTANCE_HPP
|
||||
12
include/Nazara/Renderer/RenderDeviceInstance.inl
Normal file
12
include/Nazara/Renderer/RenderDeviceInstance.inl
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/RenderDeviceInstance.hpp>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
30
include/Nazara/Renderer/RenderSurface.hpp
Normal file
30
include/Nazara/Renderer/RenderSurface.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_RENDERSURFACE_HPP
|
||||
#define NAZARA_RENDERSURFACE_HPP
|
||||
|
||||
#include <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Utility/WindowHandle.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
///TODO: Rename
|
||||
class NAZARA_RENDERER_API RenderSurface
|
||||
{
|
||||
public:
|
||||
RenderSurface() = default;
|
||||
virtual ~RenderSurface();
|
||||
|
||||
virtual bool Create(WindowHandle handle) = 0;
|
||||
virtual void Destroy() = 0;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/RenderSurface.inl>
|
||||
|
||||
#endif // NAZARA_RENDERSURFACE_HPP
|
||||
12
include/Nazara/Renderer/RenderSurface.inl
Normal file
12
include/Nazara/Renderer/RenderSurface.inl
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2016 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Renderer module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/RenderSurface.hpp>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <Nazara/Core/Clock.hpp>
|
||||
#include <Nazara/Math/Rect.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Renderer/RenderSurface.hpp>
|
||||
#include <Nazara/Renderer/RenderWindowImpl.hpp>
|
||||
#include <Nazara/Renderer/RenderWindowParameters.hpp>
|
||||
#include <Nazara/Utility/Window.hpp>
|
||||
@@ -52,6 +53,7 @@ namespace Nz
|
||||
private:
|
||||
std::unique_ptr<RenderWindowImpl> m_impl;
|
||||
Clock m_clock;
|
||||
std::unique_ptr<RenderSurface> m_surface;
|
||||
RenderWindowParameters m_parameters;
|
||||
unsigned int m_framerateLimit;
|
||||
};
|
||||
|
||||
@@ -16,13 +16,15 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class RenderSurface;
|
||||
|
||||
class NAZARA_RENDERER_API RenderWindowImpl
|
||||
{
|
||||
public:
|
||||
RenderWindowImpl() = default;
|
||||
virtual ~RenderWindowImpl();
|
||||
|
||||
virtual bool Create(WindowHandle handle, const Vector2ui& size, const RenderWindowParameters& parameters) = 0;
|
||||
virtual bool Create(RenderSurface* surface, const Vector2ui& size, const RenderWindowParameters& parameters) = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ namespace Nz
|
||||
class AbstractBuffer;
|
||||
class Buffer;
|
||||
class RendererImpl;
|
||||
class RenderDeviceInstance;
|
||||
class RenderSurface;
|
||||
class RenderWindowImpl;
|
||||
|
||||
using CreateRendererImplFunc = RendererImpl*(*)();
|
||||
@@ -32,8 +34,11 @@ namespace Nz
|
||||
virtual ~RendererImpl();
|
||||
|
||||
virtual std::unique_ptr<AbstractBuffer> CreateHardwareBufferImpl(Buffer* parent, BufferType type) = 0;
|
||||
virtual std::unique_ptr<RenderSurface> CreateRenderSurfaceImpl() = 0;
|
||||
virtual std::unique_ptr<RenderWindowImpl> CreateRenderWindowImpl() = 0;
|
||||
|
||||
virtual std::unique_ptr<RenderDeviceInstance> InstanciateRenderDevice(std::size_t deviceIndex) = 0;
|
||||
|
||||
virtual bool IsBetterThan(const RendererImpl* other) const = 0;
|
||||
|
||||
virtual RenderAPI QueryAPI() const = 0;
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
35
include/Nazara/VulkanRenderer/VulkanDevice.hpp
Normal file
35
include/Nazara/VulkanRenderer/VulkanDevice.hpp
Normal 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
|
||||
12
include/Nazara/VulkanRenderer/VulkanDevice.inl
Normal file
12
include/Nazara/VulkanRenderer/VulkanDevice.inl
Normal 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>
|
||||
@@ -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;
|
||||
|
||||
40
include/Nazara/VulkanRenderer/VulkanSurface.hpp
Normal file
40
include/Nazara/VulkanRenderer/VulkanSurface.hpp
Normal 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
|
||||
16
include/Nazara/VulkanRenderer/VulkanSurface.inl
Normal file
16
include/Nazara/VulkanRenderer/VulkanSurface.inl
Normal 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>
|
||||
Reference in New Issue
Block a user