Skip to content

Commit 2595d60

Browse files
committed
tests: vkCmdPushDescriptorSet2 with dynamic pipeline layout
1 parent 5800ffe commit 2595d60

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

tests/unit/push_descriptor_positive.cpp

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,4 +537,52 @@ TEST_F(PositivePushDescriptor, SamplerPushDescriptorWithImmutableSampler) {
537537
m_command_buffer.Begin();
538538
vk::CmdPushDescriptorSetKHR(m_command_buffer, VK_PIPELINE_BIND_POINT_GRAPHICS, pipeline_layout, 0u, 2u, write_sets);
539539
m_command_buffer.End();
540-
}
540+
}
541+
542+
TEST_F(PositivePushDescriptor, PushDescriptorSetInfo) {
543+
SetTargetApiVersion(VK_API_VERSION_1_1);
544+
AddRequiredExtensions(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME);
545+
AddRequiredExtensions(VK_KHR_MAINTENANCE_6_EXTENSION_NAME);
546+
//AddRequiredExtensions(VK_NV_PER_STAGE_DESCRIPTOR_SET_EXTENSION_NAME);
547+
//AddRequiredFeature(vkt::Feature::dynamicPipelineLayout);
548+
RETURN_IF_SKIP(Init());
549+
550+
vkt::Buffer buffer(*m_device, 256u, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT);
551+
552+
VkDescriptorSetLayoutBinding dsl_binding;
553+
dsl_binding.binding = 0u;
554+
dsl_binding.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
555+
dsl_binding.descriptorCount = 1u;
556+
dsl_binding.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
557+
dsl_binding.pImmutableSamplers = nullptr;
558+
559+
const vkt::DescriptorSetLayout push_ds_layout(*m_device, {dsl_binding}, VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT);
560+
561+
VkDescriptorBufferInfo descriptor_buffer_info;
562+
descriptor_buffer_info.buffer = buffer;
563+
descriptor_buffer_info.offset = 0u;
564+
descriptor_buffer_info.range = VK_WHOLE_SIZE;
565+
566+
VkWriteDescriptorSet descriptor_write = vku::InitStructHelper();
567+
descriptor_write.dstSet = 0u;
568+
descriptor_write.dstBinding = 0u;
569+
descriptor_write.dstArrayElement = 0u;
570+
descriptor_write.descriptorCount = 1u;
571+
descriptor_write.descriptorType = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER;
572+
descriptor_write.pBufferInfo = &descriptor_buffer_info;
573+
574+
VkPipelineLayoutCreateInfo pipeline_layout_ci = vku::InitStructHelper();
575+
pipeline_layout_ci.setLayoutCount = 1u;
576+
pipeline_layout_ci.pSetLayouts = &push_ds_layout.handle();
577+
578+
VkPushDescriptorSetInfo push_descriptor_set_info = vku::InitStructHelper(&pipeline_layout_ci);
579+
push_descriptor_set_info.stageFlags = VK_SHADER_STAGE_COMPUTE_BIT;
580+
push_descriptor_set_info.layout = VK_NULL_HANDLE;
581+
push_descriptor_set_info.set = 0u;
582+
push_descriptor_set_info.descriptorWriteCount = 1u;
583+
push_descriptor_set_info.pDescriptorWrites = &descriptor_write;
584+
585+
m_command_buffer.Begin();
586+
vk::CmdPushDescriptorSet2KHR(m_command_buffer, &push_descriptor_set_info);
587+
m_command_buffer.End();
588+
}

0 commit comments

Comments
 (0)