/* SPDX-License-Identifier: GPL-2.0-or-later * Copyright 2022 Blender Foundation. All rights reserved. */ #pragma once #include "DNA_scene_types.h" #include "GPU_texture.h" #include "VPC_texture_pool.hh" namespace blender::viewport_compositor { /* This abstract class is used by node operations to access data intrinsic to the compositor * engine. The compositor engine should implement the class to provide the necessary * functionalities for node operations. */ class Context { private: /* A texture pool that can be used to allocate textures for the compositor efficiently. */ TexturePool &texture_pool_; public: Context(TexturePool &texture_pool); /* Get the active compositing scene. */ virtual const Scene *get_scene() = 0; /* Get the texture representing the viewport where the result of the compositor should be * written. This should be called by output nodes to get their target texture. */ virtual GPUTexture *get_viewport_texture() = 0; /* Get the texture where the given render pass is stored. This should be called by the Render * Layer node to populate its outputs. */ virtual GPUTexture *get_pass_texture(int view_layer, eScenePassType pass_type) = 0; /* Get a reference to the texture pool of this context. */ TexturePool &texture_pool(); }; } // namespace blender::viewport_compositor