Graphics: Add RenderTextureBlit

This commit is contained in:
Lynix
2023-11-21 22:06:44 +01:00
parent f3aacc0cd2
commit 80cab34088
4 changed files with 121 additions and 0 deletions

View File

@@ -0,0 +1,48 @@
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#pragma once
#ifndef NAZARA_GRAPHICS_RENDERTEXTUREBLIT_HPP
#define NAZARA_GRAPHICS_RENDERTEXTUREBLIT_HPP
#include <NazaraUtils/Prerequisites.hpp>
#include <Nazara/Graphics/Config.hpp>
#include <Nazara/Graphics/RenderTarget.hpp>
#include <Nazara/Renderer/Enums.hpp>
namespace Nz
{
class Texture;
class NAZARA_GRAPHICS_API RenderTextureBlit : public RenderTarget
{
public:
inline RenderTextureBlit(const Vector2ui& textureSize, std::shared_ptr<Texture> targetTexture, SamplerFilter filter = SamplerFilter::Linear);
inline RenderTextureBlit(const Vector2ui& textureSize, std::shared_ptr<Texture> targetTexture, SamplerFilter filter, PipelineStage targetPipelineStage, MemoryAccessFlags targetMemoryFlags, TextureLayout targetLayout);
RenderTextureBlit(const RenderTextureBlit&) = delete;
RenderTextureBlit(RenderTextureBlit&&) = delete;
~RenderTextureBlit() = default;
void OnBuildGraph(FrameGraph& graph, std::size_t attachmentIndex) const override;
void OnRenderEnd(RenderFrame& renderFrame, const BakedFrameGraph& frameGraph, std::size_t finalAttachment) const override;
const Vector2ui& GetSize() const override;
RenderTextureBlit& operator=(const RenderTextureBlit&) = delete;
RenderTextureBlit& operator=(RenderTextureBlit&&) = delete;
private:
std::shared_ptr<Texture> m_targetTexture;
MemoryAccessFlags m_targetMemoryFlags;
PipelineStage m_targetPipelineStage;
SamplerFilter m_samplerFilter;
TextureLayout m_targetLayout;
Vector2ui m_textureSize;
};
}
#include <Nazara/Graphics/RenderTextureBlit.inl>
#endif // NAZARA_GRAPHICS_RENDERTEXTUREBLIT_HPP

View File

@@ -0,0 +1,25 @@
// Copyright (C) 2023 Jérôme "Lynix" Leclercq (lynix680@gmail.com)
// This file is part of the "Nazara Engine - Graphics module"
// For conditions of distribution and use, see copyright notice in Config.hpp
#include <Nazara/Graphics/Debug.hpp>
namespace Nz
{
inline RenderTextureBlit::RenderTextureBlit(const Vector2ui& textureSize, std::shared_ptr<Texture> targetTexture, SamplerFilter filter) :
RenderTextureBlit(textureSize, std::move(targetTexture), filter, PipelineStage::FragmentShader, MemoryAccess::ColorRead, TextureLayout::ColorInput)
{
}
RenderTextureBlit::RenderTextureBlit(const Vector2ui& textureSize, std::shared_ptr<Texture> texture, SamplerFilter filter, PipelineStage targetPipelineStage, MemoryAccessFlags targetMemoryFlags, TextureLayout targetLayout) :
m_targetTexture(std::move(texture)),
m_targetMemoryFlags(targetMemoryFlags),
m_targetPipelineStage(targetPipelineStage),
m_samplerFilter(filter),
m_targetLayout(targetLayout),
m_textureSize(textureSize)
{
}
}
#include <Nazara/Graphics/DebugOff.hpp>