Document more shader parameters

This commit is contained in:
Patrick Walton 2018-01-04 18:07:14 -08:00
parent 67d29803b5
commit f3841ef402
20 changed files with 86 additions and 24 deletions

View File

@ -764,26 +764,16 @@ export class ECAAStrategy extends XCAAStrategy {
if (renderer.meshData[0].segmentLineNormals.byteLength > 0) {
gl.bindBuffer(gl.ARRAY_BUFFER, lineNormalsBuffer);
gl.vertexAttribPointer(attributes.aLeftNormalAngle,
1,
gl.vertexAttribPointer(attributes.aNormalAngles,
2,
gl.FLOAT,
false,
FLOAT32_SIZE * 2,
0);
gl.vertexAttribPointer(attributes.aRightNormalAngle,
1,
gl.FLOAT,
false,
FLOAT32_SIZE * 2,
FLOAT32_SIZE);
gl.enableVertexAttribArray(attributes.aLeftNormalAngle);
gl.enableVertexAttribArray(attributes.aRightNormalAngle);
gl.enableVertexAttribArray(attributes.aNormalAngles);
renderContext.instancedArraysExt
.vertexAttribDivisorANGLE(attributes.aLeftNormalAngle, 1);
renderContext.instancedArraysExt
.vertexAttribDivisorANGLE(attributes.aRightNormalAngle, 1);
.vertexAttribDivisorANGLE(attributes.aNormalAngles, 1);
}
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, renderContext.quadElementsBuffer);

View File

@ -14,10 +14,8 @@ precision mediump float;
/// The source texture to blit.
uniform sampler2D uSource;
/// The approximate background color, in linear RGB.
uniform vec3 uBGColor;
/// The gamma LUT.
uniform sampler2D uGammaLUT;

View File

@ -12,9 +12,12 @@
precision highp float;
/// The color of the font.
uniform vec4 uColor;
/// The cached glyph atlas.
uniform sampler2D uAtlas;
/// The texture coordinate.
varying vec2 vTexCoord;
void main() {

View File

@ -19,9 +19,12 @@ uniform vec4 uGlyphTexCoords;
/// The size of the glyph in local coordinates.
uniform vec2 uGlyphSize;
/// The abstract quad position: (0.0, 0.0) to (1.0, 1.0).
attribute vec2 aQuadPosition;
// The world-space 2D position of this vertex.
attribute vec2 aPosition;
/// The texture coordinate.
varying vec2 vTexCoord;
void main() {

View File

@ -12,12 +12,17 @@
precision mediump float;
/// The 3D position of the light.
uniform vec3 uLightPosition;
/// The ambient color of the light.
uniform vec3 uAmbientColor;
/// The diffuse color of the light.
uniform vec3 uDiffuseColor;
/// The Phong specular color of the light.
uniform vec3 uSpecularColor;
/// The Phong albedo exponent.
uniform float uShininess;
/// The normal of these vertices.
uniform vec3 uNormal;
varying vec3 vPosition;

View File

@ -17,8 +17,10 @@ uniform mat4 uProjection;
/// The 3D modelview matrix.
uniform mat4 uModelview;
/// The 3D vertex position.
attribute vec3 aPosition;
/// The 3D vertex position.
varying vec3 vPosition;
void main() {

View File

@ -16,23 +16,39 @@
precision highp float;
/// A 3D transform to be applied to all points.
uniform mat4 uTransform;
uniform vec2 uEmboldenAmount;
uniform ivec2 uPathColorsDimensions;
uniform sampler2D uPathColors;
/// The size of the path transform buffer texture in texels.
uniform ivec2 uPathTransformSTDimensions;
/// The path transform buffer texture, one dilation per path ID.
uniform sampler2D uPathTransformST;
/// The size of the extra path transform factors buffer texture in texels.
uniform ivec2 uPathTransformExtDimensions;
/// The extra path transform factors buffer texture, packed two path transforms per texel.
uniform sampler2D uPathTransformExt;
/// The size of the path colors buffer texture in texels.
uniform ivec2 uPathColorsDimensions;
/// The path colors buffer texture, one color per path ID.
uniform sampler2D uPathColors;
/// The amount of faux-bold to apply, in local path units.
uniform vec2 uEmboldenAmount;
/// The 2D position of this point.
attribute vec2 aPosition;
/// The abstract Loop-Blinn texture coordinate for this point.
attribute vec2 aTexCoord;
/// The path ID, starting from 1.
attribute float aPathID;
/// Specifies whether this is a concave or convex curve.
attribute float aSign;
/// The angle of the 2D normal for this point.
attribute float aNormalAngle;
/// The fill color of this path.
varying vec4 vColor;
/// The outgoing abstract Loop-Blinn texture coordinate.
varying vec2 vTexCoord;
/// Specifies whether this is a concave or convex curve.
varying float vSign;
void main() {

View File

@ -21,8 +21,11 @@
precision highp float;
/// The fill color of this path.
varying vec4 vColor;
/// The abstract Loop-Blinn texture coordinate.
varying vec2 vTexCoord;
/// Specifies whether this is a concave or convex curve.
varying float vSign;
void main() {

View File

@ -40,14 +40,22 @@ uniform sampler2D uPathTransformExt;
/// The amount of faux-bold to apply, in local path units.
uniform vec2 uEmboldenAmount;
/// The 2D position of this point.
attribute vec2 aPosition;
/// The abstract Loop-Blinn texture coordinate for this point.
attribute vec2 aTexCoord;
/// The path ID, starting from 1.
attribute float aPathID;
/// Specifies whether this is a concave or convex curve.
attribute float aSign;
/// The angle of the 2D normal for this point.
attribute float aNormalAngle;
/// The fill color of this path.
varying vec4 vColor;
/// The outgoing abstract Loop-Blinn texture coordinate.
varying vec2 vTexCoord;
/// Specifies whether this is a concave or convex curve.
varying float vSign;
void main() {

View File

@ -16,6 +16,7 @@
precision highp float;
/// The color of this path.
varying vec4 vColor;
void main() {

View File

@ -39,6 +39,7 @@ attribute vec2 aPosition;
attribute float aPathID;
attribute float aNormalAngle;
/// The color of this path.
varying vec4 vColor;
void main() {

View File

@ -26,7 +26,7 @@
precision highp float;
/// A 3D transform to be applied to the object.
/// A 3D transform to be applied to all points.
uniform mat4 uTransform;
/// Vertical snapping positions.
uniform vec4 uHints;
@ -47,11 +47,17 @@ uniform sampler2D uPathTransformExt;
/// The amount of faux-bold to apply, in local path units.
uniform vec2 uEmboldenAmount;
/// The abstract quad position: (0.0, 0.0) to (1.0, 1.0).
attribute vec2 aQuadPosition;
/// The position of the left endpoint.
attribute vec2 aLeftPosition;
/// The position of the control point.
attribute vec2 aControlPointPosition;
/// The position of the right endpoint.
attribute vec2 aRightPosition;
/// The path ID (starting from 1).
attribute float aPathID;
/// The normal angles of the left endpoint, control point, and right endpoint, respectively.
attribute vec3 aNormalAngles;
varying vec4 vEndpoints;

View File

@ -45,12 +45,16 @@ uniform sampler2D uPathTransformExt;
/// The amount of faux-bold to apply, in local path units.
uniform vec2 uEmboldenAmount;
/// The abstract quad position: (0.0, 0.0) to (1.0, 1.0).
attribute vec2 aQuadPosition;
/// The position of the left endpoint.
attribute vec2 aLeftPosition;
/// The position of the right endpoint.
attribute vec2 aRightPosition;
/// The path ID (starting from 1).
attribute float aPathID;
attribute float aLeftNormalAngle;
attribute float aRightNormalAngle;
/// The normal angles of the left endpoint and right endpoint, respectively.
attribute vec2 aNormalAngles;
varying vec4 vEndpoints;
varying float vWinding;
@ -59,7 +63,7 @@ void main() {
vec2 leftPosition = aLeftPosition;
vec2 rightPosition = aRightPosition;
int pathID = int(aPathID);
vec2 leftRightNormalAngles = vec2(aLeftNormalAngle, aRightNormalAngle);
vec2 leftRightNormalAngles = aNormalAngles;
vec2 pathTransformExt;
vec4 pathTransformST = fetchPathAffineTransform(pathTransformExt,

View File

@ -56,11 +56,17 @@ uniform vec2 uEmboldenAmount;
/// an identical draw call with this value set to 1.
uniform int uPassIndex;
/// The abstract quad position: (0.0, 0.0) to (1.0, 1.0).
attribute vec2 aQuadPosition;
/// The position of the left endpoint.
attribute vec2 aLeftPosition;
/// The position of the control point.
attribute vec2 aControlPointPosition;
/// The position of the right endpoint.
attribute vec2 aRightPosition;
/// The path ID (starting from 1).
attribute float aPathID;
/// The normal angles of the left endpoint, control point, and right endpoint, respectively.
attribute vec3 aNormalAngles;
varying vec4 vEndpoints;

View File

@ -25,6 +25,9 @@
precision highp float;
/// True if multiple colors are being rendered; false otherwise.
///
/// If this is true, then points will be snapped to the nearest pixel.
uniform bool uMulticolor;
varying vec4 vUpperEndpoints;

View File

@ -14,7 +14,9 @@
precision mediump float;
/// The alpha coverage texture.
uniform sampler2D uSource;
/// The dimensions of the alpha coverage texture, in texels.
uniform ivec2 uSourceDimensions;
varying vec2 vTexCoord;

View File

@ -12,8 +12,11 @@
precision mediump float;
/// The background color of the monochrome path.
uniform vec4 uBGColor;
/// The foreground color of the monochrome path.
uniform vec4 uFGColor;
/// The alpha coverage texture.
uniform sampler2D uAAAlpha;
varying vec2 vTexCoord;

View File

@ -17,7 +17,9 @@ uniform vec4 uTransformST;
/// A fixed pair of factors to be applied to the texture coordinates.
uniform vec2 uTexScale;
/// The abstract quad position: (0.0, 0.0) to (1.0, 1.0).
attribute vec2 aPosition;
/// The texture coordinates: (0.0, 0.0) to (1.0, 1.0).
attribute vec2 aTexCoord;
varying vec2 vTexCoord;

View File

@ -14,9 +14,13 @@
precision mediump float;
/// The background color of the monochrome path.
uniform vec4 uBGColor;
/// The foreground color of the monochrome path.
uniform vec4 uFGColor;
/// The alpha coverage texture.
uniform sampler2D uAAAlpha;
/// The dimensions of the alpha coverage texture, in texels.
uniform ivec2 uAAAlphaDimensions;
varying vec2 vTexCoord;

View File

@ -19,7 +19,9 @@ uniform vec4 uTransformST;
/// A fixed pair of factors to be applied to the texture coordinates.
uniform vec2 uTexScale;
/// The abstract quad position: (0.0, 0.0) to (1.0, 1.0).
attribute vec2 aPosition;
/// The texture coordinates: (0.0, 0.0) to (1.0, 1.0).
attribute vec2 aTexCoord;
varying vec2 vTexCoord;