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

Method Init

layers/utils/descriptor_utils.cpp:305–363  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303}
304
305void CachedDescriptorSize::Init(const vvl::DeviceState& device_state) {
306 const VkPhysicalDevice gpu = device_state.physical_device;
307 if (IsExtEnabled(device_state.extensions.vk_ext_descriptor_heap)) {
308 heap_size_[0] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_SAMPLER);
309 heap_size_[2] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE);
310 heap_size_[3] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_STORAGE_IMAGE);
311 heap_size_[4] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER);
312 heap_size_[5] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER);
313 heap_size_[6] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER);
314 heap_size_[7] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_STORAGE_BUFFER);
315 heap_size_[10] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT);
316 if (IsExtEnabled(device_state.extensions.vk_khr_acceleration_structure)) {
317 heap_size_[1] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR);
318 } else {
319 heap_size_[1] = 0;
320 }
321 if (IsExtEnabled(device_state.extensions.vk_nv_ray_tracing)) {
322 heap_size_[8] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV);
323 } else {
324 heap_size_[8] = 0;
325 }
326 if (IsExtEnabled(device_state.extensions.vk_nv_partitioned_acceleration_structure)) {
327 heap_size_[9] =
328 DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_PARTITIONED_ACCELERATION_STRUCTURE_NV);
329 } else {
330 heap_size_[9] = 0;
331 }
332 if (IsExtEnabled(device_state.extensions.vk_arm_tensors)) {
333 heap_size_[11] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_TENSOR_ARM);
334 } else {
335 heap_size_[11] = 0;
336 }
337 if (IsExtEnabled(device_state.extensions.vk_qcom_image_processing)) {
338 heap_size_[12] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_SAMPLE_WEIGHT_IMAGE_QCOM);
339 heap_size_[13] = DispatchGetPhysicalDeviceDescriptorSizeEXT(gpu, VK_DESCRIPTOR_TYPE_BLOCK_MATCH_IMAGE_QCOM);
340 } else {
341 heap_size_[12] = 0;
342 heap_size_[13] = 0;
343 }
344 }
345 if (IsExtEnabled(device_state.extensions.vk_ext_descriptor_buffer)) {
346 const VkPhysicalDeviceDescriptorBufferPropertiesEXT& props = device_state.phys_dev_ext_props.descriptor_buffer_props;
347 const bool robust = device_state.enabled_features.robustBufferAccess;
348 buffer_size_[0] = props.samplerDescriptorSize;
349 buffer_size_[1] = props.accelerationStructureDescriptorSize;
350 buffer_size_[2] = props.sampledImageDescriptorSize;
351 buffer_size_[3] = props.storageImageDescriptorSize;
352 buffer_size_[4] = robust ? props.robustUniformTexelBufferDescriptorSize : props.uniformTexelBufferDescriptorSize;
353 buffer_size_[5] = robust ? props.robustStorageTexelBufferDescriptorSize : props.storageTexelBufferDescriptorSize;
354 buffer_size_[6] = robust ? props.robustUniformBufferDescriptorSize : props.uniformBufferDescriptorSize;
355 buffer_size_[7] = robust ? props.robustStorageBufferDescriptorSize : props.storageBufferDescriptorSize;
356 buffer_size_[8] = 0; // nv as
357 buffer_size_[9] = 0; // nv partitioned as
358 buffer_size_[10] = props.inputAttachmentDescriptorSize;
359 buffer_size_[11] = 0; // arm tensor
360 buffer_size_[12] = 0; // qcom sample weight
361 buffer_size_[13] = 0; // qcom block match
362 }

Callers 2

InitCountersFunction · 0.45
InitCountersFunction · 0.45

Calls 2

IsExtEnabledFunction · 0.85

Tested by

no test coverage detected