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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); | 80 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, "Web page was not allowed to create a WebGL cont
ext.")); |
81 return nullptr; | 81 return nullptr; |
82 } | 82 } |
83 | 83 |
84 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); | 84 WebGLContextAttributes attributes = toWebGLContextAttributes(attrs); |
85 blink::WebGraphicsContext3D::Attributes wgc3dAttributes = toWebGraphicsConte
xt3DAttributes(attributes, document.topDocument().url().string(), settings, 1); | 85 blink::WebGraphicsContext3D::Attributes wgc3dAttributes = toWebGraphicsConte
xt3DAttributes(attributes, document.topDocument().url().string(), settings, 1); |
86 blink::WebGLInfo glInfo; | 86 blink::WebGLInfo glInfo; |
87 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(wgc3dAttributes, 0, &glInfo)); | 87 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr
ent()->createOffscreenGraphicsContext3D(wgc3dAttributes, 0, &glInfo)); |
88 if (!context || shouldFailContextCreationForTesting) { | 88 if (!context || shouldFailContextCreationForTesting) { |
89 shouldFailContextCreationForTesting = false; | 89 shouldFailContextCreationForTesting = false; |
90 String statusMessage("Could not create a WebGL context for VendorInfo =
"); | 90 String statusMessage; |
91 statusMessage.append(glInfo.vendorInfo); | 91 if (!glInfo.contextInfoCollectionFailure.isEmpty()) { |
92 statusMessage.append(", RendererInfo = "); | 92 statusMessage.append("Could not create a WebGL context. "); |
93 statusMessage.append(glInfo.rendererInfo); | 93 statusMessage.append(glInfo.contextInfoCollectionFailure); |
94 statusMessage.append(", DriverInfo = "); | 94 } else { |
95 statusMessage.append(glInfo.driverVersion); | 95 statusMessage.append("Could not create a WebGL context"); |
96 statusMessage.append("."); | 96 if (!glInfo.vendorInfo.isEmpty()) { |
| 97 statusMessage.append(" VendorInfo = "); |
| 98 statusMessage.append(glInfo.vendorInfo); |
| 99 } else { |
| 100 statusMessage.append(" VendorInfo = Not Available"); |
| 101 } |
| 102 if (!glInfo.rendererInfo.isEmpty()) { |
| 103 statusMessage.append(", RendererInfo = "); |
| 104 statusMessage.append(glInfo.rendererInfo); |
| 105 } else { |
| 106 statusMessage.append(", RendererInfo = Not Available"); |
| 107 } |
| 108 if (!glInfo.driverVersion.isEmpty()) { |
| 109 statusMessage.append(", DriverInfo = "); |
| 110 statusMessage.append(glInfo.driverVersion); |
| 111 } else { |
| 112 statusMessage.append(", DriverInfo = Not Available"); |
| 113 } |
| 114 statusMessage.append("."); |
| 115 } |
97 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, statusMessage)); | 116 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon
textcreationerror, false, true, statusMessage)); |
98 return nullptr; | 117 return nullptr; |
99 } | 118 } |
100 | 119 |
101 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g
et()); | 120 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g
et()); |
102 if (!extensionsUtil) | 121 if (!extensionsUtil) |
103 return nullptr; | 122 return nullptr; |
104 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) | 123 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) |
105 context->pushGroupMarkerEXT("WebGLRenderingContext"); | 124 context->pushGroupMarkerEXT("WebGLRenderingContext"); |
106 | 125 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 visitor->trace(m_webglDepthTexture); | 201 visitor->trace(m_webglDepthTexture); |
183 WebGLRenderingContextBase::trace(visitor); | 202 WebGLRenderingContextBase::trace(visitor); |
184 } | 203 } |
185 | 204 |
186 void WebGLRenderingContext::forceNextWebGLContextCreationToFail() | 205 void WebGLRenderingContext::forceNextWebGLContextCreationToFail() |
187 { | 206 { |
188 shouldFailContextCreationForTesting = true; | 207 shouldFailContextCreationForTesting = true; |
189 } | 208 } |
190 | 209 |
191 } // namespace blink | 210 } // namespace blink |
OLD | NEW |