#define DALI_INTERNAL_RENDER_TEXTURE_FRAME_BUFFER_H
/*
- * Copyright (c) 2019 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.
*/
// INTERNAL INCLUDES
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
#include <dali/internal/render/renderers/render-frame-buffer.h>
namespace Dali
bool IsSurfaceBacked() override { return false; };
/**
- * @brief Attach a texture for color rendering. Valid only for Framebuffers with COLOR attachments.
- * param[in] context The GL context
+ * @brief Attaches a texture for the color rendering. This API is valid only for frame buffer with COLOR attachments.
+ * @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 Attaches a texture for the depth rendering. This API is valid only for frame buffer with DEPTH attachments.
+ * @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
+ */
+ void AttachDepthTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
+ * @brief Attaches a texture for the depth/stencil rendering. This API is valid only for frame buffer with DEPTH_STENCIL attachments.
+ * @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
+ */
+ void AttachDepthStencilTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel );
+
+ /**
+ * @brief Get the number of textures bound to this frame buffer as color attachments.
+ * @return The number of color attachments.
+ */
+ uint8_t GetColorAttachmentCount() const { return mColorAttachmentCount; }
+
+ /**
+ * @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:
GLuint mId;
+ GLuint mTextureId[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
GLuint mDepthBuffer;
GLuint mStencilBuffer;
uint32_t mWidth;
uint32_t mHeight;
+ uint8_t mColorAttachmentCount;
};