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

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

Issue 24096029: Moved the majority of WebGL functionality into WebGLRenderingContextBase (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed typo in gypi, was only causing issues on Windows (?!?) Created 6 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 11 matching lines...) Expand all
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */ 24 */
25 25
26 #include "config.h" 26 #include "config.h"
27 27
28 #include "core/html/canvas/WebGLDrawBuffers.h" 28 #include "core/html/canvas/WebGLDrawBuffers.h"
29 29
30 namespace WebCore { 30 namespace WebCore {
31 31
32 WebGLDrawBuffers::WebGLDrawBuffers(WebGLRenderingContext* context) 32 WebGLDrawBuffers::WebGLDrawBuffers(WebGLRenderingContextBase* context)
33 : WebGLExtension(context) 33 : WebGLExtension(context)
34 { 34 {
35 ScriptWrappable::init(this); 35 ScriptWrappable::init(this);
36 context->extensionsUtil()->ensureExtensionEnabled("GL_EXT_draw_buffers"); 36 context->extensionsUtil()->ensureExtensionEnabled("GL_EXT_draw_buffers");
37 } 37 }
38 38
39 WebGLDrawBuffers::~WebGLDrawBuffers() 39 WebGLDrawBuffers::~WebGLDrawBuffers()
40 { 40 {
41 } 41 }
42 42
43 WebGLExtension::ExtensionName WebGLDrawBuffers::name() const 43 WebGLExtensionName WebGLDrawBuffers::name() const
44 { 44 {
45 return WebGLExtension::WebGLDrawBuffersName; 45 return WebGLDrawBuffersName;
46 } 46 }
47 47
48 PassRefPtr<WebGLDrawBuffers> WebGLDrawBuffers::create(WebGLRenderingContext* con text) 48 PassRefPtr<WebGLDrawBuffers> WebGLDrawBuffers::create(WebGLRenderingContextBase* context)
49 { 49 {
50 return adoptRef(new WebGLDrawBuffers(context)); 50 return adoptRef(new WebGLDrawBuffers(context));
51 } 51 }
52 52
53 // static 53 // static
54 bool WebGLDrawBuffers::supported(WebGLRenderingContext* context) 54 bool WebGLDrawBuffers::supported(WebGLRenderingContextBase* context)
55 { 55 {
56 return (context->extensionsUtil()->supportsExtension("GL_EXT_draw_buffers") 56 return (context->extensionsUtil()->supportsExtension("GL_EXT_draw_buffers")
57 && satisfiesWebGLRequirements(context)); 57 && satisfiesWebGLRequirements(context));
58 } 58 }
59 59
60 const char* WebGLDrawBuffers::extensionName() 60 const char* WebGLDrawBuffers::extensionName()
61 { 61 {
62 return "WEBGL_draw_buffers"; 62 return "WEBGL_draw_buffers";
63 } 63 }
64 64
(...skipping 25 matching lines...) Expand all
90 if (bufs[i] != GL_NONE && bufs[i] != static_cast<GLenum>(GL_COLOR_AT TACHMENT0_EXT + i)) { 90 if (bufs[i] != GL_NONE && bufs[i] != static_cast<GLenum>(GL_COLOR_AT TACHMENT0_EXT + i)) {
91 m_context->synthesizeGLError(GL_INVALID_OPERATION, "drawBuffersW EBGL", "COLOR_ATTACHMENTi_EXT or NONE"); 91 m_context->synthesizeGLError(GL_INVALID_OPERATION, "drawBuffersW EBGL", "COLOR_ATTACHMENTi_EXT or NONE");
92 return; 92 return;
93 } 93 }
94 } 94 }
95 m_context->m_framebufferBinding->drawBuffers(buffers); 95 m_context->m_framebufferBinding->drawBuffers(buffers);
96 } 96 }
97 } 97 }
98 98
99 // static 99 // static
100 bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContext* webglCo ntext) 100 bool WebGLDrawBuffers::satisfiesWebGLRequirements(WebGLRenderingContextBase* web glContext)
101 { 101 {
102 blink::WebGraphicsContext3D* context = webglContext->webGraphicsContext3D(); 102 blink::WebGraphicsContext3D* context = webglContext->webGraphicsContext3D();
103 Extensions3DUtil* extensionsUtil = webglContext->extensionsUtil(); 103 Extensions3DUtil* extensionsUtil = webglContext->extensionsUtil();
104 104
105 // This is called after we make sure GL_EXT_draw_buffers is supported. 105 // This is called after we make sure GL_EXT_draw_buffers is supported.
106 GLint maxDrawBuffers = 0; 106 GLint maxDrawBuffers = 0;
107 GLint maxColorAttachments = 0; 107 GLint maxColorAttachments = 0;
108 context->getIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &maxDrawBuffers); 108 context->getIntegerv(GL_MAX_DRAW_BUFFERS_EXT, &maxDrawBuffers);
109 context->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &maxColorAttachments); 109 context->getIntegerv(GL_MAX_COLOR_ATTACHMENTS_EXT, &maxColorAttachments);
110 if (maxDrawBuffers < 4 || maxColorAttachments < 4) 110 if (maxDrawBuffers < 4 || maxColorAttachments < 4)
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 if (supportsDepth) 171 if (supportsDepth)
172 context->deleteTexture(depth); 172 context->deleteTexture(depth);
173 if (supportsDepthStencil) 173 if (supportsDepthStencil)
174 context->deleteTexture(depthStencil); 174 context->deleteTexture(depthStencil);
175 for (size_t i = 0; i < colors.size(); ++i) 175 for (size_t i = 0; i < colors.size(); ++i)
176 context->deleteTexture(colors[i]); 176 context->deleteTexture(colors[i]);
177 return ok; 177 return ok;
178 } 178 }
179 179
180 } // namespace WebCore 180 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698