MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Compile

Method Compile

Source/Engine/GraphicsDevice/Vulkan/DescriptorSetVulkan.cpp:68–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

66}
67
68void DescriptorSetLayoutVulkan::Compile()
69{
70#if !BUILD_RELEASE
71 ASSERT(Handles.IsEmpty());
72 const VkPhysicalDeviceLimits& limits = Device->PhysicalDeviceLimits;
73 ASSERT(LayoutTypes[VK_DESCRIPTOR_TYPE_SAMPLER] + LayoutTypes[VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER] < limits.maxDescriptorSetSamplers);
74 ASSERT(LayoutTypes[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER]+ LayoutTypes[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC] < limits.maxDescriptorSetUniformBuffers);
75 ASSERT(LayoutTypes[VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC] < limits.maxDescriptorSetUniformBuffersDynamic);
76 ASSERT(LayoutTypes[VK_DESCRIPTOR_TYPE_STORAGE_BUFFER] + LayoutTypes[VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC] < limits.maxDescriptorSetStorageBuffers);
77 ASSERT(LayoutTypes[VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC] < limits.maxDescriptorSetStorageBuffersDynamic);
78 ASSERT(LayoutTypes[VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER] + LayoutTypes[VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE] + LayoutTypes[VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER] < limits.maxDescriptorSetSampledImages);
79 ASSERT(LayoutTypes[VK_DESCRIPTOR_TYPE_STORAGE_IMAGE] + LayoutTypes[VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER]< limits.maxDescriptorSetStorageImages);
80#endif
81
82 Handles.Resize(SetLayouts.Count());
83 for (int32 i = 0; i < SetLayouts.Count(); i++)
84 {
85 auto& layout = SetLayouts.Get()[i];
86 VkDescriptorSetLayoutCreateInfo layoutInfo;
87 RenderToolsVulkan::ZeroStruct(layoutInfo, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO);
88 layoutInfo.bindingCount = layout.LayoutBindings.Count();
89 layoutInfo.pBindings = layout.LayoutBindings.Get();
90 VALIDATE_VULKAN_RESULT(vkCreateDescriptorSetLayout(Device->Device, &layoutInfo, nullptr, &Handles[i]));
91 }
92
93#if VULKAN_HASH_POOLS_WITH_LAYOUT_TYPES
94 if (SetLayoutsHash == 0)
95 SetLayoutsHash = Crc::MemCrc32(LayoutTypes, sizeof(LayoutTypes));
96#endif
97
98 RenderToolsVulkan::ZeroStruct(AllocateInfo, VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO);
99 AllocateInfo.descriptorSetCount = Handles.Count();
100 AllocateInfo.pSetLayouts = Handles.Get();
101}
102
103DescriptorPoolVulkan::DescriptorPoolVulkan(GPUDeviceVulkan* device, const DescriptorSetLayoutVulkan& layout)
104 : _device(device)

Callers 1

PipelineLayoutVulkanMethod · 0.45

Calls 4

IsEmptyMethod · 0.45
ResizeMethod · 0.45
CountMethod · 0.45
GetMethod · 0.45

Tested by

no test coverage detected