MCPcopy Create free account
hub / github.com/KhronosGroup/Vulkan-ValidationLayers / TEST_F

Function TEST_F

tests/unit/gpu_av_descriptor_buffer.cpp:21–71  ·  view source on GitHub ↗

TODO - Add support in GPU-AV for this

Source from the content-addressed store, hash-verified

19
20// TODO - Add support in GPU-AV for this
21TEST_F(NegativeGpuAVDescriptorBuffer, DISABLED_BasicNoDescriptor) {
22 TEST_DESCRIPTION("Never even call vkGetDescriptorEXT and try to access something");
23 RETURN_IF_SKIP(InitBasicDescriptorBuffer({}));
24
25 const char* cs_source = R"glsl(
26 #version 450
27 layout (set = 0, binding = 0) buffer SSBO_0 {
28 uint a;
29 };
30
31 void main() {
32 a = 0;
33 }
34 )glsl";
35
36 VkDescriptorSetLayoutBinding binding = {0, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, 1, VK_SHADER_STAGE_ALL, nullptr};
37 vkt::DescriptorSetLayout ds_layout(*m_device, binding, VK_DESCRIPTOR_SET_LAYOUT_CREATE_DESCRIPTOR_BUFFER_BIT_EXT);
38 vkt::PipelineLayout pipeline_layout(*m_device, {&ds_layout});
39
40 CreateComputePipelineHelper pipe(*this);
41 pipe.cs_ = VkShaderObj(*m_device, cs_source, VK_SHADER_STAGE_COMPUTE_BIT, SPV_ENV_VULKAN_1_2);
42 pipe.cp_ci_.flags |= VK_PIPELINE_CREATE_DESCRIPTOR_BUFFER_BIT_EXT;
43 pipe.cp_ci_.layout = pipeline_layout;
44 pipe.CreateComputePipeline();
45
46 VkMemoryAllocateFlagsInfo allocate_flag_info = vku::InitStructHelper();
47 allocate_flag_info.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT;
48 vkt::Buffer descriptor_buffer(*m_device, 1024,
49 VK_BUFFER_USAGE_TRANSFER_DST_BIT | VK_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT |
50 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
51 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT, &allocate_flag_info);
52
53 m_command_buffer.Begin();
54 vk::CmdBindPipeline(m_command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipe);
55
56 VkDeviceSize buffer_address = Align(descriptor_buffer.Address(), descriptor_buffer_properties.descriptorBufferOffsetAlignment);
57
58 VkDescriptorBufferBindingInfoEXT descriptor_buffer_binding_info = vku::InitStructHelper();
59 descriptor_buffer_binding_info.address = buffer_address;
60 descriptor_buffer_binding_info.usage = VK_BUFFER_USAGE_RESOURCE_DESCRIPTOR_BUFFER_BIT_EXT;
61 vk::CmdBindDescriptorBuffersEXT(m_command_buffer, 1, &descriptor_buffer_binding_info);
62
63 uint32_t buffer_index = 0;
64 VkDeviceSize buffer_offset = 0;
65 vk::CmdSetDescriptorBufferOffsetsEXT(m_command_buffer, VK_PIPELINE_BIND_POINT_COMPUTE, pipeline_layout, 0, 1, &buffer_index,
66 &buffer_offset);
67 vk::CmdDispatch(m_command_buffer, 1, 1, 1);
68 m_command_buffer.End();
69
70 m_default_queue->SubmitAndWait(m_command_buffer);
71}
72
73// TODO - Add support in GPU-AV for this
74TEST_F(NegativeGpuAVDescriptorBuffer, DISABLED_BasicDescriptorWrongAddress) {

Callers

nothing calls this directly

Calls 15

VkShaderObjClass · 0.85
CmdBindPipelineFunction · 0.85
CmdDispatchFunction · 0.85
GetDescriptorEXTFunction · 0.85
CmdCopyBufferFunction · 0.85
CmdDrawFunction · 0.85
CreateComputePipelineMethod · 0.80
SubmitAndWaitMethod · 0.80
FullMemoryBarrierMethod · 0.80
SetLayoutMethod · 0.80

Tested by

no test coverage detected