Don't use CurrentSingleComponentFormat.

Fix noise in voice chat blur in OpenGL ES (ANGLE).
This commit is contained in:
John Preston 2021-07-22 13:53:13 +03:00
parent 92d9ebc9f3
commit c0f8e68f5d
5 changed files with 42 additions and 33 deletions

View file

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

View file

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

View file

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

View file

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

@ -1 +1 @@
Subproject commit e68f76e6ab9457652d6de0712120695d2fbb81b8
Subproject commit 2439235e429263a5c8fe8e65b4a3a32455128443