[Bf-blender-cvs] [4f3656e] compositor-2016: Cleanup: glsl indentation, line length

Campbell Barton noreply at git.blender.org
Wed Jun 8 21:49:23 CEST 2016


Commit: 4f3656e61d61c1cb57800f4799191cb3624ec3dc
Author: Campbell Barton
Date:   Mon May 23 19:56:50 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB4f3656e61d61c1cb57800f4799191cb3624ec3dc

Cleanup: glsl indentation, line length

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

M	source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_fx_dof_hq_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_material.glsl

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

diff --git a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
index c7b29ee..e1cd7e0 100644
--- a/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_basic_frag.glsl
@@ -55,83 +55,83 @@ void main()
 {
 #if defined(USE_STIPPLE)
 #if defined(DRAW_LINE)
-    /* GLSL 1.3 */
-    if (!bool((1 << int(mod(t, 16))) & stipple_pattern))
-        discard;
+	/* GLSL 1.3 */
+	if (!bool((1 << int(mod(t, 16))) & stipple_pattern))
+		discard;
 #else
-        /* We have to use mod function and integer casting.
-         * This can be optimized further with the bitwise operations
-         * when GLSL 1.3 is supported. */
-        if (stipple_id == STIPPLE_HALFTONE ||
-            stipple_id == STIPPLE_S3D_INTERLACE_CHECKERBOARD ||
-            stipple_id == STIPPLE_S3D_INTERLACE_CHECKERBOARD_SWAP)
-        {
-            int result = int(mod(gl_FragCoord.x + gl_FragCoord.y, 2));
-            bool dis = result == 0;
-            if (stipple_id == STIPPLE_S3D_INTERLACE_CHECKERBOARD_SWAP)
-                dis = !dis;
-            if (dis)
-                discard;
-        }
-        else if (stipple_id == STIPPLE_QUARTTONE) {
-            int mody = int(mod(gl_FragCoord.y, 4));
-            int modx = int(mod(gl_FragCoord.x, 4));
-            if (mody == 0) {
-                if (modx != 2)
-                    discard;
-            }
-            else if (mody == 2){
-                if (modx != 0)
-                    discard;
-            }
-            else
-                discard;
-        }
-        else if (stipple_id == STIPPLE_CHECKER_8PX) {
-            int result = int(mod(int(gl_FragCoord.x)/8 + int(gl_FragCoord.y)/8, 2));
-            if (result != 0)
-                discard;
-        }
-        else if (stipple_id == STIPPLE_DIAG_STRIPES) {
-            int mody = int(mod(gl_FragCoord.y, 16));
-            int modx = int(mod(gl_FragCoord.x, 16));
-            if ((16 - modx > mody && mody > 8 - modx) || mody > 24 - modx)
-                discard;
-        }
-        else if (stipple_id == STIPPLE_DIAG_STRIPES_SWAP) {
-            int mody = int(mod(gl_FragCoord.y, 16));
-            int modx = int(mod(gl_FragCoord.x, 16));
-            if (!((16 - modx > mody && mody > 8 - modx) || mody > 24 - modx))
-                discard;
-        }
-        else if (stipple_id == STIPPLE_S3D_INTERLACE_ROW || stipple_id == STIPPLE_S3D_INTERLACE_ROW_SWAP) {
-            int result = int(mod(gl_FragCoord.y, 2));
-            bool dis = result == 0;
-            if (stipple_id == STIPPLE_S3D_INTERLACE_ROW_SWAP)
-                dis = !dis;
-            if (dis)
-                discard;
-        }
-        else if (stipple_id == STIPPLE_S3D_INTERLACE_COLUMN || stipple_id == STIPPLE_S3D_INTERLACE_COLUMN_SWAP) {
-            int result = int(mod(gl_FragCoord.x, 2));
-            bool dis = result != 0;
-            if (stipple_id == STIPPLE_S3D_INTERLACE_COLUMN_SWAP)
-                dis = !dis;
-            if (dis)
-                discard;
-        }
-        else if (stipple_id == STIPPLE_HEXAGON) {
-            int mody = int(mod(gl_FragCoord.y, 2));
-            int modx = int(mod(gl_FragCoord.x, 4));
-            if (mody != 0) {
-                if (modx != 1)
-                    discard;
-            }
-            else {
-                if (modx != 3)
-                    discard;
-            }
-        }
+	/* We have to use mod function and integer casting.
+	 * This can be optimized further with the bitwise operations
+	 * when GLSL 1.3 is supported. */
+	if (stipple_id == STIPPLE_HALFTONE ||
+	    stipple_id == STIPPLE_S3D_INTERLACE_CHECKERBOARD ||
+	    stipple_id == STIPPLE_S3D_INTERLACE_CHECKERBOARD_SWAP)
+	{
+		int result = int(mod(gl_FragCoord.x + gl_FragCoord.y, 2));
+		bool dis = result == 0;
+		if (stipple_id == STIPPLE_S3D_INTERLACE_CHECKERBOARD_SWAP)
+			dis = !dis;
+		if (dis)
+			discard;
+	}
+	else if (stipple_id == STIPPLE_QUARTTONE) {
+		int mody = int(mod(gl_FragCoord.y, 4));
+		int modx = int(mod(gl_FragCoord.x, 4));
+		if (mody == 0) {
+			if (modx != 2)
+				discard;
+		}
+		else if (mody == 2) {
+			if (modx != 0)
+				discard;
+		}
+		else
+			discard;
+	}
+	else if (stipple_id == STIPPLE_CHECKER_8PX) {
+		int result = int(mod(int(gl_FragCoord.x)/8 + int(gl_FragCoord.y) / 8, 2));
+		if (result != 0)
+			discard;
+	}
+	else if (stipple_id == STIPPLE_DIAG_STRIPES) {
+		int mody = int(mod(gl_FragCoord.y, 16));
+		int modx = int(mod(gl_FragCoord.x, 16));
+		if ((16 - modx > mody && mody > 8 - modx) || mody > 24 - modx)
+			discard;
+	}
+	else if (stipple_id == STIPPLE_DIAG_STRIPES_SWAP) {
+		int mody = int(mod(gl_FragCoord.y, 16));
+		int modx = int(mod(gl_FragCoord.x, 16));
+		if (!((16 - modx > mody && mody > 8 - modx) || mody > 24 - modx))
+			discard;
+	}
+	else if (stipple_id == STIPPLE_S3D_INTERLACE_ROW || stipple_id == STIPPLE_S3D_INTERLACE_ROW_SWAP) {
+		int result = int(mod(gl_FragCoord.y, 2));
+		bool dis = result == 0;
+		if (stipple_id == STIPPLE_S3D_INTERLACE_ROW_SWAP)
+			dis = !dis;
+		if (dis)
+			discard;
+	}
+	else if (stipple_id == STIPPLE_S3D_INTERLACE_COLUMN || stipple_id == STIPPLE_S3D_INTERLACE_COLUMN_SWAP) {
+		int result = int(mod(gl_FragCoord.x, 2));
+		bool dis = result != 0;
+		if (stipple_id == STIPPLE_S3D_INTERLACE_COLUMN_SWAP)
+			dis = !dis;
+		if (dis)
+			discard;
+	}
+	else if (stipple_id == STIPPLE_HEXAGON) {
+		int mody = int(mod(gl_FragCoord.y, 2));
+		int modx = int(mod(gl_FragCoord.x, 4));
+		if (mody != 0) {
+			if (modx != 1)
+				discard;
+		}
+		else {
+			if (modx != 3)
+				discard;
+		}
+	}
 #endif /* !DRAW_LINE */
 #endif /* USE_STIPPLE */
 
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 e315d2f..7657fbb 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
@@ -102,7 +102,8 @@ void accumulate_pass(void) {
 	if (dof_params.w == 0.0)
 		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))));
+		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))));
 
 	if (dot(particlecoord, particlecoord) > r * r)
 		discard;
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 494a74d..c2cd927 100644
--- a/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_fx_ssao_frag.glsl
@@ -44,7 +44,8 @@ float calculate_ssao_factor(float depth)
 	vec3 position = get_view_space_from_depth(uvcoordsvar.xy, viewvecs[0].xyz, viewvecs[1].xyz, depth);
 	vec3 normal = calculate_view_space_normal(position);
 
-	// find the offset in screen space by multiplying a point in camera space at the depth of the point by the projection matrix.
+	/* find the offset in screen space by multiplying a point
+	 * in camera space at the depth of the point by the projection matrix. */
 	vec2 offset;
 	float homcoord = gl_ProjectionMatrix[2][3] * position.z + gl_ProjectionMatrix[3][3];
 	offset.x = gl_ProjectionMatrix[0][0] * ssao_params.x / homcoord;
diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 6d2d395..506c964 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -157,7 +157,10 @@ void uv_attribute(vec2 attuv, out vec3 uv)
 	uv = vec3(attuv*2.0 - vec2(1.0, 1.0), 0.0);
 }
 
-void geom(vec3 co, vec3 nor, mat4 viewinvmat, vec3 attorco, vec2 attuv, vec4 attvcol, out vec3 global, out vec3 local, out vec3 view, out vec3 orco, out vec3 uv, out vec3 normal, out vec4 vcol, out float vcol_alpha, out float frontback)
+void geom(
+        vec3 co, vec3 nor, mat4 viewinvmat, vec3 attorco, vec2 attuv, vec4 attvcol,
+        out vec3 global, out vec3 local, out vec3 view, out vec3 orco, out vec3 uv,
+        out vec3 normal, out vec4 vcol, out float vcol_alpha, out float frontback)
 {
 	local = co;
 	view = (gl_ProjectionMatrix[3][3] == 0.0)? normalize(local): vec3(0.0, 0.0, -1.0);
@@ -171,16 +174,19 @@ void geom(vec3 co, vec3 nor, mat4 viewinvmat, vec3 attorco, vec2 attuv, vec4 att
 	frontback = (gl_FrontFacing)? 1.0: 0.0;
 }
 
-void particle_info(vec4 sprops, vec3 loc, vec3 vel, vec3 avel, out float index, out float age, out float life_time, out vec3 location, out float size, out vec3 velocity, out vec3 angular_velocity)
+void particle_info(
+        vec4 sprops, vec3 loc, vec3 vel, vec3 avel,
+        out float index, out float age, out float life_time, out vec3 location,
+        out float size, out vec3 velocity, out vec3 angular_velocity)
 {
-    index = sprops.x;
-    age = sprops.y;
-    life_time = sprops.z;
-    size = sprops.w;
+	index = sprops.x;
+	age = sprops.y;
+	life_time = sprops.z;
+	size = sprops.w;
 
-    location = loc;
-    velocity = vel;
-    angular_velocity = avel;
+	location = loc;
+	velocity = vel;
+	angular_velocity = avel;
 }
 
 void vect_normalize(vec3 vin, out vec3 vout)
@@ -214,7 +220,9 @@ void camera(vec3 co, out vec3 outview, out float outdepth, out float outdist)
 	outview = normalize(co);
 }
 
-void lamp(vec4 col, float energy, vec3 lv, float dist, vec3 shadow, float visifac, out vec4 outcol, out vec3 outlv, out float outdist, out vec4 outshadow, out float outvisifac)
+void lamp(
+        vec4 col, float energy, vec3 lv, float dist, vec3 shadow, float visifac,
+        out vec4 outcol, out vec3 outlv, out float outdist, out vec4 outshadow, out float outvisifac)
 {
 	outcol = col * energy;
 	outlv = lv;
@@ -350,7 +358,7 @@ void math_modulo(float val1, float val2, out float outval)
 
 void math_abs(float val1, out float outval)
 {
-    outval = abs(val1);
+	outval = abs(val1);
 }
 
 void squeeze(float val, float width, float center, out float outval)
@@ -407,8 +415,8 @@ void vec_math_negate(vec3 v, out vec3 outv)
 
 void invert_z(vec3 v, out vec3 outv)
 {
-        v.z = -v.z;
-        outv = v;
+	v

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list