2013-11-04 21:05:04 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "WebGLExtensions.h"
|
2014-11-14 04:03:50 +00:00
|
|
|
|
2013-11-04 21:05:04 +00:00
|
|
|
#include "GLContext.h"
|
2014-11-14 04:03:50 +00:00
|
|
|
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
|
|
|
#include "WebGLContext.h"
|
2013-11-04 21:05:04 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
namespace mozilla {
|
2013-11-04 21:05:04 +00:00
|
|
|
|
2014-11-14 04:03:50 +00:00
|
|
|
WebGLExtensionSRGB::WebGLExtensionSRGB(WebGLContext* webgl)
|
|
|
|
: WebGLExtensionBase(webgl)
|
2013-11-04 21:05:04 +00:00
|
|
|
{
|
2014-11-14 04:03:50 +00:00
|
|
|
MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
|
|
|
|
|
|
|
|
gl::GLContext* gl = webgl->GL();
|
2013-11-04 21:05:04 +00:00
|
|
|
if (!gl->IsGLES()) {
|
2014-11-14 04:03:50 +00:00
|
|
|
// Desktop OpenGL requires the following to be enabled in order to
|
|
|
|
// support sRGB operations on framebuffers.
|
2013-11-04 21:05:04 +00:00
|
|
|
gl->MakeCurrent();
|
|
|
|
gl->fEnable(LOCAL_GL_FRAMEBUFFER_SRGB_EXT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WebGLExtensionSRGB::~WebGLExtensionSRGB()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-11-14 04:03:50 +00:00
|
|
|
WebGLExtensionSRGB::IsSupported(const WebGLContext* webgl)
|
2013-11-04 21:05:04 +00:00
|
|
|
{
|
2014-11-14 04:03:50 +00:00
|
|
|
gl::GLContext* gl = webgl->GL();
|
2013-11-04 21:05:04 +00:00
|
|
|
|
|
|
|
return gl->IsSupported(gl::GLFeature::sRGB);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionSRGB)
|
2014-11-14 04:03:50 +00:00
|
|
|
|
|
|
|
} // namespace mozilla
|