If we convert buffer CPU side, we might not release sourceBuffer memory.
To avoid this kind of memory leak, let we change the logic of glTexImage2D.
Change-Id: Ib1725c5ca8e6653dd1605311e4e021b09be2d387
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
auto sourceStride = info.srcStride;
std::vector<uint8_t> tempBuffer;
auto sourceStride = info.srcStride;
std::vector<uint8_t> tempBuffer;
+ uint8_t* srcBuffer = sourceBuffer;
+
if(mGlAbstraction->TextureRequiresConverting(srcFormat, destFormat, isSubImage))
{
// Convert RGB to RGBA if necessary.
if(texture->TryConvertPixelData(sourceBuffer, info.srcFormat, createInfo.format, info.srcSize, info.srcStride, info.srcExtent2D.width, info.srcExtent2D.height, tempBuffer))
{
if(mGlAbstraction->TextureRequiresConverting(srcFormat, destFormat, isSubImage))
{
// Convert RGB to RGBA if necessary.
if(texture->TryConvertPixelData(sourceBuffer, info.srcFormat, createInfo.format, info.srcSize, info.srcStride, info.srcExtent2D.width, info.srcExtent2D.height, tempBuffer))
{
- sourceBuffer = &tempBuffer[0];
+ srcBuffer = &tempBuffer[0];
sourceStride = 0u; // Converted buffer compacted. make stride as 0.
srcFormat = destFormat;
srcType = GLES::GLTextureFormatType(createInfo.format).type;
sourceStride = 0u; // Converted buffer compacted. make stride as 0.
srcFormat = destFormat;
srcType = GLES::GLTextureFormatType(createInfo.format).type;
info.srcExtent2D.height,
0,
info.srcSize,
info.srcExtent2D.height,
0,
info.srcSize,
info.srcExtent2D.height,
srcFormat,
srcType,
info.srcExtent2D.height,
srcFormat,
srcType,
info.srcExtent2D.height,
srcFormat,
info.srcSize,
info.srcExtent2D.height,
srcFormat,
info.srcSize,