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:
|
2015-04-17 04:20:22 +03:00
|
|
|
void GetBufferSubData(GLenum target, GLintptr offset,
|
2016-08-10 03:16:09 +03:00
|
|
|
const dom::ArrayBufferView& dstData);
|
2016-06-14 19:01:43 +03:00
|
|
|
void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
|
|
|
|
GLenum type, WebGLsizeiptr offset, ErrorResult& out_error);
|
2015-04-17 04:20:22 +03:00
|
|
|
|
2016-08-10 03:16:09 +03:00
|
|
|
void ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format,
|
|
|
|
GLenum type, const dom::ArrayBufferView& pixels,
|
2016-06-14 19:01:43 +03:00
|
|
|
ErrorResult& out_error)
|
|
|
|
{
|
|
|
|
WebGLContext::ReadPixels(x, y, width, height, format, type, pixels, out_error);
|
|
|
|
}
|
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;
|
|
|
|
|
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,
|
|
|
|
GLsizei height);
|
|
|
|
void TexStorage3D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width,
|
|
|
|
GLsizei height, GLsizei depth);
|
2016-08-10 03:16:09 +03:00
|
|
|
|
2015-11-25 07:15:29 +03:00
|
|
|
void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
|
|
|
|
GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
|
2016-08-10 03:16:09 +03:00
|
|
|
GLenum unpackType, const dom::Nullable<dom::ArrayBufferView>& data);
|
|
|
|
|
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-08-10 03:16:09 +03:00
|
|
|
const dom::ArrayBufferView& data, ErrorResult&);
|
2015-11-25 07:15:29 +03:00
|
|
|
void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLenum unpackFormat, GLenum unpackType,
|
2016-08-10 03:16:09 +03:00
|
|
|
const dom::ImageData& data, ErrorResult&);
|
2015-11-25 07:15:29 +03:00
|
|
|
void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLenum unpackFormat, GLenum unpackType,
|
2016-08-10 03:16:09 +03:00
|
|
|
const dom::Element& elem, ErrorResult& out_error);
|
2015-11-25 07:15:29 +03:00
|
|
|
|
|
|
|
void CopyTexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLint x, GLint y, GLsizei width,
|
|
|
|
GLsizei height);
|
|
|
|
void CompressedTexImage3D(GLenum target, GLint level, GLenum internalFormat,
|
2014-09-18 02:08:41 +04:00
|
|
|
GLsizei width, GLsizei height, GLsizei depth,
|
2016-08-10 03:16:09 +03:00
|
|
|
GLint border, const dom::ArrayBufferView& data);
|
2015-11-25 07:15:29 +03:00
|
|
|
void CompressedTexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLsizei width, GLsizei height,
|
|
|
|
GLsizei depth, GLenum sizedUnpackFormat,
|
2015-11-26 14:47:53 +03:00
|
|
|
const dom::ArrayBufferView& data);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
2016-07-07 23:02:00 +03:00
|
|
|
////////////////
|
|
|
|
// Texture PBOs
|
|
|
|
|
|
|
|
void TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
|
|
|
GLsizei width, GLsizei height, GLint border, GLenum unpackFormat,
|
|
|
|
GLenum unpackType, WebGLsizeiptr offset, ErrorResult&);
|
|
|
|
|
|
|
|
void TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLsizei width, GLsizei height, GLenum unpackFormat,
|
|
|
|
GLenum unpackType, WebGLsizeiptr offset, ErrorResult&);
|
|
|
|
|
|
|
|
void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
|
|
|
|
GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
|
|
|
|
GLenum unpackType, WebGLsizeiptr offset);
|
|
|
|
|
|
|
|
void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
|
|
|
|
GLenum unpackFormat, GLenum unpackType, WebGLsizeiptr offset,
|
|
|
|
ErrorResult&);
|
|
|
|
|
|
|
|
////////////////
|
|
|
|
// WebGL1 overloads
|
|
|
|
|
|
|
|
void
|
|
|
|
TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat, GLsizei width,
|
|
|
|
GLsizei height, GLint border, GLenum unpackFormat, GLenum unpackType,
|
|
|
|
const dom::Nullable<dom::ArrayBufferView>& pixels, ErrorResult& out_rv)
|
|
|
|
{
|
|
|
|
WebGLContext::TexImage2D(texImageTarget, level, internalFormat, width, height,
|
|
|
|
border, unpackFormat, unpackType, pixels, out_rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
void
|
|
|
|
TexImage2D(GLenum texImageTarget, GLint level, GLenum internalFormat,
|
2016-08-10 03:16:09 +03:00
|
|
|
GLenum unpackFormat, GLenum unpackType, const T& any, ErrorResult& out_rv)
|
2016-07-07 23:02:00 +03:00
|
|
|
{
|
|
|
|
WebGLContext::TexImage2D(texImageTarget, level, internalFormat, unpackFormat,
|
|
|
|
unpackType, any, out_rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
|
|
|
GLsizei width, GLsizei height, GLenum unpackFormat, GLenum unpackType,
|
2016-08-10 03:16:09 +03:00
|
|
|
const dom::ArrayBufferView& view, ErrorResult&)
|
2016-07-07 23:02:00 +03:00
|
|
|
{
|
|
|
|
WebGLContext::TexSubImage2D(texImageTarget, level, xOffset, yOffset, width,
|
2016-08-10 03:16:09 +03:00
|
|
|
height, unpackFormat, unpackType, view);
|
2016-07-07 23:02:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
inline void
|
|
|
|
TexSubImage2D(GLenum texImageTarget, GLint level, GLint xOffset, GLint yOffset,
|
2016-08-10 03:16:09 +03:00
|
|
|
GLenum unpackFormat, GLenum unpackType, const T& any,
|
|
|
|
ErrorResult& out_rv)
|
2016-07-07 23:02:00 +03:00
|
|
|
{
|
|
|
|
WebGLContext::TexSubImage2D(texImageTarget, level, xOffset, yOffset, unpackFormat,
|
|
|
|
unpackType, any, out_rv);
|
|
|
|
}
|
2014-09-18 02:08:41 +04:00
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Programs and shaders - WebGL2ContextPrograms.cpp
|
|
|
|
GLint GetFragDataLocation(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
|
|
|
|
void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
|
|
|
|
|
2015-03-23 04:29:32 +03:00
|
|
|
// GL 3.0 & ES 3.0
|
2016-07-14 22:13:47 +03:00
|
|
|
void Uniform1ui(WebGLUniformLocation* loc, GLuint v0);
|
|
|
|
void Uniform2ui(WebGLUniformLocation* loc, GLuint v0, GLuint v1);
|
|
|
|
void Uniform3ui(WebGLUniformLocation* loc, GLuint v0, GLuint v1, GLuint v2);
|
|
|
|
void Uniform4ui(WebGLUniformLocation* loc, GLuint v0, GLuint v1, GLuint v2,
|
|
|
|
GLuint v3);
|
2015-03-23 05:13:10 +03:00
|
|
|
|
2016-07-14 22:13:47 +03:00
|
|
|
////////////////
|
2015-03-23 05:13:10 +03:00
|
|
|
|
2016-07-14 22:13:47 +03:00
|
|
|
protected:
|
|
|
|
typedef Arr<GLuint, dom::Uint32Array> UintArr;
|
2015-03-23 05:13:10 +03:00
|
|
|
|
2016-07-14 22:13:47 +03:00
|
|
|
void UniformNuiv(const char* funcName, uint8_t N, WebGLUniformLocation* loc,
|
|
|
|
const UintArr& arr);
|
|
|
|
|
|
|
|
//////
|
2015-03-23 04:29:32 +03:00
|
|
|
|
|
|
|
public:
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void Uniform1uiv(WebGLUniformLocation* loc, const T& arr) {
|
|
|
|
UniformNuiv("uniform1uiv", 1, loc, UintArr(arr));
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void Uniform2uiv(WebGLUniformLocation* loc, const T& arr) {
|
|
|
|
UniformNuiv("uniform2uiv", 2, loc, UintArr(arr));
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void Uniform3uiv(WebGLUniformLocation* loc, const T& arr) {
|
|
|
|
UniformNuiv("uniform3uiv", 3, loc, UintArr(arr));
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void Uniform4uiv(WebGLUniformLocation* loc, const T& arr) {
|
|
|
|
UniformNuiv("uniform4uiv", 4, loc, UintArr(arr));
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
|
|
|
|
2016-07-14 22:13:47 +03:00
|
|
|
//////
|
2015-03-23 04:29:32 +03:00
|
|
|
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void UniformMatrix2x3fv(WebGLUniformLocation* loc, bool transpose, const T& arr) {
|
|
|
|
UniformMatrixAxBfv("uniformMatrix2x3fv", 2, 3, loc, transpose, FloatArr(arr));
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void UniformMatrix2x4fv(WebGLUniformLocation* loc, bool transpose, const T& arr) {
|
|
|
|
UniformMatrixAxBfv("uniformMatrix2x4fv", 2, 4, loc, transpose, FloatArr(arr));
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void UniformMatrix3x2fv(WebGLUniformLocation* loc, bool transpose, const T& arr) {
|
|
|
|
UniformMatrixAxBfv("uniformMatrix3x2fv", 3, 2, loc, transpose, FloatArr(arr));
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void UniformMatrix3x4fv(WebGLUniformLocation* loc, bool transpose, const T& arr) {
|
|
|
|
UniformMatrixAxBfv("uniformMatrix3x4fv", 3, 4, loc, transpose, FloatArr(arr));
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void UniformMatrix4x2fv(WebGLUniformLocation* loc, bool transpose, const T& arr) {
|
|
|
|
UniformMatrixAxBfv("uniformMatrix4x2fv", 4, 2, loc, transpose, FloatArr(arr));
|
2015-03-23 04:29:32 +03:00
|
|
|
}
|
2016-07-14 22:13:47 +03:00
|
|
|
template<typename T>
|
|
|
|
void UniformMatrix4x3fv(WebGLUniformLocation* loc, bool transpose, const T& arr) {
|
|
|
|
UniformMatrixAxBfv("uniformMatrix4x3fv", 4, 3, loc, transpose, FloatArr(arr));
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////
|
2014-09-18 02:08:41 +04:00
|
|
|
|
2014-06-24 04:56:21 +04:00
|
|
|
private:
|
|
|
|
void VertexAttribI4iv(GLuint index, size_t length, const GLint* v);
|
|
|
|
void VertexAttribI4uiv(GLuint index, size_t length, const GLuint* v);
|
|
|
|
|
|
|
|
public:
|
|
|
|
// GL 3.0 & ES 3.0
|
2014-09-18 02:08:41 +04:00
|
|
|
void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
|
|
|
|
void VertexAttribI4iv(GLuint index, const dom::Sequence<GLint>& v);
|
|
|
|
void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
|
|
|
|
void VertexAttribI4uiv(GLuint index, const dom::Sequence<GLuint>& v);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Writing to the drawing buffer
|
|
|
|
// TODO(djg): Implemented in WebGLContext
|
|
|
|
/*
|
|
|
|
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);
|
|
|
|
*/
|
|
|
|
void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset);
|
|
|
|
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Multiple Render Targets - WebGL2ContextMRTs.cpp
|
|
|
|
// TODO(djg): Implemented in WebGLContext
|
|
|
|
/*
|
|
|
|
void DrawBuffers(const dom::Sequence<GLenum>& buffers);
|
|
|
|
*/
|
2014-09-18 04:17:00 +04:00
|
|
|
|
|
|
|
void ClearBufferiv_base(GLenum buffer, GLint drawbuffer, const GLint* value);
|
|
|
|
void ClearBufferuiv_base(GLenum buffer, GLint drawbuffer, const GLuint* value);
|
|
|
|
void ClearBufferfv_base(GLenum buffer, GLint drawbuffer, const GLfloat* value);
|
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
void ClearBufferiv(GLenum buffer, GLint drawbuffer, const dom::Int32Array& value);
|
|
|
|
void ClearBufferiv(GLenum buffer, GLint drawbuffer, const dom::Sequence<GLint>& value);
|
|
|
|
void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const dom::Uint32Array& value);
|
|
|
|
void ClearBufferuiv(GLenum buffer, GLint drawbuffer, const dom::Sequence<GLuint>& value);
|
|
|
|
void ClearBufferfv(GLenum buffer, GLint drawbuffer, const dom::Float32Array& value);
|
|
|
|
void ClearBufferfv(GLenum buffer, GLint drawbuffer, const dom::Sequence<GLfloat>& value);
|
|
|
|
void ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
2014-09-18 04:17:00 +04:00
|
|
|
bool ValidateClearBuffer(const char* info, GLenum buffer, GLint drawbuffer, size_t elemCount);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
2014-11-03 08:35:04 +03:00
|
|
|
|
2013-07-17 17:58:09 +04:00
|
|
|
// -------------------------------------------------------------------------
|
2014-09-18 02:08:41 +04:00
|
|
|
// Query Objects - WebGL2ContextQueries.cpp
|
2014-11-03 08:35:04 +03:00
|
|
|
|
|
|
|
already_AddRefed<WebGLQuery> CreateQuery();
|
2014-09-18 02:08:41 +04:00
|
|
|
void DeleteQuery(WebGLQuery* query);
|
|
|
|
bool IsQuery(WebGLQuery* query);
|
|
|
|
void BeginQuery(GLenum target, WebGLQuery* query);
|
|
|
|
void EndQuery(GLenum target);
|
2014-11-03 08:35:04 +03:00
|
|
|
already_AddRefed<WebGLQuery> GetQuery(GLenum target, GLenum pname);
|
2014-09-18 02:08:41 +04:00
|
|
|
void GetQueryParameter(JSContext*, WebGLQuery* query, GLenum pname, JS::MutableHandleValue retval);
|
2013-07-17 17:58:09 +04:00
|
|
|
|
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);
|
|
|
|
bool IsSampler(WebGLSampler* sampler);
|
|
|
|
void BindSampler(GLuint unit, WebGLSampler* sampler);
|
|
|
|
void SamplerParameteri(WebGLSampler* sampler, GLenum pname, GLint param);
|
|
|
|
void SamplerParameteriv(WebGLSampler* sampler, GLenum pname, const dom::Int32Array& param);
|
|
|
|
void SamplerParameteriv(WebGLSampler* sampler, GLenum pname, const dom::Sequence<GLint>& param);
|
|
|
|
void SamplerParameterf(WebGLSampler* sampler, GLenum pname, GLfloat param);
|
|
|
|
void SamplerParameterfv(WebGLSampler* sampler, GLenum pname, const dom::Float32Array& param);
|
|
|
|
void SamplerParameterfv(WebGLSampler* sampler, GLenum pname, const dom::Sequence<GLfloat>& param);
|
|
|
|
void GetSamplerParameter(JSContext*, WebGLSampler* sampler, GLenum pname, JS::MutableHandleValue retval);
|
|
|
|
|
|
|
|
|
|
|
|
// -------------------------------------------------------------------------
|
|
|
|
// Sync objects - WebGL2ContextSync.cpp
|
|
|
|
|
|
|
|
already_AddRefed<WebGLSync> FenceSync(GLenum condition, GLbitfield flags);
|
|
|
|
bool IsSync(WebGLSync* sync);
|
|
|
|
void DeleteSync(WebGLSync* sync);
|
|
|
|
GLenum ClientWaitSync(WebGLSync* sync, GLbitfield flags, GLuint64 timeout);
|
|
|
|
void WaitSync(WebGLSync* sync, GLbitfield flags, GLuint64 timeout);
|
|
|
|
void GetSyncParameter(JSContext*, 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);
|
|
|
|
bool IsTransformFeedback(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();
|
2014-11-26 05:00:06 +03:00
|
|
|
void TransformFeedbackVaryings(WebGLProgram* program, const dom::Sequence<nsString>& varyings, GLenum bufferMode);
|
|
|
|
already_AddRefed<WebGLActiveInfo> GetTransformFeedbackVarying(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;
|
2014-12-16 08:20:15 +03:00
|
|
|
void GetIndexedParameter(GLenum target, GLuint index,
|
|
|
|
dom::Nullable<dom::OwningWebGLBufferOrLongLong>& retval);
|
|
|
|
void GetUniformIndices(WebGLProgram* program,
|
|
|
|
const dom::Sequence<nsString>& uniformNames,
|
|
|
|
dom::Nullable< nsTArray<GLuint> >& retval);
|
2016-02-15 17:14:00 +03:00
|
|
|
void GetActiveUniforms(JSContext* cx,
|
|
|
|
WebGLProgram* program,
|
|
|
|
const dom::Sequence<GLuint>& uniformIndices,
|
|
|
|
GLenum pname,
|
|
|
|
JS::MutableHandleValue retval);
|
|
|
|
|
2014-09-18 02:08:41 +04:00
|
|
|
GLuint GetUniformBlockIndex(WebGLProgram* program, const nsAString& uniformBlockName);
|
2014-12-16 08:20:15 +03:00
|
|
|
void GetActiveUniformBlockParameter(JSContext*, WebGLProgram* program,
|
|
|
|
GLuint uniformBlockIndex, GLenum pname,
|
|
|
|
dom::Nullable<dom::OwningUnsignedLongOrUint32ArrayOrBoolean>& retval,
|
|
|
|
ErrorResult& rv);
|
|
|
|
void GetActiveUniformBlockName(WebGLProgram* program, GLuint uniformBlockIndex,
|
|
|
|
nsAString& retval);
|
|
|
|
void UniformBlockBinding(WebGLProgram* program, GLuint uniformBlockIndex,
|
|
|
|
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;
|
2016-07-22 09:25:41 +03:00
|
|
|
virtual bool ValidateAttribPointerType(bool integerMode, GLenum type,
|
|
|
|
uint32_t* alignment,
|
|
|
|
const char* info) override;
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual bool ValidateBufferTarget(GLenum target, const char* info) override;
|
|
|
|
virtual bool ValidateBufferIndexedTarget(GLenum target, const char* info) override;
|
2015-02-03 05:06:20 +03:00
|
|
|
virtual bool ValidateBufferUsageEnum(GLenum usage, const char* info) override;
|
2015-04-17 04:17:07 +03:00
|
|
|
virtual bool ValidateQueryTarget(GLenum target, const char* info) override;
|
2015-03-23 04:29:32 +03:00
|
|
|
virtual bool ValidateUniformMatrixTranspose(bool transpose, const char* info) override;
|
2013-07-17 17:58:09 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|