#include <dali/integration-api/gl-defines.h>
// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/graphics-interface.h>
#include "egl-graphics-controller.h"
#include "gles-graphics-buffer.h"
auto buffer = static_cast<GLES::Buffer*>(mMapBufferInfo.buffer);
if(buffer->IsCPUAllocated())
{
- using Ptr = char*;
- mMappedPointer = Ptr(buffer->GetCPUAllocatedAddress()) + offset;
+ using Ptr = char*;
+ mMappedPointer = Ptr(buffer->GetCPUAllocatedAddress()) + offset;
mIsAllocatedLocally = false;
}
else
{
- auto retval = malloc(size);
- mMappedPointer = retval;
+ auto retval = malloc(size);
+ mMappedPointer = retval;
mIsAllocatedLocally = true;
}
}
auto gl = mController.GetGL();
// for buffer...
- if(mMapObjectType == MapObjectType::BUFFER&& mMappedPointer)
+ if(mMapObjectType == MapObjectType::BUFFER && mMappedPointer)
{
auto buffer = static_cast<GLES::Buffer*>(mMapBufferInfo.buffer);
if(!buffer->IsCPUAllocated())
{
+ // switch to the shared context if necessary
+ auto graphics = mController.GetGraphicsInterface();
+ graphics->ActivateResourceContext();
+
buffer->Bind(BufferUsage::VERTEX_BUFFER);
gl->BufferSubData(GL_ARRAY_BUFFER, mMapBufferInfo.offset, mMapBufferInfo.size, mMappedPointer);
}