SpiecsEngine
 
Loading...
Searching...
No Matches

◆ IsFeatureMeetDemand()

bool Spices::VulkanDevice::IsFeatureMeetDemand ( const VkPhysicalDevice & device)
private

Check all Feature we need meet.

Parameters
[in]deviceVkPhysicalDevice.
Returns
Returns true if all Feature we need meet.

Create the feature chain.

Get all Features that supported.

@Fetch all features.

Just return true for we do not need a specific feature supported now.

Todo
Configurable.

Create the feature chain.

Get all Features that supported.

@Fetch all features.

Just return true for we do not need a specific feature supported now.

Todo
Configurable.

Definition at line 409 of file VulkanDevice.cpp.

410 {
412
416 VkPhysicalDeviceRobustness2FeaturesEXT robustness2{};
417 robustness2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT;
418 robustness2.pNext = nullptr;
419
420 VkPhysicalDeviceHostImageCopyFeaturesEXT hostImageCopyFeature{};
421 hostImageCopyFeature.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_IMAGE_COPY_FEATURES_EXT;
422 hostImageCopyFeature.pNext = &robustness2;
423
424 VkPhysicalDeviceTimelineSemaphoreFeatures timelineSemaphore{};
425 timelineSemaphore.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES;
426 timelineSemaphore.pNext = &hostImageCopyFeature;
427
428 VkPhysicalDeviceFragmentShaderBarycentricFeaturesKHR fragShaderBarycentric{};
429 fragShaderBarycentric.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_KHR;
430 fragShaderBarycentric.pNext = &timelineSemaphore;
431
432 VkPhysicalDeviceDiagnosticsConfigFeaturesNV diagnosticsConfig{};
433 diagnosticsConfig.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV;
434 diagnosticsConfig.pNext = &fragShaderBarycentric;
435
436 VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV dgcFeatures{};
437 dgcFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV;
438 dgcFeatures.pNext = &diagnosticsConfig;
439
440 VkPhysicalDeviceVulkan13Features vk13Frature{};
441 vk13Frature.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
442 vk13Frature.pNext = &dgcFeatures;
443
444 VkPhysicalDeviceFragmentShadingRateFeaturesKHR fragShadingRateFeature {};
445 fragShadingRateFeature.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR;
446 fragShadingRateFeature.pNext = &vk13Frature;
447
448 VkPhysicalDeviceMultiviewFeatures multiviewFeatures {};
449 multiviewFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES;
450 multiviewFeatures.pNext = &fragShadingRateFeature;
451
452 VkPhysicalDeviceMeshShaderFeaturesEXT meshShaderFeatures {};
453 meshShaderFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_EXT;
454 meshShaderFeatures.pNext = &multiviewFeatures;
455
456 VkPhysicalDeviceShaderClockFeaturesKHR shaderClockFeatures{};
457 shaderClockFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR;
458 shaderClockFeatures.pNext = &meshShaderFeatures;
459
460 VkPhysicalDeviceScalarBlockLayoutFeatures layoutFeatures {};
461 layoutFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES;
462 layoutFeatures.pNext = &shaderClockFeatures;
463
464 VkPhysicalDeviceHostQueryResetFeatures hostQueryResetFeatures {};
465 hostQueryResetFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES;
466 hostQueryResetFeatures.pNext = &layoutFeatures;
467
468 VkPhysicalDeviceRayQueryFeaturesKHR rayQueryFeatures {};
469 rayQueryFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR;
470 rayQueryFeatures.pNext = &hostQueryResetFeatures;
471
472 VkPhysicalDeviceRayTracingPipelineFeaturesKHR rayTracingFeatures {};
473 rayTracingFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR;
474 rayTracingFeatures.pNext = &rayQueryFeatures;
475
476 VkPhysicalDeviceAccelerationStructureFeaturesKHR accelerationStructureFeatures {};
477 accelerationStructureFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR;
478 accelerationStructureFeatures.pNext = &rayTracingFeatures;
479
480 VkPhysicalDeviceDescriptorIndexingFeatures descriptorIndexingFeatures {};
481 descriptorIndexingFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES;
482 descriptorIndexingFeatures.pNext = &accelerationStructureFeatures;
483
484 VkPhysicalDeviceBufferDeviceAddressFeatures bufferDeviceAddressFeatures {};
485 bufferDeviceAddressFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES;
486 bufferDeviceAddressFeatures.pNext = &descriptorIndexingFeatures;
487
491 VkPhysicalDeviceFeatures2 deviceFeatures {};
492 deviceFeatures.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
493 deviceFeatures.pNext = &bufferDeviceAddressFeatures;
494
498 vkGetPhysicalDeviceFeatures2(device, &deviceFeatures);
499 m_DeviceFeatures = deviceFeatures.features;
500
505 ASSERT(deviceFeatures.features.samplerAnisotropy) /* @brief Enable samplerAnisotropy. */
506 ASSERT(deviceFeatures.features.sampleRateShading) /* @brief Enable sampleRateShading, for MSAA. */
507 ASSERT(deviceFeatures.features.independentBlend) /* @brief Enable Independent Attachment AlphaBlend State. */
508 ASSERT(deviceFeatures.features.geometryShader) /* @brief Enable Geometry Shader Feature. */
509 ASSERT(bufferDeviceAddressFeatures.bufferDeviceAddress) /* @brief Enable Buffer Address Feature. */
510 ASSERT(bufferDeviceAddressFeatures.bufferDeviceAddressCaptureReplay) /* @brief Enable Buffer Address Capture Feature. */
511 ASSERT(accelerationStructureFeatures.accelerationStructure) /* @brief Enable RayTracing AccelerationStructure. */
512 ASSERT(rayTracingFeatures.rayTracingPipeline) /* @brief Enable RayTracing Pipeline. */
513 ASSERT(rayQueryFeatures.rayQuery) /* @brief Enable RayTracing Query Feature. */
514 ASSERT(hostQueryResetFeatures.hostQueryReset) /* @brief Enable HostQueryReset Feature. */
515 ASSERT(layoutFeatures.scalarBlockLayout) /* @brief Enable Shader ScalarBlockLayout Feature. */
516
517 ASSERT(descriptorIndexingFeatures.shaderSampledImageArrayNonUniformIndexing) /* @brief Enable Shader shaderSampledImageArrayNonUniformIndexing Feature. */
518 ASSERT(descriptorIndexingFeatures.descriptorBindingSampledImageUpdateAfterBind) /* @brief Enable Shader descriptorBindingSampledImageUpdateAfterBind Feature. */
519 ASSERT(descriptorIndexingFeatures.shaderUniformBufferArrayNonUniformIndexing) /* @brief Enable Shader shaderUniformBufferArrayNonUniformIndexing Feature. */
520 ASSERT(descriptorIndexingFeatures.descriptorBindingUniformBufferUpdateAfterBind) /* @brief Enable Shader descriptorBindingUniformBufferUpdateAfterBind Feature. */
521 ASSERT(descriptorIndexingFeatures.shaderStorageBufferArrayNonUniformIndexing) /* @brief Enable Shader shaderStorageBufferArrayNonUniformIndexing Feature. */
522 ASSERT(descriptorIndexingFeatures.descriptorBindingStorageBufferUpdateAfterBind) /* @brief Enable Shader descriptorBindingStorageBufferUpdateAfterBind Feature. */
523 ASSERT(descriptorIndexingFeatures.descriptorBindingPartiallyBound) /* @brief Enable descriptorBindingPartiallyBound Feature. */
524 ASSERT(descriptorIndexingFeatures.runtimeDescriptorArray) /* @brief Enable runtimeDescriptorArray Feature. */
525
526 ASSERT(shaderClockFeatures.shaderSubgroupClock) /* @brief Enable Shader clock time Feature. */
527
528 ASSERT(meshShaderFeatures.meshShader) /* @brief Enable Mesh Shader Feature. */
529 ASSERT(meshShaderFeatures.taskShader) /* @brief Enable Task Shader Feature. */
530
531 ASSERT(multiviewFeatures.multiview) /* @brief Enable Multiview Feature. */
532 ASSERT(fragShadingRateFeature.pipelineFragmentShadingRate) /* @brief Enable pipelineFragmentShadingRate Feature. */
533 ASSERT(vk13Frature.maintenance4) /* @brief Enable maintenance4 Feature. */
534
535 ASSERT(dgcFeatures.deviceGeneratedCommands) /* @brief Enable Nvidia GPU Generate Commands Feature. */
536
537 ASSERT(diagnosticsConfig.diagnosticsConfig) /* @brief Enable Nvidia GPU Generate Diagnostic Checkpoints Feature. */
538
539 ASSERT(fragShaderBarycentric.fragmentShaderBarycentric) /* @brief Enable FragmentShader Barycentric access Feature. */
540
541 ASSERT(timelineSemaphore.timelineSemaphore) /* @brief Enable timeline semaphore Feature. */
542
543 ASSERT(hostImageCopyFeature.hostImageCopy) /* @brief Enable image copy from host directly Feature. */
544
545 ASSERT(robustness2.nullDescriptor) /* @brief Enable Enable null Descriptor write Feature. */
546
547 return true;
548 }
#define ASSERT(expr)
Assert macro.
Definition Core.h:29
#define SPICES_PROFILE_ZONE
static VkPhysicalDeviceFeatures m_DeviceFeatures
Selected Physical Device Features.