diff --git a/Telegram/SourceFiles/calls/calls_video_incoming.cpp b/Telegram/SourceFiles/calls/calls_video_incoming.cpp index 4edec9b2c..6e97dec8d 100644 --- a/Telegram/SourceFiles/calls/calls_video_incoming.cpp +++ b/Telegram/SourceFiles/calls/calls_video_incoming.cpp @@ -223,6 +223,7 @@ void Panel::Incoming::RendererGL::paint( Assert(data.format == Webrtc::FrameFormat::YUV420); Assert(!data.yuv420->size.isEmpty()); const auto yuv = data.yuv420; + const auto format = Ui::GL::CurrentSingleComponentFormat(); f.glActiveTexture(GL_TEXTURE0); _textures.bind(f, 1); @@ -230,8 +231,8 @@ void Panel::Incoming::RendererGL::paint( f.glPixelStorei(GL_UNPACK_ALIGNMENT, 1); uploadTexture( f, - GL_RED, - GL_RED, + format, + format, yuv->size, _lumaSize, yuv->y.stride, @@ -243,8 +244,8 @@ void Panel::Incoming::RendererGL::paint( if (upload) { uploadTexture( f, - GL_RED, - GL_RED, + format, + format, yuv->chromaSize, _chromaSize, yuv->u.stride, @@ -255,8 +256,8 @@ void Panel::Incoming::RendererGL::paint( if (upload) { uploadTexture( f, - GL_RED, - GL_RED, + format, + format, yuv->chromaSize, _chromaSize, yuv->v.stride, diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp b/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp index f2cf335ba..b75f7a199 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp @@ -988,6 +988,7 @@ void Viewport::RendererGL::bindFrame( program.argb32->setUniformValue("s_texture", GLint(0)); } else { const auto yuv = data.yuv420; + const auto format = Ui::GL::CurrentSingleComponentFormat(); program.yuv420->bind(); f.glActiveTexture(GL_TEXTURE0); tileData.textures.bind(f, 0); @@ -995,8 +996,8 @@ void Viewport::RendererGL::bindFrame( f.glPixelStorei(GL_UNPACK_ALIGNMENT, 1); uploadTexture( f, - GL_RED, - GL_RED, + format, + format, yuv->size, tileData.textureSize, yuv->y.stride, @@ -1009,8 +1010,8 @@ void Viewport::RendererGL::bindFrame( if (upload) { uploadTexture( f, - GL_RED, - GL_RED, + format, + format, yuv->chromaSize, tileData.textureChromaSize, yuv->u.stride, @@ -1021,8 +1022,8 @@ void Viewport::RendererGL::bindFrame( if (upload) { uploadTexture( f, - GL_RED, - GL_RED, + format, + format, yuv->chromaSize, tileData.textureChromaSize, yuv->v.stride, @@ -1368,16 +1369,17 @@ void Viewport::RendererGL::validateNoiseTexture( if (_noiseTexture.created()) { return; } + const auto format = Ui::GL::CurrentSingleComponentFormat(); _noiseTexture.ensureCreated(f, GL_NEAREST, GL_REPEAT); _noiseTexture.bind(f, 0); f.glTexImage2D( GL_TEXTURE_2D, 0, - GL_RED, + format, kNoiseTextureSize, kNoiseTextureSize, 0, - GL_RED, + format, GL_UNSIGNED_BYTE, nullptr); diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp index 07e18f5a4..e60740b63 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp @@ -193,6 +193,7 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame( const auto upload = (_trackFrameIndex != data.index) || (_streamedIndex != _owner->streamedIndex()); + const auto format = Ui::GL::CurrentSingleComponentFormat(); _trackFrameIndex = data.index; _streamedIndex = _owner->streamedIndex(); @@ -201,8 +202,8 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame( if (upload) { _f->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); uploadTexture( - GL_RED, - GL_RED, + format, + format, yuv->size, _lumaSize, yuv->y.stride, @@ -213,8 +214,8 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame( _textures.bind(*_f, 2); if (upload) { uploadTexture( - GL_RED, - GL_RED, + format, + format, yuv->chromaSize, _chromaSize, yuv->u.stride, @@ -224,8 +225,8 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame( _textures.bind(*_f, 3); if (upload) { uploadTexture( - GL_RED, - GL_RED, + format, + format, yuv->chromaSize, _chromaSize, yuv->v.stride, diff --git a/Telegram/SourceFiles/media/view/media_view_pip_opengl.cpp b/Telegram/SourceFiles/media/view/media_view_pip_opengl.cpp index 5925c435c..a04f32b60 100644 --- a/Telegram/SourceFiles/media/view/media_view_pip_opengl.cpp +++ b/Telegram/SourceFiles/media/view/media_view_pip_opengl.cpp @@ -297,13 +297,14 @@ void Pip::RendererGL::paintTransformedVideoFrame( const auto upload = (_trackFrameIndex != data.index); _trackFrameIndex = data.index; + const auto format = Ui::GL::CurrentSingleComponentFormat(); _f->glActiveTexture(GL_TEXTURE0); _textures.bind(*_f, 1); if (upload) { _f->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); uploadTexture( - GL_RED, - GL_RED, + format, + format, yuv->size, _lumaSize, yuv->y.stride, @@ -314,8 +315,8 @@ void Pip::RendererGL::paintTransformedVideoFrame( _textures.bind(*_f, 2); if (upload) { uploadTexture( - GL_RED, - GL_RED, + format, + format, yuv->chromaSize, _chromaSize, yuv->u.stride, @@ -325,8 +326,8 @@ void Pip::RendererGL::paintTransformedVideoFrame( _textures.bind(*_f, 3); if (upload) { uploadTexture( - GL_RED, - GL_RED, + format, + format, yuv->chromaSize, _chromaSize, yuv->v.stride, diff --git a/Telegram/lib_ui b/Telegram/lib_ui index e73e1a6c0..9255d7103 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit e73e1a6c0f2a24272184c81acadf1d4249eae286 +Subproject commit 9255d7103857395e91c2e546edbf8eaed86da4ca