pathfinder/shaders/gles2/direct-curve.fs.glsl

22 lines
658 B
Plaintext
Raw Normal View History

// 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;
2017-08-16 01:09:09 -04:00
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));
2017-08-16 01:09:09 -04:00
gl_FragData[0] = vec4(vColor.rgb, vColor.a * alpha);
gl_FragData[1] = vec4(vPathID, 1.0, 1.0);
}