Fix YUV->RGB on D3D9 ANGLE backend.

This commit is contained in:
John Preston 2021-06-30 12:15:46 +03:00
parent bd93aed393
commit 6cea7d4a52
5 changed files with 32 additions and 27 deletions

View file

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

View file

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

View file

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

View file

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

@ -1 +1 @@
Subproject commit e73e1a6c0f2a24272184c81acadf1d4249eae286
Subproject commit 9255d7103857395e91c2e546edbf8eaed86da4ca