- simplify depthblur.fp into a single function

This commit is contained in:
Magnus Norddahl 2019-04-16 08:59:29 +02:00
commit 9d29a460de
2 changed files with 38 additions and 45 deletions

View file

@ -697,11 +697,6 @@ void PPAmbientOcclusion::Render(PPRenderState *renderstate, float m5, int sceneW
ssaoUniforms.Scale = sceneScale;
ssaoUniforms.Offset = sceneOffset;
DepthBlurUniforms blurUniforms;
blurUniforms.BlurSharpness = blurSharpness;
blurUniforms.InvFullResolution = { 1.0f / AmbientWidth, 1.0f / AmbientHeight };
blurUniforms.PowExponent = gl_ssao_exponent;
AmbientCombineUniforms combineUniforms;
combineUniforms.SampleCount = gl_multisample;
combineUniforms.Scale = screen->SceneScale();
@ -740,6 +735,11 @@ void PPAmbientOcclusion::Render(PPRenderState *renderstate, float m5, int sceneW
// Blur SSAO texture
if (gl_ssao_debug < 2)
{
DepthBlurUniforms blurUniforms;
blurUniforms.BlurSharpness = blurSharpness;
blurUniforms.PowExponent = gl_ssao_exponent;
blurUniforms.InvFullResolution = { 1.0f / AmbientWidth, 0.0f };
renderstate->Clear();
renderstate->Shader = &BlurHorizontal;
renderstate->Uniforms.Set(blurUniforms);
@ -749,9 +749,15 @@ void PPAmbientOcclusion::Render(PPRenderState *renderstate, float m5, int sceneW
renderstate->SetNoBlend();
renderstate->Draw();
blurUniforms.InvFullResolution = { 0.0f, 1.0f / AmbientHeight };
renderstate->Clear();
renderstate->Shader = &BlurVertical;
renderstate->Uniforms.Set(blurUniforms);
renderstate->Viewport = ambientViewport;
renderstate->SetInputTexture(0, &Ambient1);
renderstate->SetOutputTexture(&Ambient0);
renderstate->SetNoBlend();
renderstate->Draw();
}