Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLTransformFeedback.h

Issue 2773843002: Fix state management of transform feedback buffers. (Closed)
Patch Set: Implemented proper attach/detach/unbind for WebGLTransformFeedback. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/WebGLContextObject.h"
8 #include "modules/webgl/WebGLProgram.h" 9 #include "modules/webgl/WebGLProgram.h"
9 #include "modules/webgl/WebGLSharedPlatform3DObject.h"
10 #include "platform/wtf/PassRefPtr.h" 10 #include "platform/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 WebGLContextObject {
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 GLuint Object() const { return object_; }
29
30 static WebGLTransformFeedback* Create(WebGL2RenderingContextBase*, TFType);
31
32 bool IsDefaultObject() const { return type_ == TFTypeDefault; }
23 33
24 GLenum GetTarget() const { return target_; } 34 GLenum GetTarget() const { return target_; }
25 void SetTarget(GLenum); 35 void SetTarget(GLenum);
26 36
27 bool HasEverBeenBound() const { return Object() && target_; } 37 bool HasEverBeenBound() const { return object_ && target_; }
28 38
29 WebGLProgram* GetProgram() const { return program_; } 39 WebGLProgram* GetProgram() const { return program_; }
30 void SetProgram(WebGLProgram*); 40 void SetProgram(WebGLProgram*);
31 41
32 DECLARE_TRACE(); 42 // This is the generic bind point for the transform feedback buffer.
43 void SetBoundTransformFeedbackBuffer(WebGLBuffer*);
44 WebGLBuffer* GetBoundTransformFeedbackBuffer() const;
45
46 // These are the indexed bind points for transform feedback buffers.
47 // Returns false if index is out of range and the caller should
48 // synthesize a GL error.
49 bool SetBoundIndexedTransformFeedbackBuffer(GLuint index, WebGLBuffer*);
50 bool GetBoundIndexedTransformFeedbackBuffer(GLuint index,
51 WebGLBuffer** outBuffer) const;
52
53 bool IsBufferBoundToTransformFeedback(WebGLBuffer*);
54
55 void UnbindBuffer(WebGLBuffer*);
56
57 DECLARE_VIRTUAL_TRACE();
58 DECLARE_VIRTUAL_TRACE_WRAPPERS();
33 59
34 protected: 60 protected:
35 explicit WebGLTransformFeedback(WebGL2RenderingContextBase*); 61 explicit WebGLTransformFeedback(WebGL2RenderingContextBase*, TFType);
36 62
63 private:
64 void DispatchDetached(gpu::gles2::GLES2Interface*);
65 bool HasObject() const override { return object_ != 0; }
37 void DeleteObjectImpl(gpu::gles2::GLES2Interface*) override; 66 void DeleteObjectImpl(gpu::gles2::GLES2Interface*) override;
38 67
39 private: 68 GLuint object_;
40 bool IsTransformFeedback() const override { return true; }
41 69
70 TFType type_;
42 GLenum target_; 71 GLenum target_;
43 72
73 TraceWrapperMember<WebGLBuffer> bound_transform_feedback_buffer_;
74 HeapVector<TraceWrapperMember<WebGLBuffer>>
75 bound_indexed_transform_feedback_buffers_;
76
44 Member<WebGLProgram> program_; 77 Member<WebGLProgram> program_;
45 }; 78 };
46 79
47 } // namespace blink 80 } // namespace blink
48 81
49 #endif // WebGLTransformFeedback_h 82 #endif // WebGLTransformFeedback_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698