Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/canvas/WebGL2Context.h
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* This Source Code Form is subject to the terms of the Mozilla Public
3
 * License, v. 2.0. If a copy of the MPL was not distributed with this
4
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6
#ifndef WEBGL2CONTEXT_H_
7
#define WEBGL2CONTEXT_H_
8
9
#include "WebGLContext.h"
10
11
namespace mozilla {
12
13
class ErrorResult;
14
class WebGLSampler;
15
class WebGLSync;
16
class WebGLTransformFeedback;
17
class WebGLVertexArrayObject;
18
namespace dom {
19
class OwningUnsignedLongOrUint32ArrayOrBoolean;
20
class OwningWebGLBufferOrLongLong;
21
} // namespace dom
22
23
class WebGL2Context
24
    : public WebGLContext
25
{
26
public:
27
28
    virtual ~WebGL2Context();
29
30
    static bool IsSupported();
31
    static WebGL2Context* Create();
32
33
    virtual bool IsWebGL2() const override
34
0
    {
35
0
        return true;
36
0
    }
37
38
    // -------------------------------------------------------------------------
39
    // IMPLEMENT nsWrapperCache
40
41
    virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override;
42
43
    // -------------------------------------------------------------------------
44
    // Buffer objects - WebGL2ContextBuffers.cpp
45
46
    void CopyBufferSubData(GLenum readTarget, GLenum writeTarget,
47
                           GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
48
49
private:
50
    template<typename BufferT>
51
    void GetBufferSubDataT(GLenum target, GLintptr offset, const BufferT& data);
52
53
public:
54
    void GetBufferSubData(GLenum target, GLintptr srcByteOffset,
55
                          const dom::ArrayBufferView& dstData, GLuint dstElemOffset,
56
                          GLuint dstElemCountOverride);
57
58
    // -------------------------------------------------------------------------
59
    // Framebuffer objects - WebGL2ContextFramebuffers.cpp
60
61
    void BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
62
                         GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
63
                         GLbitfield mask, GLenum filter);
64
    void FramebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture* texture, GLint level, GLint layer);
65
66
    virtual JS::Value GetFramebufferAttachmentParameter(JSContext* cx, GLenum target,
67
                                                        GLenum attachment, GLenum pname,
68
                                                        ErrorResult& rv) override;
69
    // Make the inline version from the superclass visible here.
70
    using WebGLContext::GetFramebufferAttachmentParameter;
71
72
    void InvalidateFramebuffer(GLenum target, const dom::Sequence<GLenum>& attachments,
73
                               ErrorResult& rv);
74
    void InvalidateSubFramebuffer (GLenum target, const dom::Sequence<GLenum>& attachments, GLint x, GLint y,
75
                                   GLsizei width, GLsizei height, ErrorResult& rv);
76
    void ReadBuffer(GLenum mode);
77
78
79
    // -------------------------------------------------------------------------
80
    // Renderbuffer objects - WebGL2ContextRenderbuffers.cpp
81
82
    void GetInternalformatParameter(JSContext*, GLenum target, GLenum internalformat,
83
                                    GLenum pname, JS::MutableHandleValue retval,
84
                                    ErrorResult& rv);
85
    void RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalFormat,
86
                                        GLsizei width, GLsizei height)
87
0
    {
88
0
        const FuncScope funcScope(*this, "renderbufferStorageMultisample");
89
0
        RenderbufferStorage_base(target, samples, internalFormat, width, height);
90
0
    }
91
92
93
    // -------------------------------------------------------------------------
94
    // Texture objects - WebGL2ContextTextures.cpp
95
96
    void TexStorage2D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width,
97
                      GLsizei height)
98
0
    {
99
0
        const FuncScope funcScope(*this, "TexStorage2D");
100
0
        const uint8_t funcDims = 2;
101
0
        const GLsizei depth = 1;
102
0
        TexStorage(funcDims, target, levels, internalFormat, width, height, depth);
103
0
    }
104
105
    void TexStorage3D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width,
106
                      GLsizei height, GLsizei depth)
107
0
    {
108
0
        const FuncScope funcScope(*this, "TexStorage3D");
109
0
        const uint8_t funcDims = 3;
110
0
        TexStorage(funcDims, target, levels, internalFormat, width, height, depth);
111
0
    }
112
113
protected:
114
    void TexStorage(uint8_t funcDims, GLenum target, GLsizei levels,
115
                    GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth);
116
117
    ////////////////////////////////////
118
119
public:
120
    void CompressedTexImage3D(GLenum target, GLint level, GLenum internalFormat,
121
                              GLsizei width, GLsizei height, GLsizei depth, GLint border,
122
                              GLsizei imageSize, WebGLintptr offset)
123
0
    {
124
0
        const FuncScope funcScope(*this, "compressedTexImage3D");
125
0
        const uint8_t funcDims = 3;
126
0
        const TexImageSourceAdapter src(&offset, 0, 0);
127
0
        CompressedTexImage(funcDims, target, level, internalFormat, width,
128
0
                           height, depth, border, src, Some(imageSize));
129
0
    }
130
131
    template<typename T>
132
    void CompressedTexImage3D(GLenum target, GLint level, GLenum internalFormat,
133
                              GLsizei width, GLsizei height, GLsizei depth, GLint border,
134
                              const T& anySrc, GLuint viewElemOffset = 0,
135
                              GLuint viewElemLengthOverride = 0)
136
0
    {
137
0
        const FuncScope funcScope(*this, "compressedTexImage3D");
138
0
        const uint8_t funcDims = 3;
139
0
        const TexImageSourceAdapter src(&anySrc, viewElemOffset, viewElemLengthOverride);
140
0
        CompressedTexImage(funcDims, target, level, internalFormat, width,
141
0
                           height, depth, border, src, Nothing());
142
0
    }
143
144
    void CompressedTexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
145
                                 GLint zOffset, GLsizei width, GLsizei height,
146
                                 GLsizei depth, GLenum unpackFormat,
147
                                 GLsizei imageSize, WebGLintptr offset)
148
0
    {
149
0
        const FuncScope funcScope(*this, "compressedTexSubImage3D");
150
0
        const uint8_t funcDims = 3;
151
0
        const TexImageSourceAdapter src(&offset, 0, 0);
152
0
        CompressedTexSubImage(funcDims, target, level, xOffset, yOffset,
153
0
                              zOffset, width, height, depth, unpackFormat, src, Some(imageSize));
154
0
    }
155
156
    template<typename T>
157
    void CompressedTexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
158
                                 GLint zOffset, GLsizei width, GLsizei height,
159
                                 GLsizei depth, GLenum unpackFormat, const T& anySrc,
160
                                 GLuint viewElemOffset = 0,
161
                                 GLuint viewElemLengthOverride = 0)
162
0
    {
163
0
        const FuncScope funcScope(*this, "compressedTexSubImage3D");
164
0
        const uint8_t funcDims = 3;
165
0
        const TexImageSourceAdapter src(&anySrc, viewElemOffset, viewElemLengthOverride);
166
0
        CompressedTexSubImage(funcDims, target, level, xOffset, yOffset,
167
0
                              zOffset, width, height, depth, unpackFormat, src, Nothing());
168
0
    }
169
170
    ////////////////////////////////////
171
172
    void CopyTexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
173
                           GLint zOffset, GLint x, GLint y, GLsizei width,
174
                           GLsizei height)
175
0
    {
176
0
        const FuncScope funcScope(*this, "copyTexSubImage3D");
177
0
        const uint8_t funcDims = 3;
178
0
        CopyTexSubImage(funcDims, target, level, xOffset, yOffset, zOffset,
179
0
                        x, y, width, height);
180
0
    }
181
182
    ////////////////////////////////////
183
184
    template<typename T>
185
    void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
186
                    GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
187
                    GLenum unpackType, const T& anySrc, ErrorResult& out_error)
188
0
    {
189
0
        const TexImageSourceAdapter src(&anySrc, &out_error);
190
0
        TexImage3D(target, level, internalFormat, width, height, depth, border,
191
0
                   unpackFormat, unpackType, src);
192
0
    }
Unexecuted instantiation: void mozilla::WebGL2Context::TexImage3D<mozilla::dom::RootedSpiderMonkeyInterface<mozilla::dom::Nullable<mozilla::dom::ArrayBufferView_base<&js::UnwrapArrayBufferView, &js::GetArrayBufferViewLengthAndData, &(JS_GetArrayBufferViewType(JSObject*))> > > >(unsigned int, int, unsigned int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::RootedSpiderMonkeyInterface<mozilla::dom::Nullable<mozilla::dom::ArrayBufferView_base<&js::UnwrapArrayBufferView, &js::GetArrayBufferViewLengthAndData, &(JS_GetArrayBufferViewType(JSObject*))> > > const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexImage3D<mozilla::dom::HTMLCanvasElement>(unsigned int, int, unsigned int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::HTMLCanvasElement const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexImage3D<mozilla::dom::HTMLImageElement>(unsigned int, int, unsigned int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::HTMLImageElement const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexImage3D<mozilla::dom::HTMLVideoElement>(unsigned int, int, unsigned int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::HTMLVideoElement const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexImage3D<mozilla::dom::ImageBitmap>(unsigned int, int, unsigned int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::ImageBitmap const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexImage3D<mozilla::dom::ImageData>(unsigned int, int, unsigned int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::ImageData const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexImage3D<long>(unsigned int, int, unsigned int, int, int, int, int, unsigned int, unsigned int, long const&, mozilla::ErrorResult&)
193
194
    void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
195
                    GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
196
                    GLenum unpackType, const dom::ArrayBufferView& view,
197
                    GLuint viewElemOffset, ErrorResult&)
198
0
    {
199
0
        const TexImageSourceAdapter src(&view, viewElemOffset);
200
0
        TexImage3D(target, level, internalFormat, width, height, depth, border,
201
0
                   unpackFormat, unpackType, src);
202
0
    }
203
204
protected:
205
    void TexImage3D(GLenum target, GLint level, GLenum internalFormat, GLsizei width,
206
                    GLsizei height, GLsizei depth, GLint border, GLenum unpackFormat,
207
                    GLenum unpackType, const TexImageSource& src)
208
0
    {
209
0
        const FuncScope funcScope(*this, "texImage3D");
210
0
        const uint8_t funcDims = 3;
211
0
        TexImage(funcDims, target, level, internalFormat, width, height, depth,
212
0
                 border, unpackFormat, unpackType, src);
213
0
    }
214
215
    ////////////////////////////////////
216
217
public:
218
    template<typename T>
219
    void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
220
                       GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
221
                       GLenum unpackFormat, GLenum unpackType, const T& anySrc,
222
                       ErrorResult& out_error)
223
0
    {
224
0
        const TexImageSourceAdapter src(&anySrc, &out_error);
225
0
        TexSubImage3D(target, level, xOffset, yOffset, zOffset, width, height, depth,
226
0
                      unpackFormat, unpackType, src);
227
0
    }
Unexecuted instantiation: void mozilla::WebGL2Context::TexSubImage3D<mozilla::dom::HTMLCanvasElement>(unsigned int, int, int, int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::HTMLCanvasElement const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexSubImage3D<mozilla::dom::HTMLImageElement>(unsigned int, int, int, int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::HTMLImageElement const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexSubImage3D<mozilla::dom::HTMLVideoElement>(unsigned int, int, int, int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::HTMLVideoElement const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexSubImage3D<mozilla::dom::ImageBitmap>(unsigned int, int, int, int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::ImageBitmap const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexSubImage3D<mozilla::dom::ImageData>(unsigned int, int, int, int, int, int, int, int, unsigned int, unsigned int, mozilla::dom::ImageData const&, mozilla::ErrorResult&)
Unexecuted instantiation: void mozilla::WebGL2Context::TexSubImage3D<long>(unsigned int, int, int, int, int, int, int, int, unsigned int, unsigned int, long const&, mozilla::ErrorResult&)
228
229
    void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
230
                       GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
231
                       GLenum unpackFormat, GLenum unpackType,
232
                       const dom::Nullable<dom::ArrayBufferView>& maybeSrcView,
233
                       GLuint srcElemOffset, ErrorResult&)
234
0
    {
235
0
        const FuncScope funcScope(*this, "texSubImage3D");
236
0
        if (IsContextLost())
237
0
            return;
238
0
239
0
        if (!ValidateNonNull("src", maybeSrcView))
240
0
            return;
241
0
        const auto& srcView = maybeSrcView.Value();
242
0
243
0
        const TexImageSourceAdapter src(&srcView, srcElemOffset);
244
0
        TexSubImage3D(target, level, xOffset, yOffset, zOffset, width, height, depth,
245
0
                      unpackFormat, unpackType, src);
246
0
    }
247
248
protected:
249
    void TexSubImage3D(GLenum target, GLint level, GLint xOffset, GLint yOffset,
250
                       GLint zOffset, GLsizei width, GLsizei height, GLsizei depth,
251
                       GLenum unpackFormat, GLenum unpackType, const TexImageSource& src)
252
0
    {
253
0
        const FuncScope funcScope(*this, "texSubImage3D");
254
0
        const uint8_t funcDims = 3;
255
0
        TexSubImage(funcDims, target, level, xOffset, yOffset, zOffset, width,
256
0
                    height, depth, unpackFormat, unpackType, src);
257
0
    }
258
259
public:
260
    // -------------------------------------------------------------------------
261
    // Programs and shaders - WebGL2ContextPrograms.cpp
262
    GLint GetFragDataLocation(const WebGLProgram& program, const nsAString& name);
263
264
265
    // -------------------------------------------------------------------------
266
    // Uniforms and attributes - WebGL2ContextUniforms.cpp
267
268
    void VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride,
269
                              WebGLintptr byteOffset)
270
0
    {
271
0
        const FuncScope funcScope(*this, "vertexAttribIPointer");
272
0
        const bool isFuncInt = true;
273
0
        const bool normalized = false;
274
0
        VertexAttribAnyPointer(isFuncInt, index, size, type, normalized, stride,
275
0
                               byteOffset);
276
0
    }
277
278
    ////////////////
279
280
    // GL 3.0 & ES 3.0
281
    void VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
282
    void VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
283
284
0
    void VertexAttribI4iv(GLuint index, const Int32ListU& list) {
285
0
        const FuncScope funcScope(*this, "VertexAttribI4iv");
286
0
        const auto& arr = Int32Arr::From(list);
287
0
        if (!ValidateAttribArraySetter(4, arr.elemCount))
288
0
            return;
289
0
290
0
        const auto& itr = arr.elemBytes;
291
0
        VertexAttribI4i(index, itr[0], itr[1], itr[2], itr[3]);
292
0
    }
293
294
0
    void VertexAttribI4uiv(GLuint index, const Uint32ListU& list) {
295
0
        const FuncScope funcScope(*this, "vertexAttribI4uiv");
296
0
        const auto& arr = Uint32Arr::From(list);
297
0
        if (!ValidateAttribArraySetter(4, arr.elemCount))
298
0
            return;
299
0
300
0
        const auto& itr = arr.elemBytes;
301
0
        VertexAttribI4ui(index, itr[0], itr[1], itr[2], itr[3]);
302
0
    }
303
304
    // -------------------------------------------------------------------------
305
    // Writing to the drawing buffer
306
307
    /* Implemented in WebGLContext
308
    void VertexAttribDivisor(GLuint index, GLuint divisor);
309
    void DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
310
    void DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount);
311
    */
312
313
    void DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count,
314
                           GLenum type, WebGLintptr byteOffset)
315
0
    {
316
0
        const FuncScope funcScope(*this, "drawRangeElements");
317
0
        if (IsContextLost())
318
0
            return;
319
0
320
0
        if (end < start) {
321
0
            ErrorInvalidValue("end must be >= start.");
322
0
            return;
323
0
        }
324
0
325
0
        DrawElements(mode, count, type, byteOffset);
326
0
    }
327
328
    // ------------------------------------------------------------------------
329
    // Multiple Render Targets - WebGL2ContextMRTs.cpp
330
    /* Implemented in WebGLContext
331
    void DrawBuffers(const dom::Sequence<GLenum>& buffers);
332
    */
333
334
private:
335
    bool ValidateClearBuffer(GLenum buffer, GLint drawBuffer,
336
                             size_t availElemCount, GLuint elemOffset, GLenum funcType);
337
338
    void ClearBufferfv(GLenum buffer, GLint drawBuffer, const Float32Arr& src,
339
                       GLuint srcElemOffset);
340
    void ClearBufferiv(GLenum buffer, GLint drawBuffer, const Int32Arr& src,
341
                       GLuint srcElemOffset);
342
    void ClearBufferuiv(GLenum buffer, GLint drawBuffer, const Uint32Arr& src,
343
                        GLuint srcElemOffset);
344
345
public:
346
    void ClearBufferfv(GLenum buffer, GLint drawBuffer, const Float32ListU& list,
347
                       GLuint srcElemOffset)
348
0
    {
349
0
        ClearBufferfv(buffer, drawBuffer, Float32Arr::From(list), srcElemOffset);
350
0
    }
351
    void ClearBufferiv(GLenum buffer, GLint drawBuffer, const Int32ListU& list,
352
                       GLuint srcElemOffset)
353
0
    {
354
0
        ClearBufferiv(buffer, drawBuffer, Int32Arr::From(list), srcElemOffset);
355
0
    }
356
    void ClearBufferuiv(GLenum buffer, GLint drawBuffer, const Uint32ListU& list,
357
                        GLuint srcElemOffset)
358
0
    {
359
0
        ClearBufferuiv(buffer, drawBuffer, Uint32Arr::From(list), srcElemOffset);
360
0
    }
361
362
    void ClearBufferfi(GLenum buffer, GLint drawBuffer, GLfloat depth, GLint stencil);
363
364
    // -------------------------------------------------------------------------
365
    // Sampler Objects - WebGL2ContextSamplers.cpp
366
367
    already_AddRefed<WebGLSampler> CreateSampler();
368
    void DeleteSampler(WebGLSampler* sampler);
369
    bool IsSampler(const WebGLSampler* sampler);
370
    void BindSampler(GLuint unit, WebGLSampler* sampler);
371
    void SamplerParameteri(WebGLSampler& sampler, GLenum pname, GLint param);
372
    void SamplerParameterf(WebGLSampler& sampler, GLenum pname, GLfloat param);
373
    void GetSamplerParameter(JSContext*, const WebGLSampler& sampler, GLenum pname,
374
                             JS::MutableHandleValue retval);
375
376
377
    // -------------------------------------------------------------------------
378
    // Sync objects - WebGL2ContextSync.cpp
379
380
    const GLuint64 kMaxClientWaitSyncTimeoutNS = 1000 * 1000 * 1000; // 1000ms in ns.
381
382
    already_AddRefed<WebGLSync> FenceSync(GLenum condition, GLbitfield flags);
383
    bool IsSync(const WebGLSync* sync);
384
    void DeleteSync(WebGLSync* sync);
385
    GLenum ClientWaitSync(const WebGLSync& sync, GLbitfield flags, GLuint64 timeout);
386
    void WaitSync(const WebGLSync& sync, GLbitfield flags, GLint64 timeout);
387
    void GetSyncParameter(JSContext*, const WebGLSync& sync, GLenum pname,
388
                          JS::MutableHandleValue retval);
389
390
391
    // -------------------------------------------------------------------------
392
    // Transform Feedback - WebGL2ContextTransformFeedback.cpp
393
394
    already_AddRefed<WebGLTransformFeedback> CreateTransformFeedback();
395
    void DeleteTransformFeedback(WebGLTransformFeedback* tf);
396
    bool IsTransformFeedback(const WebGLTransformFeedback* tf);
397
    void BindTransformFeedback(GLenum target, WebGLTransformFeedback* tf);
398
    void BeginTransformFeedback(GLenum primitiveMode);
399
    void EndTransformFeedback();
400
    void PauseTransformFeedback();
401
    void ResumeTransformFeedback();
402
    void TransformFeedbackVaryings(WebGLProgram& program,
403
                                   const dom::Sequence<nsString>& varyings,
404
                                   GLenum bufferMode);
405
    already_AddRefed<WebGLActiveInfo>
406
    GetTransformFeedbackVarying(const WebGLProgram& program, GLuint index);
407
408
409
    // -------------------------------------------------------------------------
410
    // Uniform Buffer Objects and Transform Feedback Buffers - WebGL2ContextUniforms.cpp
411
    // TODO(djg): Implemented in WebGLContext
412
/*
413
    void BindBufferBase(GLenum target, GLuint index, WebGLBuffer* buffer);
414
    void BindBufferRange(GLenum target, GLuint index, WebGLBuffer* buffer, GLintptr offset, GLsizeiptr size);
415
*/
416
    virtual JS::Value GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) override;
417
    // Make the inline version from the superclass visible here.
418
    using WebGLContext::GetParameter;
419
    void GetIndexedParameter(JSContext* cx, GLenum target, GLuint index,
420
                             JS::MutableHandleValue retval, ErrorResult& rv);
421
    void GetUniformIndices(const WebGLProgram& program,
422
                           const dom::Sequence<nsString>& uniformNames,
423
                           dom::Nullable< nsTArray<GLuint> >& retval);
424
    void GetActiveUniforms(JSContext* cx, const WebGLProgram& program,
425
                           const dom::Sequence<GLuint>& uniformIndices, GLenum pname,
426
                           JS::MutableHandleValue retval);
427
428
    GLuint GetUniformBlockIndex(const WebGLProgram& program,
429
                                const nsAString& uniformBlockName);
430
    void GetActiveUniformBlockParameter(JSContext*, const WebGLProgram& program,
431
                                        GLuint uniformBlockIndex, GLenum pname,
432
                                        JS::MutableHandleValue retval, ErrorResult& rv);
433
    void GetActiveUniformBlockName(const WebGLProgram& program, GLuint uniformBlockIndex,
434
                                   nsAString& retval);
435
    void UniformBlockBinding(WebGLProgram& program, GLuint uniformBlockIndex,
436
                             GLuint uniformBlockBinding);
437
438
439
    // -------------------------------------------------------------------------
440
    // Vertex Array Object - WebGL2ContextVAOs.cpp
441
    // TODO(djg): Implemented in WebGLContext
442
/*
443
    already_AddRefed<WebGLVertexArrayObject> CreateVertexArray();
444
    void DeleteVertexArray(WebGLVertexArrayObject* vertexArray);
445
    bool IsVertexArray(WebGLVertexArrayObject* vertexArray);
446
    void BindVertexArray(WebGLVertexArrayObject* vertexArray);
447
*/
448
449
private:
450
    WebGL2Context();
451
    virtual UniquePtr<webgl::FormatUsageAuthority>
452
    CreateFormatUsage(gl::GLContext* gl) const override;
453
454
    virtual bool IsTexParamValid(GLenum pname) const override;
455
456
    void UpdateBoundQuery(GLenum target, WebGLQuery* query);
457
458
    // CreateVertexArrayImpl is assumed to be infallible.
459
    virtual WebGLVertexArray* CreateVertexArrayImpl() override;
460
};
461
462
} // namespace mozilla
463
464
#endif