Chromium Code Reviews| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 BLEND_MODE_DIFFERENCE, | 52 BLEND_MODE_DIFFERENCE, |
| 53 BLEND_MODE_EXCLUSION, | 53 BLEND_MODE_EXCLUSION, |
| 54 BLEND_MODE_MULTIPLY, | 54 BLEND_MODE_MULTIPLY, |
| 55 BLEND_MODE_HUE, | 55 BLEND_MODE_HUE, |
| 56 BLEND_MODE_SATURATION, | 56 BLEND_MODE_SATURATION, |
| 57 BLEND_MODE_COLOR, | 57 BLEND_MODE_COLOR, |
| 58 BLEND_MODE_LUMINOSITY, | 58 BLEND_MODE_LUMINOSITY, |
| 59 LAST_BLEND_MODE = BLEND_MODE_LUMINOSITY | 59 LAST_BLEND_MODE = BLEND_MODE_LUMINOSITY |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 enum InputColorSource { | |
| 63 INPUT_COLOR_SOURCE_RGBA_TEXTURE, | |
| 64 INPUT_COLOR_SOURCE_UNIFORM, | |
| 65 }; | |
| 66 | |
| 67 // TODO(ccameron): Merge this with BlendMode. | |
| 68 enum FragColorMode { | |
| 69 FRAG_COLOR_MODE_DEFAULT, | |
| 70 FRAG_COLOR_MODE_OPAQUE, | |
| 71 FRAG_COLOR_MODE_APPLY_BLEND_MODE, | |
| 72 }; | |
| 73 | |
| 62 enum MaskMode { | 74 enum MaskMode { |
| 63 NO_MASK = 0, | 75 NO_MASK = 0, |
| 64 HAS_MASK = 1, | 76 HAS_MASK = 1, |
| 65 LAST_MASK_VALUE = HAS_MASK | 77 LAST_MASK_VALUE = HAS_MASK |
| 66 }; | 78 }; |
| 67 | 79 |
| 68 struct ShaderLocations { | 80 struct ShaderLocations { |
| 69 ShaderLocations(); | 81 ShaderLocations(); |
| 70 | 82 |
| 71 int sampler = -1; | 83 int sampler = -1; |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 374 int sampler_location() const { return sampler_location_; } | 386 int sampler_location() const { return sampler_location_; } |
| 375 int alpha_location() const { return alpha_location_; } | 387 int alpha_location() const { return alpha_location_; } |
| 376 int color_location() const { return color_location_; } | 388 int color_location() const { return color_location_; } |
| 377 int background_color_location() const { return background_color_location_; } | 389 int background_color_location() const { return background_color_location_; } |
| 378 int fragment_tex_transform_location() const { | 390 int fragment_tex_transform_location() const { |
| 379 return fragment_tex_transform_location_; | 391 return fragment_tex_transform_location_; |
| 380 } | 392 } |
| 381 | 393 |
| 382 protected: | 394 protected: |
| 383 FragmentShaderBase(); | 395 FragmentShaderBase(); |
| 384 virtual std::string GetShaderSource() const = 0; | 396 virtual std::string GetShaderSource() const; |
| 385 | 397 |
| 386 std::string SetBlendModeFunctions(const std::string& shader_string) const; | 398 std::string SetBlendModeFunctions(const std::string& shader_string) const; |
| 387 | 399 |
| 400 // Settings that are modified by sub-classes. | |
| 401 bool has_aa_ = false; | |
| 402 bool has_varying_alpha_ = false; | |
| 403 bool has_swizzle_ = false; | |
| 404 bool has_premultiply_alpha_ = false; | |
| 405 FragColorMode frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | |
| 406 InputColorSource input_color_type_ = INPUT_COLOR_SOURCE_RGBA_TEXTURE; | |
| 407 | |
| 388 // Used only if |blend_mode_| is not BLEND_MODE_NONE. | 408 // Used only if |blend_mode_| is not BLEND_MODE_NONE. |
| 389 int backdrop_location_ = -1; | 409 int backdrop_location_ = -1; |
| 390 int original_backdrop_location_ = -1; | 410 int original_backdrop_location_ = -1; |
| 391 int backdrop_rect_location_ = -1; | 411 int backdrop_rect_location_ = -1; |
| 392 | 412 |
| 413 // Used only if |input_color_type_| is INPUT_COLOR_SOURCE_RGBA_TEXTURE. | |
| 414 bool has_rgba_fragment_tex_transform_ = false; | |
| 415 bool has_rgba_as_sampler_2d_ = false; | |
| 416 int sampler_location_ = -1; | |
| 417 int fragment_tex_transform_location_ = -1; | |
| 418 | |
| 419 // Used only if |input_color_type_| is INPUT_COLOR_SOURCE_UNIFORM. | |
| 420 int color_location_ = -1; | |
| 421 | |
| 393 bool has_mask_sampler_ = false; | 422 bool has_mask_sampler_ = false; |
| 394 int mask_sampler_location_ = -1; | 423 int mask_sampler_location_ = -1; |
| 395 int mask_tex_coord_scale_location_ = -1; | 424 int mask_tex_coord_scale_location_ = -1; |
| 396 int mask_tex_coord_offset_location_ = -1; | 425 int mask_tex_coord_offset_location_ = -1; |
| 397 | 426 |
| 398 bool has_color_matrix_ = false; | 427 bool has_color_matrix_ = false; |
| 399 int color_matrix_location_ = -1; | 428 int color_matrix_location_ = -1; |
| 400 int color_offset_location_ = -1; | 429 int color_offset_location_ = -1; |
| 401 | 430 |
| 402 bool has_sampler_ = false; | |
| 403 int sampler_location_ = -1; | |
| 404 | |
| 405 bool has_uniform_alpha_ = false; | 431 bool has_uniform_alpha_ = false; |
| 406 int alpha_location_ = -1; | 432 int alpha_location_ = -1; |
| 407 | 433 |
| 408 bool has_background_color_ = false; | 434 bool has_background_color_ = false; |
| 409 int background_color_location_ = -1; | 435 int background_color_location_ = -1; |
| 410 | 436 |
| 411 bool has_fragment_tex_transform_ = false; | |
| 412 int fragment_tex_transform_location_ = -1; | |
| 413 | |
| 414 bool has_uniform_color_ = false; | |
| 415 int color_location_ = -1; | |
| 416 | |
| 417 private: | 437 private: |
| 418 BlendMode blend_mode_ = BLEND_MODE_NONE; | 438 BlendMode blend_mode_ = BLEND_MODE_NONE; |
| 419 bool mask_for_background_ = false; | 439 bool mask_for_background_ = false; |
| 420 | 440 |
| 421 std::string GetHelperFunctions() const; | 441 std::string GetHelperFunctions() const; |
| 422 std::string GetBlendFunction() const; | 442 std::string GetBlendFunction() const; |
| 423 std::string GetBlendFunctionBodyForRGB() const; | 443 std::string GetBlendFunctionBodyForRGB() const; |
| 424 }; | 444 }; |
| 425 | 445 |
| 426 class FragmentTexAlphaBinding : public FragmentShaderBase { | 446 class FragmentShaderRGBATexVaryingAlpha : public FragmentShaderBase { |
| 427 public: | 447 public: |
| 428 FragmentTexAlphaBinding() { | 448 FragmentShaderRGBATexVaryingAlpha() { |
| 429 has_sampler_ = true; | 449 has_varying_alpha_ = true; |
| 430 has_uniform_alpha_ = true; | 450 frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; |
| 431 } | 451 } |
| 432 | |
| 433 private: | |
| 434 DISALLOW_COPY_AND_ASSIGN(FragmentTexAlphaBinding); | |
| 435 }; | 452 }; |
| 436 | 453 |
| 437 class FragmentTexColorMatrixAlphaBinding : public FragmentShaderBase { | 454 class FragmentShaderRGBATexPremultiplyAlpha : public FragmentShaderBase { |
| 438 public: | 455 public: |
| 439 FragmentTexColorMatrixAlphaBinding() { | 456 FragmentShaderRGBATexPremultiplyAlpha() { |
| 440 has_sampler_ = true; | 457 has_varying_alpha_ = true; |
| 458 has_premultiply_alpha_ = true; | |
| 459 frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | |
| 460 } | |
| 461 }; | |
| 462 | |
| 463 class FragmentShaderTexBackgroundVaryingAlpha : public FragmentShaderBase { | |
| 464 public: | |
| 465 FragmentShaderTexBackgroundVaryingAlpha() { | |
| 466 has_background_color_ = true; | |
| 467 has_varying_alpha_ = true; | |
| 468 frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | |
| 469 } | |
| 470 }; | |
| 471 | |
| 472 class FragmentShaderTexBackgroundPremultiplyAlpha : public FragmentShaderBase { | |
| 473 public: | |
| 474 FragmentShaderTexBackgroundPremultiplyAlpha() { | |
| 475 has_background_color_ = true; | |
| 476 has_varying_alpha_ = true; | |
| 477 has_premultiply_alpha_ = true; | |
| 478 frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | |
| 479 } | |
| 480 }; | |
| 481 | |
| 482 class FragmentShaderRGBATexAlpha : public FragmentShaderBase { | |
| 483 public: | |
| 484 FragmentShaderRGBATexAlpha() { | |
| 485 has_uniform_alpha_ = true; | |
| 486 frag_color_mode_ = FRAG_COLOR_MODE_APPLY_BLEND_MODE; | |
| 487 } | |
| 488 }; | |
| 489 | |
| 490 class FragmentShaderRGBATexColorMatrixAlpha : public FragmentShaderBase { | |
| 491 public: | |
| 492 FragmentShaderRGBATexColorMatrixAlpha() { | |
| 441 has_uniform_alpha_ = true; | 493 has_uniform_alpha_ = true; |
| 442 has_color_matrix_ = true; | 494 has_color_matrix_ = true; |
| 495 frag_color_mode_ = FRAG_COLOR_MODE_APPLY_BLEND_MODE; | |
| 443 } | 496 } |
| 444 | |
| 445 private: | |
| 446 }; | 497 }; |
| 447 | 498 |
| 448 class FragmentTexOpaqueBinding : public FragmentShaderBase { | 499 class FragmentShaderRGBATexOpaque : public FragmentShaderBase { |
| 449 public: | 500 public: |
| 450 FragmentTexOpaqueBinding() { has_sampler_ = true; } | 501 FragmentShaderRGBATexOpaque() { frag_color_mode_ = FRAG_COLOR_MODE_OPAQUE; } |
| 451 | |
| 452 private: | |
| 453 DISALLOW_COPY_AND_ASSIGN(FragmentTexOpaqueBinding); | |
| 454 }; | 502 }; |
| 455 | 503 |
| 456 class FragmentTexBackgroundBinding : public FragmentShaderBase { | 504 class FragmentShaderRGBATex : public FragmentShaderBase { |
| 457 public: | 505 public: |
| 458 FragmentTexBackgroundBinding() { | 506 FragmentShaderRGBATex() { frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; } |
| 459 has_sampler_ = true; | |
| 460 has_background_color_ = true; | |
| 461 } | |
| 462 | |
| 463 private: | |
| 464 DISALLOW_COPY_AND_ASSIGN(FragmentTexBackgroundBinding); | |
| 465 }; | |
| 466 | |
| 467 class FragmentShaderRGBATexVaryingAlpha : public FragmentTexOpaqueBinding { | |
| 468 private: | |
| 469 std::string GetShaderSource() const override; | |
| 470 }; | |
| 471 | |
| 472 class FragmentShaderRGBATexPremultiplyAlpha : public FragmentTexOpaqueBinding { | |
| 473 private: | |
| 474 std::string GetShaderSource() const override; | |
| 475 }; | |
| 476 | |
| 477 class FragmentShaderTexBackgroundVaryingAlpha | |
| 478 : public FragmentTexBackgroundBinding { | |
| 479 private: | |
| 480 std::string GetShaderSource() const override; | |
| 481 }; | |
| 482 | |
| 483 class FragmentShaderTexBackgroundPremultiplyAlpha | |
| 484 : public FragmentTexBackgroundBinding { | |
| 485 private: | |
| 486 std::string GetShaderSource() const override; | |
| 487 }; | |
| 488 | |
| 489 class FragmentShaderRGBATexAlpha : public FragmentTexAlphaBinding { | |
| 490 private: | |
| 491 std::string GetShaderSource() const override; | |
| 492 }; | |
| 493 | |
| 494 class FragmentShaderRGBATexColorMatrixAlpha | |
| 495 : public FragmentTexColorMatrixAlphaBinding { | |
| 496 private: | |
| 497 std::string GetShaderSource() const override; | |
| 498 }; | |
| 499 | |
| 500 class FragmentShaderRGBATexOpaque : public FragmentTexOpaqueBinding { | |
| 501 private: | |
| 502 std::string GetShaderSource() const override; | |
| 503 }; | |
| 504 | |
| 505 class FragmentShaderRGBATex : public FragmentTexOpaqueBinding { | |
| 506 private: | |
| 507 std::string GetShaderSource() const override; | |
| 508 }; | 507 }; |
| 509 | 508 |
| 510 // Swizzles the red and blue component of sampled texel with alpha. | 509 // Swizzles the red and blue component of sampled texel with alpha. |
| 511 class FragmentShaderRGBATexSwizzleAlpha : public FragmentTexAlphaBinding { | 510 class FragmentShaderRGBATexSwizzleAlpha : public FragmentShaderBase { |
| 512 private: | 511 public: |
| 513 std::string GetShaderSource() const override; | 512 FragmentShaderRGBATexSwizzleAlpha() { |
| 513 has_uniform_alpha_ = true; | |
| 514 has_swizzle_ = true; | |
| 515 frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | |
| 516 } | |
| 514 }; | 517 }; |
| 515 | 518 |
| 516 // Swizzles the red and blue component of sampled texel without alpha. | 519 // Swizzles the red and blue component of sampled texel without alpha. |
| 517 class FragmentShaderRGBATexSwizzleOpaque : public FragmentTexOpaqueBinding { | 520 class FragmentShaderRGBATexSwizzleOpaque : public FragmentShaderBase { |
| 518 private: | 521 public: |
| 519 std::string GetShaderSource() const override; | 522 FragmentShaderRGBATexSwizzleOpaque() { |
| 523 has_swizzle_ = true; | |
| 524 frag_color_mode_ = FRAG_COLOR_MODE_OPAQUE; | |
| 525 } | |
| 520 }; | 526 }; |
| 521 | 527 |
| 522 class FragmentShaderRGBATexAlphaAA : public FragmentShaderBase { | 528 class FragmentShaderRGBATexAlphaAA : public FragmentShaderBase { |
| 523 public: | 529 public: |
| 524 FragmentShaderRGBATexAlphaAA() { | 530 FragmentShaderRGBATexAlphaAA() { |
| 525 has_sampler_ = true; | 531 has_aa_ = true; |
| 526 has_uniform_alpha_ = true; | 532 has_uniform_alpha_ = true; |
| 533 frag_color_mode_ = FRAG_COLOR_MODE_APPLY_BLEND_MODE; | |
| 527 } | 534 } |
| 528 | |
| 529 private: | 535 private: |
| 530 std::string GetShaderSource() const override; | |
| 531 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); | 536 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaAA); |
| 532 }; | 537 }; |
| 533 | 538 |
| 534 class FragmentTexClampAlphaAABinding : public FragmentShaderBase { | 539 class FragmentShaderRGBATexClampAlphaAA : public FragmentShaderBase { |
| 535 public: | 540 public: |
| 536 FragmentTexClampAlphaAABinding() { | 541 FragmentShaderRGBATexClampAlphaAA() { |
| 537 has_sampler_ = true; | 542 has_aa_ = true; |
| 538 has_uniform_alpha_ = true; | 543 has_uniform_alpha_ = true; |
| 539 has_fragment_tex_transform_ = true; | 544 has_rgba_fragment_tex_transform_ = true; |
| 545 frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | |
| 540 } | 546 } |
| 541 private: | |
| 542 DISALLOW_COPY_AND_ASSIGN(FragmentTexClampAlphaAABinding); | |
| 543 }; | |
| 544 | |
| 545 class FragmentShaderRGBATexClampAlphaAA | |
| 546 : public FragmentTexClampAlphaAABinding { | |
| 547 private: | |
| 548 std::string GetShaderSource() const override; | |
| 549 }; | 547 }; |
| 550 | 548 |
| 551 // Swizzles the red and blue component of sampled texel. | 549 // Swizzles the red and blue component of sampled texel. |
| 552 class FragmentShaderRGBATexClampSwizzleAlphaAA | 550 class FragmentShaderRGBATexClampSwizzleAlphaAA : public FragmentShaderBase { |
| 553 : public FragmentTexClampAlphaAABinding { | 551 public: |
| 554 private: | 552 FragmentShaderRGBATexClampSwizzleAlphaAA() { |
| 555 std::string GetShaderSource() const override; | 553 has_aa_ = true; |
| 554 has_uniform_alpha_ = true; | |
| 555 has_rgba_fragment_tex_transform_ = true; | |
| 556 has_swizzle_ = true; | |
| 557 frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | |
| 558 } | |
| 556 }; | 559 }; |
| 557 | 560 |
| 558 class FragmentShaderRGBATexAlphaMask : public FragmentShaderBase { | 561 class FragmentShaderRGBATexAlphaMask : public FragmentShaderBase { |
| 559 public: | 562 public: |
| 560 FragmentShaderRGBATexAlphaMask() { | 563 FragmentShaderRGBATexAlphaMask() { |
| 561 has_sampler_ = true; | |
| 562 has_uniform_alpha_ = true; | 564 has_uniform_alpha_ = true; |
| 563 has_mask_sampler_ = true; | 565 has_mask_sampler_ = true; |
| 566 frag_color_mode_ = FRAG_COLOR_MODE_APPLY_BLEND_MODE; | |
| 567 has_rgba_as_sampler_2d_ = true; | |
| 564 } | 568 } |
| 565 private: | 569 private: |
| 566 std::string GetShaderSource() const override; | |
| 567 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); | 570 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMask); |
| 568 }; | 571 }; |
| 569 | 572 |
| 570 class FragmentShaderRGBATexAlphaMaskAA : public FragmentShaderBase { | 573 class FragmentShaderRGBATexAlphaMaskAA : public FragmentShaderBase { |
| 571 public: | 574 public: |
| 572 FragmentShaderRGBATexAlphaMaskAA() { | 575 FragmentShaderRGBATexAlphaMaskAA() { |
| 573 has_sampler_ = true; | 576 has_aa_ = true; |
| 574 has_uniform_alpha_ = true; | 577 has_uniform_alpha_ = true; |
| 575 has_mask_sampler_ = true; | 578 has_mask_sampler_ = true; |
| 579 frag_color_mode_ = FRAG_COLOR_MODE_APPLY_BLEND_MODE; | |
| 580 has_rgba_as_sampler_2d_ = true; | |
| 576 } | 581 } |
| 577 private: | 582 private: |
| 578 std::string GetShaderSource() const override; | |
| 579 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); | 583 DISALLOW_COPY_AND_ASSIGN(FragmentShaderRGBATexAlphaMaskAA); |
|
enne (OOO)
2017/01/03 21:42:58
Tiniest of nits: maybe all or none of these classe
ccameron
2017/01/03 22:12:27
Yeah, I was wondering what to do there. Updated to
| |
| 580 }; | 584 }; |
| 581 | 585 |
| 582 class FragmentShaderRGBATexAlphaMaskColorMatrixAA : public FragmentShaderBase { | 586 class FragmentShaderRGBATexAlphaMaskColorMatrixAA : public FragmentShaderBase { |
| 583 public: | 587 public: |
| 584 FragmentShaderRGBATexAlphaMaskColorMatrixAA() { | 588 FragmentShaderRGBATexAlphaMaskColorMatrixAA() { |
| 585 has_sampler_ = true; | 589 has_aa_ = true; |
| 586 has_uniform_alpha_ = true; | 590 has_uniform_alpha_ = true; |
| 587 has_mask_sampler_ = true; | 591 has_mask_sampler_ = true; |
| 588 has_color_matrix_ = true; | 592 has_color_matrix_ = true; |
| 593 frag_color_mode_ = FRAG_COLOR_MODE_APPLY_BLEND_MODE; | |
| 594 has_rgba_as_sampler_2d_ = true; | |
| 589 } | 595 } |
| 590 private: | |
| 591 std::string GetShaderSource() const override; | |
| 592 }; | 596 }; |
| 593 | 597 |
| 594 class FragmentShaderRGBATexAlphaColorMatrixAA : public FragmentShaderBase { | 598 class FragmentShaderRGBATexAlphaColorMatrixAA : public FragmentShaderBase { |
| 595 public: | 599 public: |
| 596 FragmentShaderRGBATexAlphaColorMatrixAA() { | 600 FragmentShaderRGBATexAlphaColorMatrixAA() { |
| 597 has_sampler_ = true; | 601 has_aa_ = true; |
| 598 has_uniform_alpha_ = true; | 602 has_uniform_alpha_ = true; |
| 599 has_color_matrix_ = true; | 603 has_color_matrix_ = true; |
| 604 frag_color_mode_ = FRAG_COLOR_MODE_APPLY_BLEND_MODE; | |
| 600 } | 605 } |
| 601 | |
| 602 private: | |
| 603 std::string GetShaderSource() const override; | |
| 604 }; | 606 }; |
| 605 | 607 |
| 606 class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentShaderBase { | 608 class FragmentShaderRGBATexAlphaMaskColorMatrix : public FragmentShaderBase { |
| 607 public: | 609 public: |
| 608 FragmentShaderRGBATexAlphaMaskColorMatrix() { | 610 FragmentShaderRGBATexAlphaMaskColorMatrix() { |
| 609 has_sampler_ = true; | |
| 610 has_uniform_alpha_ = true; | 611 has_uniform_alpha_ = true; |
| 611 has_mask_sampler_ = true; | 612 has_mask_sampler_ = true; |
| 612 has_color_matrix_ = true; | 613 has_color_matrix_ = true; |
| 614 frag_color_mode_ = FRAG_COLOR_MODE_APPLY_BLEND_MODE; | |
| 615 has_rgba_as_sampler_2d_ = true; | |
| 613 } | 616 } |
| 614 private: | |
| 615 std::string GetShaderSource() const override; | |
| 616 }; | 617 }; |
| 617 | 618 |
| 618 class FragmentShaderYUVVideo : public FragmentShaderBase { | 619 class FragmentShaderYUVVideo : public FragmentShaderBase { |
| 619 public: | 620 public: |
| 620 FragmentShaderYUVVideo(); | 621 FragmentShaderYUVVideo(); |
| 621 void SetFeatures(bool use_alpha_texture, bool use_nv12, bool use_color_lut); | 622 void SetFeatures(bool use_alpha_texture, bool use_nv12, bool use_color_lut); |
| 622 | 623 |
| 623 void Init(gpu::gles2::GLES2Interface* context, | 624 void Init(gpu::gles2::GLES2Interface* context, |
| 624 unsigned program, | 625 unsigned program, |
| 625 int* base_uniform_index) override; | 626 int* base_uniform_index) override; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 int ya_clamp_rect_location_ = -1; | 659 int ya_clamp_rect_location_ = -1; |
| 659 int uv_clamp_rect_location_ = -1; | 660 int uv_clamp_rect_location_ = -1; |
| 660 int resource_multiplier_location_ = -1; | 661 int resource_multiplier_location_ = -1; |
| 661 int resource_offset_location_ = -1; | 662 int resource_offset_location_ = -1; |
| 662 | 663 |
| 663 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); | 664 DISALLOW_COPY_AND_ASSIGN(FragmentShaderYUVVideo); |
| 664 }; | 665 }; |
| 665 | 666 |
| 666 class FragmentShaderColor : public FragmentShaderBase { | 667 class FragmentShaderColor : public FragmentShaderBase { |
| 667 public: | 668 public: |
| 668 FragmentShaderColor() { has_uniform_color_ = true; } | 669 FragmentShaderColor() { |
| 670 input_color_type_ = INPUT_COLOR_SOURCE_UNIFORM; | |
| 671 frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | |
| 672 } | |
| 669 | 673 |
| 670 private: | 674 private: |
| 671 std::string GetShaderSource() const override; | |
| 672 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); | 675 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColor); |
| 673 }; | 676 }; |
| 674 | 677 |
| 675 class FragmentShaderColorAA : public FragmentShaderBase { | 678 class FragmentShaderColorAA : public FragmentShaderBase { |
| 676 public: | 679 public: |
| 677 FragmentShaderColorAA() { has_uniform_color_ = true; } | 680 FragmentShaderColorAA() { |
| 681 input_color_type_ = INPUT_COLOR_SOURCE_UNIFORM; | |
| 682 has_aa_ = true; | |
| 683 frag_color_mode_ = FRAG_COLOR_MODE_DEFAULT; | |
| 684 } | |
| 678 | 685 |
| 679 private: | 686 private: |
| 680 std::string GetShaderSource() const override; | |
| 681 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); | 687 DISALLOW_COPY_AND_ASSIGN(FragmentShaderColorAA); |
| 682 }; | 688 }; |
| 683 | 689 |
| 684 } // namespace cc | 690 } // namespace cc |
| 685 | 691 |
| 686 #endif // CC_OUTPUT_SHADER_H_ | 692 #endif // CC_OUTPUT_SHADER_H_ |
| OLD | NEW |