diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2016-08-08 16:39:08 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-08 16:39:08 -0500 |
commit | 1f4dd8765fe06784f052765f63f3e4869faf8164 (patch) | |
tree | 603afd17a7430cf94ab9656d312815e7d50d7396 | |
parent | 8cd4b772e90224b344010cc6c38cebe47ce10c48 (diff) | |
parent | ce01120fb1b048f0577237a09a586bd06caf428e (diff) | |
download | servo-1f4dd8765fe06784f052765f63f3e4869faf8164.tar.gz servo-1f4dd8765fe06784f052765f63f3e4869faf8164.zip |
Auto merge of #12779 - glennw:wr-shaders-tidy, r=pcwalton
Remove some unused WR1 shaders, copy new shaders, update WR hash.
<!-- Please describe your changes on the following line: -->
---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [ ] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).
<!-- Either: -->
- [ ] 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/12779)
<!-- Reviewable:end -->
22 files changed, 81 insertions, 332 deletions
diff --git a/components/servo/Cargo.lock b/components/servo/Cargo.lock index 6a1927a08a7..9077a2cd23e 100644 --- a/components/servo/Cargo.lock +++ b/components/servo/Cargo.lock @@ -2554,7 +2554,7 @@ dependencies = [ [[package]] name = "webrender" version = "0.1.0" -source = "git+https://github.com/servo/webrender#66b7134918a56c561cbdf72ab284f5da83459ec4" +source = "git+https://github.com/servo/webrender#e2e8d91f24de961bfd6b53338e2403bc0c675aab" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/ports/cef/Cargo.lock b/ports/cef/Cargo.lock index 76b49f1f76a..f5453c236b4 100644 --- a/ports/cef/Cargo.lock +++ b/ports/cef/Cargo.lock @@ -2416,7 +2416,7 @@ dependencies = [ [[package]] name = "webrender" version = "0.1.0" -source = "git+https://github.com/servo/webrender#66b7134918a56c561cbdf72ab284f5da83459ec4" +source = "git+https://github.com/servo/webrender#e2e8d91f24de961bfd6b53338e2403bc0c675aab" dependencies = [ "app_units 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/resources/shaders/blit.fs.glsl b/resources/shaders/blit.fs.glsl deleted file mode 100644 index 135553a8029..00000000000 --- a/resources/shaders/blit.fs.glsl +++ /dev/null @@ -1,9 +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) -{ - vec4 diffuse = Texture(sDiffuse, vColorTexCoord); - SetFragColor(diffuse * vColor); -} diff --git a/resources/shaders/blit.vs.glsl b/resources/shaders/blit.vs.glsl deleted file mode 100644 index 4d1e4dad739..00000000000 --- a/resources/shaders/blit.vs.glsl +++ /dev/null @@ -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 / 255.0; - vColorTexCoord = aColorTexCoordRectTop.xy; - vec4 pos = vec4(aPosition, 1.0); - pos.xy = SnapToPixels(pos.xy); - gl_Position = uTransform * pos; -} diff --git a/resources/shaders/clear.fs.glsl b/resources/shaders/clear.fs.glsl deleted file mode 100644 index 658ac27488c..00000000000 --- a/resources/shaders/clear.fs.glsl +++ /dev/null @@ -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) -{ - SetFragColor(vColor); -} diff --git a/resources/shaders/clear.vs.glsl b/resources/shaders/clear.vs.glsl deleted file mode 100644 index 491f3ea3863..00000000000 --- a/resources/shaders/clear.vs.glsl +++ /dev/null @@ -1,9 +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 / 255.0; - gl_Position = uTransform * vec4(aPosition, 1.0); -} diff --git a/resources/shaders/mask.fs.glsl b/resources/shaders/mask.fs.glsl deleted file mode 100644 index 658ac27488c..00000000000 --- a/resources/shaders/mask.fs.glsl +++ /dev/null @@ -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) -{ - SetFragColor(vColor); -} diff --git a/resources/shaders/mask.vs.glsl b/resources/shaders/mask.vs.glsl deleted file mode 100644 index 491f3ea3863..00000000000 --- a/resources/shaders/mask.vs.glsl +++ /dev/null @@ -1,9 +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 / 255.0; - gl_Position = uTransform * vec4(aPosition, 1.0); -} diff --git a/resources/shaders/prim_shared.glsl b/resources/shaders/prim_shared.glsl index 7c21cada7fa..ad2ab82e94b 100644 --- a/resources/shaders/prim_shared.glsl +++ b/resources/shaders/prim_shared.glsl @@ -146,6 +146,53 @@ VertexInfo write_vertex(PrimitiveInfo info) { VertexInfo vi = VertexInfo(Rect(p0, p1), local_clamped_pos.xy, clamped_pos.xy); return vi; } + +struct TransformVertexInfo { + vec3 local_pos; +}; + +TransformVertexInfo write_transform_vertex(PrimitiveInfo info) { + Layer layer = layers[info.layer_tile_part.x]; + Tile tile = tiles[info.layer_tile_part.y]; + + vec2 p0 = info.local_rect.xy; + vec2 p1 = info.local_rect.xy + vec2(info.local_rect.z, 0.0); + vec2 p2 = info.local_rect.xy + vec2(0.0, info.local_rect.w); + vec2 p3 = info.local_rect.xy + info.local_rect.zw; + + vec4 t0 = layer.transform * vec4(p0, 0, 1); + vec4 t1 = layer.transform * vec4(p1, 0, 1); + vec4 t2 = layer.transform * vec4(p2, 0, 1); + vec4 t3 = layer.transform * vec4(p3, 0, 1); + + vec2 tp0 = t0.xy / t0.w; + vec2 tp1 = t1.xy / t1.w; + vec2 tp2 = t2.xy / t2.w; + vec2 tp3 = t3.xy / t3.w; + + vec2 min_pos = min(tp0.xy, min(tp1.xy, min(tp2.xy, tp3.xy))); + vec2 max_pos = max(tp0.xy, max(tp1.xy, max(tp2.xy, tp3.xy))); + + vec2 min_pos_clamped = clamp(min_pos * uDevicePixelRatio, + vec2(tile.actual_rect.xy), + vec2(tile.actual_rect.xy + tile.actual_rect.zw)); + + vec2 max_pos_clamped = clamp(max_pos * uDevicePixelRatio, + vec2(tile.actual_rect.xy), + vec2(tile.actual_rect.xy + tile.actual_rect.zw)); + + vec2 clamped_pos = mix(min_pos_clamped, + max_pos_clamped, + aPosition.xy); + + vec3 layer_pos = get_layer_pos(clamped_pos / uDevicePixelRatio, info.layer_tile_part.x); + + vec2 final_pos = clamped_pos + vec2(tile.target_rect.xy) - vec2(tile.actual_rect.xy); + + gl_Position = uTransform * vec4(final_pos, 0, 1); + + return TransformVertexInfo(layer_pos); +} #endif #ifdef WR_FRAGMENT_SHADER @@ -177,4 +224,14 @@ bool point_in_rect(vec2 p, vec2 p0, vec2 p1) { p.x <= p1.x && p.y <= p1.y; } + +vec2 init_transform_fs(vec3 local_pos, vec4 local_rect) { + vec2 pos = local_pos.xy / local_pos.z; + + if (!point_in_rect(pos, local_rect.xy, local_rect.xy + local_rect.zw)) { + discard; + } + + return pos; +} #endif diff --git a/resources/shaders/ps_angle_gradient.vs.glsl b/resources/shaders/ps_angle_gradient.vs.glsl index 16296967bdb..3b1601f2f54 100644 --- a/resources/shaders/ps_angle_gradient.vs.glsl +++ b/resources/shaders/ps_angle_gradient.vs.glsl @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ struct AngleGradient { - PrimitiveInfo info; + PrimitiveInfo info; vec4 start_end_point; uvec4 stop_count; vec4 colors[MAX_STOPS_PER_ANGLE_GRADIENT]; diff --git a/resources/shaders/ps_image_transform.fs.glsl b/resources/shaders/ps_image_transform.fs.glsl index 57fdc563ade..b12b266328b 100644 --- a/resources/shaders/ps_image_transform.fs.glsl +++ b/resources/shaders/ps_image_transform.fs.glsl @@ -3,11 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ void main(void) { - vec2 pos = vPos.xy / vPos.z; - - if (!point_in_rect(pos, vRect.xy, vRect.xy + vRect.zw)) { - discard; - } - - oFragColor = texture(sDiffuse, vUv / vPos.z); + init_transform_fs(vLocalPos, vLocalRect); + oFragColor = texture(sDiffuse, vUv / vLocalPos.z); } diff --git a/resources/shaders/ps_image_transform.glsl b/resources/shaders/ps_image_transform.glsl index 77c0eb20719..d4aed4a5161 100644 --- a/resources/shaders/ps_image_transform.glsl +++ b/resources/shaders/ps_image_transform.glsl @@ -4,5 +4,5 @@ varying vec2 vUv; -varying vec3 vPos; -flat varying vec4 vRect; +varying vec3 vLocalPos; +flat varying vec4 vLocalRect; diff --git a/resources/shaders/ps_image_transform.vs.glsl b/resources/shaders/ps_image_transform.vs.glsl index b9fcf7c24c2..bb79aea1bec 100644 --- a/resources/shaders/ps_image_transform.vs.glsl +++ b/resources/shaders/ps_image_transform.vs.glsl @@ -15,51 +15,15 @@ layout(std140) uniform Items { void main(void) { Image image = images[gl_InstanceID]; - Layer layer = layers[image.info.layer_tile_part.x]; - Tile tile = tiles[image.info.layer_tile_part.y]; - vec2 p0 = image.info.local_rect.xy; - vec2 p1 = image.info.local_rect.xy + vec2(image.info.local_rect.z, 0.0); - vec2 p2 = image.info.local_rect.xy + vec2(0.0, image.info.local_rect.w); - vec2 p3 = image.info.local_rect.xy + image.info.local_rect.zw; + TransformVertexInfo vi = write_transform_vertex(image.info); - vec4 t0 = layer.transform * vec4(p0, 0, 1); - vec4 t1 = layer.transform * vec4(p1, 0, 1); - vec4 t2 = layer.transform * vec4(p2, 0, 1); - vec4 t3 = layer.transform * vec4(p3, 0, 1); + vLocalRect = image.info.local_rect; + vLocalPos = vi.local_pos; - vec2 tp0 = t0.xy / t0.w; - vec2 tp1 = t1.xy / t1.w; - vec2 tp2 = t2.xy / t2.w; - vec2 tp3 = t3.xy / t3.w; - - vec2 min_pos = min(tp0.xy, min(tp1.xy, min(tp2.xy, tp3.xy))); - vec2 max_pos = max(tp0.xy, max(tp1.xy, max(tp2.xy, tp3.xy))); - - vec2 min_pos_clamped = clamp(min_pos * uDevicePixelRatio, - vec2(tile.actual_rect.xy), - vec2(tile.actual_rect.xy + tile.actual_rect.zw)); - - vec2 max_pos_clamped = clamp(max_pos * uDevicePixelRatio, - vec2(tile.actual_rect.xy), - vec2(tile.actual_rect.xy + tile.actual_rect.zw)); - - vec2 clamped_pos = mix(min_pos_clamped, - max_pos_clamped, - aPosition.xy); - - vec3 layer_pos = get_layer_pos(clamped_pos / uDevicePixelRatio, image.info.layer_tile_part.x); - - vRect = image.info.local_rect; - vPos = layer_pos; - - vec2 f = (layer_pos.xy - image.info.local_rect.xy) / image.info.local_rect.zw; + 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); - - vec2 final_pos = clamped_pos + vec2(tile.target_rect.xy) - vec2(tile.actual_rect.xy); - - gl_Position = uTransform * vec4(final_pos, 0, 1); } diff --git a/resources/shaders/ps_rectangle.vs.glsl b/resources/shaders/ps_rectangle.vs.glsl index 01a4e5dc185..ee2adacec2d 100644 --- a/resources/shaders/ps_rectangle.vs.glsl +++ b/resources/shaders/ps_rectangle.vs.glsl @@ -4,8 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ struct Rectangle { - PrimitiveInfo info; - vec4 color; + PrimitiveInfo info; + vec4 color; }; layout(std140) uniform Items { diff --git a/resources/shaders/ps_rectangle_clip.vs.glsl b/resources/shaders/ps_rectangle_clip.vs.glsl index b181638d010..da39ff9fd6f 100644 --- a/resources/shaders/ps_rectangle_clip.vs.glsl +++ b/resources/shaders/ps_rectangle_clip.vs.glsl @@ -4,8 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ struct Rectangle { - PrimitiveInfo info; - vec4 color; + PrimitiveInfo info; + vec4 color; Clip clip; }; diff --git a/resources/shaders/ps_rectangle_transform.fs.glsl b/resources/shaders/ps_rectangle_transform.fs.glsl index a8ac40a8451..7552a01e6d3 100644 --- a/resources/shaders/ps_rectangle_transform.fs.glsl +++ b/resources/shaders/ps_rectangle_transform.fs.glsl @@ -3,11 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ void main(void) { - vec2 pos = vPos.xy / vPos.z; - - if (!point_in_rect(pos, vRect.xy, vRect.xy + vRect.zw)) { - discard; - } - - oFragColor = vColor; + init_transform_fs(vLocalPos, vLocalRect); + oFragColor = vColor; } diff --git a/resources/shaders/ps_rectangle_transform.glsl b/resources/shaders/ps_rectangle_transform.glsl index 0ae7f839aa9..e8990e9627a 100644 --- a/resources/shaders/ps_rectangle_transform.glsl +++ b/resources/shaders/ps_rectangle_transform.glsl @@ -4,5 +4,5 @@ varying vec4 vColor; -varying vec3 vPos; -flat varying vec4 vRect; +varying vec3 vLocalPos; +flat varying vec4 vLocalRect; diff --git a/resources/shaders/ps_rectangle_transform.vs.glsl b/resources/shaders/ps_rectangle_transform.vs.glsl index 0df46710492..b21f85158c5 100644 --- a/resources/shaders/ps_rectangle_transform.vs.glsl +++ b/resources/shaders/ps_rectangle_transform.vs.glsl @@ -4,8 +4,8 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ struct Rectangle { - PrimitiveInfo info; - vec4 color; + PrimitiveInfo info; + vec4 color; }; layout(std140) uniform Items { @@ -14,46 +14,11 @@ layout(std140) uniform Items { void main(void) { Rectangle rect = rects[gl_InstanceID]; - Layer layer = layers[rect.info.layer_tile_part.x]; - Tile tile = tiles[rect.info.layer_tile_part.y]; - vec2 p0 = rect.info.local_rect.xy; - vec2 p1 = rect.info.local_rect.xy + vec2(rect.info.local_rect.z, 0.0); - vec2 p2 = rect.info.local_rect.xy + vec2(0.0, rect.info.local_rect.w); - vec2 p3 = rect.info.local_rect.xy + rect.info.local_rect.zw; + TransformVertexInfo vi = write_transform_vertex(rect.info); - vec4 t0 = layer.transform * vec4(p0, 0, 1); - vec4 t1 = layer.transform * vec4(p1, 0, 1); - vec4 t2 = layer.transform * vec4(p2, 0, 1); - vec4 t3 = layer.transform * vec4(p3, 0, 1); + vLocalRect = rect.info.local_rect; + vLocalPos = vi.local_pos; - vec2 tp0 = t0.xy / t0.w; - vec2 tp1 = t1.xy / t1.w; - vec2 tp2 = t2.xy / t2.w; - vec2 tp3 = t3.xy / t3.w; - - vec2 min_pos = min(tp0.xy, min(tp1.xy, min(tp2.xy, tp3.xy))); - vec2 max_pos = max(tp0.xy, max(tp1.xy, max(tp2.xy, tp3.xy))); - - vec2 min_pos_clamped = clamp(min_pos * uDevicePixelRatio, - vec2(tile.actual_rect.xy), - vec2(tile.actual_rect.xy + tile.actual_rect.zw)); - - vec2 max_pos_clamped = clamp(max_pos * uDevicePixelRatio, - vec2(tile.actual_rect.xy), - vec2(tile.actual_rect.xy + tile.actual_rect.zw)); - - vec2 clamped_pos = mix(min_pos_clamped, - max_pos_clamped, - aPosition.xy); - - vec3 layer_pos = get_layer_pos(clamped_pos / uDevicePixelRatio, rect.info.layer_tile_part.x); - - vRect = rect.info.local_rect; - vPos = layer_pos; vColor = rect.color; - - vec2 final_pos = clamped_pos + vec2(tile.target_rect.xy) - vec2(tile.actual_rect.xy); - - gl_Position = uTransform * vec4(final_pos, 0, 1); } diff --git a/resources/shaders/quad.fs.glsl b/resources/shaders/quad.fs.glsl deleted file mode 100644 index 8909cd0755a..00000000000 --- a/resources/shaders/quad.fs.glsl +++ /dev/null @@ -1,38 +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/. */ - -// GLSL point in rect test. -// See: https://stackoverflow.com/questions/12751080/glsl-point-inside-box-test -bool PointInRect(vec2 p, vec2 p0, vec2 p1) -{ - vec2 s = step(p0, p) - step(p1, p); - return s.x * s.y != 0.0; -} - -void main(void) -{ - // Clip out. - if (PointInRect(vPosition, vClipOutRect.xy, vClipOutRect.zw)) { - discard; - } - - // Clip in. - if (!PointInRect(vPosition, vClipInRect.xy, vClipInRect.zw)) { - discard; - } - - // Apply image tiling parameters (offset and scale) to color UVs. - vec2 colorTexCoord = vTileParams.xy + fract(vColorTexCoord.xy) * vTileParams.zw; - vec2 maskTexCoord = vMaskTexCoord.xy; - - // Fetch the diffuse and mask texels. - vec4 diffuse = Texture(sDiffuse, colorTexCoord); - vec4 mask = Texture(sMask, maskTexCoord); - - // Extract alpha from the mask (component depends on platform) - float alpha = GetAlphaFromMask(mask); - - // Write the final fragment color. - SetFragColor(diffuse * vec4(vColor.rgb, vColor.a * alpha)); -} diff --git a/resources/shaders/quad.vs.glsl b/resources/shaders/quad.vs.glsl deleted file mode 100644 index 5b43fc539b2..00000000000 --- a/resources/shaders/quad.vs.glsl +++ /dev/null @@ -1,112 +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/. */ - -vec2 Bilerp2(vec2 tl, vec2 tr, vec2 br, vec2 bl, vec2 st) { - return mix(mix(tl, bl, st.y), mix(tr, br, st.y), st.x); -} - -vec4 Bilerp4(vec4 tl, vec4 tr, vec4 br, vec4 bl, vec2 st) { - return mix(mix(tl, bl, st.y), mix(tr, br, st.y), st.x); -} - -void main(void) -{ - // Extract the image tiling parameters. - // These are passed to the fragment shader, since - // the uv interpolation must be done per-fragment. - vTileParams = uTileParams[Bottom7Bits(int(aMisc.w))]; - - // Determine clip rects. - vClipOutRect = uClipRects[int(aMisc.z)]; - vec4 clipInRect = uClipRects[int(aMisc.y)]; - - // Extract the complete (stacking context + css transform) transform - // for this vertex. Transform the position by it. - vec2 offsetParams = uOffsets[Bottom7Bits(int(aMisc.x))].xy; - mat4 matrix = uMatrixPalette[Bottom7Bits(int(aMisc.x))]; - - vec2 p0 = aPositionRect.xy + offsetParams; - vec2 p1 = p0 + aPositionRect.zw; - - vec2 rect_origin = SnapToPixels(p0); - vec2 rect_size = SnapToPixels(p1) - rect_origin; - - // Determine the position, color, and mask texture coordinates of this vertex. - vec4 localPos = vec4(0.0, 0.0, 0.0, 1.0); - bool isBorderCorner = int(aMisc.w) >= 0x80; - bool isBottomTriangle = IsBottomTriangle(); - if (aPosition.y == 0.0) { - localPos.y = rect_origin.y; - if (aPosition.x == 0.0) { - localPos.x = rect_origin.x; - if (isBorderCorner) { - vColor = isBottomTriangle ? aColorRectBL : aColorRectTR; - } - } else { - localPos.x = rect_origin.x + rect_size.x; - if (isBorderCorner) { - vColor = aColorRectTR; - } - } - } else { - localPos.y = rect_origin.y + rect_size.y; - if (aPosition.x == 0.0) { - localPos.x = rect_origin.x; - if (isBorderCorner) { - vColor = aColorRectBL; - } - } else { - localPos.x = rect_origin.x + rect_size.x; - if (isBorderCorner) { - vColor = isBottomTriangle ? aColorRectBL : aColorRectTR; - } - } - } - - // Rotate or clip as necessary. If there is no rotation, we can clip here in the vertex shader - // and save a whole bunch of fragment shader invocations. If there is a rotation, we fall back - // to FS clipping. - // - // The rotation angle is encoded as a negative bottom left u coordinate. (uv coordinates should - // always be nonnegative normally, and gradients don't use color textures, so this is fine.) - vec4 colorTexCoordRectBottom = aColorTexCoordRectBottom; - vec2 localST; - if (colorTexCoordRectBottom.z < 0.0) { - float angle = -colorTexCoordRectBottom.z; - vec2 center = rect_origin + rect_size / 2.0; - vec2 translatedPos = localPos.xy - center; - localST = (localPos.xy - rect_origin) / rect_size; - localPos.xy = vec2(translatedPos.x * cos(angle) - translatedPos.y * sin(angle), - translatedPos.x * sin(angle) + translatedPos.y * cos(angle)) + center; - colorTexCoordRectBottom.z = aColorTexCoordRectTop.x; - vClipInRect = clipInRect; - } else { - localPos.x = clamp(localPos.x, clipInRect.x, clipInRect.z); - localPos.y = clamp(localPos.y, clipInRect.y, clipInRect.w); - localST = (localPos.xy - rect_origin) / rect_size; - vClipInRect = vec4(-1e37, -1e37, 1e38, 1e38); - } - - vColorTexCoord = Bilerp2(aColorTexCoordRectTop.xy, aColorTexCoordRectTop.zw, - colorTexCoordRectBottom.xy, colorTexCoordRectBottom.zw, - localST); - vMaskTexCoord = Bilerp2(aMaskTexCoordRectTop.xy, aMaskTexCoordRectTop.zw, - aMaskTexCoordRectBottom.xy, aMaskTexCoordRectBottom.zw, - localST); - if (!isBorderCorner) { - vColor = Bilerp4(aColorRectTL, aColorRectTR, aColorRectBR, aColorRectBL, localST); - } - - // Normalize the vertex color and mask texture coordinates. - vColor /= 255.0; - vMaskTexCoord /= uAtlasParams.zw; - - vPosition = localPos.xy; - - vec4 worldPos = matrix * localPos; - - // Transform by the orthographic projection into clip space. - gl_Position = uTransform * worldPos; -} - diff --git a/resources/shaders/tile.fs.glsl b/resources/shaders/tile.fs.glsl deleted file mode 100644 index 3355ee4646f..00000000000 --- a/resources/shaders/tile.fs.glsl +++ /dev/null @@ -1,11 +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) { - vec2 textureSize = vBorderPosition.zw - vBorderPosition.xy; - vec2 colorTexCoord = vBorderPosition.xy + mod(vColorTexCoord.xy, 1.0) * textureSize; - vec4 diffuse = Texture(sDiffuse, colorTexCoord); - SetFragColor(diffuse); -} - diff --git a/resources/shaders/tile.vs.glsl b/resources/shaders/tile.vs.glsl deleted file mode 100644 index 7f57bf1e360..00000000000 --- a/resources/shaders/tile.vs.glsl +++ /dev/null @@ -1,11 +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) -{ - vColorTexCoord = aBorderRadii.xy; - vBorderPosition = aBorderPosition; - gl_Position = uTransform * vec4(aPosition, 1.0); -} - |