hello_triangle sample does not display anything on my Alienware laptop
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.
- How can hello_triangle be modified to obey the --gpu argument?
- How can hello_triangle be modified to detect that the intel GPU is unsuitable for rendering? or perhaps be modified to successfully render?
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.
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.
That's exactly what I wrote above.
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"
We don't have plans to add that functionality to the hello_triangle sample.