Added recycling of Graphics resources. 89/290289/5
authorAdam Bialogonski <adam.b@samsung.com>
Wed, 22 Mar 2023 15:26:42 +0000 (15:26 +0000)
committerAdam Bialogonski <adam.b@samsung.com>
Tue, 9 May 2023 11:06:45 +0000 (12:06 +0100)
commit5522a0d106aca1e80fdda71d7fdda58017510eb5
treecbadebaa064f785f0fe7881e808a53116b29f964
parent2f76afeddcd0a3eee9d6a9945599b129d2033ab6
Added recycling of Graphics resources.

When any Controller::Create...(...) function is being called, the last arguments takes a pointer to the old object. Originally, the implementation was supposed to use that object in order to recycle it (when possible). That code has never been implemented. This patch adds TryRecycle() method to the Graphics::Resource<> class and calls TryRecycle() if a valid pointer is being passed to the NewObject(). If TryRecycle() returns false (object couldn't be recycled) then original path is taken and new object is created (old is discarded). Otherwise, the object implementation should handle recycling.

The GLES graphics buffer is recycled when:
- The new spec (create info) matches old spec
- There is valid GPU/CPU storage already allocated

For a GPU-allocated buffer, the orphaning takes place. For CPU-allocated buffer, nothing changes.

Change-Id: I5969161c1004b2f0728b5dc9323e6caa88fab84b
automated-tests/src/dali-graphics/CMakeLists.txt
automated-tests/src/dali-graphics/utc-Dali-GraphicsBuffer.cpp [new file with mode: 0644]
dali/internal/graphics/gles-impl/egl-graphics-controller.cpp
dali/internal/graphics/gles-impl/egl-graphics-controller.h
dali/internal/graphics/gles-impl/gles-graphics-buffer.cpp
dali/internal/graphics/gles-impl/gles-graphics-buffer.h
dali/internal/graphics/gles-impl/gles-graphics-resource.h