author Jeff Gilbert <>
Thu, 11 Jan 2018 17:53:52 -0800
changeset 450710 add48ffcf30322b8ecf135e03e3bf333b8847c2c
parent 449847 e8afea9b08757dc6a3415ebd38dbd572d1ec7a45
child 450712 5150651a530bb2d7b55fe86709d8c7e1de28de1e
permissions -rw-r--r--
Bug 1429754 - Trust the driver about floating point support. - r=daoshengmu Remove the probe, and remove the cached value check. Also remove dead code which relies on this sometimes-clamping glGet query. MozReview-Commit-ID: JA1VgH8fLRB

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at */

#include "WebGLExtensions.h"

#include "GLContext.h"
#include "mozilla/dom/WebGLRenderingContextBinding.h"
#include "WebGLContext.h"
#include "WebGLFormats.h"

#ifdef FOO
#error FOO is already defined! We use FOO() macros to keep things succinct in this file.

namespace mozilla {

WebGLExtensionColorBufferFloat::WebGLExtensionColorBufferFloat(WebGLContext* webgl)
    : WebGLExtensionBase(webgl)
    MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");

    auto& fua = webgl->mFormatUsage;

    auto fnUpdateUsage = [&fua](GLenum sizedFormat, webgl::EffectiveFormat effFormat) {
        auto usage = fua->EditUsage(effFormat);
        fua->AllowRBFormat(sizedFormat, usage);

#define FOO(x) fnUpdateUsage(LOCAL_GL_ ## x, webgl::EffectiveFormat::x)

    // The extension doesn't actually add RGB32F; only RGBA32F.

#undef FOO


WebGLExtensionColorBufferFloat::IsSupported(const WebGLContext* webgl)
    const auto& gl = webgl->gl;
    if (gl->IsANGLE()) {
        // ANGLE supports this, but doesn't have a way to advertize its support,
        // since it's compliant with WEBGL_color_buffer_float's clamping, but not
        // EXT_color_buffer_float.
        // TODO: This probably isn't necessary anymore.
        return true;

    return gl->IsSupported(gl::GLFeature::renderbuffer_color_float) &&

IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionColorBufferFloat, WEBGL_color_buffer_float)

} // namespace mozilla