Added Ink and ncore to modules

This commit is contained in:
2025-09-30 07:27:58 +02:00
commit 9ec1b9cf82
327 changed files with 14171 additions and 0 deletions

View File

@@ -0,0 +1,5 @@
(program
(fun vertex vs_main
[]
(:= v float2)
(= v.x (* (+ 2 (* (- 4 2) 1.5)) 3))))

6
test/parse/arrays.golden Normal file
View File

@@ -0,0 +1,6 @@
(program
(fun vertex vs_main -> float4 (@position)
[]
(:= arr [16].float4)
(= arr[0] (float4 1 1 1))
(return arr[0])))

View File

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

View File

@@ -0,0 +1,8 @@
(program
(struct P
[(:= v float2)])
(fun vertex vs_main
[]
(:= p P)
(= p.v.x.y 2)))

View File

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

10
test/parse/buffers.golden Normal file
View File

@@ -0,0 +1,10 @@
(program
(buffer property_buffer
[(:= color float4)])
(constant_buffer cbuffer
[(:= color float4)])
(fun pixel ps_main
[(:= index int)]
(return property_buffer[index].color)))

View File

@@ -0,0 +1,27 @@
(program
(fun vertex vs_main
[]
(:= v2 float2 (float2 2 2))
(= v2 (float2 2))
(= v2 (float2 v2))
(:= v3 float3 (float3 2 2 2))
(= v3 (float3 v2 1))
(= v3 (float3 1 v2))
(= v3 (float3 1))
(= v3 (float3 v3))
(:= v4 float4 (float4 2 2 2 2))
(= v4 (float4 v4))
(= v4 (float4 v2 v2))
(= v4 (float4 v2 1 1))
(= v4 (float4 1 v2 1))
(= v4 (float4 1 1 v2))
(= v4 (float4 v3 2))
(= v4 (float4 2 v3))
(= v4 (float4 2))
(= v4 (float4 1 1 v2))
(= v4 (float4 2))
(= v2.x 2)
(= v2.y 2)
(:= p (+ v2.x v3.z))
(:= q (+ v4.w v2.x))
(:= m float4x4)))

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,14 @@
(program
(constant_buffer camera
[(:= projection float4x4)
(:= view float4x4)])
(fun vertex vs_main -> float4 (@position)
[(:= pos float4 (@position))]
(:= mv float4 (mul camera.view pos))
(:= mvp float4 (mul camera.projection mv))
(return mvp))
(fun pixel ps_main -> float4 (@target)
[]
(return (float4 0.5 0.5 0.5 1))))

View File

@@ -0,0 +1,12 @@
(program
(properties p
[(:= time float (@time))])
(fun vertex vs_main -> float4 (@position)
[(:= pos float3 (@position))]
(return (float4 pos.x pos.y pos.z 1)))
(fun pixel ps_main -> float4 (@target)
[(:= pos float4 (@outposition))]
(:= t p.time)
(return (float4 1 1 1 1))))

View File

@@ -0,0 +1,7 @@
(program
(constant_buffer p
[(:= v float2)])
(fun vertex vs_main
[]
(:= x float (/ p.v.x p.v.y))))

View File

@@ -0,0 +1,4 @@
test/else_if_after_else.ink:6,6: error: 'else if' without 'if'
 } else if 0 > 200 {
^^^^


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,6 @@
(program
(fun vertex vs_main -> float4 (@position)
[(:= pos float4 (@position))]
(:= x float 5)
(= x 7)
(return pos)))

View File

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

View File

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

View File

@@ -0,0 +1,6 @@
(program
(fun vertex vs_main
[]
(:= x 0)
(for i : 0..10
(+= x 1))))

View File

@@ -0,0 +1,4 @@
test/for_i_one_liner.ink:3,0: error: Unable to parse statement here. 'for' currently expects a brace-enclosed block as a body.
for i : 0..10 x += 2.0;
^^^


View File

@@ -0,0 +1,9 @@
test/for_no_iter.ink:3,9: error: Expected expression after '..'. Expected end of iterator.
for i : 0.. {
x += 2.0;
^^
test/for_no_iter.ink:3,0: error: Unable to parse statement here.
for i : 0.. {
x += 2.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,4 @@
(program
(fun vertex vs_main -> int
[(:= pos float3)]
(return 0)))

View File

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

View File

@@ -0,0 +1,10 @@
(program
(constant_buffer props (@properties)
[(:= projection float4x4 (@projection))
(:= view float4x4 (@view))])
(fun vertex vs_main -> float4 (@position)
[(:= pos float4 (@position))]
(:= mv float4 (mul props.view pos))
(:= mvp float4 (mul props.projection mv))
(return mvp)))

View File

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

View File

@@ -0,0 +1,8 @@
(program
(fun pixel ps_main
[]
(#if Env.Alpha
(:= alpha_color (float4 1 0 0 1))
(:= f 2)
(:= color (float3 0 0 0))
(:= g 5))))

View File

@@ -0,0 +1,6 @@
(program
(#if (|| (&& Env.PS5 Env.XSX) Env.Switch2)
(fun vertex vs_console_main
[])
(fun vertex vs_windows_main
[])))

View File

@@ -0,0 +1,4 @@
test/if_if_if.ink:2,0: error: Expected expression after 'if'. Expected if condition.
if if if 0 > 100 {
^^


12
test/parse/ifdefs.golden Normal file
View File

@@ -0,0 +1,12 @@
(program
(#if Env.Skinning
(fun vertex vs_skinning_main
[]
(:= x float 5))
(#if Env.UV
(fun vertex vs_texture_mapping_main
[]
(:= x float2 (float2 2 2)))))
(fun pixel ps_main
[]))

View File

@@ -0,0 +1,18 @@
(program
(fun bar -> float
[]
(return 5))
(fun foo -> float
[]
(return (bar)))
(fun vertex vs_main -> float4 (@position)
[(:= pos float3 (@position))]
(:= f 2)
(:= i 10)
(= f (foo))
(:= v2 (float2 2 2))
(:= v3 (float3 2 2 3))
(:= v4 (float4 4 5 6 7))
(return (float4 1 1 1 1))))

View File

@@ -0,0 +1,35 @@
(program
(constant_buffer p (@properties)
[(:= color float4)
(:= rect_position float2)
(:= rect_scale float2)
(:= resolution float2)
(:= texture Texture2D)
(:= sampler Sampler)])
(struct PS_Input
[(:= uv float2 (@uv))
(:= pos float4 (@pos))])
(fun vertex vs_main -> PS_Input
[(:= pos float4 (@position))]
(:= res float2 p.resolution)
(:= scale float2 p.rect_scale)
(:= rect_pos float2 p.rect_position)
(:= center float2 rect_pos)
(:= half_size float2 (float2 (/ scale.x 2) (/ scale.y 2)))
(:= dst_pos float4 (float4 (+ (* pos.x half_size.x) center.x) (+ (* pos.y half_size.y) center.y) 0 1))
(:= result PS_Input)
(:= src_p0 float2 (float2 0 1))
(:= src_p1 float2 (float2 1 0))
(:= src_half_size float2 (/ (- src_p1 src_p0) 2))
(:= src_center float2 (/ (+ src_p1 src_p0) 2))
(:= src_pos float2 (+ (* (float2 pos.x pos.y) src_half_size) src_center))
(= result.uv (float2 1 1))
(= result.pos (float4 (- (/ (* 2 dst_pos.x) res.x) 1) (- (/ (* 2 dst_pos.y) res.y) 1) 0 1))
(return result))
(fun pixel ps_main -> float4 (@target0)
[(:= input PS_Input)]
(:= color float4 p.color)
(return color)))

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,9 @@
(program
(fun vertex vs_main -> float4 (@position)
[(:= pos float3 (@position))]
(if (> pos.x 100)
(if (> pos.x 50)
(return (float4 pos 1))
(return (float4 1)))
(return (float4 pos 1)))
(return (float4 0))))

View File

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

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,11 @@
(program
(properties props
[(:= color float4)])
(fun vertex vs_main -> float4 (@position)
[(:= pos float4 (@position))]
(return pos))
(fun pixel ps_main -> float4 (@target0)
[]
(return props.color)))

View File

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

View File

@@ -0,0 +1,6 @@
(program
(fun vertex vs_main
[]
(:= a float2)
(:= b float2)
(:= x (+ a b).x)))

View File

@@ -0,0 +1,9 @@
(program
(fun vertex vs_main -> float4 (@position)
[(:= pos float3 (@position))]
(if (> pos.x 100)
(return (float4 pos 1))
(if (> pos.x 50)
(return (float4 pos 1))
(return (float4 1))))
(return (float4 0))))

View File

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

View File

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

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,6 @@
(program
(fun vertex vs_main
[]
(:= a float2)
(:= b float2)
(= (+ a b).x 2)))

View File

@@ -0,0 +1,21 @@
(program
(properties p
[(:= texture texture2D)
(:= sampler sampler)])
(struct PS_Input
[(:= uv float2 (@uv))
(:= pos float4 (@position))])
(fun vertex vs_main -> PS_Input
[(:= pos float4 (@position))
(:= uv float2 (@uv))]
(:= result PS_Input)
(= result.uv uv)
(= result.pos pos)
(return result))
(fun pixel ps_main -> float4 (@target)
[(:= input PS_Input)]
(:= color float4 (sample p.texture input.uv p.sampler))
(return color)))

View File

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

View File

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

8
test/parse/unary.golden Normal file
View File

@@ -0,0 +1,8 @@
(program
(fun vertex vs_vs_main -> float4 (@position)
[(:= position float3 (@position))]
(return (float4 position.x position.y position.z 1)))
(fun pixel ps_ps_main -> float4 (@target)
[(:= position float4 (@outposition))]
(return (float4 0.5 -1 0 1))))

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)))