Fix crash in GL_RED textures uploading.

This commit is contained in:
John Preston 2021-05-25 23:31:17 +04:00
parent 87cae1c3a7
commit e7ef3c4b6d

View file

@ -469,6 +469,7 @@ void Viewport::RendererGL::paintTile(
f.glActiveTexture(GL_TEXTURE0); f.glActiveTexture(GL_TEXTURE0);
textures.values.bind(f, textures.textureIndex * 3 + 0); textures.values.bind(f, textures.textureIndex * 3 + 0);
if (upload) { if (upload) {
f.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
uploadOne(GL_RED, GL_RED, yuv->size, yuv->y.stride, yuv->y.data); uploadOne(GL_RED, GL_RED, yuv->size, yuv->y.stride, yuv->y.data);
} }
f.glActiveTexture(GL_TEXTURE1); f.glActiveTexture(GL_TEXTURE1);
@ -480,6 +481,7 @@ void Viewport::RendererGL::paintTile(
textures.values.bind(f, textures.textureIndex * 3 + 2); textures.values.bind(f, textures.textureIndex * 3 + 2);
if (upload) { if (upload) {
uploadOne(GL_RED, GL_RED, otherSize, yuv->v.stride, yuv->v.data); uploadOne(GL_RED, GL_RED, otherSize, yuv->v.stride, yuv->v.data);
f.glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
} }
_yuv420Program->setUniformValue("y_texture", GLint(0)); _yuv420Program->setUniformValue("y_texture", GLint(0));
_yuv420Program->setUniformValue("u_texture", GLint(1)); _yuv420Program->setUniformValue("u_texture", GLint(1));