From b3648d0147982bfde739bba7f95ccdbe439cd39f Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 8 Jun 2021 13:25:07 +0400 Subject: [PATCH] Use QOpenGLShaderProgram::bind. --- .../calls/group/calls_group_viewport_opengl.cpp | 10 +++++----- .../media/view/media_view_overlay_opengl.cpp | 10 +++++----- Telegram/lib_ui | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp b/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp index fae2729abf..9d7320dec6 100644 --- a/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp +++ b/Telegram/SourceFiles/calls/group/calls_group_viewport_opengl.cpp @@ -789,7 +789,7 @@ void Viewport::RendererGL::paintTile( f.glDisable(GL_BLEND); }); - f.glUseProgram(_imageProgram->programId()); + _imageProgram->bind(); _imageProgram->setUniformValue("viewport", uniformViewport); _imageProgram->setUniformValue("s_texture", GLint(0)); @@ -899,7 +899,7 @@ void Viewport::RendererGL::bindFrame( tileData.trackIndex = imageIndex; if (_rgbaFrame) { ensureARGB32Program(); - f.glUseProgram(program.argb32->programId()); + program.argb32->bind(); f.glActiveTexture(GL_TEXTURE0); tileData.textures.bind(f, 0); if (upload) { @@ -922,7 +922,7 @@ void Viewport::RendererGL::bindFrame( program.argb32->setUniformValue("s_texture", GLint(0)); } else { const auto yuv = data.yuv420; - f.glUseProgram(program.yuv420->programId()); + program.yuv420->bind(); f.glActiveTexture(GL_TEXTURE0); tileData.textures.bind(f, 0); if (upload) { @@ -1023,7 +1023,7 @@ void Viewport::RendererGL::drawFirstBlurPass( QSize blurSize) { tileData.framebuffers.bind(f, 1); - f.glUseProgram(_blurProgram->programId()); + _blurProgram->bind(); f.glActiveTexture(GL_TEXTURE0); tileData.textures.bind(f, kScaleForBlurTextureIndex); @@ -1330,7 +1330,7 @@ void Viewport::RendererGL::validateNoiseTexture( &program, VertexShader({}), FragmentShader({ FragmentGenerateNoise() })); - f.glUseProgram(program.programId()); + program.bind(); GLint position = program.attributeLocation("position"); f.glVertexAttribPointer( diff --git a/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp b/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp index 07b8c834b3..17286c0b2b 100644 --- a/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp +++ b/Telegram/SourceFiles/media/view/media_view_overlay_opengl.cpp @@ -209,7 +209,7 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame( Assert(data.format == Streaming::FrameFormat::YUV420); Assert(!data.yuv420->size.isEmpty()); const auto yuv = data.yuv420; - _f->glUseProgram(_yuv420Program->programId()); + _yuv420Program->bind(); const auto upload = (_trackFrameIndex != data.index) || (_streamedIndex != _owner->streamedIndex()); @@ -275,7 +275,7 @@ void OverlayWidget::RendererGL::paintTransformedStaticContent( auto &program = fillTransparentBackground ? _withTransparencyProgram : _imageProgram; - _f->glUseProgram(program->programId()); + program->bind(); if (fillTransparentBackground) { program->setUniformValue( "transparentBg", @@ -489,7 +489,7 @@ void OverlayWidget::RendererGL::paintControl( offset * 4 * sizeof(GLfloat), coords, sizeof(coords)); - _f->glUseProgram(_fillProgram->programId()); + _fillProgram->bind(); _fillProgram->setUniformValue("viewport", _uniformViewport); FillRectangle( *_f, @@ -502,7 +502,7 @@ void OverlayWidget::RendererGL::paintControl( coords + (fgOffset - offset) * 4, sizeof(coords) - (fgOffset - offset) * 4 * sizeof(GLfloat)); } - _f->glUseProgram(_controlsProgram->programId()); + _controlsProgram->bind(); _controlsProgram->setUniformValue("g_opacity", GLfloat(innerOpacity)); _controlsProgram->setUniformValue("viewport", _uniformViewport); FillTexturedRectangle(*_f, &*_controlsProgram, fgOffset); @@ -654,7 +654,7 @@ void OverlayWidget::RendererGL::paintUsingRaster( coords, sizeof(coords)); - _f->glUseProgram(_imageProgram->programId()); + _imageProgram->bind(); _imageProgram->setUniformValue("viewport", _uniformViewport); _imageProgram->setUniformValue("s_texture", GLint(0)); diff --git a/Telegram/lib_ui b/Telegram/lib_ui index 4ae6d31963..cbb65009ff 160000 --- a/Telegram/lib_ui +++ b/Telegram/lib_ui @@ -1 +1 @@ -Subproject commit 4ae6d319634be7aa3530ad3e934a187f630bd6fd +Subproject commit cbb65009ffc443bc88137f2758228c1b185d8d20