Move Added FrameBuffer API to Devel API 82/223182/2
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 24 Jan 2020 08:14:27 +0000 (08:14 +0000)
committerAdeel Kazmi <adeel.kazmi@samsung.com>
Fri, 24 Jan 2020 08:43:49 +0000 (08:43 +0000)
Change-Id: Ida5d7776f40bcfd4c0fbf1ee79964fc5b0f2082a

automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h
automated-tests/src/dali/utc-Dali-FrameBuffer.cpp
dali/devel-api/file.list
dali/devel-api/rendering/frame-buffer-devel.cpp [new file with mode: 0644]
dali/devel-api/rendering/frame-buffer-devel.h [new file with mode: 0644]
dali/internal/event/rendering/frame-buffer-impl.cpp
dali/internal/event/rendering/frame-buffer-impl.h
dali/internal/render/renderers/render-texture-frame-buffer.h
dali/public-api/rendering/frame-buffer.cpp
dali/public-api/rendering/frame-buffer.h

index 098f555..9f458fc 100644 (file)
@@ -2,7 +2,7 @@
 #define TEST_GL_ABSTRACTION_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.
@@ -29,6 +29,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/public-api/dali-core.h>
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
 #include <dali/integration-api/core.h>
 #include <dali/integration-api/gl-abstraction.h>
 #include <dali/integration-api/gl-defines.h>
@@ -584,7 +585,7 @@ public:
     mFramebufferStatus |= 4;
 
     //We check 4 attachment colors
-    if ((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS))
+    if ((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS))
     {
       uint8_t mask = 1 << (attachment - GL_COLOR_ATTACHMENT0);
       if ((mFrameBufferColorStatus & mask) == 0)
index 9524cda..5a9a0fc 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 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.
@@ -17,6 +17,7 @@
 
 #include <dali/public-api/dali-core.h>
 #include <dali-test-suite-utils.h>
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
 
 using namespace Dali;
 
@@ -372,7 +373,7 @@ int UtcDaliFrameBufferAttachColorTexture05(void)
   Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
 
   // N.B. it doesn't make sense per se, however the OGL standard doesn't seem to forbid attaching the same texture to different slots.
-  for (int i = 0; i < Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS + 1; ++i)
+  for (int i = 0; i < Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS + 1; ++i)
   {
     frameBuffer.AttachColorTexture( texture );
   }
@@ -380,7 +381,7 @@ int UtcDaliFrameBufferAttachColorTexture05(void)
   application.SendNotification();
   application.Render();
 
-  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS, TEST_LOCATION);
+  DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
   DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
 
@@ -428,7 +429,7 @@ int UtcDaliFrameBufferGetColorTexture03(void)
   frameBuffer.AttachColorTexture( texture, 0u, 1u );
 
   DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION);
-  DALI_TEST_EQUALS(frameBuffer.GetColorTexture(0), texture, TEST_LOCATION);
+  DALI_TEST_EQUALS(DevelFrameBuffer::GetColorTexture(frameBuffer, 0), texture, TEST_LOCATION);
 
   END_TEST;
 }
@@ -458,7 +459,7 @@ int UtcDaliFrameBufferGetColorTexture04(void)
 
   for (unsigned int i = 0; i < std::extent<decltype(textures)>::value; ++i)
   {
-    DALI_TEST_EQUALS(frameBuffer.GetColorTexture(i), textures[i], TEST_LOCATION);
+    DALI_TEST_EQUALS(DevelFrameBuffer::GetColorTexture(frameBuffer, i), textures[i], TEST_LOCATION);
   }
 
   END_TEST;
index 8a0db0e..78f1aab 100644 (file)
@@ -22,6 +22,7 @@ SET( devel_api_src_files
   ${devel_api_src_dir}/images/pixel-data-devel.cpp
   ${devel_api_src_dir}/object/handle-devel.cpp
   ${devel_api_src_dir}/object/csharp-type-registry.cpp
+  ${devel_api_src_dir}/rendering/frame-buffer-devel.cpp
   ${devel_api_src_dir}/scripting/scripting.cpp
   ${devel_api_src_dir}/signals/signal-delegate.cpp
   ${devel_api_src_dir}/threading/conditional-wait.cpp
@@ -88,6 +89,7 @@ SET( devel_api_core_object_header_files
 
 
 SET( devel_api_core_rendering_header_files
+  ${devel_api_src_dir}/rendering/frame-buffer-devel.h
   ${devel_api_src_dir}/rendering/renderer-devel.h
 )
 
diff --git a/dali/devel-api/rendering/frame-buffer-devel.cpp b/dali/devel-api/rendering/frame-buffer-devel.cpp
new file mode 100644 (file)
index 0000000..f515e70
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// HEADER
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/rendering/frame-buffer-impl.h> // Dali::Internal::FrameBuffer
+
+namespace Dali
+{
+
+namespace DevelFrameBuffer
+{
+
+Texture GetColorTexture( const FrameBuffer frameBuffer, uint8_t index )
+{
+  Internal::Texture* texturePtr = GetImplementation( frameBuffer ).GetColorTexture(index);
+  return Dali::Texture( texturePtr );
+}
+
+} // namespace DevelFrameBuffer
+
+} // namespace Dali
diff --git a/dali/devel-api/rendering/frame-buffer-devel.h b/dali/devel-api/rendering/frame-buffer-devel.h
new file mode 100644 (file)
index 0000000..455d567
--- /dev/null
@@ -0,0 +1,52 @@
+#ifndef DALI_FRAME_BUFFER_DEVEL_H
+#define DALI_FRAME_BUFFER_DEVEL_H
+
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/rendering/frame-buffer.h>
+
+namespace Dali
+{
+
+namespace DevelFrameBuffer
+{
+
+/**
+ * @brief Maximum number of color attachments supported.
+ */
+constexpr uint8_t MAX_COLOR_ATTACHMENTS = 8;
+
+/**
+ * @brief Gets the color texture at the given @a index used as output in the FrameBuffer.
+ *
+ * @param[in] frameBuffer A handle to the framebuffer
+ * @param[in] index The index required
+ *
+ * @return A handle to the texture used as color output, or an uninitialized handle
+ *
+ * @note A maximum of 8 color attachments are supported. Passing an invalid index will return
+ * an uninitialized handle.
+ */
+Texture GetColorTexture( const FrameBuffer frameBuffer, uint8_t index );
+
+} // namespace DevelFrameBuffer
+
+} // namespace Dali
+
+#endif // DALI_FRAME_BUFFER_DEVEL_H
index 5fb8bfe..1703fd7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -94,7 +94,7 @@ void FrameBuffer::AttachColorTexture( TexturePtr texture, uint32_t mipmapLevel,
     {
       DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Size mismatch \n" );
     }
-    else if ( mColorAttachmentCount >= Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS )
+    else if ( mColorAttachmentCount >= Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS )
     {
       DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Exceeded maximum supported color attachments.\n" );
     }
index dfb5344..e30c285 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_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.
@@ -23,6 +23,7 @@
 #include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
 #include <dali/internal/event/common/event-thread-services.h>
 #include <dali/internal/event/rendering/texture-impl.h>
 
@@ -136,7 +137,7 @@ private: // data
   Internal::EventThreadServices& mEventThreadServices; ///< Used to send messages to the render thread via update thread
   Internal::Render::FrameBuffer* mRenderObject;        ///< The Render::Texture associated to this texture
 
-  TexturePtr mColor[Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS];
+  TexturePtr mColor[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
   uint32_t mWidth;
   uint32_t mHeight;
   Mask mAttachments;                           ///< Bit-mask of type FrameBuffer::Attachment::Mask
index c8bc8b4..5c297d9 100644 (file)
@@ -2,7 +2,7 @@
 #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.
@@ -18,6 +18,7 @@
  */
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
 #include <dali/internal/render/renderers/render-frame-buffer.h>
 
 namespace Dali
@@ -107,7 +108,7 @@ public:
 private:
 
   GLuint mId;
-  GLuint mTextureId[Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS];
+  GLuint mTextureId[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
   GLuint mDepthBuffer;
   GLuint mStencilBuffer;
   uint32_t mWidth;
index 0814059..2ddd912 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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.
@@ -108,16 +108,10 @@ void FrameBuffer::AttachColorTexture( Texture& texture, uint32_t mipmapLevel, ui
   }
 }
 
-Texture FrameBuffer::GetColorTexture() const
+Texture FrameBuffer::GetColorTexture()
 {
   Internal::Texture* texturePtr = GetImplementation(*this).GetColorTexture(0);
   return Dali::Texture( texturePtr );
 }
 
-Texture FrameBuffer::GetColorTexture(uint8_t index) const
-{
-  Internal::Texture* texturePtr = GetImplementation(*this).GetColorTexture(index);
-  return Dali::Texture( texturePtr );
-}
-
 } //namespace Dali
index 8c513c3..78143a1 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_FRAMEBUFFER_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.
@@ -72,11 +72,6 @@ public:
   };
 
   /**
-   * @brief Maximum number of color attachments supported.
-   */
-  static constexpr uint8_t MAX_COLOR_ATTACHMENTS = 8;
-
-  /**
    * @brief Creates a new FrameBuffer, which attaches only COLOR texture.
    *
    * @SINCE_1_4.0
@@ -185,17 +180,7 @@ public:
    * @SINCE_1_1.43
    * @returns A handle to the texture used as color output, or an uninitialized handle
    */
-  Texture GetColorTexture() const;
-
-  /**
-   * @brief Gets the color texture at the given @a index used as output in the FrameBuffer.
-   * @note A maximum of 8 color attachments are supported. Passing an invalid index will return
-   * an uninitialized handle.
-   *
-   * @SINCE_1_1.43
-   * @returns A handle to the texture used as color output, or an uninitialized handle
-   */
-  Texture GetColorTexture(uint8_t index) const;
+  Texture GetColorTexture();
 
 public: