| 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 687 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 698 return p->settings()->privilegedWebGLExtensionsEnabled(); | 698 return p->settings()->privilegedWebGLExtensionsEnabled(); |
| 699 return false; | 699 return false; |
| 700 } | 700 } |
| 701 | 701 |
| 702 void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format) | 702 void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format) |
| 703 { | 703 { |
| 704 if (!m_compressedTextureFormats.contains(format)) | 704 if (!m_compressedTextureFormats.contains(format)) |
| 705 m_compressedTextureFormats.append(format); | 705 m_compressedTextureFormats.append(format); |
| 706 } | 706 } |
| 707 | 707 |
| 708 void WebGLRenderingContext::removeAllCompressedTextureFormats() |
| 709 { |
| 710 m_compressedTextureFormats.clear(); |
| 711 } |
| 712 |
| 708 WebGLRenderingContext::~WebGLRenderingContext() | 713 WebGLRenderingContext::~WebGLRenderingContext() |
| 709 { | 714 { |
| 710 // Remove all references to WebGLObjects so if they are the last reference | 715 // Remove all references to WebGLObjects so if they are the last reference |
| 711 // they will be freed before the last context is removed from the context gr
oup. | 716 // they will be freed before the last context is removed from the context gr
oup. |
| 712 m_boundArrayBuffer = 0; | 717 m_boundArrayBuffer = 0; |
| 713 m_defaultVertexArrayObject = 0; | 718 m_defaultVertexArrayObject = 0; |
| 714 m_boundVertexArrayObject = 0; | 719 m_boundVertexArrayObject = 0; |
| 715 m_vertexAttrib0Buffer = 0; | 720 m_vertexAttrib0Buffer = 0; |
| 716 m_currentProgram = 0; | 721 m_currentProgram = 0; |
| 717 m_framebufferBinding = 0; | 722 m_framebufferBinding = 0; |
| 718 m_renderbufferBinding = 0; | 723 m_renderbufferBinding = 0; |
| 719 | 724 |
| 720 for (size_t i = 0; i < m_textureUnits.size(); ++i) { | 725 for (size_t i = 0; i < m_textureUnits.size(); ++i) { |
| 721 m_textureUnits[i].m_texture2DBinding = 0; | 726 m_textureUnits[i].m_texture2DBinding = 0; |
| 722 m_textureUnits[i].m_textureCubeMapBinding = 0; | 727 m_textureUnits[i].m_textureCubeMapBinding = 0; |
| 723 } | 728 } |
| 724 | 729 |
| 725 m_blackTexture2D = 0; | 730 m_blackTexture2D = 0; |
| 726 m_blackTextureCubeMap = 0; | 731 m_blackTextureCubeMap = 0; |
| 727 | 732 |
| 728 detachAndRemoveAllObjects(); | 733 detachAndRemoveAllObjects(); |
| 734 |
| 735 // release all extensions |
| 736 for (size_t i = 0; i < m_extensions.size(); ++i) |
| 737 delete m_extensions[i]; |
| 738 |
| 729 destroyGraphicsContext3D(); | 739 destroyGraphicsContext3D(); |
| 730 m_contextGroup->removeContext(this); | 740 m_contextGroup->removeContext(this); |
| 731 | 741 |
| 732 if (m_multisamplingObserverRegistered) { | 742 if (m_multisamplingObserverRegistered) { |
| 733 Page* page = canvas()->document()->page(); | 743 Page* page = canvas()->document()->page(); |
| 734 if (page) | 744 if (page) |
| 735 page->removeMultisamplingChangedObserver(this); | 745 page->removeMultisamplingChangedObserver(this); |
| 736 } | 746 } |
| 737 | 747 |
| 738 willDestroyContext(this); | 748 willDestroyContext(this); |
| (...skipping 3408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4147 frame->loader()->client()->didLoseWebGLContext(m_context->getExt
ensions()->getGraphicsResetStatusARB()); | 4157 frame->loader()->client()->didLoseWebGLContext(m_context->getExt
ensions()->getGraphicsResetStatusARB()); |
| 4148 } | 4158 } |
| 4149 } | 4159 } |
| 4150 | 4160 |
| 4151 // Make absolutely sure we do not refer to an already-deleted texture or fra
mebuffer. | 4161 // Make absolutely sure we do not refer to an already-deleted texture or fra
mebuffer. |
| 4152 m_drawingBuffer->setTexture2DBinding(0); | 4162 m_drawingBuffer->setTexture2DBinding(0); |
| 4153 m_drawingBuffer->setFramebufferBinding(0); | 4163 m_drawingBuffer->setFramebufferBinding(0); |
| 4154 | 4164 |
| 4155 detachAndRemoveAllObjects(); | 4165 detachAndRemoveAllObjects(); |
| 4156 | 4166 |
| 4167 // Lose all the extensions. |
| 4168 for (size_t i = 0; i < m_extensions.size(); ++i) { |
| 4169 ExtensionTracker* tracker = m_extensions[i]; |
| 4170 tracker->loseExtension(); |
| 4171 } |
| 4172 |
| 4173 removeAllCompressedTextureFormats(); |
| 4174 |
| 4157 if (mode != RealLostContext) | 4175 if (mode != RealLostContext) |
| 4158 destroyGraphicsContext3D(); | 4176 destroyGraphicsContext3D(); |
| 4159 | 4177 |
| 4160 ConsoleDisplayPreference display = (mode == RealLostContext) ? DisplayInCons
ole: DontDisplayInConsole; | 4178 ConsoleDisplayPreference display = (mode == RealLostContext) ? DisplayInCons
ole: DontDisplayInConsole; |
| 4161 synthesizeGLError(GraphicsContext3D::CONTEXT_LOST_WEBGL, "loseContext", "con
text lost", display); | 4179 synthesizeGLError(GraphicsContext3D::CONTEXT_LOST_WEBGL, "loseContext", "con
text lost", display); |
| 4162 | 4180 |
| 4163 // Don't allow restoration unless the context lost event has both been | 4181 // Don't allow restoration unless the context lost event has both been |
| 4164 // dispatched and its default behavior prevented. | 4182 // dispatched and its default behavior prevented. |
| 4165 m_restoreAllowed = false; | 4183 m_restoreAllowed = false; |
| 4166 | 4184 |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5463 | 5481 |
| 5464 void WebGLRenderingContext::multisamplingChanged(bool enabled) | 5482 void WebGLRenderingContext::multisamplingChanged(bool enabled) |
| 5465 { | 5483 { |
| 5466 if (m_multisamplingAllowed != enabled) { | 5484 if (m_multisamplingAllowed != enabled) { |
| 5467 m_multisamplingAllowed = enabled; | 5485 m_multisamplingAllowed = enabled; |
| 5468 forceLostContext(WebGLRenderingContext::AutoRecoverSyntheticLostContext)
; | 5486 forceLostContext(WebGLRenderingContext::AutoRecoverSyntheticLostContext)
; |
| 5469 } | 5487 } |
| 5470 } | 5488 } |
| 5471 | 5489 |
| 5472 } // namespace WebCore | 5490 } // namespace WebCore |
| OLD | NEW |