aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/servo/Cargo.lock4
-rw-r--r--components/servo/lib.rs2
-rw-r--r--components/util/opts.rs13
-rw-r--r--ports/cef/Cargo.lock4
-rw-r--r--resources/shaders/prim_shared.glsl28
5 files changed, 38 insertions, 13 deletions
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock
index e314b6de90c..0dc7ef6d02c 100644
--- a/components/servo/Cargo.lock
+++ b/components/servo/Cargo.lock
@@ -2644,7 +2644,7 @@ dependencies = [
[[package]]
name = "webrender"
version = "0.5.1"
-source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
+source = "git+https://github.com/servo/webrender#37dab545df3a9b6aa5e762f59272eb3d37227476"
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)",
@@ -2669,7 +2669,7 @@ dependencies = [
[[package]]
name = "webrender_traits"
version = "0.5.1"
-source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
+source = "git+https://github.com/servo/webrender#37dab545df3a9b6aa5e762f59272eb3d37227476"
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)",
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 47038533fe4..9284c0997a8 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -156,6 +156,8 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
enable_profiler: opts.webrender_stats,
debug: opts.webrender_debug,
enable_recording: false,
+ precache_shaders: opts.precache_shaders,
+ enable_scrollbars: opts.output_file.is_none(),
});
(Some(webrender), Some(webrender_sender))
} else {
diff --git a/components/util/opts.rs b/components/util/opts.rs
index ec7c0235fd9..e9df3f31298 100644
--- a/components/util/opts.rs
+++ b/components/util/opts.rs
@@ -200,6 +200,11 @@ pub struct Opts {
/// True to show webrender debug on screen.
pub webrender_debug: bool,
+ /// True to compile all webrender shaders at init time. This is mostly
+ /// useful when modifying the shaders, to ensure they all compile
+ /// after each change is made.
+ pub precache_shaders: bool,
+
/// True if WebRender should use multisample antialiasing.
pub use_msaa: bool,
@@ -313,6 +318,10 @@ pub struct DebugOptions {
// don't skip any backtraces on panic
pub full_backtraces: bool,
+ /// True to compile all webrender shaders at init time. This is mostly
+ /// useful when modifying the shaders, to ensure they all compile
+ /// after each change is made.
+ pub precache_shaders: bool,
}
@@ -351,6 +360,7 @@ impl DebugOptions {
"wr-debug" => debug_options.webrender_debug = true,
"msaa" => debug_options.use_msaa = true,
"full-backtraces" => debug_options.full_backtraces = true,
+ "precache-shaders" => debug_options.precache_shaders = true,
"" => {},
_ => return Err(option)
};
@@ -400,6 +410,7 @@ pub fn print_debug_usage(app: &str) -> ! {
print_option("msaa", "Use multisample antialiasing in WebRender.");
print_option("full-backtraces", "Print full backtraces for all errors");
print_option("wr-debug", "Display webrender tile borders. Must be used with -w option.");
+ print_option("precache-shaders", "Compile all shaders during init. Must be used with -w option.");
println!("");
@@ -537,6 +548,7 @@ pub fn default_opts() -> Opts {
full_backtraces: false,
is_printing_version: false,
webrender_debug: false,
+ precache_shaders: false,
}
}
@@ -849,6 +861,7 @@ pub fn from_cmdline_args(args: &[String]) -> ArgumentParsingResult {
full_backtraces: debug_options.full_backtraces,
is_printing_version: is_printing_version,
webrender_debug: debug_options.webrender_debug,
+ precache_shaders: debug_options.precache_shaders,
};
set_defaults(opts);
diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock
index eae6ba876ca..b8f6f84340f 100644
--- a/ports/cef/Cargo.lock
+++ b/ports/cef/Cargo.lock
@@ -2504,7 +2504,7 @@ dependencies = [
[[package]]
name = "webrender"
version = "0.5.1"
-source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
+source = "git+https://github.com/servo/webrender#37dab545df3a9b6aa5e762f59272eb3d37227476"
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)",
@@ -2529,7 +2529,7 @@ dependencies = [
[[package]]
name = "webrender_traits"
version = "0.5.1"
-source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
+source = "git+https://github.com/servo/webrender#37dab545df3a9b6aa5e762f59272eb3d37227476"
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)",
diff --git a/resources/shaders/prim_shared.glsl b/resources/shaders/prim_shared.glsl
index 8a957cf0ee8..271601c02df 100644
--- a/resources/shaders/prim_shared.glsl
+++ b/resources/shaders/prim_shared.glsl
@@ -30,7 +30,15 @@
#define MAX_STOPS_PER_ANGLE_GRADIENT 8
#ifdef WR_VERTEX_SHADER
+
+#define VECS_PER_LAYER 13
+#define LAYERS_PER_ROW (WR_MAX_VERTEX_TEXTURE_WIDTH / VECS_PER_LAYER)
+
+#define VECS_PER_TILE 2
+#define TILES_PER_ROW (WR_MAX_VERTEX_TEXTURE_WIDTH / VECS_PER_TILE)
+
uniform sampler2D sLayers;
+uniform sampler2D sRenderTasks;
struct Layer {
mat4 transform;
@@ -43,10 +51,6 @@ layout(std140) uniform Data {
vec4 data[WR_MAX_UBO_VECTORS];
};
-layout(std140) uniform Tiles {
- vec4 tiles[WR_MAX_UBO_VECTORS];
-};
-
Layer fetch_layer(int index) {
Layer layer;
@@ -54,8 +58,11 @@ Layer fetch_layer(int index) {
// This is required because trying to use an offset
// of more than 8 texels doesn't work on some versions
// of OSX.
- ivec2 uv0 = ivec2(0, index);
- ivec2 uv1 = ivec2(8, index);
+ int y = index / LAYERS_PER_ROW;
+ int x = VECS_PER_LAYER * (index % LAYERS_PER_ROW);
+
+ ivec2 uv0 = ivec2(x + 0, y);
+ ivec2 uv1 = ivec2(x + 8, y);
layer.transform[0] = texelFetchOffset(sLayers, uv0, 0, ivec2(0, 0));
layer.transform[1] = texelFetchOffset(sLayers, uv0, 0, ivec2(1, 0));
@@ -85,10 +92,13 @@ struct Tile {
Tile fetch_tile(int index) {
Tile tile;
- int offset = index * 2;
+ int y = index / TILES_PER_ROW;
+ int x = VECS_PER_TILE * (index % TILES_PER_ROW);
+
+ ivec2 uv = ivec2(x + 0, y);
- tile.actual_rect = tiles[offset + 0];
- tile.target_rect = tiles[offset + 1];
+ tile.actual_rect = texelFetchOffset(sRenderTasks, uv, 0, ivec2(0, 0));
+ tile.target_rect = texelFetchOffset(sRenderTasks, uv, 0, ivec2(1, 0));
return tile;
}