Vulkan-Samples icon indicating copy to clipboard operation
Vulkan-Samples copied to clipboard

hello_triangle sample does not display anything on my Alienware laptop

Open mutantbob opened this issue 1 year ago • 4 comments

I tried to run the hello_triangle sample on my laptop but the window stayed black and did not draw a triangle.

After poking around in gdb I eventually concluded that the hello_triangle sample chooses the wrong GPU . Its log shows the following physical devices.

[info] Found GPU= Intel(R) UHD Graphics 630 (CFL GT2) [info] Found GPU= NVIDIA GeForce RTX 2070 [info] Found GPU= llvmpipe (LLVM 12.0.0, 256 bits)

I tried to use the --gpu 1 argument to tell it to use the nVidia GPU, but hello_triangle still picked the first GPU (Intel) . When I changed the code to skip the first GPU, then the window successfully displays a triangle.

  1. How can hello_triangle be modified to obey the --gpu argument?
  2. How can hello_triangle be modified to detect that the intel GPU is unsuitable for rendering? or perhaps be modified to successfully render?

mutantbob avatar Feb 22 '24 18:02 mutantbob

gpu selection is part of the framework and as such not implemented in the (hpp)hello_triangle sample. You can use it with any other sample though, as they use the sample framework that supports gpu selection.

Or if you want to use the hello_triangle sample, simply adjust the the init_device and e.g. force device 1.

SaschaWillems avatar Feb 22 '24 20:02 SaschaWillems

That turns out not to be the case. hello_triangle.cpp has code to pick the GPU / physical device here:

https://github.com/KhronosGroup/Vulkan-Samples/blob/5a58580315f32b2e7fe2ed773742be2e746e5e39/samples/api/hello_triangle/hello_triangle.cpp#L293

It does not consult the framework to see which GPU has been selected by command-line arguments.

mutantbob avatar Feb 22 '24 20:02 mutantbob

That's exactly what I wrote above.

SaschaWillems avatar Feb 22 '24 20:02 SaschaWillems

Maybe? I would have worded it differently. Maybe "hello_triangle does not use the framework's GPU selection and instead picks the GPU using custom code inside init_device" I read your sentence and grouped "gpu selection is" "not implemented in the hello_triangle sample" I guess my question can be refined as "could hello_triangle be modified to respect the framework's GPU settings?" And the one about ignoring GPUs that are non-functional still stands"

mutantbob avatar Feb 22 '24 20:02 mutantbob

We don't have plans to add that functionality to the hello_triangle sample.

SaschaWillems avatar May 20 '24 13:05 SaschaWillems