2017-10-09 17:14:24 -04:00
|
|
|
// pathfinder/shaders/gles2/xcaa-multi-resolve.fs.glsl
|
2017-08-16 19:37:39 -04:00
|
|
|
//
|
2017-10-03 18:32:03 -04:00
|
|
|
// Copyright (c) 2017 The Pathfinder Project Developers.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
2017-08-16 19:37:39 -04:00
|
|
|
|
|
|
|
precision highp float;
|
|
|
|
|
2017-10-20 19:29:05 -04:00
|
|
|
uniform ivec2 uPathColorsDimensions;
|
|
|
|
uniform sampler2D uBGFGPathID;
|
2017-08-17 23:09:18 -04:00
|
|
|
uniform sampler2D uAAAlpha;
|
2017-10-20 19:29:05 -04:00
|
|
|
uniform sampler2D uPathColors;
|
2017-08-16 19:37:39 -04:00
|
|
|
|
|
|
|
varying vec2 vTexCoord;
|
|
|
|
|
|
|
|
void main() {
|
2017-10-20 19:29:05 -04:00
|
|
|
vec4 packedPathIDsBGFG = texture2D(uBGFGPathID, vTexCoord);
|
|
|
|
int pathIDBG = unpackPathID(packedPathIDsBGFG.xy);
|
|
|
|
int pathIDFG = unpackPathID(packedPathIDsBGFG.zw);
|
|
|
|
vec4 bgColor = fetchFloat4Data(uPathColors, pathIDBG, uPathColorsDimensions);
|
|
|
|
vec4 fgColor = fetchFloat4Data(uPathColors, pathIDFG, uPathColorsDimensions);
|
2017-08-18 01:47:28 -04:00
|
|
|
float alpha = clamp(texture2D(uAAAlpha, vTexCoord).r, 0.0, 1.0);
|
2017-08-18 23:23:45 -04:00
|
|
|
gl_FragColor = mix(bgColor, fgColor, alpha);
|
2017-10-20 19:29:05 -04:00
|
|
|
//gl_FragColor = vec4(vec3(alpha), 1.0);
|
|
|
|
//gl_FragColor = bgColor != fgColor ? vec4(1.0, 0.0, 0.0, 1.0) : vec4(1.0);
|
2017-08-16 19:37:39 -04:00
|
|
|
}
|