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

Side by Side Diff: Source/core/html/canvas/WebGLVertexArrayObjectOES.cpp

Issue 127163003: Completely removed the Extensions3D class (Take 2) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.cpp ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 10 matching lines...) Expand all
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 #include "config.h" 26 #include "config.h"
27 27
28 #include "core/html/canvas/WebGLVertexArrayObjectOES.h" 28 #include "core/html/canvas/WebGLVertexArrayObjectOES.h"
29 29
30 #include "core/html/canvas/WebGLRenderingContext.h" 30 #include "core/html/canvas/WebGLRenderingContext.h"
31 #include "platform/graphics/Extensions3D.h"
32 31
33 namespace WebCore { 32 namespace WebCore {
34 33
35 PassRefPtr<WebGLVertexArrayObjectOES> WebGLVertexArrayObjectOES::create(WebGLRen deringContext* ctx, VaoType type) 34 PassRefPtr<WebGLVertexArrayObjectOES> WebGLVertexArrayObjectOES::create(WebGLRen deringContext* ctx, VaoType type)
36 { 35 {
37 return adoptRef(new WebGLVertexArrayObjectOES(ctx, type)); 36 return adoptRef(new WebGLVertexArrayObjectOES(ctx, type));
38 } 37 }
39 38
40 WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContext* ctx, VaoType type) 39 WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContext* ctx, VaoType type)
41 : WebGLContextObject(ctx) 40 : WebGLContextObject(ctx)
42 , m_type(type) 41 , m_type(type)
43 , m_hasEverBeenBound(false) 42 , m_hasEverBeenBound(false)
44 , m_boundElementArrayBuffer(0) 43 , m_boundElementArrayBuffer(0)
45 { 44 {
46 ScriptWrappable::init(this); 45 ScriptWrappable::init(this);
47 m_vertexAttribState.resize(ctx->maxVertexAttribs()); 46 m_vertexAttribState.resize(ctx->maxVertexAttribs());
48 47
49 Extensions3D* extensions = context()->graphicsContext3D()->extensions();
50 switch (m_type) { 48 switch (m_type) {
51 case VaoTypeDefault: 49 case VaoTypeDefault:
52 break; 50 break;
53 default: 51 default:
54 setObject(extensions->createVertexArrayOES()); 52 setObject(context()->webGraphicsContext3D()->createVertexArrayOES());
55 break; 53 break;
56 } 54 }
57 } 55 }
58 56
59 WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES() 57 WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES()
60 { 58 {
61 deleteObject(0); 59 deleteObject(0);
62 } 60 }
63 61
64 void WebGLVertexArrayObjectOES::deleteObjectImpl(GraphicsContext3D* context3d, P latform3DObject object) 62 void WebGLVertexArrayObjectOES::deleteObjectImpl(GraphicsContext3D* context3d, P latform3DObject object)
65 { 63 {
66 Extensions3D* extensions = context3d->extensions();
67 switch (m_type) { 64 switch (m_type) {
68 case VaoTypeDefault: 65 case VaoTypeDefault:
69 break; 66 break;
70 default: 67 default:
71 extensions->deleteVertexArrayOES(object); 68 context()->webGraphicsContext3D()->deleteVertexArrayOES(object);
72 break; 69 break;
73 } 70 }
74 71
75 if (m_boundElementArrayBuffer) 72 if (m_boundElementArrayBuffer)
76 m_boundElementArrayBuffer->onDetached(context3d); 73 m_boundElementArrayBuffer->onDetached(context3d);
77 74
78 for (size_t i = 0; i < m_vertexAttribState.size(); ++i) { 75 for (size_t i = 0; i < m_vertexAttribState.size(); ++i) {
79 VertexAttribState& state = m_vertexAttribState[i]; 76 VertexAttribState& state = m_vertexAttribState[i];
80 if (state.bufferBinding) 77 if (state.bufferBinding)
81 state.bufferBinding->onDetached(context3d); 78 state.bufferBinding->onDetached(context3d);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 127 }
131 } 128 }
132 129
133 void WebGLVertexArrayObjectOES::setVertexAttribDivisor(GLuint index, GLuint divi sor) 130 void WebGLVertexArrayObjectOES::setVertexAttribDivisor(GLuint index, GLuint divi sor)
134 { 131 {
135 VertexAttribState& state = m_vertexAttribState[index]; 132 VertexAttribState& state = m_vertexAttribState[index];
136 state.divisor = divisor; 133 state.divisor = divisor;
137 } 134 }
138 135
139 } 136 }
OLDNEW
« no previous file with comments | « Source/core/html/canvas/WebGLRenderingContext.cpp ('k') | Source/core/testing/Internals.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698