| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 | 10 |
| (...skipping 2131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2142 // Compress the yz coordinates so they stay within | 2142 // Compress the yz coordinates so they stay within |
| 2143 // [0.5 .. 31.5] / 32 (assuming a LUT size of 32^3) | 2143 // [0.5 .. 31.5] / 32 (assuming a LUT size of 32^3) |
| 2144 pos.yz = (pos.yz + vec2(0.5)) / size; | 2144 pos.yz = (pos.yz + vec2(0.5)) / size; |
| 2145 pos.z = (pos.z + layer) / size; | 2145 pos.z = (pos.z + layer) / size; |
| 2146 return mix(texture2D(sampler, pos.yz), | 2146 return mix(texture2D(sampler, pos.yz), |
| 2147 texture2D(sampler, pos.yz + vec2(0, 1.0 / size)), | 2147 texture2D(sampler, pos.yz + vec2(0, 1.0 / size)), |
| 2148 pos.x - layer); | 2148 pos.x - layer); |
| 2149 } | 2149 } |
| 2150 | 2150 |
| 2151 vec3 yuv2rgb(vec3 yuv) { | 2151 vec3 yuv2rgb(vec3 yuv) { |
| 2152 yuv = yuv * resource_multiplier - vec3(resource_offset); | 2152 yuv = (yuv - vec3(resource_offset)) * resource_multiplier; |
| 2153 return LUT(lut_texture, yuv, 32.0).xyz; | 2153 return LUT(lut_texture, yuv, 32.0).xyz; |
| 2154 } | 2154 } |
| 2155 }); | 2155 }); |
| 2156 } else { | 2156 } else { |
| 2157 head += " uniform mat3 yuv_matrix;\n"; | 2157 head += " uniform mat3 yuv_matrix;\n"; |
| 2158 head += " uniform vec3 yuv_adj;\n"; | 2158 head += " uniform vec3 yuv_adj;\n"; |
| 2159 functions += SHADER0([]() { | 2159 functions += SHADER0([]() { |
| 2160 vec3 yuv2rgb(vec3 yuv) { return yuv_matrix * (yuv + yuv_adj); } | 2160 vec3 yuv2rgb(vec3 yuv) { return yuv_matrix * (yuv + yuv_adj); } |
| 2161 }); | 2161 }); |
| 2162 } | 2162 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2252 void main() { | 2252 void main() { |
| 2253 vec4 d4 = min(edge_dist[0], edge_dist[1]); | 2253 vec4 d4 = min(edge_dist[0], edge_dist[1]); |
| 2254 vec2 d2 = min(d4.xz, d4.yw); | 2254 vec2 d2 = min(d4.xz, d4.yw); |
| 2255 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); | 2255 float aa = clamp(gl_FragCoord.w * min(d2.x, d2.y), 0.0, 1.0); |
| 2256 gl_FragColor = color * aa; | 2256 gl_FragColor = color * aa; |
| 2257 } | 2257 } |
| 2258 }); | 2258 }); |
| 2259 } | 2259 } |
| 2260 | 2260 |
| 2261 } // namespace cc | 2261 } // namespace cc |
| OLD | NEW |