2013-11-05 01:05:04 +04: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 07:03:50 +03:00
|
|
|
|
2013-11-05 01:05:04 +04:00
|
|
|
#include "GLContext.h"
|
2014-11-14 07:03:50 +03:00
|
|
|
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
|
|
|
#include "WebGLContext.h"
|
2013-11-05 01:05:04 +04:00
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
namespace mozilla {
|
2013-11-05 01:05:04 +04:00
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
WebGLExtensionSRGB::WebGLExtensionSRGB(WebGLContext* webgl)
|
|
|
|
: WebGLExtensionBase(webgl)
|
2013-11-05 01:05:04 +04:00
|
|
|
{
|
2014-11-14 07:03:50 +03:00
|
|
|
MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
|
|
|
|
|
|
|
|
gl::GLContext* gl = webgl->GL();
|
2013-11-05 01:05:04 +04:00
|
|
|
if (!gl->IsGLES()) {
|
2014-11-14 07:03:50 +03:00
|
|
|
// Desktop OpenGL requires the following to be enabled in order to
|
|
|
|
// support sRGB operations on framebuffers.
|
2013-11-05 01:05:04 +04:00
|
|
|
gl->MakeCurrent();
|
|
|
|
gl->fEnable(LOCAL_GL_FRAMEBUFFER_SRGB_EXT);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
WebGLExtensionSRGB::~WebGLExtensionSRGB()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2014-11-14 07:03:50 +03:00
|
|
|
WebGLExtensionSRGB::IsSupported(const WebGLContext* webgl)
|
2013-11-05 01:05:04 +04:00
|
|
|
{
|
2014-11-14 07:03:50 +03:00
|
|
|
gl::GLContext* gl = webgl->GL();
|
2013-11-05 01:05:04 +04:00
|
|
|
|
2015-03-24 10:11:10 +03:00
|
|
|
return gl->IsSupported(gl::GLFeature::sRGB_framebuffer) &&
|
|
|
|
gl->IsSupported(gl::GLFeature::sRGB_texture);
|
2013-11-05 01:05:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionSRGB)
|
2014-11-14 07:03:50 +03:00
|
|
|
|
|
|
|
} // namespace mozilla
|