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/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 197 |
198 // Check for texture fast paths. Currently we always use MO8 textures, | 198 // Check for texture fast paths. Currently we always use MO8 textures, |
199 // so we only need to avoid POT textures if we have an NPOT fast-path. | 199 // so we only need to avoid POT textures if we have an NPOT fast-path. |
200 capabilities_.avoid_pow2_textures = context_caps.fast_npot_mo8_textures; | 200 capabilities_.avoid_pow2_textures = context_caps.fast_npot_mo8_textures; |
201 | 201 |
202 capabilities_.using_offscreen_context3d = true; | 202 capabilities_.using_offscreen_context3d = true; |
203 | 203 |
204 capabilities_.using_map_image = | 204 capabilities_.using_map_image = |
205 Settings().use_map_image && context_caps.map_image; | 205 Settings().use_map_image && context_caps.map_image; |
206 | 206 |
| 207 capabilities_.using_discard_framebuffer = |
| 208 context_caps.discard_framebuffer; |
| 209 |
207 is_using_bind_uniform_ = context_caps.bind_uniform_location; | 210 is_using_bind_uniform_ = context_caps.bind_uniform_location; |
208 | 211 |
209 if (!InitializeSharedObjects()) | 212 if (!InitializeSharedObjects()) |
210 return false; | 213 return false; |
211 | 214 |
212 // Make sure the viewport and context gets initialized, even if it is to zero. | 215 // Make sure the viewport and context gets initialized, even if it is to zero. |
213 ViewportChanged(); | 216 ViewportChanged(); |
214 return true; | 217 return true; |
215 } | 218 } |
216 | 219 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 289 |
287 void GLRenderer::ClearFramebuffer(DrawingFrame* frame) { | 290 void GLRenderer::ClearFramebuffer(DrawingFrame* frame) { |
288 // It's unsafe to clear when we have a stencil test because glClear ignores | 291 // It's unsafe to clear when we have a stencil test because glClear ignores |
289 // stencil. | 292 // stencil. |
290 if (client_->ExternalStencilTestEnabled() && | 293 if (client_->ExternalStencilTestEnabled() && |
291 frame->current_render_pass == frame->root_render_pass) { | 294 frame->current_render_pass == frame->root_render_pass) { |
292 DCHECK(!frame->current_render_pass->has_transparent_background); | 295 DCHECK(!frame->current_render_pass->has_transparent_background); |
293 return; | 296 return; |
294 } | 297 } |
295 | 298 |
| 299 if (capabilities_.using_discard_framebuffer) { |
| 300 GLenum attachments[] = { |
| 301 GL_COLOR_EXT |
| 302 }; |
| 303 context_->discardFramebufferEXT( |
| 304 GL_FRAMEBUFFER, arraysize(attachments), attachments); |
| 305 } |
| 306 |
296 // On DEBUG builds, opaque render passes are cleared to blue to easily see | 307 // On DEBUG builds, opaque render passes are cleared to blue to easily see |
297 // regions that were not drawn on the screen. | 308 // regions that were not drawn on the screen. |
298 if (frame->current_render_pass->has_transparent_background) | 309 if (frame->current_render_pass->has_transparent_background) |
299 GLC(context_, context_->clearColor(0, 0, 0, 0)); | 310 GLC(context_, context_->clearColor(0, 0, 0, 0)); |
300 else | 311 else |
301 GLC(context_, context_->clearColor(0, 0, 1, 1)); | 312 GLC(context_, context_->clearColor(0, 0, 1, 1)); |
302 | 313 |
303 bool always_clear = false; | 314 bool always_clear = false; |
304 #ifndef NDEBUG | 315 #ifndef NDEBUG |
305 always_clear = true; | 316 always_clear = true; |
(...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3150 std::string unique_context_name = base::StringPrintf( | 3161 std::string unique_context_name = base::StringPrintf( |
3151 "%s-Offscreen-%p", | 3162 "%s-Offscreen-%p", |
3152 Settings().compositor_name.c_str(), | 3163 Settings().compositor_name.c_str(), |
3153 context_); | 3164 context_); |
3154 offscreen_context_provider->Context3d()->pushGroupMarkerEXT( | 3165 offscreen_context_provider->Context3d()->pushGroupMarkerEXT( |
3155 unique_context_name.c_str()); | 3166 unique_context_name.c_str()); |
3156 } | 3167 } |
3157 | 3168 |
3158 | 3169 |
3159 } // namespace cc | 3170 } // namespace cc |
OLD | NEW |