2013-07-17 17:58:09 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 4; 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/. */
|
|
|
|
|
|
|
|
#ifndef WEBGL2CONTEXT_H_
|
|
|
|
#define WEBGL2CONTEXT_H_
|
|
|
|
|
|
|
|
#include "WebGLContext.h"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
2015-05-25 14:50:15 +03:00
|
|
|
class ErrorResult;
|
2014-09-18 02:08:41 +04:00
|
|
|
class WebGLSampler;
|
|
|
|
class WebGLSync;
|
|
|
|
class WebGLTransformFeedback;
|
|
|
|
class WebGLVertexArrayObject;
|
2014-12-16 08:20:15 +03:00
|
|
|
namespace dom {
|
|
|
|
class OwningUnsignedLongOrUint32ArrayOrBoolean;
|
|
|
|
class OwningWebGLBufferOrLongLong;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
2014-09-18 02:08:41 +04:00
|
|
|
|
2013-07-17 17:58:09 +04:00
|
|
|
class WebGL2Context
|
|
|
|
: public WebGLContext
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
virtual ~WebGL2Context();
|
|
|
|
|
|
|
|
static bool IsSupported();
|
|
|
|
static WebGL2Context* Create();
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool IsWebGL2() const override
|
2014-09-18 02:08:41 +04:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2013-07-17 17:58:09 +04:00
|
|
|
// -------------------------------------------------------------------------
|
2014-09-18 02:08:41 +04:00
|
|
|
// IMPLEMENT nsWrapperCache
|
2013-07-17 17:58:09 +04:00
|
|
|
|
2015-07-15 03:37:28 +03:00
|
|
|
virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override;
|
2013-07-17 17:58:09 +04:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2014-09-18 02:08:41 +04:00
|
|
|
// Buffer objects - WebGL2ContextBuffers.cpp
|
2013-07-17 17:58:09 +04:00
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
void CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
|
|
|
|
GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
|
2015-10-14 08:48:19 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
template<typename BufferT>
|
|
|
|
void GetBufferSubDataT(GLenum target, GLintptr offset, const BufferT& data);
|
|
|
|
|
|
|
|
public:
|
2016-10-12 03:38:45 +03:00
|
|
|
void GetBufferSubData(GLenum target, GLintptr srcByteOffset,
|
|
|
|
const dom::ArrayBufferView& dstData, GLuint dstElemOffset,
|
|
|
|
GLuint dstElemCountOverride);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Framebuffer objects - WebGL2ContextFramebuffers.cpp
|
|
|
|
|
|
|
|
void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
|
|
|
|
GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
|
|
|
|
GLbitfield mask, GLenum filter);
|
2015-07-03 04:54:07 +03:00
|
|
|
void FramebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture* texture, GLint level, GLint layer);
|
2015-08-06 09:31:00 +03:00
|
|
|
|
|
|
|
virtual JS::Value GetFramebufferAttachmentParameter(JSContext* cx, GLenum target,
|
|
|
|
GLenum attachment, GLenum pname,
|
|
|
|
ErrorResult& rv) override;
|
2016-12-21 02:47:13 +03:00
|
|
|
// Make the inline version from the superclass visible here.
|
|
|
|
using WebGLContext::GetFramebufferAttachmentParameter;
|
2015-08-06 09:31:00 +03:00
|
|
|
|
2015-05-25 14:50:15 +03:00
|
|
|
void InvalidateFramebuffer(GLenum target, const dom::Sequence<GLenum>& attachments,
|
2015-07-15 03:37:28 +03:00
|
|
|
ErrorResult& rv);
|
2014-09-18 02:08:41 +04:00
|
|
|
void InvalidateSubFramebuffer (GLenum target, const dom::Sequence<GLenum>& attachments, GLint x, GLint y,
|
2015-07-15 03:37:28 +03:00
|
|
|
GLsizei width, GLsizei height, ErrorResult& rv);
|
2014-09-18 02:08:41 +04:00
|
|
|
void ReadBuffer(GLenum mode);
|
2015-07-03 04:54:07 +03:00
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Renderbuffer objects - WebGL2ContextRenderbuffers.cpp
|
|
|
|
|
|
|
|
void GetInternalformatParameter(JSContext*, GLenum target, GLenum internalformat,
|
|
|
|
GLenum pname, JS::MutableHandleValue retval,
|
|
|
|
ErrorResult& rv);
|
2014-09-18 02:08:41 +04:00
|
|
|
void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat,
|
|
|
|
GLsizei width, GLsizei height);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2014-09-18 02:08:41 +04:00
|
|
|
// Texture objects - WebGL2ContextTextures.cpp
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
void TexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width,
|
2016-10-21 04:03:40 +03:00
|
|
|
GLsizei height)
|
|
|
|
{
|
|
|
|
const char funcName[] = "TexStorage2D";
|
|
|
|
const uint8_t funcDims = 2;
|
|
|
|
const GLsizei depth = 1;
|
|
|
|
TexStorage(funcName, funcDims, target, levels, internalFormat, width, height,
|
|
|
|
depth);
|
|
|
|
}
|
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
void TexStorage3D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width,
|
2016-10-21 04:03:40 +03:00
|
|
|
GLsizei height, GLsizei depth)
|
|
|
|
{
|
|
|
|
const char funcName[] = "TexStorage3D";
|
|
|
|
const uint8_t funcDims = 3;
|
|
|
|
TexStorage(funcName, funcDims, target, levels, internalFormat, width, height,
|
|
|
|
depth);
|
|
|
|
}
|
2016-08-10 03:16:09 +03:00
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
protected:
|
|
|
|
void TexStorage(const char* funcName, uint8_t funcDims, GLenum target, GLsizei levels,
|
|
|
|
GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth);
|
2016-10-12 04:54:59 +03:00
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
////////////////////////////////////
|
2016-10-12 04:54:59 +03:00
|
|
|
|
|
|
|
public:
|
2017-07-18 21:02:57 +03:00
|
|
|
void CompressedTexImage3D(GLenum target, GLint level, GLenum internalFormat,
|
|
|
|
GLsizei width, GLsizei height, GLsizei depth, GLint border,
|
|
|
|
GLsizei imageSize, WebGLintptr offset)
|
|
|
|
{
|
|
|
|
const char funcName[] = "compressedTexImage3D";
|
|
|
|
const uint8_t funcDims = 3;
|
|
|
|
const TexImageSourceAdapter src(&offset, 0, 0);
|
|
|
|
CompressedTexImage(funcName, funcDims, target, level, internalFormat, width,
|
|
|
|
height, depth, border, src, Some(imageSize));
|
|
|
|
}
|
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
template<typename T>
|
|
|
|
void CompressedTexImage3D(GLenum target, GLint level, GLenum internalFormat,
|
|
|
|
GLsizei width, GLsizei height, GLsizei depth, GLint border,
|
2016-10-28 05:03:20 +03:00
|
|
|
const T& anySrc, GLuint viewElemOffset = 0,
|
|
|
|
GLuint viewElemLengthOverride = 0)
|
2016-10-21 04:03:40 +03:00
|
|
|
{
|
|
|
|
const char funcName[] = "compressedTexImage3D";
|
|
|
|
const uint8_t funcDims = 3;
|
2016-11-23 04:17:12 +03:00
|
|
|
const TexImageSourceAdapter src(&anySrc, viewElemOffset, viewElemLengthOverride);
|
2016-10-21 04:03:40 +03:00
|
|
|
CompressedTexImage(funcName, funcDims, target, level, internalFormat, width,
|
2017-07-18 21:02:57 +03:00
|
|
|
height, depth, border, src, Nothing());
|
|
|
|
}
|
|
|
|
|
|
|
|
void CompressedTexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLsizei width, GLsizei height,
|
|
|
|
GLsizei depth, GLenum unpackFormat,
|
|
|
|
GLsizei imageSize, WebGLintptr offset)
|
|
|
|
{
|
|
|
|
const char funcName[] = "compressedTexSubImage3D";
|
|
|
|
const uint8_t funcDims = 3;
|
|
|
|
const TexImageSourceAdapter src(&offset, 0, 0);
|
|
|
|
CompressedTexSubImage(funcName, funcDims, target, level, xOffset, yOffset,
|
|
|
|
zOffset, width, height, depth, unpackFormat, src, Some(imageSize));
|
2016-10-21 04:03:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
void CompressedTexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLsizei width, GLsizei height,
|
|
|
|
GLsizei depth, GLenum unpackFormat, const T& anySrc,
|
2016-10-28 05:03:20 +03:00
|
|
|
GLuint viewElemOffset = 0,
|
|
|
|
GLuint viewElemLengthOverride = 0)
|
2016-10-21 04:03:40 +03:00
|
|
|
{
|
|
|
|
const char funcName[] = "compressedTexSubImage3D";
|
|
|
|
const uint8_t funcDims = 3;
|
2016-11-23 04:17:12 +03:00
|
|
|
const TexImageSourceAdapter src(&anySrc, viewElemOffset, viewElemLengthOverride);
|
2016-10-21 04:03:40 +03:00
|
|
|
CompressedTexSubImage(funcName, funcDims, target, level, xOffset, yOffset,
|
2017-07-18 21:02:57 +03:00
|
|
|
zOffset, width, height, depth, unpackFormat, src, Nothing());
|
2016-10-21 04:03:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
|
|
|
|
void CopyTexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLint x, GLint y, GLsizei width,
|
|
|
|
GLsizei height)
|
|
|
|
{
|
|
|
|
const char funcName[] = "copyTexSubImage3D";
|
|
|
|
const uint8_t funcDims = 3;
|
|
|
|
CopyTexSubImage(funcName, funcDims, target, level, xOffset, yOffset, zOffset,
|
|
|
|
x, y, width, height);
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
|
|
|
|
template<typename T>
|
2016-10-12 04:54:59 +03:00
|
|
|
void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
|
|
|
|
GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
|
2016-10-21 04:03:40 +03:00
|
|
|
GLenum unpackType, const T& anySrc, ErrorResult& out_error)
|
2016-10-12 04:54:59 +03:00
|
|
|
{
|
2016-11-23 04:17:12 +03:00
|
|
|
const TexImageSourceAdapter src(&anySrc, &out_error);
|
2016-10-12 04:54:59 +03:00
|
|
|
TexImage3D(target, level, internalFormat, width, height, depth, border,
|
2016-10-21 04:03:40 +03:00
|
|
|
unpackFormat, unpackType, src);
|
2016-10-12 04:54:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
|
|
|
|
GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
|
2016-10-21 04:03:40 +03:00
|
|
|
GLenum unpackType, const dom::ArrayBufferView& view,
|
|
|
|
GLuint viewElemOffset, ErrorResult&)
|
2016-10-12 04:54:59 +03:00
|
|
|
{
|
2016-11-23 04:17:12 +03:00
|
|
|
const TexImageSourceAdapter src(&view, viewElemOffset);
|
2016-10-12 04:54:59 +03:00
|
|
|
TexImage3D(target, level, internalFormat, width, height, depth, border,
|
2016-10-21 04:03:40 +03:00
|
|
|
unpackFormat, unpackType, src);
|
2016-10-12 04:54:59 +03:00
|
|
|
}
|
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
protected:
|
|
|
|
void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
|
|
|
|
GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
|
|
|
|
GLenum unpackType, const TexImageSource& src)
|
|
|
|
{
|
|
|
|
const char funcName[] = "texImage3D";
|
|
|
|
const uint8_t funcDims = 3;
|
|
|
|
TexImage(funcName, funcDims, target, level, internalFormat, width, height, depth,
|
|
|
|
border, unpackFormat, unpackType, src);
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////
|
|
|
|
|
|
|
|
public:
|
|
|
|
template<typename T>
|
|
|
|
void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
|
|
|
|
GLenum unpackFormat, GLenum unpackType, const T& anySrc,
|
|
|
|
ErrorResult& out_error)
|
|
|
|
{
|
2016-11-23 04:17:12 +03:00
|
|
|
const TexImageSourceAdapter src(&anySrc, &out_error);
|
2016-10-21 04:03:40 +03:00
|
|
|
TexSubImage3D(target, level, xOffset, yOffset, zOffset, width, height, depth,
|
|
|
|
unpackFormat, unpackType, src);
|
|
|
|
}
|
2016-08-10 03:16:09 +03:00
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
|
|
|
|
GLenum unpackFormat, GLenum unpackType,
|
2016-11-02 00:58:07 +03:00
|
|
|
const dom::Nullable<dom::ArrayBufferView>& maybeSrcView,
|
|
|
|
GLuint srcElemOffset, ErrorResult&)
|
2016-10-21 04:03:40 +03:00
|
|
|
{
|
2016-11-02 00:58:07 +03:00
|
|
|
if (IsContextLost())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (!ValidateNonNull("texSubImage3D", maybeSrcView))
|
|
|
|
return;
|
|
|
|
const auto& srcView = maybeSrcView.Value();
|
|
|
|
|
2016-11-23 04:17:12 +03:00
|
|
|
const TexImageSourceAdapter src(&srcView, srcElemOffset);
|
2016-10-21 04:03:40 +03:00
|
|
|
TexSubImage3D(target, level, xOffset, yOffset, zOffset, width, height, depth,
|
|
|
|
unpackFormat, unpackType, src);
|
|
|
|
}
|
2016-07-07 23:02:00 +03:00
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
protected:
|
2016-07-07 23:02:00 +03:00
|
|
|
void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
|
2016-10-21 04:03:40 +03:00
|
|
|
GLenum unpackFormat, GLenum unpackType, const TexImageSource& src)
|
|
|
|
{
|
|
|
|
const char funcName[] = "texSubImage3D";
|
|
|
|
const uint8_t funcDims = 3;
|
|
|
|
TexSubImage(funcName, funcDims, target, level, xOffset, yOffset, zOffset, width,
|
|
|
|
height, depth, unpackFormat, unpackType, src);
|
|
|
|
}
|
2016-07-07 23:02:00 +03:00
|
|
|
|
2016-10-21 04:03:40 +03:00
|
|
|
public:
|
2014-09-18 02:08:41 +04:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Programs and shaders - WebGL2ContextPrograms.cpp
|
2016-11-02 00:58:07 +03:00
|
|
|
GLint GetFragDataLocation(const WebGLProgram& program, const nsAString& name);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
2014-09-18 02:08:41 +04:00
|
|
|
// Uniforms and attributes - WebGL2ContextUniforms.cpp
|
2017-01-12 02:57:29 +03:00
|
|
|
|
|
|
|
void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride,
|
|
|
|
WebGLintptr byteOffset)
|
|
|
|
{
|
|
|
|
const char funcName[] = "vertexAttribIPointer";
|
|
|
|
const bool isFuncInt = true;
|
|
|
|
const bool normalized = false;
|
|
|
|
VertexAttribAnyPointer(funcName, isFuncInt, index, size, type, normalized, stride,
|
|
|
|
byteOffset);
|
|
|
|
}
|
2014-09-18 02:08:41 +04:00
|
|
|
|
2016-07-14 22:13:47 +03:00
|
|
|
////////////////
|
2015-03-23 05:13:10 +03:00
|
|
|
|
2016-10-14 02:15:16 +03:00
|
|
|
// GL 3.0 & ES 3.0
|
2016-12-22 06:42:07 +03:00
|
|
|
void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w,
|
|
|
|
const char* funcName = nullptr);
|
|
|
|
void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w,
|
|
|
|
const char* funcName = nullptr);
|
2016-07-14 22:13:47 +03:00
|
|
|
|
2016-10-14 02:15:16 +03:00
|
|
|
void VertexAttribI4iv(GLuint index, const Int32ListU& list) {
|
|
|
|
const auto& arr = Int32Arr::From(list);
|
|
|
|
if (!ValidateAttribArraySetter("vertexAttribI4iv", 4, arr.elemCount))
|
|
|
|
return;
|
2015-03-23 04:29:32 +03:00
|
|
|
|
2016-10-14 02:15:16 +03:00
|
|
|
const auto& itr = arr.elemBytes;
|
|
|
|
VertexAttribI4i(index, itr[0], itr[1], itr[2], itr[3]);
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
|
|
|
|
2016-10-14 02:15:16 +03:00
|
|
|
void VertexAttribI4uiv(GLuint index, const Uint32ListU& list) {
|
|
|
|
const auto& arr = Uint32Arr::From(list);
|
|
|
|
if (!ValidateAttribArraySetter("vertexAttribI4uiv", 4, arr.elemCount))
|
|
|
|
return;
|
2015-03-23 04:29:32 +03:00
|
|
|
|
2016-10-14 02:15:16 +03:00
|
|
|
const auto& itr = arr.elemBytes;
|
|
|
|
VertexAttribI4ui(index, itr[0], itr[1], itr[2], itr[3]);
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
2013-07-17 17:58:09 +04:00
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Writing to the drawing buffer
|
2016-07-18 10:15:54 +03:00
|
|
|
|
|
|
|
/* Implemented in WebGLContext
|
2014-09-18 02:08:41 +04:00
|
|
|
void VertexAttribDivisor(GLuint index, GLuint divisor);
|
|
|
|
void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
|
|
|
|
void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount);
|
2016-07-18 10:15:54 +03:00
|
|
|
*/
|
2014-09-18 02:08:41 +04:00
|
|
|
|
2016-12-20 07:10:14 +03:00
|
|
|
void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
|
|
|
|
GLenum type, WebGLintptr byteOffset)
|
|
|
|
{
|
2016-12-23 02:59:45 +03:00
|
|
|
const char funcName[] = "drawRangeElements";
|
|
|
|
if (IsContextLost())
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (end < start) {
|
|
|
|
ErrorInvalidValue("%s: end must be >= start.", funcName);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
DrawElements(mode, count, type, byteOffset, funcName);
|
2016-12-20 07:10:14 +03:00
|
|
|
}
|
2014-09-18 02:08:41 +04:00
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Multiple Render Targets - WebGL2ContextMRTs.cpp
|
2016-07-18 10:15:54 +03:00
|
|
|
/* Implemented in WebGLContext
|
2014-09-18 02:08:41 +04:00
|
|
|
void DrawBuffers(const dom::Sequence<GLenum>& buffers);
|
2016-07-18 10:15:54 +03:00
|
|
|
*/
|
2014-09-18 04:17:00 +04:00
|
|
|
|
2016-10-14 03:02:48 +03:00
|
|
|
private:
|
|
|
|
bool ValidateClearBuffer(const char* funcName, GLenum buffer, GLint drawBuffer,
|
2016-12-22 13:22:12 +03:00
|
|
|
size_t availElemCount, GLuint elemOffset, GLenum funcType);
|
2014-09-18 04:17:00 +04:00
|
|
|
|
2016-10-14 03:02:48 +03:00
|
|
|
void ClearBufferfv(GLenum buffer, GLint drawBuffer, const Float32Arr& src,
|
|
|
|
GLuint srcElemOffset);
|
|
|
|
void ClearBufferiv(GLenum buffer, GLint drawBuffer, const Int32Arr& src,
|
|
|
|
GLuint srcElemOffset);
|
|
|
|
void ClearBufferuiv(GLenum buffer, GLint drawBuffer, const Uint32Arr& src,
|
|
|
|
GLuint srcElemOffset);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
2016-10-14 03:02:48 +03:00
|
|
|
public:
|
|
|
|
void ClearBufferfv(GLenum buffer, GLint drawBuffer, const Float32ListU& list,
|
|
|
|
GLuint srcElemOffset)
|
|
|
|
{
|
|
|
|
ClearBufferfv(buffer, drawBuffer, Float32Arr::From(list), srcElemOffset);
|
|
|
|
}
|
|
|
|
void ClearBufferiv(GLenum buffer, GLint drawBuffer, const Int32ListU& list,
|
|
|
|
GLuint srcElemOffset)
|
|
|
|
{
|
|
|
|
ClearBufferiv(buffer, drawBuffer, Int32Arr::From(list), srcElemOffset);
|
|
|
|
}
|
|
|
|
void ClearBufferuiv(GLenum buffer, GLint drawBuffer, const Uint32ListU& list,
|
|
|
|
GLuint srcElemOffset)
|
|
|
|
{
|
|
|
|
ClearBufferuiv(buffer, drawBuffer, Uint32Arr::From(list), srcElemOffset);
|
|
|
|
}
|
2013-07-17 17:58:09 +04:00
|
|
|
|
2016-10-14 03:02:48 +03:00
|
|
|
void ClearBufferfi(GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil);
|
2014-11-03 08:35:04 +03:00
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Sampler Objects - WebGL2ContextSamplers.cpp
|
|
|
|
|
|
|
|
already_AddRefed<WebGLSampler> CreateSampler();
|
|
|
|
void DeleteSampler(WebGLSampler* sampler);
|
2016-11-30 05:30:28 +03:00
|
|
|
bool IsSampler(const WebGLSampler* sampler);
|
2014-09-18 02:08:41 +04:00
|
|
|
void BindSampler(GLuint unit, WebGLSampler* sampler);
|
2016-11-02 00:58:07 +03:00
|
|
|
void SamplerParameteri(WebGLSampler& sampler, GLenum pname, GLint param);
|
|
|
|
void SamplerParameterf(WebGLSampler& sampler, GLenum pname, GLfloat param);
|
|
|
|
void GetSamplerParameter(JSContext*, const WebGLSampler& sampler, GLenum pname,
|
|
|
|
JS::MutableHandleValue retval);
|
2014-09-18 02:08:41 +04:00
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Sync objects - WebGL2ContextSync.cpp
|
|
|
|
|
2016-12-20 06:31:18 +03:00
|
|
|
const GLuint64 kMaxClientWaitSyncTimeoutNS = 1000 * 1000 * 1000; // 1000ms in ns.
|
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
already_AddRefed<WebGLSync> FenceSync(GLenum condition, GLbitfield flags);
|
2016-11-30 05:30:28 +03:00
|
|
|
bool IsSync(const WebGLSync* sync);
|
2014-09-18 02:08:41 +04:00
|
|
|
void DeleteSync(WebGLSync* sync);
|
2016-11-02 00:58:07 +03:00
|
|
|
GLenum ClientWaitSync(const WebGLSync& sync, GLbitfield flags, GLuint64 timeout);
|
|
|
|
void WaitSync(const WebGLSync& sync, GLbitfield flags, GLint64 timeout);
|
|
|
|
void GetSyncParameter(JSContext*, const WebGLSync& sync, GLenum pname,
|
|
|
|
JS::MutableHandleValue retval);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Transform Feedback - WebGL2ContextTransformFeedback.cpp
|
2014-11-03 08:35:04 +03:00
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
already_AddRefed<WebGLTransformFeedback> CreateTransformFeedback();
|
|
|
|
void DeleteTransformFeedback(WebGLTransformFeedback* tf);
|
2016-11-30 05:30:28 +03:00
|
|
|
bool IsTransformFeedback(const WebGLTransformFeedback* tf);
|
2014-11-26 05:00:06 +03:00
|
|
|
void BindTransformFeedback(GLenum target, WebGLTransformFeedback* tf);
|
2014-09-18 02:08:41 +04:00
|
|
|
void BeginTransformFeedback(GLenum primitiveMode);
|
|
|
|
void EndTransformFeedback();
|
|
|
|
void PauseTransformFeedback();
|
|
|
|
void ResumeTransformFeedback();
|
2016-11-02 00:58:07 +03:00
|
|
|
void TransformFeedbackVaryings(WebGLProgram& program,
|
|
|
|
const dom::Sequence<nsString>& varyings,
|
|
|
|
GLenum bufferMode);
|
|
|
|
already_AddRefed<WebGLActiveInfo>
|
|
|
|
GetTransformFeedbackVarying(const WebGLProgram& program, GLuint index);
|
2014-09-18 02:08:41 +04:00
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Uniform Buffer Objects and Transform Feedback Buffers - WebGL2ContextUniforms.cpp
|
|
|
|
// TODO(djg): Implemented in WebGLContext
|
|
|
|
/*
|
|
|
|
void BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer);
|
|
|
|
void BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer, GLintptr offset, GLsizeiptr size);
|
|
|
|
*/
|
2015-06-05 06:26:34 +03:00
|
|
|
virtual JS::Value GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) override;
|
2016-12-21 02:47:13 +03:00
|
|
|
// Make the inline version from the superclass visible here.
|
|
|
|
using WebGLContext::GetParameter;
|
2016-10-15 01:59:27 +03:00
|
|
|
void GetIndexedParameter(JSContext* cx, GLenum target, GLuint index,
|
|
|
|
JS::MutableHandleValue retval, ErrorResult& rv);
|
2016-11-02 00:58:07 +03:00
|
|
|
void GetUniformIndices(const WebGLProgram& program,
|
2014-12-16 08:20:15 +03:00
|
|
|
const dom::Sequence<nsString>& uniformNames,
|
|
|
|
dom::Nullable< nsTArray<GLuint> >& retval);
|
2016-11-02 00:58:07 +03:00
|
|
|
void GetActiveUniforms(JSContext* cx, const WebGLProgram& program,
|
|
|
|
const dom::Sequence<GLuint>& uniformIndices, GLenum pname,
|
2016-02-15 17:14:00 +03:00
|
|
|
JS::MutableHandleValue retval);
|
|
|
|
|
2016-11-02 00:58:07 +03:00
|
|
|
GLuint GetUniformBlockIndex(const WebGLProgram& program,
|
|
|
|
const nsAString& uniformBlockName);
|
|
|
|
void GetActiveUniformBlockParameter(JSContext*, const WebGLProgram& program,
|
2014-12-16 08:20:15 +03:00
|
|
|
GLuint uniformBlockIndex, GLenum pname,
|
2016-11-02 00:58:07 +03:00
|
|
|
JS::MutableHandleValue retval, ErrorResult& rv);
|
|
|
|
void GetActiveUniformBlockName(const WebGLProgram& program, GLuint uniformBlockIndex,
|
2014-12-16 08:20:15 +03:00
|
|
|
nsAString& retval);
|
2016-11-02 00:58:07 +03:00
|
|
|
void UniformBlockBinding(WebGLProgram& program, GLuint uniformBlockIndex,
|
2014-12-16 08:20:15 +03:00
|
|
|
GLuint uniformBlockBinding);
|
2014-09-18 02:08:41 +04:00
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Vertex Array Object - WebGL2ContextVAOs.cpp
|
|
|
|
// TODO(djg): Implemented in WebGLContext
|
|
|
|
/*
|
|
|
|
already_AddRefed<WebGLVertexArrayObject> CreateVertexArray();
|
|
|
|
void DeleteVertexArray(WebGLVertexArrayObject* vertexArray);
|
|
|
|
bool IsVertexArray(WebGLVertexArrayObject* vertexArray);
|
|
|
|
void BindVertexArray(WebGLVertexArrayObject* vertexArray);
|
|
|
|
*/
|
|
|
|
|
|
|
|
private:
|
|
|
|
WebGL2Context();
|
2015-11-25 07:15:29 +03:00
|
|
|
virtual UniquePtr<webgl::FormatUsageAuthority>
|
|
|
|
CreateFormatUsage(gl::GLContext* gl) const override;
|
2014-07-15 03:55:56 +04:00
|
|
|
|
2015-08-04 00:34:46 +03:00
|
|
|
virtual bool IsTexParamValid(GLenum pname) const override;
|
2014-06-24 04:56:21 +04:00
|
|
|
|
2015-04-17 04:17:07 +03:00
|
|
|
void UpdateBoundQuery(GLenum target, WebGLQuery* query);
|
|
|
|
|
2015-06-01 09:49:47 +03:00
|
|
|
// CreateVertexArrayImpl is assumed to be infallible.
|
|
|
|
virtual WebGLVertexArray* CreateVertexArrayImpl() override;
|
2013-07-17 17:58:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|