I’d like to show great thanks to my mentor, Henri Verbeet here. He has helped me a great deal!
Some tips while using vkd3d
1. Add Path
To add for example your personal demo to the vkd3d build system, you’d add “demos/xxx” to the “vkd3d_demos” variable in Makefile.am, and add lines like this:
demos_rectangle_CFLAGS = $(DEMOS_CFLAGS)
demos_rectangle_LDADD = $(DEMOS_LDADD)
inside the “if BUILD_DEMOS” block. (Much like the existing “demos_triangle_CFLAGS” and “demos_triangle_LDADD” for the triangle demo.)
After running “make”, if the build was successful, there should then be a “demos/xxx” in the build directory.
2. Debug
The main vkd3d debug mechanisms are the VKD3D_DEBUG and VKD3D_SHADER_DEBUG environment variables. (There are some other environment variables as well; they’re described in the README, but can be ignored for now.) If you e.g. wanted to see what vkd3d calls the triangle demo is making, you’d run it like this:
VKD3D_DEBUG=trace demos/triangle
and it would print debug output for libvkd3d to stderr. Similarly:
VKD3D_SHADER_DEBUG=trace demos/triangle
will print debug output for libvkd3d-shader, and
VKD3D_DEBUG=trace VKD3D_SHADER_DEBUG=trace demos/triangle &> trace.log
will print debug output for both, and redirect it to a file called “trace.log”. The possible values for these environment variables (“err” ,“fixme”, “warn”, “trace”) correspond to the ERR/FIXME/WARN/TRACE macros in the vkd3d source code. “Higher” debug levels include the output of lower levels. So e.g. VKD3D_DEBUG=warn will output ERR, FIXME, and WARN lines, while VKD3D_DEBUG=trace will output everything.
Of course it’s also possible to use more specialised external tools like e.g. gdb, valgrind or RenderDoc. For example:
gdb --args /bin/bash demos/triangle
would cause gdb to run the triangle demo, and you could then e.g. “break vkd3d_create_device” to set a breakpoint on vkd3d_create_device().
3. Run
Actually, you don’t need to run the actual executables, and can just use the wrapper scripts.