| 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 #ifndef CC_OUTPUT_GL_RENDERER_H_ | 5 #ifndef CC_OUTPUT_GL_RENDERER_H_ |
| 6 #define CC_OUTPUT_GL_RENDERER_H_ | 6 #define CC_OUTPUT_GL_RENDERER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 const gfx::QuadF& aa_quad, | 216 const gfx::QuadF& aa_quad, |
| 217 const gfx::QuadF* clip_region); | 217 const gfx::QuadF* clip_region); |
| 218 void DrawContentQuadNoAA(const DrawingFrame* frame, | 218 void DrawContentQuadNoAA(const DrawingFrame* frame, |
| 219 const ContentDrawQuadBase* quad, | 219 const ContentDrawQuadBase* quad, |
| 220 ResourceId resource_id, | 220 ResourceId resource_id, |
| 221 const gfx::QuadF* clip_region); | 221 const gfx::QuadF* clip_region); |
| 222 void DrawYUVVideoQuad(const DrawingFrame* frame, | 222 void DrawYUVVideoQuad(const DrawingFrame* frame, |
| 223 const YUVVideoDrawQuad* quad, | 223 const YUVVideoDrawQuad* quad, |
| 224 const gfx::QuadF* clip_region); | 224 const gfx::QuadF* clip_region); |
| 225 | 225 |
| 226 void SetShaderOpacity(float opacity, int alpha_location); | 226 void SetShaderOpacity(const DrawQuad* quad); |
| 227 void SetShaderQuadF(const gfx::QuadF& quad, int quad_location); | 227 void SetShaderQuadF(const gfx::QuadF& quad); |
| 228 void SetShaderMatrix(const gfx::Transform& transform); |
| 229 void SetShaderColor(SkColor color, float opacity); |
| 228 void DrawQuadGeometryClippedByQuadF(const DrawingFrame* frame, | 230 void DrawQuadGeometryClippedByQuadF(const DrawingFrame* frame, |
| 229 const gfx::Transform& draw_transform, | 231 const gfx::Transform& draw_transform, |
| 230 const gfx::RectF& quad_rect, | 232 const gfx::RectF& quad_rect, |
| 231 const gfx::QuadF& clipping_region_quad, | 233 const gfx::QuadF& clipping_region_quad, |
| 232 int matrix_location, | |
| 233 const float uv[8]); | 234 const float uv[8]); |
| 234 void DrawQuadGeometry(const gfx::Transform& projection_matrix, | 235 void DrawQuadGeometry(const gfx::Transform& projection_matrix, |
| 235 const gfx::Transform& draw_transform, | 236 const gfx::Transform& draw_transform, |
| 236 const gfx::RectF& quad_rect, | 237 const gfx::RectF& quad_rect); |
| 237 int matrix_location); | 238 void SetUseProgram(const Program* program); |
| 238 void SetUseProgram(unsigned program); | |
| 239 | 239 |
| 240 bool MakeContextCurrent(); | 240 bool MakeContextCurrent(); |
| 241 | 241 |
| 242 void InitializeSharedObjects(); | 242 void InitializeSharedObjects(); |
| 243 void CleanupSharedObjects(); | 243 void CleanupSharedObjects(); |
| 244 | 244 |
| 245 typedef base::Callback<void(std::unique_ptr<CopyOutputRequest> copy_request, | 245 typedef base::Callback<void(std::unique_ptr<CopyOutputRequest> copy_request, |
| 246 bool success)> | 246 bool success)> |
| 247 AsyncGetFramebufferPixelsCleanupCallback; | 247 AsyncGetFramebufferPixelsCleanupCallback; |
| 248 void FinishedReadback(unsigned source_buffer, | 248 void FinishedReadback(unsigned source_buffer, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 // Resources that have been sent to the GPU process, but not yet swapped. | 290 // Resources that have been sent to the GPU process, but not yet swapped. |
| 291 OverlayResourceLockList pending_overlay_resources_; | 291 OverlayResourceLockList pending_overlay_resources_; |
| 292 | 292 |
| 293 // Resources that should be shortly swapped by the GPU process. | 293 // Resources that should be shortly swapped by the GPU process. |
| 294 std::deque<OverlayResourceLockList> swapping_overlay_resources_; | 294 std::deque<OverlayResourceLockList> swapping_overlay_resources_; |
| 295 | 295 |
| 296 // Resources that the GPU process has finished swapping. The key is the | 296 // Resources that the GPU process has finished swapping. The key is the |
| 297 // texture id of the resource. | 297 // texture id of the resource. |
| 298 std::map<unsigned, OverlayResourceLock> swapped_and_acked_overlay_resources_; | 298 std::map<unsigned, OverlayResourceLock> swapped_and_acked_overlay_resources_; |
| 299 | 299 |
| 300 unsigned offscreen_framebuffer_id_; | 300 unsigned offscreen_framebuffer_id_ = 0u; |
| 301 | 301 |
| 302 std::unique_ptr<StaticGeometryBinding> shared_geometry_; | 302 std::unique_ptr<StaticGeometryBinding> shared_geometry_; |
| 303 std::unique_ptr<DynamicGeometryBinding> clipped_geometry_; | 303 std::unique_ptr<DynamicGeometryBinding> clipped_geometry_; |
| 304 gfx::QuadF shared_geometry_quad_; | 304 gfx::QuadF shared_geometry_quad_; |
| 305 | 305 |
| 306 // If the requested program has not yet been initialized, this will initialize | 306 // If the requested program has not yet been initialized, this will initialize |
| 307 // the program before returning it. | 307 // the program before returning it. |
| 308 const Program* GetProgram(const ProgramKey& key); | 308 const Program* GetProgram(const ProgramKey& key); |
| 309 | 309 |
| 310 // This will return nullptr if the requested program has not yet been | 310 // This will return nullptr if the requested program has not yet been |
| 311 // initialized. | 311 // initialized. |
| 312 const Program* GetProgramIfInitialized(const ProgramKey& key) const; | 312 const Program* GetProgramIfInitialized(const ProgramKey& key) const; |
| 313 | 313 |
| 314 std::unordered_map<ProgramKey, std::unique_ptr<Program>, ProgramKeyHash> | 314 std::unordered_map<ProgramKey, std::unique_ptr<Program>, ProgramKeyHash> |
| 315 program_cache_; | 315 program_cache_; |
| 316 | 316 |
| 317 gpu::gles2::GLES2Interface* gl_; | 317 gpu::gles2::GLES2Interface* gl_; |
| 318 gpu::ContextSupport* context_support_; | 318 gpu::ContextSupport* context_support_; |
| 319 std::unique_ptr<ContextCacheController::ScopedVisibility> context_visibility_; | 319 std::unique_ptr<ContextCacheController::ScopedVisibility> context_visibility_; |
| 320 | 320 |
| 321 TextureMailboxDeleter* texture_mailbox_deleter_; | 321 TextureMailboxDeleter* texture_mailbox_deleter_; |
| 322 | 322 |
| 323 gfx::Rect swap_buffer_rect_; | 323 gfx::Rect swap_buffer_rect_; |
| 324 gfx::Rect scissor_rect_; | 324 gfx::Rect scissor_rect_; |
| 325 bool is_using_bind_uniform_; | 325 bool is_scissor_enabled_ = false; |
| 326 bool is_scissor_enabled_; | 326 bool stencil_shadow_ = false; |
| 327 bool stencil_shadow_; | 327 bool blend_shadow_ = false; |
| 328 bool blend_shadow_; | 328 const Program* program_shadow_ = nullptr; |
| 329 unsigned program_shadow_; | |
| 330 TexturedQuadDrawCache draw_cache_; | 329 TexturedQuadDrawCache draw_cache_; |
| 331 int highp_threshold_min_; | 330 int highp_threshold_min_ = 0; |
| 332 int highp_threshold_cache_; | 331 int highp_threshold_cache_ = 0; |
| 333 | 332 |
| 334 struct PendingAsyncReadPixels; | 333 struct PendingAsyncReadPixels; |
| 335 std::vector<std::unique_ptr<PendingAsyncReadPixels>> | 334 std::vector<std::unique_ptr<PendingAsyncReadPixels>> |
| 336 pending_async_read_pixels_; | 335 pending_async_read_pixels_; |
| 337 | 336 |
| 338 std::unique_ptr<ResourceProvider::ScopedWriteLockGL> | 337 std::unique_ptr<ResourceProvider::ScopedWriteLockGL> |
| 339 current_framebuffer_lock_; | 338 current_framebuffer_lock_; |
| 340 // This is valid when current_framebuffer_lock_ is not null. | 339 // This is valid when current_framebuffer_lock_ is not null. |
| 341 ResourceFormat current_framebuffer_format_; | 340 ResourceFormat current_framebuffer_format_; |
| 342 | 341 |
| 343 class SyncQuery; | 342 class SyncQuery; |
| 344 std::deque<std::unique_ptr<SyncQuery>> pending_sync_queries_; | 343 std::deque<std::unique_ptr<SyncQuery>> pending_sync_queries_; |
| 345 std::deque<std::unique_ptr<SyncQuery>> available_sync_queries_; | 344 std::deque<std::unique_ptr<SyncQuery>> available_sync_queries_; |
| 346 std::unique_ptr<SyncQuery> current_sync_query_; | 345 std::unique_ptr<SyncQuery> current_sync_query_; |
| 347 bool use_discard_framebuffer_; | 346 bool use_discard_framebuffer_ = false; |
| 348 bool use_sync_query_; | 347 bool use_sync_query_ = false; |
| 349 bool use_blend_equation_advanced_; | 348 bool use_blend_equation_advanced_ = false; |
| 350 bool use_blend_equation_advanced_coherent_; | 349 bool use_blend_equation_advanced_coherent_ = false; |
| 351 | 350 |
| 352 // Some overlays require that content is copied from a render pass into an | 351 // Some overlays require that content is copied from a render pass into an |
| 353 // overlay resource. This means the GLRenderer needs its own ResourcePool. | 352 // overlay resource. This means the GLRenderer needs its own ResourcePool. |
| 354 std::unique_ptr<ResourcePool> overlay_resource_pool_; | 353 std::unique_ptr<ResourcePool> overlay_resource_pool_; |
| 355 | 354 |
| 356 // If true, draw a green border after compositing a texture quad using GL. | 355 // If true, draw a green border after compositing a texture quad using GL. |
| 357 bool gl_composited_texture_quad_border_; | 356 bool gl_composited_texture_quad_border_; |
| 358 | 357 |
| 359 // The method FlippedFramebuffer determines whether the framebuffer associated | 358 // The method FlippedFramebuffer determines whether the framebuffer associated |
| 360 // with a DrawingFrame is flipped. It makes the assumption that the | 359 // with a DrawingFrame is flipped. It makes the assumption that the |
| (...skipping 10 matching lines...) Expand all Loading... |
| 371 gfx::Size offscreen_stencil_renderbuffer_size_; | 370 gfx::Size offscreen_stencil_renderbuffer_size_; |
| 372 | 371 |
| 373 base::WeakPtrFactory<GLRenderer> weak_ptr_factory_; | 372 base::WeakPtrFactory<GLRenderer> weak_ptr_factory_; |
| 374 | 373 |
| 375 DISALLOW_COPY_AND_ASSIGN(GLRenderer); | 374 DISALLOW_COPY_AND_ASSIGN(GLRenderer); |
| 376 }; | 375 }; |
| 377 | 376 |
| 378 } // namespace cc | 377 } // namespace cc |
| 379 | 378 |
| 380 #endif // CC_OUTPUT_GL_RENDERER_H_ | 379 #endif // CC_OUTPUT_GL_RENDERER_H_ |
| OLD | NEW |