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

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

Issue 1555523002: WebGL: remove validation code for vertexAttribPointer and vertexAttribIPointer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix errors found by trybots Created 4 years, 11 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 "modules/webgl/WebGLBuffer.h" 8 #include "modules/webgl/WebGLBuffer.h"
9 #include "modules/webgl/WebGLContextObject.h" 9 #include "modules/webgl/WebGLContextObject.h"
10 #include "platform/heap/Handle.h" 10 #include "platform/heap/Handle.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 class WebGLVertexArrayObjectBase : public WebGLContextObject { 14 class WebGLVertexArrayObjectBase : public WebGLContextObject {
15 public: 15 public:
16 enum VaoType { 16 enum VaoType {
17 VaoTypeDefault, 17 VaoTypeDefault,
18 VaoTypeUser, 18 VaoTypeUser,
19 }; 19 };
20 20
21 ~WebGLVertexArrayObjectBase() override; 21 ~WebGLVertexArrayObjectBase() override;
22 22
23 Platform3DObject object() const { return m_object; } 23 Platform3DObject object() const { return m_object; }
24 24
25 // Cached values for vertex attrib range checks 25 // Cached values for vertex attrib range checks
26 class VertexAttribState final : public GarbageCollected<VertexAttribState> { 26 class VertexAttribState final : public GarbageCollected<VertexAttribState> {
Zhenyao Mo 2016/01/05 21:13:21 Do we still need this class? Can't we just put bu
Ken Russell (switch to Gerrit) 2016/01/06 03:55:27 It looks to me like m_vertexAttribState could be c
yunchao 2016/01/06 17:31:42 Thanks for your review, Zhenyao and Ken. I have tr
27 public: 27 public:
28 VertexAttribState() 28 VertexAttribState() {}
29 : enabled(false)
30 , bytesPerElement(0)
31 , size(4)
32 , type(GL_FLOAT)
33 , normalized(false)
34 , stride(16)
35 , originalStride(0)
36 , offset(0)
37 , divisor(0)
38 {
39 }
40 29
41 DECLARE_TRACE(); 30 DECLARE_TRACE();
42 31
43 bool enabled;
44 Member<WebGLBuffer> bufferBinding; 32 Member<WebGLBuffer> bufferBinding;
45 GLsizei bytesPerElement;
46 GLint size;
47 GLenum type;
48 bool normalized;
49 GLsizei stride;
50 GLsizei originalStride;
51 GLintptr offset;
52 GLuint divisor;
53 }; 33 };
54 34
55 bool isDefaultObject() const { return m_type == VaoTypeDefault; } 35 bool isDefaultObject() const { return m_type == VaoTypeDefault; }
56 36
57 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; } 37 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; }
58 void setHasEverBeenBound() { m_hasEverBeenBound = true; } 38 void setHasEverBeenBound() { m_hasEverBeenBound = true; }
59 39
60 WebGLBuffer* boundElementArrayBuffer() const { return m_boundElementArrayBuf fer; } 40 WebGLBuffer* boundElementArrayBuffer() const { return m_boundElementArrayBuf fer; }
61 void setElementArrayBuffer(WebGLBuffer*); 41 void setElementArrayBuffer(WebGLBuffer*);
62 42
63 VertexAttribState* getVertexAttribState(size_t); 43 VertexAttribState* getVertexAttribState(size_t);
64 void setVertexAttribState(GLuint, GLsizei, GLint, GLenum, GLboolean, GLsizei , GLintptr, WebGLBuffer*); 44 void setVertexAttribState(GLuint, WebGLBuffer*);
65 void unbindBuffer(WebGLBuffer*); 45 void unbindBuffer(WebGLBuffer*);
66 void setVertexAttribDivisor(GLuint index, GLuint divisor);
67 46
68 DECLARE_VIRTUAL_TRACE(); 47 DECLARE_VIRTUAL_TRACE();
69 48
70 protected: 49 protected:
71 WebGLVertexArrayObjectBase(WebGLRenderingContextBase*, VaoType); 50 WebGLVertexArrayObjectBase(WebGLRenderingContextBase*, VaoType);
72 51
73 private: 52 private:
74 void dispatchDetached(WebGraphicsContext3D*); 53 void dispatchDetached(WebGraphicsContext3D*);
75 bool hasObject() const override { return m_object != 0; } 54 bool hasObject() const override { return m_object != 0; }
76 void deleteObjectImpl(WebGraphicsContext3D*) override; 55 void deleteObjectImpl(WebGraphicsContext3D*) override;
77 56
78 Platform3DObject m_object; 57 Platform3DObject m_object;
79 58
80 VaoType m_type; 59 VaoType m_type;
81 bool m_hasEverBeenBound; 60 bool m_hasEverBeenBound;
82 bool m_destructionInProgress; 61 bool m_destructionInProgress;
83 Member<WebGLBuffer> m_boundElementArrayBuffer; 62 Member<WebGLBuffer> m_boundElementArrayBuffer;
84 HeapVector<Member<VertexAttribState>> m_vertexAttribState; 63 HeapVector<Member<VertexAttribState>> m_vertexAttribState;
85 }; 64 };
86 65
87 } // namespace blink 66 } // namespace blink
88 67
89 #endif // WebGLVertexArrayObjectBase_h 68 #endif // WebGLVertexArrayObjectBase_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698