Bug 1238865 - Part 3: Prevent IMPLEMENTATION_COLOR_READ_FORMAT return SRGB_ALPHA. r=jgilbert

--HG--
extra : commitid : Gu6Cf81s63T
This commit is contained in:
Morris Tseng 2016-01-21 14:51:59 +08:00
parent 794c8843cb
commit 4648f2d1cb

View File

@ -310,6 +310,7 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
} else {
i = LOCAL_GL_UNSIGNED_BYTE;
}
return JS::NumberValue(uint32_t(i));
}
case LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT: {
@ -330,6 +331,14 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv)
} else {
i = LOCAL_GL_RGBA;
}
// OpenGL ES 3.0.4 p112 Table 3.2 shows that read format SRGB_ALPHA is
// not supported. And if internal format of fbo is SRGB8_ALPHA8, then
// IMPLEMENTATION_COLOR_READ_FORMAT is SRGB_ALPHA which is not supported
// by ReadPixels. So, just return RGBA here.
if (i == LOCAL_GL_SRGB_ALPHA)
i = LOCAL_GL_RGBA;
return JS::NumberValue(uint32_t(i));
}
// int