diff options
| author | skallweitNV <64953474+skallweitNV@users.noreply.github.com> | 2024-02-21 08:20:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-20 23:20:07 -0800 |
| commit | 70ea0b048970b9d2e00451636c88313093de2337 (patch) | |
| tree | f55d6361c006e9f402dd3ef77e5120547f9f67d0 | |
| parent | 2e2c7943da89b0100db3bba4b11267b5a857ca92 (diff) | |
derive approximate DX12 shader model in vulkan (#3596)
Co-authored-by: Yong He <yonghe@outlook.com>
| -rw-r--r-- | tools/gfx/vulkan/vk-device.cpp | 43 |
1 files changed, 41 insertions, 2 deletions
diff --git a/tools/gfx/vulkan/vk-device.cpp b/tools/gfx/vulkan/vk-device.cpp index e1b1eaf27..46023281c 100644 --- a/tools/gfx/vulkan/vk-device.cpp +++ b/tools/gfx/vulkan/vk-device.cpp @@ -592,8 +592,7 @@ Result DeviceImpl::initVulkanInstanceAndDevice( rayQuery, VK_KHR_RAY_QUERY_EXTENSION_NAME, "ray-query", - "ray-tracing", - "sm_6_6" + "ray-tracing" ); SIMPLE_EXTENSION_FEATURE( @@ -776,6 +775,46 @@ Result DeviceImpl::initVulkanInstanceAndDevice( deviceExtensions.add(VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME); m_features.add("shader-subgroup-partitioned"); } + + // Derive approximate DX12 shader model. + const char* featureTable[] = { + "sm_6_0", "wave-ops", "atomic-int64", nullptr, + "sm_6_1", "barycentrics", "multiview", nullptr, + "sm_6_2", "half", nullptr, + "sm_6_3", "ray-tracing-pipeline", nullptr, + "sm_6_4", "fragment-shading-rate", nullptr, + "sm_6_5", "ray-query", "mesh-shader", nullptr, + "sm_6_6", "wave-ops", "atomic-float", "atomic-int64", nullptr, + nullptr, + }; + + int i = 0; + while (i < SLANG_COUNT_OF(featureTable)) + { + const char* sm = featureTable[i++]; + if (sm == nullptr) + { + break; + } + bool hasAll = true; + while (i < SLANG_COUNT_OF(featureTable)) + { + const char* feature = featureTable[i++]; + if (feature == nullptr) + { + break; + } + hasAll &= m_features.contains(feature); + } + if (hasAll) + { + m_features.add(sm); + } + else + { + break; + } + } } if (m_api.m_module->isSoftware()) { |
