summaryrefslogtreecommitdiff
path: root/drivers/gles2
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-08-27 10:12:24 +0200
committerGitHub <noreply@github.com>2018-08-27 10:12:24 +0200
commit3dc63a710f0ca845e6de9e8b4a2158a33743ad36 (patch)
tree7d8cfabb399fa0ebd547ce6224504b1149c25c8d /drivers/gles2
parentddfef86836be8e30709006ac30bc83007823468c (diff)
parent4226d56ca9ec91c4878d47e3bce4784e5edc3006 (diff)
Merge pull request #21469 from akien-mga/glsl-clang-format
Style: Enable clang-format on GLSL shaders
Diffstat (limited to 'drivers/gles2')
-rw-r--r--drivers/gles2/shaders/blend_shape.glsl4
-rw-r--r--drivers/gles2/shaders/canvas.glsl27
-rw-r--r--drivers/gles2/shaders/canvas_shadow.glsl4
-rw-r--r--drivers/gles2/shaders/copy.glsl4
-rw-r--r--drivers/gles2/shaders/cube_to_dp.glsl4
-rw-r--r--drivers/gles2/shaders/cubemap_filter.glsl4
-rw-r--r--drivers/gles2/shaders/effect_blur.glsl4
-rw-r--r--drivers/gles2/shaders/exposure.glsl4
-rw-r--r--drivers/gles2/shaders/particles.glsl17
-rw-r--r--drivers/gles2/shaders/resolve.glsl4
-rw-r--r--drivers/gles2/shaders/scene.glsl24
-rw-r--r--drivers/gles2/shaders/screen_space_reflection.glsl4
-rw-r--r--drivers/gles2/shaders/ssao.glsl4
-rw-r--r--drivers/gles2/shaders/ssao_blur.glsl6
-rw-r--r--drivers/gles2/shaders/ssao_minify.glsl4
-rw-r--r--drivers/gles2/shaders/subsurf_scattering.glsl4
-rw-r--r--drivers/gles2/shaders/tonemap.glsl6
17 files changed, 116 insertions, 12 deletions
diff --git a/drivers/gles2/shaders/blend_shape.glsl b/drivers/gles2/shaders/blend_shape.glsl
index d019062ba0..a1e954e33d 100644
--- a/drivers/gles2/shaders/blend_shape.glsl
+++ b/drivers/gles2/shaders/blend_shape.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
/*
@@ -23,6 +24,7 @@ ARRAY_INDEX=8,
/* INPUT ATTRIBS */
layout(location = 0) in highp VFORMAT vertex_attrib;
+/* clang-format on */
layout(location = 1) in vec3 normal_attrib;
#ifdef ENABLE_TANGENT
@@ -183,8 +185,10 @@ void main() {
gl_Position = vec4(0.0);
}
+/* clang-format off */
[fragment]
void main() {
}
+/* clang-format on */
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index cee68a58ff..ba69ca9b6e 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
#endif
uniform highp mat4 projection_matrix;
+/* clang-format on */
uniform highp mat4 modelview_matrix;
uniform highp mat4 extra_matrix;
attribute highp vec2 vertex; // attrib:0
@@ -29,8 +31,12 @@ uniform vec4 src_rect;
uniform highp float time;
+/* clang-format off */
+
VERTEX_SHADER_GLOBALS
+/* clang-format on */
+
vec2 select(vec2 a, vec2 b, bvec2 c) {
vec2 ret;
@@ -74,17 +80,21 @@ void main() {
#endif
-{
- vec2 src_vtx = outvec.xy;
+ {
+ vec2 src_vtx = outvec.xy;
+ /* clang-format off */
+
VERTEX_SHADER_CODE
-}
+ /* clang-format on */
+ }
color_interp = color;
gl_Position = projection_matrix * modelview_matrix * outvec;
}
+/* clang-format off */
[fragment]
#ifdef USE_GLES_OVER_GL
@@ -96,6 +106,7 @@ precision mediump int;
#endif
uniform sampler2D color_texture; // texunit:-1
+/* clang-format on */
uniform highp vec2 color_texpixel_size;
uniform mediump sampler2D normal_texture; // texunit:-2
@@ -118,8 +129,12 @@ uniform vec2 screen_pixel_size;
#endif
+/* clang-format off */
+
FRAGMENT_SHADER_GLOBALS
+/* clang-format on */
+
void main() {
vec4 color = color_interp;
@@ -129,11 +144,13 @@ void main() {
#ifdef SCREEN_UV_USED
vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
#endif
-{
+ {
+ /* clang-format off */
FRAGMENT_SHADER_CODE
-}
+ /* clang-format on */
+ }
color *= final_modulate;
diff --git a/drivers/gles2/shaders/canvas_shadow.glsl b/drivers/gles2/shaders/canvas_shadow.glsl
index 81af486101..e3c8140e31 100644
--- a/drivers/gles2/shaders/canvas_shadow.glsl
+++ b/drivers/gles2/shaders/canvas_shadow.glsl
@@ -1,6 +1,8 @@
+/* clang-format off */
[vertex]
uniform highp mat4 projection_matrix;
+/* clang-format on */
uniform highp mat4 light_matrix;
uniform highp mat4 world_matrix;
uniform highp float distance_norm;
@@ -15,9 +17,11 @@ void main() {
position_interp = gl_Position;
}
+/* clang-format off */
[fragment]
in highp vec4 position_interp;
+/* clang-format on */
#ifdef USE_RGBA_SHADOWS
diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl
index 6e9aad2a5d..16bbde196d 100644
--- a/drivers/gles2/shaders/copy.glsl
+++ b/drivers/gles2/shaders/copy.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
#endif
attribute highp vec4 vertex_attrib; // attrib:0
+/* clang-format on */
#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
attribute vec3 cube_in; // attrib:4
@@ -46,6 +48,7 @@ void main() {
#endif
}
+/* clang-format off */
[fragment]
#define M_PI 3.14159265359
@@ -63,6 +66,7 @@ varying vec3 cube_interp;
#else
varying vec2 uv_interp;
#endif
+/* clang-format on */
#ifdef USE_CUBEMAP
uniform samplerCube source_cube; // texunit:0
diff --git a/drivers/gles2/shaders/cube_to_dp.glsl b/drivers/gles2/shaders/cube_to_dp.glsl
index b44aab8946..3d24c36336 100644
--- a/drivers/gles2/shaders/cube_to_dp.glsl
+++ b/drivers/gles2/shaders/cube_to_dp.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
#endif
attribute highp vec4 vertex_attrib; // attrib:0
+/* clang-format on */
attribute vec2 uv_in; // attrib:4
varying vec2 uv_interp;
@@ -19,6 +21,7 @@ void main() {
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
#ifdef USE_GLES_OVER_GL
@@ -30,6 +33,7 @@ precision mediump int;
#endif
uniform highp samplerCube source_cube; //texunit:0
+/* clang-format on */
varying vec2 uv_interp;
uniform bool z_flip;
diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl
index 0d60104480..2a1ad8d8f2 100644
--- a/drivers/gles2/shaders/cubemap_filter.glsl
+++ b/drivers/gles2/shaders/cubemap_filter.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
#endif
attribute highp vec2 vertex; // attrib:0
+/* clang-format on */
attribute highp vec2 uv; // attrib:4
varying highp vec2 uv_interp;
@@ -19,6 +21,7 @@ void main() {
gl_Position = vec4(vertex, 0, 1);
}
+/* clang-format off */
[fragment]
#extension GL_ARB_shader_texture_lod : enable
@@ -41,6 +44,7 @@ uniform sampler2D source_panorama; //texunit:0
#else
uniform samplerCube source_cube; //texunit:0
#endif
+/* clang-format on */
uniform int face_id;
uniform float roughness;
diff --git a/drivers/gles2/shaders/effect_blur.glsl b/drivers/gles2/shaders/effect_blur.glsl
index 0e2d28af20..a531802c75 100644
--- a/drivers/gles2/shaders/effect_blur.glsl
+++ b/drivers/gles2/shaders/effect_blur.glsl
@@ -1,6 +1,8 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
@@ -22,6 +24,7 @@ void main() {
#endif
}
+/* clang-format off */
[fragment]
#if !defined(GLES_OVER_GL)
@@ -29,6 +32,7 @@ precision mediump float;
#endif
in vec2 uv_interp;
+/* clang-format on */
uniform sampler2D source_color; //texunit:0
#ifdef SSAO_MERGE
diff --git a/drivers/gles2/shaders/exposure.glsl b/drivers/gles2/shaders/exposure.glsl
index 18fff1ae36..759adcda06 100644
--- a/drivers/gles2/shaders/exposure.glsl
+++ b/drivers/gles2/shaders/exposure.glsl
@@ -1,15 +1,19 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
uniform highp sampler2D source_exposure; //texunit:0
+/* clang-format on */
#ifdef EXPOSURE_BEGIN
diff --git a/drivers/gles2/shaders/particles.glsl b/drivers/gles2/shaders/particles.glsl
index 5af4b65b28..5974050fc1 100644
--- a/drivers/gles2/shaders/particles.glsl
+++ b/drivers/gles2/shaders/particles.glsl
@@ -1,6 +1,8 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 color;
+/* clang-format on */
layout(location = 1) in highp vec4 velocity_active;
layout(location = 2) in highp vec4 custom;
layout(location = 3) in highp vec4 xform_1;
@@ -45,16 +47,22 @@ out highp vec4 out_xform_3; //tfb:
#if defined(USE_MATERIAL)
+/* clang-format off */
layout(std140) uniform UniformData { //ubo:0
MATERIAL_UNIFORMS
};
+/* clang-format on */
#endif
+/* clang-format off */
+
VERTEX_SHADER_GLOBALS
+/* clang-format on */
+
uint hash(uint x) {
x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
@@ -165,9 +173,11 @@ void main() {
//execute shader
{
+ /* clang-format off */
VERTEX_SHADER_CODE
+ /* clang-format on */
}
#if !defined(DISABLE_FORCE)
@@ -223,6 +233,7 @@ VERTEX_SHADER_CODE
#endif //PARTICLES_COPY
}
+/* clang-format off */
[fragment]
//any code here is never executed, stuff is filled just so it works
@@ -240,12 +251,16 @@ MATERIAL_UNIFORMS
FRAGMENT_SHADER_GLOBALS
void main() {
-
{
+
LIGHT_SHADER_CODE
+
}
{
+
FRAGMENT_SHADER_CODE
+
}
}
+/* clang-format on */
diff --git a/drivers/gles2/shaders/resolve.glsl b/drivers/gles2/shaders/resolve.glsl
index 05bb922eec..5c6f5d6561 100644
--- a/drivers/gles2/shaders/resolve.glsl
+++ b/drivers/gles2/shaders/resolve.glsl
@@ -1,6 +1,8 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
@@ -11,6 +13,7 @@ void main() {
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
#if !defined(GLES_OVER_GL)
@@ -18,6 +21,7 @@ precision mediump float;
#endif
in vec2 uv_interp;
+/* clang-format on */
uniform sampler2D source_specular; //texunit:0
uniform sampler2D source_ssr; //texunit:1
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index 8bcb3b5f1d..906c089170 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -1,3 +1,4 @@
+/* clang-format off */
[vertex]
#ifdef USE_GLES_OVER_GL
@@ -15,6 +16,7 @@ precision mediump int;
//
attribute highp vec4 vertex_attrib; // attrib:0
+/* clang-format on */
attribute vec3 normal_attrib; // attrib:1
#if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP)
@@ -108,8 +110,12 @@ varying vec2 uv_interp;
varying vec2 uv2_interp;
#endif
+/* clang-format off */
+
VERTEX_SHADER_GLOBALS
+/* clang-format on */
+
void main() {
highp vec4 vertex = vertex_attrib;
@@ -206,11 +212,13 @@ void main() {
#define world_transform world_matrix
-{
+ {
+ /* clang-format off */
VERTEX_SHADER_CODE
-}
+ /* clang-format on */
+ }
vec4 outvec = vertex;
@@ -254,6 +262,7 @@ VERTEX_SHADER_CODE
gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
}
+/* clang-format off */
[fragment]
#extension GL_ARB_shader_texture_lod : enable
@@ -279,6 +288,7 @@ precision mediump int;
//
uniform mat4 camera_matrix;
+/* clang-format on */
uniform mat4 camera_inverse_matrix;
uniform mat4 projection_matrix;
uniform mat4 projection_inverse_matrix;
@@ -390,8 +400,12 @@ vec3 metallic_to_specular_color(float metallic, float specular, vec3 albedo) {
return mix(vec3(dielectric), albedo, metallic); // TODO: reference?
}
+/* clang-format off */
+
FRAGMENT_SHADER_GLOBALS
+/* clang-format on */
+
#ifdef LIGHT_PASS
void light_compute(
vec3 N,
@@ -504,11 +518,13 @@ void main() {
vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
#endif
-{
+ {
+ /* clang-format off */
FRAGMENT_SHADER_CODE
-}
+ /* clang-format on */
+ }
#if defined(ENABLE_NORMALMAP)
normalmap.xy = normalmap.xy * 2.0 - 1.0;
diff --git a/drivers/gles2/shaders/screen_space_reflection.glsl b/drivers/gles2/shaders/screen_space_reflection.glsl
index 77af874ee4..a11da10b61 100644
--- a/drivers/gles2/shaders/screen_space_reflection.glsl
+++ b/drivers/gles2/shaders/screen_space_reflection.glsl
@@ -1,6 +1,8 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
@@ -13,9 +15,11 @@ void main() {
pos_interp.xy = gl_Position.xy;
}
+/* clang-format off */
[fragment]
in vec2 uv_interp;
+/* clang-format on */
in vec2 pos_interp;
uniform sampler2D source_diffuse; //texunit:0
diff --git a/drivers/gles2/shaders/ssao.glsl b/drivers/gles2/shaders/ssao.glsl
index 8dbe8c6ba9..82eea8f274 100644
--- a/drivers/gles2/shaders/ssao.glsl
+++ b/drivers/gles2/shaders/ssao.glsl
@@ -1,6 +1,8 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
@@ -8,6 +10,7 @@ void main() {
gl_Position.z = 1.0;
}
+/* clang-format off */
[fragment]
#define TWO_PI 6.283185307179586476925286766559
@@ -53,6 +56,7 @@ const int ROTATIONS[] = int[](
29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
19, 27, 21, 25, 39, 29, 17, 21, 27);
+/* clang-format on */
//#define NUM_SPIRAL_TURNS (7)
const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1];
diff --git a/drivers/gles2/shaders/ssao_blur.glsl b/drivers/gles2/shaders/ssao_blur.glsl
index 82b735a2b4..e4133ad534 100644
--- a/drivers/gles2/shaders/ssao_blur.glsl
+++ b/drivers/gles2/shaders/ssao_blur.glsl
@@ -1,6 +1,8 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
@@ -8,9 +10,11 @@ void main() {
gl_Position.z = 1.0;
}
+/* clang-format off */
[fragment]
uniform sampler2D source_ssao; //texunit:0
+/* clang-format on */
uniform sampler2D source_depth; //texunit:1
uniform sampler2D source_normal; //texunit:3
@@ -43,7 +47,7 @@ const float gaussian[R + 1] =
//float[](0.356642, 0.239400, 0.072410, 0.009869);
//float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134); // stddev = 1.0
float[](0.153170, 0.144893, 0.122649, 0.092902, 0.062970); // stddev = 2.0
- //float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0
+//float[](0.111220, 0.107798, 0.098151, 0.083953, 0.067458, 0.050920, 0.036108); // stddev = 3.0
/** (1, 0) or (0, 1)*/
uniform ivec2 axis;
diff --git a/drivers/gles2/shaders/ssao_minify.glsl b/drivers/gles2/shaders/ssao_minify.glsl
index 777a0069fc..272f3e236e 100644
--- a/drivers/gles2/shaders/ssao_minify.glsl
+++ b/drivers/gles2/shaders/ssao_minify.glsl
@@ -1,12 +1,15 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
void main() {
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
#ifdef MINIFY_START
@@ -14,6 +17,7 @@ void main() {
#define SDEPTH_TYPE highp sampler2D
uniform float camera_z_far;
uniform float camera_z_near;
+/* clang-format on */
#else
diff --git a/drivers/gles2/shaders/subsurf_scattering.glsl b/drivers/gles2/shaders/subsurf_scattering.glsl
index fb7908f06a..f40fb3a244 100644
--- a/drivers/gles2/shaders/subsurf_scattering.glsl
+++ b/drivers/gles2/shaders/subsurf_scattering.glsl
@@ -1,6 +1,8 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
@@ -11,6 +13,7 @@ void main() {
gl_Position = vertex_attrib;
}
+/* clang-format off */
[fragment]
//#define QUALIFIER uniform // some guy on the interweb says it may be faster with this
@@ -18,6 +21,7 @@ void main() {
#ifdef USE_25_SAMPLES
const int kernel_size = 25;
+/* clang-format on */
QUALIFIER vec2 kernel[25] = vec2[](
vec2(0.530605, 0.0),
vec2(0.000973794, -3.0),
diff --git a/drivers/gles2/shaders/tonemap.glsl b/drivers/gles2/shaders/tonemap.glsl
index f3f6a85565..eae3b5a1ca 100644
--- a/drivers/gles2/shaders/tonemap.glsl
+++ b/drivers/gles2/shaders/tonemap.glsl
@@ -1,6 +1,8 @@
+/* clang-format off */
[vertex]
layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
@@ -14,6 +16,7 @@ void main() {
#endif
}
+/* clang-format off */
[fragment]
#if !defined(GLES_OVER_GL)
@@ -21,6 +24,7 @@ precision mediump float;
#endif
in vec2 uv_interp;
+/* clang-format on */
uniform highp sampler2D source; //texunit:0
@@ -115,7 +119,7 @@ vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) {
vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - 0.5) * pixel_size;
return (g0(fuv.y) * (g0x * textureLod(tex, p0, lod) + g1x * textureLod(tex, p1, lod))) +
- (g1(fuv.y) * (g0x * textureLod(tex, p2, lod) + g1x * textureLod(tex, p3, lod)));
+ (g1(fuv.y) * (g0x * textureLod(tex, p2, lod) + g1x * textureLod(tex, p3, lod)));
}
#define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod)