OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/common/gpu/client/gl_helper.h" | 5 #include "content/common/gpu/client/gl_helper.h" |
6 | 6 |
7 #include <queue> | 7 #include <queue> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 // lock, and we'll exit early, or we ensure that the texture is bound to the | 540 // lock, and we'll exit early, or we ensure that the texture is bound to the |
541 // framebuffer before the main thread has a chance to delete it. | 541 // framebuffer before the main thread has a chance to delete it. |
542 base::AutoLock auto_lock(request->lock); | 542 base::AutoLock auto_lock(request->lock); |
543 if (!request->texture || !request->pixels) | 543 if (!request->texture || !request->pixels) |
544 return; | 544 return; |
545 pixels = request->pixels; | 545 pixels = request->pixels; |
546 request->pixels = NULL; | 546 request->pixels = NULL; |
547 size = request->size; | 547 size = request->size; |
548 { | 548 { |
549 ScopedFlush flush(context); | 549 ScopedFlush flush(context); |
550 ScopedFramebufferBinder<GL_DRAW_FRAMEBUFFER> framebuffer_binder( | 550 ScopedFramebufferBinder<GL_READ_FRAMEBUFFER> framebuffer_binder( |
551 context, dst_framebuffer); | 551 context, dst_framebuffer); |
552 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder( | 552 ScopedTextureBinder<GL_TEXTURE_2D> texture_binder( |
553 context, request->texture); | 553 context, request->texture); |
554 context->framebufferTexture2D(GL_DRAW_FRAMEBUFFER, | 554 context->framebufferTexture2D(GL_READ_FRAMEBUFFER, |
555 GL_COLOR_ATTACHMENT0, | 555 GL_COLOR_ATTACHMENT0, |
556 GL_TEXTURE_2D, | 556 GL_TEXTURE_2D, |
557 request->texture, | 557 request->texture, |
558 0); | 558 0); |
559 } | 559 } |
560 } | 560 } |
561 bool result = context->readBackFramebuffer( | 561 bool result = context->readBackFramebuffer( |
562 pixels, | 562 pixels, |
563 4 * size.GetArea(), | 563 4 * size.GetArea(), |
564 dst_framebuffer.id(), | 564 dst_framebuffer.id(), |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 WebKit::WGC3Dint compile_status = 0; | 673 WebKit::WGC3Dint compile_status = 0; |
674 context_->getShaderiv(shader, GL_COMPILE_STATUS, &compile_status); | 674 context_->getShaderiv(shader, GL_COMPILE_STATUS, &compile_status); |
675 if (!compile_status) { | 675 if (!compile_status) { |
676 LOG(ERROR) << std::string(context_->getShaderInfoLog(shader).utf8()); | 676 LOG(ERROR) << std::string(context_->getShaderInfoLog(shader).utf8()); |
677 return 0; | 677 return 0; |
678 } | 678 } |
679 return shader.Detach(); | 679 return shader.Detach(); |
680 } | 680 } |
681 | 681 |
682 } // namespace content | 682 } // namespace content |
OLD | NEW |