| OLD | NEW |
| 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 #include "modules/webgl/WebGLVertexArrayObjectBase.h" | 5 #include "modules/webgl/WebGLVertexArrayObjectBase.h" |
| 6 | 6 |
| 7 #include "gpu/command_buffer/client/gles2_interface.h" |
| 7 #include "modules/webgl/WebGLRenderingContextBase.h" | 8 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 8 | 9 |
| 9 namespace blink { | 10 namespace blink { |
| 10 | 11 |
| 11 WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase(WebGLRenderingContextBase
* ctx, VaoType type) | 12 WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase(WebGLRenderingContextBase
* ctx, VaoType type) |
| 12 : WebGLContextObject(ctx) | 13 : WebGLContextObject(ctx) |
| 13 , m_object(0) | 14 , m_object(0) |
| 14 , m_type(type) | 15 , m_type(type) |
| 15 , m_hasEverBeenBound(false) | 16 , m_hasEverBeenBound(false) |
| 16 , m_destructionInProgress(false) | 17 , m_destructionInProgress(false) |
| 17 , m_boundElementArrayBuffer(nullptr) | 18 , m_boundElementArrayBuffer(nullptr) |
| 18 { | 19 { |
| 19 m_arrayBufferList.resize(ctx->maxVertexAttribs()); | 20 m_arrayBufferList.resize(ctx->maxVertexAttribs()); |
| 20 | 21 |
| 21 switch (m_type) { | 22 switch (m_type) { |
| 22 case VaoTypeDefault: | 23 case VaoTypeDefault: |
| 23 break; | 24 break; |
| 24 default: | 25 default: |
| 25 m_object = context()->webContext()->createVertexArrayOES(); | 26 context()->contextGL()->GenVertexArraysOES(1, &m_object); |
| 26 break; | 27 break; |
| 27 } | 28 } |
| 28 } | 29 } |
| 29 | 30 |
| 30 WebGLVertexArrayObjectBase::~WebGLVertexArrayObjectBase() | 31 WebGLVertexArrayObjectBase::~WebGLVertexArrayObjectBase() |
| 31 { | 32 { |
| 32 m_destructionInProgress = true; | 33 m_destructionInProgress = true; |
| 33 | 34 |
| 34 // Delete the platform framebuffer resource, in case | 35 // Delete the platform framebuffer resource, in case |
| 35 // where this vertex array object isn't detached when it and | 36 // where this vertex array object isn't detached when it and |
| (...skipping 12 matching lines...) Expand all Loading... |
| 48 m_arrayBufferList[i]->onDetached(context3d, gl); | 49 m_arrayBufferList[i]->onDetached(context3d, gl); |
| 49 } | 50 } |
| 50 } | 51 } |
| 51 | 52 |
| 52 void WebGLVertexArrayObjectBase::deleteObjectImpl(WebGraphicsContext3D* context3
d, gpu::gles2::GLES2Interface* gl) | 53 void WebGLVertexArrayObjectBase::deleteObjectImpl(WebGraphicsContext3D* context3
d, gpu::gles2::GLES2Interface* gl) |
| 53 { | 54 { |
| 54 switch (m_type) { | 55 switch (m_type) { |
| 55 case VaoTypeDefault: | 56 case VaoTypeDefault: |
| 56 break; | 57 break; |
| 57 default: | 58 default: |
| 58 context3d->deleteVertexArrayOES(m_object); | 59 gl->DeleteVertexArraysOES(1, &m_object); |
| 59 m_object = 0; | 60 m_object = 0; |
| 60 break; | 61 break; |
| 61 } | 62 } |
| 62 | 63 |
| 63 // Member<> objects must not be accessed during the destruction, | 64 // Member<> objects must not be accessed during the destruction, |
| 64 // since they could have been already finalized. | 65 // since they could have been already finalized. |
| 65 // The finalizers of these objects will handle their detachment | 66 // The finalizers of these objects will handle their detachment |
| 66 // by themselves. | 67 // by themselves. |
| 67 if (!m_destructionInProgress) | 68 if (!m_destructionInProgress) |
| 68 dispatchDetached(context3d, gl); | 69 dispatchDetached(context3d, gl); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 110 } |
| 110 | 111 |
| 111 DEFINE_TRACE(WebGLVertexArrayObjectBase) | 112 DEFINE_TRACE(WebGLVertexArrayObjectBase) |
| 112 { | 113 { |
| 113 visitor->trace(m_boundElementArrayBuffer); | 114 visitor->trace(m_boundElementArrayBuffer); |
| 114 visitor->trace(m_arrayBufferList); | 115 visitor->trace(m_arrayBufferList); |
| 115 WebGLContextObject::trace(visitor); | 116 WebGLContextObject::trace(visitor); |
| 116 } | 117 } |
| 117 | 118 |
| 118 } // namespace blink | 119 } // namespace blink |
| OLD | NEW |