Provide brief documentation of each shader
This commit is contained in:
parent
a81c69c34e
commit
017a2e2f8c
|
@ -355,6 +355,7 @@ bool splitCurveAndComputeECAAWinding(out float outWinding,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns true if the slope of the line along the given vector is negative.
|
||||||
bool slopeIsNegative(vec2 dp) {
|
bool slopeIsNegative(vec2 dp) {
|
||||||
return dp.y < 0.0;
|
return dp.y < 0.0;
|
||||||
}
|
}
|
||||||
|
@ -451,11 +452,11 @@ bool isPartiallyCovered(vec2 p0X, vec2 dPX, float pixelCenterY) {
|
||||||
return !isNearZero(dP.x) || !isNearZero(dP.y);
|
return !isNearZero(dP.x) || !isNearZero(dP.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Solve the equation:
|
/// Solves the equation:
|
||||||
//
|
///
|
||||||
// x = p0x + t^2 * (p0x - 2*p1x + p2x) + t*(2*p1x - 2*p0x)
|
/// x = p0x + t^2 * (p0x - 2*p1x + p2x) + t*(2*p1x - 2*p0x)
|
||||||
//
|
///
|
||||||
// We use the Citardauq Formula to avoid floating point precision issues.
|
/// We use the Citardauq Formula to avoid floating point precision issues.
|
||||||
vec2 solveCurveT(float p0x, float p1x, float p2x, vec2 x) {
|
vec2 solveCurveT(float p0x, float p1x, float p2x, vec2 x) {
|
||||||
float a = p0x - 2.0 * p1x + p2x;
|
float a = p0x - 2.0 * p1x + p2x;
|
||||||
float b = 2.0 * p1x - 2.0 * p0x;
|
float b = 2.0 * p1x - 2.0 * p0x;
|
||||||
|
@ -463,14 +464,11 @@ vec2 solveCurveT(float p0x, float p1x, float p2x, vec2 x) {
|
||||||
return 2.0 * c / (-b - sqrt(b * b - 4.0 * a * c));
|
return 2.0 * c / (-b - sqrt(b * b - 4.0 * a * c));
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 solveCurveT1(float p0x, float p1x, float p2x, vec2 x) {
|
/// Applies a slight horizontal blur to reduce color fringing on LCD screens
|
||||||
float a = p0x - 2.0 * p1x + p2x;
|
/// when performing subpixel AA.
|
||||||
float b = 2.0 * p1x - 2.0 * p0x;
|
///
|
||||||
vec2 c = p0x - x;
|
/// The algorithm should be identical to that of FreeType:
|
||||||
return (-b + sqrt(b * b - 4.0 * a * c)) / (2.0 * a);
|
/// https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html
|
||||||
}
|
|
||||||
|
|
||||||
// https://www.freetype.org/freetype2/docs/reference/ft2-lcd_filtering.html
|
|
||||||
float lcdFilter(float shadeL2, float shadeL1, float shade0, float shadeR1, float shadeR2) {
|
float lcdFilter(float shadeL2, float shadeL1, float shade0, float shadeR1, float shadeR2) {
|
||||||
return LCD_FILTER_FACTOR_2 * shadeL2 +
|
return LCD_FILTER_FACTOR_2 * shadeL2 +
|
||||||
LCD_FILTER_FACTOR_1 * shadeL1 +
|
LCD_FILTER_FACTOR_1 * shadeL1 +
|
||||||
|
@ -517,11 +515,3 @@ vec4 fetchPathAffineTransform(out vec2 outPathTransformExt,
|
||||||
pathTransformExtDimensions);
|
pathTransformExtDimensions);
|
||||||
return fetchFloat4Data(pathTransformSTTexture, pathID, pathTransformSTDimensions);
|
return fetchFloat4Data(pathTransformSTTexture, pathID, pathTransformSTDimensions);
|
||||||
}
|
}
|
||||||
|
|
||||||
vec2 packPathID(int pathID) {
|
|
||||||
return vec2(imod(pathID, 256), pathID / 256) / 255.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int unpackPathID(vec2 packedPathID) {
|
|
||||||
return unpackUInt16(packedPathID);
|
|
||||||
}
|
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders cached textures of distant glyphs in the 3D demo.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform vec4 uColor;
|
uniform vec4 uColor;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders cached textures of distant glyphs in the 3D demo.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform mat4 uTransform;
|
uniform mat4 uTransform;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders the monument surface in the 3D demo.
|
||||||
|
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
uniform vec3 uLightPosition;
|
uniform vec3 uLightPosition;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders the monument surface in the 3D demo.
|
||||||
|
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
uniform mat4 uProjection;
|
uniform mat4 uProjection;
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! A version of `direct-curve` that takes each vertex's Z value from the
|
||||||
|
//! transform instead of the path ID.
|
||||||
|
//!
|
||||||
|
//! FIXME(pcwalton): For CSS 3D transforms, I think `direct-curve` will need
|
||||||
|
//! to do what this shader does. Perhaps these two shaders should be unified…
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform mat4 uTransform;
|
uniform mat4 uTransform;
|
||||||
|
@ -26,7 +32,6 @@ attribute float aSign;
|
||||||
attribute float aNormalAngle;
|
attribute float aNormalAngle;
|
||||||
|
|
||||||
varying vec4 vColor;
|
varying vec4 vColor;
|
||||||
varying vec2 vPathID;
|
|
||||||
varying vec2 vTexCoord;
|
varying vec2 vTexCoord;
|
||||||
varying float vSign;
|
varying float vSign;
|
||||||
|
|
||||||
|
@ -47,7 +52,6 @@ void main() {
|
||||||
gl_Position = uTransform * vec4(position, 0.0, 1.0);
|
gl_Position = uTransform * vec4(position, 0.0, 1.0);
|
||||||
|
|
||||||
vColor = fetchFloat4Data(uPathColors, pathID, uPathColorsDimensions);
|
vColor = fetchFloat4Data(uPathColors, pathID, uPathColorsDimensions);
|
||||||
vPathID = packPathID(pathID);
|
|
||||||
vTexCoord = vec2(aTexCoord) / 2.0;
|
vTexCoord = vec2(aTexCoord) / 2.0;
|
||||||
vSign = aSign;
|
vSign = aSign;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! A version of `direct-interior` that takes each vertex's Z value from the
|
||||||
|
//! transform instead of the path ID.
|
||||||
|
//!
|
||||||
|
//! FIXME(pcwalton): For CSS 3D transforms, I think `direct-interior` will need
|
||||||
|
//! to do what this shader does. Perhaps these two shaders should be unified…
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform mat4 uTransform;
|
uniform mat4 uTransform;
|
||||||
|
@ -24,7 +30,6 @@ attribute float aPathID;
|
||||||
attribute float aNormalAngle;
|
attribute float aNormalAngle;
|
||||||
|
|
||||||
varying vec4 vColor;
|
varying vec4 vColor;
|
||||||
varying vec2 vPathID;
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
int pathID = int(aPathID);
|
int pathID = int(aPathID);
|
||||||
|
@ -43,5 +48,4 @@ void main() {
|
||||||
gl_Position = uTransform * vec4(position, 0.0, 1.0);
|
gl_Position = uTransform * vec4(position, 0.0, 1.0);
|
||||||
|
|
||||||
vColor = fetchFloat4Data(uPathColors, pathID, uPathColorsDimensions);
|
vColor = fetchFloat4Data(uPathColors, pathID, uPathColorsDimensions);
|
||||||
vPathID = packPathID(pathID);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,16 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
// This shader implements the quadratic Loop-Blinn formulation.
|
//! Implements the quadratic Loop-Blinn formulation to render curved parts of
|
||||||
|
//! the mesh.
|
||||||
|
//!
|
||||||
|
//! This shader performs no antialiasing; if you want antialiased output from
|
||||||
|
//! this shader, use MSAA with sample-level shading (GL 4.x) or else perform
|
||||||
|
//! SSAA by rendering to a higher-resolution framebuffer and downsampling (GL
|
||||||
|
//! 3.x and below).
|
||||||
|
//!
|
||||||
|
//! If you know your mesh has no curves (i.e. it consists solely of polygons),
|
||||||
|
//! then you don't need to run this shader.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,17 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Implements the quadratic Loop-Blinn formulation to render curved parts of
|
||||||
|
//! the mesh.
|
||||||
|
//!
|
||||||
|
//! This shader performs no antialiasing; if you want antialiased output from
|
||||||
|
//! this shader, use MSAA with sample-level shading (GL 4.x) or else perform
|
||||||
|
//! SSAA by rendering to a higher-resolution framebuffer and downsampling (GL
|
||||||
|
//! 3.x and below).
|
||||||
|
//!
|
||||||
|
//! If you know your mesh has no curves (i.e. it consists solely of polygons),
|
||||||
|
//! then you don't need to run this shader.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform mat4 uTransform;
|
uniform mat4 uTransform;
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders polygonal portions of a mesh.
|
||||||
|
//!
|
||||||
|
//! Typically, you will run this shader before running `direct-curve`.
|
||||||
|
//! Remember to enable the depth test with a `GREATER` depth function for optimal
|
||||||
|
//! performance.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
varying vec4 vColor;
|
varying vec4 vColor;
|
||||||
|
|
|
@ -8,6 +8,12 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders polygonal portions of a mesh.
|
||||||
|
//!
|
||||||
|
//! Typically, you will run this shader before running `direct-curve`.
|
||||||
|
//! Remember to enable the depth test with a `GREATER` depth function for optimal
|
||||||
|
//! performance.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform mat4 uTransform;
|
uniform mat4 uTransform;
|
||||||
|
|
|
@ -8,6 +8,22 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Implements *edge coverage antialiasing* (ECAA) for curved path segments.
|
||||||
|
//!
|
||||||
|
//! This shader expects to render to the red channel of a floating point color
|
||||||
|
//! buffer. Half precision floating point should be sufficient.
|
||||||
|
//!
|
||||||
|
//! Use this shader only when *all* of the following are true:
|
||||||
|
//!
|
||||||
|
//! 1. You are only rendering monochrome paths such as text. (Otherwise,
|
||||||
|
//! consider `mcaa-multi`.)
|
||||||
|
//!
|
||||||
|
//! 2. The paths are relatively small, so overdraw is not a concern.
|
||||||
|
//! (Otherwise, consider the MCAA shaders.)
|
||||||
|
//!
|
||||||
|
//! 3. Your transform is only a scale and/or translation, not a perspective,
|
||||||
|
//! rotation, or skew. (Otherwise, consider `ecaa-transformed-curve`.)
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform mat4 uTransform;
|
uniform mat4 uTransform;
|
||||||
|
|
|
@ -8,6 +8,20 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Implements *edge coverage antialiasing* (ECAA) for straight-line path
|
||||||
|
//! segments.
|
||||||
|
//!
|
||||||
|
//! This shader expects to render to the red channel of a floating point color
|
||||||
|
//! buffer. Half precision floating point should be sufficient.
|
||||||
|
//!
|
||||||
|
//! Use this shader only when *both* of the following are true:
|
||||||
|
//!
|
||||||
|
//! 1. You are only rendering monochrome paths such as text. (Otherwise,
|
||||||
|
//! consider `mcaa-multi`.)
|
||||||
|
//!
|
||||||
|
//! 2. The paths are relatively small, so overdraw is not a concern.
|
||||||
|
//! (Otherwise, consider the MCAA shaders.)
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform mat4 uTransform;
|
uniform mat4 uTransform;
|
||||||
|
|
|
@ -8,6 +8,26 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Implements *edge coverage antialiasing* (ECAA) for curved path segments,
|
||||||
|
//! performing splitting as necessary.
|
||||||
|
//!
|
||||||
|
//! This shader expects to render to the red channel of a floating point color
|
||||||
|
//! buffer. Half precision floating point should be sufficient.
|
||||||
|
//!
|
||||||
|
//! This is a two-pass shader. It must be run twice, first with `uPassIndex`
|
||||||
|
//! equal to 0, and then with `uPassIndex` equal to 1.
|
||||||
|
//!
|
||||||
|
//! Use this shader only when *all* of the following are true:
|
||||||
|
//!
|
||||||
|
//! 1. You are only rendering monochrome paths such as text. (Otherwise,
|
||||||
|
//! consider `mcaa-multi`.)
|
||||||
|
//!
|
||||||
|
//! 2. The paths are relatively small, so overdraw is not a concern.
|
||||||
|
//! (Otherwise, consider the MCAA shaders.)
|
||||||
|
//!
|
||||||
|
//! 3. Your transform contains perspective, rotation, or skew. (Otherwise,
|
||||||
|
//! consider `ecaa-curve`, which is faster and saves a pass.)
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform mat4 uTransform;
|
uniform mat4 uTransform;
|
||||||
|
|
|
@ -8,6 +8,20 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Performs the conservative coverage step for *mesh coverage antialiasing*
|
||||||
|
//! (MCAA).
|
||||||
|
//!
|
||||||
|
//! This shader expects to render to the red channel of a floating point color
|
||||||
|
//! buffer. Half precision floating point should be sufficient.
|
||||||
|
//!
|
||||||
|
//! Use this shader only when *both* of the following are true:
|
||||||
|
//!
|
||||||
|
//! 1. You are only rendering monochrome paths such as text. (Otherwise,
|
||||||
|
//! consider `mcaa-multi`.)
|
||||||
|
//!
|
||||||
|
//! 2. Your transform is only a scale and/or translation, not a perspective,
|
||||||
|
//! rotation, or skew. (Otherwise, consider the ECAA shaders.)
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
varying vec2 vHorizontalExtents;
|
varying vec2 vHorizontalExtents;
|
||||||
|
|
|
@ -8,6 +8,20 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Performs the conservative coverage step for *mesh coverage antialiasing*
|
||||||
|
//! (MCAA).
|
||||||
|
//!
|
||||||
|
//! This shader expects to render to the red channel of a floating point color
|
||||||
|
//! buffer. Half precision floating point should be sufficient.
|
||||||
|
//!
|
||||||
|
//! Use this shader only when *both* of the following are true:
|
||||||
|
//!
|
||||||
|
//! 1. You are only rendering monochrome paths such as text. (Otherwise,
|
||||||
|
//! consider `mcaa-multi`.)
|
||||||
|
//!
|
||||||
|
//! 2. Your transform is only a scale and/or translation, not a perspective,
|
||||||
|
//! rotation, or skew. (Otherwise, consider the ECAA shaders.)
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform vec4 uTransformST;
|
uniform vec4 uTransformST;
|
||||||
|
|
|
@ -8,6 +8,20 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders the curved edges of paths when performing *mesh coverage
|
||||||
|
//! antialiasing* (MCAA).
|
||||||
|
//!
|
||||||
|
//! This shader expects to render to the red channel of a floating point color
|
||||||
|
//! buffer. Half precision floating point should be sufficient.
|
||||||
|
//!
|
||||||
|
//! Use this shader only when *both* of the following are true:
|
||||||
|
//!
|
||||||
|
//! 1. You are only rendering monochrome paths such as text. (Otherwise,
|
||||||
|
//! consider `mcaa-multi`.)
|
||||||
|
//!
|
||||||
|
//! 2. Your transform is only a scale and/or translation, not a perspective,
|
||||||
|
//! rotation, or skew. (Otherwise, consider the ECAA shaders.)
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform vec4 uTransformST;
|
uniform vec4 uTransformST;
|
||||||
|
|
|
@ -8,6 +8,17 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders the straight line segments of paths when performing *mesh coverage
|
||||||
|
//! antialiasing* (MCAA).
|
||||||
|
//!
|
||||||
|
//! Use this shader only when *both* of the following are true:
|
||||||
|
//!
|
||||||
|
//! 1. You are only rendering monochrome paths such as text. (Otherwise,
|
||||||
|
//! consider `mcaa-multi`.)
|
||||||
|
//!
|
||||||
|
//! 2. Your transform is only a scale and/or translation, not a perspective,
|
||||||
|
//! rotation, or skew. (Otherwise, consider the ECAA shaders.)
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform vec4 uTransformST;
|
uniform vec4 uTransformST;
|
||||||
|
|
|
@ -8,6 +8,21 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders paths when performing multicolor *mesh coverage antialiasing*
|
||||||
|
//! (MCAA). This one shader handles both lines and curves.
|
||||||
|
//!
|
||||||
|
//! This shader expects to render to a standard RGB color buffer.
|
||||||
|
//!
|
||||||
|
//! Use this shader only when *both* of the following are true:
|
||||||
|
//!
|
||||||
|
//! 1. You are rendering multiple multicolor paths. (Otherwise, consider the
|
||||||
|
//! other MCAA shaders, which render with higher quality.)
|
||||||
|
//!
|
||||||
|
//! 2. Your transform is only a scale and/or translation, not a perspective,
|
||||||
|
//! rotation, or skew. (Otherwise, consider repartitioning the path to
|
||||||
|
//! generate a new mesh, or, alternatively, use the direct Loop-Blinn
|
||||||
|
//! shaders.)
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
varying vec4 vUpperEndpoints;
|
varying vec4 vUpperEndpoints;
|
||||||
|
|
|
@ -8,6 +8,21 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders paths when performing multicolor *mesh coverage antialiasing*
|
||||||
|
//! (MCAA). This one shader handles both lines and curves.
|
||||||
|
//!
|
||||||
|
//! This shader expects to render to a standard RGB color buffer.
|
||||||
|
//!
|
||||||
|
//! Use this shader only when *both* of the following are true:
|
||||||
|
//!
|
||||||
|
//! 1. You are rendering multiple multicolor paths. (Otherwise, consider the
|
||||||
|
//! other MCAA shaders, which render with higher quality.)
|
||||||
|
//!
|
||||||
|
//! 2. Your transform is only a scale and/or translation, not a perspective,
|
||||||
|
//! rotation, or skew. (Otherwise, consider repartitioning the path to
|
||||||
|
//! generate a new mesh, or, alternatively, use the direct Loop-Blinn
|
||||||
|
//! shaders.)
|
||||||
|
|
||||||
#define MAX_SLOPE 10.0
|
#define MAX_SLOPE 10.0
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Performs subpixel antialiasing for LCD screens by converting a
|
||||||
|
//! 3x-oversampled RGBA color buffer to an RGB framebuffer, applying the
|
||||||
|
//! FreeType color defringing filter as necessary.
|
||||||
|
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
uniform sampler2D uSource;
|
uniform sampler2D uSource;
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Performs analytic *coverage antialiasing* (XCAA) in order to render curves.
|
||||||
|
//!
|
||||||
|
//! Given endpoints P0 and P2 and control point P1, this shader expects that
|
||||||
|
//! P0.x <= P1.x <= P2.x.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
varying vec4 vEndpoints;
|
varying vec4 vEndpoints;
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Performs analytic *coverage antialiasing* (XCAA) in order to render lines.
|
||||||
|
//!
|
||||||
|
//! This shader expects that P1 is to the right of P0.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
varying vec4 vEndpoints;
|
varying vec4 vEndpoints;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders a single-channel alpha coverage buffer to an RGB framebuffer.
|
||||||
|
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
uniform vec4 uBGColor;
|
uniform vec4 uBGColor;
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Renders a single-channel alpha coverage buffer to an RGB framebuffer.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform vec4 uTransformST;
|
uniform vec4 uTransformST;
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Performs subpixel antialiasing for LCD screens by converting a
|
||||||
|
//! 3x-oversampled single-channel color buffer to an RGB framebuffer, applying
|
||||||
|
//! the FreeType color defringing filter as necessary.
|
||||||
|
|
||||||
precision mediump float;
|
precision mediump float;
|
||||||
|
|
||||||
uniform vec4 uBGColor;
|
uniform vec4 uBGColor;
|
||||||
|
|
|
@ -8,6 +8,10 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
//! Performs subpixel antialiasing for LCD screens by converting a
|
||||||
|
//! 3x-oversampled single-channel color buffer to an RGB framebuffer, applying
|
||||||
|
//! the FreeType color defringing filter as necessary.
|
||||||
|
|
||||||
precision highp float;
|
precision highp float;
|
||||||
|
|
||||||
uniform vec4 uTransformST;
|
uniform vec4 uTransformST;
|
||||||
|
|
Loading…
Reference in New Issue