Bug 1303879 - fb->ReadBuffer(BACK) is INVALID_OP. - r=mtseng
MozReview-Commit-ID: F3T4qZcETr5
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -1230,18 +1230,23 @@ WebGLFramebuffer::DrawBuffers(const char
mContext->gl->fDrawBuffers(buffers.Length(), buffers.Elements());
}
void
WebGLFramebuffer::ReadBuffer(const char* funcName, GLenum attachPoint)
{
const auto& maybeAttach = GetColorAttachPoint(attachPoint);
if (!maybeAttach) {
- mContext->ErrorInvalidValue("%s: `mode` must be a COLOR_ATTACHMENTi, for "
- " 0 <= i < MAX_DRAW_BUFFERS.", funcName);
+ const char text[] = "%s: `mode` must be a COLOR_ATTACHMENTi, for 0 <= i <"
+ " MAX_DRAW_BUFFERS.";
+ if (attachPoint == LOCAL_GL_BACK) {
+ mContext->ErrorInvalidOperation(text, funcName);
+ } else {
+ mContext->ErrorInvalidEnum(text, funcName);
+ }
return;
}
const auto& attach = maybeAttach.value();
// Record it.
mColorReadBuffer = attach;
RecacheResolvedData();