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