Browse Source

Merge pull request #21469 from akien-mga/glsl-clang-format

Style: Enable clang-format on GLSL shaders
Rémi Verschelde 7 years ago
parent
commit
3dc63a710f
37 changed files with 320 additions and 100 deletions
  1. 4 0
      drivers/gles2/shaders/blend_shape.glsl
  2. 22 5
      drivers/gles2/shaders/canvas.glsl
  3. 4 0
      drivers/gles2/shaders/canvas_shadow.glsl
  4. 4 0
      drivers/gles2/shaders/copy.glsl
  5. 4 0
      drivers/gles2/shaders/cube_to_dp.glsl
  6. 4 0
      drivers/gles2/shaders/cubemap_filter.glsl
  7. 4 0
      drivers/gles2/shaders/effect_blur.glsl
  8. 4 0
      drivers/gles2/shaders/exposure.glsl
  9. 16 1
      drivers/gles2/shaders/particles.glsl
  10. 4 0
      drivers/gles2/shaders/resolve.glsl
  11. 20 4
      drivers/gles2/shaders/scene.glsl
  12. 4 0
      drivers/gles2/shaders/screen_space_reflection.glsl
  13. 4 0
      drivers/gles2/shaders/ssao.glsl
  14. 5 1
      drivers/gles2/shaders/ssao_blur.glsl
  15. 4 0
      drivers/gles2/shaders/ssao_minify.glsl
  16. 4 0
      drivers/gles2/shaders/subsurf_scattering.glsl
  17. 5 1
      drivers/gles2/shaders/tonemap.glsl
  18. 4 0
      drivers/gles3/shaders/blend_shape.glsl
  19. 39 13
      drivers/gles3/shaders/canvas.glsl
  20. 4 0
      drivers/gles3/shaders/canvas_shadow.glsl
  21. 4 0
      drivers/gles3/shaders/copy.glsl
  22. 4 0
      drivers/gles3/shaders/cube_to_dp.glsl
  23. 4 0
      drivers/gles3/shaders/cubemap_filter.glsl
  24. 4 0
      drivers/gles3/shaders/effect_blur.glsl
  25. 4 0
      drivers/gles3/shaders/exposure.glsl
  26. 18 0
      drivers/gles3/shaders/particles.glsl
  27. 4 0
      drivers/gles3/shaders/resolve.glsl
  28. 43 21
      drivers/gles3/shaders/scene.glsl
  29. 4 0
      drivers/gles3/shaders/screen_space_reflection.glsl
  30. 5 2
      drivers/gles3/shaders/ssao.glsl
  31. 8 6
      drivers/gles3/shaders/ssao_blur.glsl
  32. 4 0
      drivers/gles3/shaders/ssao_minify.glsl
  33. 8 8
      drivers/gles3/shaders/subsurf_scattering.glsl
  34. 6 4
      drivers/gles3/shaders/tonemap.glsl
  35. 1 1
      misc/hooks/pre-commit-clang-format
  36. 1 1
      misc/travis/clang-format.sh
  37. 35 32
      modules/mobile_vr/shaders/lens_distorted.glsl

+ 4 - 0
drivers/gles2/shaders/blend_shape.glsl

@@ -1,3 +1,4 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 /*
 /*
@@ -23,6 +24,7 @@ ARRAY_INDEX=8,
 /* INPUT ATTRIBS */
 /* INPUT ATTRIBS */
 
 
 layout(location = 0) in highp VFORMAT vertex_attrib;
 layout(location = 0) in highp VFORMAT vertex_attrib;
+/* clang-format on */
 layout(location = 1) in vec3 normal_attrib;
 layout(location = 1) in vec3 normal_attrib;
 
 
 #ifdef ENABLE_TANGENT
 #ifdef ENABLE_TANGENT
@@ -183,8 +185,10 @@ void main() {
 	gl_Position = vec4(0.0);
 	gl_Position = vec4(0.0);
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 void main() {
 void main() {
 
 
 }
 }
+/* clang-format on */

+ 22 - 5
drivers/gles2/shaders/canvas.glsl

@@ -1,3 +1,4 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 #ifdef USE_GLES_OVER_GL
 #ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
 #endif
 #endif
 
 
 uniform highp mat4 projection_matrix;
 uniform highp mat4 projection_matrix;
+/* clang-format on */
 uniform highp mat4 modelview_matrix;
 uniform highp mat4 modelview_matrix;
 uniform highp mat4 extra_matrix;
 uniform highp mat4 extra_matrix;
 attribute highp vec2 vertex; // attrib:0
 attribute highp vec2 vertex; // attrib:0
@@ -29,8 +31,12 @@ uniform vec4 src_rect;
 
 
 uniform highp float time;
 uniform highp float time;
 
 
+/* clang-format off */
+
 VERTEX_SHADER_GLOBALS
 VERTEX_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 vec2 select(vec2 a, vec2 b, bvec2 c) {
 vec2 select(vec2 a, vec2 b, bvec2 c) {
 	vec2 ret;
 	vec2 ret;
 
 
@@ -74,17 +80,21 @@ void main() {
 
 
 #endif
 #endif
 
 
-{
-	vec2 src_vtx = outvec.xy;
+	{
+		vec2 src_vtx = outvec.xy;
+		/* clang-format off */
+
 VERTEX_SHADER_CODE
 VERTEX_SHADER_CODE
 
 
-}
+		/* clang-format on */
+	}
 
 
 	color_interp = color;
 	color_interp = color;
 
 
 	gl_Position = projection_matrix * modelview_matrix * outvec;
 	gl_Position = projection_matrix * modelview_matrix * outvec;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #ifdef USE_GLES_OVER_GL
 #ifdef USE_GLES_OVER_GL
@@ -96,6 +106,7 @@ precision mediump int;
 #endif
 #endif
 
 
 uniform sampler2D color_texture; // texunit:-1
 uniform sampler2D color_texture; // texunit:-1
+/* clang-format on */
 uniform highp vec2 color_texpixel_size;
 uniform highp vec2 color_texpixel_size;
 uniform mediump sampler2D normal_texture; // texunit:-2
 uniform mediump sampler2D normal_texture; // texunit:-2
 
 
@@ -118,8 +129,12 @@ uniform vec2 screen_pixel_size;
 
 
 #endif
 #endif
 
 
+/* clang-format off */
+
 FRAGMENT_SHADER_GLOBALS
 FRAGMENT_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 void main() {
 void main() {
 
 
 	vec4 color = color_interp;
 	vec4 color = color_interp;
@@ -129,11 +144,13 @@ void main() {
 #ifdef SCREEN_UV_USED
 #ifdef SCREEN_UV_USED
 	vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
 	vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
 #endif
 #endif
-{
+	{
+		/* clang-format off */
 
 
 FRAGMENT_SHADER_CODE
 FRAGMENT_SHADER_CODE
 
 
-}
+		/* clang-format on */
+	}
 
 
 	color *= final_modulate;
 	color *= final_modulate;
 
 

+ 4 - 0
drivers/gles2/shaders/canvas_shadow.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 uniform highp mat4 projection_matrix;
 uniform highp mat4 projection_matrix;
+/* clang-format on */
 uniform highp mat4 light_matrix;
 uniform highp mat4 light_matrix;
 uniform highp mat4 world_matrix;
 uniform highp mat4 world_matrix;
 uniform highp float distance_norm;
 uniform highp float distance_norm;
@@ -15,9 +17,11 @@ void main() {
 	position_interp = gl_Position;
 	position_interp = gl_Position;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 in highp vec4 position_interp;
 in highp vec4 position_interp;
+/* clang-format on */
 
 
 #ifdef USE_RGBA_SHADOWS
 #ifdef USE_RGBA_SHADOWS
 
 

+ 4 - 0
drivers/gles2/shaders/copy.glsl

@@ -1,3 +1,4 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 #ifdef USE_GLES_OVER_GL
 #ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
 #endif
 #endif
 
 
 attribute highp vec4 vertex_attrib; // attrib:0
 attribute highp vec4 vertex_attrib; // attrib:0
+/* clang-format on */
 
 
 #if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
 #if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
 attribute vec3 cube_in; // attrib:4
 attribute vec3 cube_in; // attrib:4
@@ -46,6 +48,7 @@ void main() {
 #endif
 #endif
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #define M_PI 3.14159265359
 #define M_PI 3.14159265359
@@ -63,6 +66,7 @@ varying vec3 cube_interp;
 #else
 #else
 varying vec2 uv_interp;
 varying vec2 uv_interp;
 #endif
 #endif
+/* clang-format on */
 
 
 #ifdef USE_CUBEMAP
 #ifdef USE_CUBEMAP
 uniform samplerCube source_cube; // texunit:0
 uniform samplerCube source_cube; // texunit:0

+ 4 - 0
drivers/gles2/shaders/cube_to_dp.glsl

@@ -1,3 +1,4 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 #ifdef USE_GLES_OVER_GL
 #ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
 #endif
 #endif
 
 
 attribute highp vec4 vertex_attrib; // attrib:0
 attribute highp vec4 vertex_attrib; // attrib:0
+/* clang-format on */
 attribute vec2 uv_in; // attrib:4
 attribute vec2 uv_in; // attrib:4
 
 
 varying vec2 uv_interp;
 varying vec2 uv_interp;
@@ -19,6 +21,7 @@ void main() {
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #ifdef USE_GLES_OVER_GL
 #ifdef USE_GLES_OVER_GL
@@ -30,6 +33,7 @@ precision mediump int;
 #endif
 #endif
 
 
 uniform highp samplerCube source_cube; //texunit:0
 uniform highp samplerCube source_cube; //texunit:0
+/* clang-format on */
 varying vec2 uv_interp;
 varying vec2 uv_interp;
 
 
 uniform bool z_flip;
 uniform bool z_flip;

+ 4 - 0
drivers/gles2/shaders/cubemap_filter.glsl

@@ -1,3 +1,4 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 #ifdef USE_GLES_OVER_GL
 #ifdef USE_GLES_OVER_GL
@@ -9,6 +10,7 @@ precision mediump int;
 #endif
 #endif
 
 
 attribute highp vec2 vertex; // attrib:0
 attribute highp vec2 vertex; // attrib:0
+/* clang-format on */
 attribute highp vec2 uv; // attrib:4
 attribute highp vec2 uv; // attrib:4
 
 
 varying highp vec2 uv_interp;
 varying highp vec2 uv_interp;
@@ -19,6 +21,7 @@ void main() {
 	gl_Position = vec4(vertex, 0, 1);
 	gl_Position = vec4(vertex, 0, 1);
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #extension GL_ARB_shader_texture_lod : enable
 #extension GL_ARB_shader_texture_lod : enable
@@ -41,6 +44,7 @@ uniform sampler2D source_panorama; //texunit:0
 #else
 #else
 uniform samplerCube source_cube; //texunit:0
 uniform samplerCube source_cube; //texunit:0
 #endif
 #endif
+/* clang-format on */
 
 
 uniform int face_id;
 uniform int face_id;
 uniform float roughness;
 uniform float roughness;

+ 4 - 0
drivers/gles2/shaders/effect_blur.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -22,6 +24,7 @@ void main() {
 #endif
 #endif
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #if !defined(GLES_OVER_GL)
 #if !defined(GLES_OVER_GL)
@@ -29,6 +32,7 @@ precision mediump float;
 #endif
 #endif
 
 
 in vec2 uv_interp;
 in vec2 uv_interp;
+/* clang-format on */
 uniform sampler2D source_color; //texunit:0
 uniform sampler2D source_color; //texunit:0
 
 
 #ifdef SSAO_MERGE
 #ifdef SSAO_MERGE

+ 4 - 0
drivers/gles2/shaders/exposure.glsl

@@ -1,15 +1,19 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 
 
 void main() {
 void main() {
 
 
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 uniform highp sampler2D source_exposure; //texunit:0
 uniform highp sampler2D source_exposure; //texunit:0
+/* clang-format on */
 
 
 #ifdef EXPOSURE_BEGIN
 #ifdef EXPOSURE_BEGIN
 
 

+ 16 - 1
drivers/gles2/shaders/particles.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 color;
 layout(location = 0) in highp vec4 color;
+/* clang-format on */
 layout(location = 1) in highp vec4 velocity_active;
 layout(location = 1) in highp vec4 velocity_active;
 layout(location = 2) in highp vec4 custom;
 layout(location = 2) in highp vec4 custom;
 layout(location = 3) in highp vec4 xform_1;
 layout(location = 3) in highp vec4 xform_1;
@@ -45,16 +47,22 @@ out highp vec4 out_xform_3; //tfb:
 
 
 #if defined(USE_MATERIAL)
 #if defined(USE_MATERIAL)
 
 
+/* clang-format off */
 layout(std140) uniform UniformData { //ubo:0
 layout(std140) uniform UniformData { //ubo:0
 
 
 MATERIAL_UNIFORMS
 MATERIAL_UNIFORMS
 
 
 };
 };
+/* clang-format on */
 
 
 #endif
 #endif
 
 
+/* clang-format off */
+
 VERTEX_SHADER_GLOBALS
 VERTEX_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 uint hash(uint x) {
 uint hash(uint x) {
 
 
 	x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
 	x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
@@ -165,9 +173,11 @@ void main() {
 		//execute shader
 		//execute shader
 
 
 		{
 		{
+			/* clang-format off */
 
 
 VERTEX_SHADER_CODE
 VERTEX_SHADER_CODE
 
 
+			/* clang-format on */
 		}
 		}
 
 
 #if !defined(DISABLE_FORCE)
 #if !defined(DISABLE_FORCE)
@@ -223,6 +233,7 @@ VERTEX_SHADER_CODE
 #endif //PARTICLES_COPY
 #endif //PARTICLES_COPY
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 //any code here is never executed, stuff is filled just so it works
 //any code here is never executed, stuff is filled just so it works
@@ -240,12 +251,16 @@ MATERIAL_UNIFORMS
 FRAGMENT_SHADER_GLOBALS
 FRAGMENT_SHADER_GLOBALS
 
 
 void main() {
 void main() {
-
 	{
 	{
+
 LIGHT_SHADER_CODE
 LIGHT_SHADER_CODE
+
 	}
 	}
 
 
 	{
 	{
+
 FRAGMENT_SHADER_CODE
 FRAGMENT_SHADER_CODE
+
 	}
 	}
 }
 }
+/* clang-format on */

+ 4 - 0
drivers/gles2/shaders/resolve.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -11,6 +13,7 @@ void main() {
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #if !defined(GLES_OVER_GL)
 #if !defined(GLES_OVER_GL)
@@ -18,6 +21,7 @@ precision mediump float;
 #endif
 #endif
 
 
 in vec2 uv_interp;
 in vec2 uv_interp;
+/* clang-format on */
 uniform sampler2D source_specular; //texunit:0
 uniform sampler2D source_specular; //texunit:0
 uniform sampler2D source_ssr; //texunit:1
 uniform sampler2D source_ssr; //texunit:1
 
 

+ 20 - 4
drivers/gles2/shaders/scene.glsl

@@ -1,3 +1,4 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 #ifdef USE_GLES_OVER_GL
 #ifdef USE_GLES_OVER_GL
@@ -15,6 +16,7 @@ precision mediump int;
 //
 //
 
 
 attribute highp vec4 vertex_attrib; // attrib:0
 attribute highp vec4 vertex_attrib; // attrib:0
+/* clang-format on */
 attribute vec3 normal_attrib; // attrib:1
 attribute vec3 normal_attrib; // attrib:1
 
 
 #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP)
 #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP)
@@ -108,8 +110,12 @@ varying vec2 uv_interp;
 varying vec2 uv2_interp;
 varying vec2 uv2_interp;
 #endif
 #endif
 
 
+/* clang-format off */
+
 VERTEX_SHADER_GLOBALS
 VERTEX_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 void main() {
 void main() {
 
 
 	highp vec4 vertex = vertex_attrib;
 	highp vec4 vertex = vertex_attrib;
@@ -206,11 +212,13 @@ void main() {
 
 
 #define world_transform world_matrix
 #define world_transform world_matrix
 
 
-{
+	{
+		/* clang-format off */
 
 
 VERTEX_SHADER_CODE
 VERTEX_SHADER_CODE
 
 
-}
+		/* clang-format on */
+	}
 
 
 	vec4 outvec = vertex;
 	vec4 outvec = vertex;
 
 
@@ -254,6 +262,7 @@ VERTEX_SHADER_CODE
 	gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
 	gl_Position = projection_matrix * vec4(vertex_interp, 1.0);
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 #extension GL_ARB_shader_texture_lod : enable
 #extension GL_ARB_shader_texture_lod : enable
 
 
@@ -279,6 +288,7 @@ precision mediump int;
 //
 //
 
 
 uniform mat4 camera_matrix;
 uniform mat4 camera_matrix;
+/* clang-format on */
 uniform mat4 camera_inverse_matrix;
 uniform mat4 camera_inverse_matrix;
 uniform mat4 projection_matrix;
 uniform mat4 projection_matrix;
 uniform mat4 projection_inverse_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?
 	return mix(vec3(dielectric), albedo, metallic); // TODO: reference?
 }
 }
 
 
+/* clang-format off */
+
 FRAGMENT_SHADER_GLOBALS
 FRAGMENT_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 #ifdef LIGHT_PASS
 #ifdef LIGHT_PASS
 void light_compute(
 void light_compute(
 		vec3 N,
 		vec3 N,
@@ -504,11 +518,13 @@ void main() {
 	vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
 	vec2 screen_uv = gl_FragCoord.xy * screen_pixel_size;
 #endif
 #endif
 
 
-{
+	{
+		/* clang-format off */
 
 
 FRAGMENT_SHADER_CODE
 FRAGMENT_SHADER_CODE
 
 
-}
+		/* clang-format on */
+	}
 
 
 #if defined(ENABLE_NORMALMAP)
 #if defined(ENABLE_NORMALMAP)
 	normalmap.xy = normalmap.xy * 2.0 - 1.0;
 	normalmap.xy = normalmap.xy * 2.0 - 1.0;

+ 4 - 0
drivers/gles2/shaders/screen_space_reflection.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -13,9 +15,11 @@ void main() {
 	pos_interp.xy = gl_Position.xy;
 	pos_interp.xy = gl_Position.xy;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 in vec2 uv_interp;
 in vec2 uv_interp;
+/* clang-format on */
 in vec2 pos_interp;
 in vec2 pos_interp;
 
 
 uniform sampler2D source_diffuse; //texunit:0
 uniform sampler2D source_diffuse; //texunit:0

+ 4 - 0
drivers/gles2/shaders/ssao.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 
 
 void main() {
 void main() {
 
 
@@ -8,6 +10,7 @@ void main() {
 	gl_Position.z = 1.0;
 	gl_Position.z = 1.0;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #define TWO_PI 6.283185307179586476925286766559
 #define TWO_PI 6.283185307179586476925286766559
@@ -53,6 +56,7 @@ const int ROTATIONS[] = int[](
 		29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
 		29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
 		31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
 		31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
 		19, 27, 21, 25, 39, 29, 17, 21, 27);
 		19, 27, 21, 25, 39, 29, 17, 21, 27);
+/* clang-format on */
 
 
 //#define NUM_SPIRAL_TURNS (7)
 //#define NUM_SPIRAL_TURNS (7)
 const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1];
 const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1];

+ 5 - 1
drivers/gles2/shaders/ssao_blur.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 
 
 void main() {
 void main() {
 
 
@@ -8,9 +10,11 @@ void main() {
 	gl_Position.z = 1.0;
 	gl_Position.z = 1.0;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 uniform sampler2D source_ssao; //texunit:0
 uniform sampler2D source_ssao; //texunit:0
+/* clang-format on */
 uniform sampler2D source_depth; //texunit:1
 uniform sampler2D source_depth; //texunit:1
 uniform sampler2D source_normal; //texunit:3
 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.356642, 0.239400, 0.072410, 0.009869);
 		//float[](0.398943, 0.241971, 0.053991, 0.004432, 0.000134);  // stddev = 1.0
 		//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.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)*/
 /** (1, 0) or (0, 1)*/
 uniform ivec2 axis;
 uniform ivec2 axis;

+ 4 - 0
drivers/gles2/shaders/ssao_minify.glsl

@@ -1,12 +1,15 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 
 
 void main() {
 void main() {
 
 
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #ifdef MINIFY_START
 #ifdef MINIFY_START
@@ -14,6 +17,7 @@ void main() {
 #define SDEPTH_TYPE highp sampler2D
 #define SDEPTH_TYPE highp sampler2D
 uniform float camera_z_far;
 uniform float camera_z_far;
 uniform float camera_z_near;
 uniform float camera_z_near;
+/* clang-format on */
 
 
 #else
 #else
 
 

+ 4 - 0
drivers/gles2/shaders/subsurf_scattering.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -11,6 +13,7 @@ void main() {
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 //#define QUALIFIER uniform // some guy on the interweb says it may be faster with this
 //#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
 #ifdef USE_25_SAMPLES
 const int kernel_size = 25;
 const int kernel_size = 25;
+/* clang-format on */
 QUALIFIER vec2 kernel[25] = vec2[](
 QUALIFIER vec2 kernel[25] = vec2[](
 		vec2(0.530605, 0.0),
 		vec2(0.530605, 0.0),
 		vec2(0.000973794, -3.0),
 		vec2(0.000973794, -3.0),

+ 5 - 1
drivers/gles2/shaders/tonemap.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -14,6 +16,7 @@ void main() {
 #endif
 #endif
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #if !defined(GLES_OVER_GL)
 #if !defined(GLES_OVER_GL)
@@ -21,6 +24,7 @@ precision mediump float;
 #endif
 #endif
 
 
 in vec2 uv_interp;
 in vec2 uv_interp;
+/* clang-format on */
 
 
 uniform highp sampler2D source; //texunit:0
 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;
 	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))) +
 	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)
 #define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod)

+ 4 - 0
drivers/gles3/shaders/blend_shape.glsl

@@ -1,3 +1,4 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 /*
 /*
@@ -23,6 +24,7 @@ ARRAY_INDEX=8,
 /* INPUT ATTRIBS */
 /* INPUT ATTRIBS */
 
 
 layout(location = 0) in highp VFORMAT vertex_attrib;
 layout(location = 0) in highp VFORMAT vertex_attrib;
+/* clang-format on */
 layout(location = 1) in vec3 normal_attrib;
 layout(location = 1) in vec3 normal_attrib;
 
 
 #ifdef ENABLE_TANGENT
 #ifdef ENABLE_TANGENT
@@ -183,8 +185,10 @@ void main() {
 	gl_Position = vec4(0.0);
 	gl_Position = vec4(0.0);
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 void main() {
 void main() {
 
 
 }
 }
+/* clang-format on */

+ 39 - 13
drivers/gles3/shaders/canvas.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec2 vertex;
 layout(location = 0) in highp vec2 vertex;
+/* clang-format on */
 layout(location = 3) in vec4 color_attrib;
 layout(location = 3) in vec4 color_attrib;
 
 
 #ifdef USE_SKELETON
 #ifdef USE_SKELETON
@@ -97,16 +99,22 @@ uniform int v_frames;
 
 
 #if defined(USE_MATERIAL)
 #if defined(USE_MATERIAL)
 
 
+/* clang-format off */
 layout(std140) uniform UniformData { //ubo:2
 layout(std140) uniform UniformData { //ubo:2
 
 
 MATERIAL_UNIFORMS
 MATERIAL_UNIFORMS
 
 
 };
 };
+/* clang-format on */
 
 
 #endif
 #endif
 
 
+/* clang-format off */
+
 VERTEX_SHADER_GLOBALS
 VERTEX_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 void main() {
 void main() {
 
 
 	vec4 color = color_attrib;
 	vec4 color = color_attrib;
@@ -151,11 +159,13 @@ void main() {
 
 
 #define extra_matrix extra_matrix2
 #define extra_matrix extra_matrix2
 
 
-{
+	{
+		/* clang-format off */
 
 
 VERTEX_SHADER_CODE
 VERTEX_SHADER_CODE
 
 
-}
+		/* clang-format on */
+	}
 
 
 #ifdef USE_NINEPATCH
 #ifdef USE_NINEPATCH
 
 
@@ -188,29 +198,29 @@ VERTEX_SHADER_CODE
 		highp mat2x4 m;
 		highp mat2x4 m;
 		m = mat2x4(
 		m = mat2x4(
 					texelFetch(skeleton_texture, tex_ofs, 0),
 					texelFetch(skeleton_texture, tex_ofs, 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0))
-				* bone_weights.x;
+					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) *
+			bone_weights.x;
 
 
 		tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 2);
 		tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 2);
 
 
 		m += mat2x4(
 		m += mat2x4(
-					texelFetch(skeleton_texture, tex_ofs, 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0))
-				* bone_weights.y;
+					 texelFetch(skeleton_texture, tex_ofs, 0),
+					 texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) *
+			 bone_weights.y;
 
 
 		tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 2);
 		tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 2);
 
 
 		m += mat2x4(
 		m += mat2x4(
-					texelFetch(skeleton_texture, tex_ofs, 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0))
-				* bone_weights.z;
+					 texelFetch(skeleton_texture, tex_ofs, 0),
+					 texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) *
+			 bone_weights.z;
 
 
 		tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 2);
 		tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 2);
 
 
 		m += mat2x4(
 		m += mat2x4(
-					texelFetch(skeleton_texture, tex_ofs, 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0))
-				* bone_weights.w;
+					 texelFetch(skeleton_texture, tex_ofs, 0),
+					 texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0)) *
+			 bone_weights.w;
 
 
 		mat4 bone_matrix = skeleton_transform * transpose(mat4(m[0], m[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0))) * skeleton_transform_inverse;
 		mat4 bone_matrix = skeleton_transform * transpose(mat4(m[0], m[1], vec4(0.0, 0.0, 1.0, 0.0), vec4(0.0, 0.0, 0.0, 1.0))) * skeleton_transform_inverse;
 
 
@@ -246,9 +256,11 @@ VERTEX_SHADER_CODE
 #endif
 #endif
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 uniform mediump sampler2D color_texture; // texunit:0
 uniform mediump sampler2D color_texture; // texunit:0
+/* clang-format on */
 uniform highp vec2 color_texpixel_size;
 uniform highp vec2 color_texpixel_size;
 uniform mediump sampler2D normal_texture; // texunit:1
 uniform mediump sampler2D normal_texture; // texunit:1
 
 
@@ -313,16 +325,22 @@ layout(location = 0) out mediump vec4 frag_color;
 
 
 #if defined(USE_MATERIAL)
 #if defined(USE_MATERIAL)
 
 
+/* clang-format off */
 layout(std140) uniform UniformData {
 layout(std140) uniform UniformData {
 
 
 MATERIAL_UNIFORMS
 MATERIAL_UNIFORMS
 
 
 };
 };
+/* clang-format on */
 
 
 #endif
 #endif
 
 
+/* clang-format off */
+
 FRAGMENT_SHADER_GLOBALS
 FRAGMENT_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 void light_compute(
 void light_compute(
 		inout vec4 light,
 		inout vec4 light,
 		inout vec2 light_vec,
 		inout vec2 light_vec,
@@ -339,8 +357,12 @@ void light_compute(
 
 
 #if defined(USE_LIGHT_SHADER_CODE)
 #if defined(USE_LIGHT_SHADER_CODE)
 
 
+	/* clang-format off */
+
 LIGHT_SHADER_CODE
 LIGHT_SHADER_CODE
 
 
+	/* clang-format on */
+
 #endif
 #endif
 }
 }
 
 
@@ -472,8 +494,12 @@ void main() {
 		vec3 normal_map = vec3(0.0, 0.0, 1.0);
 		vec3 normal_map = vec3(0.0, 0.0, 1.0);
 #endif
 #endif
 
 
+		/* clang-format off */
+
 FRAGMENT_SHADER_CODE
 FRAGMENT_SHADER_CODE
 
 
+		/* clang-format on */
+
 #if defined(NORMALMAP_USED)
 #if defined(NORMALMAP_USED)
 		normal = mix(vec3(0.0, 0.0, 1.0), normal_map * vec3(2.0, -2.0, 1.0) - vec3(1.0, -1.0, 0.0), normal_depth);
 		normal = mix(vec3(0.0, 0.0, 1.0), normal_map * vec3(2.0, -2.0, 1.0) - vec3(1.0, -1.0, 0.0), normal_depth);
 #endif
 #endif

+ 4 - 0
drivers/gles3/shaders/canvas_shadow.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 uniform highp mat4 projection_matrix;
 uniform highp mat4 projection_matrix;
+/* clang-format on */
 uniform highp mat4 light_matrix;
 uniform highp mat4 light_matrix;
 uniform highp mat4 world_matrix;
 uniform highp mat4 world_matrix;
 uniform highp float distance_norm;
 uniform highp float distance_norm;
@@ -15,9 +17,11 @@ void main() {
 	position_interp = gl_Position;
 	position_interp = gl_Position;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 in highp vec4 position_interp;
 in highp vec4 position_interp;
+/* clang-format on */
 
 
 #ifdef USE_RGBA_SHADOWS
 #ifdef USE_RGBA_SHADOWS
 layout(location = 0) out lowp vec4 distance_buf;
 layout(location = 0) out lowp vec4 distance_buf;

+ 4 - 0
drivers/gles3/shaders/copy.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 #if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
 #if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
 layout(location = 4) in vec3 cube_in;
 layout(location = 4) in vec3 cube_in;
 #else
 #else
@@ -45,6 +47,7 @@ void main() {
 #endif
 #endif
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #define M_PI 3.14159265359
 #define M_PI 3.14159265359
@@ -58,6 +61,7 @@ in vec3 cube_interp;
 #else
 #else
 in vec2 uv_interp;
 in vec2 uv_interp;
 #endif
 #endif
+/* clang-format on */
 
 
 #ifdef USE_ASYM_PANO
 #ifdef USE_ASYM_PANO
 uniform highp mat4 pano_transform;
 uniform highp mat4 pano_transform;

+ 4 - 0
drivers/gles3/shaders/cube_to_dp.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -11,9 +13,11 @@ void main() {
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 uniform highp samplerCube source_cube; //texunit:0
 uniform highp samplerCube source_cube; //texunit:0
+/* clang-format on */
 in vec2 uv_interp;
 in vec2 uv_interp;
 
 
 uniform bool z_flip;
 uniform bool z_flip;

+ 4 - 0
drivers/gles3/shaders/cubemap_filter.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec2 vertex;
 layout(location = 0) in highp vec2 vertex;
+/* clang-format on */
 
 
 layout(location = 4) in highp vec2 uv;
 layout(location = 4) in highp vec2 uv;
 
 
@@ -12,9 +14,11 @@ void main() {
 	gl_Position = vec4(vertex, 0, 1);
 	gl_Position = vec4(vertex, 0, 1);
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 precision highp float;
 precision highp float;
+/* clang-format on */
 precision highp int;
 precision highp int;
 
 
 #ifdef USE_SOURCE_PANORAMA
 #ifdef USE_SOURCE_PANORAMA

+ 4 - 0
drivers/gles3/shaders/effect_blur.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -22,11 +24,13 @@ void main() {
 #endif
 #endif
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #if !defined(GLES_OVER_GL)
 #if !defined(GLES_OVER_GL)
 precision mediump float;
 precision mediump float;
 #endif
 #endif
+/* clang-format on */
 
 
 in vec2 uv_interp;
 in vec2 uv_interp;
 uniform sampler2D source_color; //texunit:0
 uniform sampler2D source_color; //texunit:0

+ 4 - 0
drivers/gles3/shaders/exposure.glsl

@@ -1,15 +1,19 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 
 
 void main() {
 void main() {
 
 
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 uniform highp sampler2D source_exposure; //texunit:0
 uniform highp sampler2D source_exposure; //texunit:0
+/* clang-format on */
 
 
 #ifdef EXPOSURE_BEGIN
 #ifdef EXPOSURE_BEGIN
 
 

+ 18 - 0
drivers/gles3/shaders/particles.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 color;
 layout(location = 0) in highp vec4 color;
+/* clang-format on */
 layout(location = 1) in highp vec4 velocity_active;
 layout(location = 1) in highp vec4 velocity_active;
 layout(location = 2) in highp vec4 custom;
 layout(location = 2) in highp vec4 custom;
 layout(location = 3) in highp vec4 xform_1;
 layout(location = 3) in highp vec4 xform_1;
@@ -45,16 +47,22 @@ out highp vec4 out_xform_3; //tfb:
 
 
 #if defined(USE_MATERIAL)
 #if defined(USE_MATERIAL)
 
 
+/* clang-format off */
 layout(std140) uniform UniformData { //ubo:0
 layout(std140) uniform UniformData { //ubo:0
 
 
 MATERIAL_UNIFORMS
 MATERIAL_UNIFORMS
 
 
 };
 };
+/* clang-format on */
 
 
 #endif
 #endif
 
 
+/* clang-format off */
+
 VERTEX_SHADER_GLOBALS
 VERTEX_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 uint hash(uint x) {
 uint hash(uint x) {
 
 
 	x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
 	x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
@@ -165,7 +173,11 @@ void main() {
 		//execute shader
 		//execute shader
 
 
 		{
 		{
+			/* clang-format off */
+
 VERTEX_SHADER_CODE
 VERTEX_SHADER_CODE
+
+			/* clang-format on */
 		}
 		}
 
 
 #if !defined(DISABLE_FORCE)
 #if !defined(DISABLE_FORCE)
@@ -221,6 +233,7 @@ VERTEX_SHADER_CODE
 #endif //PARTICLES_COPY
 #endif //PARTICLES_COPY
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 // any code here is never executed, stuff is filled just so it works
 // any code here is never executed, stuff is filled just so it works
@@ -240,10 +253,15 @@ FRAGMENT_SHADER_GLOBALS
 void main() {
 void main() {
 
 
 	{
 	{
+
 LIGHT_SHADER_CODE
 LIGHT_SHADER_CODE
+
 	}
 	}
 
 
 	{
 	{
+
 FRAGMENT_SHADER_CODE
 FRAGMENT_SHADER_CODE
+
 	}
 	}
 }
 }
+/* clang-format on */

+ 4 - 0
drivers/gles3/shaders/resolve.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -11,11 +13,13 @@ void main() {
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #if !defined(GLES_OVER_GL)
 #if !defined(GLES_OVER_GL)
 precision mediump float;
 precision mediump float;
 #endif
 #endif
+/* clang-format on */
 
 
 in vec2 uv_interp;
 in vec2 uv_interp;
 uniform sampler2D source_specular; // texunit:0
 uniform sampler2D source_specular; // texunit:0

+ 43 - 21
drivers/gles3/shaders/scene.glsl

@@ -1,3 +1,4 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 #define M_PI 3.14159265359
 #define M_PI 3.14159265359
@@ -21,6 +22,7 @@ ARRAY_INDEX=8,
 /* INPUT ATTRIBS */
 /* INPUT ATTRIBS */
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 1) in vec3 normal_attrib;
 layout(location = 1) in vec3 normal_attrib;
 #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
 #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY)
 layout(location = 2) in vec4 tangent_attrib;
 layout(location = 2) in vec4 tangent_attrib;
@@ -226,16 +228,22 @@ out vec3 binormal_interp;
 
 
 #if defined(USE_MATERIAL)
 #if defined(USE_MATERIAL)
 
 
+/* clang-format off */
 layout(std140) uniform UniformData { // ubo:1
 layout(std140) uniform UniformData { // ubo:1
 
 
 MATERIAL_UNIFORMS
 MATERIAL_UNIFORMS
 
 
 };
 };
+/* clang-format on */
 
 
 #endif
 #endif
 
 
+/* clang-format off */
+
 VERTEX_SHADER_GLOBALS
 VERTEX_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 #ifdef RENDER_DEPTH_DUAL_PARABOLOID
 #ifdef RENDER_DEPTH_DUAL_PARABOLOID
 
 
 out highp float dp_clip;
 out highp float dp_clip;
@@ -340,32 +348,32 @@ void main() {
 		m = mat3x4(
 		m = mat3x4(
 					texelFetch(skeleton_texture, tex_ofs, 0),
 					texelFetch(skeleton_texture, tex_ofs, 0),
 					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
 					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0))
-			* bone_weights.x;
+					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) *
+			bone_weights.x;
 
 
 		tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 3);
 		tex_ofs = ivec2(bone_indicesi.y % 256, (bone_indicesi.y / 256) * 3);
 
 
 		m += mat3x4(
 		m += mat3x4(
-					texelFetch(skeleton_texture, tex_ofs, 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0))
-			* bone_weights.y;
+					 texelFetch(skeleton_texture, tex_ofs, 0),
+					 texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
+					 texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) *
+			 bone_weights.y;
 
 
 		tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 3);
 		tex_ofs = ivec2(bone_indicesi.z % 256, (bone_indicesi.z / 256) * 3);
 
 
 		m += mat3x4(
 		m += mat3x4(
-					texelFetch(skeleton_texture, tex_ofs, 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0))
-			* bone_weights.z;
+					 texelFetch(skeleton_texture, tex_ofs, 0),
+					 texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
+					 texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) *
+			 bone_weights.z;
 
 
 		tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 3);
 		tex_ofs = ivec2(bone_indicesi.w % 256, (bone_indicesi.w / 256) * 3);
 
 
 		m += mat3x4(
 		m += mat3x4(
-					texelFetch(skeleton_texture, tex_ofs, 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
-					texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0))
-			* bone_weights.w;
+					 texelFetch(skeleton_texture, tex_ofs, 0),
+					 texelFetch(skeleton_texture, tex_ofs + ivec2(0, 1), 0),
+					 texelFetch(skeleton_texture, tex_ofs + ivec2(0, 2), 0)) *
+			 bone_weights.w;
 
 
 		mat4 bone_matrix = transpose(mat4(m[0], m[1], m[2], vec4(0.0, 0.0, 0.0, 1.0)));
 		mat4 bone_matrix = transpose(mat4(m[0], m[1], m[2], vec4(0.0, 0.0, 0.0, 1.0)));
 
 
@@ -374,11 +382,13 @@ void main() {
 #endif
 #endif
 
 
 	mat4 modelview = camera_inverse_matrix * world_matrix;
 	mat4 modelview = camera_inverse_matrix * world_matrix;
-{
+	{
+		/* clang-format off */
 
 
 VERTEX_SHADER_CODE
 VERTEX_SHADER_CODE
 
 
-}
+		/* clang-format on */
+	}
 
 
 // using local coordinates (default)
 // using local coordinates (default)
 #if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)
 #if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED)
@@ -501,6 +511,7 @@ VERTEX_SHADER_CODE
 #endif // USE_VERTEX_LIGHTING
 #endif // USE_VERTEX_LIGHTING
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 /* texture unit usage, N is max_texture_unity-N
 /* texture unit usage, N is max_texture_unity-N
@@ -519,6 +530,7 @@ VERTEX_SHADER_CODE
 */
 */
 
 
 uniform highp mat4 world_transform;
 uniform highp mat4 world_transform;
+/* clang-format on */
 
 
 #define M_PI 3.14159265359
 #define M_PI 3.14159265359
 
 
@@ -552,7 +564,6 @@ layout(std140) uniform Radiance { // ubo:2
 
 
 	mat4 radiance_inverse_xform;
 	mat4 radiance_inverse_xform;
 	float radiance_ambient_contribution;
 	float radiance_ambient_contribution;
-
 };
 };
 
 
 #define RADIANCE_MAX_LOD 5.0
 #define RADIANCE_MAX_LOD 5.0
@@ -608,16 +619,22 @@ vec3 textureDualParaboloid(sampler2D p_tex, vec3 p_vec, float p_roughness) {
 
 
 #if defined(USE_MATERIAL)
 #if defined(USE_MATERIAL)
 
 
+/* clang-format off */
 layout(std140) uniform UniformData {
 layout(std140) uniform UniformData {
 
 
 MATERIAL_UNIFORMS
 MATERIAL_UNIFORMS
 
 
 };
 };
+/* clang-format on */
 
 
 #endif
 #endif
 
 
+/* clang-format off */
+
 FRAGMENT_SHADER_GLOBALS
 FRAGMENT_SHADER_GLOBALS
 
 
+/* clang-format on */
+
 layout(std140) uniform SceneData {
 layout(std140) uniform SceneData {
 
 
 	highp mat4 projection_matrix;
 	highp mat4 projection_matrix;
@@ -663,7 +680,7 @@ layout(std140) uniform SceneData {
 	highp float fog_height_curve;
 	highp float fog_height_curve;
 };
 };
 
 
-//directional light data
+	//directional light data
 
 
 #ifdef USE_LIGHT_DIRECTIONAL
 #ifdef USE_LIGHT_DIRECTIONAL
 
 
@@ -701,7 +718,6 @@ struct LightData {
 	mediump vec4 light_clamp;
 	mediump vec4 light_clamp;
 	mediump vec4 shadow_color_contact;
 	mediump vec4 shadow_color_contact;
 	highp mat4 shadow_matrix;
 	highp mat4 shadow_matrix;
-
 };
 };
 
 
 layout(std140) uniform OmniLightData { // ubo:4
 layout(std140) uniform OmniLightData { // ubo:4
@@ -916,8 +932,12 @@ void light_compute(vec3 N, vec3 L, vec3 V, vec3 B, vec3 T, vec3 light_color, vec
 	vec3 light = L;
 	vec3 light = L;
 	vec3 view = V;
 	vec3 view = V;
 
 
+	/* clang-format off */
+
 LIGHT_SHADER_CODE
 LIGHT_SHADER_CODE
 
 
+	/* clang-format on */
+
 #else
 #else
 	float NdotL = dot(N, L);
 	float NdotL = dot(N, L);
 	float cNdotL = max(NdotL, 0.0); // clamped NdotL
 	float cNdotL = max(NdotL, 0.0); // clamped NdotL
@@ -1599,11 +1619,13 @@ void main() {
 	float sss_strength = 0.0;
 	float sss_strength = 0.0;
 #endif
 #endif
 
 
-{
+	{
+		/* clang-format off */
 
 
 FRAGMENT_SHADER_CODE
 FRAGMENT_SHADER_CODE
 
 
-}
+		/* clang-format on */
+	}
 
 
 #if defined(ALPHA_SCISSOR_USED)
 #if defined(ALPHA_SCISSOR_USED)
 	if (alpha < alpha_scissor) {
 	if (alpha < alpha_scissor) {

+ 4 - 0
drivers/gles3/shaders/screen_space_reflection.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -13,9 +15,11 @@ void main() {
 	pos_interp.xy = gl_Position.xy;
 	pos_interp.xy = gl_Position.xy;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 in vec2 uv_interp;
 in vec2 uv_interp;
+/* clang-format on */
 in vec2 pos_interp;
 in vec2 pos_interp;
 
 
 uniform sampler2D source_diffuse; //texunit:0
 uniform sampler2D source_diffuse; //texunit:0

+ 5 - 2
drivers/gles3/shaders/ssao.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 
 
 void main() {
 void main() {
 
 
@@ -8,6 +10,7 @@ void main() {
 	gl_Position.z = 1.0;
 	gl_Position.z = 1.0;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #define TWO_PI 6.283185307179586476925286766559
 #define TWO_PI 6.283185307179586476925286766559
@@ -46,8 +49,8 @@ const int ROTATIONS[] = int[](
 		13, 17, 11, 17, 19, 18, 25, 18, 19, 19,
 		13, 17, 11, 17, 19, 18, 25, 18, 19, 19,
 		29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
 		29, 21, 19, 27, 31, 29, 21, 18, 17, 29,
 		31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
 		31, 31, 23, 18, 25, 26, 25, 23, 19, 34,
-		19, 27, 21, 25, 39, 29, 17, 21, 27
-);
+		19, 27, 21, 25, 39, 29, 17, 21, 27);
+/* clang-format on */
 
 
 //#define NUM_SPIRAL_TURNS (7)
 //#define NUM_SPIRAL_TURNS (7)
 const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1];
 const int NUM_SPIRAL_TURNS = ROTATIONS[NUM_SAMPLES - 1];

+ 8 - 6
drivers/gles3/shaders/ssao_blur.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 
 
 void main() {
 void main() {
 
 
@@ -8,9 +10,11 @@ void main() {
 	gl_Position.z = 1.0;
 	gl_Position.z = 1.0;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 uniform sampler2D source_ssao; //texunit:0
 uniform sampler2D source_ssao; //texunit:0
+/* clang-format on */
 uniform sampler2D source_depth; //texunit:1
 uniform sampler2D source_depth; //texunit:1
 uniform sampler2D source_normal; //texunit:3
 uniform sampler2D source_normal; //texunit:3
 
 
@@ -36,16 +40,14 @@ uniform int filter_scale;
 /** Filter radius in pixels. This will be multiplied by SCALE. */
 /** Filter radius in pixels. This will be multiplied by SCALE. */
 #define R (4)
 #define R (4)
 
 
-
 //////////////////////////////////////////////////////////////////////////////////////////////
 //////////////////////////////////////////////////////////////////////////////////////////////
 
 
-
 // Gaussian coefficients
 // Gaussian coefficients
 const float gaussian[R + 1] =
 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.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
 
 
 /** (1, 0) or (0, 1) */
 /** (1, 0) or (0, 1) */
 uniform ivec2 axis;
 uniform ivec2 axis;

+ 4 - 0
drivers/gles3/shaders/ssao_minify.glsl

@@ -1,18 +1,22 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 
 
 void main() {
 void main() {
 
 
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #ifdef MINIFY_START
 #ifdef MINIFY_START
 
 
 #define SDEPTH_TYPE highp sampler2D
 #define SDEPTH_TYPE highp sampler2D
 uniform float camera_z_far;
 uniform float camera_z_far;
+/* clang-format on */
 uniform float camera_z_near;
 uniform float camera_z_near;
 
 
 #else
 #else

+ 8 - 8
drivers/gles3/shaders/subsurf_scattering.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -11,6 +13,7 @@ void main() {
 	gl_Position = vertex_attrib;
 	gl_Position = vertex_attrib;
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 //#define QUALIFIER uniform // some guy on the interweb says it may be faster with this
 //#define QUALIFIER uniform // some guy on the interweb says it may be faster with this
@@ -18,7 +21,8 @@ void main() {
 
 
 #ifdef USE_25_SAMPLES
 #ifdef USE_25_SAMPLES
 const int kernel_size = 25;
 const int kernel_size = 25;
-QUALIFIER vec2 kernel[25] = vec2[] (
+/* clang-format on */
+QUALIFIER vec2 kernel[25] = vec2[](
 		vec2(0.530605, 0.0),
 		vec2(0.530605, 0.0),
 		vec2(0.000973794, -3.0),
 		vec2(0.000973794, -3.0),
 		vec2(0.00333804, -2.52083),
 		vec2(0.00333804, -2.52083),
@@ -43,8 +47,7 @@ QUALIFIER vec2 kernel[25] = vec2[] (
 		vec2(0.00700976, 1.6875),
 		vec2(0.00700976, 1.6875),
 		vec2(0.00500364, 2.08333),
 		vec2(0.00500364, 2.08333),
 		vec2(0.00333804, 2.52083),
 		vec2(0.00333804, 2.52083),
-		vec2(0.000973794, 3.0)
-);
+		vec2(0.000973794, 3.0));
 #endif //USE_25_SAMPLES
 #endif //USE_25_SAMPLES
 
 
 #ifdef USE_17_SAMPLES
 #ifdef USE_17_SAMPLES
@@ -66,11 +69,9 @@ QUALIFIER vec2 kernel[17] = vec2[](
 		vec2(0.0216301, 0.78125),
 		vec2(0.0216301, 0.78125),
 		vec2(0.0144609, 1.125),
 		vec2(0.0144609, 1.125),
 		vec2(0.0100386, 1.53125),
 		vec2(0.0100386, 1.53125),
-		vec2(0.00317394, 2.0)
-);
+		vec2(0.00317394, 2.0));
 #endif //USE_17_SAMPLES
 #endif //USE_17_SAMPLES
 
 
-
 #ifdef USE_11_SAMPLES
 #ifdef USE_11_SAMPLES
 const int kernel_size = 11;
 const int kernel_size = 11;
 QUALIFIER vec2 kernel[11] = vec2[](
 QUALIFIER vec2 kernel[11] = vec2[](
@@ -84,8 +85,7 @@ QUALIFIER vec2 kernel[11] = vec2[](
 		vec2(0.0821904, 0.32),
 		vec2(0.0821904, 0.32),
 		vec2(0.03639, 0.72),
 		vec2(0.03639, 0.72),
 		vec2(0.0192831, 1.28),
 		vec2(0.0192831, 1.28),
-		vec2(0.00471691, 2.0)
-);
+		vec2(0.00471691, 2.0));
 #endif //USE_11_SAMPLES
 #endif //USE_11_SAMPLES
 
 
 uniform float max_radius;
 uniform float max_radius;

+ 6 - 4
drivers/gles3/shaders/tonemap.glsl

@@ -1,6 +1,8 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
 layout(location = 0) in highp vec4 vertex_attrib;
 layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
 layout(location = 4) in vec2 uv_in;
 layout(location = 4) in vec2 uv_in;
 
 
 out vec2 uv_interp;
 out vec2 uv_interp;
@@ -15,11 +17,13 @@ void main() {
 #endif
 #endif
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 #if !defined(GLES_OVER_GL)
 #if !defined(GLES_OVER_GL)
 precision mediump float;
 precision mediump float;
 #endif
 #endif
+/* clang-format on */
 
 
 in vec2 uv_interp;
 in vec2 uv_interp;
 
 
@@ -110,10 +114,8 @@ vec4 texture2D_bicubic(sampler2D tex, vec2 uv, int p_lod) {
 	vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - vec2(0.5f)) * pixel_size;
 	vec2 p2 = (vec2(iuv.x + h0x, iuv.y + h1y) - vec2(0.5f)) * pixel_size;
 	vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5f)) * pixel_size;
 	vec2 p3 = (vec2(iuv.x + h1x, iuv.y + h1y) - vec2(0.5f)) * 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));
+	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)));
 }
 }
 
 
 #define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod)
 #define GLOW_TEXTURE_SAMPLE(m_tex, m_uv, m_lod) texture2D_bicubic(m_tex, m_uv, m_lod)

+ 1 - 1
misc/hooks/pre-commit-clang-format

@@ -31,7 +31,7 @@ PARSE_EXTS=true
 
 
 # File types to parse. Only effective when PARSE_EXTS is true.
 # File types to parse. Only effective when PARSE_EXTS is true.
 # FILE_EXTS=".c .h .cpp .hpp"
 # FILE_EXTS=".c .h .cpp .hpp"
-FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc *.java"
+FILE_EXTS=".c .h .cpp .hpp .cc .hh .cxx .m .mm .inc *.java *.glsl"
 
 
 # Use pygmentize instead of cat to parse diff with highlighting.
 # Use pygmentize instead of cat to parse diff with highlighting.
 # Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)
 # Install it with `pip install pygments` (Linux) or `easy_install Pygments` (Mac)

+ 1 - 1
misc/travis/clang-format.sh

@@ -11,7 +11,7 @@ else
     RANGE=HEAD
     RANGE=HEAD
 fi
 fi
 
 
-FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java)$")
+FILES=$(git diff-tree --no-commit-id --name-only -r $RANGE | grep -v thirdparty/ | grep -E "\.(c|h|cpp|hpp|cc|hh|cxx|m|mm|inc|java|glsl)$")
 echo "Checking files:\n$FILES"
 echo "Checking files:\n$FILES"
 
 
 # create a random filename to store our generated patch
 # create a random filename to store our generated patch

+ 35 - 32
modules/mobile_vr/shaders/lens_distorted.glsl

@@ -1,7 +1,9 @@
+/* clang-format off */
 [vertex]
 [vertex]
 
 
-layout(location=0) in highp vec4 vertex_attrib;
-layout(location=4) in vec2 uv_in;
+layout(location = 0) in highp vec4 vertex_attrib;
+/* clang-format on */
+layout(location = 4) in vec2 uv_in;
 
 
 uniform float offset_x;
 uniform float offset_x;
 
 
@@ -9,13 +11,15 @@ out vec2 uv_interp;
 
 
 void main() {
 void main() {
 
 
-  uv_interp = uv_in;
-  gl_Position = vec4(vertex_attrib.x + offset_x, vertex_attrib.y, 0.0, 1.0);
+	uv_interp = uv_in;
+	gl_Position = vec4(vertex_attrib.x + offset_x, vertex_attrib.y, 0.0, 1.0);
 }
 }
 
 
+/* clang-format off */
 [fragment]
 [fragment]
 
 
 uniform sampler2D source; //texunit:0
 uniform sampler2D source; //texunit:0
+/* clang-format on */
 
 
 uniform vec2 eye_center;
 uniform vec2 eye_center;
 uniform float k1;
 uniform float k1;
@@ -28,32 +32,31 @@ in vec2 uv_interp;
 layout(location = 0) out vec4 frag_color;
 layout(location = 0) out vec4 frag_color;
 
 
 void main() {
 void main() {
-  vec2 coords = uv_interp;
-  vec2 offset = coords - eye_center;
-
-  // take aspect ratio into account
-  offset.y /= aspect_ratio;
-
-  // distort 
-  vec2 offset_sq = offset * offset;
-  float radius_sq = offset_sq.x + offset_sq.y;
-  float radius_s4 = radius_sq * radius_sq;
-  float distortion_scale = 1.0 + (k1 * radius_sq) + (k2 * radius_s4);
-  offset *= distortion_scale;
-
-  // reapply aspect ratio
-  offset.y *= aspect_ratio;
-
-  // add our eye center back in
-  coords = offset + eye_center;
-  coords /= upscale;
-
-  // and check our color
-  if (coords.x < -1.0 || coords.y < -1.0 || coords.x > 1.0 || coords.y > 1.0) {
-    frag_color = vec4(0.0, 0.0, 0.0, 1.0);
-  } else {
-    coords = (coords + vec2(1.0)) / vec2(2.0);
-    frag_color = textureLod(source, coords, 0.0);
-  }
+	vec2 coords = uv_interp;
+	vec2 offset = coords - eye_center;
+
+	// take aspect ratio into account
+	offset.y /= aspect_ratio;
+
+	// distort
+	vec2 offset_sq = offset * offset;
+	float radius_sq = offset_sq.x + offset_sq.y;
+	float radius_s4 = radius_sq * radius_sq;
+	float distortion_scale = 1.0 + (k1 * radius_sq) + (k2 * radius_s4);
+	offset *= distortion_scale;
+
+	// reapply aspect ratio
+	offset.y *= aspect_ratio;
+
+	// add our eye center back in
+	coords = offset + eye_center;
+	coords /= upscale;
+
+	// and check our color
+	if (coords.x < -1.0 || coords.y < -1.0 || coords.x > 1.0 || coords.y > 1.0) {
+		frag_color = vec4(0.0, 0.0, 0.0, 1.0);
+	} else {
+		coords = (coords + vec2(1.0)) / vec2(2.0);
+		frag_color = textureLod(source, coords, 0.0);
+	}
 }
 }
-