Bug 1373702 - (wip) WebGL fast video patch for MacIOSSurface
MozReview-Commit-ID: 8uGulISSRGJ
--- a/gfx/2d/MacIOSurface.cpp
+++ b/gfx/2d/MacIOSurface.cpp
@@ -537,17 +537,17 @@ MacIOSurface::CGLTexImageIOSurface2D(moz
internalFormat = format = (isCompatibilityProfile) ? (LOCAL_GL_LUMINANCE_ALPHA)
: (LOCAL_GL_RG);
}
type = LOCAL_GL_UNSIGNED_BYTE;
if (aOutReadFormat) {
*aOutReadFormat = mozilla::gfx::SurfaceFormat::NV12;
}
} else if (pixelFormat == '2vuy') {
- MOZ_ASSERT(plane == 0);
+ // MOZ_ASSERT(plane == 0);
// The YCBCR_422_APPLE ext is only available in compatibility profile. So,
// we should use RGB_422_APPLE for core profile. The difference between
// YCBCR_422_APPLE and RGB_422_APPLE is that the YCBCR_422_APPLE converts
// the YCbCr value to RGB with REC 601 conversion. But the RGB_422_APPLE
// doesn't contain color conversion. You should do the color conversion by
// yourself for RGB_422_APPLE.
//
// https://www.khronos.org/registry/OpenGL/extensions/APPLE/APPLE_ycbcr_422.txt
--- a/gfx/gl/GLBlitHelper.cpp
+++ b/gfx/gl/GLBlitHelper.cpp
@@ -86,17 +86,17 @@ GLBlitHelper::~GLBlitHelper()
mFBO = 0;
}
// Allowed to be destructive of state we restore in functions below.
bool
GLBlitHelper::InitTexQuadProgram(BlitType target)
{
const char kTexBlit_VertShaderSource[] = "\
- #version 100 \n\
+ #version 120 \n\
#ifdef GL_ES \n\
precision mediump float; \n\
#endif \n\
attribute vec2 aPosition; \n\
\n\
uniform float uYflip; \n\
varying vec2 vTexCoord; \n\
\n\
@@ -210,33 +210,32 @@ GLBlitHelper::InitTexQuadProgram(BlitTyp
vec3 yuv = vec3(y, cb, cr); \n\
gl_FragColor.rgb = uYuvColorMatrix * yuv; \n\
gl_FragColor.a = 1.0; \n\
} \n\
";
#ifdef XP_MACOSX
const char kTexNV12PlanarBlit_FragShaderSource[] = "\
- #version 100 \n\
+ #version 120 \n\
#extension GL_ARB_texture_rectangle : require \n\
#ifdef GL_ES \n\
precision mediump float \n\
#endif \n\
varying vec2 vTexCoord; \n\
uniform sampler2DRect uYTexture; \n\
uniform sampler2DRect uCbCrTexture; \n\
uniform vec2 uYTexScale; \n\
uniform vec2 uCbCrTexScale; \n\
void main() \n\
{ \n\
float y = texture2DRect(uYTexture, vTexCoord * uYTexScale).r; \n\
float cb = texture2DRect(uCbCrTexture, vTexCoord * uCbCrTexScale).r; \n\
float cr = texture2DRect(uCbCrTexture, vTexCoord * uCbCrTexScale).a; \n\
y = (y - 0.06275) * 1.16438; \n\
- cb = cb - 0.50196; \n\
cr = cr - 0.50196; \n\
gl_FragColor.r = y + cr * 1.59603; \n\
gl_FragColor.g = y - 0.81297 * cr - 0.39176 * cb; \n\
gl_FragColor.b = y + cb * 2.01723; \n\
gl_FragColor.a = 1.0; \n\
} \n\
";
#endif