From 86f4256b5a72266ac7e9ba000197747babbd479f Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Wed, 22 May 2019 12:19:03 +1000 Subject: [PATCH] [client] egl: fix streaming texture re-init crash --- VERSION | 2 +- client/renderers/EGL/texture.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index b929b20f..f0912545 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -a12-206-gfc66a4a19c+1 \ No newline at end of file +a12-207-g84b2917706+1 \ No newline at end of file diff --git a/client/renderers/EGL/texture.c b/client/renderers/EGL/texture.c index 1f5e795f..643857fc 100644 --- a/client/renderers/EGL/texture.c +++ b/client/renderers/EGL/texture.c @@ -189,19 +189,26 @@ bool egl_texture_setup(EGL_Texture * texture, enum EGL_PixelFormat pixFmt, size_ if (streaming) { - if (!texture->hasPBO) + if (texture->hasPBO) { - glGenBuffers(2, texture->pbo); - texture->hasPBO = true; + // release old PBOs and delete the buffers + for(int i = 0; i < 2; ++i) + { + glBindBuffer(GL_PIXEL_UNPACK_BUFFER, texture->pbo[i]); + glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER); + } + glDeleteBuffers(2, texture->pbo); } + glGenBuffers(2, texture->pbo); + texture->hasPBO = true; for(int i = 0; i < 2; ++i) { glBindBuffer(GL_PIXEL_UNPACK_BUFFER, texture->pbo[i]); glBufferStorage( GL_PIXEL_UNPACK_BUFFER, texture->pboBufferSize, - 0, + NULL, GL_MAP_PERSISTENT_BIT | GL_MAP_WRITE_BIT | GL_MAP_COHERENT_BIT