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

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

Issue 640293002: [WebGL-blink] Return meaningful information in WebGL context creation error message (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 months 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
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");
92 statusMessage.append("VendorInfo= ");
93 statusMessage.append(glInfo.vendorInfo);
94 statusMessage.append(",");
95 statusMessage.append("RendererInfo= ");
96 statusMessage.append(glInfo.rendererInfo);
97 statusMessage.append(",");
98 statusMessage.append("DriverInfo= ");
99 statusMessage.append(glInfo.driverVersion);
100 statusMessage.append(",");
101 canvas->dispatchEvent(WebGLContextEvent::create(EventTypeNames::webglcon textcreationerror, false, true, statusMessage));
91 return nullptr; 102 return nullptr;
92 } 103 }
93 104
94 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g et()); 105 OwnPtr<Extensions3DUtil> extensionsUtil = Extensions3DUtil::create(context.g et());
95 if (!extensionsUtil) 106 if (!extensionsUtil)
96 return nullptr; 107 return nullptr;
97 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker")) 108 if (extensionsUtil->supportsExtension("GL_EXT_debug_marker"))
98 context->pushGroupMarkerEXT("WebGLRenderingContext"); 109 context->pushGroupMarkerEXT("WebGLRenderingContext");
99 110
100 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN oop(new WebGLRenderingContext(canvas, context.release(), attrs)); 111 OwnPtrWillBeRawPtr<WebGLRenderingContext> renderingContext = adoptPtrWillBeN oop(new WebGLRenderingContext(canvas, context.release(), attrs));
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 visitor->trace(m_webglDrawBuffers); 177 visitor->trace(m_webglDrawBuffers);
167 visitor->trace(m_webglCompressedTextureATC); 178 visitor->trace(m_webglCompressedTextureATC);
168 visitor->trace(m_webglCompressedTextureETC1); 179 visitor->trace(m_webglCompressedTextureETC1);
169 visitor->trace(m_webglCompressedTexturePVRTC); 180 visitor->trace(m_webglCompressedTexturePVRTC);
170 visitor->trace(m_webglCompressedTextureS3TC); 181 visitor->trace(m_webglCompressedTextureS3TC);
171 visitor->trace(m_webglDepthTexture); 182 visitor->trace(m_webglDepthTexture);
172 WebGLRenderingContextBase::trace(visitor); 183 WebGLRenderingContextBase::trace(visitor);
173 } 184 }
174 185
175 } // namespace blink 186 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | Source/core/html/canvas/WebGLRenderingContextBase.cpp » ('j') | public/platform/Platform.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698