OpenShadingLanguage 1.00
# Compiled by oslc 1.11.17
# options: -q -O2 -I/build/blender/src/blender/intern/cycles/kernel/osl/shaders -I/usr/share/OSL/shaders -o /build/blender/src/blender/build/intern/cycles/kernel/osl/shaders/node_glass_bsdf.oso
shader node_glass_bsdf
param	color	Color	0.800000012 0.800000012 0.800000012		%read{43,65} %write{2147483647,-1}
param	string	distribution	"sharp"		%read{34,57} %write{2147483647,-1}
param	float	Roughness	0.200000003		%read{33,33} %write{2147483647,-1}
param	float	IOR	1.45000005		%read{1,1} %write{2147483647,-1}
param	normal	Normal	0 0 0		%read{6,61} %write{0,0} %initexpr
oparam	closure color	BSDF			%read{2147483647,-1} %write{43,65}
global	vector	I	%read{6,6} %write{2147483647,-1}
global	normal	N	%read{0,0} %write{2147483647,-1}
local	float	___330_c	%read{11,23} %write{8,8}
local	float	___330_g	%read{13,22} %write{12,15}
local	float	___330_result	%read{32,32} %write{30,31}
local	float	___331_A	%read{26,27} %write{18,18}
local	float	___331_B	%read{28,28} %write{25,25}
local	float	f	%read{4,5} %write{1,1}
local	float	eta	%read{9,61} %write{4,5}
local	float	cosi	%read{8,8} %write{6,6}
local	float	Fr	%read{38,62} %write{32,32}
local	float	roughness	%read{46,61} %write{33,33}
const	float	$const1	9.99999975e-06		%read{1,1} %write{2147483647,-1}
temp	int	$tmp1	%read{3,3} %write{2,2}
const	float	$const2	1		%read{4,62} %write{2147483647,-1}
const	string	$const3	"fresnel_dielectric_cos"		%read{7,7} %write{2147483647,-1}
temp	float	$tmp2	%read{10,10} %write{9,9}
temp	float	$tmp3	%read{12,12} %write{10,10}
temp	float	$tmp4	%read{12,12} %write{11,11}
const	int	$const5	0		%read{13,13} %write{2147483647,-1}
temp	int	$tmp5	%read{14,14} %write{13,13}
temp	float	$tmp6	%read{18,18} %write{16,16}
temp	float	$tmp7	%read{18,18} %write{17,17}
temp	float	$tmp8	%read{20,20} %write{19,19}
temp	float	$tmp9	%read{21,21} %write{20,20}
temp	float	$tmp10	%read{25,25} %write{21,21}
temp	float	$tmp11	%read{23,23} %write{22,22}
temp	float	$tmp12	%read{24,24} %write{23,23}
temp	float	$tmp13	%read{25,25} %write{24,24}
const	float	$const6	0.5		%read{26,26} %write{2147483647,-1}
temp	float	$tmp14	%read{27,27} %write{26,26}
temp	float	$tmp15	%read{30,30} %write{27,27}
temp	float	$tmp16	%read{29,29} %write{28,28}
temp	float	$tmp17	%read{30,30} %write{29,29}
const	string	$const7	"sharp"		%read{34,34} %write{2147483647,-1}
temp	int	$tmp18	%read{35,35} %write{34,34}
temp	closure color	$tmp19	%read{38,38} %write{37,37}
const	string	$const8	"reflection"		%read{36,37} %write{2147483647,-1}
const	float	$const9	0		%read{37,37} %write{2147483647,-1}
temp	closure color	$tmp20	%read{42,42} %write{38,38}
temp	closure color	$tmp21	%read{41,41} %write{39,39}
const	string	$const10	"refraction"		%read{39,39} %write{2147483647,-1}
temp	float	$tmp22	%read{41,41} %write{40,40}
temp	closure color	$tmp23	%read{42,42} %write{41,41}
temp	closure color	$tmp24	%read{43,43} %write{42,42}
const	string	$const11	"beckmann"		%read{44,44} %write{2147483647,-1}
temp	int	$tmp25	%read{45,45} %write{44,44}
temp	closure color	$tmp26	%read{47,47} %write{46,46}
const	string	$const12	"microfacet_beckmann"		%read{46,46} %write{2147483647,-1}
temp	closure color	$tmp27	%read{51,51} %write{47,47}
temp	closure color	$tmp28	%read{50,50} %write{48,48}
const	string	$const13	"microfacet_beckmann_refraction"		%read{48,48} %write{2147483647,-1}
temp	float	$tmp29	%read{50,50} %write{49,49}
temp	closure color	$tmp30	%read{51,51} %write{50,50}
temp	closure color	$tmp31	%read{52,52} %write{51,51}
const	string	$const14	"Multiscatter GGX"		%read{53,53} %write{2147483647,-1}
temp	int	$tmp32	%read{54,54} %write{53,53}
temp	closure color	$tmp33	%read{56,56} %write{55,55}
const	string	$const15	"microfacet_multi_ggx_glass"		%read{55,55} %write{2147483647,-1}
const	string	$const16	"GGX"		%read{57,57} %write{2147483647,-1}
temp	int	$tmp34	%read{58,58} %write{57,57}
temp	closure color	$tmp35	%read{60,60} %write{59,59}
const	string	$const17	"microfacet_ggx"		%read{59,59} %write{2147483647,-1}
temp	closure color	$tmp36	%read{64,64} %write{60,60}
temp	closure color	$tmp37	%read{63,63} %write{61,61}
const	string	$const18	"microfacet_ggx_refraction"		%read{61,61} %write{2147483647,-1}
temp	float	$tmp38	%read{63,63} %write{62,62}
temp	closure color	$tmp39	%read{64,64} %write{63,63}
temp	closure color	$tmp40	%read{65,65} %write{64,64}
code Normal
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:11
#                        normal Normal = N,
	assign		Normal N 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl"} %line{11} %argrw{"wr"}
code ___main___
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:14
#   float f = max(IOR, 1e-5);
	max		f IOR $const1 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl"} %line{14} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:15
#   float eta = backfacing() ? 1.0 / f : f;
	backfacing	$tmp1 	%line{15} %argrw{"w"}
	if		$tmp1 5 6 	%argrw{"r"}
	div		eta $const2 f 	%argrw{"wrr"}
	assign		eta f 	%argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:16
#   float cosi = dot(I, Normal);
	dot		cosi I Normal 	%line{16} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:17
#   float Fr = fresnel_dielectric_cos(cosi, eta);
	functioncall	$const3 33 	%line{17} %argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:13
#   float c = fabs(cosi);
	fabs		___330_c cosi 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h"} %line{13} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:14
#   float g = eta * eta - 1 + c * c;
	mul		$tmp2 eta eta 	%line{14} %argrw{"wrr"}
	sub		$tmp3 $tmp2 $const2 	%argrw{"wrr"}
	mul		$tmp4 ___330_c ___330_c 	%argrw{"wrr"}
	add		___330_g $tmp3 $tmp4 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:17
#   if (g > 0) {
	gt		$tmp5 ___330_g $const5 	%line{17} %argrw{"wrr"}
	if		$tmp5 31 32 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:18
#     g = sqrt(g);
	sqrt		___330_g ___330_g 	%line{18} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:19
#     float A = (g - c) / (g + c);
	sub		$tmp6 ___330_g ___330_c 	%line{19} %argrw{"wrr"}
	add		$tmp7 ___330_g ___330_c 	%argrw{"wrr"}
	div		___331_A $tmp6 $tmp7 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:20
#     float B = (c * (g + c) - 1) / (c * (g - c) + 1);
	add		$tmp8 ___330_g ___330_c 	%line{20} %argrw{"wrr"}
	mul		$tmp9 ___330_c $tmp8 	%argrw{"wrr"}
	sub		$tmp10 $tmp9 $const2 	%argrw{"wrr"}
	sub		$tmp11 ___330_g ___330_c 	%argrw{"wrr"}
	mul		$tmp12 ___330_c $tmp11 	%argrw{"wrr"}
	add		$tmp13 $tmp12 $const2 	%argrw{"wrr"}
	div		___331_B $tmp10 $tmp13 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:21
#     result = 0.5 * A * A * (1 + B * B);
	mul		$tmp14 $const6 ___331_A 	%line{21} %argrw{"wrr"}
	mul		$tmp15 $tmp14 ___331_A 	%argrw{"wrr"}
	mul		$tmp16 ___331_B ___331_B 	%argrw{"wrr"}
	add		$tmp17 $const2 $tmp16 	%argrw{"wrr"}
	mul		___330_result $tmp15 $tmp17 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:24
#     result = 1.0; /* TIR (no refracted component) */
	assign		___330_result $const2 	%line{24} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_fresnel.h:26
#   return result;
	assign		Fr ___330_result 	%line{26} %argrw{"wr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:18
#   float roughness = Roughness * Roughness;
	mul		roughness Roughness Roughness 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl"} %line{18} %argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:20
#   if (distribution == "sharp")
	eq		$tmp18 distribution $const7 	%line{20} %argrw{"wrr"}
	if		$tmp18 44 66 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:21
#     BSDF = Color * (Fr * reflection(Normal) + (1.0 - Fr) * refraction(Normal, eta));
	functioncall	$const8 38 	%line{21} %argrw{"r"}
# /usr/share/OSL/shaders/stdosl.h:466
# closure color reflection(normal N) { return reflection (N, 0.0); }
	closure		$tmp19 $const8 Normal $const9 	%filename{"/usr/share/OSL/shaders/stdosl.h"} %line{466} %argrw{"wrrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:21
#     BSDF = Color * (Fr * reflection(Normal) + (1.0 - Fr) * refraction(Normal, eta));
	mul		$tmp20 $tmp19 Fr 	%filename{"/build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl"} %line{21} %argrw{"wrr"}
	closure		$tmp21 $const10 Normal eta 	%argrw{"wrrr"}
	sub		$tmp22 $const2 Fr 	%argrw{"wrr"}
	mul		$tmp23 $tmp21 $tmp22 	%argrw{"wrr"}
	add		$tmp24 $tmp20 $tmp23 	%argrw{"wrr"}
	mul		BSDF $tmp24 Color 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:22
#   else if (distribution == "beckmann")
	eq		$tmp25 distribution $const11 	%line{22} %argrw{"wrr"}
	if		$tmp25 53 66 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:23
#     BSDF = Color * (Fr * microfacet_beckmann(Normal, roughness) +
	closure		$tmp26 $const12 Normal roughness 	%line{23} %argrw{"wrrr"}
	mul		$tmp27 $tmp26 Fr 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:24
#                     (1.0 - Fr) * microfacet_beckmann_refraction(Normal, roughness, eta));
	closure		$tmp28 $const13 Normal roughness eta 	%line{24} %argrw{"wrrrr"}
	sub		$tmp29 $const2 Fr 	%argrw{"wrr"}
	mul		$tmp30 $tmp28 $tmp29 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:23
#     BSDF = Color * (Fr * microfacet_beckmann(Normal, roughness) +
	add		$tmp31 $tmp27 $tmp30 	%line{23} %argrw{"wrr"}
	mul		BSDF $tmp31 Color 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:25
#   else if (distribution == "Multiscatter GGX")
	eq		$tmp32 distribution $const14 	%line{25} %argrw{"wrr"}
	if		$tmp32 57 66 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:26
#     BSDF = Color * microfacet_multi_ggx_glass(Normal, roughness, eta, Color);
	closure		$tmp33 $const15 Normal roughness eta Color 	%line{26} %argrw{"wrrrrr"}
	mul		BSDF $tmp33 Color 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:27
#   else if (distribution == "GGX")
	eq		$tmp34 distribution $const16 	%line{27} %argrw{"wrr"}
	if		$tmp34 66 66 	%argrw{"r"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:28
#     BSDF = Color * (Fr * microfacet_ggx(Normal, roughness) +
	closure		$tmp35 $const17 Normal roughness 	%line{28} %argrw{"wrrr"}
	mul		$tmp36 $tmp35 Fr 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:29
#                     (1.0 - Fr) * microfacet_ggx_refraction(Normal, roughness, eta));
	closure		$tmp37 $const18 Normal roughness eta 	%line{29} %argrw{"wrrrr"}
	sub		$tmp38 $const2 Fr 	%argrw{"wrr"}
	mul		$tmp39 $tmp37 $tmp38 	%argrw{"wrr"}
# /build/blender/src/blender/intern/cycles/kernel/osl/shaders/node_glass_bsdf.osl:28
#     BSDF = Color * (Fr * microfacet_ggx(Normal, roughness) +
	add		$tmp40 $tmp36 $tmp39 	%line{28} %argrw{"wrr"}
	mul		BSDF $tmp40 Color 	%argrw{"wrr"}
	end
