I'm getting some GPU errors when testing my code on a different device on Android.
I have two surfaces, one my main surface and my second surface for backend drawing. These two surfaces share the same context and are called from the same thread as you would expect.
This is in a simplified level how my code works:
--------
-------- Drawing into surface 2
Canvas c = s2.getCanvas();
c.drawCircle(..);
c.flush();
-------- Adding current surface2 drawings into current drawing state image
SkImage image = s2.newImageSnapshot();
Canvas c = s2.getCanvas();
c.drawImage(currentState, 0, 0, NULL);
c.drawImage(image, 0, 0, NULL);
c.flush();
image.unref();
currentState = s2.newImageSnapshot();
Canvas c = s2.getCanvas();
c.clear(TRANSPARENT);
c.flush();
-------- Finally drawing into surface
Canvas c = s1.getCanvas();
c.drawImage(currentState, 0, 0, NULL);
SkImage image = s2.newImageSnapshot();
c.drawImage(image, 0, 0, NULL);
image.unref();
c.flush();
context.flush();
--------
Android Logs
09-18 15:00:45.431 14781-14886/com.vblast.smasher D/skia﹕ ---- glGetError 0x502(Invalid Operation)
09-18 15:00:45.431 14781-14886/com.vblast.smasher D/skia﹕ at
../../../../src/gpu/gl/GrGLGpu.cpp(2995) :
09-18 15:00:45.431 14781-14886/com.vblast.smasher D/skia﹕ UseProgram(fCopyProgram.fProgram)
09-18 15:00:45.431 14781-14886/com.vblast.smasher D/skia﹕ [ 09-18 15:00:45.431 14781:14886 D/skia ]
---- glGetError 0x502(Invalid Operation)
09-18 15:00:45.431 14781-14886/com.vblast.smasher D/skia﹕ at
../../../../src/gpu/gl/GrGLGpu.cpp(3031) :
09-18 15:00:45.431 14781-14886/com.vblast.smasher D/skia﹕ Uniform4f(fCopyProgram.fTexCoordXformUniform, sx1 - sx0, sy1 - sy0, sx0, sy0)
09-18 15:00:45.431 14781-14886/com.vblast.smasher D/skia﹕ [ 09-18 15:00:45.451 5470: 5470 D/ConnectivityManager ]
getMobileDataEnabled()+ subId=2