Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(500)

Side by Side Diff: Source/core/html/canvas/WebGLRenderingContext.cpp

Issue 695563003: [WebGL] Return meaningful information in WebGL context creation error message. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@webgl_patch
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return nullptr; 78 return nullptr;
79 } 79 }
80 80
81 // The only situation that attrs is null is through Document::getCSSCanvasCo ntext(). 81 // The only situation that attrs is null is through Document::getCSSCanvasCo ntext().
82 RefPtrWillBeRawPtr<WebGLContextAttributes> defaultAttrs = nullptr; 82 RefPtrWillBeRawPtr<WebGLContextAttributes> defaultAttrs = nullptr;
83 if (!attrs) { 83 if (!attrs) {
84 defaultAttrs = WebGLContextAttributes::create(); 84 defaultAttrs = WebGLContextAttributes::create();
85 attrs = defaultAttrs.get(); 85 attrs = defaultAttrs.get();
86 } 86 }
87 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum ent.topDocument().url().string(), settings, 1); 87 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum ent.topDocument().url().string(), settings, 1);
88 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes, 0)); 88 blink::WebGLInfo glInfo;
89 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes, 0, &glInfo));
89 if (!context) { 90 if (!context) {
90 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Could not create a WebGL context.")); 91 String statusMessage("Could not create a WebGL context for VendorInfo = ");
92 statusMessage.append(glInfo.vendorInfo);
93 statusMessage.append(", RendererInfo = ");
94 statusMessage.append(glInfo.rendererInfo);
95 statusMessage.append(", DriverInfo = ");
96 statusMessage.append(glInfo.driverVersion);
97 statusMessage.append(".");
98 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, statusMessage));
91 return nullptr; 99 return nullptr;
92 } 100 }
93 101
94 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g et()); 102 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g et());
95 if (!extensionsUtil) 103 if (!extensionsUtil)
96 return nullptr; 104 return nullptr;
97 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) 105 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker"))
98 context->pushGroupMarkerEXT("WebGLRenderingContext"); 106 context->pushGroupMarkerEXT("WebGLRenderingContext");
99 107
100 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN oop(new WebGLRenderingContext(canvas, context.release(), attrs)); 108 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN oop(new WebGLRenderingContext(canvas, context.release(), attrs));
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 visitor->trace(m_webglDrawBuffers); 176 visitor->trace(m_webglDrawBuffers);
169 visitor->trace(m_webglCompressedTextureATC); 177 visitor->trace(m_webglCompressedTextureATC);
170 visitor->trace(m_webglCompressedTextureETC1); 178 visitor->trace(m_webglCompressedTextureETC1);
171 visitor->trace(m_webglCompressedTexturePVRTC); 179 visitor->trace(m_webglCompressedTexturePVRTC);
172 visitor->trace(m_webglCompressedTextureS3TC); 180 visitor->trace(m_webglCompressedTextureS3TC);
173 visitor->trace(m_webglDepthTexture); 181 visitor->trace(m_webglDepthTexture);
174 WebGLRenderingContextBase::trace(visitor); 182 WebGLRenderingContextBase::trace(visitor);
175 } 183 }
176 184
177 } // namespace blink 185 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698