fix Android Vulkan instrumentation tests (#4091)
This commit is contained in:
@@ -196,11 +196,8 @@ void MapRenderer::requestSnapshot(SnapshotCallback callback) {
|
||||
|
||||
void MapRenderer::resetRenderer() {
|
||||
renderer.reset();
|
||||
#if MLN_RENDER_BACKEND_OPENGL
|
||||
// GL requires the context managed by the java surface for cleanup
|
||||
// Vulkan resources can be released on any thread (finalizer in this case)
|
||||
backend.reset();
|
||||
#endif
|
||||
window.reset();
|
||||
swapBehaviorFlush = false;
|
||||
}
|
||||
|
||||
@@ -316,7 +313,6 @@ void MapRenderer::onRendererReset(JNIEnv&) {
|
||||
// needs to be called on GL thread
|
||||
void MapRenderer::onSurfaceDestroyed(JNIEnv&) {
|
||||
resetRenderer();
|
||||
window.reset();
|
||||
}
|
||||
|
||||
void MapRenderer::setSwapBehaviorFlush(JNIEnv&, jboolean flush) {
|
||||
|
||||
@@ -85,7 +85,7 @@ abstract class TextureViewRenderThread extends Thread implements TextureView.Sur
|
||||
this.requestRender = false;
|
||||
lock.notifyAll();
|
||||
|
||||
while (this.hasNativeSurface) {
|
||||
while (this.hasNativeSurface && !this.exited) {
|
||||
try {
|
||||
lock.wait();
|
||||
} catch (InterruptedException ex) {
|
||||
|
||||
@@ -16,14 +16,12 @@ public class VulkanTextureViewRenderThread extends TextureViewRenderThread {
|
||||
}
|
||||
|
||||
void cleanup() {
|
||||
if (surface == null) {
|
||||
return;
|
||||
if (surface != null) {
|
||||
mapRenderer.onSurfaceDestroyed();
|
||||
surface.release();
|
||||
surface = null;
|
||||
}
|
||||
|
||||
mapRenderer.onSurfaceDestroyed();
|
||||
surface.release();
|
||||
surface = null;
|
||||
|
||||
hasNativeSurface = false;
|
||||
}
|
||||
|
||||
@@ -56,14 +54,17 @@ public class VulkanTextureViewRenderThread extends TextureViewRenderThread {
|
||||
}
|
||||
|
||||
if (this.destroySurface) {
|
||||
surface = null;
|
||||
destroySurface = true;
|
||||
if (surface != null) {
|
||||
surface.release();
|
||||
surface = null;
|
||||
}
|
||||
|
||||
this.destroySurface = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (surfaceTexture != null && !paused && requestRender
|
||||
&& (surface == null || this.sizeChanged)) {
|
||||
if (surfaceTexture != null && !paused && requestRender) {
|
||||
|
||||
w = width;
|
||||
h = height;
|
||||
@@ -87,10 +88,6 @@ public class VulkanTextureViewRenderThread extends TextureViewRenderThread {
|
||||
break;
|
||||
}
|
||||
|
||||
if (requestRender && !paused) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Wait until needed
|
||||
lock.wait();
|
||||
|
||||
@@ -113,11 +110,11 @@ public class VulkanTextureViewRenderThread extends TextureViewRenderThread {
|
||||
|
||||
if (destroySurface) {
|
||||
mapRenderer.onSurfaceDestroyed();
|
||||
destroySurface = false;
|
||||
synchronized (lock) {
|
||||
this.hasNativeSurface = false;
|
||||
lock.notifyAll();
|
||||
}
|
||||
destroySurface = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user