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

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

Issue 1817323003: Revert of Remove create/delete methods from WebGraphicsContext3D. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@complex-casts
Patch Set: Created 4 years, 9 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 { 194 {
195 } 195 }
196 196
197 WebGLFramebuffer* WebGLFramebuffer::create(WebGLRenderingContextBase* ctx) 197 WebGLFramebuffer* WebGLFramebuffer::create(WebGLRenderingContextBase* ctx)
198 { 198 {
199 return new WebGLFramebuffer(ctx); 199 return new WebGLFramebuffer(ctx);
200 } 200 }
201 201
202 WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContextBase* ctx) 202 WebGLFramebuffer::WebGLFramebuffer(WebGLRenderingContextBase* ctx)
203 : WebGLContextObject(ctx) 203 : WebGLContextObject(ctx)
204 , m_object(0) 204 , m_object(ctx->webContext()->createFramebuffer())
205 , m_destructionInProgress(false) 205 , m_destructionInProgress(false)
206 , m_hasEverBeenBound(false) 206 , m_hasEverBeenBound(false)
207 , m_readBuffer(GL_COLOR_ATTACHMENT0) 207 , m_readBuffer(GL_COLOR_ATTACHMENT0)
208 { 208 {
209 ctx->contextGL()->GenFramebuffers(1, &m_object);
210 } 209 }
211 210
212 WebGLFramebuffer::~WebGLFramebuffer() 211 WebGLFramebuffer::~WebGLFramebuffer()
213 { 212 {
214 // Attachments in |m_attachments| will be deleted from other 213 // Attachments in |m_attachments| will be deleted from other
215 // places, and we must not touch that map in deleteObjectImpl once 214 // places, and we must not touch that map in deleteObjectImpl once
216 // the destructor has been entered. 215 // the destructor has been entered.
217 m_destructionInProgress = true; 216 m_destructionInProgress = true;
218 217
219 // See the comment in WebGLObject::detachAndDeleteObject(). 218 // See the comment in WebGLObject::detachAndDeleteObject().
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 // Both the AttachmentMap and its WebGLAttachment objects are GCed 360 // Both the AttachmentMap and its WebGLAttachment objects are GCed
362 // objects and cannot be accessed after the destructor has been 361 // objects and cannot be accessed after the destructor has been
363 // entered, as they may have been finalized already during the 362 // entered, as they may have been finalized already during the
364 // same GC sweep. These attachments' OpenGL objects will be fully 363 // same GC sweep. These attachments' OpenGL objects will be fully
365 // destroyed once their JavaScript wrappers are collected. 364 // destroyed once their JavaScript wrappers are collected.
366 if (!m_destructionInProgress) { 365 if (!m_destructionInProgress) {
367 for (const auto& attachment : m_attachments) 366 for (const auto& attachment : m_attachments)
368 attachment.value->onDetached(context3d, gl); 367 attachment.value->onDetached(context3d, gl);
369 } 368 }
370 369
371 gl->DeleteFramebuffers(1, &m_object); 370 context3d->deleteFramebuffer(m_object);
372 m_object = 0; 371 m_object = 0;
373 } 372 }
374 373
375 bool WebGLFramebuffer::isBound(GLenum target) const 374 bool WebGLFramebuffer::isBound(GLenum target) const
376 { 375 {
377 return (context()->getFramebufferBinding(target) == this); 376 return (context()->getFramebufferBinding(target) == this);
378 } 377 }
379 378
380 void WebGLFramebuffer::drawBuffers(const Vector<GLenum>& bufs) 379 void WebGLFramebuffer::drawBuffers(const Vector<GLenum>& bufs)
381 { 380 {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
423 return GL_NONE; 422 return GL_NONE;
424 } 423 }
425 424
426 DEFINE_TRACE(WebGLFramebuffer) 425 DEFINE_TRACE(WebGLFramebuffer)
427 { 426 {
428 visitor->trace(m_attachments); 427 visitor->trace(m_attachments);
429 WebGLContextObject::trace(visitor); 428 WebGLContextObject::trace(visitor);
430 } 429 }
431 430
432 } // namespace blink 431 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLFramebuffer.h ('k') | third_party/WebKit/Source/modules/webgl/WebGLQuery.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698