mirror of
https://github.com/servo/servo.git
synced 2025-08-01 19:50:30 +01:00
Update WebRender
This is necessary because the API has changed for scrolling ids.
This commit is contained in:
parent
71d285af80
commit
05beb59f47
9 changed files with 298 additions and 209 deletions
44
components/servo/Cargo.lock
generated
44
components/servo/Cargo.lock
generated
|
@ -46,8 +46,8 @@ dependencies = [
|
|||
"util 0.0.1",
|
||||
"util_tests 0.0.1",
|
||||
"webdriver_server 0.0.1",
|
||||
"webrender 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -233,7 +233,7 @@ dependencies = [
|
|||
"offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -250,7 +250,7 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -338,8 +338,8 @@ dependencies = [
|
|||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -370,7 +370,7 @@ dependencies = [
|
|||
"style_traits 0.0.1",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -815,7 +815,7 @@ dependencies = [
|
|||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xi-unicode 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -1166,7 +1166,7 @@ dependencies = [
|
|||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1205,7 +1205,7 @@ dependencies = [
|
|||
"style 0.0.1",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1219,7 +1219,7 @@ dependencies = [
|
|||
"profile_traits 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1388,7 +1388,7 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1426,7 +1426,7 @@ dependencies = [
|
|||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1484,7 +1484,7 @@ dependencies = [
|
|||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1989,7 +1989,7 @@ dependencies = [
|
|||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml5ever 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -2666,8 +2666,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/servo/webrender#4440d1daa3d6e9630d4b164f7bae644b9dc4cb8a"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#d44b1ffd3ea9e9e97ef7a70c1ac0f53bbd626850"
|
||||
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)",
|
||||
|
@ -2686,13 +2686,13 @@ dependencies = [
|
|||
"offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webrender_traits"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/servo/webrender#4440d1daa3d6e9630d4b164f7bae644b9dc4cb8a"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#d44b1ffd3ea9e9e97ef7a70c1ac0f53bbd626850"
|
||||
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)",
|
||||
|
@ -3009,8 +3009,8 @@ dependencies = [
|
|||
"checksum wayland-sys 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9633f7fe5de56544215f82eaf1b76bf1b584becf7f08b58cbef4c2c7d10e803a"
|
||||
"checksum wayland-window 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "309b69d3a863c9c21422d889fb7d98cf02f8a2ca054960a49243ce5b67ad884c"
|
||||
"checksum webdriver 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee2d66e90672022ced375134329c57be4db228b19b120b97b744a469c381be06"
|
||||
"checksum webrender 0.7.0 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum webrender_traits 0.7.0 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum webrender 0.8.0 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum webrender_traits 0.8.0 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a1a6ea5ed0367f32eb3d94dcc58859ef4294b5f75ba983dbf56ac314af45d"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
|
|
44
ports/cef/Cargo.lock
generated
44
ports/cef/Cargo.lock
generated
|
@ -206,7 +206,7 @@ dependencies = [
|
|||
"offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"plugins 0.0.1",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -223,7 +223,7 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -295,8 +295,8 @@ dependencies = [
|
|||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -327,7 +327,7 @@ dependencies = [
|
|||
"style_traits 0.0.1",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -731,7 +731,7 @@ dependencies = [
|
|||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xi-unicode 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -1073,7 +1073,7 @@ dependencies = [
|
|||
"unicode-script 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1105,7 +1105,7 @@ dependencies = [
|
|||
"style 0.0.1",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1119,7 +1119,7 @@ dependencies = [
|
|||
"profile_traits 0.0.1",
|
||||
"script_traits 0.0.1",
|
||||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1288,7 +1288,7 @@ dependencies = [
|
|||
"plugins 0.0.1",
|
||||
"serde 0.8.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"serde_derive 0.8.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -1326,7 +1326,7 @@ dependencies = [
|
|||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1362,7 +1362,7 @@ dependencies = [
|
|||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -1840,7 +1840,7 @@ dependencies = [
|
|||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"uuid 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"xml5ever 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
@ -1998,8 +1998,8 @@ dependencies = [
|
|||
"url 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"util 0.0.1",
|
||||
"webdriver_server 0.0.1",
|
||||
"webrender 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -2524,8 +2524,8 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/servo/webrender#4440d1daa3d6e9630d4b164f7bae644b9dc4cb8a"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#d44b1ffd3ea9e9e97ef7a70c1ac0f53bbd626850"
|
||||
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)",
|
||||
|
@ -2544,13 +2544,13 @@ dependencies = [
|
|||
"offscreen_gl_context 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"rayon 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"webrender_traits 0.7.0 (git+https://github.com/servo/webrender)",
|
||||
"webrender_traits 0.8.0 (git+https://github.com/servo/webrender)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "webrender_traits"
|
||||
version = "0.7.0"
|
||||
source = "git+https://github.com/servo/webrender#4440d1daa3d6e9630d4b164f7bae644b9dc4cb8a"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#d44b1ffd3ea9e9e97ef7a70c1ac0f53bbd626850"
|
||||
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)",
|
||||
|
@ -2861,8 +2861,8 @@ dependencies = [
|
|||
"checksum wayland-sys 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9633f7fe5de56544215f82eaf1b76bf1b584becf7f08b58cbef4c2c7d10e803a"
|
||||
"checksum wayland-window 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "309b69d3a863c9c21422d889fb7d98cf02f8a2ca054960a49243ce5b67ad884c"
|
||||
"checksum webdriver 0.14.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee2d66e90672022ced375134329c57be4db228b19b120b97b744a469c381be06"
|
||||
"checksum webrender 0.7.0 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum webrender_traits 0.7.0 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum webrender 0.8.0 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum webrender_traits 0.8.0 (git+https://github.com/servo/webrender)" = "<none>"
|
||||
"checksum websocket 0.17.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4a1a6ea5ed0367f32eb3d94dcc58859ef4294b5f75ba983dbf56ac314af45d"
|
||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||
|
|
148
resources/shaders/cs_box_shadow.fs.glsl
Normal file
148
resources/shaders/cs_box_shadow.fs.glsl
Normal file
|
@ -0,0 +1,148 @@
|
|||
#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/. */
|
||||
|
||||
// See http://asciimath.org to render the equations here.
|
||||
|
||||
// The Gaussian function used for blurring:
|
||||
//
|
||||
// G_sigma(x) = 1/sqrt(2 pi sigma^2) e^(-x^2/(2 sigma^2))
|
||||
float gauss(float x, float sigma) {
|
||||
float sigmaPow2 = sigma * sigma;
|
||||
return 1.0 / sqrt(6.283185307179586 * sigmaPow2) * exp(-(x * x) / (2.0 * sigmaPow2));
|
||||
}
|
||||
|
||||
// An approximation of the error function, which is related to the integral of the Gaussian
|
||||
// function:
|
||||
//
|
||||
// "erf"(x) = 2/sqrt(pi) int_0^x e^(-t^2) dt
|
||||
// ~~ 1 - 1 / (1 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4)^4
|
||||
//
|
||||
// where:
|
||||
//
|
||||
// a_1 = 0.278393, a_2 = 0.230389, a_3 = 0.000972, a_4 = 0.078108
|
||||
//
|
||||
// This approximation is accurate to `5 xx 10^-4`, more than accurate enough for our purposes.
|
||||
//
|
||||
// See: https://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions
|
||||
float erf(float x) {
|
||||
bool negative = x < 0.0;
|
||||
if (negative)
|
||||
x = -x;
|
||||
float x2 = x * x;
|
||||
float x3 = x2 * x;
|
||||
float x4 = x2 * x2;
|
||||
float denom = 1.0 + 0.278393 * x + 0.230389 * x2 + 0.000972 * x3 + 0.078108 * x4;
|
||||
float result = 1.0 - 1.0 / (denom * denom * denom * denom);
|
||||
return negative ? -result : result;
|
||||
}
|
||||
|
||||
// A useful helper for calculating integrals of the Gaussian function via the error function:
|
||||
//
|
||||
// "erf"_sigma(x) = 2 int 1/sqrt(2 pi sigma^2) e^(-x^2/(2 sigma^2)) dx
|
||||
// = "erf"(x/(sigma sqrt(2)))
|
||||
float erfSigma(float x, float sigma) {
|
||||
return erf(x / (sigma * 1.4142135623730951));
|
||||
}
|
||||
|
||||
// Returns the blurred color value from the box itself (not counting any rounded corners). `p_0` is
|
||||
// the vector distance to the top left corner of the box; `p_1` is the vector distance to its
|
||||
// bottom right corner.
|
||||
//
|
||||
// "colorFromRect"_sigma(p_0, p_1)
|
||||
// = int_{p_{0_y}}^{p_{1_y}} int_{p_{1_x}}^{p_{0_x}} G_sigma(y) G_sigma(x) dx dy
|
||||
// = 1/4 ("erf"_sigma(p_{1_x}) - "erf"_sigma(p_{0_x}))
|
||||
// ("erf"_sigma(p_{1_y}) - "erf"_sigma(p_{0_y}))
|
||||
float colorFromRect(vec2 p0, vec2 p1, float sigma) {
|
||||
return (erfSigma(p1.x, sigma) - erfSigma(p0.x, sigma)) *
|
||||
(erfSigma(p1.y, sigma) - erfSigma(p0.y, sigma)) / 4.0;
|
||||
}
|
||||
|
||||
// Returns the `x` coordinate on the ellipse with the given radii for the given `y` coordinate:
|
||||
//
|
||||
// "ellipsePoint"(y, y_0, a, b) = a sqrt(1 - ((y - y_0) / b)^2)
|
||||
float ellipsePoint(float y, float y0, vec2 radii) {
|
||||
float bStep = (y - y0) / radii.y;
|
||||
return radii.x * sqrt(1.0 - bStep * bStep);
|
||||
}
|
||||
|
||||
// A helper function to compute the value that needs to be subtracted to accommodate the border
|
||||
// corners.
|
||||
//
|
||||
// "colorCutout"_sigma(x_{0_l}, x_{0_r}, y_0, y_{min}, y_{max}, a, b)
|
||||
// = int_{y_{min}}^{y_{max}}
|
||||
// int_{x_{0_r} + "ellipsePoint"(y, y_0, a, b)}^{x_{0_r} + a} G_sigma(y) G_sigma(x) dx
|
||||
// + int_{x_{0_l} - a}^{x_{0_l} - "ellipsePoint"(y, y_0, a, b)} G_sigma(y) G_sigma(x)
|
||||
// dx dy
|
||||
// = int_{y_{min}}^{y_{max}} 1/2 G_sigma(y)
|
||||
// ("erf"_sigma(x_{0_r} + a) - "erf"_sigma(x_{0_r} + "ellipsePoint"(y, y_0, a, b)) +
|
||||
// "erf"_sigma(x_{0_l} - "ellipsePoint"(y, y_0, a, b)) - "erf"_sigma(x_{0_l} - a))
|
||||
//
|
||||
// with the outer integral evaluated numerically.
|
||||
float colorCutoutGeneral(float x0l,
|
||||
float x0r,
|
||||
float y0,
|
||||
float yMin,
|
||||
float yMax,
|
||||
vec2 radii,
|
||||
float sigma) {
|
||||
float sum = 0.0;
|
||||
for (float y = yMin; y <= yMax; y += 1.0) {
|
||||
float xEllipsePoint = ellipsePoint(y, y0, radii);
|
||||
sum += gauss(y, sigma) *
|
||||
(erfSigma(x0r + radii.x, sigma) - erfSigma(x0r + xEllipsePoint, sigma) +
|
||||
erfSigma(x0l - xEllipsePoint, sigma) - erfSigma(x0l - radii.x, sigma));
|
||||
}
|
||||
return sum / 2.0;
|
||||
}
|
||||
|
||||
// The value that needs to be subtracted to accommodate the top border corners.
|
||||
float colorCutoutTop(float x0l, float x0r, float y0, vec2 radii, float sigma) {
|
||||
return colorCutoutGeneral(x0l, x0r, y0, y0, y0 + radii.y, radii, sigma);
|
||||
}
|
||||
|
||||
// The value that needs to be subtracted to accommodate the bottom border corners.
|
||||
float colorCutoutBottom(float x0l, float x0r, float y0, vec2 radii, float sigma) {
|
||||
return colorCutoutGeneral(x0l, x0r, y0, y0 - radii.y, y0, radii, sigma);
|
||||
}
|
||||
|
||||
// The blurred color value for the point at `pos` with the top left corner of the box at
|
||||
// `p_{0_"rect"}` and the bottom right corner of the box at `p_{1_"rect"}`.
|
||||
float color(vec2 pos, vec2 p0Rect, vec2 p1Rect, vec2 radii, float sigma) {
|
||||
// Compute the vector distances `p_0` and `p_1`.
|
||||
vec2 p0 = p0Rect - pos, p1 = p1Rect - pos;
|
||||
|
||||
// Compute the basic color `"colorFromRect"_sigma(p_0, p_1)`. This is all we have to do if
|
||||
// the box is unrounded.
|
||||
float cRect = colorFromRect(p0, p1, sigma);
|
||||
if (radii.x == 0.0 || radii.y == 0.0)
|
||||
return cRect;
|
||||
|
||||
// Compute the inner corners of the box, taking border radii into account: `x_{0_l}`,
|
||||
// `y_{0_t}`, `x_{0_r}`, and `y_{0_b}`.
|
||||
float x0l = p0.x + radii.x;
|
||||
float y0t = p1.y - radii.y;
|
||||
float x0r = p1.x - radii.x;
|
||||
float y0b = p0.y + radii.y;
|
||||
|
||||
// Compute the final color:
|
||||
//
|
||||
// "colorFromRect"_sigma(p_0, p_1) -
|
||||
// ("colorCutoutTop"_sigma(x_{0_l}, x_{0_r}, y_{0_t}, a, b) +
|
||||
// "colorCutoutBottom"_sigma(x_{0_l}, x_{0_r}, y_{0_b}, a, b))
|
||||
float cCutoutTop = colorCutoutTop(x0l, x0r, y0t, radii, sigma);
|
||||
float cCutoutBottom = colorCutoutBottom(x0l, x0r, y0b, radii, sigma);
|
||||
return cRect - (cCutoutTop + cCutoutBottom);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec2 pos = vPos.xy;
|
||||
vec2 p0Rect = vBoxShadowRect.xy, p1Rect = vBoxShadowRect.zw;
|
||||
vec2 radii = vBorderRadii.xy;
|
||||
float sigma = vBlurRadius / 2.0;
|
||||
float value = color(pos, p0Rect, p1Rect, radii, sigma);
|
||||
|
||||
value = max(value, 0.0);
|
||||
oFragColor = vec4(1.0, 1.0, 1.0, vInverted == 1.0 ? 1.0 - value : value);
|
||||
}
|
10
resources/shaders/cs_box_shadow.glsl
Normal file
10
resources/shaders/cs_box_shadow.glsl
Normal file
|
@ -0,0 +1,10 @@
|
|||
#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/. */
|
||||
|
||||
varying vec2 vPos;
|
||||
flat varying vec2 vBorderRadii;
|
||||
flat varying float vBlurRadius;
|
||||
flat varying vec4 vBoxShadowRect;
|
||||
flat varying float vInverted;
|
31
resources/shaders/cs_box_shadow.vs.glsl
Normal file
31
resources/shaders/cs_box_shadow.vs.glsl
Normal file
|
@ -0,0 +1,31 @@
|
|||
#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) {
|
||||
CachePrimitiveInstance cpi = fetch_cache_instance(gl_InstanceID);
|
||||
RenderTaskData task = fetch_render_task(cpi.render_task_index);
|
||||
BoxShadow bs = fetch_boxshadow(cpi.specific_prim_index);
|
||||
|
||||
vec2 p0 = task.data0.xy;
|
||||
vec2 p1 = p0 + task.data0.zw;
|
||||
|
||||
vec2 pos = mix(p0, p1, aPosition.xy);
|
||||
|
||||
vBorderRadii = bs.border_radius_edge_size_blur_radius_inverted.xx;
|
||||
vBlurRadius = bs.border_radius_edge_size_blur_radius_inverted.z;
|
||||
vInverted = bs.border_radius_edge_size_blur_radius_inverted.w;
|
||||
vBoxShadowRect = vec4(bs.bs_rect.xy, bs.bs_rect.xy + bs.bs_rect.zw);
|
||||
|
||||
// The fragment shader expects logical units, beginning at where the
|
||||
// blur radius begins.
|
||||
// The first path of the equation gets the virtual position in
|
||||
// logical pixels within the patch rectangle (accounting for
|
||||
// bilinear offset). Then we add the start position of the
|
||||
// box shadow rect and subtract the blur radius to get the
|
||||
// virtual coordinates that the FS expects.
|
||||
vPos = (pos - 1.0 - p0) / uDevicePixelRatio + bs.bs_rect.xy - vec2(2.0 * vBlurRadius);
|
||||
|
||||
gl_Position = uTransform * vec4(pos, 0.0, 1.0);
|
||||
}
|
|
@ -39,7 +39,7 @@ uniform sampler2DArray sCache;
|
|||
#ifdef WR_VERTEX_SHADER
|
||||
|
||||
#define VECS_PER_LAYER 13
|
||||
#define VECS_PER_TILE 2
|
||||
#define VECS_PER_RENDER_TASK 2
|
||||
#define VECS_PER_PRIM_GEOM 2
|
||||
|
||||
#define GRADIENT_HORIZONTAL 0
|
||||
|
@ -121,18 +121,33 @@ Layer fetch_layer(int index) {
|
|||
return layer;
|
||||
}
|
||||
|
||||
struct RenderTaskData {
|
||||
vec4 data0;
|
||||
vec4 data1;
|
||||
};
|
||||
|
||||
RenderTaskData fetch_render_task(int index) {
|
||||
RenderTaskData task;
|
||||
|
||||
ivec2 uv = get_fetch_uv(index, VECS_PER_RENDER_TASK);
|
||||
|
||||
task.data0 = texelFetchOffset(sRenderTasks, uv, 0, ivec2(0, 0));
|
||||
task.data1 = texelFetchOffset(sRenderTasks, uv, 0, ivec2(1, 0));
|
||||
|
||||
return task;
|
||||
}
|
||||
|
||||
struct Tile {
|
||||
vec4 screen_origin_task_origin;
|
||||
vec4 size_target_index;
|
||||
};
|
||||
|
||||
Tile fetch_tile(int index) {
|
||||
RenderTaskData task = fetch_render_task(index);
|
||||
|
||||
Tile tile;
|
||||
|
||||
ivec2 uv = get_fetch_uv(index, VECS_PER_TILE);
|
||||
|
||||
tile.screen_origin_task_origin = texelFetchOffset(sRenderTasks, uv, 0, ivec2(0, 0));
|
||||
tile.size_target_index = texelFetchOffset(sRenderTasks, uv, 0, ivec2(1, 0));
|
||||
tile.screen_origin_task_origin = task.data0;
|
||||
tile.size_target_index = task.data1;
|
||||
|
||||
return tile;
|
||||
}
|
||||
|
@ -259,6 +274,27 @@ PrimitiveInstance fetch_instance(int index) {
|
|||
|
||||
return pi;
|
||||
}
|
||||
|
||||
struct CachePrimitiveInstance {
|
||||
int global_prim_index;
|
||||
int specific_prim_index;
|
||||
int render_task_index;
|
||||
};
|
||||
|
||||
CachePrimitiveInstance fetch_cache_instance(int index) {
|
||||
CachePrimitiveInstance cpi;
|
||||
|
||||
int offset = index * 1;
|
||||
|
||||
ivec4 data0 = int_data[offset + 0];
|
||||
|
||||
cpi.global_prim_index = data0.x;
|
||||
cpi.specific_prim_index = data0.y;
|
||||
cpi.render_task_index = data0.z;
|
||||
|
||||
return cpi;
|
||||
}
|
||||
|
||||
struct Primitive {
|
||||
Layer layer;
|
||||
Tile tile;
|
||||
|
@ -553,7 +589,7 @@ struct BoxShadow {
|
|||
vec4 src_rect;
|
||||
vec4 bs_rect;
|
||||
vec4 color;
|
||||
vec4 border_radii_blur_radius_inverted;
|
||||
vec4 border_radius_edge_size_blur_radius_inverted;
|
||||
};
|
||||
|
||||
BoxShadow fetch_boxshadow(int index) {
|
||||
|
@ -564,7 +600,7 @@ BoxShadow fetch_boxshadow(int index) {
|
|||
bs.src_rect = texelFetchOffset(sData64, uv, 0, ivec2(0, 0));
|
||||
bs.bs_rect = texelFetchOffset(sData64, uv, 0, ivec2(1, 0));
|
||||
bs.color = texelFetchOffset(sData64, uv, 0, ivec2(2, 0));
|
||||
bs.border_radii_blur_radius_inverted = texelFetchOffset(sData64, uv, 0, ivec2(3, 0));
|
||||
bs.border_radius_edge_size_blur_radius_inverted = texelFetchOffset(sData64, uv, 0, ivec2(3, 0));
|
||||
|
||||
return bs;
|
||||
}
|
||||
|
|
|
@ -2,150 +2,8 @@
|
|||
* 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/. */
|
||||
|
||||
/* 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/. */
|
||||
|
||||
// See http://asciimath.org to render the equations here.
|
||||
|
||||
// The Gaussian function used for blurring:
|
||||
//
|
||||
// G_sigma(x) = 1/sqrt(2 pi sigma^2) e^(-x^2/(2 sigma^2))
|
||||
float gauss(float x, float sigma) {
|
||||
float sigmaPow2 = sigma * sigma;
|
||||
return 1.0 / sqrt(6.283185307179586 * sigmaPow2) * exp(-(x * x) / (2.0 * sigmaPow2));
|
||||
}
|
||||
|
||||
// An approximation of the error function, which is related to the integral of the Gaussian
|
||||
// function:
|
||||
//
|
||||
// "erf"(x) = 2/sqrt(pi) int_0^x e^(-t^2) dt
|
||||
// ~~ 1 - 1 / (1 + a_1 x + a_2 x^2 + a_3 x^3 + a_4 x^4)^4
|
||||
//
|
||||
// where:
|
||||
//
|
||||
// a_1 = 0.278393, a_2 = 0.230389, a_3 = 0.000972, a_4 = 0.078108
|
||||
//
|
||||
// This approximation is accurate to `5 xx 10^-4`, more than accurate enough for our purposes.
|
||||
//
|
||||
// See: https://en.wikipedia.org/wiki/Error_function#Approximation_with_elementary_functions
|
||||
float erf(float x) {
|
||||
bool negative = x < 0.0;
|
||||
if (negative)
|
||||
x = -x;
|
||||
float x2 = x * x;
|
||||
float x3 = x2 * x;
|
||||
float x4 = x2 * x2;
|
||||
float denom = 1.0 + 0.278393 * x + 0.230389 * x2 + 0.000972 * x3 + 0.078108 * x4;
|
||||
float result = 1.0 - 1.0 / (denom * denom * denom * denom);
|
||||
return negative ? -result : result;
|
||||
}
|
||||
|
||||
// A useful helper for calculating integrals of the Gaussian function via the error function:
|
||||
//
|
||||
// "erf"_sigma(x) = 2 int 1/sqrt(2 pi sigma^2) e^(-x^2/(2 sigma^2)) dx
|
||||
// = "erf"(x/(sigma sqrt(2)))
|
||||
float erfSigma(float x, float sigma) {
|
||||
return erf(x / (sigma * 1.4142135623730951));
|
||||
}
|
||||
|
||||
// Returns the blurred color value from the box itself (not counting any rounded corners). `p_0` is
|
||||
// the vector distance to the top left corner of the box; `p_1` is the vector distance to its
|
||||
// bottom right corner.
|
||||
//
|
||||
// "colorFromRect"_sigma(p_0, p_1)
|
||||
// = int_{p_{0_y}}^{p_{1_y}} int_{p_{1_x}}^{p_{0_x}} G_sigma(y) G_sigma(x) dx dy
|
||||
// = 1/4 ("erf"_sigma(p_{1_x}) - "erf"_sigma(p_{0_x}))
|
||||
// ("erf"_sigma(p_{1_y}) - "erf"_sigma(p_{0_y}))
|
||||
float colorFromRect(vec2 p0, vec2 p1, float sigma) {
|
||||
return (erfSigma(p1.x, sigma) - erfSigma(p0.x, sigma)) *
|
||||
(erfSigma(p1.y, sigma) - erfSigma(p0.y, sigma)) / 4.0;
|
||||
}
|
||||
|
||||
// Returns the `x` coordinate on the ellipse with the given radii for the given `y` coordinate:
|
||||
//
|
||||
// "ellipsePoint"(y, y_0, a, b) = a sqrt(1 - ((y - y_0) / b)^2)
|
||||
float ellipsePoint(float y, float y0, vec2 radii) {
|
||||
float bStep = (y - y0) / radii.y;
|
||||
return radii.x * sqrt(1.0 - bStep * bStep);
|
||||
}
|
||||
|
||||
// A helper function to compute the value that needs to be subtracted to accommodate the border
|
||||
// corners.
|
||||
//
|
||||
// "colorCutout"_sigma(x_{0_l}, x_{0_r}, y_0, y_{min}, y_{max}, a, b)
|
||||
// = int_{y_{min}}^{y_{max}}
|
||||
// int_{x_{0_r} + "ellipsePoint"(y, y_0, a, b)}^{x_{0_r} + a} G_sigma(y) G_sigma(x) dx
|
||||
// + int_{x_{0_l} - a}^{x_{0_l} - "ellipsePoint"(y, y_0, a, b)} G_sigma(y) G_sigma(x)
|
||||
// dx dy
|
||||
// = int_{y_{min}}^{y_{max}} 1/2 G_sigma(y)
|
||||
// ("erf"_sigma(x_{0_r} + a) - "erf"_sigma(x_{0_r} + "ellipsePoint"(y, y_0, a, b)) +
|
||||
// "erf"_sigma(x_{0_l} - "ellipsePoint"(y, y_0, a, b)) - "erf"_sigma(x_{0_l} - a))
|
||||
//
|
||||
// with the outer integral evaluated numerically.
|
||||
float colorCutoutGeneral(float x0l,
|
||||
float x0r,
|
||||
float y0,
|
||||
float yMin,
|
||||
float yMax,
|
||||
vec2 radii,
|
||||
float sigma) {
|
||||
float sum = 0.0;
|
||||
for (float y = yMin; y <= yMax; y += 1.0) {
|
||||
float xEllipsePoint = ellipsePoint(y, y0, radii);
|
||||
sum += gauss(y, sigma) *
|
||||
(erfSigma(x0r + radii.x, sigma) - erfSigma(x0r + xEllipsePoint, sigma) +
|
||||
erfSigma(x0l - xEllipsePoint, sigma) - erfSigma(x0l - radii.x, sigma));
|
||||
}
|
||||
return sum / 2.0;
|
||||
}
|
||||
|
||||
// The value that needs to be subtracted to accommodate the top border corners.
|
||||
float colorCutoutTop(float x0l, float x0r, float y0, vec2 radii, float sigma) {
|
||||
return colorCutoutGeneral(x0l, x0r, y0, y0, y0 + radii.y, radii, sigma);
|
||||
}
|
||||
|
||||
// The value that needs to be subtracted to accommodate the bottom border corners.
|
||||
float colorCutoutBottom(float x0l, float x0r, float y0, vec2 radii, float sigma) {
|
||||
return colorCutoutGeneral(x0l, x0r, y0, y0 - radii.y, y0, radii, sigma);
|
||||
}
|
||||
|
||||
// The blurred color value for the point at `pos` with the top left corner of the box at
|
||||
// `p_{0_"rect"}` and the bottom right corner of the box at `p_{1_"rect"}`.
|
||||
float color(vec2 pos, vec2 p0Rect, vec2 p1Rect, vec2 radii, float sigma) {
|
||||
// Compute the vector distances `p_0` and `p_1`.
|
||||
vec2 p0 = p0Rect - pos, p1 = p1Rect - pos;
|
||||
|
||||
// Compute the basic color `"colorFromRect"_sigma(p_0, p_1)`. This is all we have to do if
|
||||
// the box is unrounded.
|
||||
float cRect = colorFromRect(p0, p1, sigma);
|
||||
if (radii.x == 0.0 || radii.y == 0.0)
|
||||
return cRect;
|
||||
|
||||
// Compute the inner corners of the box, taking border radii into account: `x_{0_l}`,
|
||||
// `y_{0_t}`, `x_{0_r}`, and `y_{0_b}`.
|
||||
float x0l = p0.x + radii.x;
|
||||
float y0t = p1.y - radii.y;
|
||||
float x0r = p1.x - radii.x;
|
||||
float y0b = p0.y + radii.y;
|
||||
|
||||
// Compute the final color:
|
||||
//
|
||||
// "colorFromRect"_sigma(p_0, p_1) -
|
||||
// ("colorCutoutTop"_sigma(x_{0_l}, x_{0_r}, y_{0_t}, a, b) +
|
||||
// "colorCutoutBottom"_sigma(x_{0_l}, x_{0_r}, y_{0_b}, a, b))
|
||||
float cCutoutTop = colorCutoutTop(x0l, x0r, y0t, radii, sigma);
|
||||
float cCutoutBottom = colorCutoutBottom(x0l, x0r, y0b, radii, sigma);
|
||||
return cRect - (cCutoutTop + cCutoutBottom);
|
||||
}
|
||||
|
||||
void main(void) {
|
||||
vec2 pos = vPos.xy;
|
||||
vec2 p0Rect = vBoxShadowRect.xy, p1Rect = vBoxShadowRect.zw;
|
||||
vec2 radii = vBorderRadii.xy;
|
||||
float sigma = vBlurRadius / 2.0;
|
||||
float value = color(pos, p0Rect, p1Rect, radii, sigma);
|
||||
|
||||
value = max(value, 0.0);
|
||||
oFragColor = vColor * vec4(1.0, 1.0, 1.0, vInverted == 1.0 ? 1.0 - value : value);
|
||||
vec2 uv = min(vec2(1.0), vMirrorPoint - abs(vUv.xy - vMirrorPoint));
|
||||
uv = mix(vCacheUvRectCoords.xy, vCacheUvRectCoords.zw, uv);
|
||||
oFragColor = vColor * texture(sCache, vec3(uv, vUv.z));
|
||||
}
|
||||
|
|
|
@ -2,10 +2,8 @@
|
|||
* 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 vPos;
|
||||
flat varying vec4 vColor;
|
||||
flat varying vec2 vBorderRadii;
|
||||
flat varying float vBlurRadius;
|
||||
flat varying vec4 vBoxShadowRect;
|
||||
flat varying vec4 vSrcRect;
|
||||
flat varying float vInverted;
|
||||
|
||||
varying vec3 vUv;
|
||||
flat varying vec2 vMirrorPoint;
|
||||
flat varying vec4 vCacheUvRectCoords;
|
||||
|
|
|
@ -13,11 +13,19 @@ void main(void) {
|
|||
prim.layer,
|
||||
prim.tile);
|
||||
|
||||
vPos = vi.local_clamped_pos;
|
||||
RenderTaskData child_task = fetch_render_task(prim.user_data.z);
|
||||
vUv.z = child_task.data1.x;
|
||||
|
||||
// Constant offsets to inset from bilinear filtering border.
|
||||
vec2 patch_origin = child_task.data0.xy + vec2(1.0);
|
||||
vec2 patch_size_device_pixels = child_task.data0.zw - vec2(2.0);
|
||||
vec2 patch_size = patch_size_device_pixels / uDevicePixelRatio;
|
||||
|
||||
vUv.xy = (vi.local_clamped_pos - prim.local_rect.xy) / patch_size;
|
||||
vMirrorPoint = 0.5 * prim.local_rect.zw / patch_size;
|
||||
|
||||
vec2 texture_size = vec2(textureSize(sCache, 0));
|
||||
vCacheUvRectCoords = vec4(patch_origin, patch_origin + patch_size_device_pixels) / texture_size.xyxy;
|
||||
|
||||
vColor = bs.color;
|
||||
vBorderRadii = bs.border_radii_blur_radius_inverted.xy;
|
||||
vBlurRadius = bs.border_radii_blur_radius_inverted.z;
|
||||
vBoxShadowRect = vec4(bs.bs_rect.xy, bs.bs_rect.xy + bs.bs_rect.zw);
|
||||
vSrcRect = vec4(bs.src_rect.xy, bs.src_rect.xy + bs.src_rect.zw);
|
||||
vInverted = bs.border_radii_blur_radius_inverted.w;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue