@@ -456,3 +456,49 @@ TEST_F(NegativeShaderPushConstants, MultipleEntryPoint) {
456
456
pipe.InitState ();
457
457
pipe.CreateGraphicsPipeline ();
458
458
}
459
+
460
+ // This is not working because of a bug in the Spec Constant logic
461
+ // https://github.com/KhronosGroup/Vulkan-ValidationLayers/issues/5911
462
+ TEST_F (NegativeShaderPushConstants, DISABLED_SpecConstantSize) {
463
+ TEST_DESCRIPTION (" Use SpecConstant to adjust size of Push Constant Block" );
464
+ ASSERT_NO_FATAL_FAILURE (Init ());
465
+
466
+ const char *cs_source = R"glsl(
467
+ #version 460
468
+ layout (constant_id = 0) const int my_array_size = 1;
469
+ layout (push_constant) uniform my_buf {
470
+ float my_array[my_array_size];
471
+ } pc;
472
+
473
+ void main() {
474
+ float a = pc.my_array[0];
475
+ }
476
+ )glsl" ;
477
+
478
+ uint32_t data = 32 ;
479
+
480
+ VkSpecializationMapEntry entry;
481
+ entry.constantID = 0 ;
482
+ entry.offset = 0 ;
483
+ entry.size = sizeof (uint32_t );
484
+
485
+ VkSpecializationInfo specialization_info = {};
486
+ specialization_info.mapEntryCount = 1 ;
487
+ specialization_info.pMapEntries = &entry;
488
+ specialization_info.dataSize = sizeof (uint32_t );
489
+ specialization_info.pData = &data;
490
+
491
+ // With spec constant set, this should be 32, not 16
492
+ VkPushConstantRange push_constant_range = {VK_SHADER_STAGE_COMPUTE_BIT, 0 , 16 };
493
+ const VkPipelineLayoutObj pipeline_layout (m_device, {}, {push_constant_range});
494
+
495
+ CreateComputePipelineHelper pipe (*this );
496
+ pipe.InitInfo ();
497
+ pipe.cs_ .reset (
498
+ new VkShaderObj (this , cs_source, VK_SHADER_STAGE_COMPUTE_BIT, SPV_ENV_VULKAN_1_0, SPV_SOURCE_GLSL, &specialization_info));
499
+ pipe.InitState ();
500
+ pipe.pipeline_layout_ = VkPipelineLayoutObj (m_device, {}, {push_constant_range});
501
+ m_errorMonitor->SetDesiredFailureMsg (VK_DEBUG_REPORT_ERROR_BIT_EXT, " VUID-VkComputePipelineCreateInfo-layout-07987" );
502
+ pipe.CreateComputePipeline ();
503
+ m_errorMonitor->VerifyFound ();
504
+ }
0 commit comments