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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 3271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3282 case NO_BINDING: | 3282 case NO_BINDING: |
3283 break; | 3283 break; |
3284 } | 3284 } |
3285 bound_geometry_ = binding; | 3285 bound_geometry_ = binding; |
3286 } | 3286 } |
3287 | 3287 |
3288 const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() { | 3288 const GLRenderer::DebugBorderProgram* GLRenderer::GetDebugBorderProgram() { |
3289 if (!debug_border_program_.initialized()) { | 3289 if (!debug_border_program_.initialized()) { |
3290 TRACE_EVENT0("cc", "GLRenderer::debugBorderProgram::initialize"); | 3290 TRACE_EVENT0("cc", "GLRenderer::debugBorderProgram::initialize"); |
3291 debug_border_program_.Initialize(output_surface_->context_provider(), | 3291 debug_border_program_.Initialize(output_surface_->context_provider(), |
3292 TEX_COORD_PRECISION_NA, SAMPLER_TYPE_NA); | 3292 ProgramKey::DebugBorder()); |
3293 } | 3293 } |
3294 return &debug_border_program_; | 3294 return &debug_border_program_; |
3295 } | 3295 } |
3296 | 3296 |
3297 const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() { | 3297 const GLRenderer::SolidColorProgram* GLRenderer::GetSolidColorProgram() { |
3298 if (!solid_color_program_.initialized()) { | 3298 if (!solid_color_program_.initialized()) { |
3299 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); | 3299 TRACE_EVENT0("cc", "GLRenderer::solidColorProgram::initialize"); |
3300 solid_color_program_.Initialize(output_surface_->context_provider(), | 3300 solid_color_program_.Initialize(output_surface_->context_provider(), |
3301 TEX_COORD_PRECISION_NA, SAMPLER_TYPE_NA); | 3301 ProgramKey::SolidColor(NO_AA)); |
3302 } | 3302 } |
3303 return &solid_color_program_; | 3303 return &solid_color_program_; |
3304 } | 3304 } |
3305 | 3305 |
3306 const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() { | 3306 const GLRenderer::SolidColorProgramAA* GLRenderer::GetSolidColorProgramAA() { |
3307 if (!solid_color_program_aa_.initialized()) { | 3307 if (!solid_color_program_aa_.initialized()) { |
3308 TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize"); | 3308 TRACE_EVENT0("cc", "GLRenderer::solidColorProgramAA::initialize"); |
3309 solid_color_program_aa_.Initialize(output_surface_->context_provider(), | 3309 solid_color_program_aa_.Initialize(output_surface_->context_provider(), |
3310 TEX_COORD_PRECISION_NA, SAMPLER_TYPE_NA); | 3310 ProgramKey::SolidColor(USE_AA)); |
3311 } | 3311 } |
3312 return &solid_color_program_aa_; | 3312 return &solid_color_program_aa_; |
3313 } | 3313 } |
3314 | 3314 |
3315 const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram( | 3315 const GLRenderer::RenderPassProgram* GLRenderer::GetRenderPassProgram( |
3316 TexCoordPrecision precision, | 3316 TexCoordPrecision precision, |
3317 BlendMode blend_mode) { | 3317 BlendMode blend_mode) { |
3318 DCHECK_GE(precision, 0); | 3318 DCHECK_GE(precision, 0); |
3319 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3319 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3320 DCHECK_GE(blend_mode, 0); | 3320 DCHECK_GE(blend_mode, 0); |
3321 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 3321 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
3322 RenderPassProgram* program = &render_pass_program_[precision][blend_mode]; | 3322 RenderPassProgram* program = &render_pass_program_[precision][blend_mode]; |
3323 if (!program->initialized()) { | 3323 if (!program->initialized()) { |
3324 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); | 3324 TRACE_EVENT0("cc", "GLRenderer::renderPassProgram::initialize"); |
3325 program->Initialize(output_surface_->context_provider(), precision, | 3325 program->Initialize( |
3326 SAMPLER_TYPE_2D, blend_mode); | 3326 output_surface_->context_provider(), |
| 3327 ProgramKey::RenderPass(precision, SAMPLER_TYPE_2D, blend_mode, NO_AA, |
| 3328 NO_MASK, false, false)); |
3327 } | 3329 } |
3328 return program; | 3330 return program; |
3329 } | 3331 } |
3330 | 3332 |
3331 const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA( | 3333 const GLRenderer::RenderPassProgramAA* GLRenderer::GetRenderPassProgramAA( |
3332 TexCoordPrecision precision, | 3334 TexCoordPrecision precision, |
3333 BlendMode blend_mode) { | 3335 BlendMode blend_mode) { |
3334 DCHECK_GE(precision, 0); | 3336 DCHECK_GE(precision, 0); |
3335 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3337 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3336 DCHECK_GE(blend_mode, 0); | 3338 DCHECK_GE(blend_mode, 0); |
3337 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 3339 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
3338 RenderPassProgramAA* program = | 3340 RenderPassProgramAA* program = |
3339 &render_pass_program_aa_[precision][blend_mode]; | 3341 &render_pass_program_aa_[precision][blend_mode]; |
3340 if (!program->initialized()) { | 3342 if (!program->initialized()) { |
3341 TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize"); | 3343 TRACE_EVENT0("cc", "GLRenderer::renderPassProgramAA::initialize"); |
3342 program->Initialize(output_surface_->context_provider(), precision, | 3344 program->Initialize( |
3343 SAMPLER_TYPE_2D, blend_mode); | 3345 output_surface_->context_provider(), |
| 3346 ProgramKey::RenderPass(precision, SAMPLER_TYPE_2D, blend_mode, USE_AA, |
| 3347 NO_MASK, false, false)); |
3344 } | 3348 } |
3345 return program; | 3349 return program; |
3346 } | 3350 } |
3347 | 3351 |
3348 const GLRenderer::RenderPassMaskProgram* GLRenderer::GetRenderPassMaskProgram( | 3352 const GLRenderer::RenderPassMaskProgram* GLRenderer::GetRenderPassMaskProgram( |
3349 TexCoordPrecision precision, | 3353 TexCoordPrecision precision, |
3350 SamplerType sampler, | 3354 SamplerType sampler, |
3351 BlendMode blend_mode, | 3355 BlendMode blend_mode, |
3352 bool mask_for_background) { | 3356 bool mask_for_background) { |
3353 DCHECK_GE(precision, 0); | 3357 DCHECK_GE(precision, 0); |
3354 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3358 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3355 DCHECK_GE(sampler, 0); | 3359 DCHECK_GE(sampler, 0); |
3356 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3360 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3357 DCHECK_GE(blend_mode, 0); | 3361 DCHECK_GE(blend_mode, 0); |
3358 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 3362 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
3359 RenderPassMaskProgram* program = | 3363 RenderPassMaskProgram* program = |
3360 &render_pass_mask_program_[precision][sampler][blend_mode] | 3364 &render_pass_mask_program_[precision][sampler][blend_mode] |
3361 [mask_for_background ? HAS_MASK : NO_MASK]; | 3365 [mask_for_background ? HAS_MASK : NO_MASK]; |
3362 if (!program->initialized()) { | 3366 if (!program->initialized()) { |
3363 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); | 3367 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgram::initialize"); |
3364 program->Initialize( | 3368 program->Initialize( |
3365 output_surface_->context_provider(), precision, | 3369 output_surface_->context_provider(), |
3366 sampler, blend_mode, mask_for_background); | 3370 ProgramKey::RenderPass(precision, sampler, blend_mode, NO_AA, HAS_MASK, |
| 3371 mask_for_background, false)); |
3367 } | 3372 } |
3368 return program; | 3373 return program; |
3369 } | 3374 } |
3370 | 3375 |
3371 const GLRenderer::RenderPassMaskProgramAA* | 3376 const GLRenderer::RenderPassMaskProgramAA* |
3372 GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision, | 3377 GLRenderer::GetRenderPassMaskProgramAA(TexCoordPrecision precision, |
3373 SamplerType sampler, | 3378 SamplerType sampler, |
3374 BlendMode blend_mode, | 3379 BlendMode blend_mode, |
3375 bool mask_for_background) { | 3380 bool mask_for_background) { |
3376 DCHECK_GE(precision, 0); | 3381 DCHECK_GE(precision, 0); |
3377 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3382 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3378 DCHECK_GE(sampler, 0); | 3383 DCHECK_GE(sampler, 0); |
3379 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3384 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3380 DCHECK_GE(blend_mode, 0); | 3385 DCHECK_GE(blend_mode, 0); |
3381 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 3386 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
3382 RenderPassMaskProgramAA* program = | 3387 RenderPassMaskProgramAA* program = |
3383 &render_pass_mask_program_aa_[precision][sampler][blend_mode] | 3388 &render_pass_mask_program_aa_[precision][sampler][blend_mode] |
3384 [mask_for_background ? HAS_MASK : NO_MASK]; | 3389 [mask_for_background ? HAS_MASK : NO_MASK]; |
3385 if (!program->initialized()) { | 3390 if (!program->initialized()) { |
3386 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); | 3391 TRACE_EVENT0("cc", "GLRenderer::renderPassMaskProgramAA::initialize"); |
3387 program->Initialize( | 3392 program->Initialize( |
3388 output_surface_->context_provider(), precision, | 3393 output_surface_->context_provider(), |
3389 sampler, blend_mode, mask_for_background); | 3394 ProgramKey::RenderPass(precision, sampler, blend_mode, USE_AA, HAS_MASK, |
| 3395 mask_for_background, false)); |
3390 } | 3396 } |
3391 return program; | 3397 return program; |
3392 } | 3398 } |
3393 | 3399 |
3394 const GLRenderer::RenderPassColorMatrixProgram* | 3400 const GLRenderer::RenderPassColorMatrixProgram* |
3395 GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision, | 3401 GLRenderer::GetRenderPassColorMatrixProgram(TexCoordPrecision precision, |
3396 BlendMode blend_mode) { | 3402 BlendMode blend_mode) { |
3397 DCHECK_GE(precision, 0); | 3403 DCHECK_GE(precision, 0); |
3398 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3404 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3399 DCHECK_GE(blend_mode, 0); | 3405 DCHECK_GE(blend_mode, 0); |
3400 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 3406 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
3401 RenderPassColorMatrixProgram* program = | 3407 RenderPassColorMatrixProgram* program = |
3402 &render_pass_color_matrix_program_[precision][blend_mode]; | 3408 &render_pass_color_matrix_program_[precision][blend_mode]; |
3403 if (!program->initialized()) { | 3409 if (!program->initialized()) { |
3404 TRACE_EVENT0("cc", "GLRenderer::renderPassColorMatrixProgram::initialize"); | 3410 TRACE_EVENT0("cc", "GLRenderer::renderPassColorMatrixProgram::initialize"); |
3405 program->Initialize(output_surface_->context_provider(), precision, | 3411 program->Initialize( |
3406 SAMPLER_TYPE_2D, blend_mode); | 3412 output_surface_->context_provider(), |
| 3413 ProgramKey::RenderPass(precision, SAMPLER_TYPE_2D, blend_mode, NO_AA, |
| 3414 NO_MASK, false, true)); |
3407 } | 3415 } |
3408 return program; | 3416 return program; |
3409 } | 3417 } |
3410 | 3418 |
3411 const GLRenderer::RenderPassColorMatrixProgramAA* | 3419 const GLRenderer::RenderPassColorMatrixProgramAA* |
3412 GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision, | 3420 GLRenderer::GetRenderPassColorMatrixProgramAA(TexCoordPrecision precision, |
3413 BlendMode blend_mode) { | 3421 BlendMode blend_mode) { |
3414 DCHECK_GE(precision, 0); | 3422 DCHECK_GE(precision, 0); |
3415 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3423 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3416 DCHECK_GE(blend_mode, 0); | 3424 DCHECK_GE(blend_mode, 0); |
3417 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 3425 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
3418 RenderPassColorMatrixProgramAA* program = | 3426 RenderPassColorMatrixProgramAA* program = |
3419 &render_pass_color_matrix_program_aa_[precision][blend_mode]; | 3427 &render_pass_color_matrix_program_aa_[precision][blend_mode]; |
3420 if (!program->initialized()) { | 3428 if (!program->initialized()) { |
3421 TRACE_EVENT0("cc", | 3429 TRACE_EVENT0("cc", |
3422 "GLRenderer::renderPassColorMatrixProgramAA::initialize"); | 3430 "GLRenderer::renderPassColorMatrixProgramAA::initialize"); |
3423 program->Initialize(output_surface_->context_provider(), precision, | 3431 program->Initialize( |
3424 SAMPLER_TYPE_2D, blend_mode); | 3432 output_surface_->context_provider(), |
| 3433 ProgramKey::RenderPass(precision, SAMPLER_TYPE_2D, blend_mode, USE_AA, |
| 3434 NO_MASK, false, true)); |
3425 } | 3435 } |
3426 return program; | 3436 return program; |
3427 } | 3437 } |
3428 | 3438 |
3429 const GLRenderer::RenderPassMaskColorMatrixProgram* | 3439 const GLRenderer::RenderPassMaskColorMatrixProgram* |
3430 GLRenderer::GetRenderPassMaskColorMatrixProgram( | 3440 GLRenderer::GetRenderPassMaskColorMatrixProgram( |
3431 TexCoordPrecision precision, | 3441 TexCoordPrecision precision, |
3432 SamplerType sampler, | 3442 SamplerType sampler, |
3433 BlendMode blend_mode, | 3443 BlendMode blend_mode, |
3434 bool mask_for_background) { | 3444 bool mask_for_background) { |
3435 DCHECK_GE(precision, 0); | 3445 DCHECK_GE(precision, 0); |
3436 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3446 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3437 DCHECK_GE(sampler, 0); | 3447 DCHECK_GE(sampler, 0); |
3438 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3448 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3439 DCHECK_GE(blend_mode, 0); | 3449 DCHECK_GE(blend_mode, 0); |
3440 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 3450 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
3441 RenderPassMaskColorMatrixProgram* program = | 3451 RenderPassMaskColorMatrixProgram* program = |
3442 &render_pass_mask_color_matrix_program_[precision][sampler][blend_mode] | 3452 &render_pass_mask_color_matrix_program_[precision][sampler][blend_mode] |
3443 [mask_for_background ? HAS_MASK : NO_MASK]; | 3453 [mask_for_background ? HAS_MASK : NO_MASK]; |
3444 if (!program->initialized()) { | 3454 if (!program->initialized()) { |
3445 TRACE_EVENT0("cc", | 3455 TRACE_EVENT0("cc", |
3446 "GLRenderer::renderPassMaskColorMatrixProgram::initialize"); | 3456 "GLRenderer::renderPassMaskColorMatrixProgram::initialize"); |
3447 program->Initialize( | 3457 program->Initialize( |
3448 output_surface_->context_provider(), precision, | 3458 output_surface_->context_provider(), |
3449 sampler, blend_mode, mask_for_background); | 3459 ProgramKey::RenderPass(precision, sampler, blend_mode, NO_AA, HAS_MASK, |
| 3460 mask_for_background, true)); |
3450 } | 3461 } |
3451 return program; | 3462 return program; |
3452 } | 3463 } |
3453 | 3464 |
3454 const GLRenderer::RenderPassMaskColorMatrixProgramAA* | 3465 const GLRenderer::RenderPassMaskColorMatrixProgramAA* |
3455 GLRenderer::GetRenderPassMaskColorMatrixProgramAA( | 3466 GLRenderer::GetRenderPassMaskColorMatrixProgramAA( |
3456 TexCoordPrecision precision, | 3467 TexCoordPrecision precision, |
3457 SamplerType sampler, | 3468 SamplerType sampler, |
3458 BlendMode blend_mode, | 3469 BlendMode blend_mode, |
3459 bool mask_for_background) { | 3470 bool mask_for_background) { |
3460 DCHECK_GE(precision, 0); | 3471 DCHECK_GE(precision, 0); |
3461 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3472 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3462 DCHECK_GE(sampler, 0); | 3473 DCHECK_GE(sampler, 0); |
3463 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3474 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3464 DCHECK_GE(blend_mode, 0); | 3475 DCHECK_GE(blend_mode, 0); |
3465 DCHECK_LE(blend_mode, LAST_BLEND_MODE); | 3476 DCHECK_LE(blend_mode, LAST_BLEND_MODE); |
3466 RenderPassMaskColorMatrixProgramAA* program = | 3477 RenderPassMaskColorMatrixProgramAA* program = |
3467 &render_pass_mask_color_matrix_program_aa_[precision][sampler][blend_mode] | 3478 &render_pass_mask_color_matrix_program_aa_[precision][sampler][blend_mode] |
3468 [mask_for_background ? HAS_MASK : NO_MASK]; | 3479 [mask_for_background ? HAS_MASK : NO_MASK]; |
3469 if (!program->initialized()) { | 3480 if (!program->initialized()) { |
3470 TRACE_EVENT0("cc", | 3481 TRACE_EVENT0("cc", |
3471 "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize"); | 3482 "GLRenderer::renderPassMaskColorMatrixProgramAA::initialize"); |
3472 program->Initialize( | 3483 program->Initialize( |
3473 output_surface_->context_provider(), precision, | 3484 output_surface_->context_provider(), |
3474 sampler, blend_mode, mask_for_background); | 3485 ProgramKey::RenderPass(precision, sampler, blend_mode, USE_AA, HAS_MASK, |
| 3486 mask_for_background, true)); |
3475 } | 3487 } |
3476 return program; | 3488 return program; |
3477 } | 3489 } |
3478 | 3490 |
3479 const GLRenderer::TileProgram* GLRenderer::GetTileProgram( | 3491 const GLRenderer::TileProgram* GLRenderer::GetTileProgram( |
3480 TexCoordPrecision precision, | 3492 TexCoordPrecision precision, |
3481 SamplerType sampler) { | 3493 SamplerType sampler) { |
3482 DCHECK_GE(precision, 0); | 3494 DCHECK_GE(precision, 0); |
3483 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3495 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3484 DCHECK_GE(sampler, 0); | 3496 DCHECK_GE(sampler, 0); |
3485 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3497 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3486 TileProgram* program = &tile_program_[precision][sampler]; | 3498 TileProgram* program = &tile_program_[precision][sampler]; |
3487 if (!program->initialized()) { | 3499 if (!program->initialized()) { |
3488 TRACE_EVENT0("cc", "GLRenderer::tileProgram::initialize"); | 3500 TRACE_EVENT0("cc", "GLRenderer::tileProgram::initialize"); |
3489 program->Initialize( | 3501 program->Initialize( |
3490 output_surface_->context_provider(), precision, sampler); | 3502 output_surface_->context_provider(), |
| 3503 ProgramKey::Tile(precision, sampler, NO_AA, NO_SWIZZLE, false)); |
3491 } | 3504 } |
3492 return program; | 3505 return program; |
3493 } | 3506 } |
3494 | 3507 |
3495 const GLRenderer::TileProgramOpaque* GLRenderer::GetTileProgramOpaque( | 3508 const GLRenderer::TileProgramOpaque* GLRenderer::GetTileProgramOpaque( |
3496 TexCoordPrecision precision, | 3509 TexCoordPrecision precision, |
3497 SamplerType sampler) { | 3510 SamplerType sampler) { |
3498 DCHECK_GE(precision, 0); | 3511 DCHECK_GE(precision, 0); |
3499 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3512 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3500 DCHECK_GE(sampler, 0); | 3513 DCHECK_GE(sampler, 0); |
3501 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3514 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3502 TileProgramOpaque* program = &tile_program_opaque_[precision][sampler]; | 3515 TileProgramOpaque* program = &tile_program_opaque_[precision][sampler]; |
3503 if (!program->initialized()) { | 3516 if (!program->initialized()) { |
3504 TRACE_EVENT0("cc", "GLRenderer::tileProgramOpaque::initialize"); | 3517 TRACE_EVENT0("cc", "GLRenderer::tileProgramOpaque::initialize"); |
3505 program->Initialize( | 3518 program->Initialize( |
3506 output_surface_->context_provider(), precision, sampler); | 3519 output_surface_->context_provider(), |
| 3520 ProgramKey::Tile(precision, sampler, NO_AA, NO_SWIZZLE, true)); |
3507 } | 3521 } |
3508 return program; | 3522 return program; |
3509 } | 3523 } |
3510 | 3524 |
3511 const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA( | 3525 const GLRenderer::TileProgramAA* GLRenderer::GetTileProgramAA( |
3512 TexCoordPrecision precision, | 3526 TexCoordPrecision precision, |
3513 SamplerType sampler) { | 3527 SamplerType sampler) { |
3514 DCHECK_GE(precision, 0); | 3528 DCHECK_GE(precision, 0); |
3515 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3529 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3516 DCHECK_GE(sampler, 0); | 3530 DCHECK_GE(sampler, 0); |
3517 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3531 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3518 TileProgramAA* program = &tile_program_aa_[precision][sampler]; | 3532 TileProgramAA* program = &tile_program_aa_[precision][sampler]; |
3519 if (!program->initialized()) { | 3533 if (!program->initialized()) { |
3520 TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize"); | 3534 TRACE_EVENT0("cc", "GLRenderer::tileProgramAA::initialize"); |
3521 program->Initialize( | 3535 program->Initialize( |
3522 output_surface_->context_provider(), precision, sampler); | 3536 output_surface_->context_provider(), |
| 3537 ProgramKey::Tile(precision, sampler, USE_AA, NO_SWIZZLE, false)); |
3523 } | 3538 } |
3524 return program; | 3539 return program; |
3525 } | 3540 } |
3526 | 3541 |
3527 const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle( | 3542 const GLRenderer::TileProgramSwizzle* GLRenderer::GetTileProgramSwizzle( |
3528 TexCoordPrecision precision, | 3543 TexCoordPrecision precision, |
3529 SamplerType sampler) { | 3544 SamplerType sampler) { |
3530 DCHECK_GE(precision, 0); | 3545 DCHECK_GE(precision, 0); |
3531 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3546 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3532 DCHECK_GE(sampler, 0); | 3547 DCHECK_GE(sampler, 0); |
3533 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3548 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3534 TileProgramSwizzle* program = &tile_program_swizzle_[precision][sampler]; | 3549 TileProgramSwizzle* program = &tile_program_swizzle_[precision][sampler]; |
3535 if (!program->initialized()) { | 3550 if (!program->initialized()) { |
3536 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize"); | 3551 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzle::initialize"); |
3537 program->Initialize( | 3552 program->Initialize( |
3538 output_surface_->context_provider(), precision, sampler); | 3553 output_surface_->context_provider(), |
| 3554 ProgramKey::Tile(precision, sampler, NO_AA, DO_SWIZZLE, false)); |
3539 } | 3555 } |
3540 return program; | 3556 return program; |
3541 } | 3557 } |
3542 | 3558 |
3543 const GLRenderer::TileProgramSwizzleOpaque* | 3559 const GLRenderer::TileProgramSwizzleOpaque* |
3544 GLRenderer::GetTileProgramSwizzleOpaque(TexCoordPrecision precision, | 3560 GLRenderer::GetTileProgramSwizzleOpaque(TexCoordPrecision precision, |
3545 SamplerType sampler) { | 3561 SamplerType sampler) { |
3546 DCHECK_GE(precision, 0); | 3562 DCHECK_GE(precision, 0); |
3547 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3563 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3548 DCHECK_GE(sampler, 0); | 3564 DCHECK_GE(sampler, 0); |
3549 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3565 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3550 TileProgramSwizzleOpaque* program = | 3566 TileProgramSwizzleOpaque* program = |
3551 &tile_program_swizzle_opaque_[precision][sampler]; | 3567 &tile_program_swizzle_opaque_[precision][sampler]; |
3552 if (!program->initialized()) { | 3568 if (!program->initialized()) { |
3553 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleOpaque::initialize"); | 3569 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleOpaque::initialize"); |
3554 program->Initialize( | 3570 program->Initialize( |
3555 output_surface_->context_provider(), precision, sampler); | 3571 output_surface_->context_provider(), |
| 3572 ProgramKey::Tile(precision, sampler, NO_AA, DO_SWIZZLE, true)); |
3556 } | 3573 } |
3557 return program; | 3574 return program; |
3558 } | 3575 } |
3559 | 3576 |
3560 const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA( | 3577 const GLRenderer::TileProgramSwizzleAA* GLRenderer::GetTileProgramSwizzleAA( |
3561 TexCoordPrecision precision, | 3578 TexCoordPrecision precision, |
3562 SamplerType sampler) { | 3579 SamplerType sampler) { |
3563 DCHECK_GE(precision, 0); | 3580 DCHECK_GE(precision, 0); |
3564 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3581 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3565 DCHECK_GE(sampler, 0); | 3582 DCHECK_GE(sampler, 0); |
3566 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3583 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3567 TileProgramSwizzleAA* program = &tile_program_swizzle_aa_[precision][sampler]; | 3584 TileProgramSwizzleAA* program = &tile_program_swizzle_aa_[precision][sampler]; |
3568 if (!program->initialized()) { | 3585 if (!program->initialized()) { |
3569 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize"); | 3586 TRACE_EVENT0("cc", "GLRenderer::tileProgramSwizzleAA::initialize"); |
3570 program->Initialize( | 3587 program->Initialize( |
3571 output_surface_->context_provider(), precision, sampler); | 3588 output_surface_->context_provider(), |
| 3589 ProgramKey::Tile(precision, sampler, USE_AA, DO_SWIZZLE, false)); |
3572 } | 3590 } |
3573 return program; | 3591 return program; |
3574 } | 3592 } |
3575 | 3593 |
3576 const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram( | 3594 const GLRenderer::TextureProgram* GLRenderer::GetTextureProgram( |
3577 TexCoordPrecision precision, | 3595 TexCoordPrecision precision, |
3578 SamplerType sampler) { | 3596 SamplerType sampler) { |
3579 DCHECK_GE(precision, 0); | 3597 DCHECK_GE(precision, 0); |
3580 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3598 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3581 DCHECK_GE(sampler, 0); | 3599 DCHECK_GE(sampler, 0); |
3582 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3600 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3583 TextureProgram* program = &texture_program_[precision][sampler]; | 3601 TextureProgram* program = &texture_program_[precision][sampler]; |
3584 if (!program->initialized()) { | 3602 if (!program->initialized()) { |
3585 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); | 3603 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); |
3586 program->Initialize(output_surface_->context_provider(), precision, | 3604 program->Initialize( |
3587 sampler); | 3605 output_surface_->context_provider(), |
| 3606 ProgramKey::Texture(precision, sampler, PREMULTIPLIED_ALPHA, false)); |
3588 } | 3607 } |
3589 return program; | 3608 return program; |
3590 } | 3609 } |
3591 | 3610 |
3592 const GLRenderer::NonPremultipliedTextureProgram* | 3611 const GLRenderer::NonPremultipliedTextureProgram* |
3593 GLRenderer::GetNonPremultipliedTextureProgram(TexCoordPrecision precision, | 3612 GLRenderer::GetNonPremultipliedTextureProgram(TexCoordPrecision precision, |
3594 SamplerType sampler) { | 3613 SamplerType sampler) { |
3595 DCHECK_GE(precision, 0); | 3614 DCHECK_GE(precision, 0); |
3596 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3615 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3597 DCHECK_GE(sampler, 0); | 3616 DCHECK_GE(sampler, 0); |
3598 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3617 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3599 NonPremultipliedTextureProgram* program = | 3618 NonPremultipliedTextureProgram* program = |
3600 &nonpremultiplied_texture_program_[precision][sampler]; | 3619 &nonpremultiplied_texture_program_[precision][sampler]; |
3601 if (!program->initialized()) { | 3620 if (!program->initialized()) { |
3602 TRACE_EVENT0("cc", | 3621 TRACE_EVENT0("cc", |
3603 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); | 3622 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); |
3604 program->Initialize(output_surface_->context_provider(), precision, | 3623 program->Initialize(output_surface_->context_provider(), |
3605 sampler); | 3624 ProgramKey::Texture(precision, sampler, |
| 3625 NON_PREMULTIPLIED_ALPHA, false)); |
3606 } | 3626 } |
3607 return program; | 3627 return program; |
3608 } | 3628 } |
3609 | 3629 |
3610 const GLRenderer::TextureBackgroundProgram* | 3630 const GLRenderer::TextureBackgroundProgram* |
3611 GLRenderer::GetTextureBackgroundProgram(TexCoordPrecision precision, | 3631 GLRenderer::GetTextureBackgroundProgram(TexCoordPrecision precision, |
3612 SamplerType sampler) { | 3632 SamplerType sampler) { |
3613 DCHECK_GE(precision, 0); | 3633 DCHECK_GE(precision, 0); |
3614 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3634 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3615 DCHECK_GE(sampler, 0); | 3635 DCHECK_GE(sampler, 0); |
3616 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3636 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3617 TextureBackgroundProgram* program = | 3637 TextureBackgroundProgram* program = |
3618 &texture_background_program_[precision][sampler]; | 3638 &texture_background_program_[precision][sampler]; |
3619 if (!program->initialized()) { | 3639 if (!program->initialized()) { |
3620 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); | 3640 TRACE_EVENT0("cc", "GLRenderer::textureProgram::initialize"); |
3621 program->Initialize(output_surface_->context_provider(), precision, | 3641 program->Initialize( |
3622 sampler); | 3642 output_surface_->context_provider(), |
| 3643 ProgramKey::Texture(precision, sampler, PREMULTIPLIED_ALPHA, true)); |
3623 } | 3644 } |
3624 return program; | 3645 return program; |
3625 } | 3646 } |
3626 | 3647 |
3627 const GLRenderer::NonPremultipliedTextureBackgroundProgram* | 3648 const GLRenderer::NonPremultipliedTextureBackgroundProgram* |
3628 GLRenderer::GetNonPremultipliedTextureBackgroundProgram( | 3649 GLRenderer::GetNonPremultipliedTextureBackgroundProgram( |
3629 TexCoordPrecision precision, | 3650 TexCoordPrecision precision, |
3630 SamplerType sampler) { | 3651 SamplerType sampler) { |
3631 DCHECK_GE(precision, 0); | 3652 DCHECK_GE(precision, 0); |
3632 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3653 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3633 DCHECK_GE(sampler, 0); | 3654 DCHECK_GE(sampler, 0); |
3634 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); | 3655 DCHECK_LE(sampler, LAST_SAMPLER_TYPE); |
3635 NonPremultipliedTextureBackgroundProgram* program = | 3656 NonPremultipliedTextureBackgroundProgram* program = |
3636 &nonpremultiplied_texture_background_program_[precision][sampler]; | 3657 &nonpremultiplied_texture_background_program_[precision][sampler]; |
3637 if (!program->initialized()) { | 3658 if (!program->initialized()) { |
3638 TRACE_EVENT0("cc", | 3659 TRACE_EVENT0("cc", |
3639 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); | 3660 "GLRenderer::NonPremultipliedTextureProgram::Initialize"); |
3640 program->Initialize(output_surface_->context_provider(), precision, | 3661 program->Initialize( |
3641 sampler); | 3662 output_surface_->context_provider(), |
| 3663 ProgramKey::Texture(precision, sampler, NON_PREMULTIPLIED_ALPHA, true)); |
3642 } | 3664 } |
3643 return program; | 3665 return program; |
3644 } | 3666 } |
3645 | 3667 |
3646 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( | 3668 const GLRenderer::VideoYUVProgram* GLRenderer::GetVideoYUVProgram( |
3647 TexCoordPrecision precision, | 3669 TexCoordPrecision precision, |
3648 SamplerType sampler, | 3670 SamplerType sampler, |
3649 bool use_alpha_plane, | 3671 bool use_alpha_plane, |
3650 bool use_nv12, | 3672 bool use_nv12, |
3651 bool use_color_lut) { | 3673 bool use_color_lut) { |
(...skipping 14 matching lines...) Expand all Loading... |
3666 } | 3688 } |
3667 | 3689 |
3668 const GLRenderer::VideoStreamTextureProgram* | 3690 const GLRenderer::VideoStreamTextureProgram* |
3669 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { | 3691 GLRenderer::GetVideoStreamTextureProgram(TexCoordPrecision precision) { |
3670 DCHECK_GE(precision, 0); | 3692 DCHECK_GE(precision, 0); |
3671 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); | 3693 DCHECK_LE(precision, LAST_TEX_COORD_PRECISION); |
3672 VideoStreamTextureProgram* program = | 3694 VideoStreamTextureProgram* program = |
3673 &video_stream_texture_program_[precision]; | 3695 &video_stream_texture_program_[precision]; |
3674 if (!program->initialized()) { | 3696 if (!program->initialized()) { |
3675 TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize"); | 3697 TRACE_EVENT0("cc", "GLRenderer::streamTextureProgram::initialize"); |
3676 program->Initialize(output_surface_->context_provider(), precision, | 3698 program->Initialize(output_surface_->context_provider(), |
3677 SAMPLER_TYPE_EXTERNAL_OES); | 3699 ProgramKey::VideoStream(precision)); |
3678 } | 3700 } |
3679 return program; | 3701 return program; |
3680 } | 3702 } |
3681 | 3703 |
3682 void GLRenderer::CleanupSharedObjects() { | 3704 void GLRenderer::CleanupSharedObjects() { |
3683 shared_geometry_ = nullptr; | 3705 shared_geometry_ = nullptr; |
3684 | 3706 |
3685 for (int i = 0; i <= LAST_TEX_COORD_PRECISION; ++i) { | 3707 for (int i = 0; i <= LAST_TEX_COORD_PRECISION; ++i) { |
3686 for (int j = 0; j <= LAST_SAMPLER_TYPE; ++j) { | 3708 for (int j = 0; j <= LAST_SAMPLER_TYPE; ++j) { |
3687 tile_program_[i][j].Cleanup(gl_); | 3709 tile_program_[i][j].Cleanup(gl_); |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4058 // The alpha has already been applied when copying the RPDQ to an IOSurface. | 4080 // The alpha has already been applied when copying the RPDQ to an IOSurface. |
4059 GLfloat alpha = 1; | 4081 GLfloat alpha = 1; |
4060 gl_->ScheduleCALayerSharedStateCHROMIUM(alpha, is_clipped, clip_rect, | 4082 gl_->ScheduleCALayerSharedStateCHROMIUM(alpha, is_clipped, clip_rect, |
4061 sorting_context_id, gl_transform); | 4083 sorting_context_id, gl_transform); |
4062 gl_->ScheduleCALayerCHROMIUM( | 4084 gl_->ScheduleCALayerCHROMIUM( |
4063 texture_id, contents_rect, ca_layer_overlay->background_color, | 4085 texture_id, contents_rect, ca_layer_overlay->background_color, |
4064 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); | 4086 ca_layer_overlay->edge_aa_mask, bounds_rect, filter); |
4065 } | 4087 } |
4066 | 4088 |
4067 } // namespace cc | 4089 } // namespace cc |
OLD | NEW |