• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1struct s1_t {
2    float  c0;
3    float2 c1;
4    float  c2;
5};
6
7struct s2_t {
8    float  c0;
9    float3 c1;
10};
11
12struct s3_t {
13    float2  c0;
14    float1  c1;
15};
16
17struct s4_t {
18    int  c0;
19    int2 c1;
20    int  c2;
21};
22
23struct s5_t {
24    uint c0;
25    uint c1;
26};
27
28SamplerState g_sSamp;
29Texture2D <s1_t>   g_tTex2s1;
30Texture2D <s2_t>   g_tTex2s2;
31Texture2D <s3_t>   g_tTex2s3;
32Texture2D <s4_t>   g_tTex2s4;
33Texture2D <s5_t>   g_tTex2s5;
34
35Texture2D <s1_t>   g_tTex2s1a; // same type as g_tTex2s1, to test fn signature matching.
36
37// function overloading to test name mangling with textures templatized on structs
38s1_t fn1(Texture2D <s1_t> t1) { return t1 . Sample(g_sSamp, float2(0.6, 0.61)); }
39s2_t fn1(Texture2D <s2_t> t2) { return t2 . Sample(g_sSamp, float2(0.6, 0.61)); }
40
41float4 main() : SV_Target0
42{
43    s1_t s1 = g_tTex2s1 . Sample(g_sSamp, float2(0.1, 0.11));
44    s2_t s2 = g_tTex2s2 . Sample(g_sSamp, float2(0.2, 0.21));
45    s3_t s3 = g_tTex2s3 . Sample(g_sSamp, float2(0.3, 0.31));
46    s4_t s4 = g_tTex2s4 . Sample(g_sSamp, float2(0.4, 0.41));
47    s5_t s5 = g_tTex2s5 . Sample(g_sSamp, float2(0.5, 0.51));
48
49    s1_t r0 = fn1(g_tTex2s1);
50    s2_t r1 = fn1(g_tTex2s2);
51    s1_t r2 = fn1(g_tTex2s1a);
52
53    return 0;
54}
55
56