krh / vkcube

Spinning Vulkan Cube

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot find vulkan_intel.h for Ubuntu

edgecase14 opened this issue · comments

Is this still needed? Also glslc is a bit of a mystery also.

We should probably drop the intel extension. Same stuff can be implemented with KHR.

I guess we should also replace glslc by glslang.

See #47 for glslang.

Having this issue too and it took me a while to realize this as the program appeared to work but failing to initialize KMS (so I went looking in all the wrong places) — turns out that if the vulkan_intel.h header is not found, init_kms is a stub that silently fails:

vkcube/main.c

Lines 674 to 678 in 8261e90

static int
init_kms(struct vkcube *vc)
{
return -1;
}

What would have saved me a lot of time with a helpful error message like "KMS not available: vulkan_intel is disabled"
[Edit] Suggested temporary remedy: #60

In addition, the program spits out a broken PNG: (likely from the segfault)

$ sudo ./build/vkcube
failed to initialize kms, falling back to headless
3 physical devices
vendor id 10de, device name NVIDIA GeForce RTX 4070 Ti
writing first frame to ./cube.png
Segmentation fault
$

Image:
cube

System: x86_64, Ubuntu 22.04.1, Linux 5.19.0

How I built it:

sudo apt install -y \
  meson \
  libdrm-dev \
  libpng-dev \
  libvulkan-dev \
  glslang-tools \
  ninja-build
git clone https://chromium.googlesource.com/chromiumos/platform/minigbm
cd minigbm
$EDITOR Makefile # add -DGBM_I915 to CPPFLAGS
make DESTDIR=install -j32 install
sed -E -i -e "s@^prefix=.+@prefix=$PWD/install/usr@" \
  install/usr/lib/pkgconfig/gbm.pc
cd ..
git clone https://github.com/krh/vkcube.git
cd vkcube
PKG_CONFIG_PATH="$PWD/../minigbm/install/usr/lib/pkgconfig:$(pkg-config --variable pc_path pkg-config)" \
meson setup ./build
ninja -C build

based on the very brief instructions in main.c:

vkcube/main.c

Lines 29 to 35 in 8261e90

* Compile and run this with minigbm:
*
* https://chromium.googlesource.com/chromiumos/platform/minigbm
*
* Edit the minigbm Makefile to add -DGBM_I915 to CPPFLAGS, then compile and
* install with make DESTDIR=<some path>. Then pass --with-minigbm=<some path>
* to configure when configuring vkcube

JFYI, I have implemented baremetal KMS support, see #61