2018-11-30 22:52:05 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2013-06-22 03:44:17 +04:00
|
|
|
/* 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"
|
|
|
|
|
|
|
|
#include <algorithm>
|
2014-11-14 07:03:50 +03:00
|
|
|
#include "GLContext.h"
|
|
|
|
#include "mozilla/dom/WebGLRenderingContextBinding.h"
|
|
|
|
#include "WebGLContext.h"
|
|
|
|
#include "WebGLFramebuffer.h"
|
|
|
|
#include "WebGLRenderbuffer.h"
|
|
|
|
#include "WebGLTexture.h"
|
2013-06-22 03:44:17 +04:00
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
namespace mozilla {
|
2013-06-22 03:44:17 +04:00
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
WebGLExtensionDrawBuffers::WebGLExtensionDrawBuffers(WebGLContext* webgl)
|
|
|
|
: WebGLExtensionBase(webgl) {
|
|
|
|
MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
|
2013-06-22 03:44:17 +04:00
|
|
|
}
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
bool WebGLExtensionDrawBuffers::IsSupported(const WebGLContext* webgl) {
|
2019-02-05 06:34:49 +03:00
|
|
|
if (webgl->IsWebGL2()) return false;
|
2013-06-22 03:44:17 +04:00
|
|
|
|
2019-02-05 06:34:49 +03:00
|
|
|
gl::GLContext* gl = webgl->GL();
|
2019-02-09 10:41:49 +03:00
|
|
|
if (gl->IsGLES() && gl->Version() >= 300) {
|
|
|
|
// ANGLE's shader translator can't translate ESSL1 exts to ESSL3. (bug
|
|
|
|
// 1524804)
|
|
|
|
return false;
|
|
|
|
}
|
2017-07-27 10:48:35 +03:00
|
|
|
return gl->IsSupported(gl::GLFeature::draw_buffers);
|
2013-06-22 03:44:17 +04:00
|
|
|
}
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
} // namespace mozilla
|