OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple 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/WebGLRenderingContextBase.h" | 26 #include "modules/webgl/WebGLRenderingContextBase.h" |
27 | 27 |
28 #include "bindings/core/v8/ExceptionMessages.h" | 28 #include "bindings/core/v8/ExceptionMessages.h" |
29 #include "bindings/core/v8/ExceptionState.h" | 29 #include "bindings/core/v8/ExceptionState.h" |
30 #include "bindings/core/v8/ScriptWrappableVisitor.h" | |
30 #include "bindings/core/v8/V8BindingMacros.h" | 31 #include "bindings/core/v8/V8BindingMacros.h" |
31 #include "bindings/modules/v8/HTMLCanvasElementOrOffscreenCanvas.h" | 32 #include "bindings/modules/v8/HTMLCanvasElementOrOffscreenCanvas.h" |
32 #include "bindings/modules/v8/WebGLAny.h" | 33 #include "bindings/modules/v8/WebGLAny.h" |
33 #include "core/dom/DOMArrayBuffer.h" | 34 #include "core/dom/DOMArrayBuffer.h" |
34 #include "core/dom/DOMTypedArray.h" | 35 #include "core/dom/DOMTypedArray.h" |
35 #include "core/dom/FlexibleArrayBufferView.h" | 36 #include "core/dom/FlexibleArrayBufferView.h" |
36 #include "core/fetch/ImageResource.h" | 37 #include "core/fetch/ImageResource.h" |
37 #include "core/frame/ImageBitmap.h" | 38 #include "core/frame/ImageBitmap.h" |
38 #include "core/frame/LocalFrame.h" | 39 #include "core/frame/LocalFrame.h" |
39 #include "core/frame/Settings.h" | 40 #include "core/frame/Settings.h" |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
970 passedOffscreenCanvas, | 971 passedOffscreenCanvas, |
971 requestedAttributes), | 972 requestedAttributes), |
972 m_isHidden(false), | 973 m_isHidden(false), |
973 m_contextLostMode(NotLostContext), | 974 m_contextLostMode(NotLostContext), |
974 m_autoRecoveryMethod(Manual), | 975 m_autoRecoveryMethod(Manual), |
975 m_dispatchContextLostEventTimer( | 976 m_dispatchContextLostEventTimer( |
976 this, | 977 this, |
977 &WebGLRenderingContextBase::dispatchContextLostEvent), | 978 &WebGLRenderingContextBase::dispatchContextLostEvent), |
978 m_restoreAllowed(false), | 979 m_restoreAllowed(false), |
979 m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext), | 980 m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext), |
981 m_boundArrayBuffer(this, nullptr), | |
982 m_boundVertexArrayObject(this, nullptr), | |
983 m_currentProgram(this, nullptr), | |
984 m_framebufferBinding(this, nullptr), | |
985 m_renderbufferBinding(this, nullptr), | |
980 m_generatedImageCache(4), | 986 m_generatedImageCache(4), |
981 m_synthesizedErrorsToConsole(true), | 987 m_synthesizedErrorsToConsole(true), |
982 m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole), | 988 m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole), |
983 m_onePlusMaxNonDefaultTextureUnit(0), | 989 m_onePlusMaxNonDefaultTextureUnit(0), |
984 m_isWebGL2FormatsTypesAdded(false), | 990 m_isWebGL2FormatsTypesAdded(false), |
985 m_isWebGL2TexImageSourceFormatsTypesAdded(false), | 991 m_isWebGL2TexImageSourceFormatsTypesAdded(false), |
986 m_isWebGL2InternalFormatsCopyTexImageAdded(false), | 992 m_isWebGL2InternalFormatsCopyTexImageAdded(false), |
987 m_isOESTextureFloatFormatsTypesAdded(false), | 993 m_isOESTextureFloatFormatsTypesAdded(false), |
988 m_isOESTextureHalfFloatFormatsTypesAdded(false), | 994 m_isOESTextureHalfFloatFormatsTypesAdded(false), |
989 m_isWebGLDepthTextureFormatsTypesAdded(false), | 995 m_isWebGLDepthTextureFormatsTypesAdded(false), |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1760 } else if (target == GL_TEXTURE_CUBE_MAP) { | 1766 } else if (target == GL_TEXTURE_CUBE_MAP) { |
1761 m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding = texture; | 1767 m_textureUnits[m_activeTextureUnit].m_textureCubeMapBinding = texture; |
1762 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_2D_ARRAY) { | 1768 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_2D_ARRAY) { |
1763 m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding = texture; | 1769 m_textureUnits[m_activeTextureUnit].m_texture2DArrayBinding = texture; |
1764 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_3D) { | 1770 } else if (isWebGL2OrHigher() && target == GL_TEXTURE_3D) { |
1765 m_textureUnits[m_activeTextureUnit].m_texture3DBinding = texture; | 1771 m_textureUnits[m_activeTextureUnit].m_texture3DBinding = texture; |
1766 } else { | 1772 } else { |
1767 synthesizeGLError(GL_INVALID_ENUM, "bindTexture", "invalid target"); | 1773 synthesizeGLError(GL_INVALID_ENUM, "bindTexture", "invalid target"); |
1768 return; | 1774 return; |
1769 } | 1775 } |
1776 ScriptWrappableVisitor::writeBarrier(this, texture); | |
Michael Lippautz
2016/10/12 10:57:12
TextureUnitState didn't use Member<> types before.
haraken
2016/10/12 11:51:28
How about changing Member<>s in TextureUnitState t
Michael Lippautz
2016/10/12 12:50:38
Done.
This exposes one corner case where the comp
| |
1770 | 1777 |
1771 contextGL()->BindTexture(target, objectOrZero(texture)); | 1778 contextGL()->BindTexture(target, objectOrZero(texture)); |
1772 if (texture) { | 1779 if (texture) { |
1773 texture->setTarget(target); | 1780 texture->setTarget(target); |
1774 m_onePlusMaxNonDefaultTextureUnit = | 1781 m_onePlusMaxNonDefaultTextureUnit = |
1775 max(m_activeTextureUnit + 1, m_onePlusMaxNonDefaultTextureUnit); | 1782 max(m_activeTextureUnit + 1, m_onePlusMaxNonDefaultTextureUnit); |
1776 } else { | 1783 } else { |
1777 // If the disabled index is the current maximum, trace backwards to find the | 1784 // If the disabled index is the current maximum, trace backwards to find the |
1778 // new max enabled texture index | 1785 // new max enabled texture index |
1779 if (m_onePlusMaxNonDefaultTextureUnit == m_activeTextureUnit + 1) { | 1786 if (m_onePlusMaxNonDefaultTextureUnit == m_activeTextureUnit + 1) { |
(...skipping 5749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7529 | 7536 |
7530 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( | 7537 void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( |
7531 HTMLCanvasElementOrOffscreenCanvas& result) const { | 7538 HTMLCanvasElementOrOffscreenCanvas& result) const { |
7532 if (canvas()) | 7539 if (canvas()) |
7533 result.setHTMLCanvasElement(canvas()); | 7540 result.setHTMLCanvasElement(canvas()); |
7534 else | 7541 else |
7535 result.setOffscreenCanvas(getOffscreenCanvas()); | 7542 result.setOffscreenCanvas(getOffscreenCanvas()); |
7536 } | 7543 } |
7537 | 7544 |
7538 } // namespace blink | 7545 } // namespace blink |
OLD | NEW |