Enumerate physical devices to check for any supporting shaderFloat64
This commit is contained in:
parent
03364ad387
commit
a8acdc4b01
24
main.c
24
main.c
@ -15,6 +15,7 @@
|
||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||
#define CLAMP(x, min, max) MAX((min), MIN(x, (max)))
|
||||
|
||||
#define PHYSICAL_DEV_BUFFER_SIZE 8
|
||||
#define QUEUE_FAMILY_PROP_BUFFER_SIZE 16
|
||||
#define EXT_PROP_BUFFER_SIZE 256
|
||||
#define SURFACE_FMT_BUFFER_SIZE 64
|
||||
@ -96,15 +97,22 @@ int main(void)
|
||||
assert(result == VK_SUCCESS);
|
||||
|
||||
// Select a physical device
|
||||
VkPhysicalDevice physical_devs[PHYSICAL_DEV_BUFFER_SIZE];
|
||||
uint32_t dev_count = PHYSICAL_DEV_BUFFER_SIZE;
|
||||
result = vkEnumeratePhysicalDevices(inst, &dev_count, physical_devs);
|
||||
assert(result == VK_SUCCESS);
|
||||
bool found_physical_dev = false;
|
||||
VkPhysicalDevice physical_dev;
|
||||
uint32_t dev_count = 1;
|
||||
result = vkEnumeratePhysicalDevices(inst, &dev_count, &physical_dev);
|
||||
assert(result == VK_SUCCESS || result == VK_INCOMPLETE);
|
||||
|
||||
// Check that the device supports double precision
|
||||
VkPhysicalDeviceFeatures features;
|
||||
vkGetPhysicalDeviceFeatures(physical_dev, &features);
|
||||
assert(features.shaderFloat64);
|
||||
for (unsigned i = 0; i < dev_count; ++i) {
|
||||
// Check that the device supports double precision
|
||||
VkPhysicalDeviceFeatures features;
|
||||
vkGetPhysicalDeviceFeatures(physical_devs[i], &features);
|
||||
if (features.shaderFloat64) {
|
||||
physical_dev = physical_devs[i];
|
||||
found_physical_dev = true;
|
||||
}
|
||||
}
|
||||
assert(found_physical_dev);
|
||||
|
||||
// Select queue family
|
||||
uint32_t queue_family_count = QUEUE_FAMILY_PROP_BUFFER_SIZE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user