diff options
Diffstat (limited to 'tools/gfx/vulkan/vk-device.cpp')
| -rw-r--r-- | tools/gfx/vulkan/vk-device.cpp | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp index 981b5abac..b9ca76493 100644 --- a/tools/gfx/vulkan/vk-device.cpp +++ b/tools/gfx/vulkan/vk-device.cpp @@ -730,6 +730,12 @@ Result DeviceImpl::initVulkanInstanceAndDevice( "ray-tracing-validation"); } + SIMPLE_EXTENSION_FEATURE( + extendedFeatures.cooperativeVectorFeatures, + cooperativeVector, + VK_NV_COOPERATIVE_VECTOR_EXTENSION_NAME, + "cooperative-vector"); + #undef SIMPLE_EXTENSION_FEATURE if (extendedFeatures.vulkan12Features.shaderBufferInt64Atomics) @@ -752,16 +758,6 @@ 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 = { @@ -1548,6 +1544,47 @@ Result DeviceImpl::getTextureRowAlignment(Size* outAlignment) return SLANG_OK; } +Result DeviceImpl::getCooperativeVectorProperties( + CooperativeVectorProperties* properties, + uint32_t* propertyCount) +{ + if (!m_api.m_extendedFeatures.cooperativeVectorFeatures.cooperativeVector || + !m_api.vkGetPhysicalDeviceCooperativeVectorPropertiesNV) + return SLANG_E_NOT_AVAILABLE; + + if (m_cooperativeVectorProperties.empty()) + { + uint32_t vkPropertyCount = 0; + m_api.vkGetPhysicalDeviceCooperativeVectorPropertiesNV( + m_api.m_physicalDevice, + &vkPropertyCount, + nullptr); + std::vector<VkCooperativeVectorPropertiesNV> vkProperties(vkPropertyCount); + SLANG_VK_RETURN_ON_FAIL(m_api.vkGetPhysicalDeviceCooperativeVectorPropertiesNV( + m_api.m_physicalDevice, + &vkPropertyCount, + vkProperties.data())); + for (const auto& vkProps : vkProperties) + { + CooperativeVectorProperties props; + props.inputType = + VulkanUtil::translateCooperativeVectorComponentType(vkProps.inputType); + props.inputInterpretation = + VulkanUtil::translateCooperativeVectorComponentType(vkProps.inputInterpretation); + props.matrixInterpretation = + VulkanUtil::translateCooperativeVectorComponentType(vkProps.matrixInterpretation); + props.biasInterpretation = + VulkanUtil::translateCooperativeVectorComponentType(vkProps.biasInterpretation); + props.resultType = + VulkanUtil::translateCooperativeVectorComponentType(vkProps.resultType); + props.transpose = vkProps.transpose; + m_cooperativeVectorProperties.push_back(props); + } + } + + return RendererBase::getCooperativeVectorProperties(properties, propertyCount); +} + Result DeviceImpl::createTextureResource( const ITextureResource::Desc& descIn, const ITextureResource::SubresourceData* initData, |
