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,6 @@
void vs_main()
{
float2 v;
v.x = (2.0f + ((4.0f - 2.0f) * 1.5f)) * 3.0f;
}

View File

@@ -0,0 +1,6 @@
float4 vs_main() : SV_POSITION
{
float4 arr[16];
return arr[0];
}

View File

@@ -0,0 +1,5 @@
void vs_main()
{
float x = 2.0f + 5.0f;
}

View 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;
}

View 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;
}

View File

@@ -0,0 +1,7 @@
void vs_main()
{
float x = 5.0f;
float y = 3000.0f;
float z = (y * y) + x;
}

View 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);
}

View 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);
}

View File

@@ -0,0 +1,2 @@
struct Foo {};

View File

@@ -0,0 +1,4 @@
void vs_main()
{
}

View File

@@ -0,0 +1,5 @@
float3 vs_main(float3 pos : POSITION)
{
return pos;
}

View File

@@ -0,0 +1,7 @@
float4 vs_main(float4 pos : POSITION) : SV_POSITION
{
float x = 5.0f;
x = 7.0f;
return pos;
}

View File

@@ -0,0 +1,12 @@
int foo();
int foo()
{
return 4;
}
void vs_main()
{
foo();
}

View File

@@ -0,0 +1,11 @@
void foo();
void vs_main()
{
foo();
}
void foo()
{
}

View File

@@ -0,0 +1,9 @@
void vs_main()
{
}
float4 ps_main() : SV_TARGET
{
return float4(1, 1, 1, 1);
}

View 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;
}

View File

@@ -0,0 +1,7 @@
void ps_main()
{
float4 alpha_color = float4(1, 0, 0, 1);
float f = 2.0f;
}

View File

@@ -0,0 +1,4 @@
void vs_console_main()
{
}

View File

@@ -0,0 +1,9 @@
void ps_main()
{
}
void vs_skinning_main()
{
float x = 5.0f;
}

View 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);
}

View 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;
}

View 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();
}

View 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;
}

View 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);
}

View 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);
}

View File

@@ -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);
}

View 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);
}

View 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;
}

View 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;
}

View File

@@ -0,0 +1,7 @@
void vs_main()
{
float2 a;
float2 b;
float x = (a + b).x;
}

View 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);
}

View 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);
}

View 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);
}

View File

@@ -0,0 +1,11 @@
struct Data
{
float4 color;
};
void vs_main()
{
Data d;
float4 x = d.color;
}

View File

@@ -0,0 +1,17 @@
struct Foo
{
float4 color;
};
struct Bar
{
Foo t;
};
void vs_main()
{
Foo f;
Bar b;
b.t = f;
}

View 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
View 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);
}

View File

@@ -0,0 +1,5 @@
void vs_main()
{
float4 f = float4(1, 1, 1, 1);
}