Bug 1235299 - Fix WebGL assertions for copyTexImage2D. r=jgilbert

This commit is contained in:
Ethan Lin 2016-01-07 18:50:00 +01:00
parent c69d84d994
commit 3fac635eb8

View File

@ -91,6 +91,7 @@ bool
GLBlitHelper::InitTexQuadProgram(BlitType target)
{
const char kTexBlit_VertShaderSource[] = "\
#version 100 \n\
#ifdef GL_ES \n\
precision mediump float; \n\
#endif \n\
@ -109,6 +110,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
";
const char kTex2DBlit_FragShaderSource[] = "\
#version 100 \n\
#ifdef GL_ES \n\
#ifdef GL_FRAGMENT_PRECISION_HIGH \n\
precision highp float; \n\
@ -127,6 +129,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
";
const char kTex2DRectBlit_FragShaderSource[] = "\
#version 100 \n\
#ifdef GL_FRAGMENT_PRECISION_HIGH \n\
precision highp float; \n\
#else \n\
@ -146,6 +149,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
";
#ifdef ANDROID /* MOZ_WIDGET_ANDROID || MOZ_WIDGET_GONK */
const char kTexExternalBlit_FragShaderSource[] = "\
#version 100 \n\
#extension GL_OES_EGL_image_external : require \n\
#ifdef GL_FRAGMENT_PRECISION_HIGH \n\
precision highp float; \n\
@ -174,6 +178,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196]
*/
const char kTexYUVPlanarBlit_FragShaderSource[] = "\
#version 100 \n\
#ifdef GL_ES \n\
precision mediump float; \n\
#endif \n\
@ -200,6 +205,7 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
#ifdef XP_MACOSX
const char kTexNV12PlanarBlit_FragShaderSource[] = "\
#version 100 \n\
#extension GL_ARB_texture_rectangle : require \n\
#ifdef GL_ES \n\
precision mediump float \n\
@ -383,18 +389,16 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
// Cache and set attribute and uniform
mGL->fUseProgram(program);
switch (target) {
#ifdef ANDROID
case ConvertSurfaceTexture:
case ConvertGralloc:
#endif
case BlitTex2D:
case BlitTexRect:
case ConvertEGLImage:
case ConvertSurfaceTexture:
case ConvertGralloc: {
#ifdef ANDROID
case ConvertEGLImage: {
GLint texUnitLoc = mGL->fGetUniformLocation(program, "uTexUnit");
MOZ_ASSERT(texUnitLoc != -1, "uniform uTexUnit not found");
mGL->fUniform1i(texUnitLoc, 0);
#else
MOZ_ASSERT_UNREACHABLE("gralloc not support on non-android");
#endif
break;
}
case ConvertPlanarYCbCr: {
@ -434,6 +438,8 @@ GLBlitHelper::InitTexQuadProgram(BlitType target)
#endif
break;
}
default:
return false;
}
MOZ_ASSERT(mGL->fGetAttribLocation(program, "aPosition") == 0);
mYFlipLoc = mGL->fGetUniformLocation(program, "uYflip");