Added Ink and ncore to modules
This commit is contained in:
5
test/parse/arithmetic_parens.golden
Normal file
5
test/parse/arithmetic_parens.golden
Normal 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
6
test/parse/arrays.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float4 (@position)
|
||||
[]
|
||||
(:= arr [16].float4)
|
||||
(= arr[0] (float4 1 1 1))
|
||||
(return arr[0])))
|
||||
4
test/parse/assign_arithmetic_expression.golden
Normal file
4
test/parse/assign_arithmetic_expression.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x float (+ 2 5))))
|
||||
8
test/parse/bad_double_access.golden
Normal file
8
test/parse/bad_double_access.golden
Normal file
@@ -0,0 +1,8 @@
|
||||
(program
|
||||
(struct P
|
||||
[(:= v float2)])
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= p P)
|
||||
(= p.v.x.y 2)))
|
||||
11
test/parse/basic_property_and_return_value.golden
Normal file
11
test/parse/basic_property_and_return_value.golden
Normal 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
10
test/parse/buffers.golden
Normal 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)))
|
||||
27
test/parse/builtin_types.golden
Normal file
27
test/parse/builtin_types.golden
Normal 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)))
|
||||
6
test/parse/complicated_computation.golden
Normal file
6
test/parse/complicated_computation.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x float 5)
|
||||
(:= y float 3000)
|
||||
(:= z float (+ (* y y) x))))
|
||||
14
test/parse/constant_buffer.golden
Normal file
14
test/parse/constant_buffer.golden
Normal 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))))
|
||||
12
test/parse/custom_hint.golden
Normal file
12
test/parse/custom_hint.golden
Normal 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))))
|
||||
7
test/parse/double_access.golden
Normal file
7
test/parse/double_access.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
(program
|
||||
(constant_buffer p
|
||||
[(:= v float2)])
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x float (/ p.v.x p.v.y))))
|
||||
4
test/parse/else_if_after_else.golden
Normal file
4
test/parse/else_if_after_else.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
[1;37mtest/else_if_after_else.ink:6,6: [31merror: [37m'else if' without 'if'
|
||||
[96m } else if 0 > 200 {
|
||||
^^^^[97m
|
||||
[36m[37m
|
||||
3
test/parse/empty_struct.golden
Normal file
3
test/parse/empty_struct.golden
Normal file
@@ -0,0 +1,3 @@
|
||||
(program
|
||||
(struct Foo
|
||||
[]))
|
||||
3
test/parse/empty_vertex_main.golden
Normal file
3
test/parse/empty_vertex_main.golden
Normal file
@@ -0,0 +1,3 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]))
|
||||
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float3
|
||||
[(:= pos float3 (@position))]
|
||||
(return pos)))
|
||||
6
test/parse/field_assignment.golden
Normal file
6
test/parse/field_assignment.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float4 (@position)
|
||||
[(:= pos float4 (@position))]
|
||||
(:= x float 5)
|
||||
(= x 7)
|
||||
(return pos)))
|
||||
4
test/parse/field_without_type_specifier.golden
Normal file
4
test/parse/field_without_type_specifier.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x 5)))
|
||||
6
test/parse/float_if_cond.golden
Normal file
6
test/parse/float_if_cond.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float4 (@position)
|
||||
[(:= pos float3 (@position))]
|
||||
(if 1
|
||||
(return (float4 pos 1)))
|
||||
(return (float4 0))))
|
||||
6
test/parse/for_i_loop.golden
Normal file
6
test/parse/for_i_loop.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x 0)
|
||||
(for i : 0..10
|
||||
(+= x 1))))
|
||||
4
test/parse/for_i_one_liner.golden
Normal file
4
test/parse/for_i_one_liner.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
[1;37mtest/for_i_one_liner.ink:3,0: [31merror: [37mUnable to parse statement here. 'for' currently expects a brace-enclosed block as a body.
|
||||
[96mfor i : 0..10 x += 2.0;
|
||||
^^^
|
||||
[36m[37m
|
||||
9
test/parse/for_no_iter.golden
Normal file
9
test/parse/for_no_iter.golden
Normal file
@@ -0,0 +1,9 @@
|
||||
[1;37mtest/for_no_iter.ink:3,9: [31merror: [37mExpected expression after '..'. Expected end of iterator.
|
||||
[96mfor i : 0.. {
|
||||
x += 2.0;
|
||||
^^
|
||||
[36m[37m[1;37mtest/for_no_iter.ink:3,0: [31merror: [37mUnable to parse statement here.
|
||||
[96mfor i : 0.. {
|
||||
x += 2.0;
|
||||
^^^
|
||||
[36m[37m
|
||||
15
test/parse/foreign_function.golden
Normal file
15
test/parse/foreign_function.golden
Normal 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)]))
|
||||
26
test/parse/foreign_overload.golden
Normal file
26
test/parse/foreign_overload.golden
Normal 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))))
|
||||
8
test/parse/function_call.golden
Normal file
8
test/parse/function_call.golden
Normal file
@@ -0,0 +1,8 @@
|
||||
(program
|
||||
(fun foo -> int
|
||||
[]
|
||||
(return 4))
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(foo)))
|
||||
7
test/parse/function_call_out_of_order_declaration.golden
Normal file
7
test/parse/function_call_out_of_order_declaration.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(foo))
|
||||
|
||||
(fun foo
|
||||
[]))
|
||||
7
test/parse/function_call_return.golden
Normal file
7
test/parse/function_call_return.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[])
|
||||
|
||||
(fun pixel ps_main -> float4 (@target0)
|
||||
[]
|
||||
(return (float4 1 1 1 1))))
|
||||
4
test/parse/function_with_int_return.golden
Normal file
4
test/parse/function_with_int_return.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main -> int
|
||||
[(:= pos float3)]
|
||||
(return 0)))
|
||||
12
test/parse/functions_with_same_name.golden
Normal file
12
test/parse/functions_with_same_name.golden
Normal file
@@ -0,0 +1,12 @@
|
||||
(program
|
||||
(fun foo
|
||||
[])
|
||||
|
||||
(fun foo
|
||||
[])
|
||||
|
||||
(fun bar
|
||||
[])
|
||||
|
||||
(fun vertex vs_main
|
||||
[]))
|
||||
10
test/parse/hinted_cbuffer.golden
Normal file
10
test/parse/hinted_cbuffer.golden
Normal 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)))
|
||||
6
test/parse/if_cond_assign.golden
Normal file
6
test/parse/if_cond_assign.golden
Normal 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))))
|
||||
8
test/parse/if_def_block.golden
Normal file
8
test/parse/if_def_block.golden
Normal 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))))
|
||||
6
test/parse/if_def_expression.golden
Normal file
6
test/parse/if_def_expression.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(#if (|| (&& Env.PS5 Env.XSX) Env.Switch2)
|
||||
(fun vertex vs_console_main
|
||||
[])
|
||||
(fun vertex vs_windows_main
|
||||
[])))
|
||||
4
test/parse/if_if_if.golden
Normal file
4
test/parse/if_if_if.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
[1;37mtest/if_if_if.ink:2,0: [31merror: [37mExpected expression after 'if'. Expected if condition.
|
||||
[96mif if if 0 > 100 {
|
||||
^^
|
||||
[36m[37m
|
||||
12
test/parse/ifdefs.golden
Normal file
12
test/parse/ifdefs.golden
Normal 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
|
||||
[]))
|
||||
18
test/parse/inferred_types.golden
Normal file
18
test/parse/inferred_types.golden
Normal 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))))
|
||||
35
test/parse/large_block.golden
Normal file
35
test/parse/large_block.golden
Normal 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)))
|
||||
16
test/parse/meta_block.golden
Normal file
16
test/parse/meta_block.golden
Normal 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)))
|
||||
13
test/parse/multiple_functions.golden
Normal file
13
test/parse/multiple_functions.golden
Normal 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))))
|
||||
14
test/parse/multiple_semicolons_everywhere.golden
Normal file
14
test/parse/multiple_semicolons_everywhere.golden
Normal 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)))
|
||||
9
test/parse/nested_if.golden
Normal file
9
test/parse/nested_if.golden
Normal 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))))
|
||||
6
test/parse/non_bool_cond.golden
Normal file
6
test/parse/non_bool_cond.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main -> float4 (@position)
|
||||
[(:= pos float3 (@position))]
|
||||
(if 1
|
||||
(return (float4 pos 1)))
|
||||
(return (float4 0))))
|
||||
13
test/parse/pass_and_access_struct_fields_in_functions.golden
Normal file
13
test/parse/pass_and_access_struct_fields_in_functions.golden
Normal 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))))
|
||||
8
test/parse/passthrough.golden
Normal file
8
test/parse/passthrough.golden
Normal 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))))
|
||||
7
test/parse/precedence_test.golden
Normal file
7
test/parse/precedence_test.golden
Normal 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))))))))
|
||||
11
test/parse/property_rename.golden
Normal file
11
test/parse/property_rename.golden
Normal 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)))
|
||||
5
test/parse/redeclared_variable.golden
Normal file
5
test/parse/redeclared_variable.golden
Normal file
@@ -0,0 +1,5 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x float 1)
|
||||
(:= x float 5)))
|
||||
6
test/parse/rvalue_binary.golden
Normal file
6
test/parse/rvalue_binary.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= a float2)
|
||||
(:= b float2)
|
||||
(:= x (+ a b).x)))
|
||||
9
test/parse/simple_else_if.golden
Normal file
9
test/parse/simple_else_if.golden
Normal 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))))
|
||||
6
test/parse/simple_if.golden
Normal file
6
test/parse/simple_if.golden
Normal 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))))
|
||||
7
test/parse/simple_if_else.golden
Normal file
7
test/parse/simple_if_else.golden
Normal 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))))
|
||||
8
test/parse/simple_struct_access.golden
Normal file
8
test/parse/simple_struct_access.golden
Normal file
@@ -0,0 +1,8 @@
|
||||
(program
|
||||
(struct Data
|
||||
[(:= color float4)])
|
||||
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= d Data)
|
||||
(:= x float4 d.color)))
|
||||
5
test/parse/struct_access_primitive_type.golden
Normal file
5
test/parse/struct_access_primitive_type.golden
Normal file
@@ -0,0 +1,5 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= x int 5)
|
||||
(= x.d 4)))
|
||||
31
test/parse/struct_field_access_test.golden
Normal file
31
test/parse/struct_field_access_test.golden
Normal 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)))
|
||||
12
test/parse/struct_within_struct.golden
Normal file
12
test/parse/struct_within_struct.golden
Normal 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)))
|
||||
6
test/parse/temp_access.golden
Normal file
6
test/parse/temp_access.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= a float2)
|
||||
(:= b float2)
|
||||
(= (+ a b).x 2)))
|
||||
21
test/parse/texture_sample.golden
Normal file
21
test/parse/texture_sample.golden
Normal 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)))
|
||||
3
test/parse/type_as_function_name.golden
Normal file
3
test/parse/type_as_function_name.golden
Normal file
@@ -0,0 +1,3 @@
|
||||
(program
|
||||
(fun int
|
||||
[]))
|
||||
4
test/parse/type_as_variable_name.golden
Normal file
4
test/parse/type_as_variable_name.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= int float 4)))
|
||||
8
test/parse/unary.golden
Normal file
8
test/parse/unary.golden
Normal 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))))
|
||||
4
test/parse/undeclared_function.golden
Normal file
4
test/parse/undeclared_function.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(foo)))
|
||||
4
test/parse/undeclared_symbol.golden
Normal file
4
test/parse/undeclared_symbol.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= b int f)))
|
||||
14
test/parse/unknown_overload.golden
Normal file
14
test/parse/unknown_overload.golden
Normal 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)))
|
||||
4
test/parse/use_builtin_functions.golden
Normal file
4
test/parse/use_builtin_functions.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
(program
|
||||
(fun vertex vs_main
|
||||
[]
|
||||
(:= f float4 (float4 1 1 1 1))))
|
||||
17
test/parse/wrong_argument_count.golden
Normal file
17
test/parse/wrong_argument_count.golden
Normal 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)))
|
||||
7
test/parse/wrong_multiply.golden
Normal file
7
test/parse/wrong_multiply.golden
Normal 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)))
|
||||
14
test/parse/wrong_type_for_function.golden
Normal file
14
test/parse/wrong_type_for_function.golden
Normal 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)))
|
||||
Reference in New Issue
Block a user