Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(64)

Side by Side Diff: cc/output/shader.cc

Issue 2237003007: hi10p+LUT bugfix (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698