@@ -10364,6 +10364,79 @@ OpFunctionEnd
10364
10364
HasSubstr (" member 0 is missing an Offset decoration" ));
10365
10365
}
10366
10366
10367
+ TEST_F (ValidateDecorations, ComponentMultipleArrays) {
10368
+ const std::string spirv = R"(
10369
+ OpCapability Tessellation
10370
+ %1 = OpExtInstImport "GLSL.std.450"
10371
+ OpMemoryModel Logical GLSL450
10372
+ OpEntryPoint TessellationEvaluation %main "main" %_ %FOO %FOO0
10373
+ OpExecutionMode %main Triangles
10374
+ OpExecutionMode %main SpacingEqual
10375
+ OpExecutionMode %main VertexOrderCcw
10376
+ OpSource GLSL 460
10377
+ OpSourceExtension "GL_EXT_nonuniform_qualifier"
10378
+ OpName %main "main"
10379
+ OpName %gl_PerVertex "gl_PerVertex"
10380
+ OpMemberName %gl_PerVertex 0 "gl_Position"
10381
+ OpMemberName %gl_PerVertex 1 "gl_PointSize"
10382
+ OpMemberName %gl_PerVertex 2 "gl_ClipDistance"
10383
+ OpMemberName %gl_PerVertex 3 "gl_CullDistance"
10384
+ OpName %_ ""
10385
+ OpName %FOO "FOO"
10386
+ OpMemberDecorate %gl_PerVertex 0 BuiltIn Position
10387
+ OpMemberDecorate %gl_PerVertex 1 BuiltIn PointSize
10388
+ OpMemberDecorate %gl_PerVertex 2 BuiltIn ClipDistance
10389
+ OpMemberDecorate %gl_PerVertex 3 BuiltIn CullDistance
10390
+ OpDecorate %gl_PerVertex Block
10391
+ OpDecorate %FOO Component 2
10392
+ OpDecorate %FOO Location 1
10393
+ OpDecorate %FOO0 Location 1
10394
+ OpDecorate %FOO0 Component 0
10395
+ %void = OpTypeVoid
10396
+ %3 = OpTypeFunction %void
10397
+ %float = OpTypeFloat 32
10398
+ %v4float = OpTypeVector %float 4
10399
+ %uint = OpTypeInt 32 0
10400
+ %uint_1 = OpConstant %uint 1
10401
+ %_arr_float_uint_1 = OpTypeArray %float %uint_1
10402
+ %gl_PerVertex = OpTypeStruct %v4float %float %_arr_float_uint_1 %_arr_float_uint_1
10403
+ %_ptr_Output_gl_PerVertex = OpTypePointer Output %gl_PerVertex
10404
+ %_ = OpVariable %_ptr_Output_gl_PerVertex Output
10405
+ %int = OpTypeInt 32 1
10406
+ %int_0 = OpConstant %int 0
10407
+ %v2float = OpTypeVector %float 2
10408
+ %uint_2 = OpConstant %uint 2
10409
+ %_arr_v2float_uint_2 = OpTypeArray %v2float %uint_2
10410
+ %uint_32 = OpConstant %uint 32
10411
+ %_arr__arr_v2float_uint_2_uint_32 = OpTypeArray %_arr_v2float_uint_2 %uint_32
10412
+ %_ptr_Input__arr__arr_v2float_uint_2_uint_32 = OpTypePointer Input %_arr__arr_v2float_uint_2_uint_32
10413
+ %FOO = OpVariable %_ptr_Input__arr__arr_v2float_uint_2_uint_32 Input
10414
+ %FOO0 = OpVariable %_ptr_Input__arr__arr_v2float_uint_2_uint_32 Input
10415
+ %_ptr_Input_v2float = OpTypePointer Input %v2float
10416
+ %int_1 = OpConstant %int 1
10417
+ %uint_0 = OpConstant %uint 0
10418
+ %_ptr_Output_float = OpTypePointer Output %float
10419
+ %main = OpFunction %void None %3
10420
+ %5 = OpLabel
10421
+ %24 = OpAccessChain %_ptr_Input_v2float %FOO %int_0 %int_0
10422
+ %25 = OpLoad %v2float %24
10423
+ %27 = OpAccessChain %_ptr_Input_v2float %FOO0 %int_1 %int_1
10424
+ %28 = OpLoad %v2float %27
10425
+ %29 = OpFAdd %v2float %25 %28
10426
+ %32 = OpAccessChain %_ptr_Output_float %_ %int_0 %uint_0
10427
+ %33 = OpCompositeExtract %float %29 0
10428
+ OpStore %32 %33
10429
+ %34 = OpAccessChain %_ptr_Output_float %_ %int_0 %uint_1
10430
+ %35 = OpCompositeExtract %float %29 1
10431
+ OpStore %34 %35
10432
+ OpReturn
10433
+ OpFunctionEnd
10434
+ )" ;
10435
+
10436
+ CompileSuccessfully (spirv, SPV_ENV_VULKAN_1_0);
10437
+ EXPECT_EQ (SPV_SUCCESS, ValidateInstructions (SPV_ENV_VULKAN_1_0));
10438
+ }
10439
+
10367
10440
} // namespace
10368
10441
} // namespace val
10369
10442
} // namespace spvtools
0 commit comments