yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Yong HeLower varying parameters as pointers instead of SSA values. (#5919)c43f6fa55

master
838 B39 linesraw
1//TEST:SIMPLE(filecheck=CHECK): -target spirv-assembly -entry main -profile vs_5_0 -emit-spirv-directly
2//TEST:SIMPLE(filecheck=CHECK): -target spirv-assembly -entry main -profile vs_5_0 -emit-spirv-via-glsl
3
4// CHECK-DAG: vIn_field_v0{{.*}} = OpVariable %_ptr_Input_v4float Input
5// CHECK-DAG: %vIn_field_v1{{.*}}= OpVariable %_ptr_Input_v2float Input
6// CHECK-DAG: %vIn_p0{{.*}}= OpVariable %_ptr_Input_v3float Input
7
8interface IField
9{
10	float get();
11};
12struct GIn<TField : IField, TEmptyField>
13{
14	float3 p0;
15	TField field;
16	TEmptyField e;
17};
18struct F : IField
19{
20	float4 v0;
21	float2 v1;
22	float get() { return v0.x + v1.x; }
23};
24struct E
25{
26	float get() {return 1.0;}
27};
28
29struct VOut
30{
31	float4 projPos : SV_POSITION;
32};
33
34VOut main(GIn<F, E> vIn)
35{
36	VOut vout;
37	vout.projPos = float4(vIn.p0, vIn.field.get() + vIn.e.get());
38	return vout;
39}