gpu_tonemapper: Use individual EGL contexts.
- Use individual EGL contexts for each tone-mapping
session.
- Having one context make multiple sessions serial, this
helps in making this parallel when possible.
- Resolves error messages which happened when the context
was deleted during mirroring.
Change-Id: Ia8738551b4189dccffb233320a9d69fcfd7f0118
Crs-fixed: 1115057
diff --git a/gpu_tonemapper/Tonemapper.cpp b/gpu_tonemapper/Tonemapper.cpp
index bb7ba1b..b4d82e1 100644
--- a/gpu_tonemapper/Tonemapper.cpp
+++ b/gpu_tonemapper/Tonemapper.cpp
@@ -39,7 +39,7 @@
Tonemapper::~Tonemapper()
//-----------------------------------------------------------------------------
{
- engine_bind();
+ engine_bind(engineContext);
engine_deleteInputBuffer(tonemapTexture);
engine_deleteInputBuffer(lutXformTexture);
engine_deleteProgram(programID);
@@ -50,6 +50,8 @@
delete eglImageWrapper;
eglImageWrapper = 0;
}
+
+ engine_shutdown(engineContext);
}
//-----------------------------------------------------------------------------
@@ -61,10 +63,14 @@
ALOGE("Invalid Color Map size = %d", colorMapSize);
return NULL;
}
- engine_bind();
// build new tonemapper
Tonemapper *tonemapper = new Tonemapper();
+
+ tonemapper->engineContext = engine_initialize();
+
+ engine_bind(tonemapper->engineContext);
+
// load the 3d lut
tonemapper->tonemapTexture = engine_load3DTexture(colorMap, colorMapSize, 0);
// load the non-uniform xform
@@ -101,7 +107,7 @@
//-----------------------------------------------------------------------------
{
// make current
- engine_bind();
+ engine_bind(engineContext);
// create eglimages if required
EGLImageBuffer *dst_buffer = eglImageWrapper->wrap(dst);