mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Update WR (resource cache changes, various optimizations).
This commit is contained in:
parent
4984a83f67
commit
04cd35914a
13 changed files with 32 additions and 41 deletions
|
@ -523,8 +523,6 @@ impl WebRenderFrameBuilder {
|
|||
stacking_context: &mut webrender_traits::StackingContext)
|
||||
-> DisplayListId {
|
||||
let id = api.next_display_list_id();
|
||||
stacking_context.has_stacking_contexts = stacking_context.has_stacking_contexts ||
|
||||
display_list.descriptor().has_stacking_contexts;
|
||||
stacking_context.display_lists.push(id);
|
||||
self.display_lists.push((id, display_list));
|
||||
id
|
||||
|
|
4
components/servo/Cargo.lock
generated
4
components/servo/Cargo.lock
generated
|
@ -2737,7 +2737,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#2be67987a0ff7bdd4820b65283e6fc1604cc301c"
|
||||
source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244"
|
||||
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)",
|
||||
|
@ -2762,7 +2762,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender_traits"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#2be67987a0ff7bdd4820b65283e6fc1604cc301c"
|
||||
source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244"
|
||||
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)",
|
||||
|
|
4
ports/cef/Cargo.lock
generated
4
ports/cef/Cargo.lock
generated
|
@ -2595,7 +2595,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#2be67987a0ff7bdd4820b65283e6fc1604cc301c"
|
||||
source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244"
|
||||
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)",
|
||||
|
@ -2620,7 +2620,7 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "webrender_traits"
|
||||
version = "0.8.0"
|
||||
source = "git+https://github.com/servo/webrender#2be67987a0ff7bdd4820b65283e6fc1604cc301c"
|
||||
source = "git+https://github.com/servo/webrender#8b53081a3de714f8c1296e20658fabe4e75a6244"
|
||||
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)",
|
||||
|
|
|
@ -16,7 +16,8 @@ void write_clip(ClipInfo clip) {
|
|||
clip.bottom_right.outer_inner_radius.x,
|
||||
clip.bottom_left.outer_inner_radius.x);
|
||||
//TODO: interpolate the final mask UV
|
||||
vClipMaskUvRect = clip.mask_info.uv_rect;
|
||||
vec2 texture_size = textureSize(sMask, 0);
|
||||
vClipMaskUvRect = clip.mask_info.uv_rect / texture_size.xyxy;
|
||||
vClipMaskLocalRect = clip.mask_info.local_rect; //TODO: transform
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -254,7 +254,8 @@ struct PrimitiveInstance {
|
|||
int render_task_index;
|
||||
int layer_index;
|
||||
int clip_address;
|
||||
ivec3 user_data;
|
||||
int sub_index;
|
||||
ivec2 user_data;
|
||||
};
|
||||
|
||||
PrimitiveInstance fetch_instance(int index) {
|
||||
|
@ -270,7 +271,8 @@ PrimitiveInstance fetch_instance(int index) {
|
|||
pi.render_task_index = data0.z;
|
||||
pi.layer_index = data0.w;
|
||||
pi.clip_address = data1.x;
|
||||
pi.user_data = data1.yzw;
|
||||
pi.sub_index = data1.y;
|
||||
pi.user_data = data1.zw;
|
||||
|
||||
return pi;
|
||||
}
|
||||
|
@ -302,7 +304,10 @@ struct Primitive {
|
|||
vec4 local_clip_rect;
|
||||
int prim_index;
|
||||
int clip_index;
|
||||
ivec3 user_data;
|
||||
// when sending multiple primitives of the same type (e.g. border segments)
|
||||
// this index allows the vertex shader to recognize the difference
|
||||
int sub_index;
|
||||
ivec2 user_data;
|
||||
};
|
||||
|
||||
Primitive load_primitive(int index) {
|
||||
|
@ -318,8 +323,9 @@ Primitive load_primitive(int index) {
|
|||
prim.local_clip_rect = pg.local_clip_rect;
|
||||
|
||||
prim.prim_index = pi.specific_prim_index;
|
||||
prim.user_data = pi.user_data;
|
||||
prim.clip_index = pi.clip_address;
|
||||
prim.sub_index = pi.sub_index;
|
||||
prim.user_data = pi.user_data;
|
||||
|
||||
return prim;
|
||||
}
|
||||
|
@ -588,7 +594,6 @@ struct Image {
|
|||
vec4 st_rect; // Location of the image texture in the texture atlas.
|
||||
vec4 stretch_size_and_tile_spacing; // Size of the actual image and amount of space between
|
||||
// tiled instances of this image.
|
||||
bool has_pixel_coords;
|
||||
};
|
||||
|
||||
Image fetch_image(int index) {
|
||||
|
@ -599,9 +604,6 @@ Image fetch_image(int index) {
|
|||
image.st_rect = texelFetchOffset(sData32, uv, 0, ivec2(0, 0));
|
||||
image.stretch_size_and_tile_spacing = texelFetchOffset(sData32, uv, 0, ivec2(1, 0));
|
||||
|
||||
image.has_pixel_coords = image.st_rect.z < 0.0;
|
||||
image.st_rect.z = abs(image.st_rect.z);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ void main(void) {
|
|||
prim.layer,
|
||||
prim.tile);
|
||||
|
||||
vStopCount = int(prim.user_data.y);
|
||||
vStopCount = int(prim.user_data.x);
|
||||
vPos = vi.local_clamped_pos;
|
||||
|
||||
// Snap the start/end points to device pixel units.
|
||||
|
@ -24,10 +24,8 @@ void main(void) {
|
|||
vStartPoint = floor(0.5 + gradient.start_end_point.xy * uDevicePixelRatio) / uDevicePixelRatio;
|
||||
vEndPoint = floor(0.5 + gradient.start_end_point.zw * uDevicePixelRatio) / uDevicePixelRatio;
|
||||
|
||||
int stop_index = int(prim.user_data.x);
|
||||
|
||||
for (int i=0 ; i < vStopCount ; ++i) {
|
||||
GradientStop stop = fetch_gradient_stop(stop_index + i);
|
||||
GradientStop stop = fetch_gradient_stop(prim.sub_index + i);
|
||||
vColors[i] = stop.color;
|
||||
vOffsets[i/4][i%4] = stop.offset.x;
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
void main(void) {
|
||||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
Border border = fetch_border(prim.prim_index);
|
||||
int sub_part = prim.sub_index;
|
||||
|
||||
vec2 tl_outer = prim.local_rect.xy;
|
||||
vec2 tl_inner = tl_outer + vec2(max(border.radii[0].x, border.widths.x),
|
||||
|
@ -27,7 +28,7 @@ void main(void) {
|
|||
-max(border.radii[1].w, border.widths.w));
|
||||
|
||||
vec4 segment_rect;
|
||||
switch (prim.user_data.x) {
|
||||
switch (sub_part) {
|
||||
case PST_TOP_LEFT:
|
||||
segment_rect = vec4(tl_outer, tl_inner - tl_outer);
|
||||
break;
|
||||
|
@ -92,9 +93,6 @@ void main(void) {
|
|||
vLocalRect = prim.local_rect;
|
||||
#endif
|
||||
|
||||
float x0, y0, x1, y1;
|
||||
int sub_part = prim.user_data.x;
|
||||
|
||||
switch (sub_part) {
|
||||
case PST_LEFT:
|
||||
vBorderStyle = int(border.style.x);
|
||||
|
@ -150,6 +148,7 @@ void main(void) {
|
|||
break;
|
||||
}
|
||||
|
||||
float x0, y0, x1, y1;
|
||||
switch (sub_part) {
|
||||
// These are the layer tile part PrimitivePart as uploaded by the tiling.rs
|
||||
case PST_TOP_LEFT:
|
||||
|
|
|
@ -6,14 +6,14 @@
|
|||
void main(void) {
|
||||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
BoxShadow bs = fetch_boxshadow(prim.prim_index);
|
||||
vec4 segment_rect = fetch_instance_geometry(prim.user_data.x + prim.user_data.y);
|
||||
vec4 segment_rect = fetch_instance_geometry(prim.sub_index);
|
||||
|
||||
VertexInfo vi = write_vertex(segment_rect,
|
||||
prim.local_clip_rect,
|
||||
prim.layer,
|
||||
prim.tile);
|
||||
|
||||
RenderTaskData child_task = fetch_render_task(prim.user_data.z);
|
||||
RenderTaskData child_task = fetch_render_task(prim.user_data.x);
|
||||
vUv.z = child_task.data1.x;
|
||||
|
||||
// Constant offsets to inset from bilinear filtering border.
|
||||
|
|
|
@ -7,9 +7,8 @@ void main(void) {
|
|||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
Gradient gradient = fetch_gradient(prim.prim_index);
|
||||
|
||||
int stop_index = prim.user_data.x + prim.user_data.y;
|
||||
GradientStop g0 = fetch_gradient_stop(stop_index + 0);
|
||||
GradientStop g1 = fetch_gradient_stop(stop_index + 1);
|
||||
GradientStop g0 = fetch_gradient_stop(prim.sub_index + 0);
|
||||
GradientStop g1 = fetch_gradient_stop(prim.sub_index + 1);
|
||||
|
||||
vec4 segment_rect;
|
||||
switch (int(gradient.kind.x)) {
|
||||
|
|
|
@ -7,9 +7,8 @@ void main(void) {
|
|||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
Gradient gradient = fetch_gradient(prim.prim_index);
|
||||
|
||||
int stop_index = prim.user_data.x + prim.user_data.y;
|
||||
GradientStop g0 = fetch_gradient_stop(stop_index + 0);
|
||||
GradientStop g1 = fetch_gradient_stop(stop_index + 1);
|
||||
GradientStop g0 = fetch_gradient_stop(prim.sub_index + 0);
|
||||
GradientStop g1 = fetch_gradient_stop(prim.sub_index + 1);
|
||||
|
||||
vec4 segment_rect;
|
||||
switch (int(gradient.kind.x)) {
|
||||
|
|
|
@ -23,14 +23,9 @@ void main(void) {
|
|||
#endif
|
||||
|
||||
// vUv will contain how many times this image has wrapped around the image size.
|
||||
vec2 st0 = image.st_rect.xy;
|
||||
vec2 st1 = image.st_rect.zw;
|
||||
|
||||
if (image.has_pixel_coords) {
|
||||
vec2 texture_size = vec2(textureSize(sDiffuse, 0));
|
||||
st0 /= texture_size;
|
||||
st1 /= texture_size;
|
||||
}
|
||||
vec2 st0 = image.st_rect.xy / texture_size;
|
||||
vec2 st1 = image.st_rect.zw / texture_size;
|
||||
|
||||
vTextureSize = st1 - st0;
|
||||
vTextureOffset = st0;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
void main(void) {
|
||||
Primitive prim = load_primitive(gl_InstanceID);
|
||||
TextRun text = fetch_text_run(prim.prim_index);
|
||||
Glyph glyph = fetch_glyph(prim.user_data.x + prim.user_data.y);
|
||||
Glyph glyph = fetch_glyph(prim.sub_index);
|
||||
vec4 local_rect = vec4(glyph.offset.xy, (glyph.uv_rect.zw - glyph.uv_rect.xy) / uDevicePixelRatio);
|
||||
|
||||
#ifdef WR_FEATURE_TRANSFORM
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#define varying in
|
||||
|
||||
// Uniform inputs
|
||||
uniform sampler2D sMask;
|
||||
|
||||
// Fragment shader outputs
|
||||
out vec4 oFragColor;
|
||||
|
@ -35,6 +34,7 @@
|
|||
// Shared shader uniforms
|
||||
//======================================================================================
|
||||
uniform sampler2D sDiffuse;
|
||||
uniform sampler2D sMask;
|
||||
|
||||
//======================================================================================
|
||||
// Interpolator definitions
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue