Lines Matching refs:gpu
92 struct app_gpu *gpu; /* point back to the GPU */ member
408 vkGetPhysicalDeviceFormatProperties(dev->gpu->obj, fmt, in app_dev_init_formats()
421 struct app_gpu *gpu, char *layer_name, uint32_t *extension_count, in app_get_physical_device_layer_extensions() argument
429 err = vkEnumerateDeviceExtensionProperties(gpu->obj, layer_name, in app_get_physical_device_layer_extensions()
437 err = vkEnumerateDeviceExtensionProperties(gpu->obj, layer_name, in app_get_physical_device_layer_extensions()
446 static void app_dev_init(struct app_dev *dev, struct app_gpu *gpu) { in app_dev_init() argument
470 err = vkEnumerateDeviceLayerProperties(gpu->obj, &count, NULL); in app_dev_init()
485 err = vkEnumerateDeviceLayerProperties(gpu->obj, &count, in app_dev_init()
490 gpu->device_layer_count = count; in app_dev_init()
491 gpu->device_layers = device_layers; in app_dev_init()
493 for (uint32_t i = 0; i < gpu->device_layer_count; i++) { in app_dev_init()
495 struct layer_extension_list *dst_info = &gpu->device_layers[i]; in app_dev_init()
501 gpu, src_info->layerName, &dst_info->extension_count, in app_dev_init()
507 gpu, NULL, &gpu->device_extension_count, &gpu->device_extensions); in app_dev_init()
516 for (uint32_t j = 0; j < gpu->device_extension_count; j++) { in app_dev_init()
517 VkExtensionProperties *ext_prop = &gpu->device_extensions[j]; in app_dev_init()
531 info.queueCreateInfoCount = gpu->queue_count; in app_dev_init()
532 info.pQueueCreateInfos = gpu->queue_reqs; in app_dev_init()
538 dev->gpu = gpu; in app_dev_init()
539 err = vkCreateDevice(gpu->obj, &info, NULL, &dev->obj); in app_dev_init()
708 static void app_gpu_init(struct app_gpu *gpu, uint32_t id, in app_gpu_init() argument
712 memset(gpu, 0, sizeof(*gpu)); in app_gpu_init()
714 gpu->id = id; in app_gpu_init()
715 gpu->obj = obj; in app_gpu_init()
717 vkGetPhysicalDeviceProperties(gpu->obj, &gpu->props); in app_gpu_init()
720 vkGetPhysicalDeviceQueueFamilyProperties(gpu->obj, &gpu->queue_count, NULL); in app_gpu_init()
722 gpu->queue_props = malloc(sizeof(gpu->queue_props[0]) * gpu->queue_count); in app_gpu_init()
724 if (!gpu->queue_props) in app_gpu_init()
726 vkGetPhysicalDeviceQueueFamilyProperties(gpu->obj, &gpu->queue_count, in app_gpu_init()
727 gpu->queue_props); in app_gpu_init()
730 gpu->queue_reqs = malloc(sizeof(*gpu->queue_reqs) * gpu->queue_count); in app_gpu_init()
731 if (!gpu->queue_reqs) in app_gpu_init()
733 for (i = 0; i < gpu->queue_count; i++) { in app_gpu_init()
735 malloc(gpu->queue_props[i].queueCount * sizeof(float)); in app_gpu_init()
737 gpu->queue_props[i].queueCount * sizeof(float)); in app_gpu_init()
738 gpu->queue_reqs[i].sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; in app_gpu_init()
739 gpu->queue_reqs[i].pNext = NULL; in app_gpu_init()
740 gpu->queue_reqs[i].queueFamilyIndex = i; in app_gpu_init()
741 gpu->queue_reqs[i].queueCount = gpu->queue_props[i].queueCount; in app_gpu_init()
742 gpu->queue_reqs[i].pQueuePriorities = queue_priorities; in app_gpu_init()
745 vkGetPhysicalDeviceMemoryProperties(gpu->obj, &gpu->memory_props); in app_gpu_init()
747 vkGetPhysicalDeviceFeatures(gpu->obj, &gpu->features); in app_gpu_init()
749 app_dev_init(&gpu->dev, gpu); in app_gpu_init()
750 app_dev_init_formats(&gpu->dev); in app_gpu_init()
753 static void app_gpu_destroy(struct app_gpu *gpu) { in app_gpu_destroy() argument
754 app_dev_destroy(&gpu->dev); in app_gpu_destroy()
755 free(gpu->device_extensions); in app_gpu_destroy()
757 for (uint32_t i = 0; i < gpu->queue_count; i++) { in app_gpu_destroy()
758 free((void *)gpu->queue_reqs[i].pQueuePriorities); in app_gpu_destroy()
760 free(gpu->queue_reqs); in app_gpu_destroy()
761 free(gpu->queue_props); in app_gpu_destroy()
823 static void app_gpu_dump_features(const struct app_gpu *gpu) in app_gpu_dump_features() argument
825 const VkPhysicalDeviceFeatures *features = &gpu->features; in app_gpu_dump_features()
1017 static void app_gpu_dump_props(const struct app_gpu *gpu) in app_gpu_dump_props() argument
1019 const VkPhysicalDeviceProperties *props = &gpu->props; in app_gpu_dump_props()
1030 app_dump_limits(&gpu->props.limits); in app_gpu_dump_props()
1031 app_dump_sparse_props(&gpu->props.sparseProperties); in app_gpu_dump_props()
1059 static void app_gpu_dump_queue_props(const struct app_gpu *gpu, uint32_t id) { in app_gpu_dump_queue_props() argument
1060 const VkQueueFamilyProperties *props = &gpu->queue_props[id]; in app_gpu_dump_queue_props()
1077 static void app_gpu_dump_memory_props(const struct app_gpu *gpu) { in app_gpu_dump_memory_props() argument
1078 const VkPhysicalDeviceMemoryProperties *props = &gpu->memory_props; in app_gpu_dump_memory_props()
1097 static void app_gpu_dump(const struct app_gpu *gpu) { in app_gpu_dump() argument
1102 printf("GPU%u\n", gpu->id); in app_gpu_dump()
1103 app_gpu_dump_props(gpu); in app_gpu_dump()
1105 app_dump_extensions("", "Device", gpu->device_extension_count, in app_gpu_dump()
1106 gpu->device_extensions); in app_gpu_dump()
1108 printf("Layers\tcount = %d\n", gpu->device_layer_count); in app_gpu_dump()
1109 for (uint32_t i = 0; i < gpu->device_layer_count; i++) { in app_gpu_dump()
1112 struct layer_extension_list const *layer_info = &gpu->device_layers[i]; in app_gpu_dump()
1131 for (i = 0; i < gpu->queue_count; i++) { in app_gpu_dump()
1132 app_gpu_dump_queue_props(gpu, i); in app_gpu_dump()
1135 app_gpu_dump_memory_props(gpu); in app_gpu_dump()
1137 app_gpu_dump_features(gpu); in app_gpu_dump()
1139 app_dev_dump(&gpu->dev); in app_gpu_dump()