2017-08-18 14:44:17 -04:00
|
|
|
// pathfinder/shaders/gles2/ecaa-line.vs.glsl
|
|
|
|
//
|
|
|
|
// Copyright (c) 2017 Mozilla Foundation
|
|
|
|
|
|
|
|
precision highp float;
|
|
|
|
|
|
|
|
uniform mat4 uTransform;
|
2017-09-07 17:58:41 -04:00
|
|
|
uniform float uScaleX;
|
2017-08-18 14:44:17 -04:00
|
|
|
uniform ivec2 uFramebufferSize;
|
|
|
|
uniform ivec2 uBVertexPositionDimensions;
|
|
|
|
uniform ivec2 uBVertexPathIDDimensions;
|
2017-08-22 21:25:32 -04:00
|
|
|
uniform ivec2 uPathTransformDimensions;
|
2017-08-18 14:44:17 -04:00
|
|
|
uniform sampler2D uBVertexPosition;
|
|
|
|
uniform sampler2D uBVertexPathID;
|
2017-08-22 21:25:32 -04:00
|
|
|
uniform sampler2D uPathTransform;
|
2017-08-18 14:44:17 -04:00
|
|
|
uniform bool uLowerPart;
|
|
|
|
|
|
|
|
attribute vec2 aQuadPosition;
|
|
|
|
attribute vec4 aLineIndices;
|
|
|
|
|
|
|
|
varying vec4 vEndpoints;
|
|
|
|
|
|
|
|
void main() {
|
|
|
|
// Fetch B-vertex positions.
|
|
|
|
ivec2 pointIndices = ivec2(unpackUInt32Attribute(aLineIndices.xy),
|
|
|
|
unpackUInt32Attribute(aLineIndices.zw));
|
|
|
|
vec2 leftPosition = fetchFloat2Data(uBVertexPosition,
|
|
|
|
pointIndices.x,
|
|
|
|
uBVertexPositionDimensions);
|
|
|
|
vec2 rightPosition = fetchFloat2Data(uBVertexPosition,
|
|
|
|
pointIndices.y,
|
|
|
|
uBVertexPositionDimensions);
|
|
|
|
|
2017-08-22 21:25:32 -04:00
|
|
|
int pathID = fetchUInt16Data(uBVertexPathID, pointIndices.x, uBVertexPathIDDimensions);
|
|
|
|
|
|
|
|
vec4 transform = fetchFloat4Data(uPathTransform, pathID, uPathTransformDimensions);
|
2017-09-07 17:58:41 -04:00
|
|
|
transform.xz *= uScaleX;
|
2017-08-22 21:25:32 -04:00
|
|
|
|
2017-08-18 20:12:58 -04:00
|
|
|
// Transform the points, and compute the position of this vertex.
|
2017-08-18 14:44:17 -04:00
|
|
|
vec2 position;
|
2017-08-18 20:12:58 -04:00
|
|
|
computeQuadPosition(position,
|
|
|
|
leftPosition,
|
|
|
|
rightPosition,
|
|
|
|
aQuadPosition,
|
|
|
|
uFramebufferSize,
|
2017-08-22 21:25:32 -04:00
|
|
|
transform);
|
2017-08-18 14:44:17 -04:00
|
|
|
|
2017-08-23 22:18:24 -04:00
|
|
|
float depth = convertPathIndexToViewportDepthValue(pathID);
|
2017-08-18 14:44:17 -04:00
|
|
|
|
|
|
|
gl_Position = vec4(position, depth, 1.0);
|
|
|
|
vEndpoints = vec4(leftPosition, rightPosition);
|
|
|
|
}
|