2021-09-11 17:19:37 -07:00
|
|
|
% Test how semantics are determined when spread across the entry point's
|
|
|
|
% definition and its declarations.
|
|
|
|
|
|
|
|
[vertex shader]
|
2022-08-15 17:53:55 -07:00
|
|
|
void main(float4 pos : position, out float tex : texcoord, out float4 out_pos : sv_position)
|
2021-09-11 17:19:37 -07:00
|
|
|
{
|
|
|
|
tex = 0.2;
|
2022-08-15 17:53:55 -07:00
|
|
|
out_pos = pos;
|
2021-09-11 17:19:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
|
|
|
|
float4 main(float tex : texcoord) : sv_target;
|
|
|
|
|
|
|
|
float4 main(float tex)
|
|
|
|
{
|
|
|
|
return tex;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail]
|
|
|
|
|
|
|
|
float4 main(float tex)
|
|
|
|
{
|
|
|
|
return tex;
|
|
|
|
}
|
|
|
|
|
|
|
|
float4 main(float tex : texcoord) : sv_target;
|
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
|
|
|
|
float4 main(float tex : bogus) : bogus;
|
|
|
|
|
|
|
|
float4 main(float tex : texcoord) : sv_target
|
|
|
|
{
|
|
|
|
return tex;
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-10-21 07:23:27 -07:00
|
|
|
todo(msl) draw quad
|
2021-09-11 17:19:37 -07:00
|
|
|
probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2)
|
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
|
|
|
|
float4 main(float tex : texcoord) : sv_target
|
|
|
|
{
|
|
|
|
return tex;
|
|
|
|
}
|
|
|
|
|
|
|
|
float4 main(float tex : bogus) : bogus;
|
|
|
|
|
|
|
|
[test]
|
2024-10-21 07:23:27 -07:00
|
|
|
todo(msl) draw quad
|
2021-09-11 17:19:37 -07:00
|
|
|
probe (0, 0) rgba (0.2, 0.2, 0.2, 0.2)
|
2023-04-04 16:46:16 -07:00
|
|
|
|
|
|
|
|
2023-04-05 09:07:37 -07:00
|
|
|
[vertex shader]
|
2022-08-15 17:53:55 -07:00
|
|
|
void main(float4 pos : position, out float4 tex[4] : texcoord, out float4 out_pos : sv_position)
|
2023-04-04 16:46:16 -07:00
|
|
|
{
|
|
|
|
tex[0] = float4(10.0, 11.0, 12.0, 13.0);
|
|
|
|
tex[1] = float4(20.0, 21.0, 22.0, 23.0);
|
|
|
|
tex[2] = float4(30.0, 31.0, 32.0, 33.0);
|
|
|
|
tex[3] = float4(40.0, 41.0, 42.0, 43.0);
|
2022-08-15 17:53:55 -07:00
|
|
|
out_pos = pos;
|
2023-04-04 16:46:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
% Array parameters of non-struct elements must have a semantic.
|
|
|
|
[pixel shader fail]
|
|
|
|
float4 main(in float2 arr[2]) : sv_target
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
% Array elements with a semantic get successive indexes.
|
2023-04-05 09:07:37 -07:00
|
|
|
[pixel shader]
|
2023-04-04 16:46:16 -07:00
|
|
|
struct apple
|
|
|
|
{
|
|
|
|
float3 tp[4] : TEXCOORD0;
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main(in apple a) : sv_target
|
|
|
|
{
|
|
|
|
return float4(a.tp[0].x, a.tp[1].x, a.tp[2].x, a.tp[3].x);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-10-21 07:23:27 -07:00
|
|
|
todo(sm<4 | msl) draw quad
|
2023-10-02 18:59:09 -07:00
|
|
|
probe (0, 0) rgba (10.0, 20.0, 30.0, 40.0)
|
2023-04-04 16:46:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
% Arrays of matrices get successive indexes.
|
2023-04-05 09:07:37 -07:00
|
|
|
[pixel shader]
|
2023-04-04 16:46:16 -07:00
|
|
|
struct apple
|
|
|
|
{
|
|
|
|
float4x2 tp[2] : TEXCOORD0;
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main(in apple a) : sv_target
|
|
|
|
{
|
|
|
|
return float4(a.tp[0][0].x, a.tp[0][1].x, a.tp[1][0].x, a.tp[1][1].x);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-10-21 07:23:27 -07:00
|
|
|
todo(msl) draw quad
|
2023-10-02 18:59:09 -07:00
|
|
|
probe (0, 0) rgba (10.0, 11.0, 30.0, 31.0)
|
|
|
|
|
|
|
|
|
|
|
|
% dxcompiler emits correct array addressing.
|
|
|
|
[require]
|
|
|
|
shader model < 6.0
|
2023-04-04 16:46:16 -07:00
|
|
|
|
|
|
|
|
|
|
|
% Arrays (even multi-dimensional) of struct elements are allowed. The fields in the different struct
|
|
|
|
% elements get the same indexes.
|
2023-04-05 09:07:37 -07:00
|
|
|
[pixel shader]
|
2023-04-04 16:46:16 -07:00
|
|
|
struct apple
|
|
|
|
{
|
|
|
|
float4 tc0 : TEXCOORD0;
|
|
|
|
float4 tc1 : TEXCOORD1;
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main(in apple aps[2][2]) : sv_target
|
|
|
|
{
|
|
|
|
return float4(aps[0][0].tc0.x, aps[1][1].tc0.x, aps[0][0].tc1.x, aps[1][1].tc1.x);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-10-21 07:23:27 -07:00
|
|
|
todo(msl) draw quad
|
2023-11-15 12:41:33 -08:00
|
|
|
probe (0, 0) rgba (10.0, 10.0, 20.0, 20.0)
|
2023-04-04 16:46:16 -07:00
|
|
|
|
|
|
|
|
2023-04-05 09:07:37 -07:00
|
|
|
[pixel shader]
|
2023-04-04 16:46:16 -07:00
|
|
|
struct apple
|
|
|
|
{
|
|
|
|
float4 tc0 : TEXCOORD0;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct banana
|
|
|
|
{
|
|
|
|
apple apl;
|
|
|
|
float4 tc1 : TEXCOORD1;
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main(in banana bans[2]) : sv_target
|
|
|
|
{
|
|
|
|
return float4(bans[0].apl.tc0.xy, bans[1].tc1.xy);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-10-21 07:23:27 -07:00
|
|
|
todo(msl) draw quad
|
2023-09-14 02:29:24 -07:00
|
|
|
todo(sm>=6) probe (0, 0) rgba (10.0, 11.0, 20.0, 21.0)
|
2023-04-04 16:46:16 -07:00
|
|
|
|
|
|
|
|
2023-10-02 18:59:09 -07:00
|
|
|
[require]
|
|
|
|
% reset requirements
|
|
|
|
|
|
|
|
|
2023-04-04 16:46:16 -07:00
|
|
|
[pixel shader fail]
|
|
|
|
struct apple
|
|
|
|
{
|
|
|
|
float2 miss; // missing semantic.
|
|
|
|
};
|
|
|
|
|
|
|
|
struct banana
|
|
|
|
{
|
|
|
|
apple apl[2];
|
|
|
|
float4 arb : UNUSED;
|
|
|
|
};
|
|
|
|
|
|
|
|
float4 main(in banana bans[2]) : sv_target
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[vertex shader fail]
|
|
|
|
struct apple
|
|
|
|
{
|
|
|
|
float2 miss; // missing semantic.
|
|
|
|
};
|
|
|
|
|
|
|
|
struct banana
|
|
|
|
{
|
|
|
|
apple apl[2];
|
|
|
|
float4 arb : UNUSED;
|
|
|
|
};
|
|
|
|
|
|
|
|
void main(out banana bans[2])
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-05 09:07:37 -07:00
|
|
|
[vertex shader]
|
2023-04-04 16:46:16 -07:00
|
|
|
struct apple
|
|
|
|
{
|
|
|
|
float4 tex[2] : TEXCOORD0;
|
|
|
|
};
|
|
|
|
|
2022-08-15 17:53:55 -07:00
|
|
|
void main(float4 pos : position, out apple apl, out float4 out_pos : sv_position)
|
2023-04-04 16:46:16 -07:00
|
|
|
{
|
|
|
|
apl.tex[0] = float4(1, 2, 3, 4);
|
|
|
|
apl.tex[1] = float4(10, 20, 30, 40);
|
2022-08-15 17:53:55 -07:00
|
|
|
out_pos = pos;
|
2023-04-04 16:46:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader]
|
|
|
|
float4 main(in float4 tex0 : TEXCOORD0, in float4 tex1 : TEXCOORD1) : sv_target
|
|
|
|
{
|
|
|
|
return float4(tex0.xy, tex1.xy);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-10-21 07:23:27 -07:00
|
|
|
todo(msl) draw quad
|
2023-10-02 18:59:09 -07:00
|
|
|
probe (0, 0) rgba (1.0, 2.0, 10.0, 20.0)
|
2023-04-14 13:46:57 -07:00
|
|
|
|
|
|
|
|
|
|
|
% Output semantics cannot be mapped to more than one value.
|
2023-09-14 02:29:24 -07:00
|
|
|
[vertex shader fail(sm<6)]
|
2023-04-14 13:46:57 -07:00
|
|
|
struct apple
|
|
|
|
{
|
|
|
|
float2 tex : TEXCOORD0;
|
|
|
|
};
|
|
|
|
|
2022-08-15 17:53:55 -07:00
|
|
|
void main(float4 pos : position, out apple apls[2], out float4 out_pos : sv_position)
|
2023-04-14 13:46:57 -07:00
|
|
|
{
|
|
|
|
apls[0].tex = float2(1, 2);
|
|
|
|
apls[1].tex = float2(3, 4);
|
2022-08-15 17:53:55 -07:00
|
|
|
out_pos = pos;
|
2023-04-14 13:46:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-12 12:59:06 -07:00
|
|
|
[vertex shader fail]
|
2023-04-14 13:46:57 -07:00
|
|
|
struct apple
|
|
|
|
{
|
|
|
|
float2 f : SEMANTIC;
|
|
|
|
};
|
|
|
|
|
2022-08-15 17:53:55 -07:00
|
|
|
void main(float4 pos : position, out apple a, out apple b, out float4 out_pos : sv_position)
|
2023-04-14 13:46:57 -07:00
|
|
|
{
|
|
|
|
a.f = float2(1, 2);
|
|
|
|
b.f = float2(3, 4);
|
2022-08-15 17:53:55 -07:00
|
|
|
out_pos = pos;
|
2023-04-14 13:46:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
% Semantic names are case-insensitive.
|
2023-04-12 12:59:06 -07:00
|
|
|
[vertex shader fail]
|
2022-08-15 17:53:55 -07:00
|
|
|
void main(float4 pos : position, out float2 a : sem0, out float2 b : SEM, out float4 out_pos : sv_position)
|
2023-04-14 13:46:57 -07:00
|
|
|
{
|
|
|
|
a = float2(1, 2);
|
|
|
|
b = float2(3, 4);
|
2022-08-15 17:53:55 -07:00
|
|
|
out_pos = pos;
|
2023-04-14 13:46:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-05 09:07:37 -07:00
|
|
|
[vertex shader]
|
2022-08-15 17:53:55 -07:00
|
|
|
void main(float4 pos : position, out float4 tex[4] : texcoord, out float4 out_pos : sv_position)
|
2023-04-14 13:46:57 -07:00
|
|
|
{
|
|
|
|
tex[0] = float4(10.0, 11.0, 12.0, 13.0);
|
|
|
|
tex[1] = float4(20.0, 21.0, 22.0, 23.0);
|
|
|
|
tex[2] = float4(30.0, 31.0, 32.0, 33.0);
|
|
|
|
tex[3] = float4(40.0, 41.0, 42.0, 43.0);
|
2022-08-15 17:53:55 -07:00
|
|
|
out_pos = pos;
|
2023-04-14 13:46:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
% Arguments with the same semantic aren't aliased.
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2023-04-14 13:46:57 -07:00
|
|
|
float4 main(in float4 t1 : TEXCOORD0, in float4 t2 : TEXCOORD0) : sv_target
|
|
|
|
{
|
|
|
|
t1 = 99;
|
|
|
|
return float4(t1.xy, t2.xy);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-10-21 07:23:27 -07:00
|
|
|
todo(msl) draw quad
|
2023-11-15 12:41:33 -08:00
|
|
|
todo(sm>=6) probe (0, 0) rgba (99.0, 99.0, 10.0, 11.0)
|
2023-04-14 13:46:57 -07:00
|
|
|
|
|
|
|
|
|
|
|
% Different indexes of the same semantic can have different types.
|
|
|
|
[pixel shader]
|
|
|
|
float4 main(in float4 a : TEXCOORD0, in float3 b : TEXCOORD1) : sv_target
|
|
|
|
{
|
|
|
|
return float4(a.xy, b.xy);
|
|
|
|
}
|
|
|
|
|
|
|
|
[test]
|
2024-10-21 07:23:27 -07:00
|
|
|
todo(sm<4 | msl) draw quad
|
2023-10-02 18:59:09 -07:00
|
|
|
probe (0, 0) rgba (10.0, 11.0, 20.0, 21.0)
|
2023-04-14 13:46:57 -07:00
|
|
|
|
|
|
|
|
|
|
|
% In SM4, duplicated input semantics can only have different types if they have the same layout and
|
|
|
|
% register types. SM1 is permissive in this regard.
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2023-04-14 13:46:57 -07:00
|
|
|
float4 main(in float2 a : TEXCOORD0, in half2 b : TEXCOORD0, in float2x1 c: TEXCOORD0) : sv_target
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-09-14 02:29:24 -07:00
|
|
|
[pixel shader fail(sm>=6)]
|
2023-04-14 13:46:57 -07:00
|
|
|
float4 main(in uint2 a : TEXCOORD0, in int2 b : TEXCOORD0, in int2x1 c : TEXCOORD0, in bool2 d : TEXCOORD0) : sv_target
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
[require]
|
|
|
|
shader model >= 4.0
|
|
|
|
|
|
|
|
|
2023-04-12 13:27:31 -07:00
|
|
|
[pixel shader fail]
|
2023-04-14 13:46:57 -07:00
|
|
|
float4 main(in float2 a : TEXCOORD0, in float3 b : TEXCOORD0) : sv_target
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-04-12 13:27:31 -07:00
|
|
|
[pixel shader fail]
|
2023-04-14 13:46:57 -07:00
|
|
|
float4 main(in float2 a : TEXCOORD0, in int2 b : TEXCOORD0) : sv_target
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
% For some reason, vectors from row_major matrices are not considered as having the same layout as
|
|
|
|
% regular vectors.
|
|
|
|
[pixel shader fail todo]
|
|
|
|
float4 main(in float2 a : TEXCOORD0, row_major float1x2 b : TEXCOORD0) : sv_target
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
2023-04-12 13:27:31 -07:00
|
|
|
[pixel shader fail]
|
2023-04-14 13:46:57 -07:00
|
|
|
float4 main(in float2 a : TEXCOORD0, row_major float2x1 b : TEXCOORD0) : sv_target
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|
|
|
|
|
|
|
|
[pixel shader fail todo]
|
|
|
|
float4 main(in float4 a : TEXCOORD0, row_major float1x4 b : TEXCOORD0) : sv_target
|
|
|
|
{
|
|
|
|
return 0.0;
|
|
|
|
}
|