-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to select phys device to vkcube / vkcubepp #427
Conversation
@@ -3178,8 +3179,7 @@ static void demo_init_vk(struct demo *demo) { | |||
VkPhysicalDevice *physical_devices = malloc(sizeof(VkPhysicalDevice) * gpu_count); | |||
err = vkEnumeratePhysicalDevices(demo->inst, &gpu_count, physical_devices); | |||
assert(!err); | |||
/* For cube demo we just grab the first physical device */ | |||
demo->gpu = physical_devices[0]; | |||
demo->gpu = physical_devices[demo->gpu_number]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This segfaults if the number selected by the user is out of bounds.
It would be cleaner if it either:
- Crashed more gracefully with an error message.
- Output a warning to the user and use the first gpu in the list.
@@ -1215,8 +1223,7 @@ void Demo::init_vk() { | |||
std::unique_ptr<vk::PhysicalDevice[]> physical_devices(new vk::PhysicalDevice[gpu_count]); | |||
result = inst.enumeratePhysicalDevices(&gpu_count, physical_devices.get()); | |||
VERIFY(result == vk::Result::eSuccess); | |||
/* For cube demo we just grab the first physical device */ | |||
gpu = physical_devices[0]; | |||
gpu = physical_devices[gpu_number]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as vkcube.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I choose option 2.
Change-Id: Ic6ff0210b586e03597aa3418b45bf0fa57b1157c
9a143ce
to
fffc7bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Workaround for issue in #308