diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2018-08-27 07:31:48 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2018-08-27 07:34:14 +0200 |
commit | 4226d56ca9ec91c4878d47e3bce4784e5edc3006 (patch) | |
tree | 92a34cf9488067658e5f32da6d48bd5869a40c6b /drivers/gles3 | |
parent | db55d8a4b6ad6c14f2131e02b50689eb8380276f (diff) |
Style: Enable clang-format on GLSL shaders
As of clang-format 6.0.1, putting the `/* clang-format off */` hint
around our "invalid" `[vertex]` and `[shader]` statements isn't enough
to prevent a bogus indent of the next comments and first valid statement,
so we need to enclose that first valid statement in the unformatted chunk.
Diffstat (limited to 'drivers/gles3')
-rw-r--r-- | drivers/gles3/shaders/blend_shape.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas.glsl | 52 | ||||
-rw-r--r-- | drivers/gles3/shaders/canvas_shadow.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/copy.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/cube_to_dp.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/cubemap_filter.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/effect_blur.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/exposure.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/particles.glsl | 18 | ||||
-rw-r--r-- | drivers/gles3/shaders/resolve.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/scene.glsl | 64 | ||||
-rw-r--r-- | drivers/gles3/shaders/screen_space_reflection.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/ssao.glsl | 7 | ||||
-rw-r--r-- | drivers/gles3/shaders/ssao_blur.glsl | 14 | ||||
-rw-r--r-- | drivers/gles3/shaders/ssao_minify.glsl | 4 | ||||
-rw-r--r-- | drivers/gles3/shaders/subsurf_scattering.glsl | 16 | ||||
-rw-r--r-- | drivers/gles3/shaders/tonemap.glsl | 10 |
17 files changed, 167 insertions, 54 deletions
diff --git a/drivers/gles3/shaders/blend_shape.glsl b/drivers/gles3/shaders/blend_shape.glsl index d019062ba0..a1e954e33d 100644 --- a/drivers/gles3/shaders/blend_shape.glsl +++ b/drivers/gles3/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/gles3/shaders/canvas.glsl b/drivers/gles3/shaders/canvas.glsl index 9e99305fe7..53f563303a 100644 --- a/drivers/gles3/shaders/canvas.glsl +++ b/drivers/gles3/shaders/canvas.glsl @@ -1,6 +1,8 @@ +/* clang-format off */ [vertex] layout(location = 0) in highp vec2 vertex; +/* clang-format on */ layout(location = 3) in vec4 color_attrib; #ifdef USE_SKELETON @@ -97,16 +99,22 @@ uniform int v_frames; #if defined(USE_MATERIAL) +/* clang-format off */ layout(std140) uniform UniformData { //ubo:2 MATERIAL_UNIFORMS }; +/* clang-format on */ #endif +/* clang-format off */ + VERTEX_SHADER_GLOBALS +/* clang-format on */ + void main() { vec4 color = color_attrib; @@ -151,11 +159,13 @@ void main() { #define extra_matrix extra_matrix2 -{ + { + /* clang-format off */ VERTEX_SHADER_CODE -} + /* clang-format on */ + } #ifdef USE_NINEPATCH @@ -188,29 +198,29 @@ VERTEX_SHADER_CODE highp mat2x4 m; m = mat2x4( 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); 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); 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); 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; @@ -246,9 +256,11 @@ VERTEX_SHADER_CODE #endif } +/* clang-format off */ [fragment] uniform mediump sampler2D color_texture; // texunit:0 +/* clang-format on */ uniform highp vec2 color_texpixel_size; uniform mediump sampler2D normal_texture; // texunit:1 @@ -313,16 +325,22 @@ layout(location = 0) out mediump vec4 frag_color; #if defined(USE_MATERIAL) +/* clang-format off */ layout(std140) uniform UniformData { MATERIAL_UNIFORMS }; +/* clang-format on */ #endif +/* clang-format off */ + FRAGMENT_SHADER_GLOBALS +/* clang-format on */ + void light_compute( inout vec4 light, inout vec2 light_vec, @@ -339,8 +357,12 @@ void light_compute( #if defined(USE_LIGHT_SHADER_CODE) + /* clang-format off */ + LIGHT_SHADER_CODE + /* clang-format on */ + #endif } @@ -472,8 +494,12 @@ void main() { vec3 normal_map = vec3(0.0, 0.0, 1.0); #endif + /* clang-format off */ + FRAGMENT_SHADER_CODE + /* clang-format on */ + #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); #endif diff --git a/drivers/gles3/shaders/canvas_shadow.glsl b/drivers/gles3/shaders/canvas_shadow.glsl index b06e9076d9..68d0713385 100644 --- a/drivers/gles3/shaders/canvas_shadow.glsl +++ b/drivers/gles3/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 layout(location = 0) out lowp vec4 distance_buf; diff --git a/drivers/gles3/shaders/copy.glsl b/drivers/gles3/shaders/copy.glsl index e17b71df27..a5637537d2 100644 --- a/drivers/gles3/shaders/copy.glsl +++ b/drivers/gles3/shaders/copy.glsl @@ -1,6 +1,8 @@ +/* clang-format off */ [vertex] layout(location = 0) in highp vec4 vertex_attrib; +/* clang-format on */ #if defined(USE_CUBEMAP) || defined(USE_PANORAMA) layout(location = 4) in vec3 cube_in; #else @@ -45,6 +47,7 @@ void main() { #endif } +/* clang-format off */ [fragment] #define M_PI 3.14159265359 @@ -58,6 +61,7 @@ in vec3 cube_interp; #else in vec2 uv_interp; #endif +/* clang-format on */ #ifdef USE_ASYM_PANO uniform highp mat4 pano_transform; diff --git a/drivers/gles3/shaders/cube_to_dp.glsl b/drivers/gles3/shaders/cube_to_dp.glsl index 2911746bb7..2b74f054f9 100644 --- a/drivers/gles3/shaders/cube_to_dp.glsl +++ b/drivers/gles3/shaders/cube_to_dp.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,9 +13,11 @@ void main() { gl_Position = vertex_attrib; } +/* clang-format off */ [fragment] uniform highp samplerCube source_cube; //texunit:0 +/* clang-format on */ in vec2 uv_interp; uniform bool z_flip; diff --git a/drivers/gles3/shaders/cubemap_filter.glsl b/drivers/gles3/shaders/cubemap_filter.glsl index 7f2dc5057c..f65f798ff0 100644 --- a/drivers/gles3/shaders/cubemap_filter.glsl +++ b/drivers/gles3/shaders/cubemap_filter.glsl @@ -1,6 +1,8 @@ +/* clang-format off */ [vertex] layout(location = 0) in highp vec2 vertex; +/* clang-format on */ layout(location = 4) in highp vec2 uv; @@ -12,9 +14,11 @@ void main() { gl_Position = vec4(vertex, 0, 1); } +/* clang-format off */ [fragment] precision highp float; +/* clang-format on */ precision highp int; #ifdef USE_SOURCE_PANORAMA diff --git a/drivers/gles3/shaders/effect_blur.glsl b/drivers/gles3/shaders/effect_blur.glsl index 3872ee8d1d..b67d06bc10 100644 --- a/drivers/gles3/shaders/effect_blur.glsl +++ b/drivers/gles3/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,11 +24,13 @@ void main() { #endif } +/* clang-format off */ [fragment] #if !defined(GLES_OVER_GL) precision mediump float; #endif +/* clang-format on */ in vec2 uv_interp; uniform sampler2D source_color; //texunit:0 diff --git a/drivers/gles3/shaders/exposure.glsl b/drivers/gles3/shaders/exposure.glsl index 18fff1ae36..759adcda06 100644 --- a/drivers/gles3/shaders/exposure.glsl +++ b/drivers/gles3/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/gles3/shaders/particles.glsl b/drivers/gles3/shaders/particles.glsl index 56e5545efe..8523c08597 100644 --- a/drivers/gles3/shaders/particles.glsl +++ b/drivers/gles3/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,7 +173,11 @@ void main() { //execute shader { + /* clang-format off */ + VERTEX_SHADER_CODE + + /* clang-format on */ } #if !defined(DISABLE_FORCE) @@ -221,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,10 +253,15 @@ FRAGMENT_SHADER_GLOBALS void main() { { + LIGHT_SHADER_CODE + } { + FRAGMENT_SHADER_CODE + } } +/* clang-format on */ diff --git a/drivers/gles3/shaders/resolve.glsl b/drivers/gles3/shaders/resolve.glsl index d860fa544f..d64d8308c1 100644 --- a/drivers/gles3/shaders/resolve.glsl +++ b/drivers/gles3/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,11 +13,13 @@ void main() { gl_Position = vertex_attrib; } +/* clang-format off */ [fragment] #if !defined(GLES_OVER_GL) precision mediump float; #endif +/* clang-format on */ in vec2 uv_interp; uniform sampler2D source_specular; // texunit:0 diff --git a/drivers/gles3/shaders/scene.glsl b/drivers/gles3/shaders/scene.glsl index cacce93dc5..12cbe02d0c 100644 --- a/drivers/gles3/shaders/scene.glsl +++ b/drivers/gles3/shaders/scene.glsl @@ -1,3 +1,4 @@ +/* clang-format off */ [vertex] #define M_PI 3.14159265359 @@ -21,6 +22,7 @@ ARRAY_INDEX=8, /* INPUT ATTRIBS */ layout(location = 0) in highp vec4 vertex_attrib; +/* clang-format on */ layout(location = 1) in vec3 normal_attrib; #if defined(ENABLE_TANGENT_INTERP) || defined(ENABLE_NORMALMAP) || defined(LIGHT_USE_ANISOTROPY) layout(location = 2) in vec4 tangent_attrib; @@ -226,16 +228,22 @@ out vec3 binormal_interp; #if defined(USE_MATERIAL) +/* clang-format off */ layout(std140) uniform UniformData { // ubo:1 MATERIAL_UNIFORMS }; +/* clang-format on */ #endif +/* clang-format off */ + VERTEX_SHADER_GLOBALS +/* clang-format on */ + #ifdef RENDER_DEPTH_DUAL_PARABOLOID out highp float dp_clip; @@ -340,32 +348,32 @@ void main() { 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.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); 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); 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); 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))); @@ -374,11 +382,13 @@ void main() { #endif mat4 modelview = camera_inverse_matrix * world_matrix; -{ + { + /* clang-format off */ VERTEX_SHADER_CODE -} + /* clang-format on */ + } // using local coordinates (default) #if !defined(SKIP_TRANSFORM_USED) && !defined(VERTEX_WORLD_COORDS_USED) @@ -501,6 +511,7 @@ VERTEX_SHADER_CODE #endif // USE_VERTEX_LIGHTING } +/* clang-format off */ [fragment] /* texture unit usage, N is max_texture_unity-N @@ -519,6 +530,7 @@ VERTEX_SHADER_CODE */ uniform highp mat4 world_transform; +/* clang-format on */ #define M_PI 3.14159265359 @@ -552,7 +564,6 @@ layout(std140) uniform Radiance { // ubo:2 mat4 radiance_inverse_xform; float radiance_ambient_contribution; - }; #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) +/* clang-format off */ layout(std140) uniform UniformData { MATERIAL_UNIFORMS }; +/* clang-format on */ #endif +/* clang-format off */ + FRAGMENT_SHADER_GLOBALS +/* clang-format on */ + layout(std140) uniform SceneData { highp mat4 projection_matrix; @@ -663,7 +680,7 @@ layout(std140) uniform SceneData { highp float fog_height_curve; }; -//directional light data + //directional light data #ifdef USE_LIGHT_DIRECTIONAL @@ -701,7 +718,6 @@ struct LightData { mediump vec4 light_clamp; mediump vec4 shadow_color_contact; highp mat4 shadow_matrix; - }; 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 view = V; + /* clang-format off */ + LIGHT_SHADER_CODE + /* clang-format on */ + #else float NdotL = dot(N, L); float cNdotL = max(NdotL, 0.0); // clamped NdotL @@ -1599,11 +1619,13 @@ void main() { float sss_strength = 0.0; #endif -{ + { + /* clang-format off */ FRAGMENT_SHADER_CODE -} + /* clang-format on */ + } #if defined(ALPHA_SCISSOR_USED) if (alpha < alpha_scissor) { diff --git a/drivers/gles3/shaders/screen_space_reflection.glsl b/drivers/gles3/shaders/screen_space_reflection.glsl index 73b1ddbb0e..86546319a0 100644 --- a/drivers/gles3/shaders/screen_space_reflection.glsl +++ b/drivers/gles3/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/gles3/shaders/ssao.glsl b/drivers/gles3/shaders/ssao.glsl index 2eeeac31c3..be44365169 100644 --- a/drivers/gles3/shaders/ssao.glsl +++ b/drivers/gles3/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 @@ -46,8 +49,8 @@ const int ROTATIONS[] = int[]( 13, 17, 11, 17, 19, 18, 25, 18, 19, 19, 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 -); + 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/gles3/shaders/ssao_blur.glsl b/drivers/gles3/shaders/ssao_blur.glsl index 5526d0de18..c49ea1e957 100644 --- a/drivers/gles3/shaders/ssao_blur.glsl +++ b/drivers/gles3/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 @@ -36,16 +40,14 @@ uniform int filter_scale; /** Filter radius in pixels. This will be multiplied by SCALE. */ #define R (4) - ////////////////////////////////////////////////////////////////////////////////////////////// - // Gaussian coefficients 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) */ uniform ivec2 axis; diff --git a/drivers/gles3/shaders/ssao_minify.glsl b/drivers/gles3/shaders/ssao_minify.glsl index 777a0069fc..1696648dae 100644 --- a/drivers/gles3/shaders/ssao_minify.glsl +++ b/drivers/gles3/shaders/ssao_minify.glsl @@ -1,18 +1,22 @@ +/* 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 #define SDEPTH_TYPE highp sampler2D uniform float camera_z_far; +/* clang-format on */ uniform float camera_z_near; #else diff --git a/drivers/gles3/shaders/subsurf_scattering.glsl b/drivers/gles3/shaders/subsurf_scattering.glsl index af0d5a0e62..f40fb3a244 100644 --- a/drivers/gles3/shaders/subsurf_scattering.glsl +++ b/drivers/gles3/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,7 +21,8 @@ void main() { #ifdef USE_25_SAMPLES 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.000973794, -3.0), vec2(0.00333804, -2.52083), @@ -43,8 +47,7 @@ QUALIFIER vec2 kernel[25] = vec2[] ( vec2(0.00700976, 1.6875), vec2(0.00500364, 2.08333), vec2(0.00333804, 2.52083), - vec2(0.000973794, 3.0) -); + vec2(0.000973794, 3.0)); #endif //USE_25_SAMPLES #ifdef USE_17_SAMPLES @@ -66,11 +69,9 @@ QUALIFIER vec2 kernel[17] = vec2[]( vec2(0.0216301, 0.78125), vec2(0.0144609, 1.125), vec2(0.0100386, 1.53125), - vec2(0.00317394, 2.0) -); + vec2(0.00317394, 2.0)); #endif //USE_17_SAMPLES - #ifdef USE_11_SAMPLES const int kernel_size = 11; QUALIFIER vec2 kernel[11] = vec2[]( @@ -84,8 +85,7 @@ QUALIFIER vec2 kernel[11] = vec2[]( vec2(0.0821904, 0.32), vec2(0.03639, 0.72), vec2(0.0192831, 1.28), - vec2(0.00471691, 2.0) -); + vec2(0.00471691, 2.0)); #endif //USE_11_SAMPLES uniform float max_radius; diff --git a/drivers/gles3/shaders/tonemap.glsl b/drivers/gles3/shaders/tonemap.glsl index 56876bdb72..e4aa8d5730 100644 --- a/drivers/gles3/shaders/tonemap.glsl +++ b/drivers/gles3/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; @@ -15,11 +17,13 @@ void main() { #endif } +/* clang-format off */ [fragment] #if !defined(GLES_OVER_GL) precision mediump float; #endif +/* clang-format on */ 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 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) |