| OLD | NEW |
| 1 /* | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 * | 3 // found in the LICENSE file. |
| 4 * Redistribution and use in source and binary forms, with or without | |
| 5 * modification, are permitted provided that the following conditions | |
| 6 * are met: | |
| 7 * 1. Redistributions of source code must retain the above copyright | |
| 8 * notice, this list of conditions and the following disclaimer. | |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | |
| 10 * notice, this list of conditions and the following disclaimer in the | |
| 11 * documentation and/or other materials provided with the distribution. | |
| 12 * | |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 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. | |
| 24 */ | |
| 25 | 4 |
| 26 #ifndef WebGLVertexArrayObjectOES_h | 5 #ifndef WebGLVertexArrayObjectBase_h |
| 27 #define WebGLVertexArrayObjectOES_h | 6 #define WebGLVertexArrayObjectBase_h |
| 28 | 7 |
| 29 #include "core/html/canvas/WebGLBuffer.h" | 8 #include "core/html/canvas/WebGLBuffer.h" |
| 30 #include "core/html/canvas/WebGLContextObject.h" | 9 #include "core/html/canvas/WebGLContextObject.h" |
| 31 #include "platform/heap/Handle.h" | 10 #include "platform/heap/Handle.h" |
| 32 #include "wtf/PassRefPtr.h" | 11 #include "wtf/PassRefPtr.h" |
| 33 | 12 |
| 34 namespace blink { | 13 namespace blink { |
| 35 | 14 |
| 36 class WebGLVertexArrayObjectOES final : public WebGLContextObject { | 15 class WebGLVertexArrayObjectBase : public WebGLContextObject { |
| 37 DEFINE_WRAPPERTYPEINFO(); | |
| 38 public: | 16 public: |
| 39 enum VaoType { | 17 enum VaoType { |
| 40 VaoTypeDefault, | 18 VaoTypeDefault, |
| 41 VaoTypeUser, | 19 VaoTypeUser, |
| 42 }; | 20 }; |
| 43 | 21 |
| 44 ~WebGLVertexArrayObjectOES() override; | 22 virtual ~WebGLVertexArrayObjectBase(); |
| 45 | |
| 46 static PassRefPtrWillBeRawPtr<WebGLVertexArrayObjectOES> create(WebGLRenderi
ngContextBase*, VaoType); | |
| 47 | 23 |
| 48 Platform3DObject object() const { return m_object; } | 24 Platform3DObject object() const { return m_object; } |
| 49 | 25 |
| 50 // Cached values for vertex attrib range checks | 26 // Cached values for vertex attrib range checks |
| 51 class VertexAttribState final : public NoBaseWillBeGarbageCollected<VertexAt
tribState> { | 27 class VertexAttribState final : public NoBaseWillBeGarbageCollected<VertexAt
tribState> { |
| 52 public: | 28 public: |
| 53 VertexAttribState() | 29 VertexAttribState() |
| 54 : enabled(false) | 30 : enabled(false) |
| 55 , bytesPerElement(0) | 31 , bytesPerElement(0) |
| 56 , size(4) | 32 , size(4) |
| (...skipping 28 matching lines...) Expand all Loading... |
| 85 PassRefPtrWillBeRawPtr<WebGLBuffer> boundElementArrayBuffer() const { return
m_boundElementArrayBuffer; } | 61 PassRefPtrWillBeRawPtr<WebGLBuffer> boundElementArrayBuffer() const { return
m_boundElementArrayBuffer; } |
| 86 void setElementArrayBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer>); | 62 void setElementArrayBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer>); |
| 87 | 63 |
| 88 VertexAttribState* getVertexAttribState(size_t); | 64 VertexAttribState* getVertexAttribState(size_t); |
| 89 void setVertexAttribState(GLuint, GLsizei, GLint, GLenum, GLboolean, GLsizei
, GLintptr, PassRefPtrWillBeRawPtr<WebGLBuffer>); | 65 void setVertexAttribState(GLuint, GLsizei, GLint, GLenum, GLboolean, GLsizei
, GLintptr, PassRefPtrWillBeRawPtr<WebGLBuffer>); |
| 90 void unbindBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer>); | 66 void unbindBuffer(PassRefPtrWillBeRawPtr<WebGLBuffer>); |
| 91 void setVertexAttribDivisor(GLuint index, GLuint divisor); | 67 void setVertexAttribDivisor(GLuint index, GLuint divisor); |
| 92 | 68 |
| 93 DECLARE_VIRTUAL_TRACE(); | 69 DECLARE_VIRTUAL_TRACE(); |
| 94 | 70 |
| 71 protected: |
| 72 WebGLVertexArrayObjectBase(WebGLRenderingContextBase*, VaoType); |
| 73 |
| 95 private: | 74 private: |
| 96 WebGLVertexArrayObjectOES(WebGLRenderingContextBase*, VaoType); | |
| 97 | |
| 98 void dispatchDetached(WebGraphicsContext3D*); | 75 void dispatchDetached(WebGraphicsContext3D*); |
| 99 bool hasObject() const override { return m_object != 0; } | 76 bool hasObject() const override { return m_object != 0; } |
| 100 void deleteObjectImpl(WebGraphicsContext3D*) override; | 77 void deleteObjectImpl(WebGraphicsContext3D*) override; |
| 101 | 78 |
| 102 Platform3DObject m_object; | 79 Platform3DObject m_object; |
| 103 | 80 |
| 104 VaoType m_type; | 81 VaoType m_type; |
| 105 bool m_hasEverBeenBound; | 82 bool m_hasEverBeenBound; |
| 106 #if ENABLE(OILPAN) | 83 #if ENABLE(OILPAN) |
| 107 bool m_destructionInProgress; | 84 bool m_destructionInProgress; |
| 108 #endif | 85 #endif |
| 109 RefPtrWillBeMember<WebGLBuffer> m_boundElementArrayBuffer; | 86 RefPtrWillBeMember<WebGLBuffer> m_boundElementArrayBuffer; |
| 110 WillBeHeapVector<OwnPtrWillBeMember<VertexAttribState>> m_vertexAttribState; | 87 WillBeHeapVector<OwnPtrWillBeMember<VertexAttribState>> m_vertexAttribState; |
| 111 }; | 88 }; |
| 112 | 89 |
| 113 } // namespace blink | 90 } // namespace blink |
| 114 | 91 |
| 115 #endif // WebGLVertexArrayObjectOES_h | 92 #endif // WebGLVertexArrayObjectBase_h |
| OLD | NEW |