|
| 1 | +// REQUIRES: dxil-1-10 |
| 2 | +// RUN: %dxc -T lib_6_10 %s -verify |
| 3 | + |
| 4 | +// expected-no-diagnostics |
| 5 | + |
| 6 | +void CallFunction() |
| 7 | +{ |
| 8 | + __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat; |
| 9 | + __builtin_LinAlg_MatrixLength(mat); |
| 10 | +} |
| 11 | + |
| 12 | +// --- Allowed Stages --- |
| 13 | + |
| 14 | +[shader("compute")] |
| 15 | +[numthreads(4,4,4)] |
| 16 | +void mainCS(uint ix : SV_GroupIndex, uint3 id : SV_GroupThreadID) { |
| 17 | + CallFunction(); |
| 18 | +} |
| 19 | + |
| 20 | +struct Verts { |
| 21 | + float4 position : SV_Position; |
| 22 | +}; |
| 23 | + |
| 24 | +[shader("mesh")] |
| 25 | +[NumThreads(8, 8, 2)] |
| 26 | +[OutputTopology("triangle")] |
| 27 | +void mainMeS(out vertices Verts verts[32], uint ix : SV_GroupIndex) { |
| 28 | + CallFunction(); |
| 29 | + SetMeshOutputCounts(32, 16); |
| 30 | + Verts v = {0.0, 0.0, 0.0, 0.0}; |
| 31 | + verts[ix] = v; |
| 32 | +} |
| 33 | + |
| 34 | +struct AmpPayload { |
| 35 | + float2 dummy; |
| 36 | +}; |
| 37 | + |
| 38 | +[numthreads(8, 1, 1)] |
| 39 | +[shader("amplification")] |
| 40 | +void mainAS() |
| 41 | +{ |
| 42 | + CallFunction(); |
| 43 | + AmpPayload pld; |
| 44 | + pld.dummy = float2(1.0,2.0); |
| 45 | + DispatchMesh(8, 1, 1, pld); |
| 46 | +} |
| 47 | + |
| 48 | +[shader("pixel")] |
| 49 | +float4 mainPS(uint ix : SV_PrimitiveID) : SV_TARGET { |
| 50 | + CallFunction(); |
| 51 | + return 1.0; |
| 52 | +} |
| 53 | + |
| 54 | +[shader("vertex")] |
| 55 | +float4 mainVS(uint ix : SV_VertexID) : OUT { |
| 56 | + CallFunction(); |
| 57 | + return 1.0; |
| 58 | +} |
| 59 | + |
| 60 | +[shader("node")] |
| 61 | +[nodedispatchgrid(8,1,1)] |
| 62 | +[numthreads(64,2,2)] |
| 63 | +void mainNS() { |
| 64 | + CallFunction(); |
| 65 | +} |
| 66 | + |
| 67 | +[shader("raygeneration")] |
| 68 | +void mainRG() { |
| 69 | + CallFunction(); |
| 70 | +} |
| 71 | + |
| 72 | +[shader("intersection")] |
| 73 | +void mainIS() { |
| 74 | + CallFunction(); |
| 75 | +} |
| 76 | + |
| 77 | +struct Attribs { float2 barys; }; |
| 78 | + |
| 79 | +[shader("callable")] |
| 80 | +void mainCALL(inout Attribs attrs) { |
| 81 | + CallFunction(); |
| 82 | +} |
| 83 | + |
| 84 | +struct [raypayload] RayPayload |
| 85 | +{ |
| 86 | + float elem |
| 87 | + : write(caller,closesthit,anyhit,miss) |
| 88 | + : read(caller,closesthit,anyhit,miss); |
| 89 | +}; |
| 90 | + |
| 91 | +[shader("anyhit")] |
| 92 | +void mainAH(inout RayPayload pld, in Attribs attrs) { |
| 93 | + CallFunction(); |
| 94 | +} |
| 95 | + |
| 96 | +[shader("closesthit")] |
| 97 | +void mainCH(inout RayPayload pld, in Attribs attrs) { |
| 98 | + CallFunction(); |
| 99 | +} |
| 100 | + |
| 101 | +[shader("miss")] |
| 102 | +void mainMS(inout RayPayload pld) { |
| 103 | + CallFunction(); |
| 104 | +} |
| 105 | + |
| 106 | +struct PosStruct { |
| 107 | + float4 pos : SV_Position; |
| 108 | +}; |
| 109 | + |
| 110 | +struct PCStruct |
| 111 | +{ |
| 112 | + float Edges[3] : SV_TessFactor; |
| 113 | + float Inside : SV_InsideTessFactor; |
| 114 | + float4 test : TEST; |
| 115 | +}; |
| 116 | + |
| 117 | +PCStruct HSPatch(InputPatch<PosStruct, 3> ip, |
| 118 | + OutputPatch<PosStruct, 3> op, |
| 119 | + uint ix : SV_PrimitiveID) |
| 120 | +{ |
| 121 | + PCStruct a; |
| 122 | + a.Edges[0] = ip[0].pos.w; |
| 123 | + a.Edges[1] = ip[0].pos.w; |
| 124 | + a.Edges[2] = ip[0].pos.w; |
| 125 | + a.Inside = ip[0].pos.w; |
| 126 | + return a; |
| 127 | +} |
| 128 | + |
| 129 | +[shader("hull")] |
| 130 | +[domain("tri")] |
| 131 | +[partitioning("fractional_odd")] |
| 132 | +[outputtopology("triangle_cw")] |
| 133 | +[outputcontrolpoints(3)] |
| 134 | +[patchconstantfunc("HSPatch")] |
| 135 | +PosStruct mainHS(InputPatch<PosStruct, 3> p, uint ix : SV_OutputControlPointID) |
| 136 | +{ |
| 137 | + CallFunction(); |
| 138 | + PosStruct s; |
| 139 | + s.pos = p[ix].pos; |
| 140 | + return s; |
| 141 | +} |
| 142 | + |
| 143 | +[shader("domain")] |
| 144 | +[domain("tri")] |
| 145 | +PosStruct mainDS(const OutputPatch<PosStruct, 3> patch, |
| 146 | + uint ix : SV_PrimitiveID) |
| 147 | +{ |
| 148 | + CallFunction(); |
| 149 | + PosStruct v; |
| 150 | + v.pos = patch[0].pos; |
| 151 | + return v; |
| 152 | +} |
| 153 | + |
| 154 | +float4 a; |
| 155 | + |
| 156 | +[shader("geometry")] |
| 157 | +[maxvertexcount(1)] |
| 158 | +void mainGS(triangle float4 array[3] : SV_Position, uint ix : SV_GSInstanceID, |
| 159 | + inout PointStream<PosStruct> OutputStream) |
| 160 | +{ |
| 161 | + CallFunction(); |
| 162 | + PosStruct s; |
| 163 | + s.pos = a; |
| 164 | + OutputStream.Append(s); |
| 165 | + OutputStream.RestartStrip(); |
| 166 | +} |
0 commit comments