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