Skip to content

Commit

Permalink
Update webrender + shaders (border AA improvements, float packing work).
Browse files Browse the repository at this point in the history
  • Loading branch information
gw3583 committed Aug 30, 2016
1 parent a338bea commit e75386f
Show file tree
Hide file tree
Showing 11 changed files with 180 additions and 128 deletions.
4 changes: 2 additions & 2 deletions components/servo/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ports/cef/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 16 additions & 17 deletions resources/shaders/prim_shared.glsl
Expand Up @@ -3,15 +3,14 @@
* 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/. */

#define PST_INVALID uint(0)
#define PST_TOP_LEFT uint(1)
#define PST_TOP_RIGHT uint(2)
#define PST_BOTTOM_LEFT uint(3)
#define PST_BOTTOM_RIGHT uint(4)
#define PST_TOP uint(5)
#define PST_LEFT uint(6)
#define PST_BOTTOM uint(7)
#define PST_RIGHT uint(8)
#define PST_TOP_LEFT uint(0)
#define PST_TOP_RIGHT uint(1)
#define PST_BOTTOM_LEFT uint(2)
#define PST_BOTTOM_RIGHT uint(3)
#define PST_TOP uint(4)
#define PST_LEFT uint(5)
#define PST_BOTTOM uint(6)
#define PST_RIGHT uint(7)

// Border styles as defined in webrender_traits/types.rs
#define BORDER_STYLE_NONE uint(0)
Expand All @@ -38,16 +37,16 @@ layout(std140) uniform Layers {
};

struct Tile {
uvec4 actual_rect;
uvec4 target_rect;
vec4 actual_rect;
vec4 target_rect;
};

layout(std140) uniform Tiles {
Tile tiles[WR_MAX_PRIM_TILES];
};

struct PrimitiveInfo {
uvec4 layer_tile_part;
uvec4 layer_tile;
vec4 local_clip_rect;
vec4 local_rect;
};
Expand Down Expand Up @@ -111,8 +110,8 @@ struct VertexInfo {
};

VertexInfo write_vertex(PrimitiveInfo info) {
Layer layer = layers[info.layer_tile_part.x];
Tile tile = tiles[info.layer_tile_part.y];
Layer layer = layers[info.layer_tile.x];
Tile tile = tiles[info.layer_tile.y];

vec2 p0 = floor(0.5 + info.local_rect.xy * uDevicePixelRatio) / uDevicePixelRatio;
vec2 p1 = floor(0.5 + (info.local_rect.xy + info.local_rect.zw) * uDevicePixelRatio) / uDevicePixelRatio;
Expand Down Expand Up @@ -153,8 +152,8 @@ struct TransformVertexInfo {
};

TransformVertexInfo write_transform_vertex(PrimitiveInfo info) {
Layer layer = layers[info.layer_tile_part.x];
Tile tile = tiles[info.layer_tile_part.y];
Layer layer = layers[info.layer_tile.x];
Tile tile = tiles[info.layer_tile.y];

vec2 lp0 = info.local_rect.xy;
vec2 lp1 = info.local_rect.xy + info.local_rect.zw;
Expand Down Expand Up @@ -198,7 +197,7 @@ TransformVertexInfo write_transform_vertex(PrimitiveInfo info) {
max_pos_clamped,
aPosition.xy);

vec3 layer_pos = get_layer_pos(clamped_pos / uDevicePixelRatio, info.layer_tile_part.x);
vec3 layer_pos = get_layer_pos(clamped_pos / uDevicePixelRatio, info.layer_tile.x);

vec2 final_pos = clamped_pos + vec2(tile.target_rect.xy) - vec2(tile.actual_rect.xy);

Expand Down
2 changes: 1 addition & 1 deletion resources/shaders/ps_angle_gradient.vs.glsl
Expand Up @@ -6,7 +6,7 @@
struct AngleGradient {
PrimitiveInfo info;
vec4 start_end_point;
uvec4 stop_count;
vec4 stop_count;
vec4 colors[MAX_STOPS_PER_ANGLE_GRADIENT];
vec4 offsets[MAX_STOPS_PER_ANGLE_GRADIENT/4];
};
Expand Down
4 changes: 2 additions & 2 deletions resources/shaders/ps_blend.vs.glsl
Expand Up @@ -4,8 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

struct Blend {
uvec4 target_rect;
uvec4 src_rect;
vec4 target_rect;
vec4 src_rect;
vec4 opacity;
};

Expand Down

0 comments on commit e75386f

Please sign in to comment.