- fix the gl_ssao_debug cvar

This commit is contained in:
Magnus Norddahl 2019-04-16 03:32:54 +02:00
parent 73efe707ac
commit 558760c090
3 changed files with 16 additions and 5 deletions

View file

@ -706,6 +706,7 @@ void PPAmbientOcclusion::Render(PPRenderState *renderstate, float m5, int sceneW
combineUniforms.SampleCount = gl_multisample;
combineUniforms.Scale = screen->SceneScale();
combineUniforms.Offset = screen->SceneOffset();
combineUniforms.DebugMode = gl_ssao_debug;
IntRect ambientViewport;
ambientViewport.left = 0;
@ -759,7 +760,10 @@ void PPAmbientOcclusion::Render(PPRenderState *renderstate, float m5, int sceneW
renderstate->Shader = gl_multisample > 1 ? &CombineMS : &Combine;
renderstate->Uniforms.Set(combineUniforms);
renderstate->Viewport = screen->mSceneViewport;
renderstate->SetInputTexture(0, &Ambient0, PPFilterMode::Linear);
if (gl_ssao_debug < 3)
renderstate->SetInputTexture(0, &Ambient0, PPFilterMode::Linear);
else
renderstate->SetInputSceneNormal(0, PPFilterMode::Linear);
renderstate->SetInputSceneFog(1);
renderstate->SetOutputSceneColor();
if (gl_ssao_debug != 0)

View file

@ -650,7 +650,7 @@ struct DepthBlurUniforms
struct AmbientCombineUniforms
{
int SampleCount;
int Padding0, Padding1, Padding2;
int DebugMode, Padding1, Padding2;
FVector2 Scale;
FVector2 Offset;
@ -659,7 +659,7 @@ struct AmbientCombineUniforms
return
{
{ "SampleCount", UniformType::Int, offsetof(AmbientCombineUniforms, SampleCount) },
{ "Padding0", UniformType::Int, offsetof(AmbientCombineUniforms, Padding0) },
{ "DebugMode", UniformType::Int, offsetof(AmbientCombineUniforms, DebugMode) },
{ "Padding1", UniformType::Int, offsetof(AmbientCombineUniforms, Padding1) },
{ "Padding2", UniformType::Int, offsetof(AmbientCombineUniforms, Padding2) },
{ "Scale", UniformType::Vec2, offsetof(AmbientCombineUniforms, Scale) },

View file

@ -30,6 +30,13 @@ void main()
vec3 fogColor = texelFetch(SceneFogTexture, ipos, 0).rgb;
#endif
float attenutation = texture(AODepthTexture, TexCoord).x;
FragColor = vec4(fogColor, 1.0 - attenutation);
vec4 ssao = texture(AODepthTexture, TexCoord);
float attenutation = ssao.x;
if (DebugMode == 0)
FragColor = vec4(fogColor, 1.0 - attenutation);
else if (DebugMode < 3)
FragColor = vec4(attenutation, attenutation, attenutation, 1.0);
else
FragColor = vec4(ssao.xyz, 1.0);
}