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

Side by Side Diff: third_party/WebKit/Source/modules/webgl/WebGLDrawBuffers.cpp

Issue 2389203002: reflow comments in modules/webgl (Closed)
Patch Set: Created 4 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) 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, 67 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION,
68 "drawBuffersWEBGL", 68 "drawBuffersWEBGL",
69 "must provide exactly one buffer"); 69 "must provide exactly one buffer");
70 return; 70 return;
71 } 71 }
72 if (bufs[0] != GL_BACK && bufs[0] != GL_NONE) { 72 if (bufs[0] != GL_BACK && bufs[0] != GL_NONE) {
73 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION, 73 scoped.context()->synthesizeGLError(GL_INVALID_OPERATION,
74 "drawBuffersWEBGL", "BACK or NONE"); 74 "drawBuffersWEBGL", "BACK or NONE");
75 return; 75 return;
76 } 76 }
77 // Because the backbuffer is simulated on all current WebKit ports, we need to change BACK to COLOR_ATTACHMENT0. 77 // Because the backbuffer is simulated on all current WebKit ports, we need
78 // to change BACK to COLOR_ATTACHMENT0.
78 GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE; 79 GLenum value = (bufs[0] == GL_BACK) ? GL_COLOR_ATTACHMENT0 : GL_NONE;
79 scoped.context()->contextGL()->DrawBuffersEXT(1, &value); 80 scoped.context()->contextGL()->DrawBuffersEXT(1, &value);
80 scoped.context()->setBackDrawBuffer(bufs[0]); 81 scoped.context()->setBackDrawBuffer(bufs[0]);
81 } else { 82 } else {
82 if (n > scoped.context()->maxDrawBuffers()) { 83 if (n > scoped.context()->maxDrawBuffers()) {
83 scoped.context()->synthesizeGLError(GL_INVALID_VALUE, "drawBuffersWEBGL", 84 scoped.context()->synthesizeGLError(GL_INVALID_VALUE, "drawBuffersWEBGL",
84 "more than max draw buffers"); 85 "more than max draw buffers");
85 return; 86 return;
86 } 87 }
87 for (GLsizei i = 0; i < n; ++i) { 88 for (GLsizei i = 0; i < n; ++i) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 GL_TEXTURE_2D, depth, 0); 162 GL_TEXTURE_2D, depth, 0);
162 if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != 163 if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) !=
163 GL_FRAMEBUFFER_COMPLETE) { 164 GL_FRAMEBUFFER_COMPLETE) {
164 ok = false; 165 ok = false;
165 break; 166 break;
166 } 167 }
167 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, 168 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
168 GL_TEXTURE_2D, 0, 0); 169 GL_TEXTURE_2D, 0, 0);
169 } 170 }
170 if (supportsDepthStencil) { 171 if (supportsDepthStencil) {
171 // For ES 2.0 contexts DEPTH_STENCIL is not available natively, so we emul ate it 172 // For ES 2.0 contexts DEPTH_STENCIL is not available natively, so we
172 // at the command buffer level for WebGL contexts. 173 // emulate it at the command buffer level for WebGL contexts.
173 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, 174 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
174 GL_TEXTURE_2D, depthStencil, 0); 175 GL_TEXTURE_2D, depthStencil, 0);
175 if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) != 176 if (gl->CheckFramebufferStatus(GL_FRAMEBUFFER) !=
176 GL_FRAMEBUFFER_COMPLETE) { 177 GL_FRAMEBUFFER_COMPLETE) {
177 ok = false; 178 ok = false;
178 break; 179 break;
179 } 180 }
180 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, 181 gl->FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
181 GL_TEXTURE_2D, 0, 0); 182 GL_TEXTURE_2D, 0, 0);
182 } 183 }
183 } 184 }
184 185
185 webglContext->restoreCurrentFramebuffer(); 186 webglContext->restoreCurrentFramebuffer();
186 gl->DeleteFramebuffers(1, &fbo); 187 gl->DeleteFramebuffers(1, &fbo);
187 webglContext->restoreCurrentTexture2D(); 188 webglContext->restoreCurrentTexture2D();
188 if (supportsDepth) 189 if (supportsDepth)
189 gl->DeleteTextures(1, &depth); 190 gl->DeleteTextures(1, &depth);
190 if (supportsDepthStencil) 191 if (supportsDepthStencil)
191 gl->DeleteTextures(1, &depthStencil); 192 gl->DeleteTextures(1, &depthStencil);
192 gl->DeleteTextures(colors.size(), colors.data()); 193 gl->DeleteTextures(colors.size(), colors.data());
193 194
194 return ok; 195 return ok;
195 } 196 }
196 197
197 } // namespace blink 198 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698