|
| 1 | +// RUN: %dxc -T ms_6_5 -E outie -fcgl %s -spirv | FileCheck %s |
| 2 | +// RUN: %dxc -T ms_6_5 -E innie -fcgl %s -spirv | FileCheck %s |
| 3 | + |
| 4 | +// CHECK-DAG: [[v4_n05_05_0_1:%[0-9]+]] = OpConstantComposite %v4float %float_n0_5 %float_0_5 %float_0 %float_1 |
| 5 | +// CHECK-DAG: [[v4_05_05_0_1:%[0-9]+]] = OpConstantComposite %v4float %float_0_5 %float_0_5 %float_0 %float_1 |
| 6 | +// CHECK-DAG: [[v4_0_n05_0_1:%[0-9]+]] = OpConstantComposite %v4float %float_0 %float_n0_5 %float_0 %float_1 |
| 7 | +// CHECK-DAG: [[v3_1_0_0:%[0-9]+]] = OpConstantComposite %v3float %float_1 %float_0 %float_0 |
| 8 | +// CHECK-DAG: [[v3_0_1_0:%[0-9]+]] = OpConstantComposite %v3float %float_0 %float_1 %float_0 |
| 9 | +// CHECK-DAG: [[v3_0_0_1:%[0-9]+]] = OpConstantComposite %v3float %float_0 %float_0 %float_1 |
| 10 | +// CHECK-DAG: [[u3_0_1_2:%[0-9]+]] = OpConstantComposite %v3uint %uint_0 %uint_1 %uint_2 |
| 11 | + |
| 12 | +// CHECK-DAG: OpDecorate [[indices:%[0-9]+]] BuiltIn PrimitiveIndicesNV |
| 13 | + |
| 14 | +struct MeshOutput { |
| 15 | + float4 position : SV_Position; |
| 16 | + float3 color : COLOR0; |
| 17 | +}; |
| 18 | + |
| 19 | +[outputtopology("triangle")] |
| 20 | +[numthreads(1, 1, 1)] |
| 21 | +void innie(out indices uint3 triangles[1], out vertices MeshOutput verts[3]) { |
| 22 | + SetMeshOutputCounts(3, 2); |
| 23 | + |
| 24 | + triangles[0] = uint3(0, 1, 2); |
| 25 | +// CHECK: [[off:%[0-9]+]] = OpIMul %uint %uint_0 %uint_3 |
| 26 | +// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Output_uint [[indices]] [[off]] |
| 27 | +// CHECK: [[tmp:%[0-9]+]] = OpCompositeExtract %uint [[u3_0_1_2]] 0 |
| 28 | +// CHECK: OpStore [[ptr]] [[tmp]] |
| 29 | +// CHECK: [[idx:%[0-9]+]] = OpIAdd %uint [[off]] %uint_1 |
| 30 | +// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Output_uint [[indices]] [[idx]] |
| 31 | +// CHECK: [[tmp:%[0-9]+]] = OpCompositeExtract %uint [[u3_0_1_2]] 1 |
| 32 | +// CHECK: OpStore [[ptr]] [[tmp]] |
| 33 | +// CHECK: [[idx:%[0-9]+]] = OpIAdd %uint [[off]] %uint_2 |
| 34 | +// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Output_uint [[indices]] [[idx]] |
| 35 | +// CHECK: [[tmp:%[0-9]+]] = OpCompositeExtract %uint [[u3_0_1_2]] 2 |
| 36 | +// CHECK: OpStore [[ptr]] [[tmp]] |
| 37 | + |
| 38 | + verts[0].position = float4(-0.5, 0.5, 0.0, 1.0); |
| 39 | +// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Output_v4float %gl_Position %int_0 |
| 40 | +// CHECK: OpStore [[ptr]] [[v4_n05_05_0_1]] |
| 41 | + verts[0].color = float3(1.0, 0.0, 0.0); |
| 42 | +// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Output_v3float %out_var_COLOR0 %int_0 |
| 43 | +// CHECK: OpStore [[ptr]] [[v3_1_0_0]] |
| 44 | + |
| 45 | + verts[1].position = float4(0.5, 0.5, 0.0, 1.0); |
| 46 | +// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Output_v4float %gl_Position %int_1 |
| 47 | +// CHECK: OpStore [[ptr]] [[v4_05_05_0_1]] |
| 48 | + verts[1].color = float3(0.0, 1.0, 0.0); |
| 49 | +// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Output_v3float %out_var_COLOR0 %int_1 |
| 50 | +// CHECK: OpStore [[ptr]] [[v3_0_1_0]] |
| 51 | + |
| 52 | + verts[2].position = float4(0.0, -0.5, 0.0, 1.0); |
| 53 | +// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Output_v4float %gl_Position %int_2 |
| 54 | +// CHECK: OpStore [[ptr]] [[v4_0_n05_0_1]] |
| 55 | + verts[2].color = float3(0.0, 0.0, 1.0); |
| 56 | +// CHECK: [[ptr:%[0-9]+]] = OpAccessChain %_ptr_Output_v3float %out_var_COLOR0 %int_2 |
| 57 | +// CHECK: OpStore [[ptr]] [[v3_0_0_1]] |
| 58 | + |
| 59 | +} |
| 60 | + |
| 61 | +[outputtopology("triangle")] |
| 62 | +[numthreads(1, 1, 1)] |
| 63 | +void outie(out indices uint3 triangles[1], out vertices MeshOutput verts[3]) { |
| 64 | + innie(triangles, verts); |
| 65 | +} |
0 commit comments