1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
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/. */
6 #ifndef WEBGL_TRANSFORM_FEEDBACK_H_
7 #define WEBGL_TRANSFORM_FEEDBACK_H_
9 #include "WebGLContext.h"
10 #include "WebGLObjectModel.h"
14 struct CachedDrawFetchLimits
;
17 class WebGLTransformFeedback final
: public WebGLContextBoundObject
{
18 friend class ScopedDrawWithTransformFeedback
;
19 friend class WebGLContext
;
20 friend class WebGL2Context
;
21 friend class WebGLProgram
;
23 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(WebGLTransformFeedback
, override
)
25 friend const webgl::CachedDrawFetchLimits
* ValidateDraw(WebGLContext
*, GLenum
,
30 bool mHasBeenBound
= false;
33 // GLES 3.0.4 p267, Table 6.24 "Transform Feedback State"
34 // It's not yet in the ES3 spec, but the generic TF buffer bind point has been
35 // moved to context state, instead of TFO state.
36 std::vector
<IndexedBufferBinding
> mIndexedBindings
;
39 // Not in state tables:
40 RefPtr
<WebGLProgram
> mActive_Program
;
41 MOZ_INIT_OUTSIDE_CTOR GLenum mActive_PrimMode
;
42 MOZ_INIT_OUTSIDE_CTOR
size_t mActive_VertPosition
;
43 MOZ_INIT_OUTSIDE_CTOR
size_t mActive_VertCapacity
;
46 WebGLTransformFeedback(WebGLContext
* webgl
, GLuint tf
);
49 ~WebGLTransformFeedback() override
;
52 bool IsActiveAndNotPaused() const { return mIsActive
&& !mIsPaused
; }
55 void BeginTransformFeedback(GLenum primMode
);
56 void EndTransformFeedback();
57 void PauseTransformFeedback();
58 void ResumeTransformFeedback();
61 } // namespace mozilla
63 #endif // WEBGL_TRANSFORM_FEEDBACK_H_