/src/mozilla-central/dom/canvas/WebGLTransformFeedback.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 WEBGL_TRANSFORM_FEEDBACK_H_ |
7 | | #define WEBGL_TRANSFORM_FEEDBACK_H_ |
8 | | |
9 | | #include "mozilla/LinkedList.h" |
10 | | #include "nsWrapperCache.h" |
11 | | #include "WebGLObjectModel.h" |
12 | | |
13 | | namespace mozilla { |
14 | | namespace webgl { |
15 | | struct CachedDrawFetchLimits; |
16 | | } |
17 | | |
18 | | class WebGLTransformFeedback final |
19 | | : public nsWrapperCache |
20 | | , public WebGLRefCountedObject<WebGLTransformFeedback> |
21 | | , public LinkedListElement<WebGLTransformFeedback> |
22 | | { |
23 | | friend class ScopedDrawWithTransformFeedback; |
24 | | friend class WebGLContext; |
25 | | friend class WebGL2Context; |
26 | | friend class WebGLProgram; |
27 | | |
28 | | friend const webgl::CachedDrawFetchLimits* |
29 | | ValidateDraw(WebGLContext*, GLenum, uint32_t); |
30 | | |
31 | | public: |
32 | | const GLuint mGLName; |
33 | | private: |
34 | | // GLES 3.0.4 p267, Table 6.24 "Transform Feedback State" |
35 | | // It's not yet in the ES3 spec, but the generic TF buffer bind point has been moved |
36 | | // to context state, instead of TFO state. |
37 | | std::vector<IndexedBufferBinding> mIndexedBindings; |
38 | | bool mIsPaused; |
39 | | bool mIsActive; |
40 | | // Not in state tables: |
41 | | WebGLRefPtr<WebGLProgram> mActive_Program; |
42 | | MOZ_INIT_OUTSIDE_CTOR GLenum mActive_PrimMode; |
43 | | MOZ_INIT_OUTSIDE_CTOR size_t mActive_VertPosition; |
44 | | MOZ_INIT_OUTSIDE_CTOR size_t mActive_VertCapacity; |
45 | | |
46 | | public: |
47 | | WebGLTransformFeedback(WebGLContext* webgl, GLuint tf); |
48 | | private: |
49 | | ~WebGLTransformFeedback(); |
50 | | |
51 | | public: |
52 | | NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(WebGLTransformFeedback) |
53 | | NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(WebGLTransformFeedback) |
54 | | |
55 | | void Delete(); |
56 | 0 | WebGLContext* GetParentObject() const { return mContext; } |
57 | | virtual JSObject* WrapObject(JSContext*, JS::Handle<JSObject*>) override; |
58 | | |
59 | 0 | bool IsActiveAndNotPaused() const { return mIsActive && !mIsPaused; } |
60 | | |
61 | | void AddBufferBindCounts(int8_t addVal) const; |
62 | | |
63 | | // GL Funcs |
64 | | void BeginTransformFeedback(GLenum primMode); |
65 | | void EndTransformFeedback(); |
66 | | void PauseTransformFeedback(); |
67 | | void ResumeTransformFeedback(); |
68 | | }; |
69 | | |
70 | | } // namespace mozilla |
71 | | |
72 | | #endif // WEBGL_TRANSFORM_FEEDBACK_H_ |