[Bf-blender-cvs] [470c25e5f10] blender2.8: Cleanup: removed unused GLSL shader functions.

Brecht Van Lommel noreply at git.blender.org
Thu Apr 19 19:04:46 CEST 2018


Commit: 470c25e5f1016956490413e98370af2c5ac19b17
Author: Brecht Van Lommel
Date:   Thu Apr 19 18:15:55 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB470c25e5f1016956490413e98370af2c5ac19b17

Cleanup: removed unused GLSL shader functions.

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

M	source/blender/gpu/shaders/gpu_shader_material.glsl

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

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 5eac8ca8f51..ca04ebcc3ed 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -199,50 +199,6 @@ void color_to_blender_normal_new_shading(vec3 color, out vec3 normal)
 
 /*********** SHADER NODES ***************/
 
-void vcol_attribute(vec4 attvcol, out vec4 vcol)
-{
-	vcol = vec4(attvcol.xyz, 1.0);
-}
-
-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)
-{
-	local = co;
-	view = (ProjectionMatrix[3][3] == 0.0) ? normalize(local) : vec3(0.0, 0.0, -1.0);
-	global = (viewinvmat * vec4(local, 1.0)).xyz;
-	orco = attorco;
-	uv_attribute(attuv, uv);
-	normal = -normalize(nor);   /* blender render normal is negated */
-	vcol_attribute(attvcol, vcol);
-	srgb_to_linearrgb(vcol, vcol);
-	vcol_alpha = attvcol.a;
-	frontback = (gl_FrontFacing) ? 1.0 : 0.0;
-}
-
-void particle_info(
-        vec4 sprops, vec4 loc, vec3 vel, vec3 avel,
-        out float index, out float random, out float age,
-        out float life_time, out vec3 location,
-        out float size, out vec3 velocity, out vec3 angular_velocity)
-{
-	index = sprops.x;
-	random = loc.w;
-	age = sprops.y;
-	life_time = sprops.z;
-	size = sprops.w;
-
-	location = loc.xyz;
-	velocity = vel;
-	angular_velocity = avel;
-}
-
 void vect_normalize(vec3 vin, out vec3 vout)
 {
 	vout = normalize(vin);
@@ -310,17 +266,6 @@ 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)
-{
-	outcol = col * energy;
-	outlv = lv;
-	outdist = dist;
-	outshadow = vec4(shadow, 1.0);
-	outvisifac = visifac;
-}
-
 void math_add(float val1, float val2, out float outval)
 {
 	outval = val1 + val2;
@@ -798,1617 +743,169 @@ void mix_sat(float fac, vec4 col1, vec4 col2, out vec4 outcol)
 	if (hsv.y != 0.0) {
 		rgb_to_hsv(col2, hsv2);
 
-		hsv.y = facm * hsv.y + fac * hsv2.y;
-		hsv_to_rgb(hsv, outcol);
-	}
-}
-
-void mix_val(float fac, vec4 col1, vec4 col2, out vec4 outcol)
-{
-	fac = clamp(fac, 0.0, 1.0);
-	float facm = 1.0 - fac;
-
-	vec4 hsv, hsv2;
-	rgb_to_hsv(col1, hsv);
-	rgb_to_hsv(col2, hsv2);
-
-	hsv.z = facm * hsv.z + fac * hsv2.z;
-	hsv_to_rgb(hsv, outcol);
-}
-
-void mix_color(float fac, vec4 col1, vec4 col2, out vec4 outcol)
-{
-	fac = clamp(fac, 0.0, 1.0);
-	float facm = 1.0 - fac;
-
-	outcol = col1;
-
-	vec4 hsv, hsv2, tmp;
-	rgb_to_hsv(col2, hsv2);
-
-	if (hsv2.y != 0.0) {
-		rgb_to_hsv(outcol, hsv);
-		hsv.x = hsv2.x;
-		hsv.y = hsv2.y;
-		hsv_to_rgb(hsv, tmp);
-
-		outcol = mix(outcol, tmp, fac);
-		outcol.a = col1.a;
-	}
-}
-
-void mix_soft(float fac, vec4 col1, vec4 col2, out vec4 outcol)
-{
-	fac = clamp(fac, 0.0, 1.0);
-	float facm = 1.0 - fac;
-
-	vec4 one = vec4(1.0);
-	vec4 scr = one - (one - col2) * (one - col1);
-	outcol = facm * col1 + fac * ((one - col1) * col2 * col1 + col1 * scr);
-}
-
-void mix_linear(float fac, vec4 col1, vec4 col2, out vec4 outcol)
-{
-	fac = clamp(fac, 0.0, 1.0);
-
-	outcol = col1 + fac * (2.0 * (col2 - vec4(0.5)));
-}
-
-void valtorgb(float fac, sampler2D colormap, out vec4 outcol, out float outalpha)
-{
-	outcol = texture(colormap, vec2(fac, 0.0));
-	outalpha = outcol.a;
-}
-
-void rgbtobw(vec4 color, out float outval)
-{
-	vec3 factors = vec3(0.2126, 0.7152, 0.0722);
-	outval = dot(color.rgb, factors);
-}
-
-void invert(float fac, vec4 col, out vec4 outcol)
-{
-	outcol.xyz = mix(col.xyz, vec3(1.0) - col.xyz, fac);
-	outcol.w = col.w;
-}
-
-void clamp_vec3(vec3 vec, vec3 min, vec3 max, out vec3 out_vec)
-{
-	out_vec = clamp(vec, min, max);
-}
-
-void clamp_val(float value, float min, float max, out float out_value)
-{
-	out_value = clamp(value, min, max);
-}
-
-void hue_sat(float hue, float sat, float value, float fac, vec4 col, out vec4 outcol)
-{
-	vec4 hsv;
-
-	rgb_to_hsv(col, hsv);
-
-	hsv[0] += (hue - 0.5);
-	if (hsv[0] > 1.0) hsv[0] -= 1.0; else if (hsv[0] < 0.0) hsv[0] += 1.0;
-	hsv[1] *= sat;
-	if (hsv[1] > 1.0) hsv[1] = 1.0; else if (hsv[1] < 0.0) hsv[1] = 0.0;
-	hsv[2] *= value;
-	if (hsv[2] > 1.0) hsv[2] = 1.0; else if (hsv[2] < 0.0) hsv[2] = 0.0;
-
-	hsv_to_rgb(hsv, outcol);
-
-	outcol = mix(col, outcol, fac);
-}
-
-void separate_rgb(vec4 col, out float r, out float g, out float b)
-{
-	r = col.r;
-	g = col.g;
-	b = col.b;
-}
-
-void combine_rgb(float r, float g, float b, out vec4 col)
-{
-	col = vec4(r, g, b, 1.0);
-}
-
-void separate_xyz(vec3 vec, out float x, out float y, out float z)
-{
-	x = vec.r;
-	y = vec.g;
-	z = vec.b;
-}
-
-void combine_xyz(float x, float y, float z, out vec3 vec)
-{
-	vec = vec3(x, y, z);
-}
-
-void separate_hsv(vec4 col, out float h, out float s, out float v)
-{
-	vec4 hsv;
-
-	rgb_to_hsv(col, hsv);
-	h = hsv[0];
-	s = hsv[1];
-	v = hsv[2];
-}
-
-void combine_hsv(float h, float s, float v, out vec4 col)
-{
-	hsv_to_rgb(vec4(h, s, v, 1.0), col);
-}
-
-void output_node(vec4 rgb, float alpha, out vec4 outrgb)
-{
-	outrgb = vec4(rgb.rgb, alpha);
-}
-
-/*********** TEXTURES ***************/
-
-void texture_flip_blend(vec3 vec, out vec3 outvec)
-{
-	outvec = vec.yxz;
-}
-
-void texture_blend_lin(vec3 vec, out float outval)
-{
-	outval = (1.0 + vec.x) * 0.5;
-}
-
-void texture_blend_quad(vec3 vec, out float outval)
-{
-	outval = max((1.0 + vec.x) * 0.5, 0.0);
-	outval *= outval;
-}
-
-void texture_wood_sin(vec3 vec, out float value, out vec4 color, out vec3 normal)
-{
-	float a = sqrt(vec.x * vec.x + vec.y * vec.y + vec.z * vec.z) * 20.0;
-	float wi = 0.5 + 0.5 * sin(a);
-
-	value = wi;
-	color = vec4(wi, wi, wi, 1.0);
-	normal = vec3(0.0);
-}
-
-void texture_image(vec3 vec, sampler2D ima, out float value, out vec4 color, out vec3 normal)
-{
-	color = texture(ima, (vec.xy + vec2(1.0)) * 0.5);
-	value = color.a;
-
-	normal.x = 2.0 * (color.r - 0.5);
-	normal.y = 2.0 * (0.5 - color.g);
-	normal.z = 2.0 * (color.b - 0.5);
-}
-
-/************* MTEX *****************/
-
-void texco_orco(vec3 attorco, out vec3 orco)
-{
-	orco = attorco;
-}
-
-void texco_uv(vec2 attuv, out vec3 uv)
-{
-	/* disabled for now, works together with leaving out mtex_2d_mapping */
-	// uv = vec3(attuv*2.0 - vec2(1.0, 1.0), 0.0); */
-	uv = vec3(attuv, 0.0);
-}
-
-void texco_norm(vec3 normal, out vec3 outnormal)
-{
-	/* corresponds to shi->orn, which is negated so cancels
-	   out blender normal negation */
-	outnormal = normalize(normal);
-}
-
-void texco_tangent(vec4 tangent, out vec3 outtangent)
-{
-	outtangent = normalize(tangent.xyz);
-}
-
-void texco_global(mat4 viewinvmat, vec3 co, out vec3 global)
-{
-	global = (viewinvmat * vec4(co, 1.0)).xyz;
-}
-
-void texco_object(mat4 viewinvmat, mat4 obinvmat, vec3 co, out vec3 object)
-{
-	object = (obinvmat * (viewinvmat * vec4(co, 1.0))).xyz;
-}
-
-void texco_refl(vec3 vn, vec3 view, out vec3 ref)
-{
-	ref = view - 2.0 * dot(vn, view) * vn;
-}
-
-void shade_norm(vec3 normal, out vec3 outnormal)
-{
-	/* blender render normal is negated */
-	outnormal = -normalize(normal);
-}
-
-void mtex_mirror(vec3 tcol, vec4 refcol, float tin, float colmirfac, out vec4 outrefcol)
-{
-	outrefcol = mix(refcol, vec4(1.0, tcol), tin * colmirfac);
-}
-
-void mtex_rgb_blend(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	float facm;
-
-	fact *= facg;
-	facm = 1.0 - fact;
-
-	incol = fact * texcol + facm * outcol;
-}
-
-void mtex_rgb_mul(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	float facm;
-
-	fact *= facg;
-	facm = 1.0 - fact;
-
-	incol = (facm + fact * texcol) * outcol;
-}
-
-void mtex_rgb_screen(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	float facm;
-
-	fact *= facg;
-	facm = 1.0 - fact;
-
-	incol = vec3(1.0) - (vec3(facm) + fact * (vec3(1.0) - texcol)) * (vec3(1.0) - outcol);
-}
-
-void mtex_rgb_overlay(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	float facm;
-
-	fact *= facg;
-	facm = 1.0 - fact;
-
-	if (outcol.r < 0.5)
-		incol.r = outcol.r * (facm + 2.0 * fact * texcol.r);
-	else
-		incol.r = 1.0 - (facm + 2.0 * fact * (1.0 - texcol.r)) * (1.0 - outcol.r);
-
-	if (outcol.g < 0.5)
-		incol.g = outcol.g * (facm + 2.0 * fact * texcol.g);
-	else
-		incol.g = 1.0 - (facm + 2.0 * fact * (1.0 - texcol.g)) * (1.0 - outcol.g);
-
-	if (outcol.b < 0.5)
-		incol.b = outcol.b * (facm + 2.0 * fact * texcol.b);
-	else
-		incol.b = 1.0 - (facm + 2.0 * fact * (1.0 - texcol.b)) * (1.0 - outcol.b);
-}
-
-void mtex_rgb_sub(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	incol = -fact * facg * texcol + outcol;
-}
-
-void mtex_rgb_add(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	incol = fact * facg * texcol + outcol;
-}
-
-void mtex_rgb_div(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	float facm;
-
-	fact *= facg;
-	facm = 1.0 - fact;
-
-	if (texcol.r != 0.0) incol.r = facm * outcol.r + fact * outcol.r / texcol.r;
-	if (texcol.g != 0.0) incol.g = facm * outcol.g + fact * outcol.g / texcol.g;
-	if (texcol.b != 0.0) incol.b = facm * outcol.b + fact * outcol.b / texcol.b;
-}
-
-void mtex_rgb_diff(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	float facm;
-
-	fact *= facg;
-	facm = 1.0 - fact;
-
-	incol = facm * outcol + fact * abs(texcol - outcol);
-}
-
-void mtex_rgb_dark(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	float facm, col;
-
-	fact *= facg;
-	facm = 1.0 - fact;
-
-	incol.r = min(outcol.r, texcol.r) * fact + outcol.r * facm;
-	incol.g = min(outcol.g, texcol.g) * fact + outcol.g * facm;
-	incol.b = min(outcol.b, texcol.b) * fact + outcol.b * facm;
-}
-
-void mtex_rgb_light(vec3 outcol, vec3 texcol, float fact, float facg, out vec3 incol)
-{
-	float facm, col;
-
-	fact *= fa

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list