mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Auto merge of #12985 - glennw:shader-cleanup, r=Manishearth
Remove some unused shaders. <!-- 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/12985) <!-- Reviewable:end -->
This commit is contained in:
commit
f84e01ecaf
8 changed files with 0 additions and 138 deletions
|
@ -1,41 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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/. */
|
|
||||||
|
|
||||||
/*
|
|
||||||
Ellipse equation:
|
|
||||||
|
|
||||||
(x-h)^2 (y-k)^2
|
|
||||||
------- + ------- <= 1
|
|
||||||
rx^2 ry^2
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
float Value(vec2 position) {
|
|
||||||
float outer_rx = vBorderRadii.x;
|
|
||||||
float outer_ry = vBorderRadii.y;
|
|
||||||
float outer_dx = position.x * position.x / (outer_rx * outer_rx);
|
|
||||||
float outer_dy = position.y * position.y / (outer_ry * outer_ry);
|
|
||||||
if (outer_dx + outer_dy > 1.0)
|
|
||||||
return 0.0;
|
|
||||||
|
|
||||||
float inner_rx = vBorderRadii.z;
|
|
||||||
float inner_ry = vBorderRadii.w;
|
|
||||||
if (inner_rx == 0.0 || inner_ry == 0.0)
|
|
||||||
return 1.0;
|
|
||||||
|
|
||||||
float inner_dx = position.x * position.x / (inner_rx * inner_rx);
|
|
||||||
float inner_dy = position.y * position.y / (inner_ry * inner_ry);
|
|
||||||
return inner_dx + inner_dy >= 1.0 ? 1.0 : 0.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void main(void)
|
|
||||||
{
|
|
||||||
vec2 position = vPosition - vBorderPosition.xy;
|
|
||||||
vec4 pixelBounds = vec4(floor(position.x), floor(position.y),
|
|
||||||
ceil(position.x), ceil(position.y));
|
|
||||||
float value = (Value(pixelBounds.xy) + Value(pixelBounds.zy) +
|
|
||||||
Value(pixelBounds.xw) + Value(pixelBounds.zw)) / 4.0;
|
|
||||||
SetFragColor(vec4(vColor.rgb, mix(1.0 - vColor.a, vColor.a, value)));
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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/. */
|
|
||||||
|
|
||||||
void main(void)
|
|
||||||
{
|
|
||||||
vColor = aColorRectTL;
|
|
||||||
vPosition = aPosition.xy;
|
|
||||||
vBorderPosition = aBorderPosition;
|
|
||||||
vBorderRadii = aBorderRadii;
|
|
||||||
gl_Position = uTransform * vec4(aPosition, 1.0);
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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/. */
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
init_transform_fs(vLocalPos, vLocalRect);
|
|
||||||
oFragColor = texture(sDiffuse, vUv / vLocalPos.z);
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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/. */
|
|
||||||
|
|
||||||
varying vec2 vUv;
|
|
||||||
|
|
||||||
varying vec3 vLocalPos;
|
|
||||||
flat varying vec4 vLocalRect;
|
|
|
@ -1,29 +0,0 @@
|
||||||
#line 1
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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/. */
|
|
||||||
|
|
||||||
struct Image {
|
|
||||||
PrimitiveInfo info;
|
|
||||||
vec4 st_rect;
|
|
||||||
vec4 stretch_size; // Size of the actual image.
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std140) uniform Items {
|
|
||||||
Image images[WR_MAX_PRIM_ITEMS];
|
|
||||||
};
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
Image image = images[gl_InstanceID];
|
|
||||||
|
|
||||||
TransformVertexInfo vi = write_transform_vertex(image.info);
|
|
||||||
|
|
||||||
vLocalRect = image.info.local_rect;
|
|
||||||
vLocalPos = vi.local_pos;
|
|
||||||
|
|
||||||
vec2 f = (vi.local_pos.xy - image.info.local_rect.xy) / image.info.local_rect.zw;
|
|
||||||
|
|
||||||
vUv = mix(image.st_rect.xy,
|
|
||||||
image.st_rect.zw,
|
|
||||||
f);
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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/. */
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
init_transform_fs(vLocalPos, vLocalRect);
|
|
||||||
oFragColor = vColor;
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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/. */
|
|
||||||
|
|
||||||
varying vec4 vColor;
|
|
||||||
|
|
||||||
varying vec3 vLocalPos;
|
|
||||||
flat varying vec4 vLocalRect;
|
|
|
@ -1,24 +0,0 @@
|
||||||
#line 1
|
|
||||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
* 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/. */
|
|
||||||
|
|
||||||
struct Rectangle {
|
|
||||||
PrimitiveInfo info;
|
|
||||||
vec4 color;
|
|
||||||
};
|
|
||||||
|
|
||||||
layout(std140) uniform Items {
|
|
||||||
Rectangle rects[WR_MAX_PRIM_ITEMS];
|
|
||||||
};
|
|
||||||
|
|
||||||
void main(void) {
|
|
||||||
Rectangle rect = rects[gl_InstanceID];
|
|
||||||
|
|
||||||
TransformVertexInfo vi = write_transform_vertex(rect.info);
|
|
||||||
|
|
||||||
vLocalRect = rect.info.local_rect;
|
|
||||||
vLocalPos = vi.local_pos;
|
|
||||||
|
|
||||||
vColor = rect.color;
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue