| 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 16 matching lines...) Expand all  Loading... | 
| 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 "platform/heap/Handle.h" | 
| 33 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" | 
| 34 | 34 | 
| 35 namespace blink { | 35 namespace blink { | 
| 36 | 36 | 
| 37 class WebGLVertexArrayObjectOES FINAL : public WebGLContextObject, public Script
     Wrappable { | 37 class WebGLVertexArrayObjectOES final : public WebGLContextObject, public Script
     Wrappable { | 
| 38     DEFINE_WRAPPERTYPEINFO(); | 38     DEFINE_WRAPPERTYPEINFO(); | 
| 39 public: | 39 public: | 
| 40     enum VaoType { | 40     enum VaoType { | 
| 41         VaoTypeDefault, | 41         VaoTypeDefault, | 
| 42         VaoTypeUser, | 42         VaoTypeUser, | 
| 43     }; | 43     }; | 
| 44 | 44 | 
| 45     virtual ~WebGLVertexArrayObjectOES(); | 45     virtual ~WebGLVertexArrayObjectOES(); | 
| 46 | 46 | 
| 47     static PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> create(WebGLRenderi
     ngContextBase*, VaoType); | 47     static PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> create(WebGLRenderi
     ngContextBase*, VaoType); | 
| 48 | 48 | 
| 49     // Cached values for vertex attrib range checks | 49     // Cached values for vertex attrib range checks | 
| 50     class VertexAttribState FINAL { | 50     class VertexAttribState final { | 
| 51         ALLOW_ONLY_INLINE_ALLOCATION(); | 51         ALLOW_ONLY_INLINE_ALLOCATION(); | 
| 52     public: | 52     public: | 
| 53         VertexAttribState() | 53         VertexAttribState() | 
| 54             : enabled(false) | 54             : enabled(false) | 
| 55             , bytesPerElement(0) | 55             , bytesPerElement(0) | 
| 56             , size(4) | 56             , size(4) | 
| 57             , type(GL_FLOAT) | 57             , type(GL_FLOAT) | 
| 58             , normalized(false) | 58             , normalized(false) | 
| 59             , stride(16) | 59             , stride(16) | 
| 60             , originalStride(0) | 60             , originalStride(0) | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 83     void setHasEverBeenBound() { m_hasEverBeenBound = true; } | 83     void setHasEverBeenBound() { m_hasEverBeenBound = true; } | 
| 84 | 84 | 
| 85     PassRefPtrWillBeRawPtr<WebGLBuffer> boundElementArrayBuffer() const { return
      m_boundElementArrayBuffer; } | 85     PassRefPtrWillBeRawPtr<WebGLBuffer> boundElementArrayBuffer() const { return
      m_boundElementArrayBuffer; } | 
| 86     void setElementArrayBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer>); | 86     void setElementArrayBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer>); | 
| 87 | 87 | 
| 88     VertexAttribState& getVertexAttribState(int index) { return m_vertexAttribSt
     ate[index]; } | 88     VertexAttribState& getVertexAttribState(int index) { return m_vertexAttribSt
     ate[index]; } | 
| 89     void setVertexAttribState(GLuint, GLsizei, GLint, GLenum, GLboolean, GLsizei
     , GLintptr, PassRefPtrWillBeRawPtr<WebGLBuffer>); | 89     void setVertexAttribState(GLuint, GLsizei, GLint, GLenum, GLboolean, GLsizei
     , GLintptr, PassRefPtrWillBeRawPtr<WebGLBuffer>); | 
| 90     void unbindBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer>); | 90     void unbindBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer>); | 
| 91     void setVertexAttribDivisor(GLuint index, GLuint divisor); | 91     void setVertexAttribDivisor(GLuint index, GLuint divisor); | 
| 92 | 92 | 
| 93     virtual void trace(Visitor*) OVERRIDE; | 93     virtual void trace(Visitor*) override; | 
| 94 | 94 | 
| 95 private: | 95 private: | 
| 96     WebGLVertexArrayObjectOES(WebGLRenderingContextBase*, VaoType); | 96     WebGLVertexArrayObjectOES(WebGLRenderingContextBase*, VaoType); | 
| 97 | 97 | 
| 98     void dispatchDetached(blink::WebGraphicsContext3D*); | 98     void dispatchDetached(blink::WebGraphicsContext3D*); | 
| 99     virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
     ) OVERRIDE; | 99     virtual void deleteObjectImpl(blink::WebGraphicsContext3D*, Platform3DObject
     ) override; | 
| 100 | 100 | 
| 101     VaoType m_type; | 101     VaoType m_type; | 
| 102     bool m_hasEverBeenBound; | 102     bool m_hasEverBeenBound; | 
| 103 #if ENABLE(OILPAN) | 103 #if ENABLE(OILPAN) | 
| 104     bool m_destructionInProgress; | 104     bool m_destructionInProgress; | 
| 105 #endif | 105 #endif | 
| 106     RefPtrWillBeMember<WebGLBuffer> m_boundElementArrayBuffer; | 106     RefPtrWillBeMember<WebGLBuffer> m_boundElementArrayBuffer; | 
| 107     WillBeHeapVector<VertexAttribState> m_vertexAttribState; | 107     WillBeHeapVector<VertexAttribState> m_vertexAttribState; | 
| 108 }; | 108 }; | 
| 109 | 109 | 
| 110 } // namespace blink | 110 } // namespace blink | 
| 111 | 111 | 
| 112 namespace WTF { | 112 namespace WTF { | 
| 113 | 113 | 
| 114 template<> | 114 template<> | 
| 115 struct VectorTraits<blink::WebGLVertexArrayObjectOES::VertexAttribState> : Simpl
     eClassVectorTraits<blink::WebGLVertexArrayObjectOES::VertexAttribState> { | 115 struct VectorTraits<blink::WebGLVertexArrayObjectOES::VertexAttribState> : Simpl
     eClassVectorTraits<blink::WebGLVertexArrayObjectOES::VertexAttribState> { | 
| 116     // Specialization needed as the VertexAttribState's struct fields | 116     // Specialization needed as the VertexAttribState's struct fields | 
| 117     // aren't handled as desired by the IsPod() trait. | 117     // aren't handled as desired by the IsPod() trait. | 
| 118 #if ENABLE(OILPAN) | 118 #if ENABLE(OILPAN) | 
| 119     static const bool needsDestruction = false; | 119     static const bool needsDestruction = false; | 
| 120 #endif | 120 #endif | 
| 121     // Must use the constructor. | 121     // Must use the constructor. | 
| 122     static const bool canInitializeWithMemset = false; | 122     static const bool canInitializeWithMemset = false; | 
| 123     static const bool canCopyWithMemcpy = true; | 123     static const bool canCopyWithMemcpy = true; | 
| 124 }; | 124 }; | 
| 125 | 125 | 
| 126 } // namespace WTF | 126 } // namespace WTF | 
| 127 | 127 | 
| 128 #endif // WebGLVertexArrayObjectOES_h | 128 #endif // WebGLVertexArrayObjectOES_h | 
| OLD | NEW | 
|---|