| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WebGLTransformFeedback_h | 5 #ifndef WebGLTransformFeedback_h |
| 6 #define WebGLTransformFeedback_h | 6 #define WebGLTransformFeedback_h |
| 7 | 7 |
| 8 #include "modules/webgl/WebGLProgram.h" | 8 #include "modules/webgl/WebGLProgram.h" |
| 9 #include "modules/webgl/WebGLSharedPlatform3DObject.h" | 9 #include "modules/webgl/WebGLSharedPlatform3DObject.h" |
| 10 #include "wtf/PassRefPtr.h" | 10 #include "wtf/PassRefPtr.h" |
| 11 | 11 |
| 12 namespace blink { | 12 namespace blink { |
| 13 | 13 |
| 14 class WebGL2RenderingContextBase; | 14 class WebGL2RenderingContextBase; |
| 15 class WebGLBuffer; |
| 15 | 16 |
| 16 class WebGLTransformFeedback : public WebGLSharedPlatform3DObject { | 17 class WebGLTransformFeedback : public WebGLSharedPlatform3DObject { |
| 17 DEFINE_WRAPPERTYPEINFO(); | 18 DEFINE_WRAPPERTYPEINFO(); |
| 18 | 19 |
| 19 public: | 20 public: |
| 21 enum TFType { |
| 22 TFTypeDefault, |
| 23 TFTypeUser, |
| 24 }; |
| 25 |
| 20 ~WebGLTransformFeedback() override; | 26 ~WebGLTransformFeedback() override; |
| 21 | 27 |
| 22 static WebGLTransformFeedback* create(WebGL2RenderingContextBase*); | 28 static WebGLTransformFeedback* create(WebGL2RenderingContextBase*, TFType); |
| 29 |
| 30 bool isDefaultObject() const { return m_type == TFTypeDefault; } |
| 23 | 31 |
| 24 GLenum getTarget() const { return m_target; } | 32 GLenum getTarget() const { return m_target; } |
| 25 void setTarget(GLenum); | 33 void setTarget(GLenum); |
| 26 | 34 |
| 27 bool hasEverBeenBound() const { return object() && m_target; } | 35 bool hasEverBeenBound() const { return object() && m_target; } |
| 28 | 36 |
| 29 WebGLProgram* getProgram() const { return m_program; } | 37 WebGLProgram* getProgram() const { return m_program; } |
| 30 void setProgram(WebGLProgram*); | 38 void setProgram(WebGLProgram*); |
| 31 | 39 |
| 32 DECLARE_TRACE(); | 40 // This is the generic bind point for the transform feedback buffer. |
| 41 void setBoundTransformFeedbackBuffer(WebGLBuffer*); |
| 42 WebGLBuffer* getBoundTransformFeedbackBuffer() const; |
| 43 |
| 44 // These are the indexed bind points for transform feedback buffers. |
| 45 // Returns false if index is out of range and the caller should |
| 46 // synthesize a GL error. |
| 47 bool setBoundIndexedTransformFeedbackBuffer(GLuint index, WebGLBuffer*); |
| 48 bool getBoundIndexedTransformFeedbackBuffer(GLuint index, |
| 49 WebGLBuffer** outBuffer) const; |
| 50 |
| 51 bool isBufferBoundToTransformFeedback(WebGLBuffer*); |
| 52 |
| 53 DECLARE_VIRTUAL_TRACE(); |
| 54 DECLARE_VIRTUAL_TRACE_WRAPPERS(); |
| 33 | 55 |
| 34 protected: | 56 protected: |
| 35 explicit WebGLTransformFeedback(WebGL2RenderingContextBase*); | 57 explicit WebGLTransformFeedback(WebGL2RenderingContextBase*, TFType); |
| 36 | 58 |
| 37 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override; | 59 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override; |
| 38 | 60 |
| 39 private: | 61 private: |
| 40 bool isTransformFeedback() const override { return true; } | 62 bool isTransformFeedback() const override { return true; } |
| 41 | 63 |
| 64 TFType m_type; |
| 42 GLenum m_target; | 65 GLenum m_target; |
| 43 | 66 |
| 67 TraceWrapperMember<WebGLBuffer> m_boundTransformFeedbackBuffer; |
| 68 HeapVector<TraceWrapperMember<WebGLBuffer>> |
| 69 m_boundIndexedTransformFeedbackBuffers; |
| 70 |
| 44 Member<WebGLProgram> m_program; | 71 Member<WebGLProgram> m_program; |
| 45 }; | 72 }; |
| 46 | 73 |
| 47 } // namespace blink | 74 } // namespace blink |
| 48 | 75 |
| 49 #endif // WebGLTransformFeedback_h | 76 #endif // WebGLTransformFeedback_h |
| OLD | NEW |