Remove dependency of OpenGL es version. 43/200343/12
authorSeungho, Baek <sbsh.baek@samsung.com>
Fri, 22 Feb 2019 02:09:39 +0000 (11:09 +0900)
committerSeungho, Baek <sbsh.baek@samsung.com>
Thu, 14 Mar 2019 07:59:00 +0000 (16:59 +0900)
 - Remove compile option DALI_GLES_VERSION
 - Define texture format converting in the dali-adaptor

Change-Id: Ib6805783b718c5796341ce77a5346f7178c0705b
Signed-off-by: Seungho, Baek <sbsh.baek@samsung.com>
.travis.yml
README.md
automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.cpp
automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h
build/tizen-cmake/CMakeLists.txt
build/tizen/configure.ac
dali/integration-api/gl-abstraction.h
dali/internal/render/common/render-manager.cpp
dali/internal/render/gl-resources/context.h
dali/internal/render/renderers/render-texture.cpp
packaging/dali.spec

index 9fcfc79..04f43d6 100644 (file)
@@ -29,7 +29,7 @@ script:
   - autoreconf --install
   - export CXXFLAGS="--coverage "
   - export LD_LIBRARY_PATH=/usr/local/lib
-  - ./configure --enable-profile=UBUNTU --enable-gles=20 --enable-debug
+  - ./configure --enable-profile=UBUNTU --enable-debug
   - make -j7
   - sudo make install
   - popd
index 98db879..b374d3a 100644 (file)
--- a/README.md
+++ b/README.md
@@ -69,21 +69,6 @@ Then run the following commands:
          $ ./configure --prefix=$DESKTOP_PREFIX
          $ make install -j8
 
-### Build target options
-
-OpenGL ES context:
-
-When building, the OpenGL ES version of the target should be specified.
-
-Valid version options are 20, 30, 31
-
-With configure:
-Add: *--enable-gles=X*
-
-With gbs:
-Add to the gbs build line: *--define "%target_gles_version X"*
-
-
 ### Building and executing test cases
 
 See the README.md in dali-core/automated-tests.
index 02439bc..44c6a33 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -104,6 +104,10 @@ void TestGlAbstraction::PostRender()
 {
 }
 
+void TestGlAbstraction::ConvertTexture( uint8_t* buffer, GLenum& imageGlFormat, const uint32_t dataSize, const GLenum textureGlFormat, const bool isSubImage )
+{
+}
+
 } // Namespace dali
 
 bool BlendEnabled(const Dali::TraceCallStack& callStack)
index c68573b..c69e4e3 100644 (file)
@@ -2,7 +2,7 @@
 #define TEST_GL_ABSTRACTION_H
 
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -59,6 +59,8 @@ public:
   void PreRender();
   void PostRender();
 
+  void ConvertTexture( uint8_t* buffer, GLenum& imageGlFormat, const uint32_t dataSize, const GLenum textureGlFormat, const bool isSubImage );
+
   /* OpenGL ES 2.0 */
 
   inline void ActiveTexture( GLenum textureUnit )
index baf23b0..8faa8a1 100644 (file)
@@ -21,12 +21,10 @@ OPTION(ENABLE_DEBUG          "Enable Debug" OFF)
 OPTION(ENABLE_BACKTRACE      "Enable Backtrace" OFF)
 OPTION(ENABLE_LOCK_BACKTRACE "Enable" OFF)
 OPTION(ENABLE_COVERAGE       "Coverage" OFF)
-SET(GLES_VERSION 20 CACHE INTEGER "Gles Version")
 
 # Set up compiler definitions
 
 ADD_DEFINITIONS(-DPLATFORM_TIZEN -DDALI_COMPILATION)
-ADD_DEFINITIONS(-DDALI_GLES_VERSION=${GLES_VERSION})
 ADD_DEFINITIONS(-DPIC -DSTDC_HEADERS)
 
 IF("${ARCH}" STREQUAL "arm")
index 75b5615..4082251 100644 (file)
@@ -57,12 +57,6 @@ AC_ARG_ENABLE([lock_backtrace],
               [enable_lock_backtrace=$enableval],
               [enable_lock_backtrace=no])
 
-AC_ARG_ENABLE([gles],
-              [AC_HELP_STRING([--enable-gles],
-                              [Specify the OpenGL ES version for backwards compatibility])],
-              [enable_gles=$enableval],
-              [enable_gles=30])
-
 AC_ARG_ENABLE([cxx03_abi],
               [AC_HELP_STRING([--enable-cxx03-abi],
                               [Specify abi for the build])],
@@ -82,8 +76,6 @@ if test "x$enable_cxx03_abi" = "xyes"; then
   DALI_CFLAGS="$DALI_CFLAGS -D_GLIBCXX_USE_CXX11_ABI=0"
 fi
 
-DALI_CFLAGS="$DALI_CFLAGS -DDALI_GLES_VERSION=${enable_gles}"
-
 if test "x$enable_debug" = "xyes"; then
   DALI_CFLAGS="$DALI_CFLAGS -DDEBUG_ENABLED"
 fi
@@ -152,7 +144,6 @@ Configuration
   Data Dir (Read Only):             $dataReadOnlyDir
   Backtrace:                        $enable_backtrace
   ScopedLock Backtrace:             $enable_lock_backtrace
-  OpenGL ES version:                $enable_gles
   C++03 ABI:                        $enable_cxx03_abi
   Rename so file:                   $enable_rename_so
 "
index a5d81f3..d8cda34 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTEGRATION_GL_ABSTRACTION_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -116,6 +116,15 @@ public:
   virtual void PostRender() = 0;
 
   /**
+   * Determine whether to convert pixel format or not.
+   * @param[in] imageGlFormat GLformat of input image.
+   * @param[in] textureGlFormat GLformat of Texture.
+   * @param[in] isSubImage Boolian value for the whether the image is subimage or not
+   * @return Whether the texture will be convert or not.
+   */
+  virtual void ConvertTexture( uint8_t* buffer, GLenum& imageGlFormat, const uint32_t dataSize, const GLenum textureGlFormat, const bool isSubImage ) = 0;
+
+  /**
    * The number of texture units an implementation supports is implementation dependent, but must be at least 8.
    */
   static const unsigned int MIN_TEXTURE_UNIT_LIMIT = 8;
index a69d02f..7886686 100644 (file)
@@ -561,7 +561,7 @@ void RenderManager::DoRender( RenderInstruction& instruction )
   {
     surfaceFrameBuffer = static_cast<Render::SurfaceFrameBuffer*>( instruction.mFrameBuffer );
 
-#if DALI_GLES_VERSION >= 30
+    // For the Multi-Windows
     Context* surfaceContext = surfaceFrameBuffer->GetContext();
     if ( mImpl->currentContext != surfaceContext )
     {
@@ -570,7 +570,6 @@ void RenderManager::DoRender( RenderInstruction& instruction )
       // Clear the current cached program when the context is switched
       mImpl->programController.ClearCurrentProgram();
     }
-#endif
 
     surfaceRect = Rect<int32_t>( 0, 0, static_cast<int32_t>( surfaceFrameBuffer->GetWidth() ), static_cast<int32_t>( surfaceFrameBuffer->GetHeight() ) );
     backgroundColor = surfaceFrameBuffer->GetBackgroundColor();
index 81561ba..80da02e 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_CONTEXT_H__
 
 /*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -130,6 +130,14 @@ public:
    ****************************************************************************************/
 
   /**
+   * Wrapper for ConvertTexture of Dali::Integration::GlAbstraction
+   */
+  void ConvertTexture( uint8_t* buffer, GLenum& imageGlFormat, const uint32_t dataSize, const GLenum textureGlFormat, const bool isSubImage )
+  {
+    return mGlAbstraction.ConvertTexture( buffer, imageGlFormat, dataSize, textureGlFormat, isSubImage );
+  }
+
+  /**
    * Wrapper for OpenGL ES 2.0 glActiveTexture()
    */
   void ActiveTexture( TextureUnit textureUnit )
index 99fca0d..c993e67 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
@@ -766,9 +766,6 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal::
   //Get pointer to the data of the PixelData object
   uint8_t* buffer( pixelData->GetBuffer() );
 
-  //This buffer is only used if manually converting from RGB to RGBA
-  uint8_t* tempBuffer(0);
-
   //Retrieves the pixel data element type, the gl format and gl internal format of the data contained in the PixelData object.
   GLenum glFormat;
   GLint glInternalFormat;
@@ -784,27 +781,8 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal::
                             ( params.width  != ( mWidth  / ( 1 << params.mipmap ) ) ) ||
                             ( params.height != ( mHeight / ( 1 << params.mipmap ) ) ) );
 
-  bool convert = ( ( glFormat == GL_RGB ) && ( mGlFormat == GL_RGBA ) );
-#if DALI_GLES_VERSION >= 30
-  // Don't convert manually from RGB to RGBA if GLES >= 3.0 and a sub-image is uploaded.
-  convert = convert && !isSubImage;
-#endif
-
-  if( convert )
-  {
-    uint32_t dataSize = static_cast< uint32_t >( params.width ) * params.height;
-    tempBuffer = new uint8_t[dataSize*4u];
-    for( uint32_t i = 0u; i < dataSize; ++i )
-    {
-      tempBuffer[i*4u]   = buffer[i*3u];
-      tempBuffer[i*4u+1] = buffer[i*3u+1];
-      tempBuffer[i*4u+2] = buffer[i*3u+2];
-      tempBuffer[i*4u+3] = 0xFF;
-    }
-
-    buffer = tempBuffer;
-    glFormat = mGlFormat; // Set the glFormat to GL_RGBA
-  }
+  uint32_t dataSize = static_cast< uint32_t >( params.width ) * params.height;
+  context.ConvertTexture( buffer, glFormat, dataSize, mGlFormat, isSubImage );
 
   //Upload data to the texture
 
@@ -845,10 +823,6 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal::
                                        glFormat, static_cast<GLsizei>( pixelData->GetBufferSize() ), buffer );
     }
   }
-
-
-  //Destroy temp buffer used for conversion RGB->RGBA
-  delete[] tempBuffer;
 }
 
 bool Texture::Bind( Context& context, uint32_t textureUnit, Render::Sampler* sampler )
@@ -914,14 +888,10 @@ void Texture::ApplySampler( Context& context, Render::Sampler* sampler )
       }
     }
 
-#if DALI_GLES_VERSION >= 30
-    //In GLES 3.0 we do not need to upload all of the mipmap levels, but GL_TEXTURE_MAX_LEVEL must be set
     if(mMaxMipMapLevel)
     {
       context.TexParameteri( mTarget, GL_TEXTURE_MAX_LEVEL, mMaxMipMapLevel );
     }
-#endif
-
   }
 }
 
index cf06396..998e589 100644 (file)
@@ -124,9 +124,6 @@ DALI_DATA_RO_DIR="%{dali_data_ro_dir}"
 export DALI_DATA_RW_DIR
 export DALI_DATA_RO_DIR
 
-# Default to GLES 2.0 if not specified.
-%{!?target_gles_version: %define target_gles_version 20}
-
 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS;
 CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS;
 LDFLAGS="${LDFLAGS:-%optflags}" ; export LDFLAGS;
@@ -145,7 +142,6 @@ LDFLAGS="${LDFLAGS:-%optflags}" ; export LDFLAGS;
       --localstatedir=%{_localstatedir} \
       --sharedstatedir=%{_sharedstatedir} \
       --mandir=%{_mandir} \
-      --enable-gles=%{target_gles_version} \
 %if 0%{?enable_debug}
       --enable-debug \
 %endif
@@ -184,7 +180,6 @@ make clean
       --sharedstatedir=%{_sharedstatedir} \
       --mandir=%{_mandir} \
       --enable-cxx03-abi=yes  \
-      --enable-gles=%{target_gles_version} \
 %if 0%{?enable_debug}
       --enable-debug \
 %endif