[client] egl: fix streaming texture re-init crash

This commit is contained in:
Geoffrey McRae 2019-05-22 12:19:03 +10:00
parent 84b2917706
commit 86f4256b5a
2 changed files with 12 additions and 5 deletions

View File

@ -1 +1 @@
a12-206-gfc66a4a19c+1
a12-207-g84b2917706+1

View File

@ -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