summaryrefslogtreecommitdiff
path: root/drivers/gles2/shaders/canvas_shadow.glsl
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gles2/shaders/canvas_shadow.glsl')
-rw-r--r--drivers/gles2/shaders/canvas_shadow.glsl41
1 files changed, 24 insertions, 17 deletions
diff --git a/drivers/gles2/shaders/canvas_shadow.glsl b/drivers/gles2/shaders/canvas_shadow.glsl
index e3c8140e31..d39212826e 100644
--- a/drivers/gles2/shaders/canvas_shadow.glsl
+++ b/drivers/gles2/shaders/canvas_shadow.glsl
@@ -1,15 +1,24 @@
/* clang-format off */
[vertex]
+#ifdef USE_GLES_OVER_GL
+#define lowp
+#define mediump
+#define highp
+#else
+precision highp float;
+precision highp int;
+#endif
+
+attribute highp vec3 vertex; // attrib:0
+
uniform highp mat4 projection_matrix;
/* clang-format on */
uniform highp mat4 light_matrix;
uniform highp mat4 world_matrix;
uniform highp float distance_norm;
-layout(location = 0) in highp vec3 vertex;
-
-out highp vec4 position_interp;
+varying highp vec4 position_interp;
void main() {
@@ -20,31 +29,29 @@ void main() {
/* clang-format off */
[fragment]
-in highp vec4 position_interp;
-/* clang-format on */
-
-#ifdef USE_RGBA_SHADOWS
-
-layout(location = 0) out lowp vec4 distance_buf;
-
+#ifdef USE_GLES_OVER_GL
+#define lowp
+#define mediump
+#define highp
#else
-
-layout(location = 0) out highp float distance_buf;
-
+precision mediump float;
+precision mediump int;
#endif
+varying highp vec4 position_interp;
+/* clang-format on */
+
void main() {
- highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; //bias;
+ highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; // bias
#ifdef USE_RGBA_SHADOWS
highp vec4 comp = fract(depth * vec4(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0));
comp -= comp.xxyz * vec4(0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0);
- distance_buf = comp;
+ gl_FragColor = comp;
#else
- distance_buf = depth;
-
+ gl_FragColor = vec4(depth);
#endif
}