|
| 1 | +// REQUIRES: dxil-1-10 |
| 2 | +// RUN: not %dxc -T lib_6_10 %s 2>&1 | FileCheck %s |
| 3 | + |
| 4 | +// CHECK: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(gs). |
| 5 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function 'mainGS'. |
| 6 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(ds). |
| 7 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function 'mainDS'. |
| 8 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(hs). |
| 9 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function 'mainHS'. |
| 10 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(vs). |
| 11 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function 'mainVS'. |
| 12 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(ps). |
| 13 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function 'mainPS'. |
| 14 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(miss). |
| 15 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function '{{.*}}mainMS@@YAXURayPayload@@@Z'. |
| 16 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(closesthit). |
| 17 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function '{{.*}}mainCH@@YAXURayPayload@@UAttribs@@@Z'. |
| 18 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(anyhit). |
| 19 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function '{{.*}}mainAH@@YAXURayPayload@@UAttribs@@@Z'. |
| 20 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(callable). |
| 21 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function '{{.*}}mainCALL@@YAXUAttribs@@@Z'. |
| 22 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(intersection). |
| 23 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function '{{.*}}mainIS@@YAXXZ'. |
| 24 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(raygeneration). |
| 25 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function '{{.*}}mainRG@@YAXXZ'. |
| 26 | +// CHECK-NEXT: Opcode LinAlgCopyConvertMatrix not valid in shader model lib_6_10(node). |
| 27 | +// CHECK-NEXT: note: at {{.*}} @dx.op.linAlgCopyConvertMatrix{{.*}} of function 'mainNS'. |
| 28 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 29 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (node) of the entry function. |
| 30 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 31 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (raygeneration) of the entry function. |
| 32 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 33 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (intersection) of the entry function. |
| 34 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 35 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (callable) of the entry function. |
| 36 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 37 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (anyhit) of the entry function. |
| 38 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 39 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (closesthit) of the entry function. |
| 40 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 41 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (miss) of the entry function. |
| 42 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 43 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (ps) of the entry function. |
| 44 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 45 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (vs) of the entry function. |
| 46 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 47 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (hs) of the entry function. |
| 48 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 49 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (ds) of the entry function. |
| 50 | +// CHECK-NEXT: Entry function performs some operation that is incompatible with the shader stage or other entry properties. See other errors for details. |
| 51 | +// CHECK-NEXT: Function uses features incompatible with the shader stage (gs) of the entry function. |
| 52 | +// CHECK-NEXT: Validation failed. |
| 53 | + |
| 54 | +void CallFunction() |
| 55 | +{ |
| 56 | + __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(1, 5, 4, 2, 2)]] mat1; |
| 57 | + __builtin_LinAlgMatrix [[__LinAlgMatrix_Attributes(4, 5, 4, 1, 2)]] mat2; |
| 58 | + __builtin_LinAlg_CopyConvertMatrix(mat2, mat1, true); |
| 59 | +} |
| 60 | + |
| 61 | +// --- Allowed Stages --- |
| 62 | + |
| 63 | +[shader("compute")] |
| 64 | +[numthreads(4,4,4)] |
| 65 | +void mainCS(uint ix : SV_GroupIndex, uint3 id : SV_GroupThreadID) { |
| 66 | + CallFunction(); |
| 67 | +} |
| 68 | + |
| 69 | +struct Verts { |
| 70 | + float4 position : SV_Position; |
| 71 | +}; |
| 72 | + |
| 73 | +[shader("mesh")] |
| 74 | +[NumThreads(8, 8, 2)] |
| 75 | +[OutputTopology("triangle")] |
| 76 | +void mainMeS(out vertices Verts verts[32], uint ix : SV_GroupIndex) { |
| 77 | + CallFunction(); |
| 78 | + SetMeshOutputCounts(32, 16); |
| 79 | + Verts v = {0.0, 0.0, 0.0, 0.0}; |
| 80 | + verts[ix] = v; |
| 81 | +} |
| 82 | + |
| 83 | +struct AmpPayload { |
| 84 | + float2 dummy; |
| 85 | +}; |
| 86 | + |
| 87 | +[numthreads(8, 1, 1)] |
| 88 | +[shader("amplification")] |
| 89 | +void mainAS() |
| 90 | +{ |
| 91 | + CallFunction(); |
| 92 | + AmpPayload pld; |
| 93 | + pld.dummy = float2(1.0,2.0); |
| 94 | + DispatchMesh(8, 1, 1, pld); |
| 95 | +} |
| 96 | + |
| 97 | +// --- Prohibited Stages --- |
| 98 | + |
| 99 | +[shader("pixel")] |
| 100 | +float4 mainPS(uint ix : SV_PrimitiveID) : SV_TARGET { |
| 101 | + CallFunction(); |
| 102 | + return 1.0; |
| 103 | +} |
| 104 | + |
| 105 | +[shader("vertex")] |
| 106 | +float4 mainVS(uint ix : SV_VertexID) : OUT { |
| 107 | + CallFunction(); |
| 108 | + return 1.0; |
| 109 | +} |
| 110 | + |
| 111 | +[shader("node")] |
| 112 | +[nodedispatchgrid(8,1,1)] |
| 113 | +[numthreads(64,2,2)] |
| 114 | +void mainNS() { |
| 115 | + CallFunction(); |
| 116 | +} |
| 117 | + |
| 118 | +[shader("raygeneration")] |
| 119 | +void mainRG() { |
| 120 | + CallFunction(); |
| 121 | +} |
| 122 | + |
| 123 | +[shader("intersection")] |
| 124 | +void mainIS() { |
| 125 | + CallFunction(); |
| 126 | +} |
| 127 | + |
| 128 | +struct Attribs { float2 barys; }; |
| 129 | + |
| 130 | +[shader("callable")] |
| 131 | +void mainCALL(inout Attribs attrs) { |
| 132 | + CallFunction(); |
| 133 | +} |
| 134 | + |
| 135 | +struct [raypayload] RayPayload |
| 136 | +{ |
| 137 | + float elem |
| 138 | + : write(caller,closesthit,anyhit,miss) |
| 139 | + : read(caller,closesthit,anyhit,miss); |
| 140 | +}; |
| 141 | + |
| 142 | +[shader("anyhit")] |
| 143 | +void mainAH(inout RayPayload pld, in Attribs attrs) { |
| 144 | + CallFunction(); |
| 145 | +} |
| 146 | + |
| 147 | +[shader("closesthit")] |
| 148 | +void mainCH(inout RayPayload pld, in Attribs attrs) { |
| 149 | + CallFunction(); |
| 150 | +} |
| 151 | + |
| 152 | +[shader("miss")] |
| 153 | +void mainMS(inout RayPayload pld) { |
| 154 | + CallFunction(); |
| 155 | +} |
| 156 | + |
| 157 | +struct PosStruct { |
| 158 | + float4 pos : SV_Position; |
| 159 | +}; |
| 160 | + |
| 161 | +struct PCStruct |
| 162 | +{ |
| 163 | + float Edges[3] : SV_TessFactor; |
| 164 | + float Inside : SV_InsideTessFactor; |
| 165 | + float4 test : TEST; |
| 166 | +}; |
| 167 | + |
| 168 | +PCStruct HSPatch(InputPatch<PosStruct, 3> ip, |
| 169 | + OutputPatch<PosStruct, 3> op, |
| 170 | + uint ix : SV_PrimitiveID) |
| 171 | +{ |
| 172 | + PCStruct a; |
| 173 | + a.Edges[0] = ip[0].pos.w; |
| 174 | + a.Edges[1] = ip[0].pos.w; |
| 175 | + a.Edges[2] = ip[0].pos.w; |
| 176 | + a.Inside = ip[0].pos.w; |
| 177 | + return a; |
| 178 | +} |
| 179 | + |
| 180 | +[shader("hull")] |
| 181 | +[domain("tri")] |
| 182 | +[partitioning("fractional_odd")] |
| 183 | +[outputtopology("triangle_cw")] |
| 184 | +[outputcontrolpoints(3)] |
| 185 | +[patchconstantfunc("HSPatch")] |
| 186 | +PosStruct mainHS(InputPatch<PosStruct, 3> p, uint ix : SV_OutputControlPointID) |
| 187 | +{ |
| 188 | + CallFunction(); |
| 189 | + PosStruct s; |
| 190 | + s.pos = p[ix].pos; |
| 191 | + return s; |
| 192 | +} |
| 193 | + |
| 194 | +[shader("domain")] |
| 195 | +[domain("tri")] |
| 196 | +PosStruct mainDS(const OutputPatch<PosStruct, 3> patch, |
| 197 | + uint ix : SV_PrimitiveID) |
| 198 | +{ |
| 199 | + CallFunction(); |
| 200 | + PosStruct v; |
| 201 | + v.pos = patch[0].pos; |
| 202 | + return v; |
| 203 | +} |
| 204 | + |
| 205 | +float4 a; |
| 206 | + |
| 207 | +[shader("geometry")] |
| 208 | +[maxvertexcount(1)] |
| 209 | +void mainGS(triangle float4 array[3] : SV_Position, uint ix : SV_GSInstanceID, |
| 210 | + inout PointStream<PosStruct> OutputStream) |
| 211 | +{ |
| 212 | + CallFunction(); |
| 213 | + PosStruct s; |
| 214 | + s.pos = a; |
| 215 | + OutputStream.Append(s); |
| 216 | + OutputStream.RestartStrip(); |
| 217 | +} |
0 commit comments