Auto merge of #13273 - glennw:update-wr-floats, r=jdm

Update webrender, gleam and associated shaders.

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13273)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-09-14 19:05:26 -05:00 committed by GitHub
commit b3db4b4c0d
18 changed files with 142 additions and 85 deletions

View file

@ -18,7 +18,7 @@ dependencies = [
"gaol 0.0.1 (git+https://github.com/servo/gaol)",
"gfx 0.0.1",
"gfx_tests 0.0.1",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"layout 0.0.1",
@ -231,7 +231,7 @@ dependencies = [
"canvas_traits 0.0.1",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -277,7 +277,7 @@ name = "cgl"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -330,7 +330,7 @@ dependencies = [
"azure 0.8.0 (git+https://github.com/servo/rust-azure)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.5.3 (git+https://github.com/servo/rust-layers)",
@ -878,7 +878,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.2.21"
version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -897,7 +897,7 @@ dependencies = [
"compositing 0.0.1",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.5.3 (git+https://github.com/servo/rust-layers)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -1077,7 +1077,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1150,7 +1150,7 @@ dependencies = [
"cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1624,7 +1624,7 @@ dependencies = [
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2201,7 +2201,7 @@ dependencies = [
"cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"expat-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2644,7 +2644,7 @@ dependencies = [
[[package]]
name = "webrender"
version = "0.5.1"
source = "git+https://github.com/servo/webrender#c9ceb97e9f6b919518f3c70cdae85d3213c8290c"
source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2655,7 +2655,7 @@ dependencies = [
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2669,13 +2669,13 @@ dependencies = [
[[package]]
name = "webrender_traits"
version = "0.5.1"
source = "git+https://github.com/servo/webrender#c9ceb97e9f6b919518f3c70cdae85d3213c8290c"
source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2843,7 +2843,7 @@ dependencies = [
"checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685"
"checksum gif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01c7c19a035de94bd7afbaa62c241aadfbdf1a70f560b348d2312eafa566ca16"
"checksum gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1d8edc81c5ae84605a62f5dac661a2313003b26d59839f81d47d46cf0f16a55"
"checksum gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "2c41f3a5972e6a8796d70fdc37787bcbfedc6e06385eea0937f64324f5819061"
"checksum gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "e299fc6b34e698955c6e7cbe7afef2b89774124c82d3636ab85c540edd9ad567"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b280007fa9c7442cfd1e0b1addb8d1a59240267110e8705f8f7e2c7bfb7e2f72"
"checksum harfbuzz-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "16f772015f526a0cb0c642676cf696bcd2de35e4b91d016a8105755fec2bb373"

32
ports/cef/Cargo.lock generated
View file

@ -6,7 +6,7 @@ dependencies = [
"compositing 0.0.1",
"devtools 0.0.1",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1",
"layers 0.5.3 (git+https://github.com/servo/rust-layers)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
@ -204,7 +204,7 @@ dependencies = [
"canvas_traits 0.0.1",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"num-traits 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
@ -250,7 +250,7 @@ name = "cgl"
version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -287,7 +287,7 @@ dependencies = [
"azure 0.8.0 (git+https://github.com/servo/rust-azure)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gfx_traits 0.0.1",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"image 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.5.3 (git+https://github.com/servo/rust-layers)",
@ -785,7 +785,7 @@ dependencies = [
[[package]]
name = "gleam"
version = "0.2.21"
version = "0.2.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -804,7 +804,7 @@ dependencies = [
"compositing 0.0.1",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"layers 0.5.3 (git+https://github.com/servo/rust-layers)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"msg 0.0.1",
@ -984,7 +984,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"leaky-cow 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -1057,7 +1057,7 @@ dependencies = [
"cgl 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1495,7 +1495,7 @@ dependencies = [
"core-foundation 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 0.8.8 (registry+https://github.com/rust-lang/crates.io-index)",
@ -1986,7 +1986,7 @@ dependencies = [
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gaol 0.0.1 (git+https://github.com/servo/gaol)",
"gfx 0.0.1",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"glutin_app 0.0.1",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"layout 0.0.1",
@ -2084,7 +2084,7 @@ dependencies = [
"cmake 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"expat-sys 2.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
"io-surface 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.16 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2504,7 +2504,7 @@ dependencies = [
[[package]]
name = "webrender"
version = "0.5.1"
source = "git+https://github.com/servo/webrender#c9ceb97e9f6b919518f3c70cdae85d3213c8290c"
source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2515,7 +2515,7 @@ dependencies = [
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"fnv 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"freetype 0.1.0 (git+https://github.com/servo/rust-freetype)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2529,13 +2529,13 @@ dependencies = [
[[package]]
name = "webrender_traits"
version = "0.5.1"
source = "git+https://github.com/servo/webrender#c9ceb97e9f6b919518f3c70cdae85d3213c8290c"
source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
dependencies = [
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
"core-graphics 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
"euclid 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
"heapsize 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"ipc-channel 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
"offscreen_gl_context 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)",
@ -2697,7 +2697,7 @@ dependencies = [
"checksum getopts 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "d9047cfbd08a437050b363d35ef160452c5fe8ea5187ae0a624708c91581d685"
"checksum gif 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "01c7c19a035de94bd7afbaa62c241aadfbdf1a70f560b348d2312eafa566ca16"
"checksum gl_generator 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f1d8edc81c5ae84605a62f5dac661a2313003b26d59839f81d47d46cf0f16a55"
"checksum gleam 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "2c41f3a5972e6a8796d70fdc37787bcbfedc6e06385eea0937f64324f5819061"
"checksum gleam 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "e299fc6b34e698955c6e7cbe7afef2b89774124c82d3636ab85c540edd9ad567"
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
"checksum glx 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "b280007fa9c7442cfd1e0b1addb8d1a59240267110e8705f8f7e2c7bfb7e2f72"
"checksum harfbuzz-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "16f772015f526a0cb0c642676cf696bcd2de35e4b91d016a8105755fec2bb373"

View file

@ -567,7 +567,7 @@ float do_clip(vec2 pos, vec4 clip_rect, vec4 radius) {
// Apply a more gradual fade out to transparent.
//distance_from_border -= 0.5;
return smoothstep(1.0, 0, distance_from_border);
return smoothstep(1.0, 0.0, distance_from_border);
}
float squared_distance_from_rect(vec2 p, vec2 origin, vec2 size) {
@ -580,9 +580,9 @@ vec2 init_transform_fs(vec3 local_pos, vec4 local_rect, out float fragment_alpha
vec2 pos = local_pos.xy / local_pos.z;
float squared_distance = squared_distance_from_rect(pos, local_rect.xy, local_rect.zw);
if (squared_distance != 0) {
if (squared_distance != 0.0) {
float delta = length(fwidth(local_pos.xy));
fragment_alpha = smoothstep(1.0, 0.0, squared_distance / delta * 2);
fragment_alpha = smoothstep(1.0, 0.0, squared_distance / delta * 2.0);
}
return pos;

View file

@ -24,7 +24,7 @@ float alpha_for_solid_border(float distance_from_ref,
float outer_radius,
float pixels_per_fragment) {
// We want to start anti-aliasing one pixel in from the border.
float nudge = 1 * pixels_per_fragment;
float nudge = pixels_per_fragment;
inner_radius += nudge;
outer_radius -= nudge;
@ -41,7 +41,7 @@ float alpha_for_solid_border(float distance_from_ref,
// Apply a more gradual fade out to transparent.
distance_from_border -= 0.5;
return smoothstep(1.0, 0, distance_from_border);
return smoothstep(1.0, 0.0, distance_from_border);
}
float alpha_for_solid_border_corner(vec2 local_pos,
@ -56,22 +56,22 @@ vec4 draw_dotted_edge(vec2 local_pos, vec4 piece_rect, float pixels_per_fragment
// We don't use pixels_per_fragment here, since it can change along the edge
// of a transformed border edge. We want this calculation to be consistent
// across the entire edge so that the positioning of the dots stays the same.
float two_pixels = 2 * length(fwidth(vLocalPos.xy));
float two_pixels = 2.0 * length(fwidth(vLocalPos.xy));
// Circle diameter is stroke width, minus a couple pixels to account for anti-aliasing.
float circle_diameter = max(piece_rect.z - two_pixels, min(piece_rect.z, two_pixels));
// We want to spread the circles across the edge, but keep one circle diameter at the end
// reserved for two half-circles which connect to the corners.
float edge_available = piece_rect.w - (circle_diameter * 2);
float number_of_circles = floor(edge_available / (circle_diameter * 2));
float edge_available = piece_rect.w - (circle_diameter * 2.0);
float number_of_circles = floor(edge_available / (circle_diameter * 2.0));
// Here we are initializing the distance from the y coordinate of the center of the circle to
// the closest end half-circle.
vec2 relative_pos = local_pos - piece_rect.xy;
float y_distance = min(relative_pos.y, piece_rect.w - relative_pos.y);
if (number_of_circles > 0) {
if (number_of_circles > 0.0) {
// Spread the circles throughout the edge, to distribute the extra space evenly. We want
// to ensure that we have at last two pixels of space for each circle so that they aren't
// touching.
@ -80,41 +80,41 @@ vec4 draw_dotted_edge(vec2 local_pos, vec4 piece_rect, float pixels_per_fragment
float first_half_circle_space = circle_diameter;
float circle_index = (relative_pos.y - first_half_circle_space) / space_for_each_circle;
circle_index = floor(clamp(circle_index, 0, number_of_circles - 1));
circle_index = floor(clamp(circle_index, 0.0, number_of_circles - 1.0));
float circle_y_pos =
circle_index * space_for_each_circle + (space_for_each_circle / 2) + circle_diameter;
circle_index * space_for_each_circle + (space_for_each_circle / 2.0) + circle_diameter;
y_distance = min(abs(circle_y_pos - relative_pos.y), y_distance);
}
float distance_from_circle_center = length(vec2(relative_pos.x - (piece_rect.z / 2), y_distance));
float distance_from_circle_edge = distance_from_circle_center - (circle_diameter / 2);
float distance_from_circle_center = length(vec2(relative_pos.x - (piece_rect.z / 2.0), y_distance));
float distance_from_circle_edge = distance_from_circle_center - (circle_diameter / 2.0);
// Don't anti-alias if the circle diameter is small to avoid a blur of color.
if (circle_diameter < two_pixels && distance_from_circle_edge > 0)
return vec4(0, 0, 0, 0);
if (circle_diameter < two_pixels && distance_from_circle_edge > 0.0)
return vec4(0.0);
// Move the distance back into pixels.
distance_from_circle_edge /= pixels_per_fragment;
float alpha = smoothstep(1.0, 0.0, min(1.0, max(0, distance_from_circle_edge)));
return vHorizontalColor * vec4(1, 1, 1, alpha);
float alpha = smoothstep(1.0, 0.0, min(1.0, max(0.0, distance_from_circle_edge)));
return vHorizontalColor * vec4(1.0, 1.0, 1.0, alpha);
}
vec4 draw_dashed_edge(float position, float border_width, float pixels_per_fragment) {
// TODO: Investigate exactly what FF does.
float size = border_width * 3;
float size = border_width * 3.0;
float segment = floor(position / size);
float alpha = alpha_for_solid_border(position,
segment * size,
(segment + 1) * size,
(segment + 1.0) * size,
pixels_per_fragment);
if (mod(segment + 2, 2) == 0) {
return vHorizontalColor * vec4(1, 1, 1, 1 - alpha);
if (mod(segment + 2.0, 2.0) == 0.0) {
return vHorizontalColor * vec4(1.0, 1.0, 1.0, 1.0 - alpha);
} else {
return vHorizontalColor * vec4(1, 1, 1, alpha);
return vHorizontalColor * vec4(1.0, 1.0, 1.0, alpha);
}
}
@ -131,7 +131,7 @@ void draw_dashed_or_dotted_border(vec2 local_pos, float distance_from_mix_line)
{
oFragColor = get_fragment_color(distance_from_mix_line, pixels_per_fragment);
if (vRadii.x > 0.0) {
oFragColor *= vec4(1, 1, 1, alpha_for_solid_border_corner(local_pos,
oFragColor *= vec4(1.0, 1.0, 1.0, alpha_for_solid_border_corner(local_pos,
vRadii.z,
vRadii.x,
pixels_per_fragment));
@ -179,8 +179,8 @@ vec4 draw_double_edge(float pos,
pixels_per_fragment);
// Contribution of the inner border segment.
alpha += alpha_for_solid_border(pos, 0, one_third_width, pixels_per_fragment);
return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1, 1, 1, alpha);
alpha += alpha_for_solid_border(pos, 0.0, one_third_width, pixels_per_fragment);
return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1.0, 1.0, 1.0, alpha);
}
vec4 draw_double_edge_vertical(vec2 local_pos,
@ -216,20 +216,20 @@ vec4 draw_double_edge_corner_with_radius(vec2 local_pos,
vRadii.z,
vRadii.z + one_third_width,
pixels_per_fragment);
return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1, 1, 1, alpha);
return get_fragment_color(distance_from_mix_line, pixels_per_fragment) * vec4(1.0, 1.0, 1.0, alpha);
}
vec4 draw_double_edge_corner(vec2 local_pos,
float distance_from_mix_line,
float pixels_per_fragment) {
if (vRadii.x > 0) {
if (vRadii.x > 0.0) {
return draw_double_edge_corner_with_radius(local_pos,
distance_from_mix_line,
pixels_per_fragment);
}
bool is_vertical = (vBorderPart == PST_TOP_LEFT) ? distance_from_mix_line < 0 :
distance_from_mix_line >= 0;
bool is_vertical = (vBorderPart == PST_TOP_LEFT) ? distance_from_mix_line < 0.0 :
distance_from_mix_line >= 0.0;
if (is_vertical) {
return draw_double_edge_vertical(local_pos, distance_from_mix_line, pixels_per_fragment);
} else {
@ -280,7 +280,7 @@ void draw_solid_border(float distanceFromMixLine, vec2 localPos) {
if (vRadii.x > 0.0) {
float alpha = alpha_for_solid_border_corner(localPos, vRadii.z, vRadii.x, pixelsPerFragment);
oFragColor *= vec4(1, 1, 1, alpha);
oFragColor *= vec4(1.0, 1.0, 1.0, alpha);
}
break;
@ -295,7 +295,7 @@ void draw_solid_border(float distanceFromMixLine, vec2 localPos) {
// if it's worthwhile splitting it / removing branches etc.
void main(void) {
#ifdef WR_FEATURE_TRANSFORM
float alpha = 0;
float alpha = 0.0;
vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha);
#else
vec2 local_pos = vLocalPos;
@ -330,6 +330,6 @@ void main(void) {
}
#ifdef WR_FEATURE_TRANSFORM
oFragColor *= vec4(1, 1, 1, alpha);
oFragColor *= vec4(1.0, 1.0, 1.0, alpha);
#endif
}

View file

@ -105,7 +105,7 @@ void main(void) {
// in the fragment shader itself. For non-transformed borders, we can use the
// interpolator.
#ifdef WR_FEATURE_TRANSFORM
vPieceRectHypotenuseLength = sqrt(pow(width, 2) + pow(height, 2));
vPieceRectHypotenuseLength = sqrt(pow(width, 2.0) + pow(height, 2.0));
#else
vDistanceFromMixLine = (vi.local_clamped_pos.x - x0) * height -
(vi.local_clamped_pos.y - y0) * width;

View file

@ -4,10 +4,10 @@
void main(void) {
#ifdef WR_FEATURE_TRANSFORM
float alpha = 0;
float alpha = 0.0;
vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha);
#else
float alpha = 1;
float alpha = 1.0;
vec2 local_pos = vPos;
#endif

View file

@ -6,9 +6,14 @@
void main(void) {
#ifdef WR_FEATURE_TRANSFORM
float alpha = 0;
float alpha = 0.0;
vec2 pos = init_transform_fs(vLocalPos, vLocalRect, alpha);
vec2 uv = (pos - vLocalRect.xy) / vStretchSize;
// We clamp the texture coordinate calculation here to the local rectangle boundaries,
// which makes the edge of the texture stretch instead of repeat.
vec2 uv = clamp(pos, vLocalRect.xy, vLocalRect.xy + vLocalRect.zw);
uv = (uv - vLocalRect.xy) / vStretchSize;
#else
vec2 uv = vUv;
#endif

View file

@ -24,7 +24,7 @@ void main(void) {
case UV_NORMALIZED:
break;
case UV_PIXEL: {
vec2 texture_size = textureSize(sDiffuse, 0);
vec2 texture_size = vec2(textureSize(sDiffuse, 0));
st0 /= texture_size;
st1 /= texture_size;
}

View file

@ -1,9 +1,27 @@
#line 1
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
void main(void) {
float alpha = do_clip(vPos, vClipRect, vClipRadius);
vec2 st = vTextureOffset + vTextureSize * fract(vUv);
#ifdef WR_FEATURE_TRANSFORM
float alpha = 1;
vec2 local_pos = init_transform_fs(vLocalPos, vLocalRect, alpha);
// We clamp the texture coordinate calculation here to the local rectangle boundaries,
// which makes the edge of the texture stretch instead of repeat.
vec2 uv = clamp(local_pos.xy, vLocalRect.xy, vLocalRect.xy + vLocalRect.zw);
uv = (uv - vLocalRect.xy) / vStretchSize;
#else
float alpha = 1;
vec2 local_pos = vLocalPos;
vec2 uv = vUv;
#endif
vec2 st = vTextureOffset + vTextureSize * fract(uv);
alpha = min(alpha, do_clip(local_pos, vClipRect, vClipRadius));
oFragColor = texture(sDiffuse, st) * vec4(1, 1, 1, alpha);
}

View file

@ -2,9 +2,16 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
varying vec2 vUv; // Location within the CSS box to draw.
varying vec2 vPos;
flat varying vec2 vTextureOffset; // Offset of this image into the texture atlas.
flat varying vec2 vTextureSize; // Size of the image in the texture atlas.
flat varying vec4 vClipRect;
flat varying vec4 vClipRadius;
#ifdef WR_FEATURE_TRANSFORM
varying vec3 vLocalPos;
flat varying vec4 vLocalRect;
flat varying vec2 vStretchSize;
#else
varying vec2 vLocalPos;
varying vec2 vUv; // Location within the CSS box to draw.
#endif

View file

@ -5,17 +5,23 @@
void main(void) {
ImageClip image = fetch_image_clip(gl_InstanceID);
#ifdef WR_FEATURE_TRANSFORM
TransformVertexInfo vi = write_transform_vertex(image.info);
vLocalRect = vi.clipped_local_rect;
vLocalPos = vi.local_pos;
vStretchSize = image.stretch_size_uvkind.xy;
#else
VertexInfo vi = write_vertex(image.info);
vUv = (vi.local_clamped_pos - vi.local_rect.p0) / image.stretch_size_uvkind.xy;
vLocalPos = vi.local_clamped_pos;
#endif
vClipRect = vec4(image.clip.rect.xy, image.clip.rect.xy + image.clip.rect.zw);
vClipRadius = vec4(image.clip.top_left.outer_inner_radius.x,
image.clip.top_right.outer_inner_radius.x,
image.clip.bottom_right.outer_inner_radius.x,
image.clip.bottom_left.outer_inner_radius.x);
vPos = vi.local_clamped_pos;
// vUv will contain how many times this image has wrapped around the image size.
vUv = (vi.local_clamped_pos - image.info.local_rect.xy) / image.stretch_size_uvkind.xy;
vec2 st0 = image.st_rect.xy;
vec2 st1 = image.st_rect.zw;
@ -24,7 +30,7 @@ void main(void) {
case UV_NORMALIZED:
break;
case UV_PIXEL: {
vec2 texture_size = textureSize(sDiffuse, 0);
vec2 texture_size = vec2(textureSize(sDiffuse, 0));
st0 /= texture_size;
st1 /= texture_size;
}

View file

@ -4,7 +4,7 @@
void main(void) {
#ifdef WR_FEATURE_TRANSFORM
float alpha = 0;
float alpha = 0.0;
init_transform_fs(vLocalPos, vLocalRect, alpha);
oFragColor = vec4(1, 1, 1, alpha) * vColor;
#else

View file

@ -3,6 +3,14 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
void main(void) {
float alpha = do_clip(vPos, vClipRect, vClipRadius);
#ifdef WR_FEATURE_TRANSFORM
float alpha = 1;
vec2 local_pos = init_transform_fs(vPos, vLocalRect, alpha);
#else
float alpha = 1;
vec2 local_pos = vPos;
#endif
alpha = min(alpha, do_clip(local_pos, vClipRect, vClipRadius));
oFragColor = vColor * vec4(1, 1, 1, alpha);
}

View file

@ -5,6 +5,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
varying vec4 vColor;
varying vec2 vPos;
flat varying vec4 vClipRect;
flat varying vec4 vClipRadius;
#ifdef WR_FEATURE_TRANSFORM
varying vec3 vPos;
flat varying vec4 vLocalRect;
#else
varying vec2 vPos;
#endif

View file

@ -5,14 +5,21 @@
void main(void) {
RectangleClip rect = fetch_rectangle_clip(gl_InstanceID);
#ifdef WR_FEATURE_TRANSFORM
TransformVertexInfo vi = write_transform_vertex(rect.info);
vPos = vi.local_pos;
vLocalRect = vi.clipped_local_rect;
#else
VertexInfo vi = write_vertex(rect.info);
vPos = vi.local_clamped_pos;
#endif
vClipRect = vec4(rect.clip.rect.xy, rect.clip.rect.xy + rect.clip.rect.zw);
vClipRadius = vec4(rect.clip.top_left.outer_inner_radius.x,
rect.clip.top_right.outer_inner_radius.x,
rect.clip.bottom_right.outer_inner_radius.x,
rect.clip.bottom_left.outer_inner_radius.x);
vPos = vi.local_clamped_pos;
vColor = rect.color;
}

View file

@ -5,7 +5,7 @@
void main(void) {
float a = texture(sDiffuse, vUv).a;
#ifdef WR_FEATURE_TRANSFORM
float alpha = 0;
float alpha = 0.0;
init_transform_fs(vLocalPos, vLocalRect, alpha);
a *= alpha;
#endif

View file

@ -16,7 +16,7 @@ void main(void) {
vec2 f = (vi.local_clamped_pos - vi.local_rect.p0) / (vi.local_rect.p1 - vi.local_rect.p0);
#endif
vec2 texture_size = textureSize(sDiffuse, 0);
vec2 texture_size = vec2(textureSize(sDiffuse, 0));
vec2 st0 = glyph.uv_rect.xy / texture_size;
vec2 st1 = glyph.uv_rect.zw / texture_size;

View file

@ -17,7 +17,7 @@ void main(void) {
vec2 f = (vi.local_clamped_pos - vi.local_rect.p0) / (vi.local_rect.p1 - vi.local_rect.p0);
#endif
vec2 texture_size = textureSize(sDiffuse, 0);
vec2 texture_size = vec2(textureSize(sDiffuse, 0));
vec2 st0 = uv_rect.xy / texture_size;
vec2 st1 = uv_rect.zw / texture_size;