diff --git a/Telegram/SourceFiles/calls/calls_video_incoming.cpp b/Telegram/SourceFiles/calls/calls_video_incoming.cpp index 56cb34762..bfd3fe7e7 100644 --- a/Telegram/SourceFiles/calls/calls_video_incoming.cpp +++ b/Telegram/SourceFiles/calls/calls_video_incoming.cpp @@ -223,7 +223,6 @@ 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); @@ -231,8 +230,8 @@ void Panel::Incoming::RendererGL::paint( f.glPixelStorei(GL_UNPACK_ALIGNMENT, 1); uploadTexture( f, - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->size, _lumaSize, yuv->y.stride, @@ -244,8 +243,8 @@ void Panel::Incoming::RendererGL::paint( if (upload) { uploadTexture( f, - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->chromaSize, _chromaSize, yuv->u.stride, @@ -256,8 +255,8 @@ void Panel::Incoming::RendererGL::paint( if (upload) { uploadTexture( f, - format, - format, + GL_ALPHA, + GL_ALPHA, 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 cfc3b49e7..7ca3a5024 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp @@ -985,7 +985,6 @@ 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); @@ -993,8 +992,8 @@ void Viewport::RendererGL::bindFrame( f.glPixelStorei(GL_UNPACK_ALIGNMENT, 1); uploadTexture( f, - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->size, tileData.textureSize, yuv->y.stride, @@ -1007,8 +1006,8 @@ void Viewport::RendererGL::bindFrame( if (upload) { uploadTexture( f, - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->chromaSize, tileData.textureChromaSize, yuv->u.stride, @@ -1019,8 +1018,8 @@ void Viewport::RendererGL::bindFrame( if (upload) { uploadTexture( f, - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->chromaSize, tileData.textureChromaSize, yuv->v.stride, @@ -1365,19 +1364,33 @@ 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); + + // Rendering to GL_ALPHA is not supported. f.glTexImage2D( GL_TEXTURE_2D, 0, - format, + GL_R8, kNoiseTextureSize, kNoiseTextureSize, 0, - format, + GL_RED, GL_UNSIGNED_BYTE, nullptr); + if (f.glGetError() != GL_NO_ERROR) { + // Direct3D 9 doesn't support GL_R8 textures. + f.glTexImage2D( + GL_TEXTURE_2D, + 0, + GL_RGB, + kNoiseTextureSize, + kNoiseTextureSize, + 0, + GL_RGB, + GL_UNSIGNED_BYTE, + nullptr); + } _noiseFramebuffer.ensureCreated(f); _noiseFramebuffer.bind(f, 0); @@ -1459,5 +1472,4 @@ void Viewport::RendererGL::validatePausedAnimation( st::fadeWrapDuration); } - } // namespace Calls::Group diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp index 712c5b73e..fe46890fd 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp @@ -193,7 +193,6 @@ 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(); @@ -202,8 +201,8 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame( if (upload) { _f->glPixelStorei(GL_UNPACK_ALIGNMENT, 1); uploadTexture( - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->size, _lumaSize, yuv->y.stride, @@ -214,8 +213,8 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame( _textures.bind(*_f, 2); if (upload) { uploadTexture( - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->chromaSize, _chromaSize, yuv->u.stride, @@ -225,8 +224,8 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame( _textures.bind(*_f, 3); if (upload) { uploadTexture( - format, - format, + GL_ALPHA, + GL_ALPHA, 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 7abfbad69..92aa09061 100644 --- a/Telegram/SourceFiles/media/view/media_view_pip_opengl.cpp +++ b/Telegram/SourceFiles/media/view/media_view_pip_opengl.cpp @@ -297,14 +297,13 @@ 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( - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->size, _lumaSize, yuv->y.stride, @@ -315,8 +314,8 @@ void Pip::RendererGL::paintTransformedVideoFrame( _textures.bind(*_f, 2); if (upload) { uploadTexture( - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->chromaSize, _chromaSize, yuv->u.stride, @@ -326,8 +325,8 @@ void Pip::RendererGL::paintTransformedVideoFrame( _textures.bind(*_f, 3); if (upload) { uploadTexture( - format, - format, + GL_ALPHA, + GL_ALPHA, yuv->chromaSize, _chromaSize, yuv->v.stride, diff --git a/Telegram/lib_ui b/Telegram/lib_ui index e68f76e6a..2439235e4 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit e68f76e6ab9457652d6de0712120695d2fbb81b8 +Subproject commit 2439235e429263a5c8fe8e65b4a3a32455128443