mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Don't use CurrentSingleComponentFormat.
Fix noise in voice chat blur in OpenGL ES (ANGLE).
This commit is contained in:
parent
92d9ebc9f3
commit
c0f8e68f5d
5 changed files with 42 additions and 33 deletions
|
@ -223,7 +223,6 @@ void Panel::Incoming::RendererGL::paint(
|
||||||
Assert(data.format == Webrtc::FrameFormat::YUV420);
|
Assert(data.format == Webrtc::FrameFormat::YUV420);
|
||||||
Assert(!data.yuv420->size.isEmpty());
|
Assert(!data.yuv420->size.isEmpty());
|
||||||
const auto yuv = data.yuv420;
|
const auto yuv = data.yuv420;
|
||||||
const auto format = Ui::GL::CurrentSingleComponentFormat();
|
|
||||||
|
|
||||||
f.glActiveTexture(GL_TEXTURE0);
|
f.glActiveTexture(GL_TEXTURE0);
|
||||||
_textures.bind(f, 1);
|
_textures.bind(f, 1);
|
||||||
|
@ -231,8 +230,8 @@ void Panel::Incoming::RendererGL::paint(
|
||||||
f.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
f.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
f,
|
f,
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->size,
|
yuv->size,
|
||||||
_lumaSize,
|
_lumaSize,
|
||||||
yuv->y.stride,
|
yuv->y.stride,
|
||||||
|
@ -244,8 +243,8 @@ void Panel::Incoming::RendererGL::paint(
|
||||||
if (upload) {
|
if (upload) {
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
f,
|
f,
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->chromaSize,
|
yuv->chromaSize,
|
||||||
_chromaSize,
|
_chromaSize,
|
||||||
yuv->u.stride,
|
yuv->u.stride,
|
||||||
|
@ -256,8 +255,8 @@ void Panel::Incoming::RendererGL::paint(
|
||||||
if (upload) {
|
if (upload) {
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
f,
|
f,
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->chromaSize,
|
yuv->chromaSize,
|
||||||
_chromaSize,
|
_chromaSize,
|
||||||
yuv->v.stride,
|
yuv->v.stride,
|
||||||
|
|
|
@ -985,7 +985,6 @@ void Viewport::RendererGL::bindFrame(
|
||||||
program.argb32->setUniformValue("s_texture", GLint(0));
|
program.argb32->setUniformValue("s_texture", GLint(0));
|
||||||
} else {
|
} else {
|
||||||
const auto yuv = data.yuv420;
|
const auto yuv = data.yuv420;
|
||||||
const auto format = Ui::GL::CurrentSingleComponentFormat();
|
|
||||||
program.yuv420->bind();
|
program.yuv420->bind();
|
||||||
f.glActiveTexture(GL_TEXTURE0);
|
f.glActiveTexture(GL_TEXTURE0);
|
||||||
tileData.textures.bind(f, 0);
|
tileData.textures.bind(f, 0);
|
||||||
|
@ -993,8 +992,8 @@ void Viewport::RendererGL::bindFrame(
|
||||||
f.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
f.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
f,
|
f,
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->size,
|
yuv->size,
|
||||||
tileData.textureSize,
|
tileData.textureSize,
|
||||||
yuv->y.stride,
|
yuv->y.stride,
|
||||||
|
@ -1007,8 +1006,8 @@ void Viewport::RendererGL::bindFrame(
|
||||||
if (upload) {
|
if (upload) {
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
f,
|
f,
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->chromaSize,
|
yuv->chromaSize,
|
||||||
tileData.textureChromaSize,
|
tileData.textureChromaSize,
|
||||||
yuv->u.stride,
|
yuv->u.stride,
|
||||||
|
@ -1019,8 +1018,8 @@ void Viewport::RendererGL::bindFrame(
|
||||||
if (upload) {
|
if (upload) {
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
f,
|
f,
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->chromaSize,
|
yuv->chromaSize,
|
||||||
tileData.textureChromaSize,
|
tileData.textureChromaSize,
|
||||||
yuv->v.stride,
|
yuv->v.stride,
|
||||||
|
@ -1365,19 +1364,33 @@ void Viewport::RendererGL::validateNoiseTexture(
|
||||||
if (_noiseTexture.created()) {
|
if (_noiseTexture.created()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto format = Ui::GL::CurrentSingleComponentFormat();
|
|
||||||
_noiseTexture.ensureCreated(f, GL_NEAREST, GL_REPEAT);
|
_noiseTexture.ensureCreated(f, GL_NEAREST, GL_REPEAT);
|
||||||
_noiseTexture.bind(f, 0);
|
_noiseTexture.bind(f, 0);
|
||||||
|
|
||||||
|
// Rendering to GL_ALPHA is not supported.
|
||||||
f.glTexImage2D(
|
f.glTexImage2D(
|
||||||
GL_TEXTURE_2D,
|
GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
format,
|
GL_R8,
|
||||||
kNoiseTextureSize,
|
kNoiseTextureSize,
|
||||||
kNoiseTextureSize,
|
kNoiseTextureSize,
|
||||||
0,
|
0,
|
||||||
format,
|
GL_RED,
|
||||||
GL_UNSIGNED_BYTE,
|
GL_UNSIGNED_BYTE,
|
||||||
nullptr);
|
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.ensureCreated(f);
|
||||||
_noiseFramebuffer.bind(f, 0);
|
_noiseFramebuffer.bind(f, 0);
|
||||||
|
@ -1459,5 +1472,4 @@ void Viewport::RendererGL::validatePausedAnimation(
|
||||||
st::fadeWrapDuration);
|
st::fadeWrapDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace Calls::Group
|
} // namespace Calls::Group
|
||||||
|
|
|
@ -193,7 +193,6 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame(
|
||||||
|
|
||||||
const auto upload = (_trackFrameIndex != data.index)
|
const auto upload = (_trackFrameIndex != data.index)
|
||||||
|| (_streamedIndex != _owner->streamedIndex());
|
|| (_streamedIndex != _owner->streamedIndex());
|
||||||
const auto format = Ui::GL::CurrentSingleComponentFormat();
|
|
||||||
_trackFrameIndex = data.index;
|
_trackFrameIndex = data.index;
|
||||||
_streamedIndex = _owner->streamedIndex();
|
_streamedIndex = _owner->streamedIndex();
|
||||||
|
|
||||||
|
@ -202,8 +201,8 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame(
|
||||||
if (upload) {
|
if (upload) {
|
||||||
_f->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
_f->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->size,
|
yuv->size,
|
||||||
_lumaSize,
|
_lumaSize,
|
||||||
yuv->y.stride,
|
yuv->y.stride,
|
||||||
|
@ -214,8 +213,8 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame(
|
||||||
_textures.bind(*_f, 2);
|
_textures.bind(*_f, 2);
|
||||||
if (upload) {
|
if (upload) {
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->chromaSize,
|
yuv->chromaSize,
|
||||||
_chromaSize,
|
_chromaSize,
|
||||||
yuv->u.stride,
|
yuv->u.stride,
|
||||||
|
@ -225,8 +224,8 @@ void OverlayWidget::RendererGL::paintTransformedVideoFrame(
|
||||||
_textures.bind(*_f, 3);
|
_textures.bind(*_f, 3);
|
||||||
if (upload) {
|
if (upload) {
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->chromaSize,
|
yuv->chromaSize,
|
||||||
_chromaSize,
|
_chromaSize,
|
||||||
yuv->v.stride,
|
yuv->v.stride,
|
||||||
|
|
|
@ -297,14 +297,13 @@ void Pip::RendererGL::paintTransformedVideoFrame(
|
||||||
const auto upload = (_trackFrameIndex != data.index);
|
const auto upload = (_trackFrameIndex != data.index);
|
||||||
_trackFrameIndex = data.index;
|
_trackFrameIndex = data.index;
|
||||||
|
|
||||||
const auto format = Ui::GL::CurrentSingleComponentFormat();
|
|
||||||
_f->glActiveTexture(GL_TEXTURE0);
|
_f->glActiveTexture(GL_TEXTURE0);
|
||||||
_textures.bind(*_f, 1);
|
_textures.bind(*_f, 1);
|
||||||
if (upload) {
|
if (upload) {
|
||||||
_f->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
_f->glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->size,
|
yuv->size,
|
||||||
_lumaSize,
|
_lumaSize,
|
||||||
yuv->y.stride,
|
yuv->y.stride,
|
||||||
|
@ -315,8 +314,8 @@ void Pip::RendererGL::paintTransformedVideoFrame(
|
||||||
_textures.bind(*_f, 2);
|
_textures.bind(*_f, 2);
|
||||||
if (upload) {
|
if (upload) {
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->chromaSize,
|
yuv->chromaSize,
|
||||||
_chromaSize,
|
_chromaSize,
|
||||||
yuv->u.stride,
|
yuv->u.stride,
|
||||||
|
@ -326,8 +325,8 @@ void Pip::RendererGL::paintTransformedVideoFrame(
|
||||||
_textures.bind(*_f, 3);
|
_textures.bind(*_f, 3);
|
||||||
if (upload) {
|
if (upload) {
|
||||||
uploadTexture(
|
uploadTexture(
|
||||||
format,
|
GL_ALPHA,
|
||||||
format,
|
GL_ALPHA,
|
||||||
yuv->chromaSize,
|
yuv->chromaSize,
|
||||||
_chromaSize,
|
_chromaSize,
|
||||||
yuv->v.stride,
|
yuv->v.stride,
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit e68f76e6ab9457652d6de0712120695d2fbb81b8
|
Subproject commit 2439235e429263a5c8fe8e65b4a3a32455128443
|
Loading…
Add table
Reference in a new issue