Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 18 matching lines...) Expand all Loading... | |
| 29 | 29 |
| 30 #include "core/html/canvas/WebGLRenderingContext.h" | 30 #include "core/html/canvas/WebGLRenderingContext.h" |
| 31 #include "core/html/canvas/WebGLVertexArrayObjectOES.h" | 31 #include "core/html/canvas/WebGLVertexArrayObjectOES.h" |
| 32 #include "core/platform/graphics/Extensions3D.h" | 32 #include "core/platform/graphics/Extensions3D.h" |
| 33 | 33 |
| 34 namespace WebCore { | 34 namespace WebCore { |
| 35 | 35 |
| 36 OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContext* context) | 36 OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContext* context) |
| 37 : WebGLExtension(context) | 37 : WebGLExtension(context) |
| 38 { | 38 { |
| 39 ScriptWrappable::init(this); | 39 ScriptWrappable::init(this); |
|
Ken Russell (switch to Gerrit)
2013/06/05 00:46:38
Missing call to enable()?
| |
| 40 context->graphicsContext3D()->getExtensions()->ensureEnabled("GL_OES_vertex_ array_object"); | |
| 41 } | 40 } |
| 42 | 41 |
| 43 OESVertexArrayObject::~OESVertexArrayObject() | 42 OESVertexArrayObject::~OESVertexArrayObject() |
| 44 { | 43 { |
| 45 } | 44 } |
| 46 | 45 |
| 46 void OESVertexArrayObject::enable() | |
| 47 { | |
| 48 m_context->graphicsContext3D()->getExtensions()->ensureEnabled("GL_OES_verte x_array_object"); | |
| 49 } | |
| 50 | |
| 47 WebGLExtension::ExtensionName OESVertexArrayObject::getName() const | 51 WebGLExtension::ExtensionName OESVertexArrayObject::getName() const |
| 48 { | 52 { |
| 49 return OESVertexArrayObjectName; | 53 return OESVertexArrayObjectName; |
| 50 } | 54 } |
| 51 | 55 |
| 52 PassOwnPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLRenderingCont ext* context) | 56 PassOwnPtr<OESVertexArrayObject> OESVertexArrayObject::create(WebGLRenderingCont ext* context) |
| 53 { | 57 { |
| 54 return adoptPtr(new OESVertexArrayObject(context)); | 58 return adoptPtr(new OESVertexArrayObject(context)); |
| 55 } | 59 } |
| 56 | 60 |
| 57 PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES () | 61 PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES () |
| 58 { | 62 { |
| 59 if (m_context->isContextLost()) | 63 if (isLost()) |
| 60 return 0; | 64 return 0; |
| 61 | 65 |
| 62 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_co ntext, WebGLVertexArrayObjectOES::VaoTypeUser); | 66 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_co ntext, WebGLVertexArrayObjectOES::VaoTypeUser); |
| 63 m_context->addContextObject(o.get()); | 67 m_context->addContextObject(o.get()); |
| 64 return o.release(); | 68 return o.release(); |
| 65 } | 69 } |
| 66 | 70 |
| 67 void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* array Object) | 71 void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* array Object) |
| 68 { | 72 { |
| 69 if (!arrayObject || m_context->isContextLost()) | 73 if (!arrayObject || isLost()) |
| 70 return; | 74 return; |
| 71 | 75 |
| 72 if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVert exArrayObject) | 76 if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVert exArrayObject) |
| 73 m_context->setBoundVertexArrayObject(0); | 77 m_context->setBoundVertexArrayObject(0); |
| 74 | 78 |
| 75 arrayObject->deleteObject(m_context->graphicsContext3D()); | 79 arrayObject->deleteObject(m_context->graphicsContext3D()); |
| 76 } | 80 } |
| 77 | 81 |
| 78 GC3Dboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* ar rayObject) | 82 GC3Dboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* ar rayObject) |
| 79 { | 83 { |
| 80 if (!arrayObject || m_context->isContextLost()) | 84 if (!arrayObject || isLost()) |
| 81 return 0; | 85 return 0; |
| 82 | 86 |
| 83 if (!arrayObject->hasEverBeenBound()) | 87 if (!arrayObject->hasEverBeenBound()) |
| 84 return 0; | 88 return 0; |
| 85 | 89 |
| 86 Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); | 90 Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); |
| 87 return extensions->isVertexArrayOES(arrayObject->object()); | 91 return extensions->isVertexArrayOES(arrayObject->object()); |
| 88 } | 92 } |
| 89 | 93 |
| 90 void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayOb ject, ExceptionCode& ec) | 94 void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayOb ject, ExceptionCode& ec) |
| 91 { | 95 { |
| 92 UNUSED_PARAM(ec); | 96 UNUSED_PARAM(ec); |
| 93 if (m_context->isContextLost()) | 97 if (isLost()) |
| 94 return; | 98 return; |
| 95 | 99 |
| 96 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, co ntext()))) { | 100 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, co ntext()))) { |
| 97 m_context->graphicsContext3D()->synthesizeGLError(GraphicsContext3D::INV ALID_OPERATION); | 101 m_context->graphicsContext3D()->synthesizeGLError(GraphicsContext3D::INV ALID_OPERATION); |
| 98 return; | 102 return; |
| 99 } | 103 } |
| 100 | 104 |
| 101 Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); | 105 Extensions3D* extensions = m_context->graphicsContext3D()->getExtensions(); |
| 102 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) { | 106 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) { |
| 103 extensions->bindVertexArrayOES(arrayObject->object()); | 107 extensions->bindVertexArrayOES(arrayObject->object()); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 115 Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); | 119 Extensions3D* extensions = context->graphicsContext3D()->getExtensions(); |
| 116 return extensions->supports("GL_OES_vertex_array_object"); | 120 return extensions->supports("GL_OES_vertex_array_object"); |
| 117 } | 121 } |
| 118 | 122 |
| 119 const char* OESVertexArrayObject::getExtensionName() | 123 const char* OESVertexArrayObject::getExtensionName() |
| 120 { | 124 { |
| 121 return "OES_vertex_array_object"; | 125 return "OES_vertex_array_object"; |
| 122 } | 126 } |
| 123 | 127 |
| 124 } // namespace WebCore | 128 } // namespace WebCore |
| OLD | NEW |