Renderer/Framebuffer: Add GetType (and rework backend internals)
This commit is contained in:
@@ -144,7 +144,7 @@ namespace Nz
|
||||
|
||||
StackVector<GLenum> invalidateAttachments = NazaraStackVector(GLenum, colorBufferCount + 1);
|
||||
|
||||
if (command.framebuffer->GetType() == OpenGLFramebuffer::Type::FBO)
|
||||
if (command.framebuffer->GetType() == FramebufferType::Texture)
|
||||
{
|
||||
context->glDrawBuffers(GLsizei(colorBufferCount), fboDrawBuffers.data());
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
namespace Nz
|
||||
{
|
||||
OpenGLFboFramebuffer::OpenGLFboFramebuffer(OpenGLDevice& device, const std::vector<std::shared_ptr<Texture>>& attachments) :
|
||||
OpenGLFramebuffer(OpenGLFramebuffer::Type::FBO)
|
||||
OpenGLFramebuffer(FramebufferType::Texture)
|
||||
{
|
||||
if (!m_framebuffer.Create(device))
|
||||
throw std::runtime_error("failed to create framebuffer object");
|
||||
|
||||
@@ -5,11 +5,11 @@
|
||||
#include <Nazara/VulkanRenderer/VulkanCommandBufferBuilder.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanBuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanMultipleFramebuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanWindowFramebuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanRenderPass.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanRenderPipeline.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanRenderPipelineLayout.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanSingleFramebuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanTextureFramebuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanShaderBinding.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanTexture.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanUploadPool.hpp>
|
||||
@@ -33,21 +33,20 @@ namespace Nz
|
||||
|
||||
const Vk::Framebuffer& vkFramebuffer = [&] () -> const Vk::Framebuffer&
|
||||
{
|
||||
const VulkanFramebuffer& vkFramebuffer = static_cast<const VulkanFramebuffer&>(framebuffer);
|
||||
switch (vkFramebuffer.GetType())
|
||||
switch (framebuffer.GetType())
|
||||
{
|
||||
case VulkanFramebuffer::Type::Multiple:
|
||||
case FramebufferType::Texture:
|
||||
return static_cast<const VulkanTextureFramebuffer&>(framebuffer).GetFramebuffer();
|
||||
|
||||
case FramebufferType::Window:
|
||||
{
|
||||
const VulkanMultipleFramebuffer& vkMultipleFramebuffer = static_cast<const VulkanMultipleFramebuffer&>(vkFramebuffer);
|
||||
const VulkanWindowFramebuffer& vkMultipleFramebuffer = static_cast<const VulkanWindowFramebuffer&>(framebuffer);
|
||||
m_framebufferCount = std::max(m_framebufferCount, vkMultipleFramebuffer.GetFramebufferCount());
|
||||
return vkMultipleFramebuffer.GetFramebuffer(m_imageIndex);
|
||||
}
|
||||
|
||||
case VulkanFramebuffer::Type::Single:
|
||||
return static_cast<const VulkanSingleFramebuffer&>(vkFramebuffer).GetFramebuffer();
|
||||
}
|
||||
|
||||
throw std::runtime_error("Unhandled framebuffer type " + std::to_string(UnderlyingCast(vkFramebuffer.GetType())));
|
||||
throw std::runtime_error("Unhandled framebuffer type " + std::to_string(UnderlyingCast(framebuffer.GetType())));
|
||||
}();
|
||||
|
||||
std::size_t attachmentCount = vkRenderPass.GetAttachmentCount();
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
#include <Nazara/VulkanRenderer/VulkanRenderPipeline.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanRenderPipelineLayout.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanShaderModule.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanSingleFramebuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanTexture.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanTextureFramebuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanTextureSampler.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace Nz
|
||||
|
||||
std::shared_ptr<Framebuffer> VulkanDevice::InstantiateFramebuffer(unsigned int width, unsigned int height, const std::shared_ptr<RenderPass>& renderPass, const std::vector<std::shared_ptr<Texture>>& attachments)
|
||||
{
|
||||
return std::make_shared<VulkanSingleFramebuffer>(*this, width, height, renderPass, attachments);
|
||||
return std::make_shared<VulkanTextureFramebuffer>(*this, width, height, renderPass, attachments);
|
||||
}
|
||||
|
||||
std::shared_ptr<RenderPass> VulkanDevice::InstantiateRenderPass(std::vector<RenderPass::Attachment> attachments, std::vector<RenderPass::SubpassDescription> subpassDescriptions, std::vector<RenderPass::SubpassDependency> subpassDependencies)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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/VulkanSingleFramebuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanTextureFramebuffer.hpp>
|
||||
#include <Nazara/Core/StackArray.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanRenderPass.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanTexture.hpp>
|
||||
@@ -11,8 +11,8 @@
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
VulkanSingleFramebuffer::VulkanSingleFramebuffer(Vk::Device& device, unsigned int width, unsigned int height, const std::shared_ptr<RenderPass>& renderPass, const std::vector<std::shared_ptr<Texture>>& attachments) :
|
||||
VulkanFramebuffer(Type::Single)
|
||||
VulkanTextureFramebuffer::VulkanTextureFramebuffer(Vk::Device& device, unsigned int width, unsigned int height, const std::shared_ptr<RenderPass>& renderPass, const std::vector<std::shared_ptr<Texture>>& attachments) :
|
||||
VulkanFramebuffer(FramebufferType::Texture)
|
||||
{
|
||||
assert(renderPass);
|
||||
const VulkanRenderPass& vkRenderPass = static_cast<const VulkanRenderPass&>(*renderPass);
|
||||
@@ -2,7 +2,7 @@
|
||||
// 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/VulkanMultipleFramebuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/VulkanWindowFramebuffer.hpp>
|
||||
#include <Nazara/VulkanRenderer/Debug.hpp>
|
||||
|
||||
namespace Nz
|
||||
Reference in New Issue
Block a user