OLD | NEW |
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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 "cc/gl_renderer.h" | 5 #include "cc/gl_renderer.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "cc/damage_tracker.h" | 12 #include "cc/damage_tracker.h" |
13 #include "cc/geometry_binding.h" | 13 #include "cc/geometry_binding.h" |
14 #include "cc/layer_quad.h" | 14 #include "cc/layer_quad.h" |
15 #include "cc/math_util.h" | 15 #include "cc/math_util.h" |
16 #include "cc/platform_color.h" | 16 #include "cc/platform_color.h" |
17 #include "cc/priority_calculator.h" | 17 #include "cc/priority_calculator.h" |
18 #include "cc/proxy.h" | 18 #include "cc/proxy.h" |
19 #include "cc/render_pass.h" | 19 #include "cc/render_pass.h" |
20 #include "cc/render_surface_filters.h" | 20 #include "cc/render_surface_filters.h" |
21 #include "cc/scoped_resource.h" | 21 #include "cc/scoped_resource.h" |
22 #include "cc/settings.h" | |
23 #include "cc/single_thread_proxy.h" | 22 #include "cc/single_thread_proxy.h" |
24 #include "cc/stream_video_draw_quad.h" | 23 #include "cc/stream_video_draw_quad.h" |
25 #include "cc/texture_draw_quad.h" | 24 #include "cc/texture_draw_quad.h" |
26 #include "cc/video_layer_impl.h" | 25 #include "cc/video_layer_impl.h" |
27 #include "third_party/khronos/GLES2/gl2.h" | 26 #include "third_party/khronos/GLES2/gl2.h" |
28 #include "third_party/khronos/GLES2/gl2ext.h" | 27 #include "third_party/khronos/GLES2/gl2ext.h" |
29 #include "third_party/skia/include/core/SkBitmap.h" | 28 #include "third_party/skia/include/core/SkBitmap.h" |
30 #include "third_party/skia/include/core/SkColor.h" | 29 #include "third_party/skia/include/core/SkColor.h" |
31 #include "third_party/skia/include/gpu/GrContext.h" | 30 #include "third_party/skia/include/gpu/GrContext.h" |
32 #include "third_party/skia/include/gpu/GrTexture.h" | 31 #include "third_party/skia/include/gpu/GrTexture.h" |
(...skipping 30 matching lines...) Expand all Loading... |
63 | 62 |
64 scoped_ptr<GLRenderer> GLRenderer::create(RendererClient* client, ResourceProvid
er* resourceProvider) | 63 scoped_ptr<GLRenderer> GLRenderer::create(RendererClient* client, ResourceProvid
er* resourceProvider) |
65 { | 64 { |
66 scoped_ptr<GLRenderer> renderer(make_scoped_ptr(new GLRenderer(client, resou
rceProvider))); | 65 scoped_ptr<GLRenderer> renderer(make_scoped_ptr(new GLRenderer(client, resou
rceProvider))); |
67 if (!renderer->initialize()) | 66 if (!renderer->initialize()) |
68 return scoped_ptr<GLRenderer>(); | 67 return scoped_ptr<GLRenderer>(); |
69 | 68 |
70 return renderer.Pass(); | 69 return renderer.Pass(); |
71 } | 70 } |
72 | 71 |
73 GLRenderer::GLRenderer(RendererClient* client, | 72 GLRenderer::GLRenderer(RendererClient* client, ResourceProvider* resourceProvide
r) |
74 ResourceProvider* resourceProvider) | |
75 : DirectRenderer(client, resourceProvider) | 73 : DirectRenderer(client, resourceProvider) |
76 , m_offscreenFramebufferId(0) | 74 , m_offscreenFramebufferId(0) |
77 , m_sharedGeometryQuad(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)) | 75 , m_sharedGeometryQuad(gfx::RectF(-0.5f, -0.5f, 1.0f, 1.0f)) |
78 , m_context(resourceProvider->graphicsContext3D()) | 76 , m_context(resourceProvider->graphicsContext3D()) |
79 , m_isViewportChanged(false) | 77 , m_isViewportChanged(false) |
80 , m_isFramebufferDiscarded(false) | 78 , m_isFramebufferDiscarded(false) |
81 , m_discardFramebufferWhenNotVisible(false) | 79 , m_discardFramebufferWhenNotVisible(false) |
82 , m_isUsingBindUniform(false) | 80 , m_isUsingBindUniform(false) |
83 , m_visible(true) | 81 , m_visible(true) |
84 { | 82 { |
(...skipping 15 matching lines...) Expand all Loading... |
100 | 98 |
101 if (settings().acceleratePainting && extensions.count("GL_EXT_texture_format
_BGRA8888") | 99 if (settings().acceleratePainting && extensions.count("GL_EXT_texture_format
_BGRA8888") |
102 && extensions.count("GL_EXT_read_format_bg
ra")) | 100 && extensions.count("GL_EXT_read_format_bg
ra")) |
103 m_capabilities.usingAcceleratedPainting = true; | 101 m_capabilities.usingAcceleratedPainting = true; |
104 else | 102 else |
105 m_capabilities.usingAcceleratedPainting = false; | 103 m_capabilities.usingAcceleratedPainting = false; |
106 | 104 |
107 | 105 |
108 m_capabilities.contextHasCachedFrontBuffer = extensions.count("GL_CHROMIUM_f
ront_buffer_cached"); | 106 m_capabilities.contextHasCachedFrontBuffer = extensions.count("GL_CHROMIUM_f
ront_buffer_cached"); |
109 | 107 |
110 m_capabilities.usingPartialSwap = Settings::partialSwapEnabled() && extensio
ns.count("GL_CHROMIUM_post_sub_buffer"); | 108 m_capabilities.usingPartialSwap = settings().partialSwapEnabled && extension
s.count("GL_CHROMIUM_post_sub_buffer"); |
111 | 109 |
112 // Use the swapBuffers callback only with the threaded proxy. | 110 // Use the swapBuffers callback only with the threaded proxy. |
113 if (m_client->hasImplThread()) | 111 if (m_client->hasImplThread()) |
114 m_capabilities.usingSwapCompleteCallback = extensions.count("GL_CHROMIUM
_swapbuffers_complete_callback"); | 112 m_capabilities.usingSwapCompleteCallback = extensions.count("GL_CHROMIUM
_swapbuffers_complete_callback"); |
115 if (m_capabilities.usingSwapCompleteCallback) | 113 if (m_capabilities.usingSwapCompleteCallback) |
116 m_context->setSwapBuffersCompleteCallbackCHROMIUM(this); | 114 m_context->setSwapBuffersCompleteCallbackCHROMIUM(this); |
117 | 115 |
118 m_capabilities.usingSetVisibility = extensions.count("GL_CHROMIUM_set_visibi
lity"); | 116 m_capabilities.usingSetVisibility = extensions.count("GL_CHROMIUM_set_visibi
lity"); |
119 | 117 |
120 if (extensions.count("GL_CHROMIUM_iosurface")) | 118 if (extensions.count("GL_CHROMIUM_iosurface")) |
(...skipping 1482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 | 1601 |
1604 releaseRenderPassTextures(); | 1602 releaseRenderPassTextures(); |
1605 } | 1603 } |
1606 | 1604 |
1607 bool GLRenderer::isContextLost() | 1605 bool GLRenderer::isContextLost() |
1608 { | 1606 { |
1609 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); | 1607 return (m_context->getGraphicsResetStatusARB() != GL_NO_ERROR); |
1610 } | 1608 } |
1611 | 1609 |
1612 } // namespace cc | 1610 } // namespace cc |
OLD | NEW |