Mobile DoF integration for FilmGrain Tonemap.TonemapperFilm set by default

#jira UE-86775
#rb Jack.Porter, Dmitriy.Dyomin
#lockdown cristina.riveron

#ROBOMERGE-SOURCE: CL 12620424 in //UE4/Release-4.25/... via CL 12620427 via CL 12620433
#ROBOMERGE-BOT: RELEASE (Release-Engine-Staging -> Main) (v675-12543919)

[CL 12620435 by florin pascu in Main branch]
This commit is contained in:
florin pascu
2020-04-06 08:26:53 -04:00
parent 4329e99e55
commit 48438a40d8
7 changed files with 216 additions and 28 deletions
@@ -2164,8 +2164,129 @@ FPooledRenderTargetDesc FRCPassPostProcessDofBlurES2::ComputeOutputDesc(EPassOut
}
class FPostProcessIntegrateDofPS_ES2 : public FGlobalShader
{
DECLARE_SHADER_TYPE(FPostProcessIntegrateDofPS_ES2, Global);
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
{
return !IsConsolePlatform(Parameters.Platform);
}
FPostProcessIntegrateDofPS_ES2() {}
public:
LAYOUT_FIELD(FPostProcessPassParameters, PostprocessParameter);
FPostProcessIntegrateDofPS_ES2(const ShaderMetaType::CompiledShaderInitializerType& Initializer)
: FGlobalShader(Initializer)
{
PostprocessParameter.Bind(Initializer.ParameterMap);
}
void SetPS(const FRenderingCompositePassContext& Context)
{
FRHIPixelShader* ShaderRHI = Context.RHICmdList.GetBoundPixelShader();
const FPostProcessSettings& Settings = Context.View.FinalPostProcessSettings;
FGlobalShader::SetParameters<FViewUniformShaderParameters>(Context.RHICmdList, ShaderRHI, Context.View.ViewUniformBuffer);
PostprocessParameter.SetPS(Context.RHICmdList, ShaderRHI, Context, TStaticSamplerState<SF_Bilinear, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI());
}
};
IMPLEMENT_SHADER_TYPE(, FPostProcessIntegrateDofPS_ES2, TEXT("/Engine/Private/PostProcessMobile.usf"), TEXT("IntegrateDOFPS_ES2"), SF_Pixel);
class FPostProcessIntegrateDofVS_ES2 : public FGlobalShader
{
DECLARE_SHADER_TYPE(FPostProcessIntegrateDofVS_ES2, Global);
static bool ShouldCompilePermutation(const FGlobalShaderPermutationParameters& Parameters)
{
return !IsConsolePlatform(Parameters.Platform);
}
FPostProcessIntegrateDofVS_ES2() {}
public:
LAYOUT_FIELD(FPostProcessPassParameters, PostprocessParameter);
FPostProcessIntegrateDofVS_ES2(const ShaderMetaType::CompiledShaderInitializerType& Initializer)
: FGlobalShader(Initializer)
{
PostprocessParameter.Bind(Initializer.ParameterMap);
}
void SetVS(const FRenderingCompositePassContext& Context)
{
FRHIVertexShader* ShaderRHI = Context.RHICmdList.GetBoundVertexShader();
FGlobalShader::SetParameters<FViewUniformShaderParameters>(Context.RHICmdList, ShaderRHI, Context.View.ViewUniformBuffer);
PostprocessParameter.SetVS(ShaderRHI, Context, TStaticSamplerState<SF_Point, AM_Clamp, AM_Clamp, AM_Clamp>::GetRHI());
}
};
IMPLEMENT_SHADER_TYPE(, FPostProcessIntegrateDofVS_ES2, TEXT("/Engine/Private/PostProcessMobile.usf"), TEXT("IntegrateDOFVS_ES2"), SF_Vertex);
void FRCPassIntegrateDofES2::Process(FRenderingCompositePassContext& Context)
{
SCOPED_DRAW_EVENT(Context.RHICmdList, PostProcessIntegrateDof);
FIntRect DstRect;
DstRect.Min.X = 0;
DstRect.Min.Y = 0;
DstRect.Max.X = PrePostSourceViewportSize.X;
DstRect.Max.Y = PrePostSourceViewportSize.Y;
const FSceneRenderTargetItem& DestRenderTarget = PassOutputs[0].RequestSurface(Context);
ERenderTargetLoadAction LoadAction = ERenderTargetLoadAction::EClear;
FRHIRenderPassInfo RPInfo(DestRenderTarget.TargetableTexture, MakeRenderTargetActions(LoadAction, ERenderTargetStoreAction::EStore));
Context.RHICmdList.BeginRenderPass(RPInfo, TEXT("IntegrateDof"));
{
Context.SetViewportAndCallRHI(0, 0, 0.0f, PrePostSourceViewportSize.X, PrePostSourceViewportSize.Y, 1.0f);
FGraphicsPipelineStateInitializer GraphicsPSOInit;
Context.RHICmdList.ApplyCachedRenderTargets(GraphicsPSOInit);
GraphicsPSOInit.BlendState = TStaticBlendState<>::GetRHI();
GraphicsPSOInit.RasterizerState = TStaticRasterizerState<>::GetRHI();
GraphicsPSOInit.DepthStencilState = TStaticDepthStencilState<false, CF_Always>::GetRHI();
TShaderMapRef<FPostProcessIntegrateDofVS_ES2> VertexShader(Context.GetShaderMap());
TShaderMapRef<FPostProcessIntegrateDofPS_ES2> PixelShader(Context.GetShaderMap());
GraphicsPSOInit.BoundShaderState.VertexDeclarationRHI = GFilterVertexDeclaration.VertexDeclarationRHI;
GraphicsPSOInit.BoundShaderState.VertexShaderRHI = VertexShader.GetVertexShader();
GraphicsPSOInit.BoundShaderState.PixelShaderRHI = PixelShader.GetPixelShader();
GraphicsPSOInit.PrimitiveType = PT_TriangleList;
SetGraphicsPipelineState(Context.RHICmdList, GraphicsPSOInit);
VertexShader->SetVS(Context);
PixelShader->SetPS(Context);
DrawRectangle(
Context.RHICmdList,
0, 0,
PrePostSourceViewportSize.X, PrePostSourceViewportSize.Y,
0, 0,
PrePostSourceViewportSize.X, PrePostSourceViewportSize.Y,
PrePostSourceViewportSize,
PrePostSourceViewportSize,
VertexShader,
EDRF_UseTriangleOptimization);
}
Context.RHICmdList.EndRenderPass();
Context.RHICmdList.CopyToResolveTarget(DestRenderTarget.TargetableTexture, DestRenderTarget.ShaderResourceTexture, FResolveParams());
}
FPooledRenderTargetDesc FRCPassIntegrateDofES2::ComputeOutputDesc(EPassOutputId InPassOutputId) const
{
FPooledRenderTargetDesc Ret = GetInput(ePId_Input0)->GetOutput()->RenderTargetDesc;
Ret.DebugName = TEXT("IntegrateDof");
return Ret;
}
//