// Copyright (c) Wojciech Figat. All rights reserved. #pragma once #include "RendererPass.h" #include "Engine/Graphics/GPUPipelineStatePermutations.h" /// /// Post-processing rendering service. /// class PostProcessingPass : public RendererPass { private: AssetReference _shader; GPUPipelineState* _psBloomBrightPass = nullptr; GPUPipelineState* _psBloomDownsample = nullptr; GPUPipelineState* _psBloomDualFilterUpsample = nullptr; GPUPipelineState* _psBlurH = nullptr; GPUPipelineState* _psBlurV = nullptr; GPUPipelineState* _psGenGhosts = nullptr; GPUPipelineStatePermutationsPs<3> _psComposite; AssetReference _defaultLensColor; AssetReference _defaultLensStar; AssetReference _defaultLensDirt; public: /// /// Perform postFx rendering for the input task /// /// The rendering context. /// Target with rendered HDR frame to post process /// Output frame /// The prebaked LUT for color grading and tonemapping. void Render(RenderContext& renderContext, GPUTexture* input, GPUTexture* output, GPUTexture* colorGradingLUT); private: #if COMPILE_WITH_DEV_ENV void OnShaderReloading(Asset* obj) { _psBloomBrightPass->ReleaseGPU(); _psBloomDownsample->ReleaseGPU(); _psBloomDualFilterUpsample->ReleaseGPU(); _psBlurH->ReleaseGPU(); _psBlurV->ReleaseGPU(); _psGenGhosts->ReleaseGPU(); _psComposite.Release(); invalidateResources(); } #endif public: // [RendererPass] String ToString() const override; bool Init() override; void Dispose() override; protected: // [RendererPass] bool setupResources() override; };