From ecd65f980183df6d313ff68783c535446acb4679 Mon Sep 17 00:00:00 2001 From: "Seungho, Baek" Date: Mon, 18 Mar 2019 15:11:08 +0900 Subject: [PATCH] Remove DALI_GLES_VERSION compile option - Remove compile option DALI_GLES_VERSION - Define whether the texture format is converted in the dali-adaptor Change-Id: I9919fd4adf03e554e1d72b6bdf6d1a50ca43ea77 Signed-off-by: Seungho, Baek --- .travis.yml | 2 +- README.md | 15 -------------- .../dali-test-suite-utils/test-gl-abstraction.cpp | 12 ++++++++++- .../dali-test-suite-utils/test-gl-abstraction.h | 6 +++++- build/tizen-cmake/CMakeLists.txt | 2 -- build/tizen/configure.ac | 9 -------- dali/integration-api/gl-abstraction.h | 17 ++++++++++++++- dali/internal/render/common/render-manager.cpp | 17 +++++++-------- dali/internal/render/gl-resources/context.h | 18 +++++++++++++++- dali/internal/render/renderers/render-texture.cpp | 24 +++++----------------- packaging/dali.spec | 5 ----- 11 files changed, 64 insertions(+), 63 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9fcfc79..04f43d6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/README.md b/README.md index 98db879..b374d3a 100644 --- 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. diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.cpp index 02439bc..8372e03 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.cpp @@ -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,16 @@ void TestGlAbstraction::PostRender() { } +bool TestGlAbstraction::IsSurfacelessContextSupported() const +{ + return true; +} + +bool TestGlAbstraction::TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const +{ + return ( ( imageGlFormat == GL_RGB ) && ( textureGlFormat == GL_RGBA ) ); +} + } // Namespace dali bool BlendEnabled(const Dali::TraceCallStack& callStack) diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h b/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h index c68573b..6572dbc 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-gl-abstraction.h @@ -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,10 @@ public: void PreRender(); void PostRender(); + bool IsSurfacelessContextSupported() const; + + bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const; + /* OpenGL ES 2.0 */ inline void ActiveTexture( GLenum textureUnit ) diff --git a/build/tizen-cmake/CMakeLists.txt b/build/tizen-cmake/CMakeLists.txt index 408f967..c25032d 100644 --- a/build/tizen-cmake/CMakeLists.txt +++ b/build/tizen-cmake/CMakeLists.txt @@ -21,7 +21,6 @@ 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 @@ -33,7 +32,6 @@ ELSE() ENDIF() ADD_DEFINITIONS(-DPLATFORM_TIZEN -DDALI_COMPILATION) -ADD_DEFINITIONS(-DDALI_GLES_VERSION=${GLES_VERSION}) ADD_DEFINITIONS(-DPIC -DSTDC_HEADERS) IF("${ARCH}" STREQUAL "arm") diff --git a/build/tizen/configure.ac b/build/tizen/configure.ac index 75b5615..4082251 100644 --- a/build/tizen/configure.ac +++ b/build/tizen/configure.ac @@ -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 " diff --git a/dali/integration-api/gl-abstraction.h b/dali/integration-api/gl-abstraction.h index a5d81f3..98df443 100644 --- a/dali/integration-api/gl-abstraction.h +++ b/dali/integration-api/gl-abstraction.h @@ -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,21 @@ public: virtual void PostRender() = 0; /** + * Returns current gles can support surfaceless context + * @Return true current gles support surfaceless context + */ + virtual bool IsSurfacelessContextSupported() const = 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 bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const = 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; diff --git a/dali/internal/render/common/render-manager.cpp b/dali/internal/render/common/render-manager.cpp index 2d4d9e8..d0bdd0d 100644 --- a/dali/internal/render/common/render-manager.cpp +++ b/dali/internal/render/common/render-manager.cpp @@ -561,16 +561,17 @@ void RenderManager::DoRender( RenderInstruction& instruction ) { surfaceFrameBuffer = static_cast( instruction.mFrameBuffer ); -#if DALI_GLES_VERSION >= 30 - Context* surfaceContext = surfaceFrameBuffer->GetContext(); - if ( mImpl->currentContext != surfaceContext ) + if ( mImpl->currentContext->IsSurfacelessContextSupported() ) { - // Switch the correct context if rendering to a surface - mImpl->currentContext = surfaceContext; - // Clear the current cached program when the context is switched - mImpl->programController.ClearCurrentProgram(); + Context* surfaceContext = surfaceFrameBuffer->GetContext(); + if ( mImpl->currentContext != surfaceContext ) + { + // Switch the correct context if rendering to a surface + mImpl->currentContext = surfaceContext; + // Clear the current cached program when the context is switched + mImpl->programController.ClearCurrentProgram(); + } } -#endif surfaceRect = Rect( 0, 0, static_cast( surfaceFrameBuffer->GetWidth() ), static_cast( surfaceFrameBuffer->GetHeight() ) ); backgroundColor = surfaceFrameBuffer->GetBackgroundColor(); diff --git a/dali/internal/render/gl-resources/context.h b/dali/internal/render/gl-resources/context.h index e758632..a9ad4a2 100644 --- a/dali/internal/render/gl-resources/context.h +++ b/dali/internal/render/gl-resources/context.h @@ -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,22 @@ public: ****************************************************************************************/ /** + * Wrapper for IsSurfacelessContextSupported of Dali::Integration::GlAbstraction + */ + bool IsSurfacelessContextSupported() const + { + return mGlAbstraction.IsSurfacelessContextSupported(); + } + + /** + * Wrapper for TextureRequiresConverting of Dali::Integration::GlAbstraction + */ + bool TextureRequiresConverting( const GLenum imageGlFormat, const GLenum textureGlFormat, const bool isSubImage ) const + { + return mGlAbstraction.TextureRequiresConverting( imageGlFormat, textureGlFormat, isSubImage ); + } + + /** * Wrapper for OpenGL ES 2.0 glActiveTexture() */ void ActiveTexture( TextureUnit textureUnit ) diff --git a/dali/internal/render/renderers/render-texture.cpp b/dali/internal/render/renderers/render-texture.cpp index 99fca0d..d26f00d 100644 --- a/dali/internal/render/renderers/render-texture.cpp +++ b/dali/internal/render/renderers/render-texture.cpp @@ -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. @@ -767,7 +767,7 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal:: uint8_t* buffer( pixelData->GetBuffer() ); //This buffer is only used if manually converting from RGB to RGBA - uint8_t* tempBuffer(0); + std::vector< uint8_t > tempBuffer; //Retrieves the pixel data element type, the gl format and gl internal format of the data contained in the PixelData object. GLenum glFormat; @@ -784,16 +784,10 @@ 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 ) + if( context.TextureRequiresConverting( glFormat, mGlFormat, isSubImage ) ) { uint32_t dataSize = static_cast< uint32_t >( params.width ) * params.height; - tempBuffer = new uint8_t[dataSize*4u]; + tempBuffer.reserve( dataSize * 4u ); for( uint32_t i = 0u; i < dataSize; ++i ) { tempBuffer[i*4u] = buffer[i*3u]; @@ -802,7 +796,7 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal:: tempBuffer[i*4u+3] = 0xFF; } - buffer = tempBuffer; + buffer = &tempBuffer[0]; glFormat = mGlFormat; // Set the glFormat to GL_RGBA } @@ -845,10 +839,6 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal:: glFormat, static_cast( 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 +904,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 - } } diff --git a/packaging/dali.spec b/packaging/dali.spec index b96a606..ea37646 100644 --- a/packaging/dali.spec +++ b/packaging/dali.spec @@ -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 -- 2.7.4