Commit 775132d7 authored by Eldritch Conundrum's avatar Eldritch Conundrum
Browse files

minor changes; add elevated shader to tests

parent a59a1c85
......@@ -23,7 +23,7 @@ let mutable noSequence = false
let mutable noRenaming = false
let mutable noRenamingList = [ "main" ]
let mutable forbiddenNames = [ "if"; "in"; "do" ]
let addFobiddenName s = forbiddenNames <- s :: forbiddenNames
let addForbiddenName s = forbiddenNames <- s :: forbiddenNames
type Ident = string
......
......@@ -271,7 +271,7 @@ module private ParseImpl =
let ident = manyChars (pchar '_' <|> asciiLetter <|> digit)
// parse the #define macros to get the macro name
let define = pipe2 (keyword "define" >>. ident) line
(fun id line -> Ast.addFobiddenName id; "define " + id + line)
(fun id line -> Ast.addForbiddenName id; "define " + id + line)
pchar '#' >>. (define <|> line) .>> ws |>> (fun s -> "#" + s)
let verbatim = parse {
......
......@@ -151,11 +151,6 @@ let renFunction env nbArgs id =
let env = {env with fct = env.fct.Add (newName, Map.empty.Add(nbArgs, id))}
env, newName
let renSpecial env ty id =
let env, name = newId env id
CGen.export ty id name
env, name
let renFctName env (f: FunctionType) =
let ext = hlsl && f.semantics <> []
if (ext && preserveExternals) || preserveAllGlobals then
......
......@@ -15,14 +15,14 @@ let () =
exit 1
let stopwatch = Stopwatch.StartNew()
printfn "Running %i tests..." (testFiles.Length)
let failedTestCount = ref 0
let mutable failedTestCount = 0
for filename in testFiles do
let p = Process.Start(binaryFilename,
String.concat " " (List.map quoteArgs [ filename; "-o"; outFilename ]))
p.WaitForExit()
if p.ExitCode <> 0 then
printfn "*** error while testing %s: program returned %i" filename p.ExitCode
failedTestCount := !failedTestCount + 1
failedTestCount <- failedTestCount + 1
printfn "\n"
printfn "%i tests run in %i seconds, %i failed." testFiles.Length (int(stopwatch.Elapsed.TotalSeconds)) !failedTestCount
printfn "%i tests run in %i seconds, %i failed." testFiles.Length (int(stopwatch.Elapsed.TotalSeconds)) failedTestCount
()
sampler t0,t1,t2;float4 q[16];float4x4 v:register(c16);float3 no(float2 p){float2 f=p-floor(p);float2 u=f*f*f*(f*(f*6-15)+10);float a=tex2Dlod(t0,float4((floor(p)+float2(0,0))/256,0,0));float b=tex2Dlod(t0,float4((floor(p)+float2(1,0))/256,0,0));float c=tex2Dlod(t0,float4((floor(p)+float2(0,1))/256,0,0));float d=tex2Dlod(t0,float4((floor(p)+float2(1,1))/256,0,0));return float3(a+(b-a)*u.x+(c-a)*u.y+(a-b-c+d)*u.x*u.y,30*f*f*(f*(f-2)+1)*(float2(b-a,c-a)+(a-b-c+d)*u.yx));}float f(float2 p,float o){float2 d=0;float a=0;float b=3;for(float i=0;i<o;i++){float3 n=no(.25*p);d+=n.yz;a+=(b*=.5)*n.x/(1+mul(d,d));p=mul(float2x2(1.6,-1.2,1.2,1.6),p);}return a;}float3 cn(float2 p,float e,float o){float a=f(p,o);return normalize(float3(q[2].w*(a-f(p+float2(e,0),o)),e,q[2].w*(a-f(p+float2(0,e),o))));}float3 b(float3 p,float3 c,float3 d){float a=mul(d,q[3]);float b=lerp(a,mul(c,q[3]),.5+.5*q[2].x);return float3(.13,.18,.22)*(c.y+.25*saturate(-b)-.1*no(1024*p.xz).y)+float3(1.4,1,.7)*saturate(b)*saturate(2*a);}float4 m0(float4 x:position,out float4 y:color):position{x.z=q[2].w*f(x.yx,8);y=x.yzxw;return mul(v,y);}float4 m1(float2 x:vpos):color{float2 o=q[0]+x.x*.37;float3 c;float t=q[3].w*q[0].z;c.x=16*cos(t*tex2D(t0,o+=.1)+3*tex2D(t0,o+=.1))+8*cos(t*tex2D(t0,o+=.1)*2+3*tex2D(t0,o+=.1));c.z=16*cos(t*tex2D(t0,o+=.1)+3*tex2D(t0,o+=.1))+8*cos(t*tex2D(t0,o+=.1)*2+3*tex2D(t0,o+=.1));c.y=q[2].w*f(c.xz,3)+q[1].x+q[1].y*x.x;o+=q[3].w*.5;c.x+=.002*no(o+=.1);c.y+=.002*no(o+=.1);c.z+=.002*no(o+=.1);return float4(c,.3*cos(t*2));}float4 m2(float4 y:color):color{return y;}float4 m3(float2 x:texcoord):color{float2 o=x+.5/1280;float4 d=tex2D(t1,o);float3 e=normalize(mul(v,float4(x.x*2-1,-x.y*2+1,1,1)));float2 s=e.xz/e.y;float k=(2*s.y+1000)%8;float3 c=float3(.55,.65,.75)+.1*f(s+q[3].w*.2,10)+.5*pow(1-e.y,8)+pow(saturate(mul(e,q[3])),16)*float3(.4,.3,.1)+float4(1+.4*k,2,3+.5*k,0)*(1-cos(12.5664*s.y))*saturate(1-abs(s.y)/10-abs(s.x+q[5+k].x*.0012-8)/20)*exp(-q[5+k].x*.0002);if(d.w>.5){float t=length(d.xyz-q[4].xyz);float w=q[1].w-d.y;if(w<0){float3 n=cn(d.xz,.001*t,12-log2(t));float h=f(3*d.xz,3);float r=no(666*d.xz);c=(.1+.75*q[2].x)*(.8+.2*r);c=lerp(c,lerp(float3(.8,.85,.9),float3(.45,.45,.2)*(.8+.2*r),q[2].x),smoothstep(.5-.8*n.y,1-1.1*n.y,h*.15));c=lerp(c,lerp(float3(.37,.23,.08),float3(.42,.4,.2),q[2].x)*(.5+.5*r),smoothstep(0,1,50*(n.y-1)+(h+q[2].x)/.4));c*=b(d,n,cn(d.xz,.001*t,5));}else{t=(q[1].w-q[4].y)/e.y;d=q[4]+e.xyzz*t;float3 n=normalize(cn(float2(512,32)*d.xz+saturate(w*60)*float2(q[3].w,0),.001*t,4)*float3(1,6,1));c=.12*(float3(.4,1,1)-float3(.2,.6,.4)*saturate(w*16));c*=.3+.7*q[2].x;c+=pow(1-mul(-e,n),4)*(pow(mul(q[3],reflect(-e,n)),32)*float3(.32,.31,.3)+.1);c=lerp(c,b(d,n,n),smoothstep(1,0,q[2].x+w*60-f(666*d.xz+saturate(w*60)*float2(q[3].w,0)*2,5))*.5);}c*=.7+.3*smoothstep(0,1,256*abs(w));c*=exp(-.042*t);c+=(1-exp(-.1*t))*(float3(.52,.59,.65)+pow(saturate(mul(e,q[3])),8)*float3(.6,.4,.1));}return float4(c,0);}float4 m4(float2 x:texcoord):color{float2 o=x+.5/1280;float4 d=tex2D(t1,o);float3 c=tex2D(t2,o);if(d.w>.5){d=mul(v,float4(d.xyz,1));d.y*=-1;c=0;for(float i=0;i<16;i++){c.x+=tex2D(t2,o+i*(.5+.5*d.xy/d.w-o)/16+float2(2,0)/1280).x;c.y+=tex2D(t2,o+i*(.5+.5*d.xy/d.w-o)/16+float2(0,0)/1280).y;c.z+=tex2D(t2,o+i*(.5+.5*d.xy/d.w-o)/16+float2(-2,0)/1280).z;}c/=16;}c=pow(c,.45)*q[2].z+q[2].y;c*=.4+9.6*o.x*o.y*(1-o.x)*(1-o.y);c.xz*=.98;float w=tex2D(t0,q[3].w*.1);o+=w;c-=.005*w;c.x+=.01*tex2D(t0,o+=.1);c.y+=.01*tex2D(t0,o+=.1);c.z+=.01*tex2D(t0,o+=.1);return float4(c,0);}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment