Skip to content

Commit

Permalink
Add support for Vulkan 1.4 (#1061)
Browse files Browse the repository at this point in the history
* Also check Vulkan 1.4 features for indexTypeUint8
* Make extension functions to be optional
* Update Vulkan headers, SPIRV and Vulkan validation refs

---------

Co-authored-by: Faith Ekstrand <[email protected]>
Co-authored-by: Boris Zanin <[email protected]>
  • Loading branch information
3 people authored Dec 3, 2024
1 parent fc9d766 commit 1ec5e96
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 12 deletions.
12 changes: 6 additions & 6 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ vars = {
'json_revision': '4f8fba14066156b73f1189a2b8bd568bde5284c5',
'lodepng_revision': '5601b8272a6850b7c5d693dd0c0e16da50be8d8d',
'shaderc_revision': 'f59f0d11b80fd622383199c867137ededf89d43b',
'spirv_headers_revision': '5e3ad389ee56fca27c9705d093ae5387ce404df4',
'spirv_tools_revision': '9241a58a8028c49510bc174b6c970e3c2b4b8e51',
'spirv_headers_revision': '36d5e2ddaa54c70d2f29081510c66f4fc98e5e53',
'spirv_tools_revision': '3fb52548bc8a68d349d31e21bd4e80e3d953e87c',
'swiftshader_revision': 'da334852e70510d259bfa8cbaa7c5412966b2f41',
'vulkan_headers_revision': '4bc77c26ff9ce89cf4a4f79e1c24a44604132d53',
'vulkan_loader_revision': 'e69a59a96b241038f24a0e425445d001ea099b2c',
'vulkan_utility_libraries_revision': '358a107a6ff284906dcccbabe5b0183c03fd85b6',
'vulkan_validationlayers_revision': '23455c903e2ab21db2b4497331d80d610841cae1',
'vulkan_headers_revision': '49af1bfe467dd5a9efc22f7867d95fdde50e2b00',
'vulkan_loader_revision': 'ce2d68b24b66a91ed798d870ca205f899ee6e79d',
'vulkan_utility_libraries_revision': 'b538fb5b08513aa78346cd414ad5e576a2a3e920',
'vulkan_validationlayers_revision': '902f3cf8d51e76be0c0deb4be39c6223abebbae2',
}

deps = {
Expand Down
26 changes: 20 additions & 6 deletions src/vulkan/device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ Result Device::Initialize(
VkPhysicalDeviceVulkan11Features* vulkan11_ptrs = nullptr;
VkPhysicalDeviceVulkan12Features* vulkan12_ptrs = nullptr;
VkPhysicalDeviceVulkan13Features* vulkan13_ptrs = nullptr;
VkPhysicalDeviceVulkan14Features* vulkan14_ptrs = nullptr;
VkPhysicalDeviceSubgroupSizeControlFeaturesEXT*
subgroup_size_control_features = nullptr;
VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures*
Expand Down Expand Up @@ -557,6 +558,9 @@ Result Device::Initialize(
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES:
vulkan13_ptrs = static_cast<VkPhysicalDeviceVulkan13Features*>(ptr);
break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_FEATURES:
vulkan14_ptrs = static_cast<VkPhysicalDeviceVulkan14Features*>(ptr);
break;
default:
break;
}
Expand Down Expand Up @@ -610,12 +614,6 @@ Result Device::Initialize(
return amber::Result(
"Subgroup extended types requested but feature not returned");
}
if (feature == kIndexTypeUint8 &&
(index_type_uint8_ptrs == nullptr ||
index_type_uint8_ptrs->indexTypeUint8 != VK_TRUE)) {
return amber::Result(
"Index type uint8_t requested but feature not returned");
}
if (feature == kAccelerationStructure) {
if (acceleration_structure_ptrs == nullptr)
return amber::Result(
Expand Down Expand Up @@ -806,6 +804,22 @@ Result Device::Initialize(
return amber::Result("Missing compute full subgroups feature");
}
}

// If Vulkan 1.4 structure exists the features are set there.
if (vulkan14_ptrs) {
if (feature == kIndexTypeUint8 &&
vulkan14_ptrs->indexTypeUint8 != VK_TRUE) {
return amber::Result(
"Index type uint8_t requested but feature not returned");
}
} else {
if (feature == kIndexTypeUint8 &&
(index_type_uint8_ptrs == nullptr ||
index_type_uint8_ptrs->indexTypeUint8 != VK_TRUE)) {
return amber::Result(
"Index type uint8_t requested but feature not returned");
}
}
}

if (!AreAllExtensionsSupported(available_extensions,
Expand Down

0 comments on commit 1ec5e96

Please sign in to comment.