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

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

Issue 1815803003: Move simple methods [T-Z] from WebGraphicsContext3D to GLES2Interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@simples-fplus
Patch Set: simples-tplus: fixed Created 4 years, 9 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 #include "modules/webgl/WebGLVertexArrayObjectBase.h" 5 #include "modules/webgl/WebGLVertexArrayObjectBase.h"
6 6
7 #include "modules/webgl/WebGLRenderingContextBase.h" 7 #include "modules/webgl/WebGLRenderingContextBase.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
(...skipping 20 matching lines...) Expand all
31 { 31 {
32 m_destructionInProgress = true; 32 m_destructionInProgress = true;
33 33
34 // Delete the platform framebuffer resource, in case 34 // Delete the platform framebuffer resource, in case
35 // where this vertex array object isn't detached when it and 35 // where this vertex array object isn't detached when it and
36 // the WebGLRenderingContextBase object it is registered with 36 // the WebGLRenderingContextBase object it is registered with
37 // are both finalized. 37 // are both finalized.
38 detachAndDeleteObject(); 38 detachAndDeleteObject();
39 } 39 }
40 40
41 void WebGLVertexArrayObjectBase::dispatchDetached(WebGraphicsContext3D* context3 d) 41 void WebGLVertexArrayObjectBase::dispatchDetached(WebGraphicsContext3D* context3 d, gpu::gles2::GLES2Interface* gl)
42 { 42 {
43 if (m_boundElementArrayBuffer) 43 if (m_boundElementArrayBuffer)
44 m_boundElementArrayBuffer->onDetached(context3d); 44 m_boundElementArrayBuffer->onDetached(context3d, gl);
45 45
46 for (size_t i = 0; i < m_arrayBufferList.size(); ++i) { 46 for (size_t i = 0; i < m_arrayBufferList.size(); ++i) {
47 if (m_arrayBufferList[i]) 47 if (m_arrayBufferList[i])
48 m_arrayBufferList[i]->onDetached(context3d); 48 m_arrayBufferList[i]->onDetached(context3d, gl);
49 } 49 }
50 } 50 }
51 51
52 void WebGLVertexArrayObjectBase::deleteObjectImpl(WebGraphicsContext3D* context3 d) 52 void WebGLVertexArrayObjectBase::deleteObjectImpl(WebGraphicsContext3D* context3 d, gpu::gles2::GLES2Interface* gl)
53 { 53 {
54 switch (m_type) { 54 switch (m_type) {
55 case VaoTypeDefault: 55 case VaoTypeDefault:
56 break; 56 break;
57 default: 57 default:
58 context3d->deleteVertexArrayOES(m_object); 58 context3d->deleteVertexArrayOES(m_object);
59 m_object = 0; 59 m_object = 0;
60 break; 60 break;
61 } 61 }
62 62
63 // Member<> objects must not be accessed during the destruction, 63 // Member<> objects must not be accessed during the destruction,
64 // since they could have been already finalized. 64 // since they could have been already finalized.
65 // The finalizers of these objects will handle their detachment 65 // The finalizers of these objects will handle their detachment
66 // by themselves. 66 // by themselves.
67 if (!m_destructionInProgress) 67 if (!m_destructionInProgress)
68 dispatchDetached(context3d); 68 dispatchDetached(context3d, gl);
69 } 69 }
70 70
71 void WebGLVertexArrayObjectBase::setElementArrayBuffer(WebGLBuffer* buffer) 71 void WebGLVertexArrayObjectBase::setElementArrayBuffer(WebGLBuffer* buffer)
72 { 72 {
73 if (buffer) 73 if (buffer)
74 buffer->onAttached(); 74 buffer->onAttached();
75 if (m_boundElementArrayBuffer) 75 if (m_boundElementArrayBuffer)
76 m_boundElementArrayBuffer->onDetached(context()->webContext()); 76 m_boundElementArrayBuffer->onDetached(context()->webContext(), context() ->contextGL());
77 m_boundElementArrayBuffer = buffer; 77 m_boundElementArrayBuffer = buffer;
78 } 78 }
79 79
80 WebGLBuffer* WebGLVertexArrayObjectBase::getArrayBufferForAttrib(size_t index) 80 WebGLBuffer* WebGLVertexArrayObjectBase::getArrayBufferForAttrib(size_t index)
81 { 81 {
82 ASSERT(index < context()->maxVertexAttribs()); 82 ASSERT(index < context()->maxVertexAttribs());
83 return m_arrayBufferList[index].get(); 83 return m_arrayBufferList[index].get();
84 } 84 }
85 85
86 void WebGLVertexArrayObjectBase::setArrayBufferForAttrib(GLuint index, WebGLBuff er* buffer) 86 void WebGLVertexArrayObjectBase::setArrayBufferForAttrib(GLuint index, WebGLBuff er* buffer)
87 { 87 {
88 if (buffer) 88 if (buffer)
89 buffer->onAttached(); 89 buffer->onAttached();
90 if (m_arrayBufferList[index]) 90 if (m_arrayBufferList[index])
91 m_arrayBufferList[index]->onDetached(context()->webContext()); 91 m_arrayBufferList[index]->onDetached(context()->webContext(), context()- >contextGL());
92 92
93 m_arrayBufferList[index] = buffer; 93 m_arrayBufferList[index] = buffer;
94 } 94 }
95 95
96 void WebGLVertexArrayObjectBase::unbindBuffer(WebGLBuffer* buffer) 96 void WebGLVertexArrayObjectBase::unbindBuffer(WebGLBuffer* buffer)
97 { 97 {
98 if (m_boundElementArrayBuffer == buffer) { 98 if (m_boundElementArrayBuffer == buffer) {
99 m_boundElementArrayBuffer->onDetached(context()->webContext()); 99 m_boundElementArrayBuffer->onDetached(context()->webContext(), context() ->contextGL());
100 m_boundElementArrayBuffer = nullptr; 100 m_boundElementArrayBuffer = nullptr;
101 } 101 }
102 102
103 for (size_t i = 0; i < m_arrayBufferList.size(); ++i) { 103 for (size_t i = 0; i < m_arrayBufferList.size(); ++i) {
104 if (m_arrayBufferList[i] == buffer) { 104 if (m_arrayBufferList[i] == buffer) {
105 m_arrayBufferList[i]->onDetached(context()->webContext()); 105 m_arrayBufferList[i]->onDetached(context()->webContext(), context()- >contextGL());
106 m_arrayBufferList[i] = nullptr; 106 m_arrayBufferList[i] = nullptr;
107 } 107 }
108 } 108 }
109 } 109 }
110 110
111 DEFINE_TRACE(WebGLVertexArrayObjectBase) 111 DEFINE_TRACE(WebGLVertexArrayObjectBase)
112 { 112 {
113 visitor->trace(m_boundElementArrayBuffer); 113 visitor->trace(m_boundElementArrayBuffer);
114 visitor->trace(m_arrayBufferList); 114 visitor->trace(m_arrayBufferList);
115 WebGLContextObject::trace(visitor); 115 WebGLContextObject::trace(visitor);
116 } 116 }
117 117
118 } // namespace blink 118 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698