vulkan_best_practice_for_mobile_developers

Creating a new sample

This document will explain how to create the necessary files to start working on your own sample.

Create

To create a new sample, run the generate_sample script that exists within bldsys/scripts. There is a batch script for Windows, and a shell script for Unix based systems.

Usage

generate_sample <sample_id> <category> [<create_path>]

Example

generate_sample my_sample category

Running the above line will generate the following files:

samples/category/my_sample/CMakeLists.txt
samples/category/my_sample/my_sample.cpp
samples/category/my_sample/my_sample.h

Configure

To configure how your sample will appear, you can modify the CMakeLists.txt within the generated directory:

To change the order of the samples (or place your sample in a specific place), modify the ORDER_LIST list inside samples/CMakeLists.txt. Just place a string of your <sample_id> where you would like it to be placed relative to the other samples.

If you would like to show different configurations of your sample during batch mode, you will need to insert these configurations in the constructor of your sample (inside samples/category/my_sample.cpp).

e.g. get_configuration().insert<vkb::IntSetting>(0, my_sample_value, 3);