[Bf-blender-cvs] [7424ded] master: Cleanup: glsl style

Campbell Barton noreply at git.blender.org
Thu May 26 10:43:26 CEST 2016


Commit: 7424ded9c7d842cf56f677607d7a3c5c1562b687
Author: Campbell Barton
Date:   Thu May 26 18:46:12 2016 +1000
Branches: master
https://developer.blender.org/rB7424ded9c7d842cf56f677607d7a3c5c1562b687

Cleanup: glsl style

===================================================================

M	intern/opencolorio/gpu_shader_display_transform.glsl
M	intern/opensubdiv/gpu_shader_opensubd_display.glsl
M	source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_basic_geom.glsl
M	source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_fx_dof_hq_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
M	source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_geometry.glsl
M	source/blender/gpu/shaders/gpu_shader_material.glsl
M	source/blender/gpu/shaders/gpu_shader_sep_gaussian_blur_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_vsm_store_frag.glsl

===================================================================

diff --git a/intern/opencolorio/gpu_shader_display_transform.glsl b/intern/opencolorio/gpu_shader_display_transform.glsl
index 5921d6d..853bf57 100644
--- a/intern/opencolorio/gpu_shader_display_transform.glsl
+++ b/intern/opencolorio/gpu_shader_display_transform.glsl
@@ -38,7 +38,7 @@ float read_curve_mapping(int table, int index)
 	 *               But is it actually correct to subtract 1 here?
 	 */
 	float texture_index = float(index) / float(curve_mapping_lut_size  - 1);
-	return texture1D(curve_mapping_texture, texture_index) [table];
+	return texture1D(curve_mapping_texture, texture_index)[table];
 }
 
 float curvemap_calc_extend(int table, float x, vec2 first, vec2 last)
diff --git a/intern/opensubdiv/gpu_shader_opensubd_display.glsl b/intern/opensubdiv/gpu_shader_opensubd_display.glsl
index 51e8ed4..a17dcef 100644
--- a/intern/opensubdiv/gpu_shader_opensubd_display.glsl
+++ b/intern/opensubdiv/gpu_shader_opensubd_display.glsl
@@ -111,7 +111,7 @@ void emit(int index, vec3 normal)
 	outpt.v.normal = normal;
 
 	/* TODO(sergey): Only uniform subdivisions atm. */
-	vec2 quadst[4] = vec2[](vec2(0,0), vec2(1,0), vec2(1,1), vec2(0,1));
+	vec2 quadst[4] = vec2[](vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1));
 	vec2 st = quadst[index];
 
 	INTERP_FACE_VARYING_2(outpt.v.uv, osd_active_uv_offset, st);
@@ -135,7 +135,7 @@ void emit(int index)
 	outpt.v.normal = inpt[index].v.normal;
 
 	/* TODO(sergey): Only uniform subdivisions atm. */
-	vec2 quadst[4] = vec2[](vec2(0,0), vec2(1,0), vec2(1,1), vec2(0,1));
+	vec2 quadst[4] = vec2[](vec2(0, 0), vec2(1, 0), vec2(1, 1), vec2(0, 1));
 	vec2 st = quadst[index];
 
 	INTERP_FACE_VARYING_2(outpt.v.uv, osd_active_uv_offset, st);
@@ -261,7 +261,7 @@ void main()
 #else  /* USE_COLOR_MATERIAL */
 	vec3 varying_position = inpt.v.position.xyz;
 	vec3 V = (gl_ProjectionMatrix[3][3] == 0.0) ?
-		normalize(varying_position): vec3(0.0, 0.0, -1.0);
+	         normalize(varying_position) : vec3(0.0, 0.0, -1.0);
 	for (int i = 0; i < num_enabled_lights; i++) {
 		/* todo: this is a slow check for disabled lights */
 		if (lightSource[i].specular.a == 0.0)
@@ -299,7 +299,7 @@ void main()
 		/* diffuse light */
 		vec3 light_diffuse = lightSource[i].diffuse.rgb;
 		float diffuse_bsdf = max(dot(N, light_direction), 0.0);
-		L_diffuse += light_diffuse*diffuse_bsdf*intensity;
+		L_diffuse += light_diffuse * diffuse_bsdf * intensity;
 
 		/* specular light */
 		vec3 light_specular = lightSource[i].specular.rgb;
@@ -307,7 +307,7 @@ void main()
 
 		float specular_bsdf = pow(max(dot(N, H), 0.0),
 		                          gl_FrontMaterial.shininess);
-		L_specular += light_specular*specular_bsdf * intensity;
+		L_specular += light_specular * specular_bsdf * intensity;
 	}
 #endif  /* USE_COLOR_MATERIAL */
 
diff --git a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
index e1cd7e0..6b6679b 100644
--- a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
@@ -88,7 +88,7 @@ void main()
 			discard;
 	}
 	else if (stipple_id == STIPPLE_CHECKER_8PX) {
-		int result = int(mod(int(gl_FragCoord.x)/8 + int(gl_FragCoord.y) / 8, 2));
+		int result = int(mod(int(gl_FragCoord.x) / 8 + int(gl_FragCoord.y) / 8, 2));
 		if (result != 0)
 			discard;
 	}
@@ -158,7 +158,7 @@ void main()
 		/* diffuse light */
 		vec3 light_diffuse = gl_LightSource[i].diffuse.rgb;
 		float diffuse_bsdf = max(dot(N, light_direction), 0.0);
-		L_diffuse += light_diffuse*diffuse_bsdf;
+		L_diffuse += light_diffuse * diffuse_bsdf;
 
 #ifndef NO_SPECULAR
 		/* specular light */
@@ -166,7 +166,7 @@ void main()
 		vec3 H = gl_LightSource[i].halfVector.xyz;
 
 		float specular_bsdf = pow(max(dot(N, H), 0.0), gl_FrontMaterial.shininess);
-		L_specular += light_specular*specular_bsdf;
+		L_specular += light_specular * specular_bsdf;
 #endif
 	}
 #else
@@ -174,7 +174,7 @@ void main()
 
 #ifndef NO_SPECULAR
 	/* view vector computation, depends on orthographics or perspective */
-	vec3 V = (gl_ProjectionMatrix[3][3] == 0.0) ? normalize(varying_position): vec3(0.0, 0.0, -1.0);
+	vec3 V = (gl_ProjectionMatrix[3][3] == 0.0) ? normalize(varying_position) : vec3(0.0, 0.0, -1.0);
 #endif
 
 	for (int i = 0; i < NUM_SCENE_LIGHTS; i++) {
@@ -205,14 +205,14 @@ void main()
 			float distance = length(d);
 
 			intensity /= gl_LightSource[i].constantAttenuation +
-				gl_LightSource[i].linearAttenuation * distance +
-				gl_LightSource[i].quadraticAttenuation * distance * distance;
+			             gl_LightSource[i].linearAttenuation * distance +
+			             gl_LightSource[i].quadraticAttenuation * distance * distance;
 		}
 
 		/* diffuse light */
 		vec3 light_diffuse = gl_LightSource[i].diffuse.rgb;
 		float diffuse_bsdf = max(dot(N, light_direction), 0.0);
-		L_diffuse += light_diffuse*diffuse_bsdf*intensity;
+		L_diffuse += light_diffuse * diffuse_bsdf * intensity;
 
 #ifndef NO_SPECULAR
 		/* specular light */
@@ -220,7 +220,7 @@ void main()
 		vec3 H = normalize(light_direction - V);
 
 		float specular_bsdf = pow(max(dot(N, H), 0.0), gl_FrontMaterial.shininess);
-		L_specular += light_specular*specular_bsdf*intensity;
+		L_specular += light_specular * specular_bsdf * intensity;
 #endif
 	}
 #endif
@@ -250,7 +250,7 @@ void main()
 	vec3 L = gl_FrontLightModelProduct.sceneColor.rgb + L_diffuse;
 
 #ifndef NO_SPECULAR
-	L += L_specular*gl_FrontMaterial.specular.rgb;
+	L += L_specular * gl_FrontMaterial.specular.rgb;
 #endif
 
 	/* write out fragment color */
diff --git a/source/blender/gpu/shaders/gpu_shader_basic_geom.glsl b/source/blender/gpu/shaders/gpu_shader_basic_geom.glsl
index 0c938c0..a88681a 100644
--- a/source/blender/gpu/shaders/gpu_shader_basic_geom.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_basic_geom.glsl
@@ -1,6 +1,6 @@
 /*
-* Used the implementation of wide lines of Timo Suoranta (http://neure.dy.fi/wideline.html)
-*/
+ * Used the implementation of wide lines of Timo Suoranta (http://neure.dy.fi/wideline.html)
+ */
 
 #define PASSTHROUGH             0
 
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
index e9dab04..338ef6d 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_frag.glsl
@@ -115,9 +115,9 @@ void second_pass()
 	color += texture2D(colorbuffer, uvcoordsvar.xy + invrendertargetdim) * 0.234375;
 	color += texture2D(colorbuffer, uvcoordsvar.xy + 2.5 * invrendertargetdim) * 0.09375;
 	color += texture2D(colorbuffer, uvcoordsvar.xy + 4.5 * invrendertargetdim) * 0.015625;
-	color += texture2D(colorbuffer, uvcoordsvar.xy -invrendertargetdim) * 0.234375;
-	color += texture2D(colorbuffer, uvcoordsvar.xy -2.5 * invrendertargetdim) * 0.09375;
-	color += texture2D(colorbuffer, uvcoordsvar.xy -4.5 * invrendertargetdim) * 0.015625;
+	color += texture2D(colorbuffer, uvcoordsvar.xy - invrendertargetdim) * 0.234375;
+	color += texture2D(colorbuffer, uvcoordsvar.xy - 2.5 * invrendertargetdim) * 0.09375;
+	color += texture2D(colorbuffer, uvcoordsvar.xy - 4.5 * invrendertargetdim) * 0.015625;
 
 	gl_FragColor = color;
 }
@@ -128,7 +128,7 @@ void third_pass()
 {
 	vec4 color =  texture2D(colorbuffer, uvcoordsvar.xy);
 	vec4 color_blurred =  texture2D(blurredcolorbuffer, uvcoordsvar.xy);
-	float coc = 2.0 * max(color_blurred.a, color.a); - color.a;
+	float coc = 2.0 * max(color_blurred.a, color.a); -color.a;
 	gl_FragColor = vec4(color.rgb, coc);
 }
 
@@ -146,7 +146,7 @@ void fourth_pass()
 
 vec4 small_sample_blur(in sampler2D colorbuffer, in vec2 uv, in vec4 color)
 {
-	float weight = 1.0/ 17.0;
+	float weight = 1.0 / 17.0;
 	vec4 result = weight * color;
 	weight *= 4.0;
 
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_hq_frag.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_hq_frag.glsl
index 7657fbb..1821133 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_dof_hq_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_hq_frag.glsl
@@ -103,7 +103,7 @@ void accumulate_pass(void) {
 		r = 1.0;
 	else
 		r = cos(M_PI / dof_params.w) /
-		        (cos(theta - (2.0 * M_PI / dof_params.w) * floor((dof_params.w * theta + M_PI) / (2.0 * M_PI))));
+		    (cos(theta - (2.0 * M_PI / dof_params.w) * floor((dof_params.w * theta + M_PI) / (2.0 * M_PI))));
 
 	if (dot(particlecoord, particlecoord) > r * r)
 		discard;
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl b/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
index a2ef990..63b57d5 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_dof_vert.glsl
@@ -38,8 +38,12 @@ void vert_dof_first_pass()
 void vert_dof_fourth_pass()
 {
 	vec4 halfpixel = vec4(-0.5, 0.5, -0.5, 0.5);
-	uvcoordsvar = gl_MultiTexCoord0.xxyy + halfpixel * vec4(invrendertargetdim.x,
-	              invrendertargetdim.x, invrendertargetdim.y, invrendertargetdim.y);
+	uvcoordsvar = gl_MultiTexCoord0.xxyy +
+	              halfpixel *
+	              vec4(invrendertargetdim.x,
+	                   invrendertargetdim.x,
+	                   invrendertargetdim.y,
+	                   invrendertargetdim.y);
 
 	gl_Position = gl_Vertex;
 }
diff --git a/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl b/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
index c2cd927..054a2f7 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
@@ -77,7 +77,7 @@ float calculate_ssao_factor(float depth)
 
 			/* use minor bias here to avoid self shadowing */
 			if (f > 0.05 * len + 0.0001)
-				factor += f * 1.0/(len * (1.0 + len * len * ssao_params.z));
+				factor += f * 1.0 / (len * (1.0 + len * len * ssao_params.z));
 		}
 	}
 
diff --git a/source/blender/gpu/shaders/gpu_shader_geometry.glsl b/source/blender/gpu/shaders/gpu_shader_geometry.glsl
index 16fba0d..1663915 100644
--- a/source/blender/gpu/shaders/gpu_shader_geometry.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_geometry.glsl
@@ -49,7 +49,7 @@ void emit_flat(int index, vec3 normal)
 	varposition = outpt.v.position.xyz;
 
 	/* TODO(sergey): Only

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list