update servo to use webrender shaders

This commit is contained in:
Mason Chang 2016-08-04 17:57:19 -07:00
parent 1086df67e0
commit 7699380965
9 changed files with 18 additions and 18 deletions

View file

@ -21,7 +21,7 @@ void main(void) {
float sa = sin(angle);
float ca = cos(angle);
float sx = vStartPoint.x * ca - vStartPoint.y * sa;
float sx = vStartPoint.x * ca - vStartPoint.y * sa;
float ex = vEndPoint.x * ca - vEndPoint.y * sa;
float d = ex - sx;

View file

@ -28,7 +28,7 @@ vec4 draw_dotted_edge() {
// like firefox.
float circleSpacing = diameter * 2.2;
vec2 size = vec2(vBorders.z, vBorders.w);
vec2 size = vBorders.zw;
// Get our position within this specific segment
vec2 position = vDevicePos - vBorders.xy;
@ -68,15 +68,16 @@ vec2 get_dashed_nudge_factor(vec2 dash_size, bool is_corner) {
bool xAxisFudge = vBorders.z > vBorders.w;
if (xAxisFudge) {
return vec2(dash_size.x / 2.0, 0);
} else {
return vec2(0.0, dash_size.y / 2.0);
}
return vec2(0.0, dash_size.y / 2.0);
}
vec4 draw_dashed_edge(bool is_corner) {
// Everything here should be in device pixels.
// We want the dot to be roughly the size of the whole border spacing
// 5.5 here isn't a magic number, it's just what mostly looks like FF/Chrome
// TODO: Investigate exactly what FF does.
float dash_interval = min(vBorders.w, vBorders.z) * 5.5;
vec2 edge_size = vec2(vBorders.z, vBorders.w);
vec2 dash_size = vec2(dash_interval / 2.0, dash_interval / 2.0);
@ -143,6 +144,8 @@ void draw_dashed_border(void) {
}
}
// TODO: Investigate performance of this shader and see
// if it's worthwhile splitting it / removing branches etc.
void main(void) {
if (vRadii.x > 0.0 &&
(distance(vRefPoint, vLocalPos) > vRadii.x ||
@ -178,7 +181,6 @@ void main(void) {
default:
{
discard;
break;
}
}
}

View file

@ -107,7 +107,5 @@ void main(void) {
vDevicePos = vi.global_clamped_pos;
// These are in device space
vBorders = vec4(border.info.local_rect.x, border.info.local_rect.y,
border.info.local_rect.z,
border.info.local_rect.w) * uDevicePixelRatio;
vBorders = border.info.local_rect * uDevicePixelRatio;
}

View file

@ -4,8 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
struct BoxShadow {
PrimitiveInfo info;
vec4 color;
PrimitiveInfo info;
vec4 color;
vec4 border_radii_blur_radius_inverted;
vec4 bs_rect;
vec4 src_rect;

View file

@ -7,7 +7,7 @@
#define DIR_VERTICAL uint(1)
struct Gradient {
PrimitiveInfo info;
PrimitiveInfo info;
vec4 color0;
vec4 color1;
uvec4 dir;

View file

@ -9,11 +9,11 @@
#define varying out
// Uniform inputs
uniform mat4 uTransform; // Orthographic projection
uniform float uDevicePixelRatio;
uniform mat4 uTransform; // Orthographic projection
uniform float uDevicePixelRatio;
// Attribute inputs
in vec3 aPosition;
in vec3 aPosition;
#endif
//======================================================================================

View file

@ -11,8 +11,8 @@
// box-shadow
in vec4 aBorderPosition;
in vec4 aBorderRadii;
in float aBlurRadius;
in vec4 aBorderRadii;
in float aBlurRadius;
// blur
in vec2 aDestTextureSize;