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

Side by Side Diff: Source/core/html/canvas/OESVertexArrayObject.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
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 12 matching lines...) Expand all
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/OESVertexArrayObject.h" 28 #include "core/html/canvas/OESVertexArrayObject.h"
29 29
30 #include "bindings/v8/ExceptionState.h" 30 #include "bindings/v8/ExceptionState.h"
31 #include "core/html/canvas/WebGLRenderingContext.h" 31 #include "core/html/canvas/WebGLRenderingContext.h"
32 #include "core/html/canvas/WebGLVertexArrayObjectOES.h" 32 #include "core/html/canvas/WebGLVertexArrayObjectOES.h"
33 #include "platform/graphics/Extensions3D.h"
34 33
35 namespace WebCore { 34 namespace WebCore {
36 35
37 OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContext* context) 36 OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContext* context)
38 : WebGLExtension(context) 37 : WebGLExtension(context)
39 { 38 {
40 ScriptWrappable::init(this); 39 ScriptWrappable::init(this);
41 context->graphicsContext3D()->extensions()->ensureEnabled("GL_OES_vertex_arr ay_object"); 40 context->graphicsContext3D()->ensureExtensionEnabled("GL_OES_vertex_array_ob ject");
42 } 41 }
43 42
44 OESVertexArrayObject::~OESVertexArrayObject() 43 OESVertexArrayObject::~OESVertexArrayObject()
45 { 44 {
46 } 45 }
47 46
48 WebGLExtension::ExtensionName OESVertexArrayObject::name() const 47 WebGLExtension::ExtensionName OESVertexArrayObject::name() const
49 { 48 {
50 return OESVertexArrayObjectName; 49 return OESVertexArrayObjectName;
51 } 50 }
(...skipping 25 matching lines...) Expand all
77 } 76 }
78 77
79 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra yObject) 78 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra yObject)
80 { 79 {
81 if (!arrayObject || isLost()) 80 if (!arrayObject || isLost())
82 return 0; 81 return 0;
83 82
84 if (!arrayObject->hasEverBeenBound()) 83 if (!arrayObject->hasEverBeenBound())
85 return 0; 84 return 0;
86 85
87 Extensions3D* extensions = m_context->graphicsContext3D()->extensions(); 86 return m_context->webGraphicsContext3D()->isVertexArrayOES(arrayObject->obje ct());
88 return extensions->isVertexArrayOES(arrayObject->object());
89 } 87 }
90 88
91 void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayOb ject) 89 void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayOb ject)
92 { 90 {
93 if (isLost()) 91 if (isLost())
94 return; 92 return;
95 93
96 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, co ntext()))) { 94 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, co ntext()))) {
97 m_context->graphicsContext3D()->synthesizeGLError(GL_INVALID_OPERATION); 95 m_context->webGraphicsContext3D()->synthesizeGLError(GL_INVALID_OPERATIO N);
98 return; 96 return;
99 } 97 }
100 98
101 Extensions3D* extensions = m_context->graphicsContext3D()->extensions();
102 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) { 99 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) {
103 extensions->bindVertexArrayOES(arrayObject->object()); 100 m_context->webGraphicsContext3D()->bindVertexArrayOES(arrayObject->objec t());
104 101
105 arrayObject->setHasEverBeenBound(); 102 arrayObject->setHasEverBeenBound();
106 m_context->setBoundVertexArrayObject(arrayObject); 103 m_context->setBoundVertexArrayObject(arrayObject);
107 } else { 104 } else {
108 extensions->bindVertexArrayOES(0); 105 m_context->webGraphicsContext3D()->bindVertexArrayOES(0);
109 m_context->setBoundVertexArrayObject(0); 106 m_context->setBoundVertexArrayObject(0);
110 } 107 }
111 } 108 }
112 109
113 bool OESVertexArrayObject::supported(WebGLRenderingContext* context) 110 bool OESVertexArrayObject::supported(WebGLRenderingContext* context)
114 { 111 {
115 Extensions3D* extensions = context->graphicsContext3D()->extensions(); 112 return context->graphicsContext3D()->supportsExtension("GL_OES_vertex_array_ object");
116 return extensions->supports("GL_OES_vertex_array_object");
117 } 113 }
118 114
119 const char* OESVertexArrayObject::extensionName() 115 const char* OESVertexArrayObject::extensionName()
120 { 116 {
121 return "OES_vertex_array_object"; 117 return "OES_vertex_array_object";
122 } 118 }
123 119
124 } // namespace WebCore 120 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/canvas/OESVertexArrayObject.h ('k') | Source/core/html/canvas/WebGLCompressedTextureATC.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698