Created
December 17, 2012 17:21
-
-
Save going-digital/4320041 to your computer and use it in GitHub Desktop.
Revisions
-
going-digital revised this gist
Dec 17, 2012 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,7 @@ // Language is OpenGL ES, but gist.github.com doesn't know that language // // Approximation is based on multiply/accumulate, because thats the only // thing Videocore can do quickly! precision highp float; -
going-digital created this gist
Dec 17, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,53 @@ // Language is OpenGL ES, but gist.github.com doesn't know that language precision highp float; float sinf(float x) { x*=0.159155; x-=floor(x); float xx=x*x; float y=-6.87897; y=y*xx+33.7755; y=y*xx-72.5257; y=y*xx+80.5874; y=y*xx-41.2408; y=y*xx+6.28077; return x*y; } float cosf(float x) { return sinf(x+1.5708); } vec3 z() { return vec3(0.); } // // There is no speed advantage in vectorising the following. // Maybe the compiler figures out the vectorisation itself? // vec2 sinf(vec2 x) { return vec2(sinf(x.x),sinf(x.y)); } vec2 cosf(vec2 x) { return vec2(cosf(x.x),cosf(x.y)); } vec3 sinf(vec3 x) { return vec3(sinf(x.x),sinf(x.y),sinf(x.z)); } vec3 cosf(vec3 x) { return vec3(cosf(x.x),cosf(x.y),cosf(x.z)); } vec4 sinf(vec4 x) { return vec4(sinf(x.x),sinf(x.y),sinf(x.z),sinf(x.w)); } vec4 cosf(vec4 x) { return vec4(cosf(x.x),cosf(x.y),cosf(x.z),cosf(x.w)); }