summaryrefslogtreecommitdiff
path: root/drivers/gles2/shaders
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /drivers/gles2/shaders
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'drivers/gles2/shaders')
-rw-r--r--drivers/gles2/shaders/blend_shape.glsl1
-rw-r--r--drivers/gles2/shaders/canvas.glsl5
-rw-r--r--drivers/gles2/shaders/canvas_shadow.glsl2
-rw-r--r--drivers/gles2/shaders/copy.glsl3
-rw-r--r--drivers/gles2/shaders/cube_to_dp.glsl2
-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.glsl2
-rw-r--r--drivers/gles2/shaders/lens_distorted.glsl1
-rw-r--r--drivers/gles2/shaders/particles.glsl6
-rw-r--r--drivers/gles2/shaders/resolve.glsl2
-rw-r--r--drivers/gles2/shaders/scene.glsl21
-rw-r--r--drivers/gles2/shaders/screen_space_reflection.glsl5
-rw-r--r--drivers/gles2/shaders/ssao.glsl2
-rw-r--r--drivers/gles2/shaders/ssao_blur.glsl3
-rw-r--r--drivers/gles2/shaders/ssao_minify.glsl2
-rw-r--r--drivers/gles2/shaders/subsurf_scattering.glsl3
17 files changed, 0 insertions, 68 deletions
diff --git a/drivers/gles2/shaders/blend_shape.glsl b/drivers/gles2/shaders/blend_shape.glsl
index 0d0b3e24e4..7a0a7ebe99 100644
--- a/drivers/gles2/shaders/blend_shape.glsl
+++ b/drivers/gles2/shaders/blend_shape.glsl
@@ -110,7 +110,6 @@ out vec4 weight_out; //tfb:ENABLE_SKELETON
uniform float blend_amount;
void main() {
-
#ifdef ENABLE_BLEND
vertex_out = vertex_attrib_blend + vertex_attrib * blend_amount;
diff --git a/drivers/gles2/shaders/canvas.glsl b/drivers/gles2/shaders/canvas.glsl
index 3b685b3f0b..1fadf44d97 100644
--- a/drivers/gles2/shaders/canvas.glsl
+++ b/drivers/gles2/shaders/canvas.glsl
@@ -111,7 +111,6 @@ vec2 select(vec2 a, vec2 b, bvec2 c) {
}
void main() {
-
vec4 color = color_attrib;
vec2 uv;
@@ -186,7 +185,6 @@ VERTEX_SHADER_CODE
// look up transform from the "pose texture"
if (bone_weights != vec4(0.0)) {
-
highp mat4 bone_transform = mat4(0.0);
for (int i = 0; i < 4; i++) {
@@ -367,7 +365,6 @@ LIGHT_SHADER_CODE
}
void main() {
-
vec4 color = color_interp;
vec2 uv = uv_interp;
#ifdef USE_FORCE_REPEAT
@@ -499,11 +496,9 @@ FRAGMENT_SHADER_CODE
point = -shadow_vec;
sh = 0.5 + (1.0 / 8.0);
} else if (angle_to_light > 0.0) {
-
point = vec2(shadow_vec.y, -shadow_vec.x);
sh = 0.25 + (1.0 / 8.0);
} else {
-
point = vec2(-shadow_vec.y, shadow_vec.x);
sh = 0.75 + (1.0 / 8.0);
}
diff --git a/drivers/gles2/shaders/canvas_shadow.glsl b/drivers/gles2/shaders/canvas_shadow.glsl
index 7a5ba4f571..2abcd5e67c 100644
--- a/drivers/gles2/shaders/canvas_shadow.glsl
+++ b/drivers/gles2/shaders/canvas_shadow.glsl
@@ -21,7 +21,6 @@ uniform highp float distance_norm;
varying highp vec4 position_interp;
void main() {
-
gl_Position = projection_matrix * (light_matrix * (world_matrix * vec4(vertex, 1.0)));
position_interp = gl_Position;
}
@@ -47,7 +46,6 @@ varying highp vec4 position_interp;
/* clang-format on */
void main() {
-
highp float depth = ((position_interp.z / position_interp.w) + 1.0) * 0.5 + 0.0; // bias
#ifdef USE_RGBA_SHADOWS
diff --git a/drivers/gles2/shaders/copy.glsl b/drivers/gles2/shaders/copy.glsl
index aa967115da..e833722ac3 100644
--- a/drivers/gles2/shaders/copy.glsl
+++ b/drivers/gles2/shaders/copy.glsl
@@ -40,7 +40,6 @@ uniform highp mat4 display_transform;
#endif
void main() {
-
#if defined(USE_CUBEMAP) || defined(USE_PANORAMA)
cube_interp = cube_in;
#elif defined(USE_ASYM_PANO)
@@ -115,7 +114,6 @@ uniform float custom_alpha;
uniform highp mat4 sky_transform;
vec4 texturePanorama(sampler2D pano, vec3 normal) {
-
vec2 st = vec2(
atan(normal.x, normal.z),
acos(normal.y));
@@ -131,7 +129,6 @@ vec4 texturePanorama(sampler2D pano, vec3 normal) {
#endif
void main() {
-
#ifdef USE_PANORAMA
vec3 cube_normal = normalize(cube_interp);
diff --git a/drivers/gles2/shaders/cube_to_dp.glsl b/drivers/gles2/shaders/cube_to_dp.glsl
index 769908c3b4..1612ec3d5a 100644
--- a/drivers/gles2/shaders/cube_to_dp.glsl
+++ b/drivers/gles2/shaders/cube_to_dp.glsl
@@ -17,7 +17,6 @@ attribute vec2 uv_in; // attrib:4
varying vec2 uv_interp;
void main() {
-
uv_interp = uv_in;
gl_Position = vertex_attrib;
}
@@ -49,7 +48,6 @@ uniform highp float z_near;
uniform highp float bias;
void main() {
-
highp vec3 normal = vec3(uv_interp * 2.0 - 1.0, 0.0);
/*
if (z_flip) {
diff --git a/drivers/gles2/shaders/cubemap_filter.glsl b/drivers/gles2/shaders/cubemap_filter.glsl
index db3d8b3a1b..f5c91cc707 100644
--- a/drivers/gles2/shaders/cubemap_filter.glsl
+++ b/drivers/gles2/shaders/cubemap_filter.glsl
@@ -17,7 +17,6 @@ attribute highp vec2 uv; // attrib:4
varying highp vec2 uv_interp;
void main() {
-
uv_interp = uv;
gl_Position = vec4(vertex, 0, 1);
}
@@ -87,7 +86,6 @@ uniform sampler2D radical_inverse_vdc_cache; // texunit:1
#ifdef USE_SOURCE_PANORAMA
vec4 texturePanorama(sampler2D pano, vec3 normal) {
-
vec2 st = vec2(
atan(normal.x, normal.z),
acos(normal.y));
@@ -179,7 +177,6 @@ vec2 Hammersley(int i, int N) {
uniform bool z_flip;
void main() {
-
vec3 color = vec3(0.0);
vec2 uv = (uv_interp * 2.0) - 1.0;
@@ -200,7 +197,6 @@ void main() {
vec4 sum = vec4(0.0);
for (int sample_num = 0; sample_num < SAMPLE_COUNT; sample_num++) {
-
vec2 xi = Hammersley(sample_num, SAMPLE_COUNT);
vec3 H = ImportanceSampleGGX(xi, roughness, N);
diff --git a/drivers/gles2/shaders/effect_blur.glsl b/drivers/gles2/shaders/effect_blur.glsl
index b28d78a6ca..7b607dd76a 100644
--- a/drivers/gles2/shaders/effect_blur.glsl
+++ b/drivers/gles2/shaders/effect_blur.glsl
@@ -23,7 +23,6 @@ uniform vec4 blur_section;
#endif
void main() {
-
uv_interp = uv_in;
gl_Position = vec4(vertex_attrib, 0.0, 1.0);
#ifdef USE_BLUR_SECTION
@@ -127,7 +126,6 @@ uniform float camera_z_far;
uniform float camera_z_near;
void main() {
-
#ifdef GLOW_GAUSSIAN_HORIZONTAL
vec2 pix_size = pixel_size;
pix_size *= 0.5; //reading from larger buffer, so use more samples
@@ -228,7 +226,6 @@ void main() {
float k_accum = 0.0;
for (int i = 0; i < dof_kernel_size; i++) {
-
int int_ofs = i - dof_kernel_from;
vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * amount * dof_radius;
@@ -265,7 +262,6 @@ void main() {
float max_accum = 0.0;
for (int i = 0; i < dof_kernel_size; i++) {
-
int int_ofs = i - dof_kernel_from;
vec2 tap_uv = uv_interp + dof_dir * float(int_ofs) * dof_radius;
float ofs_influence = max(0.0, 1.0 - abs(float(int_ofs)) / float(dof_kernel_from));
diff --git a/drivers/gles2/shaders/exposure.glsl b/drivers/gles2/shaders/exposure.glsl
index 759adcda06..c20812bfa3 100644
--- a/drivers/gles2/shaders/exposure.glsl
+++ b/drivers/gles2/shaders/exposure.glsl
@@ -5,7 +5,6 @@ layout(location = 0) in highp vec4 vertex_attrib;
/* clang-format on */
void main() {
-
gl_Position = vertex_attrib;
}
@@ -34,7 +33,6 @@ uniform highp float max_luminance;
layout(location = 0) out highp float exposure;
void main() {
-
#ifdef EXPOSURE_BEGIN
ivec2 src_pos = ivec2(gl_FragCoord.xy) * source_render_size / target_size;
diff --git a/drivers/gles2/shaders/lens_distorted.glsl b/drivers/gles2/shaders/lens_distorted.glsl
index f4ff80ba9a..d568006ccc 100644
--- a/drivers/gles2/shaders/lens_distorted.glsl
+++ b/drivers/gles2/shaders/lens_distorted.glsl
@@ -19,7 +19,6 @@ uniform vec2 scale;
varying vec2 uv_interp;
void main() {
-
uv_interp = vertex.xy * 2.0 - 1.0;
vec2 v = vertex.xy * scale + offset;
diff --git a/drivers/gles2/shaders/particles.glsl b/drivers/gles2/shaders/particles.glsl
index 5974050fc1..1575db701f 100644
--- a/drivers/gles2/shaders/particles.glsl
+++ b/drivers/gles2/shaders/particles.glsl
@@ -10,7 +10,6 @@ layout(location = 4) in highp vec4 xform_2;
layout(location = 5) in highp vec4 xform_3;
struct Attractor {
-
vec3 pos;
vec3 dir;
float radius;
@@ -64,7 +63,6 @@ VERTEX_SHADER_GLOBALS
/* clang-format on */
uint hash(uint x) {
-
x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
x = ((x >> uint(16)) ^ x) * uint(0x45d9f3b);
x = (x >> uint(16)) ^ x;
@@ -72,7 +70,6 @@ uint hash(uint x) {
}
void main() {
-
#ifdef PARTICLES_COPY
out_color = color;
@@ -183,10 +180,8 @@ VERTEX_SHADER_CODE
#if !defined(DISABLE_FORCE)
if (false) {
-
vec3 force = vec3(0.0);
for (int i = 0; i < attractor_count; i++) {
-
vec3 rel_vec = xform[3].xyz - attractors[i].pos;
float dist = length(rel_vec);
if (attractors[i].radius < dist)
@@ -214,7 +209,6 @@ VERTEX_SHADER_CODE
#if !defined(DISABLE_VELOCITY)
if (true) {
-
xform[3].xyz += out_velocity_active.xyz * local_delta;
}
#endif
diff --git a/drivers/gles2/shaders/resolve.glsl b/drivers/gles2/shaders/resolve.glsl
index 5c6f5d6561..071cb37a99 100644
--- a/drivers/gles2/shaders/resolve.glsl
+++ b/drivers/gles2/shaders/resolve.glsl
@@ -8,7 +8,6 @@ layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
void main() {
-
uv_interp = uv_in;
gl_Position = vertex_attrib;
}
@@ -32,7 +31,6 @@ in vec2 uv2_interp;
layout(location = 0) out vec4 frag_color;
void main() {
-
vec4 specular = texture(source_specular, uv_interp);
#ifdef USE_SSR
diff --git a/drivers/gles2/shaders/scene.glsl b/drivers/gles2/shaders/scene.glsl
index b720c71cec..d658ccd5cd 100644
--- a/drivers/gles2/shaders/scene.glsl
+++ b/drivers/gles2/shaders/scene.glsl
@@ -194,7 +194,6 @@ void light_compute(
vec3 light_color,
vec3 attenuation,
float roughness) {
-
//this makes lights behave closer to linear, but then addition of lights looks bad
//better left disabled
@@ -249,7 +248,6 @@ void light_compute(
diffuse_interp += light_color * diffuse_brdf_NL * attenuation;
if (roughness > 0.0) {
-
// D
float specular_brdf_NL = 0.0;
@@ -325,7 +323,6 @@ uniform mediump float fog_height_curve;
#endif //fog
void main() {
-
highp vec4 vertex = vertex_attrib;
mat4 world_matrix = world_transform;
@@ -394,7 +391,6 @@ void main() {
#else
// look up transform from the "pose texture"
{
-
for (int i = 0; i < 4; i++) {
ivec2 tex_ofs = ivec2(int(bone_ids[i]) * 3, 0);
@@ -512,7 +508,6 @@ VERTEX_SHADER_CODE
float normalized_distance = light_length / light_range;
if (normalized_distance < 1.0) {
-
float omni_attenuation = pow(1.0 - normalized_distance, light_attenuation);
vec3 attenuation = vec3(omni_attenuation);
@@ -532,7 +527,6 @@ VERTEX_SHADER_CODE
float normalized_distance = light_length / light_range;
if (normalized_distance < 1.0) {
-
float spot_attenuation = pow(1.0 - normalized_distance, light_attenuation);
vec3 spot_dir = light_direction;
@@ -541,7 +535,6 @@ VERTEX_SHADER_CODE
float angle = dot(-normalize(light_rel_vec), spot_dir);
if (angle > spot_cutoff) {
-
float scos = max(angle, spot_cutoff);
float spot_rim = max(0.0001, (1.0 - scos) / (1.0 - spot_cutoff));
@@ -645,7 +638,6 @@ VERTEX_SHADER_CODE
#ifdef FOG_DEPTH_ENABLED
{
-
float fog_z = smoothstep(fog_depth_begin, fog_max_distance, length(vertex));
fog_amount = pow(fog_z, fog_depth_curve) * fog_color_base.a;
@@ -1157,7 +1149,6 @@ void light_compute(
inout vec3 diffuse_light,
inout vec3 specular_light,
inout float alpha) {
-
//this makes lights behave closer to linear, but then addition of lights looks bad
//better left disabled
@@ -1381,7 +1372,6 @@ LIGHT_SHADER_CODE
#define SAMPLE_SHADOW_TEXEL_PROJ(p_shadow, p_pos) step(p_pos.z, SHADOW_DEPTH(texture2DProj(p_shadow, p_pos)))
float sample_shadow(highp sampler2D shadow, highp vec4 spos) {
-
#ifdef SHADOW_MODE_PCF_13
spos.xyz /= spos.w;
@@ -1458,7 +1448,6 @@ uniform mediump float fog_height_curve;
#endif //fog
void main() {
-
#ifdef RENDER_DEPTH_DUAL_PARABOLOID
if (dp_clip > 0.0)
@@ -1653,7 +1642,6 @@ FRAGMENT_SHADER_CODE
// environment BRDF approximation
{
-
#if defined(DIFFUSE_TOON)
//simplify for toon, as
specular_light *= specular * metallic * albedo * 2.0;
@@ -1732,7 +1720,6 @@ FRAGMENT_SHADER_CODE
float normalized_distance = light_length / light_range;
if (normalized_distance < 1.0) {
-
float omni_attenuation = pow(1.0 - normalized_distance, light_attenuation);
light_att = vec3(omni_attenuation);
@@ -1829,7 +1816,6 @@ FRAGMENT_SHADER_CODE
}
} else {
if (depth_z < light_split_offsets.z) {
-
shadow_att = shadow3;
#if defined(LIGHT_USE_PSSM_BLEND)
@@ -1838,7 +1824,6 @@ FRAGMENT_SHADER_CODE
#endif
} else {
-
shadow_att = shadow4;
pssm_fade = smoothstep(light_split_offsets.z, light_split_offsets.w, depth_z);
@@ -1881,7 +1866,6 @@ FRAGMENT_SHADER_CODE
pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z);
#endif
} else {
-
shadow_att = shadow2;
pssm_fade = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z);
#ifdef LIGHT_USE_PSSM_BLEND
@@ -1945,7 +1929,6 @@ FRAGMENT_SHADER_CODE
}
} else {
if (depth_z < light_split_offsets.z) {
-
pssm_coord = shadow_coord3;
#if defined(LIGHT_USE_PSSM_BLEND)
@@ -1954,7 +1937,6 @@ FRAGMENT_SHADER_CODE
#endif
} else {
-
pssm_coord = shadow_coord4;
pssm_fade = smoothstep(light_split_offsets.z, light_split_offsets.w, depth_z);
@@ -1968,7 +1950,6 @@ FRAGMENT_SHADER_CODE
#ifdef LIGHT_USE_PSSM2
if (depth_z < light_split_offsets.x) {
-
pssm_coord = shadow_coord;
#ifdef LIGHT_USE_PSSM_BLEND
@@ -1976,7 +1957,6 @@ FRAGMENT_SHADER_CODE
pssm_blend = smoothstep(0.0, light_split_offsets.x, depth_z);
#endif
} else {
-
pssm_coord = shadow_coord2;
pssm_fade = smoothstep(light_split_offsets.x, light_split_offsets.y, depth_z);
#ifdef LIGHT_USE_PSSM_BLEND
@@ -2165,7 +2145,6 @@ FRAGMENT_SHADER_CODE
#ifdef FOG_DEPTH_ENABLED
{
-
float fog_z = smoothstep(fog_depth_begin, fog_max_distance, length(vertex));
fog_amount = pow(fog_z, fog_depth_curve) * fog_color_base.a;
diff --git a/drivers/gles2/shaders/screen_space_reflection.glsl b/drivers/gles2/shaders/screen_space_reflection.glsl
index a11da10b61..6b5b7c885c 100644
--- a/drivers/gles2/shaders/screen_space_reflection.glsl
+++ b/drivers/gles2/shaders/screen_space_reflection.glsl
@@ -9,7 +9,6 @@ out vec2 uv_interp;
out vec2 pos_interp;
void main() {
-
uv_interp = uv_in;
gl_Position = vertex_attrib;
pos_interp.xy = gl_Position.xy;
@@ -55,7 +54,6 @@ vec2 view_to_screen(vec3 view_pos, out float w) {
#define M_PI 3.14159265359
void main() {
-
vec4 diffuse = texture(source_diffuse, uv_interp);
vec4 normal_roughness = texture(source_normal_roughness, uv_interp);
@@ -142,7 +140,6 @@ void main() {
float steps_taken = 0.0;
for (int i = 0; i < num_steps; i++) {
-
pos += line_advance;
z += z_advance;
w += w_advance;
@@ -174,7 +171,6 @@ void main() {
}
if (found) {
-
float margin_blend = 1.0;
vec2 margin = vec2((viewport_size.x + viewport_size.y) * 0.5 * 0.05); //make a uniform margin
@@ -218,7 +214,6 @@ void main() {
final_color = vec4(0.0);
for (int i = 0; i < 7; i++) {
-
float op_len = 2.0 * tan(cone_angle) * cone_len; //opposite side of iso triangle
float radius;
{
diff --git a/drivers/gles2/shaders/ssao.glsl b/drivers/gles2/shaders/ssao.glsl
index 82eea8f274..0fd29e8dcc 100644
--- a/drivers/gles2/shaders/ssao.glsl
+++ b/drivers/gles2/shaders/ssao.glsl
@@ -5,7 +5,6 @@ layout(location = 0) in highp vec4 vertex_attrib;
/* clang-format on */
void main() {
-
gl_Position = vertex_attrib;
gl_Position.z = 1.0;
}
@@ -207,7 +206,6 @@ float sampleAO(in ivec2 ssC, in vec3 C, in vec3 n_C, in float ssDiskRadius, in f
}
void main() {
-
// Pixel being shaded
ivec2 ssC = ivec2(gl_FragCoord.xy);
diff --git a/drivers/gles2/shaders/ssao_blur.glsl b/drivers/gles2/shaders/ssao_blur.glsl
index e4133ad534..f065cd74eb 100644
--- a/drivers/gles2/shaders/ssao_blur.glsl
+++ b/drivers/gles2/shaders/ssao_blur.glsl
@@ -5,7 +5,6 @@ layout(location = 0) in highp vec4 vertex_attrib;
/* clang-format on */
void main() {
-
gl_Position = vertex_attrib;
gl_Position.z = 1.0;
}
@@ -58,7 +57,6 @@ uniform float camera_z_near;
uniform ivec2 screen_size;
void main() {
-
ivec2 ssC = ivec2(gl_FragCoord.xy);
float depth = texelFetch(source_depth, ssC, 0).r;
@@ -91,7 +89,6 @@ void main() {
// We already handled the zero case above. This loop should be unrolled and the static branch optimized out,
// so the IF statement has no runtime cost
if (r != 0) {
-
ivec2 ppos = ssC + axis * (r * filter_scale);
float value = texelFetch(source_ssao, clamp(ppos, ivec2(0), clamp_limit), 0).r;
ivec2 rpos = clamp(ppos, ivec2(0), clamp_limit);
diff --git a/drivers/gles2/shaders/ssao_minify.glsl b/drivers/gles2/shaders/ssao_minify.glsl
index 272f3e236e..f654e00a4f 100644
--- a/drivers/gles2/shaders/ssao_minify.glsl
+++ b/drivers/gles2/shaders/ssao_minify.glsl
@@ -5,7 +5,6 @@ layout(location = 0) in highp vec4 vertex_attrib;
/* clang-format on */
void main() {
-
gl_Position = vertex_attrib;
}
@@ -33,7 +32,6 @@ uniform int source_mipmap;
layout(location = 0) out mediump uint depth;
void main() {
-
ivec2 ssP = ivec2(gl_FragCoord.xy);
// Rotated grid subsampling to avoid XY directional bias or Z precision bias while downsampling.
diff --git a/drivers/gles2/shaders/subsurf_scattering.glsl b/drivers/gles2/shaders/subsurf_scattering.glsl
index f40fb3a244..d0c34cf1b0 100644
--- a/drivers/gles2/shaders/subsurf_scattering.glsl
+++ b/drivers/gles2/shaders/subsurf_scattering.glsl
@@ -8,7 +8,6 @@ layout(location = 4) in vec2 uv_in;
out vec2 uv_interp;
void main() {
-
uv_interp = uv_in;
gl_Position = vertex_attrib;
}
@@ -102,7 +101,6 @@ uniform sampler2D source_depth; //texunit:2
layout(location = 0) out vec4 frag_color;
void main() {
-
float strength = texture(source_sss, uv_interp).r;
strength *= strength; //stored as sqrt
@@ -110,7 +108,6 @@ void main() {
vec4 base_color = texture(source_diffuse, uv_interp);
if (strength > 0.0) {
-
// Fetch linear depth of current pixel:
float depth = texture(source_depth, uv_interp).r * 2.0 - 1.0;
#ifdef USE_ORTHOGONAL_PROJECTION