Vulkan: Add renderpass and framebuffers
This commit is contained in:
@@ -17,20 +17,27 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class Framebuffer;
|
||||
class RenderPass;
|
||||
class RenderPipeline;
|
||||
class ShaderBinding;
|
||||
|
||||
class NAZARA_RENDERER_API CommandBufferBuilder
|
||||
{
|
||||
public:
|
||||
struct ClearValues;
|
||||
|
||||
CommandBufferBuilder() = default;
|
||||
CommandBufferBuilder(const CommandBufferBuilder&) = delete;
|
||||
CommandBufferBuilder(CommandBufferBuilder&&) = default;
|
||||
virtual ~CommandBufferBuilder();
|
||||
|
||||
virtual void BeginDebugRegion(const std::string_view& regionName, const Nz::Color& color) = 0;
|
||||
virtual void BeginRenderPass(const Framebuffer& framebuffer, const RenderPass& renderPass, Nz::Recti renderRect, std::initializer_list<ClearValues> clearValues) = 0;
|
||||
|
||||
virtual void BindIndexBuffer(Nz::AbstractBuffer* indexBuffer, UInt64 offset = 0) = 0;
|
||||
virtual void BindShaderBinding(ShaderBinding& binding) = 0;
|
||||
virtual void BindPipeline(const RenderPipeline& pipeline) = 0;
|
||||
virtual void BindShaderBinding(const ShaderBinding& binding) = 0;
|
||||
virtual void BindVertexBuffer(UInt32 binding, Nz::AbstractBuffer* vertexBuffer, UInt64 offset = 0) = 0;
|
||||
|
||||
inline void CopyBuffer(const RenderBufferView& source, const RenderBufferView& target);
|
||||
@@ -42,6 +49,7 @@ namespace Nz
|
||||
virtual void DrawIndexed(UInt32 indexCount, UInt32 instanceCount = 1, UInt32 firstVertex = 0, UInt32 firstInstance = 0) = 0;
|
||||
|
||||
virtual void EndDebugRegion() = 0;
|
||||
virtual void EndRenderPass() = 0;
|
||||
|
||||
virtual void PreTransferBarrier() = 0;
|
||||
virtual void PostTransferBarrier() = 0;
|
||||
@@ -51,6 +59,13 @@ namespace Nz
|
||||
|
||||
CommandBufferBuilder& operator=(const CommandBufferBuilder&) = delete;
|
||||
CommandBufferBuilder& operator=(CommandBufferBuilder&&) = default;
|
||||
|
||||
struct ClearValues
|
||||
{
|
||||
Nz::Color color;
|
||||
float depth;
|
||||
UInt32 stencil;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
30
include/Nazara/Renderer/Framebuffer.hpp
Normal file
30
include/Nazara/Renderer/Framebuffer.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_FRAMEBUFFER_HPP
|
||||
#define NAZARA_FRAMEBUFFER_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_RENDERER_API Framebuffer
|
||||
{
|
||||
public:
|
||||
Framebuffer() = default;
|
||||
Framebuffer(const Framebuffer&) = delete;
|
||||
Framebuffer(Framebuffer&&) noexcept = default;
|
||||
virtual ~Framebuffer();
|
||||
|
||||
Framebuffer& operator=(const Framebuffer&) = delete;
|
||||
Framebuffer& operator=(Framebuffer&&) noexcept = default;
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/Framebuffer.inl>
|
||||
|
||||
#endif // NAZARA_FRAMEBUFFER_HPP
|
||||
12
include/Nazara/Renderer/Framebuffer.inl
Normal file
12
include/Nazara/Renderer/Framebuffer.inl
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/Framebuffer.hpp>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
40
include/Nazara/Renderer/RenderPass.hpp
Normal file
40
include/Nazara/Renderer/RenderPass.hpp
Normal file
@@ -0,0 +1,40 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef NAZARA_RENDERPASS_HPP
|
||||
#define NAZARA_RENDERPASS_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Renderer/Config.hpp>
|
||||
#include <Nazara/Renderer/Enums.hpp>
|
||||
#include <Nazara/Utility/PixelFormat.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
class NAZARA_RENDERER_API RenderPass
|
||||
{
|
||||
public:
|
||||
struct Attachment;
|
||||
|
||||
RenderPass() = default;
|
||||
RenderPass(const RenderPass&) = delete;
|
||||
RenderPass(RenderPass&&) noexcept = default;
|
||||
virtual ~RenderPass();
|
||||
|
||||
RenderPass& operator=(const RenderPass&) = delete;
|
||||
RenderPass& operator=(RenderPass&&) noexcept = default;
|
||||
|
||||
struct Attachment
|
||||
{
|
||||
PixelFormat format;
|
||||
// TODO
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/RenderPass.inl>
|
||||
|
||||
#endif // NAZARA_RENDERPASS_HPP
|
||||
12
include/Nazara/Renderer/RenderPass.inl
Normal file
12
include/Nazara/Renderer/RenderPass.inl
Normal file
@@ -0,0 +1,12 @@
|
||||
// Copyright (C) 2020 Jérôme Leclercq
|
||||
// This file is part of the "Nazara Engine - Utility module"
|
||||
// For conditions of distribution and use, see copyright notice in Config.hpp
|
||||
|
||||
#include <Nazara/Renderer/RenderPass.hpp>
|
||||
#include <Nazara/Renderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
}
|
||||
|
||||
#include <Nazara/Renderer/DebugOff.hpp>
|
||||
@@ -17,8 +17,10 @@
|
||||
namespace Nz
|
||||
{
|
||||
class CommandPool;
|
||||
class Framebuffer;
|
||||
class RendererImpl;
|
||||
class RenderImage;
|
||||
class RenderPass;
|
||||
class RenderSurface;
|
||||
|
||||
class NAZARA_RENDERER_API RenderWindowImpl
|
||||
@@ -32,7 +34,9 @@ namespace Nz
|
||||
virtual bool Create(RendererImpl* renderer, RenderSurface* surface, const Vector2ui& size, const RenderWindowParameters& parameters) = 0;
|
||||
virtual std::unique_ptr<CommandPool> CreateCommandPool(QueueType queueType) = 0;
|
||||
|
||||
virtual const Framebuffer& GetFramebuffer() const = 0;
|
||||
virtual std::shared_ptr<RenderDevice> GetRenderDevice() = 0;
|
||||
virtual const RenderPass& GetRenderPass() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user