diff options
| author | Jay Kwak <82421531+jkwak-work@users.noreply.github.com> | 2025-01-30 13:19:13 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-30 13:19:13 -0800 |
| commit | fb052bf4674b55933e6dd9f991c99000c049d216 (patch) | |
| tree | cff94fc924a63fe80ae53cc3a0c15039c171bf7a /tools/gfx/vulkan | |
| parent | 7a8131d312d84f71b1c8776ad83713dea52301f4 (diff) | |
Support cooperative vector including Vulkan-Header (#6228)
* Support cooperative vector including Vulkan-Header
Adding a Slang support for cooperative vector with vulkan-header update.
Diffstat (limited to 'tools/gfx/vulkan')
| -rw-r--r-- | tools/gfx/vulkan/vk-api.cpp | 11 | ||||
| -rw-r--r-- | tools/gfx/vulkan/vk-api.h | 7 | ||||
| -rw-r--r-- | tools/gfx/vulkan/vk-device.cpp | 14 |
3 files changed, 32 insertions, 0 deletions
diff --git a/tools/gfx/vulkan/vk-api.cpp b/tools/gfx/vulkan/vk-api.cpp index dbf32345f..09b8e92f5 100644 --- a/tools/gfx/vulkan/vk-api.cpp +++ b/tools/gfx/vulkan/vk-api.cpp @@ -86,6 +86,17 @@ Slang::Result VulkanApi::initPhysicalDevice(VkPhysicalDevice physicalDevice) vkGetPhysicalDeviceFeatures(m_physicalDevice, &m_deviceFeatures); vkGetPhysicalDeviceMemoryProperties(m_physicalDevice, &m_deviceMemoryProperties); + if (vkGetPhysicalDeviceCooperativeVectorPropertiesNV) + { + uint32_t nProps = 0; + vkGetPhysicalDeviceCooperativeVectorPropertiesNV(m_physicalDevice, &nProps, nullptr); + m_cooperativeVectorProperties.setCount(nProps); + vkGetPhysicalDeviceCooperativeVectorPropertiesNV( + m_physicalDevice, + &nProps, + m_cooperativeVectorProperties.getBuffer()); + } + return SLANG_OK; } diff --git a/tools/gfx/vulkan/vk-api.h b/tools/gfx/vulkan/vk-api.h index 23902e88c..41fede15e 100644 --- a/tools/gfx/vulkan/vk-api.h +++ b/tools/gfx/vulkan/vk-api.h @@ -22,6 +22,7 @@ namespace gfx x(vkCreateDebugReportCallbackEXT) \ x(vkDestroyDebugReportCallbackEXT) \ x(vkDebugReportMessageEXT) \ + x(vkGetPhysicalDeviceCooperativeVectorPropertiesNV) \ /* */ #define VK_API_INSTANCE_PROCS(x) \ @@ -304,6 +305,10 @@ struct VulkanExtendedFeatureProperties VkPhysicalDeviceVulkan12Features vulkan12Features = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES}; + // Cooperative vector features + VkPhysicalDeviceCooperativeVectorFeaturesNV cooperativeVectorFeatures = { + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_VECTOR_FEATURES_NV}; + // Ray tracing validation features VkPhysicalDeviceRayTracingValidationFeaturesNV rayTracingValidationFeatures = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_VALIDATION_FEATURES_NV}; @@ -352,6 +357,8 @@ struct VulkanApi VkPhysicalDeviceFeatures m_deviceFeatures; VkPhysicalDeviceMemoryProperties m_deviceMemoryProperties; VulkanExtendedFeatureProperties m_extendedFeatures; + + Slang::List<VkCooperativeVectorPropertiesNV> m_cooperativeVectorProperties; }; } // namespace gfx diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp index 3654203da..cffa094ae 100644 --- a/tools/gfx/vulkan/vk-device.cpp +++ b/tools/gfx/vulkan/vk-device.cpp @@ -511,6 +511,10 @@ Result DeviceImpl::initVulkanInstanceAndDevice( extendedFeatures.clockFeatures.pNext = deviceFeatures2.pNext; deviceFeatures2.pNext = &extendedFeatures.clockFeatures; + // cooperative vector features + extendedFeatures.cooperativeVectorFeatures.pNext = deviceFeatures2.pNext; + deviceFeatures2.pNext = &extendedFeatures.cooperativeVectorFeatures; + // Atomic Float // To detect atomic float we need // https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VkPhysicalDeviceShaderAtomicFloatFeaturesEXT.html @@ -748,6 +752,16 @@ Result DeviceImpl::initVulkanInstanceAndDevice( deviceCreateInfo.pNext = &extendedFeatures.vulkan12Features; } + if (extendedFeatures.cooperativeVectorFeatures.cooperativeVector) + { + deviceExtensions.add(VK_NV_COOPERATIVE_VECTOR_EXTENSION_NAME); + + extendedFeatures.cooperativeVectorFeatures.pNext = (void*)deviceCreateInfo.pNext; + deviceCreateInfo.pNext = &extendedFeatures.cooperativeVectorFeatures; + + m_features.add("cooperative-vector"); + } + VkPhysicalDeviceProperties2 extendedProps = { VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2}; VkPhysicalDeviceRayTracingPipelinePropertiesKHR rtProps = { |
