#pragma once #include "OpenGLRenderer.h" #include "RenderPassDescriptor.h" #include "ShaderTypes.h" #include "VideoIOFormat.h" #include #include #include class OpenGLRenderPass { public: using LayerProgram = OpenGLRenderer::LayerProgram; using TextBindingUpdater = std::function; using GlobalParamsUpdater = std::function; explicit OpenGLRenderPass(OpenGLRenderer& renderer); void Render( bool hasInputSource, const std::vector& layerStates, unsigned inputFrameWidth, unsigned inputFrameHeight, unsigned captureTextureWidth, VideoIOPixelFormat inputPixelFormat, unsigned historyCap, const TextBindingUpdater& updateTextBinding, const GlobalParamsUpdater& updateGlobalParams); private: void RenderDecodePass(unsigned inputFrameWidth, unsigned inputFrameHeight, unsigned captureTextureWidth, VideoIOPixelFormat inputPixelFormat); std::vector BuildLayerPassDescriptors( const std::vector& layerStates, std::vector& layerPrograms) const; void RenderLayerPass( const RenderPassDescriptor& pass, unsigned inputFrameWidth, unsigned inputFrameHeight, unsigned historyCap, const TextBindingUpdater& updateTextBinding, const GlobalParamsUpdater& updateGlobalParams); void RenderShaderProgram( GLuint sourceTexture, GLuint destinationFrameBuffer, LayerProgram& layerProgram, const RuntimeRenderState& state, unsigned inputFrameWidth, unsigned inputFrameHeight, unsigned historyCap, const TextBindingUpdater& updateTextBinding, const GlobalParamsUpdater& updateGlobalParams); void BindLayerTextureAssets(const LayerProgram& layerProgram); void UnbindLayerTextureAssets(const LayerProgram& layerProgram, unsigned historyCap); OpenGLRenderer& mRenderer; };