- autoreconf --install
- export CXXFLAGS="--coverage "
- export LD_LIBRARY_PATH=/usr/local/lib
- - ./configure --enable-profile=UBUNTU --enable-debug
+ - ./configure --enable-profile=UBUNTU --enable-gles=20 --enable-debug
- make -j7
- sudo make install
- popd
$ ./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.
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
{
}
-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)
#define TEST_GL_ABSTRACTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
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 )
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")
[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])],
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
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
"
#define __DALI_INTEGRATION_GL_ABSTRACTION_H__
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2014 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.
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;
{
surfaceFrameBuffer = static_cast<Render::SurfaceFrameBuffer*>( instruction.mFrameBuffer );
- // For the Multi-Windows
+#if DALI_GLES_VERSION >= 30
Context* surfaceContext = surfaceFrameBuffer->GetContext();
if ( mImpl->currentContext != surfaceContext )
{
// 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();
#define __DALI_INTERNAL_CONTEXT_H__
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
****************************************************************************************/
/**
- * 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 )
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
//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;
( params.width != ( mWidth / ( 1 << params.mipmap ) ) ) ||
( params.height != ( mHeight / ( 1 << params.mipmap ) ) ) );
- uint32_t dataSize = static_cast< uint32_t >( params.width ) * params.height;
- context.ConvertTexture( buffer, glFormat, dataSize, mGlFormat, isSubImage );
+ 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
+ }
//Upload data to the texture
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 )
}
}
+#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
+
}
}
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;
--localstatedir=%{_localstatedir} \
--sharedstatedir=%{_sharedstatedir} \
--mandir=%{_mandir} \
+ --enable-gles=%{target_gles_version} \
%if 0%{?enable_debug}
--enable-debug \
%endif
--sharedstatedir=%{_sharedstatedir} \
--mandir=%{_mandir} \
--enable-cxx03-abi=yes \
+ --enable-gles=%{target_gles_version} \
%if 0%{?enable_debug}
--enable-debug \
%endif