/src/mozilla-central/dom/canvas/WebGLExtensions.h
Line | Count | Source (jump to first uncovered line) |
1 | | /* -*- Mode: C++; tab-width: 20; 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 WEBGL_EXTENSIONS_H_ |
7 | | #define WEBGL_EXTENSIONS_H_ |
8 | | |
9 | | #include "mozilla/AlreadyAddRefed.h" |
10 | | #include "nsString.h" |
11 | | #include "nsTArray.h" |
12 | | #include "nsWrapperCache.h" |
13 | | #include "WebGLObjectModel.h" |
14 | | #include "WebGLTypes.h" |
15 | | |
16 | | namespace mozilla { |
17 | | class ErrorResult; |
18 | | |
19 | | namespace dom { |
20 | | template<typename> struct Nullable; |
21 | | template<typename> class Sequence; |
22 | | } // namespace dom |
23 | | |
24 | | namespace webgl { |
25 | | class FormatUsageAuthority; |
26 | | } // namespace webgl |
27 | | |
28 | | class WebGLContext; |
29 | | class WebGLShader; |
30 | | class WebGLQuery; |
31 | | class WebGLVertexArray; |
32 | | |
33 | | class WebGLExtensionBase |
34 | | : public nsWrapperCache |
35 | | , public WebGLContextBoundObject |
36 | | { |
37 | | public: |
38 | | explicit WebGLExtensionBase(WebGLContext* webgl); |
39 | | |
40 | 0 | WebGLContext* GetParentObject() const { |
41 | 0 | return mContext; |
42 | 0 | } |
43 | | |
44 | | void MarkLost(); |
45 | | |
46 | | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLExtensionBase) |
47 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLExtensionBase) |
48 | | |
49 | | protected: |
50 | | virtual ~WebGLExtensionBase(); |
51 | | |
52 | 0 | virtual void OnMarkLost() { } |
53 | | |
54 | | bool mIsLost; |
55 | | }; |
56 | | |
57 | | #define DECL_WEBGL_EXTENSION_GOOP \ |
58 | | virtual JSObject* WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) override; |
59 | | |
60 | | #define IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionType, WebGLBindingType)\ |
61 | | JSObject* \ |
62 | 0 | WebGLExtensionType::WrapObject(JSContext* cx, JS::Handle<JSObject*> givenProto) { \ |
63 | 0 | return dom::WebGLBindingType##_Binding::Wrap(cx, this, givenProto); \ |
64 | 0 | } Unexecuted instantiation: mozilla::WebGLExtensionBlendMinMax::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionColorBufferFloat::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionColorBufferHalfFloat::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionCompressedTextureASTC::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionCompressedTextureATC::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionCompressedTextureES3::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionCompressedTextureETC1::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionCompressedTexturePVRTC::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionCompressedTextureS3TC::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionCompressedTextureS3TC_SRGB::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionDebugRendererInfo::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionDebugShaders::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionDepthTexture::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionDisjointTimerQuery::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionDrawBuffers::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionEXTColorBufferFloat::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionElementIndexUint::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionFragDepth::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionInstancedArrays::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionLoseContext::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionMOZDebug::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionSRGB::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionShaderTextureLod::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionStandardDerivatives::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionTextureFilterAnisotropic::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionTextureFloat::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionTextureFloatLinear::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionTextureHalfFloat::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionTextureHalfFloatLinear::WrapObject(JSContext*, JS::Handle<JSObject*>) Unexecuted instantiation: mozilla::WebGLExtensionVertexArray::WrapObject(JSContext*, JS::Handle<JSObject*>) |
65 | | |
66 | | //// |
67 | | |
68 | | class WebGLExtensionCompressedTextureASTC |
69 | | : public WebGLExtensionBase |
70 | | { |
71 | | public: |
72 | | explicit WebGLExtensionCompressedTextureASTC(WebGLContext* webgl); |
73 | | virtual ~WebGLExtensionCompressedTextureASTC(); |
74 | | |
75 | | void GetSupportedProfiles(dom::Nullable< nsTArray<nsString> >& retval) const; |
76 | | |
77 | | static bool IsSupported(const WebGLContext* webgl); |
78 | | |
79 | | DECL_WEBGL_EXTENSION_GOOP |
80 | | }; |
81 | | |
82 | | class WebGLExtensionCompressedTextureATC |
83 | | : public WebGLExtensionBase |
84 | | { |
85 | | public: |
86 | | explicit WebGLExtensionCompressedTextureATC(WebGLContext*); |
87 | | virtual ~WebGLExtensionCompressedTextureATC(); |
88 | | |
89 | | DECL_WEBGL_EXTENSION_GOOP |
90 | | }; |
91 | | |
92 | | class WebGLExtensionCompressedTextureES3 |
93 | | : public WebGLExtensionBase |
94 | | { |
95 | | public: |
96 | | explicit WebGLExtensionCompressedTextureES3(WebGLContext*); |
97 | | virtual ~WebGLExtensionCompressedTextureES3(); |
98 | | |
99 | | DECL_WEBGL_EXTENSION_GOOP |
100 | | }; |
101 | | |
102 | | class WebGLExtensionCompressedTextureETC1 |
103 | | : public WebGLExtensionBase |
104 | | { |
105 | | public: |
106 | | explicit WebGLExtensionCompressedTextureETC1(WebGLContext*); |
107 | | virtual ~WebGLExtensionCompressedTextureETC1(); |
108 | | |
109 | | DECL_WEBGL_EXTENSION_GOOP |
110 | | }; |
111 | | |
112 | | class WebGLExtensionCompressedTexturePVRTC |
113 | | : public WebGLExtensionBase |
114 | | { |
115 | | public: |
116 | | explicit WebGLExtensionCompressedTexturePVRTC(WebGLContext*); |
117 | | virtual ~WebGLExtensionCompressedTexturePVRTC(); |
118 | | |
119 | | DECL_WEBGL_EXTENSION_GOOP |
120 | | }; |
121 | | |
122 | | class WebGLExtensionCompressedTextureS3TC |
123 | | : public WebGLExtensionBase |
124 | | { |
125 | | public: |
126 | | explicit WebGLExtensionCompressedTextureS3TC(WebGLContext*); |
127 | | virtual ~WebGLExtensionCompressedTextureS3TC(); |
128 | | |
129 | | static bool IsSupported(const WebGLContext*); |
130 | | |
131 | | DECL_WEBGL_EXTENSION_GOOP |
132 | | }; |
133 | | |
134 | | class WebGLExtensionCompressedTextureS3TC_SRGB |
135 | | : public WebGLExtensionBase |
136 | | { |
137 | | public: |
138 | | explicit WebGLExtensionCompressedTextureS3TC_SRGB(WebGLContext*); |
139 | | virtual ~WebGLExtensionCompressedTextureS3TC_SRGB(); |
140 | | |
141 | | static bool IsSupported(const WebGLContext*); |
142 | | |
143 | | DECL_WEBGL_EXTENSION_GOOP |
144 | | }; |
145 | | |
146 | | class WebGLExtensionDebugRendererInfo |
147 | | : public WebGLExtensionBase |
148 | | { |
149 | | public: |
150 | | explicit WebGLExtensionDebugRendererInfo(WebGLContext*); |
151 | | virtual ~WebGLExtensionDebugRendererInfo(); |
152 | | |
153 | | DECL_WEBGL_EXTENSION_GOOP |
154 | | }; |
155 | | |
156 | | class WebGLExtensionDebugShaders |
157 | | : public WebGLExtensionBase |
158 | | { |
159 | | public: |
160 | | explicit WebGLExtensionDebugShaders(WebGLContext*); |
161 | | virtual ~WebGLExtensionDebugShaders(); |
162 | | |
163 | | void GetTranslatedShaderSource(const WebGLShader& shader, nsAString& retval) const; |
164 | | |
165 | | DECL_WEBGL_EXTENSION_GOOP |
166 | | }; |
167 | | |
168 | | class WebGLExtensionDepthTexture |
169 | | : public WebGLExtensionBase |
170 | | { |
171 | | public: |
172 | | explicit WebGLExtensionDepthTexture(WebGLContext*); |
173 | | virtual ~WebGLExtensionDepthTexture(); |
174 | | |
175 | | DECL_WEBGL_EXTENSION_GOOP |
176 | | }; |
177 | | |
178 | | class WebGLExtensionElementIndexUint |
179 | | : public WebGLExtensionBase |
180 | | { |
181 | | public: |
182 | | explicit WebGLExtensionElementIndexUint(WebGLContext*); |
183 | | virtual ~WebGLExtensionElementIndexUint(); |
184 | | |
185 | | DECL_WEBGL_EXTENSION_GOOP |
186 | | }; |
187 | | |
188 | | class WebGLExtensionEXTColorBufferFloat |
189 | | : public WebGLExtensionBase |
190 | | { |
191 | | public: |
192 | | explicit WebGLExtensionEXTColorBufferFloat(WebGLContext*); |
193 | 0 | virtual ~WebGLExtensionEXTColorBufferFloat() { } |
194 | | |
195 | | static bool IsSupported(const WebGLContext*); |
196 | | |
197 | | DECL_WEBGL_EXTENSION_GOOP |
198 | | }; |
199 | | |
200 | | class WebGLExtensionFragDepth |
201 | | : public WebGLExtensionBase |
202 | | { |
203 | | public: |
204 | | explicit WebGLExtensionFragDepth(WebGLContext*); |
205 | | virtual ~WebGLExtensionFragDepth(); |
206 | | |
207 | | static bool IsSupported(const WebGLContext* context); |
208 | | |
209 | | DECL_WEBGL_EXTENSION_GOOP |
210 | | }; |
211 | | |
212 | | class WebGLExtensionLoseContext |
213 | | : public WebGLExtensionBase |
214 | | { |
215 | | public: |
216 | | explicit WebGLExtensionLoseContext(WebGLContext*); |
217 | | virtual ~WebGLExtensionLoseContext(); |
218 | | |
219 | | void LoseContext(); |
220 | | void RestoreContext(); |
221 | | |
222 | | DECL_WEBGL_EXTENSION_GOOP |
223 | | }; |
224 | | |
225 | | class WebGLExtensionSRGB |
226 | | : public WebGLExtensionBase |
227 | | { |
228 | | public: |
229 | | explicit WebGLExtensionSRGB(WebGLContext*); |
230 | | virtual ~WebGLExtensionSRGB(); |
231 | | |
232 | | static bool IsSupported(const WebGLContext* context); |
233 | | |
234 | | DECL_WEBGL_EXTENSION_GOOP |
235 | | }; |
236 | | |
237 | | class WebGLExtensionStandardDerivatives |
238 | | : public WebGLExtensionBase |
239 | | { |
240 | | public: |
241 | | explicit WebGLExtensionStandardDerivatives(WebGLContext*); |
242 | | virtual ~WebGLExtensionStandardDerivatives(); |
243 | | |
244 | | DECL_WEBGL_EXTENSION_GOOP |
245 | | }; |
246 | | |
247 | | class WebGLExtensionShaderTextureLod |
248 | | : public WebGLExtensionBase |
249 | | { |
250 | | public: |
251 | | explicit WebGLExtensionShaderTextureLod(WebGLContext*); |
252 | | virtual ~WebGLExtensionShaderTextureLod(); |
253 | | |
254 | | DECL_WEBGL_EXTENSION_GOOP |
255 | | }; |
256 | | |
257 | | class WebGLExtensionTextureFilterAnisotropic |
258 | | : public WebGLExtensionBase |
259 | | { |
260 | | public: |
261 | | explicit WebGLExtensionTextureFilterAnisotropic(WebGLContext*); |
262 | | virtual ~WebGLExtensionTextureFilterAnisotropic(); |
263 | | |
264 | | DECL_WEBGL_EXTENSION_GOOP |
265 | | }; |
266 | | |
267 | | class WebGLExtensionTextureFloat |
268 | | : public WebGLExtensionBase |
269 | | { |
270 | | public: |
271 | | static void InitWebGLFormats(webgl::FormatUsageAuthority* authority); |
272 | | |
273 | | explicit WebGLExtensionTextureFloat(WebGLContext*); |
274 | | virtual ~WebGLExtensionTextureFloat(); |
275 | | |
276 | | static bool IsSupported(const WebGLContext*); |
277 | | |
278 | | DECL_WEBGL_EXTENSION_GOOP |
279 | | }; |
280 | | |
281 | | class WebGLExtensionTextureFloatLinear |
282 | | : public WebGLExtensionBase |
283 | | { |
284 | | public: |
285 | | explicit WebGLExtensionTextureFloatLinear(WebGLContext*); |
286 | | virtual ~WebGLExtensionTextureFloatLinear(); |
287 | | |
288 | | DECL_WEBGL_EXTENSION_GOOP |
289 | | }; |
290 | | |
291 | | class WebGLExtensionTextureHalfFloat |
292 | | : public WebGLExtensionBase |
293 | | { |
294 | | public: |
295 | | static void InitWebGLFormats(webgl::FormatUsageAuthority* authority); |
296 | | |
297 | | explicit WebGLExtensionTextureHalfFloat(WebGLContext*); |
298 | | virtual ~WebGLExtensionTextureHalfFloat(); |
299 | | |
300 | | static bool IsSupported(const WebGLContext*); |
301 | | |
302 | | DECL_WEBGL_EXTENSION_GOOP |
303 | | }; |
304 | | |
305 | | class WebGLExtensionTextureHalfFloatLinear |
306 | | : public WebGLExtensionBase |
307 | | { |
308 | | public: |
309 | | explicit WebGLExtensionTextureHalfFloatLinear(WebGLContext*); |
310 | | virtual ~WebGLExtensionTextureHalfFloatLinear(); |
311 | | |
312 | | DECL_WEBGL_EXTENSION_GOOP |
313 | | }; |
314 | | |
315 | | class WebGLExtensionColorBufferFloat |
316 | | : public WebGLExtensionBase |
317 | | { |
318 | | public: |
319 | | explicit WebGLExtensionColorBufferFloat(WebGLContext*); |
320 | | virtual ~WebGLExtensionColorBufferFloat(); |
321 | | |
322 | | static bool IsSupported(const WebGLContext*); |
323 | | |
324 | | DECL_WEBGL_EXTENSION_GOOP |
325 | | }; |
326 | | |
327 | | class WebGLExtensionColorBufferHalfFloat |
328 | | : public WebGLExtensionBase |
329 | | { |
330 | | public: |
331 | | explicit WebGLExtensionColorBufferHalfFloat(WebGLContext*); |
332 | | virtual ~WebGLExtensionColorBufferHalfFloat(); |
333 | | |
334 | | static bool IsSupported(const WebGLContext*); |
335 | | |
336 | | DECL_WEBGL_EXTENSION_GOOP |
337 | | }; |
338 | | |
339 | | class WebGLExtensionDrawBuffers |
340 | | : public WebGLExtensionBase |
341 | | { |
342 | | public: |
343 | | explicit WebGLExtensionDrawBuffers(WebGLContext*); |
344 | | virtual ~WebGLExtensionDrawBuffers(); |
345 | | |
346 | | void DrawBuffersWEBGL(const dom::Sequence<GLenum>& buffers); |
347 | | |
348 | | static bool IsSupported(const WebGLContext*); |
349 | | |
350 | | DECL_WEBGL_EXTENSION_GOOP |
351 | | }; |
352 | | |
353 | | class WebGLExtensionVertexArray |
354 | | : public WebGLExtensionBase |
355 | | { |
356 | | public: |
357 | | explicit WebGLExtensionVertexArray(WebGLContext* webgl); |
358 | | virtual ~WebGLExtensionVertexArray(); |
359 | | |
360 | | already_AddRefed<WebGLVertexArray> CreateVertexArrayOES(); |
361 | | void DeleteVertexArrayOES(WebGLVertexArray* array); |
362 | | bool IsVertexArrayOES(const WebGLVertexArray* array); |
363 | | void BindVertexArrayOES(WebGLVertexArray* array); |
364 | | |
365 | | DECL_WEBGL_EXTENSION_GOOP |
366 | | }; |
367 | | |
368 | | class WebGLExtensionInstancedArrays |
369 | | : public WebGLExtensionBase |
370 | | { |
371 | | public: |
372 | | explicit WebGLExtensionInstancedArrays(WebGLContext* webgl); |
373 | | virtual ~WebGLExtensionInstancedArrays(); |
374 | | |
375 | | void DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, |
376 | | GLsizei primcount); |
377 | | void DrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, |
378 | | WebGLintptr offset, GLsizei primcount); |
379 | | void VertexAttribDivisorANGLE(GLuint index, GLuint divisor); |
380 | | |
381 | | static bool IsSupported(const WebGLContext* webgl); |
382 | | |
383 | | DECL_WEBGL_EXTENSION_GOOP |
384 | | }; |
385 | | |
386 | | class WebGLExtensionBlendMinMax |
387 | | : public WebGLExtensionBase |
388 | | { |
389 | | public: |
390 | | explicit WebGLExtensionBlendMinMax(WebGLContext* webgl); |
391 | | virtual ~WebGLExtensionBlendMinMax(); |
392 | | |
393 | | static bool IsSupported(const WebGLContext*); |
394 | | |
395 | | DECL_WEBGL_EXTENSION_GOOP |
396 | | }; |
397 | | |
398 | | class WebGLExtensionDisjointTimerQuery |
399 | | : public WebGLExtensionBase |
400 | | { |
401 | | public: |
402 | | explicit WebGLExtensionDisjointTimerQuery(WebGLContext* webgl); |
403 | | virtual ~WebGLExtensionDisjointTimerQuery(); |
404 | | |
405 | | already_AddRefed<WebGLQuery> CreateQueryEXT() const; |
406 | | void DeleteQueryEXT(WebGLQuery* query) const; |
407 | | bool IsQueryEXT(const WebGLQuery* query) const; |
408 | | void BeginQueryEXT(GLenum target, WebGLQuery& query) const; |
409 | | void EndQueryEXT(GLenum target) const; |
410 | | void QueryCounterEXT(WebGLQuery& query, GLenum target) const; |
411 | | void GetQueryEXT(JSContext* cx, GLenum target, GLenum pname, |
412 | | JS::MutableHandleValue retval) const; |
413 | | void GetQueryObjectEXT(JSContext* cx, const WebGLQuery& query, |
414 | | GLenum pname, JS::MutableHandleValue retval) const; |
415 | | |
416 | | static bool IsSupported(const WebGLContext*); |
417 | | |
418 | | DECL_WEBGL_EXTENSION_GOOP |
419 | | }; |
420 | | |
421 | | class WebGLExtensionMOZDebug final |
422 | | : public WebGLExtensionBase |
423 | | { |
424 | | public: |
425 | | explicit WebGLExtensionMOZDebug(WebGLContext* webgl); |
426 | | virtual ~WebGLExtensionMOZDebug(); |
427 | | |
428 | | void GetParameter(JSContext* cx, GLenum pname, |
429 | | JS::MutableHandle<JS::Value> retval, ErrorResult& er) const; |
430 | | |
431 | | DECL_WEBGL_EXTENSION_GOOP |
432 | | }; |
433 | | |
434 | | } // namespace mozilla |
435 | | |
436 | | #endif // WEBGL_EXTENSIONS_H_ |