author | Daosheng Mu <daoshengmu@gmail.com> |
Thu, 14 Jul 2016 11:27:27 +0800 | |
changeset 304932 | 663bb8ffe93401eb80e3caf9578763094d2fe378 |
parent 304931 | 0d3db763a5e3e5341ae11ad1ce42c9a684aabeba |
child 304933 | 54bc921dd236fb88a7e2dcd3ec87102a19f98ba3 |
push id | 79466 |
push user | cbook@mozilla.com |
push date | Thu, 14 Jul 2016 09:56:07 +0000 |
treeherder | mozilla-inbound@553ce3faa35f [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jgilbert |
bugs | 1236787 |
milestone | 50.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/dom/canvas/WebGL2ContextRenderbuffers.cpp +++ b/dom/canvas/WebGL2ContextRenderbuffers.cpp @@ -13,28 +13,53 @@ namespace mozilla { void WebGL2Context::GetInternalformatParameter(JSContext* cx, GLenum target, GLenum internalformat, GLenum pname, JS::MutableHandleValue retval, ErrorResult& out_rv) { const char funcName[] = "getInternalfomratParameter"; + retval.setObjectOrNull(nullptr); + if (IsContextLost()) return; if (target != LOCAL_GL_RENDERBUFFER) { ErrorInvalidEnum("%s: `target` must be RENDERBUFFER, was: 0x%04x.", funcName, target); return; } - // GL_INVALID_ENUM is generated if internalformat is not color-, depth-, or - // stencil-renderable. - // TODO: When format table queries lands. + // GLES 3.0.4 $4.4.4 p212: + // "An internal format is color-renderable if it is one of the formats from table 3.13 + // noted as color-renderable or if it is unsized format RGBA or RGB." + + GLenum sizedFormat; + switch (internalformat) { + case LOCAL_GL_RGB: + sizedFormat = LOCAL_GL_RGB8; + break; + case LOCAL_GL_RGBA: + sizedFormat = LOCAL_GL_RGBA8; + break; + default: + sizedFormat = internalformat; + break; + } + + // In RenderbufferStorage, we allow DEPTH_STENCIL. Therefore, it is accepted for + // internalformat as well. Please ignore the conformance test fail for DEPTH_STENCIL. + + const auto usage = mFormatUsage->GetRBUsage(sizedFormat); + if (!usage) { + ErrorInvalidEnum("%s: `internalformat` must be color-, depth-, or stencil-renderable, was: 0x%04x.", + funcName, internalformat); + return; + } if (pname != LOCAL_GL_SAMPLES) { ErrorInvalidEnumInfo("%s: `pname` must be SAMPLES, was 0x%04x.", funcName, pname); return; } GLint* samples = nullptr; GLint sampleCount = 0;