| 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 828 , m_contextLostMode(NotLostContext) | 828 , m_contextLostMode(NotLostContext) |
| 829 , m_autoRecoveryMethod(Manual) | 829 , m_autoRecoveryMethod(Manual) |
| 830 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) | 830 , m_dispatchContextLostEventTimer(this, &WebGLRenderingContextBase::dispatch
ContextLostEvent) |
| 831 , m_restoreAllowed(false) | 831 , m_restoreAllowed(false) |
| 832 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) | 832 , m_restoreTimer(this, &WebGLRenderingContextBase::maybeRestoreContext) |
| 833 , m_preservedDefaultVAOObjectWrapper(false) | 833 , m_preservedDefaultVAOObjectWrapper(false) |
| 834 , m_generatedImageCache(4) | 834 , m_generatedImageCache(4) |
| 835 , m_requestedAttributes(requestedAttributes) | 835 , m_requestedAttributes(requestedAttributes) |
| 836 , m_synthesizedErrorsToConsole(true) | 836 , m_synthesizedErrorsToConsole(true) |
| 837 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) | 837 , m_numGLErrorsToConsoleAllowed(maxGLErrorsAllowedToConsole) |
| 838 , m_multisamplingAllowed(false) | |
| 839 , m_multisamplingObserverRegistered(false) | |
| 840 , m_onePlusMaxNonDefaultTextureUnit(0) | 838 , m_onePlusMaxNonDefaultTextureUnit(0) |
| 841 , m_isWebGL2FormatsTypesAdded(false) | 839 , m_isWebGL2FormatsTypesAdded(false) |
| 842 , m_isWebGL2InternalFormatsCopyTexImageAdded(false) | 840 , m_isWebGL2InternalFormatsCopyTexImageAdded(false) |
| 843 , m_isOESTextureFloatFormatsTypesAdded(false) | 841 , m_isOESTextureFloatFormatsTypesAdded(false) |
| 844 , m_isOESTextureHalfFloatFormatsTypesAdded(false) | 842 , m_isOESTextureHalfFloatFormatsTypesAdded(false) |
| 845 , m_isWebGLDepthTextureFormatsTypesAdded(false) | 843 , m_isWebGLDepthTextureFormatsTypesAdded(false) |
| 846 , m_isEXTsRGBFormatsTypesAdded(false) | 844 , m_isEXTsRGBFormatsTypesAdded(false) |
| 847 #if !ENABLE(OILPAN) | 845 #if !ENABLE(OILPAN) |
| 848 , m_weakPtrFactory(this) | 846 , m_weakPtrFactory(this) |
| 849 #endif | 847 #endif |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 ADD_VALUES_TO_SET(m_supportedTypes, kSupportedTypesES2); | 1011 ADD_VALUES_TO_SET(m_supportedTypes, kSupportedTypesES2); |
| 1014 | 1012 |
| 1015 activateContext(this); | 1013 activateContext(this); |
| 1016 } | 1014 } |
| 1017 | 1015 |
| 1018 void WebGLRenderingContextBase::setupFlags() | 1016 void WebGLRenderingContextBase::setupFlags() |
| 1019 { | 1017 { |
| 1020 ASSERT(drawingBuffer()); | 1018 ASSERT(drawingBuffer()); |
| 1021 if (Page* p = canvas()->document().page()) { | 1019 if (Page* p = canvas()->document().page()) { |
| 1022 m_synthesizedErrorsToConsole = p->settings().webGLErrorsToConsoleEnabled
(); | 1020 m_synthesizedErrorsToConsole = p->settings().webGLErrorsToConsoleEnabled
(); |
| 1023 | |
| 1024 if (!m_multisamplingObserverRegistered && m_requestedAttributes.antialia
s()) { | |
| 1025 m_multisamplingAllowed = drawingBuffer()->multisample(); | |
| 1026 p->addMultisamplingChangedObserver(this); | |
| 1027 m_multisamplingObserverRegistered = true; | |
| 1028 } | |
| 1029 } | 1021 } |
| 1030 | 1022 |
| 1031 m_isDepthStencilSupported = extensionsUtil()->isExtensionEnabled("GL_OES_pac
ked_depth_stencil"); | 1023 m_isDepthStencilSupported = extensionsUtil()->isExtensionEnabled("GL_OES_pac
ked_depth_stencil"); |
| 1032 } | 1024 } |
| 1033 | 1025 |
| 1034 void WebGLRenderingContextBase::addCompressedTextureFormat(GLenum format) | 1026 void WebGLRenderingContextBase::addCompressedTextureFormat(GLenum format) |
| 1035 { | 1027 { |
| 1036 if (!m_compressedTextureFormats.contains(format)) | 1028 if (!m_compressedTextureFormats.contains(format)) |
| 1037 m_compressedTextureFormats.append(format); | 1029 m_compressedTextureFormats.append(format); |
| 1038 } | 1030 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1079 tracker->loseExtension(true); | 1071 tracker->loseExtension(true); |
| 1080 } | 1072 } |
| 1081 m_extensions.clear(); | 1073 m_extensions.clear(); |
| 1082 | 1074 |
| 1083 // Context must be removed from the group prior to the destruction of the | 1075 // Context must be removed from the group prior to the destruction of the |
| 1084 // WebGraphicsContext3D, otherwise shared objects may not be properly delete
d. | 1076 // WebGraphicsContext3D, otherwise shared objects may not be properly delete
d. |
| 1085 m_contextGroup->removeContext(this); | 1077 m_contextGroup->removeContext(this); |
| 1086 | 1078 |
| 1087 destroyContext(); | 1079 destroyContext(); |
| 1088 | 1080 |
| 1089 #if !ENABLE(OILPAN) | |
| 1090 if (m_multisamplingObserverRegistered) { | |
| 1091 if (Page* page = canvas()->document().page()) | |
| 1092 page->removeMultisamplingChangedObserver(this); | |
| 1093 } | |
| 1094 #endif | |
| 1095 | |
| 1096 willDestroyContext(this); | 1081 willDestroyContext(this); |
| 1097 } | 1082 } |
| 1098 | 1083 |
| 1099 void WebGLRenderingContextBase::destroyContext() | 1084 void WebGLRenderingContextBase::destroyContext() |
| 1100 { | 1085 { |
| 1101 if (!drawingBuffer()) | 1086 if (!drawingBuffer()) |
| 1102 return; | 1087 return; |
| 1103 | 1088 |
| 1104 m_extensionsUtil.clear(); | 1089 m_extensionsUtil.clear(); |
| 1105 | 1090 |
| (...skipping 5108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6214 void WebGLRenderingContextBase::restoreCurrentFramebuffer() | 6199 void WebGLRenderingContextBase::restoreCurrentFramebuffer() |
| 6215 { | 6200 { |
| 6216 bindFramebuffer(nullptr, GL_FRAMEBUFFER, m_framebufferBinding.get()); | 6201 bindFramebuffer(nullptr, GL_FRAMEBUFFER, m_framebufferBinding.get()); |
| 6217 } | 6202 } |
| 6218 | 6203 |
| 6219 void WebGLRenderingContextBase::restoreCurrentTexture2D() | 6204 void WebGLRenderingContextBase::restoreCurrentTexture2D() |
| 6220 { | 6205 { |
| 6221 bindTexture(nullptr, GL_TEXTURE_2D, m_textureUnits[m_activeTextureUnit].m_te
xture2DBinding.get()); | 6206 bindTexture(nullptr, GL_TEXTURE_2D, m_textureUnits[m_activeTextureUnit].m_te
xture2DBinding.get()); |
| 6222 } | 6207 } |
| 6223 | 6208 |
| 6224 void WebGLRenderingContextBase::multisamplingChanged(bool enabled) | |
| 6225 { | |
| 6226 if (m_multisamplingAllowed != enabled) { | |
| 6227 m_multisamplingAllowed = enabled; | |
| 6228 forceLostContext(WebGLRenderingContextBase::SyntheticLostContext, WebGLR
enderingContextBase::Auto); | |
| 6229 } | |
| 6230 } | |
| 6231 | |
| 6232 void WebGLRenderingContextBase::findNewMaxNonDefaultTextureUnit() | 6209 void WebGLRenderingContextBase::findNewMaxNonDefaultTextureUnit() |
| 6233 { | 6210 { |
| 6234 // Trace backwards from the current max to find the new max non-default text
ure unit | 6211 // Trace backwards from the current max to find the new max non-default text
ure unit |
| 6235 int startIndex = m_onePlusMaxNonDefaultTextureUnit - 1; | 6212 int startIndex = m_onePlusMaxNonDefaultTextureUnit - 1; |
| 6236 for (int i = startIndex; i >= 0; --i) { | 6213 for (int i = startIndex; i >= 0; --i) { |
| 6237 if (m_textureUnits[i].m_texture2DBinding | 6214 if (m_textureUnits[i].m_texture2DBinding |
| 6238 || m_textureUnits[i].m_textureCubeMapBinding) { | 6215 || m_textureUnits[i].m_textureCubeMapBinding) { |
| 6239 m_onePlusMaxNonDefaultTextureUnit = i + 1; | 6216 m_onePlusMaxNonDefaultTextureUnit = i + 1; |
| 6240 return; | 6217 return; |
| 6241 } | 6218 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6352 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); | 6329 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, 1); |
| 6353 } | 6330 } |
| 6354 | 6331 |
| 6355 void WebGLRenderingContextBase::restoreUnpackParameters() | 6332 void WebGLRenderingContextBase::restoreUnpackParameters() |
| 6356 { | 6333 { |
| 6357 if (m_unpackAlignment != 1) | 6334 if (m_unpackAlignment != 1) |
| 6358 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); | 6335 contextGL()->PixelStorei(GL_UNPACK_ALIGNMENT, m_unpackAlignment); |
| 6359 } | 6336 } |
| 6360 | 6337 |
| 6361 } // namespace blink | 6338 } // namespace blink |
| OLD | NEW |