2014-03-12 06:51:39 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
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)
|
2013-06-22 03:44:17 +04:00
|
|
|
{
|
2014-11-14 07:03:50 +03:00
|
|
|
MOZ_ASSERT(IsSupported(webgl), "Don't construct extension if unsupported.");
|
|
|
|
|
2017-07-27 10:48:58 +03:00
|
|
|
webgl->UpdateMaxDrawBuffers();
|
2013-06-22 03:44:17 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
WebGLExtensionDrawBuffers::~WebGLExtensionDrawBuffers()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
void
|
|
|
|
WebGLExtensionDrawBuffers::DrawBuffersWEBGL(const dom::Sequence<GLenum>& buffers)
|
2013-06-22 03:44:17 +04:00
|
|
|
{
|
2014-11-14 07:03:50 +03:00
|
|
|
if (mIsLost) {
|
|
|
|
mContext->ErrorInvalidOperation("drawBuffersWEBGL: Extension is lost.");
|
|
|
|
return;
|
|
|
|
}
|
2014-03-12 06:51:39 +04:00
|
|
|
|
2013-07-17 20:13:38 +04:00
|
|
|
mContext->DrawBuffers(buffers);
|
2013-06-22 03:44:17 +04:00
|
|
|
}
|
|
|
|
|
2014-11-14 07:03:50 +03:00
|
|
|
bool
|
|
|
|
WebGLExtensionDrawBuffers::IsSupported(const WebGLContext* webgl)
|
2013-06-22 03:44:17 +04:00
|
|
|
{
|
2014-11-14 07:03:50 +03:00
|
|
|
gl::GLContext* gl = webgl->GL();
|
2013-06-22 03:44:17 +04:00
|
|
|
|
2017-07-27 10:48:35 +03:00
|
|
|
return gl->IsSupported(gl::GLFeature::draw_buffers);
|
2013-06-22 03:44:17 +04:00
|
|
|
}
|
|
|
|
|
2015-06-01 17:17:00 +03:00
|
|
|
IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionDrawBuffers, WEBGL_draw_buffers)
|
2014-11-14 07:03:50 +03:00
|
|
|
|
|
|
|
} // namespace mozilla
|