From c03272a460183423077b6696acddcce03e33ced4 Mon Sep 17 00:00:00 2001 From: Glenn Watson Date: Tue, 23 Aug 2016 13:04:19 +1000 Subject: [PATCH] Remove some unused shaders. --- resources/shaders/border.fs.glsl | 41 ------------------- resources/shaders/border.vs.glsl | 12 ------ resources/shaders/ps_image_transform.fs.glsl | 8 ---- resources/shaders/ps_image_transform.glsl | 8 ---- resources/shaders/ps_image_transform.vs.glsl | 29 ------------- .../shaders/ps_rectangle_transform.fs.glsl | 8 ---- resources/shaders/ps_rectangle_transform.glsl | 8 ---- .../shaders/ps_rectangle_transform.vs.glsl | 24 ----------- 8 files changed, 138 deletions(-) delete mode 100644 resources/shaders/border.fs.glsl delete mode 100644 resources/shaders/border.vs.glsl delete mode 100644 resources/shaders/ps_image_transform.fs.glsl delete mode 100644 resources/shaders/ps_image_transform.glsl delete mode 100644 resources/shaders/ps_image_transform.vs.glsl delete mode 100644 resources/shaders/ps_rectangle_transform.fs.glsl delete mode 100644 resources/shaders/ps_rectangle_transform.glsl delete mode 100644 resources/shaders/ps_rectangle_transform.vs.glsl diff --git a/resources/shaders/border.fs.glsl b/resources/shaders/border.fs.glsl deleted file mode 100644 index 32d1930aa5aa..000000000000 --- a/resources/shaders/border.fs.glsl +++ /dev/null @@ -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))); -} - diff --git a/resources/shaders/border.vs.glsl b/resources/shaders/border.vs.glsl deleted file mode 100644 index cbd9cdcd0c1c..000000000000 --- a/resources/shaders/border.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; - vPosition = aPosition.xy; - vBorderPosition = aBorderPosition; - vBorderRadii = aBorderRadii; - gl_Position = uTransform * vec4(aPosition, 1.0); -} diff --git a/resources/shaders/ps_image_transform.fs.glsl b/resources/shaders/ps_image_transform.fs.glsl deleted file mode 100644 index b12b266328bb..000000000000 --- a/resources/shaders/ps_image_transform.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) { - 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 deleted file mode 100644 index d4aed4a51614..000000000000 --- a/resources/shaders/ps_image_transform.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/. */ - -varying vec2 vUv; - -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 deleted file mode 100644 index bb79aea1becf..000000000000 --- a/resources/shaders/ps_image_transform.vs.glsl +++ /dev/null @@ -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); -} diff --git a/resources/shaders/ps_rectangle_transform.fs.glsl b/resources/shaders/ps_rectangle_transform.fs.glsl deleted file mode 100644 index 7552a01e6d35..000000000000 --- a/resources/shaders/ps_rectangle_transform.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) { - init_transform_fs(vLocalPos, vLocalRect); - oFragColor = vColor; -} diff --git a/resources/shaders/ps_rectangle_transform.glsl b/resources/shaders/ps_rectangle_transform.glsl deleted file mode 100644 index e8990e9627a0..000000000000 --- a/resources/shaders/ps_rectangle_transform.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/. */ - -varying vec4 vColor; - -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 deleted file mode 100644 index b21f85158c58..000000000000 --- a/resources/shaders/ps_rectangle_transform.vs.glsl +++ /dev/null @@ -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; -}