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

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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return nullptr; 77 return nullptr;
78 } 78 }
79 79
80 // The only situation that attrs is null is through Document::getCSSCanvasCo ntext(). 80 // The only situation that attrs is null is through Document::getCSSCanvasCo ntext().
81 RefPtrWillBeRawPtr<WebGLContextAttributes> defaultAttrs = nullptr; 81 RefPtrWillBeRawPtr<WebGLContextAttributes> defaultAttrs = nullptr;
82 if (!attrs) { 82 if (!attrs) {
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, 1); 86 blink::WebGraphicsContext3D::Attributes attributes = attrs->attributes(docum ent.topDocument().url().string(), settings, 1);
87 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes, 0)); 87 blink::WebGLInfo glInfo;
88 OwnPtr<blink::WebGraphicsContext3D> context = adoptPtr(blink::Platform::curr ent()->createOffscreenGraphicsContext3D(attributes, 0, &glInfo));
88 if (!context) { 89 if (!context) {
89 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, "Could not create a WebGL context.")); 90 String statusMessage("Could not create a WebGL context for");
91 statusMessage.append("VendorInfo= ");
Ken Russell (switch to Gerrit) 2014/11/04 00:37:49 Combine these two constant strings. Add space betw
sivag 2014/11/04 12:33:32 Done.
92 statusMessage.append(glInfo.vendorInfo);
93 statusMessage.append(",");
94 statusMessage.append("RendererInfo= ");
Ken Russell (switch to Gerrit) 2014/11/04 00:37:49 Combine the adjacent constant strings here and bel
sivag 2014/11/04 12:33:32 Done.
95 statusMessage.append(glInfo.rendererInfo);
96 statusMessage.append(",");
97 statusMessage.append("DriverInfo= ");
98 statusMessage.append(glInfo.driverVersion);
99 statusMessage.append(",");
100 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, statusMessage));
90 return nullptr; 101 return nullptr;
91 } 102 }
92 103
93 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g et()); 104 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g et());
94 if (!extensionsUtil) 105 if (!extensionsUtil)
95 return nullptr; 106 return nullptr;
96 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) 107 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker"))
97 context->pushGroupMarkerEXT("WebGLRenderingContext"); 108 context->pushGroupMarkerEXT("WebGLRenderingContext");
98 109
99 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN oop(new WebGLRenderingContext(canvas, context.release(), attrs)); 110 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN oop(new WebGLRenderingContext(canvas, context.release(), attrs));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 visitor->trace(m_webglDrawBuffers); 176 visitor->trace(m_webglDrawBuffers);
166 visitor->trace(m_webglCompressedTextureATC); 177 visitor->trace(m_webglCompressedTextureATC);
167 visitor->trace(m_webglCompressedTextureETC1); 178 visitor->trace(m_webglCompressedTextureETC1);
168 visitor->trace(m_webglCompressedTexturePVRTC); 179 visitor->trace(m_webglCompressedTexturePVRTC);
169 visitor->trace(m_webglCompressedTextureS3TC); 180 visitor->trace(m_webglCompressedTextureS3TC);
170 visitor->trace(m_webglDepthTexture); 181 visitor->trace(m_webglDepthTexture);
171 WebGLRenderingContextBase::trace(visitor); 182 WebGLRenderingContextBase::trace(visitor);
172 } 183 }
173 184
174 } // 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