| 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR | 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, | 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | 19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 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 "modules/webgl/OESVertexArrayObject.h" | 26 #include "modules/webgl/OESVertexArrayObject.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/ExceptionState.h" | 28 #include "bindings/core/v8/ExceptionState.h" |
| 29 #include "gpu/command_buffer/client/gles2_interface.h" |
| 29 #include "modules/webgl/WebGLRenderingContextBase.h" | 30 #include "modules/webgl/WebGLRenderingContextBase.h" |
| 30 #include "modules/webgl/WebGLVertexArrayObjectOES.h" | 31 #include "modules/webgl/WebGLVertexArrayObjectOES.h" |
| 31 | 32 |
| 32 namespace blink { | 33 namespace blink { |
| 33 | 34 |
| 34 OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContextBase* context) | 35 OESVertexArrayObject::OESVertexArrayObject(WebGLRenderingContextBase* context) |
| 35 : WebGLExtension(context) | 36 : WebGLExtension(context) |
| 36 { | 37 { |
| 37 context->extensionsUtil()->ensureExtensionEnabled("GL_OES_vertex_array_objec
t"); | 38 context->extensionsUtil()->ensureExtensionEnabled("GL_OES_vertex_array_objec
t"); |
| 38 } | 39 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 64 | 65 |
| 65 void OESVertexArrayObject::deleteVertexArrayOES(ScriptState* scriptState, WebGLV
ertexArrayObjectOES* arrayObject) | 66 void OESVertexArrayObject::deleteVertexArrayOES(ScriptState* scriptState, WebGLV
ertexArrayObjectOES* arrayObject) |
| 66 { | 67 { |
| 67 WebGLExtensionScopedContext scoped(this); | 68 WebGLExtensionScopedContext scoped(this); |
| 68 if (!arrayObject || scoped.isLost()) | 69 if (!arrayObject || scoped.isLost()) |
| 69 return; | 70 return; |
| 70 | 71 |
| 71 if (!arrayObject->isDefaultObject() && arrayObject == scoped.context()->m_bo
undVertexArrayObject) | 72 if (!arrayObject->isDefaultObject() && arrayObject == scoped.context()->m_bo
undVertexArrayObject) |
| 72 scoped.context()->setBoundVertexArrayObject(scriptState, nullptr); | 73 scoped.context()->setBoundVertexArrayObject(scriptState, nullptr); |
| 73 | 74 |
| 74 arrayObject->deleteObject(scoped.context()->webContext()); | 75 arrayObject->deleteObject(scoped.context()->webContext(), scoped.context()->
contextGL()); |
| 75 } | 76 } |
| 76 | 77 |
| 77 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra
yObject) | 78 GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arra
yObject) |
| 78 { | 79 { |
| 79 WebGLExtensionScopedContext scoped(this); | 80 WebGLExtensionScopedContext scoped(this); |
| 80 if (!arrayObject || scoped.isLost()) | 81 if (!arrayObject || scoped.isLost()) |
| 81 return 0; | 82 return 0; |
| 82 | 83 |
| 83 if (!arrayObject->hasEverBeenBound()) | 84 if (!arrayObject->hasEverBeenBound()) |
| 84 return 0; | 85 return 0; |
| 85 | 86 |
| 86 return scoped.context()->webContext()->isVertexArrayOES(arrayObject->object(
)); | 87 return scoped.context()->contextGL()->IsVertexArrayOES(arrayObject->object()
); |
| 87 } | 88 } |
| 88 | 89 |
| 89 void OESVertexArrayObject::bindVertexArrayOES(ScriptState* scriptState, WebGLVer
texArrayObjectOES* arrayObject) | 90 void OESVertexArrayObject::bindVertexArrayOES(ScriptState* scriptState, WebGLVer
texArrayObjectOES* arrayObject) |
| 90 { | 91 { |
| 91 WebGLExtensionScopedContext scoped(this); | 92 WebGLExtensionScopedContext scoped(this); |
| 92 if (scoped.isLost()) | 93 if (scoped.isLost()) |
| 93 return; | 94 return; |
| 94 | 95 |
| 95 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, sc
oped.context()))) { | 96 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, sc
oped.context()))) { |
| 96 scoped.context()->webContext()->synthesizeGLError(GL_INVALID_OPERATION); | 97 scoped.context()->webContext()->synthesizeGLError(GL_INVALID_OPERATION); |
| 97 return; | 98 return; |
| 98 } | 99 } |
| 99 | 100 |
| 100 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object())
{ | 101 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object())
{ |
| 101 scoped.context()->webContext()->bindVertexArrayOES(arrayObject->object()
); | 102 scoped.context()->contextGL()->BindVertexArrayOES(arrayObject->object())
; |
| 102 | 103 |
| 103 arrayObject->setHasEverBeenBound(); | 104 arrayObject->setHasEverBeenBound(); |
| 104 scoped.context()->setBoundVertexArrayObject(scriptState, arrayObject); | 105 scoped.context()->setBoundVertexArrayObject(scriptState, arrayObject); |
| 105 } else { | 106 } else { |
| 106 scoped.context()->webContext()->bindVertexArrayOES(0); | 107 scoped.context()->contextGL()->BindVertexArrayOES(0); |
| 107 scoped.context()->setBoundVertexArrayObject(scriptState, nullptr); | 108 scoped.context()->setBoundVertexArrayObject(scriptState, nullptr); |
| 108 } | 109 } |
| 109 } | 110 } |
| 110 | 111 |
| 111 bool OESVertexArrayObject::supported(WebGLRenderingContextBase* context) | 112 bool OESVertexArrayObject::supported(WebGLRenderingContextBase* context) |
| 112 { | 113 { |
| 113 return context->extensionsUtil()->supportsExtension("GL_OES_vertex_array_obj
ect"); | 114 return context->extensionsUtil()->supportsExtension("GL_OES_vertex_array_obj
ect"); |
| 114 } | 115 } |
| 115 | 116 |
| 116 const char* OESVertexArrayObject::extensionName() | 117 const char* OESVertexArrayObject::extensionName() |
| 117 { | 118 { |
| 118 return "OES_vertex_array_object"; | 119 return "OES_vertex_array_object"; |
| 119 } | 120 } |
| 120 | 121 |
| 121 } // namespace blink | 122 } // namespace blink |
| OLD | NEW |