2022-01-04 14:29:01 +01:00
|
|
|
/* Copyright (C) 2022 Wildfire Games.
|
2012-10-15 12:34:23 +02:00
|
|
|
* This file is part of 0 A.D.
|
|
|
|
*
|
|
|
|
* 0 A.D. is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 0 A.D. is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precompiled.h"
|
|
|
|
|
2019-08-20 23:15:15 +02:00
|
|
|
#include "renderer/PostprocManager.h"
|
2012-10-15 12:34:23 +02:00
|
|
|
|
2019-08-20 23:15:15 +02:00
|
|
|
#include "graphics/GameView.h"
|
|
|
|
#include "graphics/LightEnv.h"
|
|
|
|
#include "graphics/ShaderManager.h"
|
2012-10-15 12:34:23 +02:00
|
|
|
#include "lib/bits.h"
|
2019-08-20 23:15:15 +02:00
|
|
|
#include "lib/ogl.h"
|
|
|
|
#include "maths/MathUtil.h"
|
2020-02-05 22:53:10 +01:00
|
|
|
#include "ps/ConfigDB.h"
|
2012-10-15 12:34:23 +02:00
|
|
|
#include "ps/CLogger.h"
|
2021-05-18 13:09:54 +02:00
|
|
|
#include "ps/CStrInternStatic.h"
|
2012-10-15 12:34:23 +02:00
|
|
|
#include "ps/Filesystem.h"
|
|
|
|
#include "ps/Game.h"
|
2021-12-14 07:34:02 +01:00
|
|
|
#include "ps/VideoMode.h"
|
2012-10-15 12:34:23 +02:00
|
|
|
#include "ps/World.h"
|
2022-02-05 17:59:23 +01:00
|
|
|
#include "renderer/backend/gl/Device.h"
|
2012-10-15 12:34:23 +02:00
|
|
|
#include "renderer/Renderer.h"
|
2020-02-05 22:53:10 +01:00
|
|
|
#include "renderer/RenderingOptions.h"
|
2020-11-15 21:07:48 +01:00
|
|
|
#include "tools/atlas/GameInterface/GameLoop.h"
|
2012-10-15 12:34:23 +02:00
|
|
|
|
2013-11-12 02:17:16 +01:00
|
|
|
#if !CONFIG2_GLES
|
2012-10-15 12:34:23 +02:00
|
|
|
|
|
|
|
CPostprocManager::CPostprocManager()
|
2022-02-05 17:59:23 +01:00
|
|
|
: m_IsInitialized(false), m_PostProcEffect(L"default"), m_WhichBuffer(true),
|
|
|
|
m_Sharpness(0.3f), m_UsingMultisampleBuffer(false), m_MultisampleCount(0)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CPostprocManager::~CPostprocManager()
|
|
|
|
{
|
2014-10-27 01:53:31 +01:00
|
|
|
Cleanup();
|
2012-10-15 12:34:23 +02:00
|
|
|
}
|
|
|
|
|
2022-01-28 07:34:34 +01:00
|
|
|
bool CPostprocManager::IsEnabled() const
|
|
|
|
{
|
|
|
|
return g_RenderingOptions.GetPostProc() &&
|
|
|
|
g_VideoMode.GetBackend() != CVideoMode::Backend::GL_ARB;
|
|
|
|
}
|
|
|
|
|
2014-10-05 22:50:10 +02:00
|
|
|
void CPostprocManager::Cleanup()
|
|
|
|
{
|
2014-10-27 01:53:31 +01:00
|
|
|
if (!m_IsInitialized) // Only cleanup if previously used
|
|
|
|
return;
|
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
m_CaptureFramebuffer.reset();
|
|
|
|
|
|
|
|
m_PingFramebuffer.reset();
|
|
|
|
m_PongFramebuffer.reset();
|
2014-10-05 22:50:10 +02:00
|
|
|
|
2021-12-27 22:01:43 +01:00
|
|
|
m_ColorTex1.reset();
|
|
|
|
m_ColorTex2.reset();
|
|
|
|
m_DepthTex.reset();
|
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
for (BlurScale& scale : m_BlurScales)
|
|
|
|
{
|
|
|
|
for (BlurScale::Step& step : scale.steps)
|
|
|
|
{
|
|
|
|
step.framebuffer.reset();
|
|
|
|
step.texture.reset();
|
|
|
|
}
|
|
|
|
}
|
2014-10-05 22:50:10 +02:00
|
|
|
}
|
2012-10-15 12:34:23 +02:00
|
|
|
|
|
|
|
void CPostprocManager::Initialize()
|
|
|
|
{
|
2014-10-27 01:53:31 +01:00
|
|
|
if (m_IsInitialized)
|
|
|
|
return;
|
|
|
|
|
2022-02-13 22:46:03 +01:00
|
|
|
const uint32_t maxSamples = g_VideoMode.GetBackendDevice()->GetCapabilities().maxSampleCount;
|
|
|
|
const uint32_t possibleSampleCounts[] = {2, 4, 8, 16};
|
2020-11-15 21:07:48 +01:00
|
|
|
std::copy_if(
|
|
|
|
std::begin(possibleSampleCounts), std::end(possibleSampleCounts),
|
|
|
|
std::back_inserter(m_AllowedSampleCounts),
|
2022-02-13 22:46:03 +01:00
|
|
|
[maxSamples](const uint32_t sampleCount) { return sampleCount <= maxSamples; } );
|
2020-11-15 21:07:48 +01:00
|
|
|
|
2014-10-05 22:50:10 +02:00
|
|
|
// The screen size starts out correct and then must be updated with Resize()
|
|
|
|
m_Width = g_Renderer.GetWidth();
|
|
|
|
m_Height = g_Renderer.GetHeight();
|
|
|
|
|
2020-12-03 13:19:44 +01:00
|
|
|
RecreateBuffers();
|
|
|
|
m_IsInitialized = true;
|
|
|
|
|
|
|
|
// Once we have initialised the buffers, we can update the techniques.
|
2020-02-05 22:53:10 +01:00
|
|
|
UpdateAntiAliasingTechnique();
|
2020-08-08 00:16:55 +02:00
|
|
|
UpdateSharpeningTechnique();
|
|
|
|
UpdateSharpnessFactor();
|
2014-10-27 01:53:31 +01:00
|
|
|
|
|
|
|
// This might happen after the map is loaded and the effect chosen
|
|
|
|
SetPostEffect(m_PostProcEffect);
|
2012-10-15 12:34:23 +02:00
|
|
|
}
|
|
|
|
|
2014-10-05 22:50:10 +02:00
|
|
|
void CPostprocManager::Resize()
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
2014-10-05 22:50:10 +02:00
|
|
|
m_Width = g_Renderer.GetWidth();
|
|
|
|
m_Height = g_Renderer.GetHeight();
|
|
|
|
|
|
|
|
// If the buffers were intialized, recreate them to the new size.
|
|
|
|
if (m_IsInitialized)
|
|
|
|
RecreateBuffers();
|
2012-10-15 12:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void CPostprocManager::RecreateBuffers()
|
|
|
|
{
|
2014-10-27 01:53:31 +01:00
|
|
|
Cleanup();
|
2014-10-05 22:50:10 +02:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
#define GEN_BUFFER_RGBA(name, w, h) \
|
2022-02-13 20:30:28 +01:00
|
|
|
name = g_VideoMode.GetBackendDevice()->CreateTexture2D( \
|
|
|
|
"PostProc" #name, Renderer::Backend::Format::R8G8B8A8, w, h, \
|
2021-12-27 22:01:43 +01:00
|
|
|
Renderer::Backend::Sampler::MakeDefaultSampler( \
|
|
|
|
Renderer::Backend::Sampler::Filter::LINEAR, \
|
2022-01-05 15:49:54 +01:00
|
|
|
Renderer::Backend::Sampler::AddressMode::CLAMP_TO_EDGE));
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2016-11-23 14:02:58 +01:00
|
|
|
// Two fullscreen ping-pong textures.
|
2015-03-16 00:59:48 +01:00
|
|
|
GEN_BUFFER_RGBA(m_ColorTex1, m_Width, m_Height);
|
|
|
|
GEN_BUFFER_RGBA(m_ColorTex2, m_Width, m_Height);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
// Textures for several blur sizes. It would be possible to reuse
|
|
|
|
// m_BlurTex2b, thus avoiding the need for m_BlurTex4b and m_BlurTex8b, though given
|
|
|
|
// that these are fairly small it's probably not worth complicating the coordinates passed
|
|
|
|
// to the blur helper functions.
|
2022-02-05 17:59:23 +01:00
|
|
|
uint32_t width = m_Width / 2, height = m_Height / 2;
|
|
|
|
for (BlurScale& scale : m_BlurScales)
|
|
|
|
{
|
|
|
|
for (BlurScale::Step& step : scale.steps)
|
|
|
|
{
|
|
|
|
GEN_BUFFER_RGBA(step.texture, width, height);
|
|
|
|
step.framebuffer = Renderer::Backend::GL::CFramebuffer::Create(
|
|
|
|
step.texture.get(), nullptr);
|
|
|
|
}
|
|
|
|
width /= 2;
|
|
|
|
height /= 2;
|
|
|
|
}
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
#undef GEN_BUFFER_RGBA
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
// Allocate the Depth/Stencil texture.
|
2022-02-13 20:30:28 +01:00
|
|
|
m_DepthTex = g_VideoMode.GetBackendDevice()->CreateTexture2D("PostPRocDepthTexture",
|
2021-12-27 22:01:43 +01:00
|
|
|
Renderer::Backend::Format::D24_S8, m_Width, m_Height,
|
|
|
|
Renderer::Backend::Sampler::MakeDefaultSampler(
|
|
|
|
Renderer::Backend::Sampler::Filter::LINEAR,
|
|
|
|
Renderer::Backend::Sampler::AddressMode::CLAMP_TO_EDGE));
|
2014-10-05 22:50:10 +02:00
|
|
|
|
2022-02-13 20:30:28 +01:00
|
|
|
g_Renderer.GetDeviceCommandContext()->BindTexture(0, GL_TEXTURE_2D, m_DepthTex->GetHandle());
|
2014-10-05 22:50:10 +02:00
|
|
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE, GL_NONE);
|
2022-02-13 20:30:28 +01:00
|
|
|
g_Renderer.GetDeviceCommandContext()->BindTexture(0, GL_TEXTURE_2D, 0);
|
2012-10-15 12:34:23 +02:00
|
|
|
|
|
|
|
// Set up the framebuffers with some initial textures.
|
2022-02-05 17:59:23 +01:00
|
|
|
m_CaptureFramebuffer = Renderer::Backend::GL::CFramebuffer::Create(
|
|
|
|
m_ColorTex1.get(), m_DepthTex.get(),
|
|
|
|
g_VideoMode.GetBackendDevice()->GetCurrentBackbuffer()->GetClearColor());
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
m_PingFramebuffer = Renderer::Backend::GL::CFramebuffer::Create(
|
|
|
|
m_ColorTex1.get(), nullptr);
|
|
|
|
m_PongFramebuffer = Renderer::Backend::GL::CFramebuffer::Create(
|
|
|
|
m_ColorTex2.get(), nullptr);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
if (!m_CaptureFramebuffer || !m_PingFramebuffer || !m_PongFramebuffer)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
2022-02-05 17:59:23 +01:00
|
|
|
LOGWARNING("Failed to create postproc framebuffers");
|
|
|
|
g_RenderingOptions.SetPostProc(false);
|
2012-10-15 12:34:23 +02:00
|
|
|
}
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2020-11-15 21:07:48 +01:00
|
|
|
if (m_UsingMultisampleBuffer)
|
|
|
|
{
|
|
|
|
DestroyMultisampleBuffer();
|
|
|
|
CreateMultisampleBuffer();
|
|
|
|
}
|
2012-10-15 12:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2021-12-30 17:37:51 +01:00
|
|
|
void CPostprocManager::ApplyBlurDownscale2x(
|
2022-01-19 18:28:47 +01:00
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
2022-02-05 17:59:23 +01:00
|
|
|
Renderer::Backend::GL::CFramebuffer* framebuffer,
|
|
|
|
Renderer::Backend::GL::CTexture* inTex, int inWidth, int inHeight)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
2022-02-05 17:59:23 +01:00
|
|
|
deviceCommandContext->SetFramebuffer(framebuffer);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
// Get bloom shader with instructions to simply copy texels.
|
|
|
|
CShaderDefines defines;
|
2013-09-29 15:19:52 +02:00
|
|
|
defines.Add(str_BLOOM_NOP, str_1);
|
2021-12-14 07:34:02 +01:00
|
|
|
CShaderTechniquePtr tech = g_Renderer.GetShaderManager().LoadEffect(str_bloom, defines);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
tech->BeginPass();
|
2022-01-19 18:28:47 +01:00
|
|
|
deviceCommandContext->SetGraphicsPipelineState(
|
|
|
|
tech->GetGraphicsPipelineStateDesc());
|
|
|
|
const CShaderProgramPtr& shader = tech->GetShader();
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2021-12-30 17:37:51 +01:00
|
|
|
shader->BindTexture(str_renderedTex, inTex);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2013-12-06 01:42:50 +01:00
|
|
|
const SViewPort oldVp = g_Renderer.GetViewport();
|
|
|
|
const SViewPort vp = { 0, 0, inWidth / 2, inHeight / 2 };
|
2013-11-28 01:57:39 +01:00
|
|
|
g_Renderer.SetViewport(vp);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2021-12-30 17:37:51 +01:00
|
|
|
float quadVerts[] =
|
|
|
|
{
|
2013-11-12 02:30:17 +01:00
|
|
|
1.0f, 1.0f,
|
|
|
|
-1.0f, 1.0f,
|
|
|
|
-1.0f, -1.0f,
|
|
|
|
|
|
|
|
-1.0f, -1.0f,
|
|
|
|
1.0f, -1.0f,
|
|
|
|
1.0f, 1.0f
|
|
|
|
};
|
2021-12-30 17:37:51 +01:00
|
|
|
float quadTex[] =
|
|
|
|
{
|
2013-11-12 02:30:17 +01:00
|
|
|
1.0f, 1.0f,
|
|
|
|
0.0f, 1.0f,
|
|
|
|
0.0f, 0.0f,
|
|
|
|
|
|
|
|
0.0f, 0.0f,
|
|
|
|
1.0f, 0.0f,
|
|
|
|
1.0f, 1.0f
|
|
|
|
};
|
|
|
|
shader->TexCoordPointer(GL_TEXTURE0, 2, GL_FLOAT, 0, quadTex);
|
|
|
|
shader->VertexPointer(2, GL_FLOAT, 0, quadVerts);
|
|
|
|
shader->AssertPointersBound();
|
|
|
|
glDrawArrays(GL_TRIANGLES, 0, 6);
|
|
|
|
|
2013-11-28 01:57:39 +01:00
|
|
|
g_Renderer.SetViewport(oldVp);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
tech->EndPass();
|
|
|
|
}
|
|
|
|
|
2021-12-30 17:37:51 +01:00
|
|
|
void CPostprocManager::ApplyBlurGauss(
|
2022-01-19 18:28:47 +01:00
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
2022-02-05 17:59:23 +01:00
|
|
|
Renderer::Backend::GL::CTexture* inTex,
|
|
|
|
Renderer::Backend::GL::CTexture* tempTex,
|
|
|
|
Renderer::Backend::GL::CFramebuffer* tempFramebuffer,
|
|
|
|
Renderer::Backend::GL::CFramebuffer* outFramebuffer,
|
|
|
|
int inWidth, int inHeight)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
2022-02-05 17:59:23 +01:00
|
|
|
deviceCommandContext->SetFramebuffer(tempFramebuffer);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
// Get bloom shader, for a horizontal Gaussian blur pass.
|
|
|
|
CShaderDefines defines2;
|
2013-09-29 15:19:52 +02:00
|
|
|
defines2.Add(str_BLOOM_PASS_H, str_1);
|
2021-12-14 07:34:02 +01:00
|
|
|
CShaderTechniquePtr tech = g_Renderer.GetShaderManager().LoadEffect(str_bloom, defines2);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
tech->BeginPass();
|
2022-01-19 18:28:47 +01:00
|
|
|
deviceCommandContext->SetGraphicsPipelineState(
|
|
|
|
tech->GetGraphicsPipelineStateDesc());
|
2012-10-15 12:34:23 +02:00
|
|
|
CShaderProgramPtr shader = tech->GetShader();
|
2022-02-05 17:59:23 +01:00
|
|
|
shader->BindTexture(str_renderedTex, inTex);
|
2013-09-29 15:19:52 +02:00
|
|
|
shader->Uniform(str_texSize, inWidth, inHeight, 0.0f, 0.0f);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2013-12-06 01:42:50 +01:00
|
|
|
const SViewPort oldVp = g_Renderer.GetViewport();
|
|
|
|
const SViewPort vp = { 0, 0, inWidth, inHeight };
|
2013-11-28 01:57:39 +01:00
|
|
|
g_Renderer.SetViewport(vp);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2021-12-30 17:37:51 +01:00
|
|
|
float quadVerts[] =
|
|
|
|
{
|
2013-11-12 02:30:17 +01:00
|
|
|
1.0f, 1.0f,
|
|
|
|
-1.0f, 1.0f,
|
|
|
|
-1.0f, -1.0f,
|
|
|
|
|
|
|
|
-1.0f, -1.0f,
|
|
|
|
1.0f, -1.0f,
|
|
|
|
1.0f, 1.0f
|
|
|
|
};
|
2021-12-30 17:37:51 +01:00
|
|
|
float quadTex[] =
|
|
|
|
{
|
2013-11-12 02:30:17 +01:00
|
|
|
1.0f, 1.0f,
|
|
|
|
0.0f, 1.0f,
|
|
|
|
0.0f, 0.0f,
|
|
|
|
|
|
|
|
0.0f, 0.0f,
|
|
|
|
1.0f, 0.0f,
|
|
|
|
1.0f, 1.0f
|
|
|
|
};
|
|
|
|
shader->TexCoordPointer(GL_TEXTURE0, 2, GL_FLOAT, 0, quadTex);
|
|
|
|
shader->VertexPointer(2, GL_FLOAT, 0, quadVerts);
|
|
|
|
shader->AssertPointersBound();
|
|
|
|
glDrawArrays(GL_TRIANGLES, 0, 6);
|
|
|
|
|
2013-11-28 01:57:39 +01:00
|
|
|
g_Renderer.SetViewport(oldVp);
|
2013-11-12 02:30:17 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
tech->EndPass();
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
deviceCommandContext->SetFramebuffer(outFramebuffer);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
// Get bloom shader, for a vertical Gaussian blur pass.
|
|
|
|
CShaderDefines defines3;
|
2013-09-29 15:19:52 +02:00
|
|
|
defines3.Add(str_BLOOM_PASS_V, str_1);
|
2021-12-14 07:34:02 +01:00
|
|
|
tech = g_Renderer.GetShaderManager().LoadEffect(str_bloom, defines3);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
tech->BeginPass();
|
|
|
|
shader = tech->GetShader();
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
// Our input texture to the shader is the output of the horizontal pass.
|
2013-09-29 15:19:52 +02:00
|
|
|
shader->BindTexture(str_renderedTex, tempTex);
|
|
|
|
shader->Uniform(str_texSize, inWidth, inHeight, 0.0f, 0.0f);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2013-11-28 01:57:39 +01:00
|
|
|
g_Renderer.SetViewport(vp);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2013-11-12 02:30:17 +01:00
|
|
|
shader->TexCoordPointer(GL_TEXTURE0, 2, GL_FLOAT, 0, quadTex);
|
|
|
|
shader->VertexPointer(2, GL_FLOAT, 0, quadVerts);
|
|
|
|
shader->AssertPointersBound();
|
|
|
|
glDrawArrays(GL_TRIANGLES, 0, 6);
|
|
|
|
|
2013-11-28 01:57:39 +01:00
|
|
|
g_Renderer.SetViewport(oldVp);
|
2013-11-12 02:30:17 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
tech->EndPass();
|
|
|
|
}
|
|
|
|
|
2022-01-19 18:28:47 +01:00
|
|
|
void CPostprocManager::ApplyBlur(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
2022-02-05 17:59:23 +01:00
|
|
|
uint32_t width = m_Width, height = m_Height;
|
|
|
|
Renderer::Backend::GL::CTexture* previousTexture =
|
|
|
|
(m_WhichBuffer ? m_ColorTex1 : m_ColorTex2).get();
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
for (BlurScale& scale : m_BlurScales)
|
|
|
|
{
|
|
|
|
ApplyBlurDownscale2x(deviceCommandContext, scale.steps[0].framebuffer.get(), previousTexture, width, height);
|
|
|
|
width /= 2;
|
|
|
|
height /= 2;
|
|
|
|
ApplyBlurGauss(deviceCommandContext, scale.steps[0].texture.get(),
|
|
|
|
scale.steps[1].texture.get(), scale.steps[1].framebuffer.get(),
|
|
|
|
scale.steps[0].framebuffer.get(), width, height);
|
|
|
|
}
|
2012-10-15 12:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
void CPostprocManager::CaptureRenderOutput(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
2014-10-27 01:53:31 +01:00
|
|
|
ENSURE(m_IsInitialized);
|
2014-10-05 22:50:10 +02:00
|
|
|
|
2021-03-02 22:20:26 +01:00
|
|
|
// Leaves m_PingFbo selected for rendering; m_WhichBuffer stays true at this point.
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
if (m_UsingMultisampleBuffer)
|
|
|
|
deviceCommandContext->SetFramebuffer(m_MultisampleFramebuffer.get());
|
|
|
|
else
|
|
|
|
deviceCommandContext->SetFramebuffer(m_CaptureFramebuffer.get());
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
m_WhichBuffer = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-01-31 21:10:06 +01:00
|
|
|
void CPostprocManager::ReleaseRenderOutput(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
2014-10-27 01:53:31 +01:00
|
|
|
ENSURE(m_IsInitialized);
|
2014-10-05 22:50:10 +02:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
// We blit to the backbuffer from the previous active buffer.
|
|
|
|
deviceCommandContext->BlitFramebuffer(
|
|
|
|
deviceCommandContext->GetDevice()->GetCurrentBackbuffer(),
|
|
|
|
(m_WhichBuffer ? m_PingFramebuffer : m_PongFramebuffer).get());
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
deviceCommandContext->SetFramebuffer(
|
|
|
|
deviceCommandContext->GetDevice()->GetCurrentBackbuffer());
|
2012-10-15 12:34:23 +02:00
|
|
|
}
|
|
|
|
|
2022-01-19 18:28:47 +01:00
|
|
|
void CPostprocManager::ApplyEffect(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext,
|
2022-02-05 17:59:23 +01:00
|
|
|
const CShaderTechniquePtr& shaderTech, int pass)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
|
|
|
// select the other FBO for rendering
|
2022-02-05 17:59:23 +01:00
|
|
|
deviceCommandContext->SetFramebuffer(
|
|
|
|
(m_WhichBuffer ? m_PongFramebuffer : m_PingFramebuffer).get());
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
shaderTech->BeginPass(pass);
|
2022-01-19 18:28:47 +01:00
|
|
|
deviceCommandContext->SetGraphicsPipelineState(
|
2022-02-05 17:59:23 +01:00
|
|
|
shaderTech->GetGraphicsPipelineStateDesc(pass));
|
|
|
|
const CShaderProgramPtr& shader = shaderTech->GetShader(pass);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
// Use the textures from the current FBO as input to the shader.
|
|
|
|
// We also bind a bunch of other textures and parameters, but since
|
|
|
|
// this only happens once per frame the overhead is negligible.
|
|
|
|
if (m_WhichBuffer)
|
2021-12-30 17:37:51 +01:00
|
|
|
shader->BindTexture(str_renderedTex, m_ColorTex1.get());
|
2012-10-15 12:34:23 +02:00
|
|
|
else
|
2021-12-30 17:37:51 +01:00
|
|
|
shader->BindTexture(str_renderedTex, m_ColorTex2.get());
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2021-12-30 17:37:51 +01:00
|
|
|
shader->BindTexture(str_depthTex, m_DepthTex.get());
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
shader->BindTexture(str_blurTex2, m_BlurScales[0].steps[0].texture.get());
|
|
|
|
shader->BindTexture(str_blurTex4, m_BlurScales[1].steps[0].texture.get());
|
|
|
|
shader->BindTexture(str_blurTex8, m_BlurScales[2].steps[0].texture.get());
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2013-09-29 15:19:52 +02:00
|
|
|
shader->Uniform(str_width, m_Width);
|
|
|
|
shader->Uniform(str_height, m_Height);
|
2019-09-20 09:54:44 +02:00
|
|
|
shader->Uniform(str_zNear, m_NearPlane);
|
|
|
|
shader->Uniform(str_zFar, m_FarPlane);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2020-08-08 00:16:55 +02:00
|
|
|
shader->Uniform(str_sharpness, m_Sharpness);
|
|
|
|
|
2013-09-29 15:19:52 +02:00
|
|
|
shader->Uniform(str_brightness, g_LightEnv.m_Brightness);
|
|
|
|
shader->Uniform(str_hdr, g_LightEnv.m_Contrast);
|
|
|
|
shader->Uniform(str_saturation, g_LightEnv.m_Saturation);
|
|
|
|
shader->Uniform(str_bloom, g_LightEnv.m_Bloom);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-01-11 06:56:44 +01:00
|
|
|
float quadVerts[] =
|
|
|
|
{
|
2013-11-12 02:30:17 +01:00
|
|
|
1.0f, 1.0f,
|
|
|
|
-1.0f, 1.0f,
|
|
|
|
-1.0f, -1.0f,
|
|
|
|
|
|
|
|
-1.0f, -1.0f,
|
|
|
|
1.0f, -1.0f,
|
|
|
|
1.0f, 1.0f
|
|
|
|
};
|
2022-01-11 06:56:44 +01:00
|
|
|
float quadTex[] =
|
|
|
|
{
|
2013-11-12 02:30:17 +01:00
|
|
|
1.0f, 1.0f,
|
|
|
|
0.0f, 1.0f,
|
|
|
|
0.0f, 0.0f,
|
|
|
|
|
|
|
|
0.0f, 0.0f,
|
|
|
|
1.0f, 0.0f,
|
|
|
|
1.0f, 1.0f
|
|
|
|
};
|
|
|
|
shader->TexCoordPointer(GL_TEXTURE0, 2, GL_FLOAT, 0, quadTex);
|
|
|
|
shader->VertexPointer(2, GL_FLOAT, 0, quadVerts);
|
|
|
|
shader->AssertPointersBound();
|
|
|
|
glDrawArrays(GL_TRIANGLES, 0, 6);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
shaderTech->EndPass(pass);
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
m_WhichBuffer = !m_WhichBuffer;
|
|
|
|
}
|
|
|
|
|
2022-01-19 18:28:47 +01:00
|
|
|
void CPostprocManager::ApplyPostproc(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
2014-10-27 01:53:31 +01:00
|
|
|
ENSURE(m_IsInitialized);
|
2014-10-05 22:50:10 +02:00
|
|
|
|
2020-05-03 00:34:29 +02:00
|
|
|
// Don't do anything if we are using the default effect and no AA.
|
|
|
|
const bool hasEffects = m_PostProcEffect != L"default";
|
2021-12-14 07:34:02 +01:00
|
|
|
const bool hasARB = g_VideoMode.GetBackend() == CVideoMode::Backend::GL_ARB;
|
|
|
|
const bool hasAA = m_AATech && !hasARB;
|
|
|
|
const bool hasSharp = m_SharpTech && !hasARB;
|
2020-08-08 00:16:55 +02:00
|
|
|
if (!hasEffects && !hasAA && !hasSharp)
|
2012-10-15 12:34:23 +02:00
|
|
|
return;
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2020-05-03 00:34:29 +02:00
|
|
|
if (hasEffects)
|
|
|
|
{
|
|
|
|
// First render blur textures. Note that this only happens ONLY ONCE, before any effects are applied!
|
|
|
|
// (This may need to change depending on future usage, however that will have a fps hit)
|
2022-01-19 18:28:47 +01:00
|
|
|
ApplyBlur(deviceCommandContext);
|
2020-05-03 00:34:29 +02:00
|
|
|
for (int pass = 0; pass < m_PostProcTech->GetNumPasses(); ++pass)
|
2022-01-19 18:28:47 +01:00
|
|
|
ApplyEffect(deviceCommandContext, m_PostProcTech, pass);
|
2020-05-03 00:34:29 +02:00
|
|
|
}
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2020-07-24 20:48:18 +02:00
|
|
|
if (hasAA)
|
2020-02-05 22:53:10 +01:00
|
|
|
{
|
|
|
|
for (int pass = 0; pass < m_AATech->GetNumPasses(); ++pass)
|
2022-01-19 18:28:47 +01:00
|
|
|
ApplyEffect(deviceCommandContext, m_AATech, pass);
|
2020-02-05 22:53:10 +01:00
|
|
|
}
|
|
|
|
|
2020-08-08 00:16:55 +02:00
|
|
|
if (hasSharp)
|
|
|
|
{
|
|
|
|
for (int pass = 0; pass < m_SharpTech->GetNumPasses(); ++pass)
|
2022-01-19 18:28:47 +01:00
|
|
|
ApplyEffect(deviceCommandContext, m_SharpTech, pass);
|
2020-08-08 00:16:55 +02:00
|
|
|
}
|
2012-10-15 12:34:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Generate list of available effect-sets
|
2014-10-05 22:50:10 +02:00
|
|
|
std::vector<CStrW> CPostprocManager::GetPostEffects()
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
|
|
|
std::vector<CStrW> effects;
|
2015-07-30 01:44:12 +02:00
|
|
|
|
2020-11-26 23:28:50 +01:00
|
|
|
const VfsPath folder(L"shaders/effects/postproc/");
|
2015-07-30 01:44:12 +02:00
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
VfsPaths pathnames;
|
2020-11-26 23:28:50 +01:00
|
|
|
if (vfs::GetPathnames(g_VFS, folder, 0, pathnames) < 0)
|
|
|
|
LOGERROR("Error finding Post effects in '%s'", folder.string8());
|
2014-10-05 22:50:10 +02:00
|
|
|
|
2015-07-30 01:44:12 +02:00
|
|
|
for (const VfsPath& path : pathnames)
|
|
|
|
if (path.Extension() == L".xml")
|
|
|
|
effects.push_back(path.Basename().string());
|
|
|
|
|
2012-10-15 12:34:23 +02:00
|
|
|
// Add the default "null" effect to the list.
|
|
|
|
effects.push_back(L"default");
|
|
|
|
|
|
|
|
sort(effects.begin(), effects.end());
|
|
|
|
|
|
|
|
return effects;
|
|
|
|
}
|
|
|
|
|
2015-07-27 03:08:25 +02:00
|
|
|
void CPostprocManager::SetPostEffect(const CStrW& name)
|
2012-10-15 12:34:23 +02:00
|
|
|
{
|
2014-10-27 01:53:31 +01:00
|
|
|
if (m_IsInitialized)
|
|
|
|
{
|
|
|
|
if (name != L"default")
|
|
|
|
{
|
|
|
|
CStrW n = L"postproc/" + name;
|
|
|
|
m_PostProcTech = g_Renderer.GetShaderManager().LoadEffect(CStrIntern(n.ToUTF8()));
|
|
|
|
}
|
|
|
|
}
|
2014-10-05 22:50:10 +02:00
|
|
|
|
2014-10-27 01:53:31 +01:00
|
|
|
m_PostProcEffect = name;
|
2012-10-15 12:34:23 +02:00
|
|
|
}
|
2013-11-12 02:17:16 +01:00
|
|
|
|
2020-02-05 22:53:10 +01:00
|
|
|
void CPostprocManager::UpdateAntiAliasingTechnique()
|
|
|
|
{
|
2021-12-14 07:34:02 +01:00
|
|
|
if (g_VideoMode.GetBackend() == CVideoMode::Backend::GL_ARB || !m_IsInitialized)
|
2020-02-05 22:53:10 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
CStr newAAName;
|
|
|
|
CFG_GET_VAL("antialiasing", newAAName);
|
|
|
|
if (m_AAName == newAAName)
|
|
|
|
return;
|
|
|
|
m_AAName = newAAName;
|
|
|
|
m_AATech.reset();
|
|
|
|
|
2020-11-15 21:07:48 +01:00
|
|
|
if (m_UsingMultisampleBuffer)
|
|
|
|
{
|
|
|
|
m_UsingMultisampleBuffer = false;
|
|
|
|
DestroyMultisampleBuffer();
|
|
|
|
}
|
|
|
|
|
2020-02-05 22:53:10 +01:00
|
|
|
// We have to hardcode names in the engine, because anti-aliasing
|
|
|
|
// techinques strongly depend on the graphics pipeline.
|
|
|
|
// We might use enums in future though.
|
2020-11-15 21:07:48 +01:00
|
|
|
const CStr msaaPrefix = "msaa";
|
2020-02-05 22:53:10 +01:00
|
|
|
if (m_AAName == "fxaa")
|
|
|
|
{
|
|
|
|
m_AATech = g_Renderer.GetShaderManager().LoadEffect(CStrIntern("fxaa"));
|
|
|
|
}
|
2020-11-15 21:07:48 +01:00
|
|
|
else if (m_AAName.size() > msaaPrefix.size() && m_AAName.substr(0, msaaPrefix.size()) == msaaPrefix)
|
|
|
|
{
|
|
|
|
// We don't want to enable MSAA in Atlas, because it uses wxWidgets and its canvas.
|
|
|
|
if (g_AtlasGameLoop && g_AtlasGameLoop->running)
|
|
|
|
return;
|
2022-02-13 22:46:03 +01:00
|
|
|
if (!g_VideoMode.GetBackendDevice()->GetCapabilities().multisampling && !m_AllowedSampleCounts.empty())
|
2020-11-15 21:07:48 +01:00
|
|
|
{
|
|
|
|
LOGWARNING("MSAA is unsupported.");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
std::stringstream ss(m_AAName.substr(msaaPrefix.size()));
|
|
|
|
ss >> m_MultisampleCount;
|
|
|
|
if (std::find(std::begin(m_AllowedSampleCounts), std::end(m_AllowedSampleCounts), m_MultisampleCount) ==
|
|
|
|
std::end(m_AllowedSampleCounts))
|
|
|
|
{
|
|
|
|
m_MultisampleCount = 4;
|
|
|
|
LOGWARNING("Wrong MSAA sample count: %s.", m_AAName.EscapeToPrintableASCII().c_str());
|
|
|
|
}
|
|
|
|
m_UsingMultisampleBuffer = true;
|
|
|
|
CreateMultisampleBuffer();
|
|
|
|
}
|
2020-02-05 22:53:10 +01:00
|
|
|
}
|
|
|
|
|
2020-08-08 00:16:55 +02:00
|
|
|
void CPostprocManager::UpdateSharpeningTechnique()
|
|
|
|
{
|
2021-12-14 07:34:02 +01:00
|
|
|
if (g_VideoMode.GetBackend() == CVideoMode::Backend::GL_ARB || !m_IsInitialized)
|
2020-08-08 00:16:55 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
CStr newSharpName;
|
|
|
|
CFG_GET_VAL("sharpening", newSharpName);
|
|
|
|
if (m_SharpName == newSharpName)
|
|
|
|
return;
|
|
|
|
m_SharpName = newSharpName;
|
|
|
|
m_SharpTech.reset();
|
|
|
|
|
|
|
|
if (m_SharpName == "cas")
|
|
|
|
{
|
|
|
|
m_SharpTech = g_Renderer.GetShaderManager().LoadEffect(CStrIntern(m_SharpName));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CPostprocManager::UpdateSharpnessFactor()
|
|
|
|
{
|
|
|
|
CFG_GET_VAL("sharpness", m_Sharpness);
|
|
|
|
}
|
|
|
|
|
2019-09-20 09:54:44 +02:00
|
|
|
void CPostprocManager::SetDepthBufferClipPlanes(float nearPlane, float farPlane)
|
|
|
|
{
|
|
|
|
m_NearPlane = nearPlane;
|
|
|
|
m_FarPlane = farPlane;
|
|
|
|
}
|
|
|
|
|
2020-11-15 21:07:48 +01:00
|
|
|
void CPostprocManager::CreateMultisampleBuffer()
|
|
|
|
{
|
|
|
|
glEnable(GL_MULTISAMPLE);
|
|
|
|
|
2022-02-13 20:30:28 +01:00
|
|
|
m_MultisampleColorTex = g_VideoMode.GetBackendDevice()->CreateTexture("PostProcColorMS",
|
2021-12-27 22:01:43 +01:00
|
|
|
Renderer::Backend::GL::CTexture::Type::TEXTURE_2D_MULTISAMPLE,
|
|
|
|
Renderer::Backend::Format::R8G8B8A8, m_Width, m_Height,
|
|
|
|
Renderer::Backend::Sampler::MakeDefaultSampler(
|
|
|
|
Renderer::Backend::Sampler::Filter::LINEAR,
|
2022-01-05 15:49:54 +01:00
|
|
|
Renderer::Backend::Sampler::AddressMode::CLAMP_TO_EDGE), 1, m_MultisampleCount);
|
2020-11-15 21:07:48 +01:00
|
|
|
|
|
|
|
// Allocate the Depth/Stencil texture.
|
2022-02-13 20:30:28 +01:00
|
|
|
m_MultisampleDepthTex = g_VideoMode.GetBackendDevice()->CreateTexture("PostProcDepthMS",
|
2021-12-27 22:01:43 +01:00
|
|
|
Renderer::Backend::GL::CTexture::Type::TEXTURE_2D_MULTISAMPLE,
|
|
|
|
Renderer::Backend::Format::D24_S8, m_Width, m_Height,
|
|
|
|
Renderer::Backend::Sampler::MakeDefaultSampler(
|
|
|
|
Renderer::Backend::Sampler::Filter::LINEAR,
|
2022-01-05 15:49:54 +01:00
|
|
|
Renderer::Backend::Sampler::AddressMode::CLAMP_TO_EDGE), 1, m_MultisampleCount);
|
2020-11-15 21:07:48 +01:00
|
|
|
|
|
|
|
// Set up the framebuffers with some initial textures.
|
2022-02-05 17:59:23 +01:00
|
|
|
m_MultisampleFramebuffer = Renderer::Backend::GL::CFramebuffer::Create(
|
|
|
|
m_MultisampleColorTex.get(), m_MultisampleDepthTex.get(),
|
|
|
|
g_VideoMode.GetBackendDevice()->GetCurrentBackbuffer()->GetClearColor());
|
2020-11-15 21:07:48 +01:00
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
if (!m_MultisampleFramebuffer)
|
2020-11-15 21:07:48 +01:00
|
|
|
{
|
2022-02-05 17:59:23 +01:00
|
|
|
LOGERROR("Failed to create postproc multisample framebuffer");
|
2020-11-15 21:07:48 +01:00
|
|
|
m_UsingMultisampleBuffer = false;
|
|
|
|
DestroyMultisampleBuffer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CPostprocManager::DestroyMultisampleBuffer()
|
|
|
|
{
|
|
|
|
if (m_UsingMultisampleBuffer)
|
|
|
|
return;
|
2022-02-05 17:59:23 +01:00
|
|
|
m_MultisampleFramebuffer.reset();
|
2021-12-27 22:01:43 +01:00
|
|
|
m_MultisampleColorTex.reset();
|
|
|
|
m_MultisampleDepthTex.reset();
|
2020-11-15 21:07:48 +01:00
|
|
|
glDisable(GL_MULTISAMPLE);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CPostprocManager::IsMultisampleEnabled() const
|
|
|
|
{
|
|
|
|
return m_UsingMultisampleBuffer;
|
|
|
|
}
|
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
void CPostprocManager::ResolveMultisampleFramebuffer(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* deviceCommandContext)
|
2020-11-15 21:07:48 +01:00
|
|
|
{
|
|
|
|
if (!m_UsingMultisampleBuffer)
|
|
|
|
return;
|
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
deviceCommandContext->BlitFramebuffer(
|
|
|
|
m_PingFramebuffer.get(), m_MultisampleFramebuffer.get());
|
|
|
|
deviceCommandContext->SetFramebuffer(m_PingFramebuffer.get());
|
2020-11-15 21:07:48 +01:00
|
|
|
}
|
|
|
|
|
2013-11-12 02:17:16 +01:00
|
|
|
#else
|
|
|
|
|
|
|
|
#warning TODO: implement PostprocManager for GLES
|
|
|
|
|
2022-01-04 14:29:01 +01:00
|
|
|
void ApplyBlurDownscale2x(
|
2022-01-19 18:28:47 +01:00
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext),
|
2022-02-05 17:59:23 +01:00
|
|
|
Renderer::Backend::GL::CFramebuffer* UNUSED(framebuffer),
|
2022-01-04 14:29:01 +01:00
|
|
|
Renderer::Backend::GL::CTexture* UNUSED(inTex),
|
|
|
|
int UNUSED(inWidth), int UNUSED(inHeight))
|
2013-11-12 02:17:16 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-01-04 14:29:01 +01:00
|
|
|
void CPostprocManager::ApplyBlurGauss(
|
2022-01-19 18:28:47 +01:00
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext),
|
2022-02-05 17:59:23 +01:00
|
|
|
Renderer::Backend::GL::CTexture* UNUSED(inTex),
|
2022-01-04 14:29:01 +01:00
|
|
|
Renderer::Backend::GL::CTexture* UNUSED(tempTex),
|
2022-02-05 17:59:23 +01:00
|
|
|
Renderer::Backend::GL::CFramebuffer* UNUSED(tempFramebuffer),
|
|
|
|
Renderer::Backend::GL::CFramebuffer* UNUSED(outFramebuffer),
|
2022-01-04 14:29:01 +01:00
|
|
|
int UNUSED(inWidth), int UNUSED(inHeight))
|
2013-11-12 02:17:16 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-01-19 18:28:47 +01:00
|
|
|
void CPostprocManager::ApplyEffect(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext),
|
2022-02-05 17:59:23 +01:00
|
|
|
const CShaderTechniquePtr& UNUSED(shaderTech), int UNUSED(pass))
|
2013-11-12 02:17:16 +01:00
|
|
|
{
|
|
|
|
}
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2013-11-12 02:17:16 +01:00
|
|
|
CPostprocManager::CPostprocManager()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
CPostprocManager::~CPostprocManager()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-01-28 07:34:34 +01:00
|
|
|
bool CPostprocManager::IsEnabled() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-11-12 02:17:16 +01:00
|
|
|
void CPostprocManager::Initialize()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-10-29 03:36:42 +01:00
|
|
|
void CPostprocManager::Resize()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-11-12 02:17:16 +01:00
|
|
|
void CPostprocManager::Cleanup()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CPostprocManager::RecreateBuffers()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-10-29 03:36:42 +01:00
|
|
|
std::vector<CStrW> CPostprocManager::GetPostEffects()
|
2013-11-12 02:17:16 +01:00
|
|
|
{
|
|
|
|
return std::vector<CStrW>();
|
|
|
|
}
|
|
|
|
|
2015-07-27 03:08:25 +02:00
|
|
|
void CPostprocManager::SetPostEffect(const CStrW& UNUSED(name))
|
2013-11-12 02:17:16 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2019-09-20 09:54:44 +02:00
|
|
|
void CPostprocManager::SetDepthBufferClipPlanes(float UNUSED(nearPlane), float UNUSED(farPlane))
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-02-05 22:53:10 +01:00
|
|
|
void CPostprocManager::UpdateAntiAliasingTechnique()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-08-08 00:16:55 +02:00
|
|
|
void CPostprocManager::UpdateSharpeningTechnique()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CPostprocManager::UpdateSharpnessFactor()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
void CPostprocManager::CaptureRenderOutput(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext))
|
2013-11-12 02:17:16 +01:00
|
|
|
{
|
|
|
|
}
|
2016-11-23 15:09:58 +01:00
|
|
|
|
2022-01-19 18:28:47 +01:00
|
|
|
void CPostprocManager::ApplyPostproc(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext))
|
2013-11-12 02:17:16 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2022-01-31 21:10:06 +01:00
|
|
|
void CPostprocManager::ReleaseRenderOutput(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext))
|
2013-11-12 02:17:16 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2020-11-15 21:07:48 +01:00
|
|
|
void CPostprocManager::CreateMultisampleBuffer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void CPostprocManager::DestroyMultisampleBuffer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool CPostprocManager::IsMultisampleEnabled() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-02-05 17:59:23 +01:00
|
|
|
void CPostprocManager::ResolveMultisampleFramebuffer(
|
|
|
|
Renderer::Backend::GL::CDeviceCommandContext* UNUSED(deviceCommandContext))
|
2020-11-15 21:07:48 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-11-12 02:17:16 +01:00
|
|
|
#endif
|