Graphics/FrameGraph: Make use of RenderPassCache
This commit is contained in:
parent
7e4f624ca7
commit
7fb5109dfa
|
|
@ -12,6 +12,7 @@
|
||||||
#include <Nazara/Graphics/TextureSamplerCache.hpp>
|
#include <Nazara/Graphics/TextureSamplerCache.hpp>
|
||||||
#include <Nazara/Renderer/Renderer.hpp>
|
#include <Nazara/Renderer/Renderer.hpp>
|
||||||
#include <Nazara/Renderer/RenderDevice.hpp>
|
#include <Nazara/Renderer/RenderDevice.hpp>
|
||||||
|
#include <Nazara/Renderer/RenderPassCache.hpp>
|
||||||
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
|
#include <Nazara/Renderer/RenderPipelineLayout.hpp>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
|
||||||
|
|
@ -38,6 +39,7 @@ namespace Nz
|
||||||
inline PixelFormat GetPreferredDepthStencilFormat() const;
|
inline PixelFormat GetPreferredDepthStencilFormat() const;
|
||||||
inline const std::shared_ptr<RenderPipelineLayout>& GetReferencePipelineLayout() const;
|
inline const std::shared_ptr<RenderPipelineLayout>& GetReferencePipelineLayout() const;
|
||||||
inline const std::shared_ptr<RenderDevice>& GetRenderDevice() const;
|
inline const std::shared_ptr<RenderDevice>& GetRenderDevice() const;
|
||||||
|
inline const RenderPassCache& GetRenderPassCache() const;
|
||||||
inline TextureSamplerCache& GetSamplerCache();
|
inline TextureSamplerCache& GetSamplerCache();
|
||||||
|
|
||||||
struct Config
|
struct Config
|
||||||
|
|
@ -58,6 +60,7 @@ namespace Nz
|
||||||
void BuildFullscreenVertexBuffer();
|
void BuildFullscreenVertexBuffer();
|
||||||
void SelectDepthStencilFormats();
|
void SelectDepthStencilFormats();
|
||||||
|
|
||||||
|
std::optional<RenderPassCache> m_renderPassCache;
|
||||||
std::optional<TextureSamplerCache> m_samplerCache;
|
std::optional<TextureSamplerCache> m_samplerCache;
|
||||||
std::shared_ptr<AbstractBuffer> m_fullscreenVertexBuffer;
|
std::shared_ptr<AbstractBuffer> m_fullscreenVertexBuffer;
|
||||||
std::shared_ptr<RenderDevice> m_renderDevice;
|
std::shared_ptr<RenderDevice> m_renderDevice;
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,12 @@ namespace Nz
|
||||||
return m_renderDevice;
|
return m_renderDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const RenderPassCache& Graphics::GetRenderPassCache() const
|
||||||
|
{
|
||||||
|
assert(m_renderPassCache);
|
||||||
|
return *m_renderPassCache;
|
||||||
|
}
|
||||||
|
|
||||||
inline TextureSamplerCache& Graphics::GetSamplerCache()
|
inline TextureSamplerCache& Graphics::GetSamplerCache()
|
||||||
{
|
{
|
||||||
return *m_samplerCache;
|
return *m_samplerCache;
|
||||||
|
|
|
||||||
|
|
@ -851,7 +851,8 @@ namespace Nz
|
||||||
|
|
||||||
BuildPhysicalPassDependencies(colorAttachmentCount, depthStencilAttachmentIndex.has_value(), renderPassAttachments, subpassesDesc, subpassesDeps);
|
BuildPhysicalPassDependencies(colorAttachmentCount, depthStencilAttachmentIndex.has_value(), renderPassAttachments, subpassesDesc, subpassesDeps);
|
||||||
|
|
||||||
m_pending.renderPasses.push_back(renderDevice->InstantiateRenderPass(std::move(renderPassAttachments), std::move(subpassesDesc), std::move(subpassesDeps)));
|
m_pending.renderPasses.push_back(Graphics::Instance()->GetRenderPassCache().Get(renderPassAttachments, subpassesDesc, subpassesDeps));
|
||||||
|
//m_pending.renderPasses.push_back(renderDevice->InstantiateRenderPass(std::move(renderPassAttachments), std::move(subpassesDesc), std::move(subpassesDeps)));
|
||||||
|
|
||||||
physicalPassIndex++;
|
physicalPassIndex++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ namespace Nz
|
||||||
if (!m_renderDevice)
|
if (!m_renderDevice)
|
||||||
throw std::runtime_error("failed to instantiate render device");
|
throw std::runtime_error("failed to instantiate render device");
|
||||||
|
|
||||||
|
m_renderPassCache.emplace(*m_renderDevice);
|
||||||
m_samplerCache.emplace(m_renderDevice);
|
m_samplerCache.emplace(m_renderDevice);
|
||||||
|
|
||||||
MaterialPipeline::Initialize();
|
MaterialPipeline::Initialize();
|
||||||
|
|
@ -78,6 +79,7 @@ namespace Nz
|
||||||
Graphics::~Graphics()
|
Graphics::~Graphics()
|
||||||
{
|
{
|
||||||
MaterialPipeline::Uninitialize();
|
MaterialPipeline::Uninitialize();
|
||||||
|
m_renderPassCache.reset();
|
||||||
m_samplerCache.reset();
|
m_samplerCache.reset();
|
||||||
m_fullscreenVertexBuffer.reset();
|
m_fullscreenVertexBuffer.reset();
|
||||||
m_fullscreenVertexDeclaration.reset();
|
m_fullscreenVertexDeclaration.reset();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue