OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "config.h" | |
6 | |
7 #include "cc/texture_copier.h" | 5 #include "cc/texture_copier.h" |
8 | 6 |
9 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "build/build_config.h" |
10 #include "cc/gl_renderer.h" // For the GLC() macro. | 9 #include "cc/gl_renderer.h" // For the GLC() macro. |
11 #include "third_party/khronos/GLES2/gl2.h" | 10 #include "third_party/khronos/GLES2/gl2.h" |
12 #include <public/WebGraphicsContext3D.h> | 11 #include <public/WebGraphicsContext3D.h> |
13 | 12 |
14 namespace cc { | 13 namespace cc { |
15 | 14 |
16 AcceleratedTextureCopier::AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*
context, bool usingBindUniforms) | 15 AcceleratedTextureCopier::AcceleratedTextureCopier(WebKit::WebGraphicsContext3D*
context, bool usingBindUniforms) |
17 : m_context(context) | 16 : m_context(context) |
18 , m_usingBindUniforms(usingBindUniforms) | 17 , m_usingBindUniforms(usingBindUniforms) |
19 { | 18 { |
(...skipping 28 matching lines...) Expand all Loading... |
48 void AcceleratedTextureCopier::copyTexture(Parameters parameters) | 47 void AcceleratedTextureCopier::copyTexture(Parameters parameters) |
49 { | 48 { |
50 TRACE_EVENT0("cc", "TextureCopier::copyTexture"); | 49 TRACE_EVENT0("cc", "TextureCopier::copyTexture"); |
51 | 50 |
52 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); | 51 GLC(m_context, m_context->disable(GL_SCISSOR_TEST)); |
53 | 52 |
54 // Note: this code does not restore the viewport, bound program, 2D texture,
framebuffer, buffer or blend enable. | 53 // Note: this code does not restore the viewport, bound program, 2D texture,
framebuffer, buffer or blend enable. |
55 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo)); | 54 GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo)); |
56 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, parameters.destTexture, 0)); | 55 GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTA
CHMENT0, GL_TEXTURE_2D, parameters.destTexture, 0)); |
57 | 56 |
58 #if OS(ANDROID) | 57 #if defined(OS_ANDROID) |
59 // Clear destination to improve performance on tiling GPUs. | 58 // Clear destination to improve performance on tiling GPUs. |
60 // TODO: Use EXT_discard_framebuffer or skip clearing if it isn't available. | 59 // TODO: Use EXT_discard_framebuffer or skip clearing if it isn't available. |
61 GLC(m_context, m_context->clear(GL_COLOR_BUFFER_BIT)); | 60 GLC(m_context, m_context->clear(GL_COLOR_BUFFER_BIT)); |
62 #endif | 61 #endif |
63 | 62 |
64 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, parameters.sourceTextur
e)); | 63 GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, parameters.sourceTextur
e)); |
65 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER
, GL_NEAREST)); | 64 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER
, GL_NEAREST)); |
66 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER
, GL_NEAREST)); | 65 GLC(m_context, m_context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER
, GL_NEAREST)); |
67 | 66 |
68 if (!m_blitProgram->initialized()) | 67 if (!m_blitProgram->initialized()) |
(...skipping 24 matching lines...) Expand all Loading... |
93 | 92 |
94 GLC(m_context, m_context->enable(GL_SCISSOR_TEST)); | 93 GLC(m_context, m_context->enable(GL_SCISSOR_TEST)); |
95 } | 94 } |
96 | 95 |
97 void AcceleratedTextureCopier::flush() | 96 void AcceleratedTextureCopier::flush() |
98 { | 97 { |
99 GLC(m_context, m_context->flush()); | 98 GLC(m_context, m_context->flush()); |
100 } | 99 } |
101 | 100 |
102 } // namespace cc | 101 } // namespace cc |
OLD | NEW |