mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Update webrender + shaders.
This commit is contained in:
parent
8334020a87
commit
15f4d7c587
5 changed files with 38 additions and 13 deletions
4
components/servo/Cargo.lock
generated
4
components/servo/Cargo.lock
generated
|
@ -2644,7 +2644,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webrender"
|
name = "webrender"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
|
source = "git+https://github.com/servo/webrender#37dab545df3a9b6aa5e762f59272eb3d37227476"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2669,7 +2669,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webrender_traits"
|
name = "webrender_traits"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
|
source = "git+https://github.com/servo/webrender#37dab545df3a9b6aa5e762f59272eb3d37227476"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -156,6 +156,8 @@ impl<Window> Browser<Window> where Window: WindowMethods + 'static {
|
||||||
enable_profiler: opts.webrender_stats,
|
enable_profiler: opts.webrender_stats,
|
||||||
debug: opts.webrender_debug,
|
debug: opts.webrender_debug,
|
||||||
enable_recording: false,
|
enable_recording: false,
|
||||||
|
precache_shaders: opts.precache_shaders,
|
||||||
|
enable_scrollbars: opts.output_file.is_none(),
|
||||||
});
|
});
|
||||||
(Some(webrender), Some(webrender_sender))
|
(Some(webrender), Some(webrender_sender))
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -200,6 +200,11 @@ pub struct Opts {
|
||||||
/// True to show webrender debug on screen.
|
/// True to show webrender debug on screen.
|
||||||
pub webrender_debug: bool,
|
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.
|
/// True if WebRender should use multisample antialiasing.
|
||||||
pub use_msaa: bool,
|
pub use_msaa: bool,
|
||||||
|
|
||||||
|
@ -313,6 +318,10 @@ pub struct DebugOptions {
|
||||||
// don't skip any backtraces on panic
|
// don't skip any backtraces on panic
|
||||||
pub full_backtraces: bool,
|
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,
|
"wr-debug" => debug_options.webrender_debug = true,
|
||||||
"msaa" => debug_options.use_msaa = true,
|
"msaa" => debug_options.use_msaa = true,
|
||||||
"full-backtraces" => debug_options.full_backtraces = true,
|
"full-backtraces" => debug_options.full_backtraces = true,
|
||||||
|
"precache-shaders" => debug_options.precache_shaders = true,
|
||||||
"" => {},
|
"" => {},
|
||||||
_ => return Err(option)
|
_ => return Err(option)
|
||||||
};
|
};
|
||||||
|
@ -400,6 +410,7 @@ pub fn print_debug_usage(app: &str) -> ! {
|
||||||
print_option("msaa", "Use multisample antialiasing in WebRender.");
|
print_option("msaa", "Use multisample antialiasing in WebRender.");
|
||||||
print_option("full-backtraces", "Print full backtraces for all errors");
|
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("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!("");
|
println!("");
|
||||||
|
|
||||||
|
@ -537,6 +548,7 @@ pub fn default_opts() -> Opts {
|
||||||
full_backtraces: false,
|
full_backtraces: false,
|
||||||
is_printing_version: false,
|
is_printing_version: false,
|
||||||
webrender_debug: 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,
|
full_backtraces: debug_options.full_backtraces,
|
||||||
is_printing_version: is_printing_version,
|
is_printing_version: is_printing_version,
|
||||||
webrender_debug: debug_options.webrender_debug,
|
webrender_debug: debug_options.webrender_debug,
|
||||||
|
precache_shaders: debug_options.precache_shaders,
|
||||||
};
|
};
|
||||||
|
|
||||||
set_defaults(opts);
|
set_defaults(opts);
|
||||||
|
|
4
ports/cef/Cargo.lock
generated
4
ports/cef/Cargo.lock
generated
|
@ -2504,7 +2504,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webrender"
|
name = "webrender"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
|
source = "git+https://github.com/servo/webrender#37dab545df3a9b6aa5e762f59272eb3d37227476"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"bincode 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -2529,7 +2529,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "webrender_traits"
|
name = "webrender_traits"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
source = "git+https://github.com/servo/webrender#db07ba36d02570b3fc70e9b31df7b09af3009abe"
|
source = "git+https://github.com/servo/webrender#37dab545df3a9b6aa5e762f59272eb3d37227476"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"app_units 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"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)",
|
"byteorder 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
|
|
@ -30,7 +30,15 @@
|
||||||
#define MAX_STOPS_PER_ANGLE_GRADIENT 8
|
#define MAX_STOPS_PER_ANGLE_GRADIENT 8
|
||||||
|
|
||||||
#ifdef WR_VERTEX_SHADER
|
#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 sLayers;
|
||||||
|
uniform sampler2D sRenderTasks;
|
||||||
|
|
||||||
struct Layer {
|
struct Layer {
|
||||||
mat4 transform;
|
mat4 transform;
|
||||||
|
@ -43,10 +51,6 @@ layout(std140) uniform Data {
|
||||||
vec4 data[WR_MAX_UBO_VECTORS];
|
vec4 data[WR_MAX_UBO_VECTORS];
|
||||||
};
|
};
|
||||||
|
|
||||||
layout(std140) uniform Tiles {
|
|
||||||
vec4 tiles[WR_MAX_UBO_VECTORS];
|
|
||||||
};
|
|
||||||
|
|
||||||
Layer fetch_layer(int index) {
|
Layer fetch_layer(int index) {
|
||||||
Layer layer;
|
Layer layer;
|
||||||
|
|
||||||
|
@ -54,8 +58,11 @@ Layer fetch_layer(int index) {
|
||||||
// This is required because trying to use an offset
|
// This is required because trying to use an offset
|
||||||
// of more than 8 texels doesn't work on some versions
|
// of more than 8 texels doesn't work on some versions
|
||||||
// of OSX.
|
// of OSX.
|
||||||
ivec2 uv0 = ivec2(0, index);
|
int y = index / LAYERS_PER_ROW;
|
||||||
ivec2 uv1 = ivec2(8, index);
|
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[0] = texelFetchOffset(sLayers, uv0, 0, ivec2(0, 0));
|
||||||
layer.transform[1] = texelFetchOffset(sLayers, uv0, 0, ivec2(1, 0));
|
layer.transform[1] = texelFetchOffset(sLayers, uv0, 0, ivec2(1, 0));
|
||||||
|
@ -85,10 +92,13 @@ struct Tile {
|
||||||
Tile fetch_tile(int index) {
|
Tile fetch_tile(int index) {
|
||||||
Tile tile;
|
Tile tile;
|
||||||
|
|
||||||
int offset = index * 2;
|
int y = index / TILES_PER_ROW;
|
||||||
|
int x = VECS_PER_TILE * (index % TILES_PER_ROW);
|
||||||
|
|
||||||
tile.actual_rect = tiles[offset + 0];
|
ivec2 uv = ivec2(x + 0, y);
|
||||||
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;
|
return tile;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue