Vulkan tutorial first steps

Not an issue, just sharing some steps to anyone wanting to try Vulkan Tutorial on Jetson. For reference I’m using Xavier NX and R32.4.4.
Here are some steps that may help:

#Pre-requisites
sudo apt update
sudo apt install vulkan-utils libvulkan-dev meson libglm-dev libglfw3-dev

TOP_DIR=<wherever_you_want>/VulkanTutorial

mkdir $TOP_DIR
cd $TOP_DIR

#Get shaderc sources
git clone https://github.com/google/shaderc.git
cd shaderc/
#Get dependencies
./utils/git-sync-deps

#make a build directory and jump into it
cd ..
mkdir shaderc-build; cd shaderc-build

#configure build
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ../shaderc

#build...this may take some time...you may boost with jetson_clocks uncommenting related lines.
#sudo jetson_clocks --store
#sudo jetson_clocks
ninja
#sudo jetson_clocks --restore

#test would only take a few minutes
ctest

#if some test failed, you may get some info with:
ctest --rerun-failed -VV --output-on-failure
#I do see 2 failing tests:
# $TOP_DIR/shaderc/third_party/glslang/gtests/TestFixture.h
# Glsl/CompileToAstTest.FromFile/constantUnaryConversion_comp, where GetParam() = "constantUnaryConversion.comp"
# ToSpirv/HlslCompileTest.FromFile/hlsl_inf_vert, where GetParam() = 16-byte object <D0-46 02-62 55-00 00-00 90-39 02-62 55-00 00-00>
# You may try to go ahead with these

#install (here using a symbolic link, YMMV...)
sudo ln -s $TOP_DIR/shaderc-build/glslc/glslc /usr/local/bin/glslc

#back to top VulkanTutorial directory
cd ..

#Have some shaders
mkdir shaders; cd shaders

# copy shader.vert, shader.frag files here. Got mines from:
# https://vulkan.developpez.com/tutorial/tutoriel-complet-debutant/?page=dessiner-un-triangle#LIV-C-2-d

#compile these
/usr/local/bin/glslc shader.vert -o vert.spv
/usr/local/bin/glslc shader.frag -o frag.spv

#done, back to top for tutorial, should be enough for displaying the triangle.
cd ..
# Now follow: https://vulkan-tutorial.com/Introduction for triangle and more.

Hope it helps.
In case I’m wrong, please correct me and show the right way to do.

2 Likes

Hi @Honey_Patouceul
Thanks for the sharing. We would like to put it to Jetson Xavier NX FAQ so that everyone can refer to it. Is it OK for you?

1 Like

Hi @DaneLLL,
If you think it may be useful, feel free to do so.