From: Victor Cebollada Date: Fri, 9 Jun 2017 13:15:02 +0000 (+0100) Subject: Fix for texture Upload() X-Git-Tag: dali_1.2.44~6 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d14bd612ee9db26994645af497e310ba12a3e516;p=platform%2Fcore%2Fuifw%2Fdali-core.git Fix for texture Upload() * When a full texture is loaded in a GLES3.x context and the pixel data format is RGB and the internal format is RGBA, it needs to be converted to RGBA. Change-Id: Idcd3635d2d1bd378b9ffe96266c4fb8ced5e4087 Signed-off-by: Victor Cebollada --- diff --git a/dali/internal/render/renderers/render-texture.cpp b/dali/internal/render/renderers/render-texture.cpp index 39c07fa..191951c 100644 --- a/dali/internal/render/renderers/render-texture.cpp +++ b/dali/internal/render/renderers/render-texture.cpp @@ -737,10 +737,19 @@ void Texture::Upload( Context& context, PixelDataPtr pixelData, const Internal:: //necessary to upload all the mipmap levels mMaxMipMapLevel = ( mMaxMipMapLevel > params.mipmap ) ? mMaxMipMapLevel : params.mipmap; -#if DALI_GLES_VERSION < 30 - if( pixelDataFormat == GL_RGB && mInternalFormat == GL_RGBA ) + const bool isSubImage = ( ( params.xOffset != 0 ) || + ( params.yOffset != 0 ) || + ( params.width != ( mWidth / ( 1 << params.mipmap ) ) ) || + ( params.height != ( mHeight / ( 1 << params.mipmap ) ) ) ); + + bool convert = ( ( pixelDataFormat == GL_RGB ) && ( mInternalFormat == 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 ) { - //Convert manually from RGB to RGBA if GLES < 3 ( GLES 3 can do the conversion automatically when uploading ) size_t dataSize = static_cast< size_t >( params.width ) * params.height; tempBuffer = new unsigned char[dataSize*4u]; for( size_t i(0u); i