Skip to content
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

Merged
merged 1 commit into from
Jul 17, 2020

Conversation

TonyBarbour
Copy link
Contributor

Workaround for issue in #308

@@ -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];
Copy link
Contributor

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:

  1. Crashed more gracefully with an error message.
  2. 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];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as vkcube.

Copy link
Contributor Author

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
Copy link
Contributor

@jeremyk-lunarg jeremyk-lunarg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeremyk-lunarg jeremyk-lunarg merged commit 50e737c into master Jul 17, 2020
@jeremyk-lunarg jeremyk-lunarg deleted the tony-cube-phydev branch July 17, 2020 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants