| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef WebGLVertexArrayObjectOES_h | 26 #ifndef WebGLVertexArrayObjectOES_h |
| 27 #define WebGLVertexArrayObjectOES_h | 27 #define WebGLVertexArrayObjectOES_h |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptWrappable.h" | 29 #include "bindings/core/v8/ScriptWrappable.h" |
| 30 #include "core/html/canvas/WebGLBuffer.h" | 30 #include "core/html/canvas/WebGLBuffer.h" |
| 31 #include "core/html/canvas/WebGLContextObject.h" | 31 #include "core/html/canvas/WebGLContextObject.h" |
| 32 #include "platform/heap/Handle.h" | 32 #include "wtf/RefCounted.h" |
| 33 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" |
| 34 #include "wtf/Vector.h" |
| 34 | 35 |
| 35 namespace blink { | 36 namespace blink { |
| 36 | 37 |
| 37 class WebGLVertexArrayObjectOES final : public WebGLContextObject, public Script
Wrappable { | 38 class WebGLVertexArrayObjectOES final : public WebGLContextObject, public Script
Wrappable { |
| 38 DEFINE_WRAPPERTYPEINFO(); | 39 DEFINE_WRAPPERTYPEINFO(); |
| 39 public: | 40 public: |
| 40 enum VaoType { | 41 enum VaoType { |
| 41 VaoTypeDefault, | 42 VaoTypeDefault, |
| 42 VaoTypeUser, | 43 VaoTypeUser, |
| 43 }; | 44 }; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 56 , size(4) | 57 , size(4) |
| 57 , type(GL_FLOAT) | 58 , type(GL_FLOAT) |
| 58 , normalized(false) | 59 , normalized(false) |
| 59 , stride(16) | 60 , stride(16) |
| 60 , originalStride(0) | 61 , originalStride(0) |
| 61 , offset(0) | 62 , offset(0) |
| 62 , divisor(0) | 63 , divisor(0) |
| 63 { | 64 { |
| 64 } | 65 } |
| 65 | 66 |
| 66 void trace(Visitor*); | |
| 67 | |
| 68 bool enabled; | 67 bool enabled; |
| 69 RefPtr<WebGLBuffer> bufferBinding; | 68 RefPtr<WebGLBuffer> bufferBinding; |
| 70 GLsizei bytesPerElement; | 69 GLsizei bytesPerElement; |
| 71 GLint size; | 70 GLint size; |
| 72 GLenum type; | 71 GLenum type; |
| 73 bool normalized; | 72 bool normalized; |
| 74 GLsizei stride; | 73 GLsizei stride; |
| 75 GLsizei originalStride; | 74 GLsizei originalStride; |
| 76 GLintptr offset; | 75 GLintptr offset; |
| 77 GLuint divisor; | 76 GLuint divisor; |
| 78 }; | 77 }; |
| 79 | 78 |
| 80 bool isDefaultObject() const { return m_type == VaoTypeDefault; } | 79 bool isDefaultObject() const { return m_type == VaoTypeDefault; } |
| 81 | 80 |
| 82 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; } | 81 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; } |
| 83 void setHasEverBeenBound() { m_hasEverBeenBound = true; } | 82 void setHasEverBeenBound() { m_hasEverBeenBound = true; } |
| 84 | 83 |
| 85 PassRefPtr<WebGLBuffer> boundElementArrayBuffer() const { return m_boundElem
entArrayBuffer; } | 84 PassRefPtr<WebGLBuffer> boundElementArrayBuffer() const { return m_boundElem
entArrayBuffer; } |
| 86 void setElementArrayBuffer(PassRefPtr<WebGLBuffer>); | 85 void setElementArrayBuffer(PassRefPtr<WebGLBuffer>); |
| 87 | 86 |
| 88 VertexAttribState& getVertexAttribState(int index) { return m_vertexAttribSt
ate[index]; } | 87 VertexAttribState& getVertexAttribState(int index) { return m_vertexAttribSt
ate[index]; } |
| 89 void setVertexAttribState(GLuint, GLsizei, GLint, GLenum, GLboolean, GLsizei
, GLintptr, PassRefPtr<WebGLBuffer>); | 88 void setVertexAttribState(GLuint, GLsizei, GLint, GLenum, GLboolean, GLsizei
, GLintptr, PassRefPtr<WebGLBuffer>); |
| 90 void unbindBuffer(PassRefPtr<WebGLBuffer>); | 89 void unbindBuffer(PassRefPtr<WebGLBuffer>); |
| 91 void setVertexAttribDivisor(GLuint index, GLuint divisor); | 90 void setVertexAttribDivisor(GLuint index, GLuint divisor); |
| 92 | 91 |
| 93 virtual void trace(Visitor*) override; | |
| 94 | |
| 95 private: | 92 private: |
| 96 WebGLVertexArrayObjectOES(WebGLRenderingContextBase*, VaoType); | 93 WebGLVertexArrayObjectOES(WebGLRenderingContextBase*, VaoType); |
| 97 | 94 |
| 98 void dispatchDetached(blink::WebGraphicsContext3D*); | 95 void dispatchDetached(blink::WebGraphicsContext3D*); |
| 99 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
) override; | 96 virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
) override; |
| 100 | 97 |
| 101 VaoType m_type; | 98 VaoType m_type; |
| 102 bool m_hasEverBeenBound; | 99 bool m_hasEverBeenBound; |
| 103 #if ENABLE(OILPAN) | 100 #if ENABLE(OILPAN) |
| 104 bool m_destructionInProgress; | 101 bool m_destructionInProgress; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 119 static const bool needsDestruction = false; | 116 static const bool needsDestruction = false; |
| 120 #endif | 117 #endif |
| 121 // Must use the constructor. | 118 // Must use the constructor. |
| 122 static const bool canInitializeWithMemset = false; | 119 static const bool canInitializeWithMemset = false; |
| 123 static const bool canCopyWithMemcpy = true; | 120 static const bool canCopyWithMemcpy = true; |
| 124 }; | 121 }; |
| 125 | 122 |
| 126 } // namespace WTF | 123 } // namespace WTF |
| 127 | 124 |
| 128 #endif // WebGLVertexArrayObjectOES_h | 125 #endif // WebGLVertexArrayObjectOES_h |
| OLD | NEW |