Skip to content

Commit

Permalink
Auto merge of #12741 - changm:shader, r=ConnorGBrewster
Browse files Browse the repository at this point in the history
update servo to use webrender shaders

<!-- Please describe your changes on the following line: -->
Pulls shaders from webrender and update the webrender commit.
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X ] `./mach build -d` does not report any errors
- [ X] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [X ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/12741)
<!-- Reviewable:end -->
  • Loading branch information
bors-servo committed Aug 5, 2016
2 parents 414204c + 7699380 commit fc4fc77
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion components/servo/Cargo.lock

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

2 changes: 1 addition & 1 deletion ports/cef/Cargo.lock

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

2 changes: 1 addition & 1 deletion resources/shaders/ps_angle_gradient.fs.glsl
Expand Up @@ -21,7 +21,7 @@ void main(void) {
float sa = sin(angle);
float ca = cos(angle);

float sx = vStartPoint.x * ca - vStartPoint.y * sa;
float sx = vStartPoint.x * ca - vStartPoint.y * sa;
float ex = vEndPoint.x * ca - vEndPoint.y * sa;
float d = ex - sx;

Expand Down
10 changes: 6 additions & 4 deletions resources/shaders/ps_border.fs.glsl
Expand Up @@ -28,7 +28,7 @@ vec4 draw_dotted_edge() {
// like firefox.
float circleSpacing = diameter * 2.2;

vec2 size = vec2(vBorders.z, vBorders.w);
vec2 size = vBorders.zw;
// Get our position within this specific segment
vec2 position = vDevicePos - vBorders.xy;

Expand Down Expand Up @@ -68,15 +68,16 @@ vec2 get_dashed_nudge_factor(vec2 dash_size, bool is_corner) {
bool xAxisFudge = vBorders.z > vBorders.w;
if (xAxisFudge) {
return vec2(dash_size.x / 2.0, 0);
} else {
return vec2(0.0, dash_size.y / 2.0);
}

return vec2(0.0, dash_size.y / 2.0);
}

vec4 draw_dashed_edge(bool is_corner) {
// Everything here should be in device pixels.
// We want the dot to be roughly the size of the whole border spacing
// 5.5 here isn't a magic number, it's just what mostly looks like FF/Chrome
// TODO: Investigate exactly what FF does.
float dash_interval = min(vBorders.w, vBorders.z) * 5.5;
vec2 edge_size = vec2(vBorders.z, vBorders.w);
vec2 dash_size = vec2(dash_interval / 2.0, dash_interval / 2.0);
Expand Down Expand Up @@ -143,6 +144,8 @@ void draw_dashed_border(void) {
}
}

// TODO: Investigate performance of this shader and see
// if it's worthwhile splitting it / removing branches etc.
void main(void) {
if (vRadii.x > 0.0 &&
(distance(vRefPoint, vLocalPos) > vRadii.x ||
Expand Down Expand Up @@ -178,7 +181,6 @@ void main(void) {
default:
{
discard;
break;
}
}
}
4 changes: 1 addition & 3 deletions resources/shaders/ps_border.vs.glsl
Expand Up @@ -107,7 +107,5 @@ void main(void) {
vDevicePos = vi.global_clamped_pos;

// These are in device space
vBorders = vec4(border.info.local_rect.x, border.info.local_rect.y,
border.info.local_rect.z,
border.info.local_rect.w) * uDevicePixelRatio;
vBorders = border.info.local_rect * uDevicePixelRatio;
}
4 changes: 2 additions & 2 deletions resources/shaders/ps_box_shadow.vs.glsl
Expand Up @@ -4,8 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

struct BoxShadow {
PrimitiveInfo info;
vec4 color;
PrimitiveInfo info;
vec4 color;
vec4 border_radii_blur_radius_inverted;
vec4 bs_rect;
vec4 src_rect;
Expand Down
2 changes: 1 addition & 1 deletion resources/shaders/ps_gradient.vs.glsl
Expand Up @@ -7,7 +7,7 @@
#define DIR_VERTICAL uint(1)

struct Gradient {
PrimitiveInfo info;
PrimitiveInfo info;
vec4 color0;
vec4 color1;
uvec4 dir;
Expand Down
6 changes: 3 additions & 3 deletions resources/shaders/shared.glsl
Expand Up @@ -9,11 +9,11 @@
#define varying out

// Uniform inputs
uniform mat4 uTransform; // Orthographic projection
uniform float uDevicePixelRatio;
uniform mat4 uTransform; // Orthographic projection
uniform float uDevicePixelRatio;

// Attribute inputs
in vec3 aPosition;
in vec3 aPosition;
#endif

//======================================================================================
Expand Down
4 changes: 2 additions & 2 deletions resources/shaders/shared_other.glsl
Expand Up @@ -11,8 +11,8 @@

// box-shadow
in vec4 aBorderPosition;
in vec4 aBorderRadii;
in float aBlurRadius;
in vec4 aBorderRadii;
in float aBlurRadius;

// blur
in vec2 aDestTextureSize;
Expand Down

0 comments on commit fc4fc77

Please sign in to comment.