John Kessenich | fcc0aa3 | 2016-08-24 18:34:43 -0600 | [diff] [blame] | 1 | // function selection under type conversion |
John Kessenich | e3f2c8f | 2016-08-25 15:57:56 -0600 | [diff] [blame] | 2 | void foo1(double a, bool b) {} |
| 3 | void foo1(double a, uint b) {} |
| 4 | void foo1(double a, int b) {} |
| 5 | void foo1(double a, float b) {} |
John Kessenich | fcc0aa3 | 2016-08-24 18:34:43 -0600 | [diff] [blame] | 6 | void foo1(double a, double b){} |
| 7 | |
John Kessenich | 90dd70f | 2016-08-25 10:49:21 -0600 | [diff] [blame] | 8 | // uint -> int |
John Kessenich | e3f2c8f | 2016-08-25 15:57:56 -0600 | [diff] [blame] | 9 | void foo2(int a, bool b) {} |
| 10 | void foo2(int a, uint b) {} |
| 11 | void foo2(int a, int b) {} |
| 12 | void foo2(int a, float b) {} |
John Kessenich | 90dd70f | 2016-08-25 10:49:21 -0600 | [diff] [blame] | 13 | void foo2(int a, double b){} |
| 14 | |
| 15 | // everything can promote |
John Kessenich | e3f2c8f | 2016-08-25 15:57:56 -0600 | [diff] [blame] | 16 | void foo3(bool b) {} |
| 17 | void foo4(uint b) {} |
| 18 | void foo5(int b) {} |
| 19 | void foo6(float b) {} |
John Kessenich | 90dd70f | 2016-08-25 10:49:21 -0600 | [diff] [blame] | 20 | void foo7(double b){} |
| 21 | |
| 22 | // shorter forward chain better than longer or backward chain |
John Kessenich | e3f2c8f | 2016-08-25 15:57:56 -0600 | [diff] [blame] | 23 | void foo8(float) {} |
| 24 | void foo8(double) {} |
| 25 | void foo9(int) {} |
| 26 | void foo9(uint) {} |
| 27 | void foo10(bool) {} |
| 28 | void foo10(int) {} |
| 29 | |
| 30 | // shape change is worse |
| 31 | void foo11(float3) {} |
| 32 | void foo11(double) {} |
| 33 | void foo11(int3) {} |
| 34 | void foo11(uint) {} |
| 35 | void foo12(float1) {} |
| 36 | void foo12(double3) {} |
| 37 | void foo16(uint) {} |
| 38 | void foo16(uint2) {} |
| 39 | |
| 40 | // shape change |
| 41 | void foo13(float3) {} |
| 42 | void foo14(int1) {} |
| 43 | void foo15(bool1) {} |
John Kessenich | 90dd70f | 2016-08-25 10:49:21 -0600 | [diff] [blame] | 44 | |
John Kessenich | fcc0aa3 | 2016-08-24 18:34:43 -0600 | [diff] [blame] | 45 | float4 PixelShaderFunction(float4 input) : COLOR0 |
| 46 | { |
John Kessenich | e3f2c8f | 2016-08-25 15:57:56 -0600 | [diff] [blame] | 47 | bool b; |
| 48 | double d; |
| 49 | uint u; |
| 50 | int i; |
| 51 | float f; |
John Kessenich | fcc0aa3 | 2016-08-24 18:34:43 -0600 | [diff] [blame] | 52 | |
John Kessenich | e3f2c8f | 2016-08-25 15:57:56 -0600 | [diff] [blame] | 53 | foo1(d, b); |
| 54 | foo1(d, d); |
| 55 | foo1(d, u); |
| 56 | foo1(d, i); |
| 57 | foo1(d, f); |
| 58 | |
| 59 | foo1(f, b); |
| 60 | foo1(f, d); |
| 61 | foo1(f, u); |
| 62 | foo1(f, i); |
| 63 | foo1(f, f); |
| 64 | |
| 65 | foo1(u, b); |
| 66 | foo1(u, d); |
| 67 | foo1(u, u); |
| 68 | foo1(u, i); |
| 69 | foo1(u, f); |
| 70 | |
| 71 | foo1(i, b); |
| 72 | foo1(i, d); |
| 73 | foo1(i, u); |
| 74 | foo1(i, i); |
| 75 | foo1(i, f); |
| 76 | |
| 77 | foo2(u, b); |
| 78 | foo2(u, d); |
| 79 | foo2(u, u); |
| 80 | foo2(u, i); |
| 81 | foo2(u, f); |
| 82 | |
| 83 | foo2(i, b); |
| 84 | foo2(i, d); |
| 85 | foo2(i, u); |
| 86 | foo2(i, i); |
| 87 | foo2(i, f); |
| 88 | |
| 89 | foo3(b); |
| 90 | foo3(d); |
| 91 | foo3(u); |
| 92 | foo3(i); |
| 93 | foo3(f); |
| 94 | |
| 95 | foo4(b); |
| 96 | foo4(d); |
| 97 | foo4(u); |
| 98 | foo4(i); |
| 99 | foo4(f); |
| 100 | |
| 101 | foo5(b); |
| 102 | foo5(d); |
| 103 | foo5(u); |
| 104 | foo5(i); |
| 105 | foo5(f); |
| 106 | |
| 107 | foo6(b); |
| 108 | foo6(d); |
| 109 | foo6(u); |
| 110 | foo6(i); |
| 111 | foo6(f); |
| 112 | |
| 113 | foo7(b); |
| 114 | foo7(d); |
| 115 | foo7(u); |
| 116 | foo7(i); |
| 117 | foo7(f); |
| 118 | |
| 119 | foo8(b); |
| 120 | foo8(u); |
| 121 | foo8(i); |
| 122 | |
| 123 | foo9(b); |
| 124 | foo9(f); |
| 125 | foo9(d); |
| 126 | |
| 127 | foo10(u); |
| 128 | foo10(f); |
| 129 | foo10(d); |
| 130 | |
| 131 | foo11(b); |
| 132 | foo11(f); |
| 133 | foo12(float3(f)); |
| 134 | foo16(int2(i,i)); |
| 135 | |
| 136 | foo13(f); |
| 137 | foo14(int4(i)); |
| 138 | foo15(b); |
| 139 | foo15(bool3(b)); |
| 140 | |
John Kessenich | fcc0aa3 | 2016-08-24 18:34:43 -0600 | [diff] [blame] | 141 | return input; |
| 142 | } |