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

@ -2554,7 +2554,7 @@ dependencies = [
[[package]] [[package]]
name = "webrender" name = "webrender"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/servo/webrender#eebe599cab295271900d7fbbe3017232dcbba867" source = "git+https://github.com/servo/webrender#66b7134918a56c561cbdf72ab284f5da83459ec4"
dependencies = [ dependencies = [
"app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",

2
ports/cef/Cargo.lock generated
View file

@ -2416,7 +2416,7 @@ dependencies = [
[[package]] [[package]]
name = "webrender" name = "webrender"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/servo/webrender#eebe599cab295271900d7fbbe3017232dcbba867" source = "git+https://github.com/servo/webrender#66b7134918a56c561cbdf72ab284f5da83459ec4"
dependencies = [ dependencies = [
"app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
"bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",

View file

@ -21,7 +21,7 @@ void main(void) {
float sa = sin(angle); float sa = sin(angle);
float ca = cos(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 ex = vEndPoint.x * ca - vEndPoint.y * sa;
float d = ex - sx; float d = ex - sx;

View file

@ -28,7 +28,7 @@ vec4 draw_dotted_edge() {
// like firefox. // like firefox.
float circleSpacing = diameter * 2.2; float circleSpacing = diameter * 2.2;
vec2 size = vec2(vBorders.z, vBorders.w); vec2 size = vBorders.zw;
// Get our position within this specific segment // Get our position within this specific segment
vec2 position = vDevicePos - vBorders.xy; 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; bool xAxisFudge = vBorders.z > vBorders.w;
if (xAxisFudge) { if (xAxisFudge) {
return vec2(dash_size.x / 2.0, 0); 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) { vec4 draw_dashed_edge(bool is_corner) {
// Everything here should be in device pixels. // Everything here should be in device pixels.
// We want the dot to be roughly the size of the whole border spacing // 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 // 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; float dash_interval = min(vBorders.w, vBorders.z) * 5.5;
vec2 edge_size = vec2(vBorders.z, vBorders.w); vec2 edge_size = vec2(vBorders.z, vBorders.w);
vec2 dash_size = vec2(dash_interval / 2.0, dash_interval / 2.0); 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) { void main(void) {
if (vRadii.x > 0.0 && if (vRadii.x > 0.0 &&
(distance(vRefPoint, vLocalPos) > vRadii.x || (distance(vRefPoint, vLocalPos) > vRadii.x ||
@ -178,7 +181,6 @@ void main(void) {
default: default:
{ {
discard; discard;
break;
} }
} }
} }

View file

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

View file

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

View file

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

View file

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

View file

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