| 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 #include "cc/output/shader.h" | 5 #include "cc/output/shader.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 void main() { | 340 void main() { |
| 341 int quad_index = int(a_index * 0.25); // NOLINT | 341 int quad_index = int(a_index * 0.25); // NOLINT |
| 342 gl_Position = matrix[quad_index] * a_position; | 342 gl_Position = matrix[quad_index] * a_position; |
| 343 TexCoordPrecision vec4 texTrans = texTransform[quad_index]; | 343 TexCoordPrecision vec4 texTrans = texTransform[quad_index]; |
| 344 v_texCoord = a_texCoord * texTrans.zw + texTrans.xy; | 344 v_texCoord = a_texCoord * texTrans.zw + texTrans.xy; |
| 345 v_alpha = opacity[int(a_index)]; // NOLINT | 345 v_alpha = opacity[int(a_index)]; // NOLINT |
| 346 } | 346 } |
| 347 }); | 347 }); |
| 348 } | 348 } |
| 349 | 349 |
| 350 void VertexShaderPosTexTransform::FillLocations( |
| 351 ShaderLocations* locations) const { |
| 352 locations->matrix = matrix_location(); |
| 353 locations->tex_transform = tex_transform_location(); |
| 354 } |
| 355 |
| 350 std::string VertexShaderPosTexIdentity::GetShaderString() const { | 356 std::string VertexShaderPosTexIdentity::GetShaderString() const { |
| 351 return VERTEX_SHADER(GetShaderHead(), GetShaderBody()); | 357 return VERTEX_SHADER(GetShaderHead(), GetShaderBody()); |
| 352 } | 358 } |
| 353 | 359 |
| 354 std::string VertexShaderPosTexIdentity::GetShaderHead() { | 360 std::string VertexShaderPosTexIdentity::GetShaderHead() { |
| 355 return SHADER0([]() { | 361 return SHADER0([]() { |
| 356 attribute vec4 a_position; | 362 attribute vec4 a_position; |
| 357 varying TexCoordPrecision vec2 v_texCoord; | 363 varying TexCoordPrecision vec2 v_texCoord; |
| 358 }); | 364 }); |
| 359 } | 365 } |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 dot(edge[2], screen_pos), dot(edge[3], screen_pos)) * | 559 dot(edge[2], screen_pos), dot(edge[3], screen_pos)) * |
| 554 gl_Position.w; | 560 gl_Position.w; |
| 555 edge_dist[1] = vec4(dot(edge[4], screen_pos), dot(edge[5], screen_pos), | 561 edge_dist[1] = vec4(dot(edge[4], screen_pos), dot(edge[5], screen_pos), |
| 556 dot(edge[6], screen_pos), dot(edge[7], screen_pos)) * | 562 dot(edge[6], screen_pos), dot(edge[7], screen_pos)) * |
| 557 gl_Position.w; | 563 gl_Position.w; |
| 558 v_texCoord = (pos.xy + vec2(0.5)) * texTrans.zw + texTrans.xy; | 564 v_texCoord = (pos.xy + vec2(0.5)) * texTrans.zw + texTrans.xy; |
| 559 } | 565 } |
| 560 }); | 566 }); |
| 561 } | 567 } |
| 562 | 568 |
| 569 void VertexShaderQuadTexTransformAA::FillLocations( |
| 570 ShaderLocations* locations) const { |
| 571 locations->quad = quad_location(); |
| 572 locations->edge = edge_location(); |
| 573 locations->viewport = viewport_location(); |
| 574 locations->matrix = matrix_location(); |
| 575 locations->tex_transform = tex_transform_location(); |
| 576 } |
| 577 |
| 578 |
| 563 VertexShaderTile::VertexShaderTile() | 579 VertexShaderTile::VertexShaderTile() |
| 564 : matrix_location_(-1), | 580 : matrix_location_(-1), |
| 565 quad_location_(-1), | 581 quad_location_(-1), |
| 566 vertex_tex_transform_location_(-1) { | 582 vertex_tex_transform_location_(-1) { |
| 567 } | 583 } |
| 568 | 584 |
| 569 void VertexShaderTile::Init(GLES2Interface* context, | 585 void VertexShaderTile::Init(GLES2Interface* context, |
| 570 unsigned program, | 586 unsigned program, |
| 571 int* base_uniform_index) { | 587 int* base_uniform_index) { |
| 572 static const char* uniforms[] = { | 588 static const char* uniforms[] = { |
| (...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1098 | 1114 |
| 1099 std::string FragmentShaderRGBATexAlpha::GetShaderBody() { | 1115 std::string FragmentShaderRGBATexAlpha::GetShaderBody() { |
| 1100 return SHADER0([]() { | 1116 return SHADER0([]() { |
| 1101 void main() { | 1117 void main() { |
| 1102 vec4 texColor = TextureLookup(s_texture, v_texCoord); | 1118 vec4 texColor = TextureLookup(s_texture, v_texCoord); |
| 1103 gl_FragColor = ApplyBlendMode(texColor * alpha); | 1119 gl_FragColor = ApplyBlendMode(texColor * alpha); |
| 1104 } | 1120 } |
| 1105 }); | 1121 }); |
| 1106 } | 1122 } |
| 1107 | 1123 |
| 1124 void FragmentShaderRGBATexAlpha::FillLocations( |
| 1125 ShaderLocations* locations) const { |
| 1126 locations->sampler = sampler_location(); |
| 1127 locations->alpha = alpha_location(); |
| 1128 locations->backdrop = backdrop_location(); |
| 1129 locations->backdrop_rect = backdrop_rect_location(); |
| 1130 } |
| 1131 |
| 1108 std::string FragmentShaderRGBATexColorMatrixAlpha::GetShaderString( | 1132 std::string FragmentShaderRGBATexColorMatrixAlpha::GetShaderString( |
| 1109 TexCoordPrecision precision, | 1133 TexCoordPrecision precision, |
| 1110 SamplerType sampler) const { | 1134 SamplerType sampler) const { |
| 1111 return FRAGMENT_SHADER(GetShaderHead(), GetShaderBody()); | 1135 return FRAGMENT_SHADER(GetShaderHead(), GetShaderBody()); |
| 1112 } | 1136 } |
| 1113 | 1137 |
| 1114 std::string FragmentShaderRGBATexColorMatrixAlpha::GetShaderHead() { | 1138 std::string FragmentShaderRGBATexColorMatrixAlpha::GetShaderHead() { |
| 1115 return SHADER0([]() { | 1139 return SHADER0([]() { |
| 1116 precision mediump float; | 1140 precision mediump float; |
| 1117 varying TexCoordPrecision vec2 v_texCoord; | 1141 varying TexCoordPrecision vec2 v_texCoord; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 1129 float nonZeroAlpha = max(texColor.a, 0.00001); | 1153 float nonZeroAlpha = max(texColor.a, 0.00001); |
| 1130 texColor = vec4(texColor.rgb / nonZeroAlpha, nonZeroAlpha); | 1154 texColor = vec4(texColor.rgb / nonZeroAlpha, nonZeroAlpha); |
| 1131 texColor = colorMatrix * texColor + colorOffset; | 1155 texColor = colorMatrix * texColor + colorOffset; |
| 1132 texColor.rgb *= texColor.a; | 1156 texColor.rgb *= texColor.a; |
| 1133 texColor = clamp(texColor, 0.0, 1.0); | 1157 texColor = clamp(texColor, 0.0, 1.0); |
| 1134 gl_FragColor = ApplyBlendMode(texColor * alpha); | 1158 gl_FragColor = ApplyBlendMode(texColor * alpha); |
| 1135 } | 1159 } |
| 1136 }); | 1160 }); |
| 1137 } | 1161 } |
| 1138 | 1162 |
| 1163 void FragmentShaderRGBATexColorMatrixAlpha::FillLocations( |
| 1164 ShaderLocations* locations) const { |
| 1165 locations->sampler = sampler_location(); |
| 1166 locations->alpha = alpha_location(); |
| 1167 locations->color_matrix = color_matrix_location(); |
| 1168 locations->color_offset = color_offset_location(); |
| 1169 locations->backdrop = backdrop_location(); |
| 1170 locations->backdrop_rect = backdrop_rect_location(); |
| 1171 } |
| 1172 |
| 1139 std::string FragmentShaderRGBATexVaryingAlpha::GetShaderString( | 1173 std::string FragmentShaderRGBATexVaryingAlpha::GetShaderString( |
| 1140 TexCoordPrecision precision, | 1174 TexCoordPrecision precision, |
| 1141 SamplerType sampler) const { | 1175 SamplerType sampler) const { |
| 1142 return FRAGMENT_SHADER(GetShaderHead(), GetShaderBody()); | 1176 return FRAGMENT_SHADER(GetShaderHead(), GetShaderBody()); |
| 1143 } | 1177 } |
| 1144 | 1178 |
| 1145 std::string FragmentShaderRGBATexVaryingAlpha::GetShaderHead() { | 1179 std::string FragmentShaderRGBATexVaryingAlpha::GetShaderHead() { |
| 1146 return SHADER0([]() { | 1180 return SHADER0([]() { |
| 1147 precision mediump float; | 1181 precision mediump float; |
| 1148 varying TexCoordPrecision vec2 v_texCoord; | 1182 varying TexCoordPrecision vec2 v_texCoord; |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1398 void main() { | 1432 void main() { |
| 1399 vec4 texColor = TextureLookup(s_texture, v_texCoord); | 1433 vec4 texColor = TextureLookup(s_texture, v_texCoord); |
| 1400 vec4 d4 = min(edge_dist[0], edge_dist[1]); | 1434 vec4 d4 = min(edge_dist[0], edge_dist[1]); |
| 1401 vec2 d2 = min(d4.xz, d4.yw); | 1435 vec2 d2 = min(d4.xz, d4.yw); |
| 1402 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); | 1436 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); |
| 1403 gl_FragColor = ApplyBlendMode(texColor * alpha * aa); | 1437 gl_FragColor = ApplyBlendMode(texColor * alpha * aa); |
| 1404 } | 1438 } |
| 1405 }); | 1439 }); |
| 1406 } | 1440 } |
| 1407 | 1441 |
| 1442 void FragmentShaderRGBATexAlphaAA::FillLocations( |
| 1443 ShaderLocations* locations) const { |
| 1444 locations->sampler = sampler_location(); |
| 1445 locations->alpha = alpha_location(); |
| 1446 locations->backdrop = backdrop_location(); |
| 1447 locations->backdrop_rect = backdrop_rect_location(); |
| 1448 } |
| 1449 |
| 1408 FragmentTexClampAlphaAABinding::FragmentTexClampAlphaAABinding() | 1450 FragmentTexClampAlphaAABinding::FragmentTexClampAlphaAABinding() |
| 1409 : sampler_location_(-1), | 1451 : sampler_location_(-1), |
| 1410 alpha_location_(-1), | 1452 alpha_location_(-1), |
| 1411 fragment_tex_transform_location_(-1) { | 1453 fragment_tex_transform_location_(-1) { |
| 1412 } | 1454 } |
| 1413 | 1455 |
| 1414 void FragmentTexClampAlphaAABinding::Init(GLES2Interface* context, | 1456 void FragmentTexClampAlphaAABinding::Init(GLES2Interface* context, |
| 1415 unsigned program, | 1457 unsigned program, |
| 1416 int* base_uniform_index) { | 1458 int* base_uniform_index) { |
| 1417 static const char* uniforms[] = { | 1459 static const char* uniforms[] = { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 vec4 texColor = texture2D(s_texture, v_texCoord); | 1595 vec4 texColor = texture2D(s_texture, v_texCoord); |
| 1554 TexCoordPrecision vec2 maskTexCoord = | 1596 TexCoordPrecision vec2 maskTexCoord = |
| 1555 vec2(maskTexCoordOffset.x + v_texCoord.x * maskTexCoordScale.x, | 1597 vec2(maskTexCoordOffset.x + v_texCoord.x * maskTexCoordScale.x, |
| 1556 maskTexCoordOffset.y + v_texCoord.y * maskTexCoordScale.y); | 1598 maskTexCoordOffset.y + v_texCoord.y * maskTexCoordScale.y); |
| 1557 vec4 maskColor = TextureLookup(s_mask, maskTexCoord); | 1599 vec4 maskColor = TextureLookup(s_mask, maskTexCoord); |
| 1558 gl_FragColor = ApplyBlendMode(texColor * alpha * maskColor.w); | 1600 gl_FragColor = ApplyBlendMode(texColor * alpha * maskColor.w); |
| 1559 } | 1601 } |
| 1560 }); | 1602 }); |
| 1561 } | 1603 } |
| 1562 | 1604 |
| 1605 void FragmentShaderRGBATexAlphaMask::FillLocations( |
| 1606 ShaderLocations* locations) const { |
| 1607 locations->sampler = sampler_location(); |
| 1608 locations->mask_sampler = mask_sampler_location(); |
| 1609 locations->mask_tex_coord_scale = mask_tex_coord_scale_location(); |
| 1610 locations->mask_tex_coord_offset = mask_tex_coord_offset_location(); |
| 1611 locations->alpha = alpha_location(); |
| 1612 locations->backdrop = backdrop_location(); |
| 1613 locations->backdrop_rect = backdrop_rect_location(); |
| 1614 } |
| 1615 |
| 1563 FragmentShaderRGBATexAlphaMaskAA::FragmentShaderRGBATexAlphaMaskAA() | 1616 FragmentShaderRGBATexAlphaMaskAA::FragmentShaderRGBATexAlphaMaskAA() |
| 1564 : sampler_location_(-1), | 1617 : sampler_location_(-1), |
| 1565 mask_sampler_location_(-1), | 1618 mask_sampler_location_(-1), |
| 1566 alpha_location_(-1), | 1619 alpha_location_(-1), |
| 1567 mask_tex_coord_scale_location_(-1), | 1620 mask_tex_coord_scale_location_(-1), |
| 1568 mask_tex_coord_offset_location_(-1) { | 1621 mask_tex_coord_offset_location_(-1) { |
| 1569 } | 1622 } |
| 1570 | 1623 |
| 1571 void FragmentShaderRGBATexAlphaMaskAA::Init(GLES2Interface* context, | 1624 void FragmentShaderRGBATexAlphaMaskAA::Init(GLES2Interface* context, |
| 1572 unsigned program, | 1625 unsigned program, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1623 maskTexCoordOffset.y + v_texCoord.y * maskTexCoordScale.y); | 1676 maskTexCoordOffset.y + v_texCoord.y * maskTexCoordScale.y); |
| 1624 vec4 maskColor = TextureLookup(s_mask, maskTexCoord); | 1677 vec4 maskColor = TextureLookup(s_mask, maskTexCoord); |
| 1625 vec4 d4 = min(edge_dist[0], edge_dist[1]); | 1678 vec4 d4 = min(edge_dist[0], edge_dist[1]); |
| 1626 vec2 d2 = min(d4.xz, d4.yw); | 1679 vec2 d2 = min(d4.xz, d4.yw); |
| 1627 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); | 1680 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); |
| 1628 gl_FragColor = ApplyBlendMode(texColor * alpha * maskColor.w * aa); | 1681 gl_FragColor = ApplyBlendMode(texColor * alpha * maskColor.w * aa); |
| 1629 } | 1682 } |
| 1630 }); | 1683 }); |
| 1631 } | 1684 } |
| 1632 | 1685 |
| 1686 void FragmentShaderRGBATexAlphaMaskAA::FillLocations( |
| 1687 ShaderLocations* locations) const { |
| 1688 locations->sampler = sampler_location(); |
| 1689 locations->mask_sampler = mask_sampler_location(); |
| 1690 locations->mask_tex_coord_scale = mask_tex_coord_scale_location(); |
| 1691 locations->mask_tex_coord_offset = mask_tex_coord_offset_location(); |
| 1692 locations->alpha = alpha_location(); |
| 1693 locations->backdrop = backdrop_location(); |
| 1694 locations->backdrop_rect = backdrop_rect_location(); |
| 1695 } |
| 1696 |
| 1633 FragmentShaderRGBATexAlphaMaskColorMatrixAA:: | 1697 FragmentShaderRGBATexAlphaMaskColorMatrixAA:: |
| 1634 FragmentShaderRGBATexAlphaMaskColorMatrixAA() | 1698 FragmentShaderRGBATexAlphaMaskColorMatrixAA() |
| 1635 : sampler_location_(-1), | 1699 : sampler_location_(-1), |
| 1636 mask_sampler_location_(-1), | 1700 mask_sampler_location_(-1), |
| 1637 alpha_location_(-1), | 1701 alpha_location_(-1), |
| 1638 mask_tex_coord_scale_location_(-1), | 1702 mask_tex_coord_scale_location_(-1), |
| 1639 color_matrix_location_(-1), | 1703 color_matrix_location_(-1), |
| 1640 color_offset_location_(-1) { | 1704 color_offset_location_(-1) { |
| 1641 } | 1705 } |
| 1642 | 1706 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1707 maskTexCoordOffset.y + v_texCoord.y * maskTexCoordScale.y); | 1771 maskTexCoordOffset.y + v_texCoord.y * maskTexCoordScale.y); |
| 1708 vec4 maskColor = TextureLookup(s_mask, maskTexCoord); | 1772 vec4 maskColor = TextureLookup(s_mask, maskTexCoord); |
| 1709 vec4 d4 = min(edge_dist[0], edge_dist[1]); | 1773 vec4 d4 = min(edge_dist[0], edge_dist[1]); |
| 1710 vec2 d2 = min(d4.xz, d4.yw); | 1774 vec2 d2 = min(d4.xz, d4.yw); |
| 1711 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); | 1775 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); |
| 1712 gl_FragColor = ApplyBlendMode(texColor * alpha * maskColor.w * aa); | 1776 gl_FragColor = ApplyBlendMode(texColor * alpha * maskColor.w * aa); |
| 1713 } | 1777 } |
| 1714 }); | 1778 }); |
| 1715 } | 1779 } |
| 1716 | 1780 |
| 1781 void FragmentShaderRGBATexAlphaMaskColorMatrixAA::FillLocations( |
| 1782 ShaderLocations* locations) const { |
| 1783 locations->sampler = sampler_location(); |
| 1784 locations->alpha = alpha_location(); |
| 1785 locations->mask_sampler = mask_sampler_location(); |
| 1786 locations->mask_tex_coord_scale = mask_tex_coord_scale_location(); |
| 1787 locations->mask_tex_coord_offset = mask_tex_coord_offset_location(); |
| 1788 locations->color_matrix = color_matrix_location(); |
| 1789 locations->color_offset = color_offset_location(); |
| 1790 locations->backdrop = backdrop_location(); |
| 1791 locations->backdrop_rect = backdrop_rect_location(); |
| 1792 } |
| 1793 |
| 1717 FragmentShaderRGBATexAlphaColorMatrixAA:: | 1794 FragmentShaderRGBATexAlphaColorMatrixAA:: |
| 1718 FragmentShaderRGBATexAlphaColorMatrixAA() | 1795 FragmentShaderRGBATexAlphaColorMatrixAA() |
| 1719 : sampler_location_(-1), | 1796 : sampler_location_(-1), |
| 1720 alpha_location_(-1), | 1797 alpha_location_(-1), |
| 1721 color_matrix_location_(-1), | 1798 color_matrix_location_(-1), |
| 1722 color_offset_location_(-1) { | 1799 color_offset_location_(-1) { |
| 1723 } | 1800 } |
| 1724 | 1801 |
| 1725 void FragmentShaderRGBATexAlphaColorMatrixAA::Init(GLES2Interface* context, | 1802 void FragmentShaderRGBATexAlphaColorMatrixAA::Init(GLES2Interface* context, |
| 1726 unsigned program, | 1803 unsigned program, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1771 texColor.rgb *= texColor.a; | 1848 texColor.rgb *= texColor.a; |
| 1772 texColor = clamp(texColor, 0.0, 1.0); | 1849 texColor = clamp(texColor, 0.0, 1.0); |
| 1773 vec4 d4 = min(edge_dist[0], edge_dist[1]); | 1850 vec4 d4 = min(edge_dist[0], edge_dist[1]); |
| 1774 vec2 d2 = min(d4.xz, d4.yw); | 1851 vec2 d2 = min(d4.xz, d4.yw); |
| 1775 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); | 1852 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); |
| 1776 gl_FragColor = ApplyBlendMode(texColor * alpha * aa); | 1853 gl_FragColor = ApplyBlendMode(texColor * alpha * aa); |
| 1777 } | 1854 } |
| 1778 }); | 1855 }); |
| 1779 } | 1856 } |
| 1780 | 1857 |
| 1858 void FragmentShaderRGBATexAlphaColorMatrixAA::FillLocations( |
| 1859 ShaderLocations* locations) const { |
| 1860 locations->sampler = sampler_location(); |
| 1861 locations->alpha = alpha_location(); |
| 1862 locations->color_matrix = color_matrix_location(); |
| 1863 locations->color_offset = color_offset_location(); |
| 1864 locations->backdrop = backdrop_location(); |
| 1865 locations->backdrop_rect = backdrop_rect_location(); |
| 1866 } |
| 1867 |
| 1781 FragmentShaderRGBATexAlphaMaskColorMatrix:: | 1868 FragmentShaderRGBATexAlphaMaskColorMatrix:: |
| 1782 FragmentShaderRGBATexAlphaMaskColorMatrix() | 1869 FragmentShaderRGBATexAlphaMaskColorMatrix() |
| 1783 : sampler_location_(-1), | 1870 : sampler_location_(-1), |
| 1784 mask_sampler_location_(-1), | 1871 mask_sampler_location_(-1), |
| 1785 alpha_location_(-1), | 1872 alpha_location_(-1), |
| 1786 mask_tex_coord_scale_location_(-1) { | 1873 mask_tex_coord_scale_location_(-1) { |
| 1787 } | 1874 } |
| 1788 | 1875 |
| 1789 void FragmentShaderRGBATexAlphaMaskColorMatrix::Init(GLES2Interface* context, | 1876 void FragmentShaderRGBATexAlphaMaskColorMatrix::Init(GLES2Interface* context, |
| 1790 unsigned program, | 1877 unsigned program, |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1848 texColor = clamp(texColor, 0.0, 1.0); | 1935 texColor = clamp(texColor, 0.0, 1.0); |
| 1849 TexCoordPrecision vec2 maskTexCoord = | 1936 TexCoordPrecision vec2 maskTexCoord = |
| 1850 vec2(maskTexCoordOffset.x + v_texCoord.x * maskTexCoordScale.x, | 1937 vec2(maskTexCoordOffset.x + v_texCoord.x * maskTexCoordScale.x, |
| 1851 maskTexCoordOffset.y + v_texCoord.y * maskTexCoordScale.y); | 1938 maskTexCoordOffset.y + v_texCoord.y * maskTexCoordScale.y); |
| 1852 vec4 maskColor = TextureLookup(s_mask, maskTexCoord); | 1939 vec4 maskColor = TextureLookup(s_mask, maskTexCoord); |
| 1853 gl_FragColor = ApplyBlendMode(texColor * alpha * maskColor.w); | 1940 gl_FragColor = ApplyBlendMode(texColor * alpha * maskColor.w); |
| 1854 } | 1941 } |
| 1855 }); | 1942 }); |
| 1856 } | 1943 } |
| 1857 | 1944 |
| 1945 void FragmentShaderRGBATexAlphaMaskColorMatrix::FillLocations( |
| 1946 ShaderLocations* locations) const { |
| 1947 locations->sampler = sampler_location(); |
| 1948 locations->mask_sampler = mask_sampler_location(); |
| 1949 locations->mask_tex_coord_scale = mask_tex_coord_scale_location(); |
| 1950 locations->mask_tex_coord_offset = mask_tex_coord_offset_location(); |
| 1951 locations->alpha = alpha_location(); |
| 1952 locations->color_matrix = color_matrix_location(); |
| 1953 locations->color_offset = color_offset_location(); |
| 1954 locations->backdrop = backdrop_location(); |
| 1955 locations->backdrop_rect = backdrop_rect_location(); |
| 1956 } |
| 1957 |
| 1858 FragmentShaderYUVVideo::FragmentShaderYUVVideo() | 1958 FragmentShaderYUVVideo::FragmentShaderYUVVideo() |
| 1859 : y_texture_location_(-1), | 1959 : y_texture_location_(-1), |
| 1860 u_texture_location_(-1), | 1960 u_texture_location_(-1), |
| 1861 v_texture_location_(-1), | 1961 v_texture_location_(-1), |
| 1862 alpha_location_(-1), | 1962 alpha_location_(-1), |
| 1863 yuv_matrix_location_(-1), | 1963 yuv_matrix_location_(-1), |
| 1864 yuv_adj_location_(-1), | 1964 yuv_adj_location_(-1), |
| 1865 clamp_rect_location_(-1) { | 1965 clamp_rect_location_(-1) { |
| 1866 } | 1966 } |
| 1867 | 1967 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2140 vec2 texCoord = | 2240 vec2 texCoord = |
| 2141 clamp(v_texCoord, 0.0, 1.0) * texTransform.zw + texTransform.xy; | 2241 clamp(v_texCoord, 0.0, 1.0) * texTransform.zw + texTransform.xy; |
| 2142 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0); | 2242 vec2 coord = mod(floor(texCoord * frequency * 2.0), 2.0); |
| 2143 float picker = abs(coord.x - coord.y); // NOLINT | 2243 float picker = abs(coord.x - coord.y); // NOLINT |
| 2144 gl_FragColor = mix(color1, color2, picker) * alpha; | 2244 gl_FragColor = mix(color1, color2, picker) * alpha; |
| 2145 } | 2245 } |
| 2146 }); | 2246 }); |
| 2147 } | 2247 } |
| 2148 | 2248 |
| 2149 } // namespace cc | 2249 } // namespace cc |
| OLD | NEW |