@@ -154,7 +154,7 @@ string declare_constant(const std::string& variable_name, const hp_vec2& value){
154154 return " const number " + variable_name + " = initialize_hp_vec2(" + convert_number_to_glsl (value.x ) + " ," + convert_number_to_glsl (value.y ) + " );\n " ;
155155}
156156
157- string build_high_precision_shader_string (const std::string& highp_header, const std::string& highp_function_declarations, const std::string& lowp_function_declarations){
157+ string build_high_precision_shader_string (const std::string& highp_header, const std::string& highp_footer, const std::string& highp_function_declarations, const std::string& lowp_function_declarations){
158158 string out = highp_header;
159159 const number pi = compute_pi ();
160160 const number e = compute_e ();
@@ -164,24 +164,26 @@ string build_high_precision_shader_string(const std::string& highp_header, const
164164 const number three = number_integer (3 );
165165 const number zero = null_number ();
166166
167- declare_constant (" PI" ,pi);
168- declare_constant (" E" , e);
169- declare_constant (" LN2" , ln_2);
170- declare_constant (" REAL_ZERO" , zero);
171- declare_constant (" REAL_ONE" , number_one ());
172- declare_constant (" REAL_TWO" , two);
173- declare_constant (" INFINITY" , infinite_number ());
167+ out += declare_constant (" PI" ,pi);
168+ out += declare_constant (" E" , e);
169+ out += declare_constant (" LN2" , ln_2);
170+ out += declare_constant (" REAL_ZERO" , zero);
171+ out += declare_constant (" REAL_ONE" , number_one ());
172+ out += declare_constant (" REAL_TWO" , two);
173+ out += declare_constant (" INFINITY" , infinite_number ());
174174
175- declare_constant (" TWO_PI_OVER_3" , hp_div (hp_mult (two,pi),three));
176- declare_constant (" TWO_OVER_PI" , hp_div (two,pi));
175+ out += declare_constant (" TWO_PI_OVER_3" , hp_div (hp_mult (two,pi),three));
176+ out += declare_constant (" TWO_OVER_PI" , hp_div (two,pi));
177177
178- declare_constant (" ZERO" , hp_vec2 (zero,zero));
179- declare_constant (" CPI" , hp_vec2 (pi,zero));
180- declare_constant (" ONE" , hp_vec2 (one,zero));
181- declare_constant (" MINUS_ONE" , hp_vec2 (hp_neg (one),zero));
182- declare_constant (" I" , hp_vec2 (zero,one));
178+ out += declare_constant (" ZERO" , hp_vec2 (zero,zero));
179+ out += declare_constant (" CPI" , hp_vec2 (pi,zero));
180+ out += declare_constant (" ONE" , hp_vec2 (one,zero));
181+ out += declare_constant (" MINUS_ONE" , hp_vec2 (hp_neg (one),zero));
182+ out += declare_constant (" I" , hp_vec2 (zero,one));
183183
184184 out += transpile_to_highp_glsl (lowp_function_declarations,highp_function_declarations);
185185
186-
186+ out += highp_footer;
187+
188+ return out;
187189}
0 commit comments