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

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

Issue 2019513004: Validate bound buffer for draw calls (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use cache Created 4 years, 6 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 WebGLVertexArrayObjectBase_h 5 #ifndef WebGLVertexArrayObjectBase_h
6 #define WebGLVertexArrayObjectBase_h 6 #define WebGLVertexArrayObjectBase_h
7 7
8 #include "bindings/core/v8/ScopedPersistent.h" 8 #include "bindings/core/v8/ScopedPersistent.h"
9 #include "modules/webgl/WebGLBuffer.h" 9 #include "modules/webgl/WebGLBuffer.h"
10 #include "modules/webgl/WebGLContextObject.h" 10 #include "modules/webgl/WebGLContextObject.h"
(...skipping 15 matching lines...) Expand all
26 bool isDefaultObject() const { return m_type == VaoTypeDefault; } 26 bool isDefaultObject() const { return m_type == VaoTypeDefault; }
27 27
28 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; } 28 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; }
29 void setHasEverBeenBound() { m_hasEverBeenBound = true; } 29 void setHasEverBeenBound() { m_hasEverBeenBound = true; }
30 30
31 WebGLBuffer* boundElementArrayBuffer() const { return m_boundElementArrayBuf fer; } 31 WebGLBuffer* boundElementArrayBuffer() const { return m_boundElementArrayBuf fer; }
32 void setElementArrayBuffer(WebGLBuffer*); 32 void setElementArrayBuffer(WebGLBuffer*);
33 33
34 WebGLBuffer* getArrayBufferForAttrib(size_t); 34 WebGLBuffer* getArrayBufferForAttrib(size_t);
35 void setArrayBufferForAttrib(GLuint, WebGLBuffer*); 35 void setArrayBufferForAttrib(GLuint, WebGLBuffer*);
36 void setAttribEnabled(GLuint, bool);
37 bool getAttribEnabled(GLuint) const;
38 bool isAllEnabledAttribBufferBound() const { return m_isAllEnabledAttribBuff erBound; }
39 void updateAttribBufferBoundStatus();
Ken Russell (switch to Gerrit) 2016/06/07 04:25:11 updateAttribBufferBoundStatus should be private, o
qiankun 2016/06/07 05:01:35 Done.
36 void unbindBuffer(WebGLBuffer*); 40 void unbindBuffer(WebGLBuffer*);
37 41
38 ScopedPersistent<v8::Array>* getPersistentCache(); 42 ScopedPersistent<v8::Array>* getPersistentCache();
39 43
40 DECLARE_VIRTUAL_TRACE(); 44 DECLARE_VIRTUAL_TRACE();
41 45
42 protected: 46 protected:
43 WebGLVertexArrayObjectBase(WebGLRenderingContextBase*, VaoType); 47 WebGLVertexArrayObjectBase(WebGLRenderingContextBase*, VaoType);
44 48
45 private: 49 private:
46 void dispatchDetached(gpu::gles2::GLES2Interface*); 50 void dispatchDetached(gpu::gles2::GLES2Interface*);
47 bool hasObject() const override { return m_object != 0; } 51 bool hasObject() const override { return m_object != 0; }
48 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override; 52 void deleteObjectImpl(gpu::gles2::GLES2Interface*) override;
49 53
50 GLuint m_object; 54 GLuint m_object;
51 55
52 VaoType m_type; 56 VaoType m_type;
53 bool m_hasEverBeenBound; 57 bool m_hasEverBeenBound;
54 bool m_destructionInProgress; 58 bool m_destructionInProgress;
55 Member<WebGLBuffer> m_boundElementArrayBuffer; 59 Member<WebGLBuffer> m_boundElementArrayBuffer;
56 HeapVector<Member<WebGLBuffer>> m_arrayBufferList; 60 HeapVector<Member<WebGLBuffer>> m_arrayBufferList;
61 Vector<bool> m_attribEnabled;
62 bool m_isAllEnabledAttribBufferBound;
57 63
58 // For preserving the wrappers of WebGLBuffer objects latched in 64 // For preserving the wrappers of WebGLBuffer objects latched in
59 // via vertexAttribPointer calls. 65 // via vertexAttribPointer calls.
60 ScopedPersistent<v8::Array> m_arrayBufferWrappers; 66 ScopedPersistent<v8::Array> m_arrayBufferWrappers;
61 }; 67 };
62 68
63 } // namespace blink 69 } // namespace blink
64 70
65 #endif // WebGLVertexArrayObjectBase_h 71 #endif // WebGLVertexArrayObjectBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698