Added Ink and ncore to modules
This commit is contained in:
6
test/codegen/arithmetic_parens.golden
Normal file
6
test/codegen/arithmetic_parens.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
void vs_main()
|
||||
{
|
||||
float2 v;
|
||||
v.x = (2.0f + ((4.0f - 2.0f) * 1.5f)) * 3.0f;
|
||||
}
|
||||
|
||||
6
test/codegen/arrays.golden
Normal file
6
test/codegen/arrays.golden
Normal file
@@ -0,0 +1,6 @@
|
||||
float4 vs_main() : SV_POSITION
|
||||
{
|
||||
float4 arr[16];
|
||||
return arr[0];
|
||||
}
|
||||
|
||||
5
test/codegen/assign_arithmetic_expression.golden
Normal file
5
test/codegen/assign_arithmetic_expression.golden
Normal file
@@ -0,0 +1,5 @@
|
||||
void vs_main()
|
||||
{
|
||||
float x = 2.0f + 5.0f;
|
||||
}
|
||||
|
||||
15
test/codegen/basic_property_and_return_value.golden
Normal file
15
test/codegen/basic_property_and_return_value.golden
Normal file
@@ -0,0 +1,15 @@
|
||||
cbuffer properties : register(b0)
|
||||
{
|
||||
float4 color;
|
||||
}
|
||||
|
||||
float3 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
return properties.color;
|
||||
}
|
||||
|
||||
28
test/codegen/builtin_types.golden
Normal file
28
test/codegen/builtin_types.golden
Normal file
@@ -0,0 +1,28 @@
|
||||
void vs_main()
|
||||
{
|
||||
float2 v2 = float2(2.0f, 2.0f);
|
||||
v2 = float2(2.0f, 2.0f);
|
||||
v2 = float2(v2, v2);
|
||||
float3 v3 = float3(2.0f, 2.0f, 2.0f);
|
||||
v3 = float3(v2, 1.0f);
|
||||
v3 = float3(1.0f, v2);
|
||||
v3 = float3(1.0f, 1.0f, 1.0f);
|
||||
v3 = float3(v3, v3, v3);
|
||||
float4 v4 = float4(2.0f, 2.0f, 2.0f, 2.0f);
|
||||
v4 = float4(v4, v4, v4, v4);
|
||||
v4 = float4(v2, v2);
|
||||
v4 = float4(v2, 1.0f, 1.0f);
|
||||
v4 = float4(1.0f, v2, 1.0f);
|
||||
v4 = float4(1.0f, 1.0f, v2);
|
||||
v4 = float4(v3, 2.0f);
|
||||
v4 = float4(2.0f, v3);
|
||||
v4 = float4(2.0f, 2.0f, 2.0f, 2.0f);
|
||||
v4 = float4(1.0f, 1.0f, v2);
|
||||
v4 = float4(2.0f, 2.0f, 2.0f, 2.0f);
|
||||
v2.x = 2.0f;
|
||||
v2.y = 2.0f;
|
||||
float p = v2.x + v3.z;
|
||||
float q = v4.w + v2.x;
|
||||
float4x4 m;
|
||||
}
|
||||
|
||||
7
test/codegen/complicated_computation.golden
Normal file
7
test/codegen/complicated_computation.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
void vs_main()
|
||||
{
|
||||
float x = 5.0f;
|
||||
float y = 3000.0f;
|
||||
float z = (y * y) + x;
|
||||
}
|
||||
|
||||
18
test/codegen/constant_buffer.golden
Normal file
18
test/codegen/constant_buffer.golden
Normal file
@@ -0,0 +1,18 @@
|
||||
cbuffer camera : register(b0)
|
||||
{
|
||||
float4x4 projection;
|
||||
float4x4 view;
|
||||
}
|
||||
|
||||
float4 vs_main(float4 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
float4 mv = mul(camera.view, pos);
|
||||
float4 mvp = mul(camera.projection, mv);
|
||||
return mvp;
|
||||
}
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
return float4(0.5f, 0.5f, 0.5f, 1.0f);
|
||||
}
|
||||
|
||||
17
test/codegen/custom_hint.golden
Normal file
17
test/codegen/custom_hint.golden
Normal file
@@ -0,0 +1,17 @@
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
float __PROPERTIES__time;
|
||||
}
|
||||
|
||||
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
return float4(pos.x, pos.y, pos.z, 1.0f);
|
||||
}
|
||||
|
||||
float4 ps_main(float4 pos : SV_POSITION) : SV_TARGET
|
||||
{
|
||||
float t = __PROPERTIES__time;
|
||||
return float4(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
2
test/codegen/empty_struct.golden
Normal file
2
test/codegen/empty_struct.golden
Normal file
@@ -0,0 +1,2 @@
|
||||
struct Foo {};
|
||||
|
||||
4
test/codegen/empty_vertex_main.golden
Normal file
4
test/codegen/empty_vertex_main.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
void vs_main()
|
||||
{
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
float3 vs_main(float3 pos : POSITION)
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
7
test/codegen/field_assignment.golden
Normal file
7
test/codegen/field_assignment.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
float4 vs_main(float4 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
float x = 5.0f;
|
||||
x = 7.0f;
|
||||
return pos;
|
||||
}
|
||||
|
||||
12
test/codegen/function_call.golden
Normal file
12
test/codegen/function_call.golden
Normal file
@@ -0,0 +1,12 @@
|
||||
int foo();
|
||||
|
||||
int foo()
|
||||
{
|
||||
return 4;
|
||||
}
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
||||
11
test/codegen/function_call_out_of_order_declaration.golden
Normal file
11
test/codegen/function_call_out_of_order_declaration.golden
Normal file
@@ -0,0 +1,11 @@
|
||||
void foo();
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
foo();
|
||||
}
|
||||
|
||||
void foo()
|
||||
{
|
||||
}
|
||||
|
||||
9
test/codegen/function_call_return.golden
Normal file
9
test/codegen/function_call_return.golden
Normal file
@@ -0,0 +1,9 @@
|
||||
void vs_main()
|
||||
{
|
||||
}
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
return float4(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
13
test/codegen/hinted_cbuffer.golden
Normal file
13
test/codegen/hinted_cbuffer.golden
Normal file
@@ -0,0 +1,13 @@
|
||||
cbuffer props : register(b0)
|
||||
{
|
||||
float4x4 projection;
|
||||
float4x4 view;
|
||||
}
|
||||
|
||||
float4 vs_main(float4 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
float4 mv = mul(props.view, pos);
|
||||
float4 mvp = mul(props.projection, mv);
|
||||
return mvp;
|
||||
}
|
||||
|
||||
7
test/codegen/if_def_block.golden
Normal file
7
test/codegen/if_def_block.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
void ps_main()
|
||||
{
|
||||
|
||||
float4 alpha_color = float4(1, 0, 0, 1);
|
||||
float f = 2.0f;
|
||||
}
|
||||
|
||||
4
test/codegen/if_def_expression.golden
Normal file
4
test/codegen/if_def_expression.golden
Normal file
@@ -0,0 +1,4 @@
|
||||
void vs_console_main()
|
||||
{
|
||||
}
|
||||
|
||||
9
test/codegen/ifdefs.golden
Normal file
9
test/codegen/ifdefs.golden
Normal file
@@ -0,0 +1,9 @@
|
||||
void ps_main()
|
||||
{
|
||||
}
|
||||
|
||||
void vs_skinning_main()
|
||||
{
|
||||
float x = 5.0f;
|
||||
}
|
||||
|
||||
24
test/codegen/inferred_types.golden
Normal file
24
test/codegen/inferred_types.golden
Normal file
@@ -0,0 +1,24 @@
|
||||
float bar();
|
||||
float foo();
|
||||
|
||||
float bar()
|
||||
{
|
||||
return 5.0f;
|
||||
}
|
||||
|
||||
float foo()
|
||||
{
|
||||
return bar();
|
||||
}
|
||||
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
float f = 2.0f;
|
||||
int i = 10;
|
||||
f = foo();
|
||||
float2 v2 = float2(2, 2);
|
||||
float3 v3 = float3(2, 2, 3);
|
||||
float4 v4 = float4(4, 5, 6, 7);
|
||||
return float4(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
16
test/codegen/meta_block.golden
Normal file
16
test/codegen/meta_block.golden
Normal file
@@ -0,0 +1,16 @@
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
float4 __PROPERTIES__color;
|
||||
}
|
||||
|
||||
|
||||
float3 vs_main(float3 pos : POSITION, float2 uv : TEXCOORD0) : SV_POSITION
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
return __PROPERTIES__color;
|
||||
}
|
||||
|
||||
19
test/codegen/multiple_functions.golden
Normal file
19
test/codegen/multiple_functions.golden
Normal file
@@ -0,0 +1,19 @@
|
||||
int foo();
|
||||
float bar();
|
||||
|
||||
int foo()
|
||||
{
|
||||
return 5;
|
||||
}
|
||||
|
||||
float bar()
|
||||
{
|
||||
return 1235.0f * 500;
|
||||
}
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
int x = foo();
|
||||
float y = bar();
|
||||
}
|
||||
|
||||
19
test/codegen/multiple_semicolons_everywhere.golden
Normal file
19
test/codegen/multiple_semicolons_everywhere.golden
Normal file
@@ -0,0 +1,19 @@
|
||||
float4 foo();
|
||||
|
||||
float3 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
float4 foo()
|
||||
{
|
||||
return float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
float4 y = foo();
|
||||
float4 color = y;
|
||||
return color;
|
||||
}
|
||||
|
||||
18
test/codegen/nested_if.golden
Normal file
18
test/codegen/nested_if.golden
Normal file
@@ -0,0 +1,18 @@
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
if (pos.x > 100)
|
||||
{
|
||||
if (pos.x > 50)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
93
test/codegen/night_time.golden
Normal file
93
test/codegen/night_time.golden
Normal file
@@ -0,0 +1,93 @@
|
||||
float4 apply_night(float4 color);
|
||||
float4 apply_twilight(float4 color);
|
||||
float4 apply_morning(float4 color);
|
||||
float4 apply_dawn(float4 color);
|
||||
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
float __PROPERTIES__hour_of_day;
|
||||
}
|
||||
|
||||
Texture2D __PROPERTIES__input_tex : register(t0);
|
||||
SamplerState __PROPERTIES__tex_sampler : register(s0);
|
||||
|
||||
struct VS_Input
|
||||
{
|
||||
float3 pos : POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct VS_Output
|
||||
{
|
||||
float4 pos : SV_POSITION;
|
||||
float2 uv : TEXCOORD0;
|
||||
};
|
||||
|
||||
VS_Output vs_main(VS_Input input)
|
||||
{
|
||||
VS_Output output;
|
||||
output.pos = float4(input.pos, 1.0f);
|
||||
output.uv = input.uv;
|
||||
return output;
|
||||
}
|
||||
|
||||
float4 apply_night(float4 color)
|
||||
{
|
||||
float4 result = color;
|
||||
(result -= float4(0.3f, 0.2f, 0.0f, 0.0f));
|
||||
(result *= 0.8f);
|
||||
return result;
|
||||
}
|
||||
|
||||
float4 apply_twilight(float4 color)
|
||||
{
|
||||
float4 result = color;
|
||||
(result += float4(0.2f, -0.1f, 0.1f, 0.0f));
|
||||
(result *= 0.9f);
|
||||
return result;
|
||||
}
|
||||
|
||||
float4 apply_morning(float4 color)
|
||||
{
|
||||
return (color * 1.3f);
|
||||
}
|
||||
|
||||
float4 apply_dawn(float4 color)
|
||||
{
|
||||
return color;
|
||||
}
|
||||
|
||||
float4 ps_main(VS_Output input)
|
||||
{
|
||||
float4 sampled_color = __PROPERTIES__input_tex.Sample(__PROPERTIES__tex_sampler, input.uv);
|
||||
float t = 0.0f;
|
||||
float4 a = float4(0, 0, 0, 0);
|
||||
float4 b = float4(0, 0, 0, 0);
|
||||
if (__PROPERTIES__hour_of_day > 16)
|
||||
{
|
||||
t = ((__PROPERTIES__hour_of_day - 16) / 6);
|
||||
a = apply_twilight(sampled_color);
|
||||
b = apply_night(sampled_color);
|
||||
}
|
||||
else if (__PROPERTIES__hour_of_day > 12)
|
||||
{
|
||||
t = ((__PROPERTIES__hour_of_day - 12) / 6);
|
||||
a = sampled_color;
|
||||
b = apply_twilight(sampled_color);
|
||||
}
|
||||
else if (__PROPERTIES__hour_of_day > 6)
|
||||
{
|
||||
t = ((__PROPERTIES__hour_of_day - 6) / 6);
|
||||
a = apply_morning(sampled_color);
|
||||
b = sampled_color;
|
||||
}
|
||||
else if (__PROPERTIES__hour_of_day >= 0)
|
||||
{
|
||||
t = (__PROPERTIES__hour_of_day / 6);
|
||||
a = apply_night(sampled_color);
|
||||
b = apply_morning(sampled_color);
|
||||
}
|
||||
|
||||
return lerp(a, b, t);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
float foo(Foo f);
|
||||
|
||||
struct Foo
|
||||
{
|
||||
float some_data;
|
||||
};
|
||||
|
||||
float foo(Foo f)
|
||||
{
|
||||
return f.some_data * 2.0f;
|
||||
}
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
Foo f;
|
||||
f.some_data = 4.0f;
|
||||
float d = foo(f);
|
||||
}
|
||||
|
||||
10
test/codegen/passthrough.golden
Normal file
10
test/codegen/passthrough.golden
Normal file
@@ -0,0 +1,10 @@
|
||||
float3 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
return float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
8
test/codegen/precedence_test.golden
Normal file
8
test/codegen/precedence_test.golden
Normal file
@@ -0,0 +1,8 @@
|
||||
void vs_main()
|
||||
{
|
||||
float x = 2;
|
||||
float y = 5;
|
||||
float z = 10;
|
||||
float w = x * y + y * z - x / y * x;
|
||||
}
|
||||
|
||||
16
test/codegen/property_rename.golden
Normal file
16
test/codegen/property_rename.golden
Normal file
@@ -0,0 +1,16 @@
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
float4 __PROPERTIES__color;
|
||||
}
|
||||
|
||||
|
||||
float4 vs_main(float4 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
float4 ps_main() : SV_TARGET
|
||||
{
|
||||
return __PROPERTIES__color;
|
||||
}
|
||||
|
||||
7
test/codegen/rvalue_binary.golden
Normal file
7
test/codegen/rvalue_binary.golden
Normal file
@@ -0,0 +1,7 @@
|
||||
void vs_main()
|
||||
{
|
||||
float2 a;
|
||||
float2 b;
|
||||
float x = (a + b).x;
|
||||
}
|
||||
|
||||
17
test/codegen/simple_else_if.golden
Normal file
17
test/codegen/simple_else_if.golden
Normal file
@@ -0,0 +1,17 @@
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
if (pos.x > 100)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
else if (pos.x > 50)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
10
test/codegen/simple_if.golden
Normal file
10
test/codegen/simple_if.golden
Normal file
@@ -0,0 +1,10 @@
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
if (0 > 100)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
13
test/codegen/simple_if_else.golden
Normal file
13
test/codegen/simple_if_else.golden
Normal file
@@ -0,0 +1,13 @@
|
||||
float4 vs_main(float3 pos : POSITION) : SV_POSITION
|
||||
{
|
||||
if (0 > 100)
|
||||
{
|
||||
return float4(pos, 1.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return float4(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
11
test/codegen/simple_struct_access.golden
Normal file
11
test/codegen/simple_struct_access.golden
Normal file
@@ -0,0 +1,11 @@
|
||||
struct Data
|
||||
{
|
||||
float4 color;
|
||||
};
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
Data d;
|
||||
float4 x = d.color;
|
||||
}
|
||||
|
||||
17
test/codegen/struct_within_struct.golden
Normal file
17
test/codegen/struct_within_struct.golden
Normal file
@@ -0,0 +1,17 @@
|
||||
struct Foo
|
||||
{
|
||||
float4 color;
|
||||
};
|
||||
|
||||
struct Bar
|
||||
{
|
||||
Foo t;
|
||||
};
|
||||
|
||||
void vs_main()
|
||||
{
|
||||
Foo f;
|
||||
Bar b;
|
||||
b.t = f;
|
||||
}
|
||||
|
||||
29
test/codegen/texture_sample.golden
Normal file
29
test/codegen/texture_sample.golden
Normal file
@@ -0,0 +1,29 @@
|
||||
struct PS_Input;
|
||||
|
||||
cbuffer __PROPERTIES : register(b0)
|
||||
{
|
||||
}
|
||||
|
||||
Texture2D texture : register(t0);
|
||||
Sampler sampler : register(s0);
|
||||
|
||||
struct PS_Input
|
||||
{
|
||||
float2 uv;
|
||||
float4 pos : POSITION;
|
||||
}
|
||||
|
||||
PS_Input vs_main(float4 pos : POSITION, float2 uv)
|
||||
{
|
||||
PS_Input result;
|
||||
result.uv = uv;
|
||||
result.pos = pos;
|
||||
return result;
|
||||
}
|
||||
|
||||
float4 ps_main(PS_Input input) : SV_TARGET
|
||||
{
|
||||
float4 color = texture.sample(input.uv, sampler);
|
||||
return color;
|
||||
}
|
||||
|
||||
10
test/codegen/unary.golden
Normal file
10
test/codegen/unary.golden
Normal file
@@ -0,0 +1,10 @@
|
||||
float4 vs_vs_main(float3 position : POSITION) : SV_POSITION
|
||||
{
|
||||
return float4(position.x, position.y, position.z, 1.0f);
|
||||
}
|
||||
|
||||
float4 ps_ps_main(float4 position : SV_POSITION) : SV_TARGET
|
||||
{
|
||||
return float4(0.5f, -1, 0, 1);
|
||||
}
|
||||
|
||||
5
test/codegen/use_builtin_functions.golden
Normal file
5
test/codegen/use_builtin_functions.golden
Normal file
@@ -0,0 +1,5 @@
|
||||
void vs_main()
|
||||
{
|
||||
float4 f = float4(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user