| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webgl/WebGL2RenderingContext.h" | 5 #include "modules/webgl/WebGL2RenderingContext.h" |
| 6 | 6 |
| 7 #include "bindings/modules/v8/UnionTypesModules.h" | 7 #include "bindings/modules/v8/UnionTypesModules.h" |
| 8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/loader/FrameLoader.h" | 10 #include "core/loader/FrameLoader.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 return nullptr; | 44 return nullptr; |
| 45 gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); | 45 gpu::gles2::GLES2Interface* gl = contextProvider->contextGL(); |
| 46 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); | 46 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(gl); |
| 47 if (!extensionsUtil) | 47 if (!extensionsUtil) |
| 48 return nullptr; | 48 return nullptr; |
| 49 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { | 49 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) { |
| 50 String contextLabel(String::format("WebGL2RenderingContext-%p", contextP
rovider.get())); | 50 String contextLabel(String::format("WebGL2RenderingContext-%p", contextP
rovider.get())); |
| 51 gl->PushGroupMarkerEXT(0, contextLabel.ascii().data()); | 51 gl->PushGroupMarkerEXT(0, contextLabel.ascii().data()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 RawPtr<WebGL2RenderingContext> renderingContext = new WebGL2RenderingContext
(canvas, contextProvider.release(), attributes); | 54 WebGL2RenderingContext* renderingContext = new WebGL2RenderingContext(canvas
, contextProvider.release(), attributes); |
| 55 | 55 |
| 56 if (!renderingContext->drawingBuffer()) { | 56 if (!renderingContext->drawingBuffer()) { |
| 57 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL2 context.")); | 57 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL2 context.")); |
| 58 return nullptr; | 58 return nullptr; |
| 59 } | 59 } |
| 60 | 60 |
| 61 renderingContext->initializeNewContext(); | 61 renderingContext->initializeNewContext(); |
| 62 renderingContext->registerContextExtensions(); | 62 renderingContext->registerContextExtensions(); |
| 63 | 63 |
| 64 return renderingContext.release(); | 64 return renderingContext; |
| 65 } | 65 } |
| 66 | 66 |
| 67 void WebGL2RenderingContext::Factory::onError(HTMLCanvasElement* canvas, const S
tring& error) | 67 void WebGL2RenderingContext::Factory::onError(HTMLCanvasElement* canvas, const S
tring& error) |
| 68 { | 68 { |
| 69 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontext
creationerror, false, true, error)); | 69 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcontext
creationerror, false, true, error)); |
| 70 } | 70 } |
| 71 | 71 |
| 72 WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement* passedCanvas,
PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttr
ibutes& requestedAttributes) | 72 WebGL2RenderingContext::WebGL2RenderingContext(HTMLCanvasElement* passedCanvas,
PassOwnPtr<WebGraphicsContext3DProvider> contextProvider, const WebGLContextAttr
ibutes& requestedAttributes) |
| 73 : WebGL2RenderingContextBase(passedCanvas, contextProvider, requestedAttribu
tes) | 73 : WebGL2RenderingContextBase(passedCanvas, contextProvider, requestedAttribu
tes) |
| 74 { | 74 { |
| 75 } | 75 } |
| 76 | 76 |
| 77 WebGL2RenderingContext::~WebGL2RenderingContext() | 77 WebGL2RenderingContext::~WebGL2RenderingContext() |
| 78 { | 78 { |
| 79 | 79 |
| 80 } | 80 } |
| 81 | 81 |
| 82 void WebGL2RenderingContext::setCanvasGetContextResult(RenderingContext& result) | 82 void WebGL2RenderingContext::setCanvasGetContextResult(RenderingContext& result) |
| 83 { | 83 { |
| 84 result.setWebGL2RenderingContext(RawPtr<WebGL2RenderingContext>(this)); | 84 result.setWebGL2RenderingContext(this); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void WebGL2RenderingContext::registerContextExtensions() | 87 void WebGL2RenderingContext::registerContextExtensions() |
| 88 { | 88 { |
| 89 // Register extensions. | 89 // Register extensions. |
| 90 registerExtension<CHROMIUMSubscribeUniform>(m_chromiumSubscribeUniform); | 90 registerExtension<CHROMIUMSubscribeUniform>(m_chromiumSubscribeUniform); |
| 91 registerExtension<EXTColorBufferFloat>(m_extColorBufferFloat, DraftExtension
); | 91 registerExtension<EXTColorBufferFloat>(m_extColorBufferFloat, DraftExtension
); |
| 92 registerExtension<EXTDisjointTimerQuery>(m_extDisjointTimerQuery); | 92 registerExtension<EXTDisjointTimerQuery>(m_extDisjointTimerQuery); |
| 93 registerExtension<EXTTextureFilterAnisotropic>(m_extTextureFilterAnisotropic
); | 93 registerExtension<EXTTextureFilterAnisotropic>(m_extTextureFilterAnisotropic
); |
| 94 registerExtension<OESTextureFloatLinear>(m_oesTextureFloatLinear); | 94 registerExtension<OESTextureFloatLinear>(m_oesTextureFloatLinear); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 114 visitor->trace(m_webglCompressedTextureETC1); | 114 visitor->trace(m_webglCompressedTextureETC1); |
| 115 visitor->trace(m_webglCompressedTexturePVRTC); | 115 visitor->trace(m_webglCompressedTexturePVRTC); |
| 116 visitor->trace(m_webglCompressedTextureS3TC); | 116 visitor->trace(m_webglCompressedTextureS3TC); |
| 117 visitor->trace(m_webglDebugRendererInfo); | 117 visitor->trace(m_webglDebugRendererInfo); |
| 118 visitor->trace(m_webglDebugShaders); | 118 visitor->trace(m_webglDebugShaders); |
| 119 visitor->trace(m_webglLoseContext); | 119 visitor->trace(m_webglLoseContext); |
| 120 WebGL2RenderingContextBase::trace(visitor); | 120 WebGL2RenderingContextBase::trace(visitor); |
| 121 } | 121 } |
| 122 | 122 |
| 123 } // namespace blink | 123 } // namespace blink |
| OLD | NEW |