| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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_SHADER_H_ | 5 #ifndef CC_OUTPUT_SHADER_H_ |
| 6 #define CC_OUTPUT_SHADER_H_ | 6 #define CC_OUTPUT_SHADER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 }; | 31 }; |
| 32 | 32 |
| 33 enum SamplerType { | 33 enum SamplerType { |
| 34 SamplerTypeNA = 0, | 34 SamplerTypeNA = 0, |
| 35 SamplerType2D = 1, | 35 SamplerType2D = 1, |
| 36 SamplerType2DRect = 2, | 36 SamplerType2DRect = 2, |
| 37 SamplerTypeExternalOES = 3, | 37 SamplerTypeExternalOES = 3, |
| 38 NumSamplerTypes = 4 | 38 NumSamplerTypes = 4 |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 enum BlendMode { |
| 42 BlendModeNormal, |
| 43 BlendModeOverlay, |
| 44 BlendModeDarken, |
| 45 BlendModeLighten, |
| 46 BlendModeColorDodge, |
| 47 BlendModeColorBurn, |
| 48 BlendModeHardLight, |
| 49 BlendModeSoftLight, |
| 50 BlendModeDifference, |
| 51 BlendModeExclusion, |
| 52 BlendModeMultiply, |
| 53 BlendModeHue, |
| 54 BlendModeSaturation, |
| 55 BlendModeColor, |
| 56 BlendModeLuminosity, |
| 57 NumBlendModes |
| 58 }; |
| 59 |
| 41 // Note: The highp_threshold_cache must be provided by the caller to make | 60 // Note: The highp_threshold_cache must be provided by the caller to make |
| 42 // the caching multi-thread/context safe in an easy low-overhead manner. | 61 // the caching multi-thread/context safe in an easy low-overhead manner. |
| 43 // The caller must make sure to clear highp_threshold_cache to 0, so it can be | 62 // The caller must make sure to clear highp_threshold_cache to 0, so it can be |
| 44 // reinitialized, if a new or different context is used. | 63 // reinitialized, if a new or different context is used. |
| 45 CC_EXPORT TexCoordPrecision | 64 CC_EXPORT TexCoordPrecision |
| 46 TexCoordPrecisionRequired(gpu::gles2::GLES2Interface* context, | 65 TexCoordPrecisionRequired(gpu::gles2::GLES2Interface* context, |
| 47 int* highp_threshold_cache, | 66 int* highp_threshold_cache, |
| 48 int highp_threshold_min, | 67 int highp_threshold_min, |
| 49 const gfx::Point& max_coordinate); | 68 const gfx::Point& max_coordinate); |
| 50 | 69 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 int matrix_location() const { return matrix_location_; } | 291 int matrix_location() const { return matrix_location_; } |
| 273 int tex_matrix_location() const { return tex_matrix_location_; } | 292 int tex_matrix_location() const { return tex_matrix_location_; } |
| 274 | 293 |
| 275 private: | 294 private: |
| 276 int matrix_location_; | 295 int matrix_location_; |
| 277 int tex_matrix_location_; | 296 int tex_matrix_location_; |
| 278 | 297 |
| 279 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); | 298 DISALLOW_COPY_AND_ASSIGN(VertexShaderVideoTransform); |
| 280 }; | 299 }; |
| 281 | 300 |
| 282 class FragmentTexAlphaBinding { | 301 class FragmentTexBlendMode { |
| 302 public: |
| 303 int backdrop_location() const { return backdrop_location_; } |
| 304 int backdrop_rect_location() const { return backdrop_rect_location_; } |
| 305 |
| 306 BlendMode blend_mode() const { return blend_mode_; } |
| 307 void set_blend_mode(BlendMode blend_mode) { blend_mode_ = blend_mode; } |
| 308 bool is_default_blend_mode() const { return blend_mode_ == BlendModeNormal; } |
| 309 |
| 310 protected: |
| 311 FragmentTexBlendMode(); |
| 312 |
| 313 std::string SetBlendModeFunctions(std::string shader_string) const; |
| 314 |
| 315 int backdrop_location_; |
| 316 int backdrop_rect_location_; |
| 317 |
| 318 private: |
| 319 BlendMode blend_mode_; |
| 320 |
| 321 std::string GetHelperFunctions() const; |
| 322 std::string GetBlendFunction() const; |
| 323 std::string GetBlendFunctionBodyForRGB() const; |
| 324 }; |
| 325 |
| 326 class FragmentTexAlphaBinding : public FragmentTexBlendMode { |
| 283 public: | 327 public: |
| 284 FragmentTexAlphaBinding(); | 328 FragmentTexAlphaBinding(); |
| 285 | 329 |
| 286 void Init(gpu::gles2::GLES2Interface* context, | 330 void Init(gpu::gles2::GLES2Interface* context, |
| 287 unsigned program, | 331 unsigned program, |
| 288 int* base_uniform_index); | 332 int* base_uniform_index); |
| 289 int alpha_location() const { return alpha_location_; } | 333 int alpha_location() const { return alpha_location_; } |
| 290 int fragment_tex_transform_location() const { return -1; } | 334 int fragment_tex_transform_location() const { return -1; } |
| 291 int sampler_location() const { return sampler_location_; } | 335 int sampler_location() const { return sampler_location_; } |
| 292 | 336 |
| 293 private: | 337 private: |
| 294 int sampler_location_; | 338 int sampler_location_; |
| 295 int alpha_location_; | 339 int alpha_location_; |
| 296 | 340 |
| 297 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding); | 341 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding); |
| 298 }; | 342 }; |
| 299 | 343 |
| 300 class FragmentTexColorMatrixAlphaBinding { | 344 class FragmentTexColorMatrixAlphaBinding : public FragmentTexBlendMode { |
| 301 public: | 345 public: |
| 302 FragmentTexColorMatrixAlphaBinding(); | 346 FragmentTexColorMatrixAlphaBinding(); |
| 303 | 347 |
| 304 void Init(gpu::gles2::GLES2Interface* context, | 348 void Init(gpu::gles2::GLES2Interface* context, |
| 305 unsigned program, | 349 unsigned program, |
| 306 int* base_uniform_index); | 350 int* base_uniform_index); |
| 307 int alpha_location() const { return alpha_location_; } | 351 int alpha_location() const { return alpha_location_; } |
| 308 int color_matrix_location() const { return color_matrix_location_; } | 352 int color_matrix_location() const { return color_matrix_location_; } |
| 309 int color_offset_location() const { return color_offset_location_; } | 353 int color_offset_location() const { return color_offset_location_; } |
| 310 int fragment_tex_transform_location() const { return -1; } | 354 int fragment_tex_transform_location() const { return -1; } |
| 311 int sampler_location() const { return sampler_location_; } | 355 int sampler_location() const { return sampler_location_; } |
| 312 | 356 |
| 313 private: | 357 private: |
| 314 int sampler_location_; | 358 int sampler_location_; |
| 315 int alpha_location_; | 359 int alpha_location_; |
| 316 int color_matrix_location_; | 360 int color_matrix_location_; |
| 317 int color_offset_location_; | 361 int color_offset_location_; |
| 318 }; | 362 }; |
| 319 | 363 |
| 320 class FragmentTexOpaqueBinding { | 364 class FragmentTexOpaqueBinding : public FragmentTexBlendMode { |
| 321 public: | 365 public: |
| 322 FragmentTexOpaqueBinding(); | 366 FragmentTexOpaqueBinding(); |
| 323 | 367 |
| 324 void Init(gpu::gles2::GLES2Interface* context, | 368 void Init(gpu::gles2::GLES2Interface* context, |
| 325 unsigned program, | 369 unsigned program, |
| 326 int* base_uniform_index); | 370 int* base_uniform_index); |
| 327 int alpha_location() const { return -1; } | 371 int alpha_location() const { return -1; } |
| 328 int fragment_tex_transform_location() const { return -1; } | 372 int fragment_tex_transform_location() const { return -1; } |
| 329 int background_color_location() const { return -1; } | 373 int background_color_location() const { return -1; } |
| 330 int sampler_location() const { return sampler_location_; } | 374 int sampler_location() const { return sampler_location_; } |
| 331 | 375 |
| 332 private: | 376 private: |
| 333 int sampler_location_; | 377 int sampler_location_; |
| 334 | 378 |
| 335 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding); | 379 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding); |
| 336 }; | 380 }; |
| 337 | 381 |
| 338 class FragmentTexBackgroundBinding { | 382 class FragmentTexBackgroundBinding : public FragmentTexBlendMode { |
| 339 public: | 383 public: |
| 340 FragmentTexBackgroundBinding(); | 384 FragmentTexBackgroundBinding(); |
| 341 | 385 |
| 342 void Init(gpu::gles2::GLES2Interface* context, | 386 void Init(gpu::gles2::GLES2Interface* context, |
| 343 unsigned program, | 387 unsigned program, |
| 344 int* base_uniform_index); | 388 int* base_uniform_index); |
| 345 int background_color_location() const { return background_color_location_; } | 389 int background_color_location() const { return background_color_location_; } |
| 346 int sampler_location() const { return sampler_location_; } | 390 int sampler_location() const { return sampler_location_; } |
| 347 | 391 |
| 348 private: | 392 private: |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 TexCoordPrecision precision, SamplerType sampler) const; | 454 TexCoordPrecision precision, SamplerType sampler) const; |
| 411 }; | 455 }; |
| 412 | 456 |
| 413 // Swizzles the red and blue component of sampled texel without alpha. | 457 // Swizzles the red and blue component of sampled texel without alpha. |
| 414 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { | 458 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { |
| 415 public: | 459 public: |
| 416 std::string GetShaderString( | 460 std::string GetShaderString( |
| 417 TexCoordPrecision precision, SamplerType sampler) const; | 461 TexCoordPrecision precision, SamplerType sampler) const; |
| 418 }; | 462 }; |
| 419 | 463 |
| 420 class FragmentShaderRGBATexAlphaAA { | 464 class FragmentShaderRGBATexAlphaAA : public FragmentTexBlendMode { |
| 421 public: | 465 public: |
| 422 FragmentShaderRGBATexAlphaAA(); | 466 FragmentShaderRGBATexAlphaAA(); |
| 423 | 467 |
| 424 void Init(gpu::gles2::GLES2Interface* context, | 468 void Init(gpu::gles2::GLES2Interface* context, |
| 425 unsigned program, | 469 unsigned program, |
| 426 int* base_uniform_index); | 470 int* base_uniform_index); |
| 427 std::string GetShaderString( | 471 std::string GetShaderString( |
| 428 TexCoordPrecision precision, SamplerType sampler) const; | 472 TexCoordPrecision precision, SamplerType sampler) const; |
| 429 | 473 |
| 430 int alpha_location() const { return alpha_location_; } | 474 int alpha_location() const { return alpha_location_; } |
| 431 int sampler_location() const { return sampler_location_; } | 475 int sampler_location() const { return sampler_location_; } |
| 432 | 476 |
| 433 private: | 477 private: |
| 434 int sampler_location_; | 478 int sampler_location_; |
| 435 int alpha_location_; | 479 int alpha_location_; |
| 436 | 480 |
| 437 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); | 481 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); |
| 438 }; | 482 }; |
| 439 | 483 |
| 440 class FragmentTexClampAlphaAABinding { | 484 class FragmentTexClampAlphaAABinding : public FragmentTexBlendMode { |
| 441 public: | 485 public: |
| 442 FragmentTexClampAlphaAABinding(); | 486 FragmentTexClampAlphaAABinding(); |
| 443 | 487 |
| 444 void Init(gpu::gles2::GLES2Interface* context, | 488 void Init(gpu::gles2::GLES2Interface* context, |
| 445 unsigned program, | 489 unsigned program, |
| 446 int* base_uniform_index); | 490 int* base_uniform_index); |
| 447 int alpha_location() const { return alpha_location_; } | 491 int alpha_location() const { return alpha_location_; } |
| 448 int sampler_location() const { return sampler_location_; } | 492 int sampler_location() const { return sampler_location_; } |
| 449 int fragment_tex_transform_location() const { | 493 int fragment_tex_transform_location() const { |
| 450 return fragment_tex_transform_location_; | 494 return fragment_tex_transform_location_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 466 }; | 510 }; |
| 467 | 511 |
| 468 // Swizzles the red and blue component of sampled texel. | 512 // Swizzles the red and blue component of sampled texel. |
| 469 class FragmentShaderRGBATexClampSwizzleAlphaAA | 513 class FragmentShaderRGBATexClampSwizzleAlphaAA |
| 470 : public FragmentTexClampAlphaAABinding { | 514 : public FragmentTexClampAlphaAABinding { |
| 471 public: | 515 public: |
| 472 std::string GetShaderString( | 516 std::string GetShaderString( |
| 473 TexCoordPrecision precision, SamplerType sampler) const; | 517 TexCoordPrecision precision, SamplerType sampler) const; |
| 474 }; | 518 }; |
| 475 | 519 |
| 476 class FragmentShaderRGBATexAlphaMask { | 520 class FragmentShaderRGBATexAlphaMask : public FragmentTexBlendMode { |
| 477 public: | 521 public: |
| 478 FragmentShaderRGBATexAlphaMask(); | 522 FragmentShaderRGBATexAlphaMask(); |
| 479 std::string GetShaderString( | 523 std::string GetShaderString( |
| 480 TexCoordPrecision precision, SamplerType sampler) const; | 524 TexCoordPrecision precision, SamplerType sampler) const; |
| 481 | 525 |
| 482 void Init(gpu::gles2::GLES2Interface* context, | 526 void Init(gpu::gles2::GLES2Interface* context, |
| 483 unsigned program, | 527 unsigned program, |
| 484 int* base_uniform_index); | 528 int* base_uniform_index); |
| 485 int alpha_location() const { return alpha_location_; } | 529 int alpha_location() const { return alpha_location_; } |
| 486 int sampler_location() const { return sampler_location_; } | 530 int sampler_location() const { return sampler_location_; } |
| 487 int mask_sampler_location() const { return mask_sampler_location_; } | 531 int mask_sampler_location() const { return mask_sampler_location_; } |
| 488 int mask_tex_coord_scale_location() const { | 532 int mask_tex_coord_scale_location() const { |
| 489 return mask_tex_coord_scale_location_; | 533 return mask_tex_coord_scale_location_; |
| 490 } | 534 } |
| 491 int mask_tex_coord_offset_location() const { | 535 int mask_tex_coord_offset_location() const { |
| 492 return mask_tex_coord_offset_location_; | 536 return mask_tex_coord_offset_location_; |
| 493 } | 537 } |
| 494 | 538 |
| 495 private: | 539 private: |
| 496 int sampler_location_; | 540 int sampler_location_; |
| 497 int mask_sampler_location_; | 541 int mask_sampler_location_; |
| 498 int alpha_location_; | 542 int alpha_location_; |
| 499 int mask_tex_coord_scale_location_; | 543 int mask_tex_coord_scale_location_; |
| 500 int mask_tex_coord_offset_location_; | 544 int mask_tex_coord_offset_location_; |
| 501 | 545 |
| 502 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); | 546 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); |
| 503 }; | 547 }; |
| 504 | 548 |
| 505 class FragmentShaderRGBATexAlphaMaskAA { | 549 class FragmentShaderRGBATexAlphaMaskAA : public FragmentTexBlendMode { |
| 506 public: | 550 public: |
| 507 FragmentShaderRGBATexAlphaMaskAA(); | 551 FragmentShaderRGBATexAlphaMaskAA(); |
| 508 std::string GetShaderString( | 552 std::string GetShaderString( |
| 509 TexCoordPrecision precision, SamplerType sampler) const; | 553 TexCoordPrecision precision, SamplerType sampler) const; |
| 510 | 554 |
| 511 void Init(gpu::gles2::GLES2Interface* context, | 555 void Init(gpu::gles2::GLES2Interface* context, |
| 512 unsigned program, | 556 unsigned program, |
| 513 int* base_uniform_index); | 557 int* base_uniform_index); |
| 514 int alpha_location() const { return alpha_location_; } | 558 int alpha_location() const { return alpha_location_; } |
| 515 int sampler_location() const { return sampler_location_; } | 559 int sampler_location() const { return sampler_location_; } |
| 516 int mask_sampler_location() const { return mask_sampler_location_; } | 560 int mask_sampler_location() const { return mask_sampler_location_; } |
| 517 int mask_tex_coord_scale_location() const { | 561 int mask_tex_coord_scale_location() const { |
| 518 return mask_tex_coord_scale_location_; | 562 return mask_tex_coord_scale_location_; |
| 519 } | 563 } |
| 520 int mask_tex_coord_offset_location() const { | 564 int mask_tex_coord_offset_location() const { |
| 521 return mask_tex_coord_offset_location_; | 565 return mask_tex_coord_offset_location_; |
| 522 } | 566 } |
| 523 | 567 |
| 524 private: | 568 private: |
| 525 int sampler_location_; | 569 int sampler_location_; |
| 526 int mask_sampler_location_; | 570 int mask_sampler_location_; |
| 527 int alpha_location_; | 571 int alpha_location_; |
| 528 int mask_tex_coord_scale_location_; | 572 int mask_tex_coord_scale_location_; |
| 529 int mask_tex_coord_offset_location_; | 573 int mask_tex_coord_offset_location_; |
| 530 | 574 |
| 531 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); | 575 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); |
| 532 }; | 576 }; |
| 533 | 577 |
| 534 class FragmentShaderRGBATexAlphaMaskColorMatrixAA { | 578 class FragmentShaderRGBATexAlphaMaskColorMatrixAA |
| 579 : public FragmentTexBlendMode { |
| 535 public: | 580 public: |
| 536 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); | 581 FragmentShaderRGBATexAlphaMaskColorMatrixAA(); |
| 537 std::string GetShaderString( | 582 std::string GetShaderString( |
| 538 TexCoordPrecision precision, SamplerType sampler) const; | 583 TexCoordPrecision precision, SamplerType sampler) const; |
| 539 | 584 |
| 540 void Init(gpu::gles2::GLES2Interface* context, | 585 void Init(gpu::gles2::GLES2Interface* context, |
| 541 unsigned program, | 586 unsigned program, |
| 542 int* base_uniform_index); | 587 int* base_uniform_index); |
| 543 int alpha_location() const { return alpha_location_; } | 588 int alpha_location() const { return alpha_location_; } |
| 544 int sampler_location() const { return sampler_location_; } | 589 int sampler_location() const { return sampler_location_; } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 555 private: | 600 private: |
| 556 int sampler_location_; | 601 int sampler_location_; |
| 557 int mask_sampler_location_; | 602 int mask_sampler_location_; |
| 558 int alpha_location_; | 603 int alpha_location_; |
| 559 int mask_tex_coord_scale_location_; | 604 int mask_tex_coord_scale_location_; |
| 560 int mask_tex_coord_offset_location_; | 605 int mask_tex_coord_offset_location_; |
| 561 int color_matrix_location_; | 606 int color_matrix_location_; |
| 562 int color_offset_location_; | 607 int color_offset_location_; |
| 563 }; | 608 }; |
| 564 | 609 |
| 565 class FragmentShaderRGBATexAlphaColorMatrixAA { | 610 class FragmentShaderRGBATexAlphaColorMatrixAA : public FragmentTexBlendMode { |
| 566 public: | 611 public: |
| 567 FragmentShaderRGBATexAlphaColorMatrixAA(); | 612 FragmentShaderRGBATexAlphaColorMatrixAA(); |
| 568 std::string GetShaderString( | 613 std::string GetShaderString( |
| 569 TexCoordPrecision precision, SamplerType sampler) const; | 614 TexCoordPrecision precision, SamplerType sampler) const; |
| 570 | 615 |
| 571 void Init(gpu::gles2::GLES2Interface* context, | 616 void Init(gpu::gles2::GLES2Interface* context, |
| 572 unsigned program, | 617 unsigned program, |
| 573 int* base_uniform_index); | 618 int* base_uniform_index); |
| 574 int alpha_location() const { return alpha_location_; } | 619 int alpha_location() const { return alpha_location_; } |
| 575 int sampler_location() const { return sampler_location_; } | 620 int sampler_location() const { return sampler_location_; } |
| 576 int color_matrix_location() const { return color_matrix_location_; } | 621 int color_matrix_location() const { return color_matrix_location_; } |
| 577 int color_offset_location() const { return color_offset_location_; } | 622 int color_offset_location() const { return color_offset_location_; } |
| 578 | 623 |
| 579 private: | 624 private: |
| 580 int sampler_location_; | 625 int sampler_location_; |
| 581 int alpha_location_; | 626 int alpha_location_; |
| 582 int color_matrix_location_; | 627 int color_matrix_location_; |
| 583 int color_offset_location_; | 628 int color_offset_location_; |
| 584 }; | 629 }; |
| 585 | 630 |
| 586 class FragmentShaderRGBATexAlphaMaskColorMatrix { | 631 class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentTexBlendMode { |
| 587 public: | 632 public: |
| 588 FragmentShaderRGBATexAlphaMaskColorMatrix(); | 633 FragmentShaderRGBATexAlphaMaskColorMatrix(); |
| 589 std::string GetShaderString( | 634 std::string GetShaderString( |
| 590 TexCoordPrecision precision, SamplerType sampler) const; | 635 TexCoordPrecision precision, SamplerType sampler) const; |
| 591 | 636 |
| 592 void Init(gpu::gles2::GLES2Interface* context, | 637 void Init(gpu::gles2::GLES2Interface* context, |
| 593 unsigned program, | 638 unsigned program, |
| 594 int* base_uniform_index); | 639 int* base_uniform_index); |
| 595 int alpha_location() const { return alpha_location_; } | 640 int alpha_location() const { return alpha_location_; } |
| 596 int sampler_location() const { return sampler_location_; } | 641 int sampler_location() const { return sampler_location_; } |
| (...skipping 10 matching lines...) Expand all Loading... |
| 607 private: | 652 private: |
| 608 int sampler_location_; | 653 int sampler_location_; |
| 609 int mask_sampler_location_; | 654 int mask_sampler_location_; |
| 610 int alpha_location_; | 655 int alpha_location_; |
| 611 int mask_tex_coord_scale_location_; | 656 int mask_tex_coord_scale_location_; |
| 612 int mask_tex_coord_offset_location_; | 657 int mask_tex_coord_offset_location_; |
| 613 int color_matrix_location_; | 658 int color_matrix_location_; |
| 614 int color_offset_location_; | 659 int color_offset_location_; |
| 615 }; | 660 }; |
| 616 | 661 |
| 617 class FragmentShaderYUVVideo { | 662 class FragmentShaderYUVVideo : public FragmentTexBlendMode { |
| 618 public: | 663 public: |
| 619 FragmentShaderYUVVideo(); | 664 FragmentShaderYUVVideo(); |
| 620 std::string GetShaderString( | 665 std::string GetShaderString( |
| 621 TexCoordPrecision precision, SamplerType sampler) const; | 666 TexCoordPrecision precision, SamplerType sampler) const; |
| 622 | 667 |
| 623 void Init(gpu::gles2::GLES2Interface* context, | 668 void Init(gpu::gles2::GLES2Interface* context, |
| 624 unsigned program, | 669 unsigned program, |
| 625 int* base_uniform_index); | 670 int* base_uniform_index); |
| 626 int y_texture_location() const { return y_texture_location_; } | 671 int y_texture_location() const { return y_texture_location_; } |
| 627 int u_texture_location() const { return u_texture_location_; } | 672 int u_texture_location() const { return u_texture_location_; } |
| 628 int v_texture_location() const { return v_texture_location_; } | 673 int v_texture_location() const { return v_texture_location_; } |
| 629 int alpha_location() const { return alpha_location_; } | 674 int alpha_location() const { return alpha_location_; } |
| 630 int yuv_matrix_location() const { return yuv_matrix_location_; } | 675 int yuv_matrix_location() const { return yuv_matrix_location_; } |
| 631 int yuv_adj_location() const { return yuv_adj_location_; } | 676 int yuv_adj_location() const { return yuv_adj_location_; } |
| 632 | 677 |
| 633 private: | 678 private: |
| 634 int y_texture_location_; | 679 int y_texture_location_; |
| 635 int u_texture_location_; | 680 int u_texture_location_; |
| 636 int v_texture_location_; | 681 int v_texture_location_; |
| 637 int alpha_location_; | 682 int alpha_location_; |
| 638 int yuv_matrix_location_; | 683 int yuv_matrix_location_; |
| 639 int yuv_adj_location_; | 684 int yuv_adj_location_; |
| 640 | 685 |
| 641 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); | 686 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); |
| 642 }; | 687 }; |
| 643 | 688 |
| 644 | 689 class FragmentShaderYUVAVideo : public FragmentTexBlendMode { |
| 645 class FragmentShaderYUVAVideo { | |
| 646 public: | 690 public: |
| 647 FragmentShaderYUVAVideo(); | 691 FragmentShaderYUVAVideo(); |
| 648 std::string GetShaderString( | 692 std::string GetShaderString( |
| 649 TexCoordPrecision precision, SamplerType sampler) const; | 693 TexCoordPrecision precision, SamplerType sampler) const; |
| 650 | 694 |
| 651 void Init(gpu::gles2::GLES2Interface* context, | 695 void Init(gpu::gles2::GLES2Interface* context, |
| 652 unsigned program, | 696 unsigned program, |
| 653 int* base_uniform_index); | 697 int* base_uniform_index); |
| 654 | 698 |
| 655 int y_texture_location() const { return y_texture_location_; } | 699 int y_texture_location() const { return y_texture_location_; } |
| 656 int u_texture_location() const { return u_texture_location_; } | 700 int u_texture_location() const { return u_texture_location_; } |
| 657 int v_texture_location() const { return v_texture_location_; } | 701 int v_texture_location() const { return v_texture_location_; } |
| 658 int a_texture_location() const { return a_texture_location_; } | 702 int a_texture_location() const { return a_texture_location_; } |
| 659 int alpha_location() const { return alpha_location_; } | 703 int alpha_location() const { return alpha_location_; } |
| 660 int yuv_matrix_location() const { return yuv_matrix_location_; } | 704 int yuv_matrix_location() const { return yuv_matrix_location_; } |
| 661 int yuv_adj_location() const { return yuv_adj_location_; } | 705 int yuv_adj_location() const { return yuv_adj_location_; } |
| 662 | 706 |
| 663 private: | 707 private: |
| 664 int y_texture_location_; | 708 int y_texture_location_; |
| 665 int u_texture_location_; | 709 int u_texture_location_; |
| 666 int v_texture_location_; | 710 int v_texture_location_; |
| 667 int a_texture_location_; | 711 int a_texture_location_; |
| 668 int alpha_location_; | 712 int alpha_location_; |
| 669 int yuv_matrix_location_; | 713 int yuv_matrix_location_; |
| 670 int yuv_adj_location_; | 714 int yuv_adj_location_; |
| 671 | 715 |
| 672 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); | 716 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVAVideo); |
| 673 }; | 717 }; |
| 674 | 718 |
| 675 class FragmentShaderColor { | 719 class FragmentShaderColor : public FragmentTexBlendMode { |
| 676 public: | 720 public: |
| 677 FragmentShaderColor(); | 721 FragmentShaderColor(); |
| 678 std::string GetShaderString( | 722 std::string GetShaderString( |
| 679 TexCoordPrecision precision, SamplerType sampler) const; | 723 TexCoordPrecision precision, SamplerType sampler) const; |
| 680 | 724 |
| 681 void Init(gpu::gles2::GLES2Interface* context, | 725 void Init(gpu::gles2::GLES2Interface* context, |
| 682 unsigned program, | 726 unsigned program, |
| 683 int* base_uniform_index); | 727 int* base_uniform_index); |
| 684 int color_location() const { return color_location_; } | 728 int color_location() const { return color_location_; } |
| 685 | 729 |
| 686 private: | 730 private: |
| 687 int color_location_; | 731 int color_location_; |
| 688 | 732 |
| 689 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); | 733 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); |
| 690 }; | 734 }; |
| 691 | 735 |
| 692 class FragmentShaderColorAA { | 736 class FragmentShaderColorAA : public FragmentTexBlendMode { |
| 693 public: | 737 public: |
| 694 FragmentShaderColorAA(); | 738 FragmentShaderColorAA(); |
| 695 std::string GetShaderString( | 739 std::string GetShaderString( |
| 696 TexCoordPrecision precision, SamplerType sampler) const; | 740 TexCoordPrecision precision, SamplerType sampler) const; |
| 697 | 741 |
| 698 void Init(gpu::gles2::GLES2Interface* context, | 742 void Init(gpu::gles2::GLES2Interface* context, |
| 699 unsigned program, | 743 unsigned program, |
| 700 int* base_uniform_index); | 744 int* base_uniform_index); |
| 701 int color_location() const { return color_location_; } | 745 int color_location() const { return color_location_; } |
| 702 | 746 |
| 703 private: | 747 private: |
| 704 int color_location_; | 748 int color_location_; |
| 705 | 749 |
| 706 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); | 750 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); |
| 707 }; | 751 }; |
| 708 | 752 |
| 709 class FragmentShaderCheckerboard { | 753 class FragmentShaderCheckerboard : public FragmentTexBlendMode { |
| 710 public: | 754 public: |
| 711 FragmentShaderCheckerboard(); | 755 FragmentShaderCheckerboard(); |
| 712 std::string GetShaderString( | 756 std::string GetShaderString( |
| 713 TexCoordPrecision precision, SamplerType sampler) const; | 757 TexCoordPrecision precision, SamplerType sampler) const; |
| 714 | 758 |
| 715 void Init(gpu::gles2::GLES2Interface* context, | 759 void Init(gpu::gles2::GLES2Interface* context, |
| 716 unsigned program, | 760 unsigned program, |
| 717 int* base_uniform_index); | 761 int* base_uniform_index); |
| 718 int alpha_location() const { return alpha_location_; } | 762 int alpha_location() const { return alpha_location_; } |
| 719 int tex_transform_location() const { return tex_transform_location_; } | 763 int tex_transform_location() const { return tex_transform_location_; } |
| 720 int frequency_location() const { return frequency_location_; } | 764 int frequency_location() const { return frequency_location_; } |
| 721 int color_location() const { return color_location_; } | 765 int color_location() const { return color_location_; } |
| 722 | 766 |
| 723 private: | 767 private: |
| 724 int alpha_location_; | 768 int alpha_location_; |
| 725 int tex_transform_location_; | 769 int tex_transform_location_; |
| 726 int frequency_location_; | 770 int frequency_location_; |
| 727 int color_location_; | 771 int color_location_; |
| 728 | 772 |
| 729 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); | 773 DISALLOW_COPY_AND_ASSIGN(FragmentShaderCheckerboard); |
| 730 }; | 774 }; |
| 731 | 775 |
| 732 } // namespace cc | 776 } // namespace cc |
| 733 | 777 |
| 734 #endif // CC_OUTPUT_SHADER_H_ | 778 #endif // CC_OUTPUT_SHADER_H_ |
| OLD | NEW |