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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 defaultAttrs = WebGLContextAttributes::create(); | 83 defaultAttrs = WebGLContextAttributes::create(); |
84 attrs = defaultAttrs.get(); | 84 attrs = defaultAttrs.get(); |
85 } | 85 } |
86 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum
ent.topDocument().url().string(), settings); | 86 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum
ent.topDocument().url().string(), settings); |
87 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); | 87 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(attributes, 0)); |
88 if (!context || !context->makeContextCurrent()) { | 88 if (!context || !context->makeContextCurrent()) { |
89 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); | 89 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); |
90 return nullptr; | 90 return nullptr; |
91 } | 91 } |
92 | 92 |
93 Extensions3DUtil extensionsUtil(context.get()); | 93 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g
et()); |
94 if (extensionsUtil.supportsExtension("GL_EXT_debug_marker")) | 94 if (!extensionsUtil) |
| 95 return nullptr; |
| 96 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) |
95 context->pushGroupMarkerEXT("WebGLRenderingContext"); | 97 context->pushGroupMarkerEXT("WebGLRenderingContext"); |
96 | 98 |
97 OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRendering
Context(canvas, context.release(), attrs)); | 99 OwnPtr<WebGLRenderingContext> renderingContext = adoptPtr(new WebGLRendering
Context(canvas, context.release(), attrs)); |
98 renderingContext->registerContextExtensions(); | 100 renderingContext->registerContextExtensions(); |
99 renderingContext->suspendIfNeeded(); | 101 renderingContext->suspendIfNeeded(); |
100 | 102 |
101 if (!renderingContext->m_drawingBuffer) { | 103 if (!renderingContext->m_drawingBuffer) { |
102 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); | 104 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Could not create a WebGL context.")); |
103 return nullptr; | 105 return nullptr; |
104 } | 106 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); | 145 registerExtension<EXTFragDepth>(m_extFragDepth, DraftExtension); |
144 registerExtension<EXTShaderTextureLOD>(m_extShaderTextureLOD, DraftExtension
); | 146 registerExtension<EXTShaderTextureLOD>(m_extShaderTextureLOD, DraftExtension
); |
145 registerExtension<WebGLCompressedTextureETC1>(m_webglCompressedTextureETC1,
DraftExtension); | 147 registerExtension<WebGLCompressedTextureETC1>(m_webglCompressedTextureETC1,
DraftExtension); |
146 | 148 |
147 // Register privileged extensions. | 149 // Register privileged extensions. |
148 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDeb
ugRendererInfoExtension); | 150 registerExtension<WebGLDebugRendererInfo>(m_webglDebugRendererInfo, WebGLDeb
ugRendererInfoExtension); |
149 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio
n); | 151 registerExtension<WebGLDebugShaders>(m_webglDebugShaders, PrivilegedExtensio
n); |
150 } | 152 } |
151 | 153 |
152 } // namespace WebCore | 154 } // namespace WebCore |
OLD | NEW |