/*
- * Copyright (c) 2016 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.
mPixelDataType(GL_UNSIGNED_BYTE),
mWidth( width ),
mHeight( height ),
+ mMaxMipMapLevel(0),
mHasAlpha( HasAlpha( format ) ),
mIsCompressed( IsCompressedFormat( format ) )
{
mPixelDataType(GL_UNSIGNED_BYTE),
mWidth( nativeImageInterface->GetWidth() ),
mHeight( nativeImageInterface->GetHeight() ),
+ mMaxMipMapLevel(0),
mHasAlpha( nativeImageInterface->RequiresBlending() ),
mIsCompressed( false )
{
GLenum pixelDataFormat, pixelDataElementType;
PixelFormatToGl( pixelData->GetPixelFormat(), pixelDataElementType, pixelDataFormat );
+ //Get the maximum mipmap level to set GL_TEXTURE_MAX_LEVEL parameter in GLES3x because is not
+ //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 )
{
context.TexParameteri( mTarget, GL_TEXTURE_WRAP_R, mode );
}
}
+
+#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
+
}
}
void Texture::GenerateMipmaps( Context& context )
{
+ //GL_TEXTURE_MAX_LEVEL does not need to be set when mipmaps are generated by GL
+ mMaxMipMapLevel = 0;
context.BindTexture( mTarget, mId );
context.GenerateMipmap( mTarget );
}
#define DALI_INTERNAL_RENDER_TEXTURE_H
/*
- * Copyright (c) 2016 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.
GLenum mPixelDataType; ///< The data type of the pixel data
unsigned int mWidth; ///< Width of the texture
unsigned int mHeight; ///< Height of the texture
+ unsigned int mMaxMipMapLevel; ///< Maximum mipmap level
bool mHasAlpha : 1; ///< Whether the format has an alpha channel
bool mIsCompressed : 1; ///< Whether the format is compressed
};