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

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

Issue 1415873007: Fixed minor memory leak in framebuffer attachments. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 2403 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 } 2414 }
2415 break; 2415 break;
2416 default: 2416 default:
2417 webContext()->framebufferRenderbuffer(target, attachment, renderbufferta rget, bufferObject); 2417 webContext()->framebufferRenderbuffer(target, attachment, renderbufferta rget, bufferObject);
2418 } 2418 }
2419 if (isWebGL2OrHigher() && attachment == GL_DEPTH_STENCIL_ATTACHMENT) { 2419 if (isWebGL2OrHigher() && attachment == GL_DEPTH_STENCIL_ATTACHMENT) {
2420 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN T + STENCIL_ATTACHMENT. 2420 // On ES3, DEPTH_STENCIL_ATTACHMENT is like an alias for DEPTH_ATTACHMEN T + STENCIL_ATTACHMENT.
2421 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP TH_STENCIL_ATTACHMENT in WebGL 2. 2421 // We divide it here so in WebGLFramebuffer, we don't have to handle DEP TH_STENCIL_ATTACHMENT in WebGL 2.
2422 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT TACHMENT, buffer); 2422 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_DEPTH_AT TACHMENT, buffer);
2423 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_ ATTACHMENT, buffer); 2423 framebufferBinding->setAttachmentForBoundFramebuffer(target, GL_STENCIL_ ATTACHMENT, buffer);
2424 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ DEPTH_ATTACHMENT, buffer);
2425 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", GL_ STENCIL_ATTACHMENT, buffer);
2424 } else { 2426 } else {
2425 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, buffer); 2427 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, buffer);
2428 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", att achment, buffer);
2426 } 2429 }
2427 applyStencilTest(); 2430 applyStencilTest();
2428 preserveObjectWrapper(scriptState, framebufferBinding, "renderbuffer", attac hment, buffer);
2429 } 2431 }
2430 2432
2431 void WebGLRenderingContextBase::framebufferTexture2D(ScriptState* scriptState, G Lenum target, GLenum attachment, GLenum textarget, WebGLTexture* texture, GLint level) 2433 void WebGLRenderingContextBase::framebufferTexture2D(ScriptState* scriptState, G Lenum target, GLenum attachment, GLenum textarget, WebGLTexture* texture, GLint level)
2432 { 2434 {
2433 if (isContextLost() || !validateFramebufferFuncParameters("framebufferTextur e2D", target, attachment)) 2435 if (isContextLost() || !validateFramebufferFuncParameters("framebufferTextur e2D", target, attachment))
2434 return; 2436 return;
2435 if (isWebGL2OrHigher()) { 2437 if (isWebGL2OrHigher()) {
2436 if (!validateTexFuncLevel("framebufferTexture2D", textarget, level)) 2438 if (!validateTexFuncLevel("framebufferTexture2D", textarget, level))
2437 return; 2439 return;
2438 } else if (level) { 2440 } else if (level) {
(...skipping 22 matching lines...) Expand all
2461 webContext()->framebufferTexture2D(target, attachment, textarget, textur eObject, level); 2463 webContext()->framebufferTexture2D(target, attachment, textarget, textur eObject, level);
2462 break; 2464 break;
2463 case GL_STENCIL_ATTACHMENT: 2465 case GL_STENCIL_ATTACHMENT:
2464 webContext()->framebufferTexture2D(target, attachment, textarget, textur eObject, level); 2466 webContext()->framebufferTexture2D(target, attachment, textarget, textur eObject, level);
2465 break; 2467 break;
2466 default: 2468 default:
2467 webContext()->framebufferTexture2D(target, attachment, textarget, textur eObject, level); 2469 webContext()->framebufferTexture2D(target, attachment, textarget, textur eObject, level);
2468 } 2470 }
2469 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, tex target, texture, level); 2471 framebufferBinding->setAttachmentForBoundFramebuffer(target, attachment, tex target, texture, level);
2470 applyStencilTest(); 2472 applyStencilTest();
2471 preserveObjectWrapper(scriptState, framebufferBinding, "texture2d", attachme nt, texture); 2473 preserveObjectWrapper(scriptState, framebufferBinding, "attachment", attachm ent, texture);
2472 } 2474 }
2473 2475
2474 void WebGLRenderingContextBase::frontFace(GLenum mode) 2476 void WebGLRenderingContextBase::frontFace(GLenum mode)
2475 { 2477 {
2476 if (isContextLost()) 2478 if (isContextLost())
2477 return; 2479 return;
2478 switch (mode) { 2480 switch (mode) {
2479 case GL_CW: 2481 case GL_CW:
2480 case GL_CCW: 2482 case GL_CCW:
2481 break; 2483 break;
(...skipping 4422 matching lines...) Expand 10 before | Expand all | Expand 10 after
6904 6906
6905 return totalBytesPerPixel; 6907 return totalBytesPerPixel;
6906 } 6908 }
6907 6909
6908 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const 6910 DrawingBuffer* WebGLRenderingContextBase::drawingBuffer() const
6909 { 6911 {
6910 return m_drawingBuffer.get(); 6912 return m_drawingBuffer.get();
6911 } 6913 }
6912 6914
6913 } // namespace blink 6915 } // 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