From cbcf9a014e362fbc24154906f6b5983948d4a1ba Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Fri, 7 Aug 2015 15:37:54 -0400 Subject: [PATCH] Bug 1191527 - Fix the YCbCr shaders in BlitImageToFramebuffer. r=jgilbert --HG-- extra : rebase_source : a5360145d7ade0f0d5ed4137bb30f9b7f2eaca51 --- gfx/gl/GLBlitHelper.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gfx/gl/GLBlitHelper.cpp b/gfx/gl/GLBlitHelper.cpp index c72a1a34032d..73f35cdf96fa 100644 --- a/gfx/gl/GLBlitHelper.cpp +++ b/gfx/gl/GLBlitHelper.cpp @@ -278,7 +278,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target) */ const char kTexYUVPlanarBlit_FragShaderSource[] = "\ #ifdef GL_ES \n\ - precision mediump float \n\ + precision mediump float; \n\ #endif \n\ varying vec2 vTexCoord; \n\ uniform sampler2D uYTexture; \n\ @@ -288,9 +288,9 @@ GLBlitHelper::InitTexQuadProgram(BlitType target) uniform vec2 uCbCrTexScale; \n\ void main() \n\ { \n\ - float y = texture2D(uYTexture, vTexCoord * uYTexScale).r; \n\ - float cb = texture2D(uCbTexture, vTexCoord * uCbCrTexScale).r; \n\ - float cr = texture2D(uCrTexture, vTexCoord * uCbCrTexScale).r; \n\ + float y = texture2D(uYTexture, vTexCoord * uYTexScale).a; \n\ + float cb = texture2D(uCbTexture, vTexCoord * uCbCrTexScale).a; \n\ + float cr = texture2D(uCrTexture, vTexCoord * uCbCrTexScale).a; \n\ y = (y - 0.06275) * 1.16438; \n\ cb = cb - 0.50196; \n\ cr = cr - 0.50196; \n\ @@ -641,7 +641,7 @@ GLBlitHelper::BindAndUploadYUVTexture(Channel which, GLuint& tex = *srcTexArr[which]; if (!tex) { MOZ_ASSERT(needsAllocation); - tex = CreateTexture(mGL, LOCAL_GL_LUMINANCE, LOCAL_GL_LUMINANCE, LOCAL_GL_UNSIGNED_BYTE, + tex = CreateTexture(mGL, LOCAL_GL_ALPHA, LOCAL_GL_ALPHA, LOCAL_GL_UNSIGNED_BYTE, gfx::IntSize(width, height), false); } mGL->fActiveTexture(LOCAL_GL_TEXTURE0 + which); @@ -654,17 +654,17 @@ GLBlitHelper::BindAndUploadYUVTexture(Channel which, 0, width, height, - LOCAL_GL_LUMINANCE, + LOCAL_GL_ALPHA, LOCAL_GL_UNSIGNED_BYTE, data); } else { mGL->fTexImage2D(LOCAL_GL_TEXTURE_2D, 0, - LOCAL_GL_LUMINANCE, + LOCAL_GL_ALPHA, width, height, 0, - LOCAL_GL_LUMINANCE, + LOCAL_GL_ALPHA, LOCAL_GL_UNSIGNED_BYTE, data); }