| 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 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 #include "core/html/HTMLImageElement.h" | 40 #include "core/html/HTMLImageElement.h" |
| 41 #include "core/html/HTMLVideoElement.h" | 41 #include "core/html/HTMLVideoElement.h" |
| 42 #include "core/html/ImageData.h" | 42 #include "core/html/ImageData.h" |
| 43 #include "core/inspector/ConsoleMessage.h" | 43 #include "core/inspector/ConsoleMessage.h" |
| 44 #include "core/inspector/InspectorInstrumentation.h" | 44 #include "core/inspector/InspectorInstrumentation.h" |
| 45 #include "core/layout/LayoutBox.h" | 45 #include "core/layout/LayoutBox.h" |
| 46 #include "core/loader/FrameLoader.h" | 46 #include "core/loader/FrameLoader.h" |
| 47 #include "core/loader/FrameLoaderClient.h" | 47 #include "core/loader/FrameLoaderClient.h" |
| 48 #include "gpu/command_buffer/client/gles2_interface.h" | 48 #include "gpu/command_buffer/client/gles2_interface.h" |
| 49 #include "modules/webgl/ANGLEInstancedArrays.h" | 49 #include "modules/webgl/ANGLEInstancedArrays.h" |
| 50 #include "modules/webgl/CHROMIUMSubscribeUniform.h" | |
| 51 #include "modules/webgl/CHROMIUMValuebuffer.h" | |
| 52 #include "modules/webgl/EXTBlendMinMax.h" | 50 #include "modules/webgl/EXTBlendMinMax.h" |
| 53 #include "modules/webgl/EXTFragDepth.h" | 51 #include "modules/webgl/EXTFragDepth.h" |
| 54 #include "modules/webgl/EXTShaderTextureLOD.h" | 52 #include "modules/webgl/EXTShaderTextureLOD.h" |
| 55 #include "modules/webgl/EXTTextureFilterAnisotropic.h" | 53 #include "modules/webgl/EXTTextureFilterAnisotropic.h" |
| 56 #include "modules/webgl/GLStringQuery.h" | 54 #include "modules/webgl/GLStringQuery.h" |
| 57 #include "modules/webgl/OESElementIndexUint.h" | 55 #include "modules/webgl/OESElementIndexUint.h" |
| 58 #include "modules/webgl/OESStandardDerivatives.h" | 56 #include "modules/webgl/OESStandardDerivatives.h" |
| 59 #include "modules/webgl/OESTextureFloat.h" | 57 #include "modules/webgl/OESTextureFloat.h" |
| 60 #include "modules/webgl/OESTextureFloatLinear.h" | 58 #include "modules/webgl/OESTextureFloatLinear.h" |
| 61 #include "modules/webgl/OESTextureHalfFloat.h" | 59 #include "modules/webgl/OESTextureHalfFloat.h" |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 m_activeTextureUnit = 0; | 860 m_activeTextureUnit = 0; |
| 863 m_packAlignment = 4; | 861 m_packAlignment = 4; |
| 864 m_unpackAlignment = 4; | 862 m_unpackAlignment = 4; |
| 865 m_unpackFlipY = false; | 863 m_unpackFlipY = false; |
| 866 m_unpackPremultiplyAlpha = false; | 864 m_unpackPremultiplyAlpha = false; |
| 867 m_unpackColorspaceConversion = GC3D_BROWSER_DEFAULT_WEBGL; | 865 m_unpackColorspaceConversion = GC3D_BROWSER_DEFAULT_WEBGL; |
| 868 m_boundArrayBuffer = nullptr; | 866 m_boundArrayBuffer = nullptr; |
| 869 m_currentProgram = nullptr; | 867 m_currentProgram = nullptr; |
| 870 m_framebufferBinding = nullptr; | 868 m_framebufferBinding = nullptr; |
| 871 m_renderbufferBinding = nullptr; | 869 m_renderbufferBinding = nullptr; |
| 872 m_valuebufferBinding = nullptr; | |
| 873 m_depthMask = true; | 870 m_depthMask = true; |
| 874 m_stencilEnabled = false; | 871 m_stencilEnabled = false; |
| 875 m_stencilMask = 0xFFFFFFFF; | 872 m_stencilMask = 0xFFFFFFFF; |
| 876 m_stencilMaskBack = 0xFFFFFFFF; | 873 m_stencilMaskBack = 0xFFFFFFFF; |
| 877 m_stencilFuncRef = 0; | 874 m_stencilFuncRef = 0; |
| 878 m_stencilFuncRefBack = 0; | 875 m_stencilFuncRefBack = 0; |
| 879 m_stencilFuncMask = 0xFFFFFFFF; | 876 m_stencilFuncMask = 0xFFFFFFFF; |
| 880 m_stencilFuncMaskBack = 0xFFFFFFFF; | 877 m_stencilFuncMaskBack = 0xFFFFFFFF; |
| 881 m_numGLErrorsToConsoleAllowed = maxGLErrorsAllowedToConsole; | 878 m_numGLErrorsToConsoleAllowed = maxGLErrorsAllowedToConsole; |
| 882 | 879 |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 WebGLRenderingContextBase::~WebGLRenderingContextBase() | 1006 WebGLRenderingContextBase::~WebGLRenderingContextBase() |
| 1010 { | 1007 { |
| 1011 // Remove all references to WebGLObjects so if they are the last reference | 1008 // Remove all references to WebGLObjects so if they are the last reference |
| 1012 // they will be freed before the last context is removed from the context gr
oup. | 1009 // they will be freed before the last context is removed from the context gr
oup. |
| 1013 m_boundArrayBuffer = nullptr; | 1010 m_boundArrayBuffer = nullptr; |
| 1014 m_defaultVertexArrayObject = nullptr; | 1011 m_defaultVertexArrayObject = nullptr; |
| 1015 m_boundVertexArrayObject = nullptr; | 1012 m_boundVertexArrayObject = nullptr; |
| 1016 m_currentProgram = nullptr; | 1013 m_currentProgram = nullptr; |
| 1017 m_framebufferBinding = nullptr; | 1014 m_framebufferBinding = nullptr; |
| 1018 m_renderbufferBinding = nullptr; | 1015 m_renderbufferBinding = nullptr; |
| 1019 m_valuebufferBinding = nullptr; | |
| 1020 | 1016 |
| 1021 // WebGLTexture shared objects will be detached and deleted | 1017 // WebGLTexture shared objects will be detached and deleted |
| 1022 // m_contextGroup->removeContext(this), which will bring about deleteTexture
() calls. | 1018 // m_contextGroup->removeContext(this), which will bring about deleteTexture
() calls. |
| 1023 // We null these out to avoid accessing those members in deleteTexture(). | 1019 // We null these out to avoid accessing those members in deleteTexture(). |
| 1024 for (size_t i = 0; i < m_textureUnits.size(); ++i) { | 1020 for (size_t i = 0; i < m_textureUnits.size(); ++i) { |
| 1025 m_textureUnits[i].m_texture2DBinding = nullptr; | 1021 m_textureUnits[i].m_texture2DBinding = nullptr; |
| 1026 m_textureUnits[i].m_textureCubeMapBinding = nullptr; | 1022 m_textureUnits[i].m_textureCubeMapBinding = nullptr; |
| 1027 m_textureUnits[i].m_texture3DBinding = nullptr; | 1023 m_textureUnits[i].m_texture3DBinding = nullptr; |
| 1028 m_textureUnits[i].m_texture2DArrayBinding = nullptr; | 1024 m_textureUnits[i].m_texture2DArrayBinding = nullptr; |
| 1029 } | 1025 } |
| (...skipping 2749 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3779 contextGL()->StencilOp(fail, zfail, zpass); | 3775 contextGL()->StencilOp(fail, zfail, zpass); |
| 3780 } | 3776 } |
| 3781 | 3777 |
| 3782 void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLen
um zfail, GLenum zpass) | 3778 void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLen
um zfail, GLenum zpass) |
| 3783 { | 3779 { |
| 3784 if (isContextLost()) | 3780 if (isContextLost()) |
| 3785 return; | 3781 return; |
| 3786 contextGL()->StencilOpSeparate(face, fail, zfail, zpass); | 3782 contextGL()->StencilOpSeparate(face, fail, zfail, zpass); |
| 3787 } | 3783 } |
| 3788 | 3784 |
| 3789 CHROMIUMValuebuffer* WebGLRenderingContextBase::createValuebufferCHROMIUM() | |
| 3790 { | |
| 3791 if (isContextLost()) | |
| 3792 return nullptr; | |
| 3793 CHROMIUMValuebuffer* o = CHROMIUMValuebuffer::create(this); | |
| 3794 addSharedObject(o); | |
| 3795 return o; | |
| 3796 } | |
| 3797 | |
| 3798 void WebGLRenderingContextBase::deleteValuebufferCHROMIUM(CHROMIUMValuebuffer *v
aluebuffer) | |
| 3799 { | |
| 3800 if (!deleteObject(valuebuffer)) | |
| 3801 return; | |
| 3802 if (valuebuffer == m_valuebufferBinding) | |
| 3803 m_valuebufferBinding = nullptr; | |
| 3804 } | |
| 3805 | |
| 3806 GLboolean WebGLRenderingContextBase::isValuebufferCHROMIUM(CHROMIUMValuebuffer*
valuebuffer) | |
| 3807 { | |
| 3808 if (!valuebuffer || isContextLost()) | |
| 3809 return 0; | |
| 3810 if (!valuebuffer->hasEverBeenBound()) | |
| 3811 return 0; | |
| 3812 if (valuebuffer->isDeleted()) | |
| 3813 return 0; | |
| 3814 return contextGL()->IsValuebufferCHROMIUM(valuebuffer->object()); | |
| 3815 } | |
| 3816 | |
| 3817 void WebGLRenderingContextBase::bindValuebufferCHROMIUM(GLenum target, CHROMIUMV
aluebuffer* valuebuffer) | |
| 3818 { | |
| 3819 bool deleted; | |
| 3820 if (!checkObjectToBeBound("bindValuebufferCHROMIUM", valuebuffer, deleted)) | |
| 3821 return; | |
| 3822 if (deleted) | |
| 3823 valuebuffer = 0; | |
| 3824 m_valuebufferBinding = valuebuffer; | |
| 3825 contextGL()->BindValuebufferCHROMIUM(target, objectOrZero(valuebuffer)); | |
| 3826 if (valuebuffer) | |
| 3827 valuebuffer->setHasEverBeenBound(); | |
| 3828 } | |
| 3829 | |
| 3830 void WebGLRenderingContextBase::subscribeValueCHROMIUM(GLenum target, GLenum sub
scription) | |
| 3831 { | |
| 3832 if (isContextLost()) | |
| 3833 return; | |
| 3834 contextGL()->SubscribeValueCHROMIUM(target, subscription); | |
| 3835 } | |
| 3836 | |
| 3837 void WebGLRenderingContextBase::populateSubscribedValuesCHROMIUM(GLenum target) | |
| 3838 { | |
| 3839 if (isContextLost()) | |
| 3840 return; | |
| 3841 contextGL()->PopulateSubscribedValuesCHROMIUM(target); | |
| 3842 } | |
| 3843 | |
| 3844 void WebGLRenderingContextBase::uniformValuebufferCHROMIUM(const WebGLUniformLoc
ation* location, GLenum target, GLenum subscription) | |
| 3845 { | |
| 3846 if (isContextLost() || !location) | |
| 3847 return; | |
| 3848 contextGL()->UniformValuebufferCHROMIUM(location->location(), target, subscr
iption); | |
| 3849 } | |
| 3850 | |
| 3851 GLenum WebGLRenderingContextBase::convertTexInternalFormat(GLenum internalformat
, GLenum type) | 3785 GLenum WebGLRenderingContextBase::convertTexInternalFormat(GLenum internalformat
, GLenum type) |
| 3852 { | 3786 { |
| 3853 // Convert to sized internal formats that are renderable with GL_CHROMIUM_co
lor_buffer_float_rgb(a). | 3787 // Convert to sized internal formats that are renderable with GL_CHROMIUM_co
lor_buffer_float_rgb(a). |
| 3854 if (type == GL_FLOAT && internalformat == GL_RGBA | 3788 if (type == GL_FLOAT && internalformat == GL_RGBA |
| 3855 && extensionsUtil()->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_
rgba")) | 3789 && extensionsUtil()->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_
rgba")) |
| 3856 return GL_RGBA32F_EXT; | 3790 return GL_RGBA32F_EXT; |
| 3857 if (type == GL_FLOAT && internalformat == GL_RGB | 3791 if (type == GL_FLOAT && internalformat == GL_RGB |
| 3858 && extensionsUtil()->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_
rgb")) | 3792 && extensionsUtil()->isExtensionEnabled("GL_CHROMIUM_color_buffer_float_
rgb")) |
| 3859 return GL_RGB32F_EXT; | 3793 return GL_RGB32F_EXT; |
| 3860 return internalformat; | 3794 return internalformat; |
| (...skipping 2379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6240 | 6174 |
| 6241 DEFINE_TRACE(WebGLRenderingContextBase) | 6175 DEFINE_TRACE(WebGLRenderingContextBase) |
| 6242 { | 6176 { |
| 6243 visitor->trace(m_contextObjects); | 6177 visitor->trace(m_contextObjects); |
| 6244 visitor->trace(m_boundArrayBuffer); | 6178 visitor->trace(m_boundArrayBuffer); |
| 6245 visitor->trace(m_defaultVertexArrayObject); | 6179 visitor->trace(m_defaultVertexArrayObject); |
| 6246 visitor->trace(m_boundVertexArrayObject); | 6180 visitor->trace(m_boundVertexArrayObject); |
| 6247 visitor->trace(m_currentProgram); | 6181 visitor->trace(m_currentProgram); |
| 6248 visitor->trace(m_framebufferBinding); | 6182 visitor->trace(m_framebufferBinding); |
| 6249 visitor->trace(m_renderbufferBinding); | 6183 visitor->trace(m_renderbufferBinding); |
| 6250 visitor->trace(m_valuebufferBinding); | |
| 6251 visitor->trace(m_textureUnits); | 6184 visitor->trace(m_textureUnits); |
| 6252 visitor->trace(m_extensions); | 6185 visitor->trace(m_extensions); |
| 6253 CanvasRenderingContext::trace(visitor); | 6186 CanvasRenderingContext::trace(visitor); |
| 6254 } | 6187 } |
| 6255 | 6188 |
| 6256 int WebGLRenderingContextBase::externallyAllocatedBytesPerPixel() | 6189 int WebGLRenderingContextBase::externallyAllocatedBytesPerPixel() |
| 6257 { | 6190 { |
| 6258 if (isContextLost()) | 6191 if (isContextLost()) |
| 6259 return 0; | 6192 return 0; |
| 6260 | 6193 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6290 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6223 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6291 } | 6224 } |
| 6292 | 6225 |
| 6293 void WebGLRenderingContextBase::restoreUnpackParameters() | 6226 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6294 { | 6227 { |
| 6295 if (m_unpackAlignment != 1) | 6228 if (m_unpackAlignment != 1) |
| 6296 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6229 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6297 } | 6230 } |
| 6298 | 6231 |
| 6299 } // namespace blink | 6232 } // namespace blink |
| OLD | NEW |