X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Frenderers%2Frender-frame-buffer.h;h=bbd2bf052deaea5fa27118d9317a37099f55f2ec;hb=79881246746f65474b24ea4fe14151ccef8df3f4;hp=3cf711059da9fb1fda47986ea8db2caaabbf92d6;hpb=ba99c2fc92c63f4a7a513813dfc5e76cc502b831;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/renderers/render-frame-buffer.h b/dali/internal/render/renderers/render-frame-buffer.h index 3cf7110..bbd2bf0 100644 --- a/dali/internal/render/renderers/render-frame-buffer.h +++ b/dali/internal/render/renderers/render-frame-buffer.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_RENDER_FRAME_BUFFER_H /* - * Copyright (c) 2018 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,12 +19,15 @@ // INTERNAL INCLUDES #include +#include #include #include #include namespace Dali { +using Mask = Dali::FrameBuffer::Attachment::Mask; + namespace Internal { namespace Render @@ -37,71 +40,94 @@ public: /** * Constructor - * @param[in] width The width of the FrameBuffer - * @param[in] height The height of the FrameBuffer - * @param[in] attachments The attachments comprising the format of the FrameBuffer (bit-mask) */ - FrameBuffer( uint32_t width, uint32_t height, uint32_t attachments ); + FrameBuffer( uint32_t width, uint32_t height, Mask attachments ); /** * Destructor */ - ~FrameBuffer(); + virtual ~FrameBuffer(); /** * Creates a FrameBuffer object in the GPU. * @param[in] context The GL context */ - void Initialize(Context& context); + virtual void Initialize( Context& context ); /** * Deletes the framebuffer object from the GPU * @param[in] context The GL context */ - void Destroy( Context& context ); + virtual void Destroy( Context& context ); /** * Called by RenderManager to inform the framebuffer that the context has been destroyed */ - void GlContextDestroyed(); + virtual void GlContextDestroyed(); + + /** + * @brief Bind the framebuffer + * @param[in] context The GL context + */ + virtual void Bind( Context& context ); + + /** + * @brief Get the width of the FrameBuffer + * @return The width of the framebuffer + */ + virtual uint32_t GetWidth() const; + + /** + * @brief Get the height of the FrameBuffer + * @return The height of the framebuffer + */ + virtual uint32_t GetHeight() const; /** * @brief Attach a texture for color rendering. Valid only for Framebuffers with COLOR attachments. - * param[in] context The GL context + * @param[in] context The GL context * @param[in] texture The texture that will be used as output when rendering * @param[in] mipmapLevel The mipmap of the texture to be attached * @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures + * @note A maximum of Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS are supported. */ void AttachColorTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer ); /** - * @brief Bind the framebuffer - * @param[in] context The GL context + * @brief Get the number of textures bound to this frame buffer as color attachments. + * @return The number of color attachments. */ - void Bind( Context& context ); + uint8_t GetColorAttachmentCount() const { return mColorAttachmentCount; } /** - * @brief Get the width of the FrameBuffer - * @return The width of the framebuffer + * @brief Get the id (OpenGL handle) of the texture bound to this frame buffer as color attachment @a index. + * @return The texture id. + */ + GLuint GetTextureId(uint8_t index) { return mTextureId[index]; }; + +private: + + /** + * @brief Undefined copy constructor. FrameBuffer cannot be copied */ - uint32_t GetWidth() const; + FrameBuffer( const FrameBuffer& rhs ) = delete; /** - * @brief Get the height of the FrameBuffer - * @return The height of the framebuffer + * @brief Undefined assignment operator. FrameBuffer cannot be copied */ - uint32_t GetHeight() const; + FrameBuffer& operator=( const FrameBuffer& rhs ) = delete; private: GLuint mId; + GLuint mTextureId[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ]; GLuint mDepthBuffer; GLuint mStencilBuffer; uint32_t mWidth; uint32_t mHeight; + uint8_t mColorAttachmentCount; }; - } // namespace Render } // namespace Internal