Skip to content

Commit 191469b

Browse files
authored
set enabledFeatures when creating vulkan device (#221)
Set pEnabledFeatures and pNext in VkDeviceCreateInfo See: https://registry.khronos.org/vulkan/specs/latest/man/html/VkDeviceCreateInfo.html Closes #220
1 parent ac8efe4 commit 191469b

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ Experimental Runtime test suite for HLSL
1313

1414
# Prerequisites
1515

16+
Requires the Vulkan 1.4 SDK.
17+
1618
This project requires being able to locally build LLVM and leverages LLVM's build infrastructure. It also requires installing the `pyyaml` Python package. You can install `pyyaml` by running:
1719

1820
```shell

lib/API/VK/Device.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,27 @@ class VKDevice : public offloadtest::Device {
252252
DeviceInfo.queueCreateInfoCount = 1;
253253
DeviceInfo.pQueueCreateInfos = &QueueInfo;
254254

255+
VkPhysicalDeviceFeatures2 Features{};
256+
Features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
257+
VkPhysicalDeviceVulkan11Features Features11{};
258+
Features11.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES;
259+
VkPhysicalDeviceVulkan12Features Features12{};
260+
Features12.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES;
261+
VkPhysicalDeviceVulkan13Features Features13{};
262+
Features13.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_3_FEATURES;
263+
VkPhysicalDeviceVulkan14Features Features14{};
264+
Features14.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_4_FEATURES;
265+
266+
Features.pNext = &Features11;
267+
Features11.pNext = &Features12;
268+
Features12.pNext = &Features13;
269+
Features13.pNext = &Features14;
270+
Features14.pNext = NULL;
271+
vkGetPhysicalDeviceFeatures2(Device, &Features);
272+
273+
DeviceInfo.pEnabledFeatures = &Features.features;
274+
DeviceInfo.pNext = Features.pNext;
275+
255276
if (vkCreateDevice(Device, &DeviceInfo, nullptr, &IS.Device))
256277
return llvm::createStringError(std::errc::no_such_device,
257278
"Could not create Vulkan logical device.");

0 commit comments

Comments
 (0)