@@ -1422,4 +1422,65 @@ TEST_F(PositiveShaderInterface, MultipleFragmentAttachment) {
1422
1422
pipe.cb_ci_ .pAttachments = cb_as;
1423
1423
pipe.gp_ci_ .renderPass = rp.Handle ();
1424
1424
pipe.CreateGraphicsPipeline ();
1425
+ }
1426
+
1427
+ TEST_F (PositiveShaderInterface, MissingInputAttachmentIndex) {
1428
+ TEST_DESCRIPTION (" You don't need InputAttachmentIndexif using dynamicRenderingLocalRead" );
1429
+ SetTargetApiVersion (VK_API_VERSION_1_2);
1430
+ AddRequiredExtensions (VK_KHR_DYNAMIC_RENDERING_EXTENSION_NAME);
1431
+ AddRequiredExtensions (VK_KHR_DYNAMIC_RENDERING_LOCAL_READ_EXTENSION_NAME);
1432
+ AddRequiredFeature (vkt::Feature::dynamicRendering);
1433
+ AddRequiredFeature (vkt::Feature::dynamicRenderingLocalRead);
1434
+ RETURN_IF_SKIP (Init ());
1435
+ InitRenderTarget ();
1436
+
1437
+ // layout(input_attachment_index=0, set=0, binding=0) uniform subpassInput xs[1];
1438
+ // layout(location=0) out vec4 color;
1439
+ // void main() {
1440
+ // color = subpassLoad(xs[0]);
1441
+ // }
1442
+ //
1443
+ // missing OpDecorate %xs InputAttachmentIndex 0
1444
+ const char *fsSource = R"(
1445
+ OpCapability Shader
1446
+ OpCapability InputAttachment
1447
+ OpMemoryModel Logical GLSL450
1448
+ OpEntryPoint Fragment %main "main" %color %xs
1449
+ OpExecutionMode %main OriginUpperLeft
1450
+ OpDecorate %color Location 0
1451
+ OpDecorate %xs DescriptorSet 0
1452
+ OpDecorate %xs Binding 0
1453
+ %void = OpTypeVoid
1454
+ %3 = OpTypeFunction %void
1455
+ %float = OpTypeFloat 32
1456
+ %v4float = OpTypeVector %float 4
1457
+ %_ptr_Output_v4float = OpTypePointer Output %v4float
1458
+ %color = OpVariable %_ptr_Output_v4float Output
1459
+ %10 = OpTypeImage %float SubpassData 0 0 0 2 Unknown
1460
+ %uint = OpTypeInt 32 0
1461
+ %uint_1 = OpConstant %uint 1
1462
+ %_arr_10_uint_1 = OpTypeArray %10 %uint_1
1463
+ %_ptr_UniformConstant__arr_10_uint_1 = OpTypePointer UniformConstant %_arr_10_uint_1
1464
+ %xs = OpVariable %_ptr_UniformConstant__arr_10_uint_1 UniformConstant
1465
+ %int = OpTypeInt 32 1
1466
+ %int_0 = OpConstant %int 0
1467
+ %_ptr_UniformConstant_10 = OpTypePointer UniformConstant %10
1468
+ %v2int = OpTypeVector %int 2
1469
+ %22 = OpConstantComposite %v2int %int_0 %int_0
1470
+ %main = OpFunction %void None %3
1471
+ %5 = OpLabel
1472
+ %19 = OpAccessChain %_ptr_UniformConstant_10 %xs %int_0
1473
+ %20 = OpLoad %10 %19
1474
+ %23 = OpImageRead %v4float %20 %22
1475
+ OpStore %color %23
1476
+ OpReturn
1477
+ OpFunctionEnd
1478
+ )" ;
1479
+
1480
+ VkShaderObj fs (this , fsSource, VK_SHADER_STAGE_FRAGMENT_BIT, SPV_ENV_VULKAN_1_2, SPV_SOURCE_ASM);
1481
+
1482
+ CreatePipelineHelper pipe (*this );
1483
+ pipe.shader_stages_ = {pipe.vs_ ->GetStageCreateInfo (), fs.GetStageCreateInfo ()};
1484
+ pipe.dsl_bindings_ = {{0 , VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, 1 , VK_SHADER_STAGE_FRAGMENT_BIT, nullptr }};
1485
+ pipe.CreateGraphicsPipeline ();
1425
1486
}
0 commit comments