init commit

This commit is contained in:
2024-06-09 21:34:23 +02:00
commit b81c0af596
177 changed files with 8799 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
(program
(fun vertex vs_main
[]
(:= x float (+ 2 5))))

View File

@@ -0,0 +1,11 @@
(program
(properties
[(:= color float4)])
(fun vertex vs_main -> float3 (@position)
[(:= pos float3 (@position))]
(return pos))
(fun pixel ps_main -> float4 (@target0)
[]
(return properties.color)))

View File

@@ -0,0 +1,6 @@
(program
(fun vertex vs_main
[]
(:= x float 5)
(:= y float 3000)
(:= z float (+ (* y y) x))))

View File

@@ -0,0 +1,3 @@
(program
(struct Foo
[]))

View File

@@ -0,0 +1,3 @@
(program
(fun vertex vs_main
[]))

View File

@@ -0,0 +1,4 @@
(program
(fun vertex vs_main -> float3
[(:= pos float3 (@position))]
(return pos)))

View File

@@ -0,0 +1,5 @@
(program
(fun vertex vs_main -> float4 (@position)
[(:= pos float4 (@position))]
(:= x float 5)
(= x 7)))

View File

@@ -0,0 +1,4 @@
test/field_without_type_specifier.shd:2,0: error: Expected type specifier after field name.
x := 5.0;
^


View File

@@ -0,0 +1,15 @@
(program
(foreign fun float2 -> float2
[(:= float)
(:= float)])
(foreign fun float3 -> float3
[(:= float)
(:= float)
(:= float)])
(foreign fun float4 -> float4
[(:= float)
(:= float)
(:= float)
(:= float)]))

View File

@@ -0,0 +1,26 @@
(program
(foreign fun mul -> float2
[(:= float2)
(:= float2)])
(foreign fun mul -> float3
[(:= float3)
(:= float3)])
(foreign fun mul -> float4
[(:= float4)
(:= float4)])
(foreign fun mul -> float4x4
[(:= float4x4)
(:= float4x4)])
(foreign fun float2 -> float2
[(:= float)
(:= float)])
(fun vertex vs_main
[]
(:= v1 float2 (float2 1 1))
(:= v2 float2 (float2 3 3))
(:= v3 float2 (mul v1 v2))))

View File

@@ -0,0 +1,8 @@
(program
(fun foo -> int
[]
(return 4))
(fun vertex vs_main
[]
(foo)))

View File

@@ -0,0 +1,7 @@
(program
(fun vertex vs_main
[]
(foo))
(fun foo
[]))

View File

@@ -0,0 +1,7 @@
(program
(fun vertex vs_main
[])
(fun pixel ps_main -> float4 (@target0)
[]
(return (float4 1 1 1 1))))

View File

@@ -0,0 +1,3 @@
(program
(fun vertex vs_main -> int
[(:= pos float3)]))

View File

@@ -0,0 +1,12 @@
(program
(fun foo
[])
(fun foo
[])
(fun bar
[])
(fun vertex vs_main
[]))

View File

@@ -0,0 +1,16 @@
(program
(meta
[(:= name LitBasic)
(:= category Scene)])
(properties
[(:= color float4)])
(fun vertex vs_main -> float3 (@position)
[(:= pos float3 (@position))
(:= uv float2 (@uv))]
(return pos))
(fun pixel ps_main -> float4 (@target0)
[]
(return properties.color)))

View File

@@ -0,0 +1,13 @@
(program
(fun foo -> int
[]
(return 5))
(fun bar -> float
[]
(return (* 1235 500)))
(fun vertex vs_main
[]
(:= x int (foo))
(:= y float (bar))))

View File

@@ -0,0 +1,14 @@
(program
(fun vertex vs_main -> float3 (@position)
[(:= pos float3 (@position))]
(return pos))
(fun foo -> float4
[]
(return (float4 1 1 1 1)))
(fun pixel ps_main -> float4 (@target0)
[]
(:= y float4 (foo))
(:= color float4 y)
(return color)))

View File

@@ -0,0 +1,13 @@
(program
(struct Foo
[(:= some_data float)])
(fun foo -> float
[(:= f Foo)]
(return (* f.some_data 2)))
(fun vertex vs_main
[]
(:= f Foo)
(= f.some_data 4)
(:= d float (foo f))))

View File

@@ -0,0 +1,8 @@
(program
(fun vertex vs_main -> float3 (@position)
[(:= pos float3 (@position))]
(return pos))
(fun pixel ps_main -> float4 (@target0)
[]
(return (float4 1 1 1 1))))

View File

@@ -0,0 +1,7 @@
(program
(fun vertex vs_main
[]
(:= x float 2)
(:= y float 5)
(:= z float 10)
(:= w float (+ (* x y) (* y (- z (/ x (* y x))))))))

View File

@@ -0,0 +1,5 @@
(program
(fun vertex vs_main
[]
(:= x float 1)
(:= x float 5)))

View File

@@ -0,0 +1,8 @@
(program
(struct Data
[(:= color float4)])
(fun vertex vs_main
[]
(:= d Data)
(:= x float4 d.color)))

View File

@@ -0,0 +1,5 @@
(program
(fun vertex vs_main
[]
(:= x int 5)
(= x.d 4)))

View File

@@ -0,0 +1,31 @@
(program
(struct Vertex_Out
[(:= position float3 (@position))
(:= normal float3 (@normal))
(:= uv float3 (@uv))
(:= frag_pos float3 (@interp))])
(instance
[(:= model float4x4 (@model))])
(fun vertex main
[(:= position float3 (@position))
(:= uv float2 (@uv))
(:= normal float3 (@normal))]
(:= v_out Vertex_Out)
(= v_out.position (mul position model))
(= v_out.normal normal)
(= v_out.uv uv)
(= v_out.frag_pos position)
(return v_out))
(struct Pixel_Out
[(:= color float4 (@target0))
(:= emission float4 (@target1))])
(fun pixel main
[(:= v_in Vertex_Out)]
(:= p_out Pixel_Out)
(= p_out.color (float4 1 0.5 1 1))
(= p_out.emission (float4 2 2 2 2))
(return p_out)))

View File

@@ -0,0 +1,12 @@
(program
(struct Foo
[(:= color float4)])
(struct Bar
[(:= t Foo)])
(fun vertex vs_main
[]
(:= f Foo)
(:= b Bar)
(= b.t f)))

View File

@@ -0,0 +1,3 @@
(program
(fun int
[]))

View File

@@ -0,0 +1,4 @@
(program
(fun vertex vs_main
[]
(:= int float 4)))

View File

@@ -0,0 +1,4 @@
(program
(fun vertex vs_main
[]
(foo)))

View File

@@ -0,0 +1,4 @@
(program
(fun vertex vs_main
[]
(:= b int f)))

View File

@@ -0,0 +1,14 @@
(program
(fun foo
[(:= v1 float3)
(:= v2 float3)])
(fun foo
[(:= v1 float2)
(:= v2 float2)
(:= v3 float2)])
(fun vertex vs_main
[]
(:= v float 2)
(foo v v)))

View File

@@ -0,0 +1,4 @@
(program
(fun vertex vs_main
[]
(:= f float4 (float4 1 1 1 1))))

View File

@@ -0,0 +1,17 @@
(program
(fun foo -> float
[(:= x float)
(:= y float)
(:= z float)]
(return (* (* x y) z)))
(fun foo -> float
[(:= x float)
(:= y float)
(:= z float)
(:= w float)]
(return (* (* (* x y) z) w)))
(fun vertex vs_main
[]
(foo 2 3)))

View File

@@ -0,0 +1,7 @@
(program
(fun vertex vs_main -> float4 (@position)
[(:= pos float4 (@position))]
(:= res float2 (float2 2 2))
(:= foo float 1)
(:= result float4 (float4 1 (* foo res) 0 1))
(return result)))

View File

@@ -0,0 +1,14 @@
(program
(fun vertex vs_main -> float3 (@position)
[(:= pos float3 (@position))]
(return pos))
(fun foo -> float2
[]
(return (float2 1 1)))
(fun pixel ps_main -> float4 (@target0)
[]
(:= y float2 (foo))
(:= color float4 (float4 y 1 1 1))
(return color)))