[Tizen] Fix SVACE issue at gles2-graphics-memory
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles-impl / gles3-graphics-memory.cpp
index 7085276..102d5e1 100644 (file)
@@ -23,6 +23,7 @@
 #include <dali/integration-api/gl-defines.h>
 
 // INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-interface.h>
 #include "egl-graphics-controller.h"
 
 namespace Dali::Graphics::GLES
@@ -56,15 +57,15 @@ void* Memory3::LockRegion(uint32_t offset, uint32_t size)
 
     if(buffer->IsCPUAllocated())
     {
-      using Ptr = char*;
-      return Ptr(buffer->GetCPUAllocatedAddress()) + offset;
+      using Ptr      = char*;
+      mMappedPointer = Ptr(buffer->GetCPUAllocatedAddress()) + offset;
     }
     else
     {
       // @TODO: trashing vertex binding, better find target that is rarely used
       buffer->Bind(Graphics::BufferUsage::VERTEX_BUFFER);
       void* ptr      = nullptr;
-      ptr            = gl->MapBufferRange(GL_ARRAY_BUFFER, mMapBufferInfo.offset, mMapBufferInfo.size, GL_MAP_WRITE_BIT);
+      ptr            = gl->MapBufferRange(GL_ARRAY_BUFFER, GLintptr(mMapBufferInfo.offset), GLsizeiptr(mMapBufferInfo.size), GL_MAP_WRITE_BIT);
       mMappedPointer = ptr;
     }
     return mMappedPointer;
@@ -91,6 +92,8 @@ void Memory3::Unlock(bool flush)
   {
     Flush();
   }
+
+  mMappedPointer = nullptr;
 }
 
 void Memory3::Flush()
@@ -98,4 +101,4 @@ void Memory3::Flush()
   // TODO:
 }
 
-} // namespace Dali::Graphics::GLES
\ No newline at end of file
+} // namespace Dali::Graphics::GLES