22 lines
660 B
GLSL
22 lines
660 B
GLSL
// pathfinder/shaders/gles2/direct-curve.fs.glsl
|
|
//
|
|
// Copyright (c) 2017 Mozilla Foundation
|
|
|
|
// This shader implements the quadratic Loop-Blinn formulation without writing precise depth.
|
|
// It is therefore unsuitable for ECAA, but it's fast (specifically, preserving early Z) and
|
|
// compatible with OpenGL ES 2.0.
|
|
|
|
precision highp float;
|
|
|
|
varying vec4 vColor;
|
|
varying vec2 vPathID;
|
|
varying vec2 vTexCoord;
|
|
varying float vSign;
|
|
|
|
void main() {
|
|
float side = vTexCoord.x * vTexCoord.x - vTexCoord.y;
|
|
float alpha = float(sign(side) == sign(vSign));
|
|
gl_FragData[0] = vec4(vColor.rgb, vColor.a * alpha);
|
|
gl_FragData[1] = vec4(vPathID, 0.0, alpha);
|
|
}
|