10a402094986739a2ce1942363370f8e097305933Jesse Hall# frameworks/native/vulkan 20a402094986739a2ce1942363370f8e097305933Jesse Hall 30a402094986739a2ce1942363370f8e097305933Jesse HallThis subdirectory contains Android's Vulkan loader, as well as some Vulkan-related tools useful to platform developers. 40a402094986739a2ce1942363370f8e097305933Jesse Hall 50a402094986739a2ce1942363370f8e097305933Jesse Hall## Coding Style 60a402094986739a2ce1942363370f8e097305933Jesse Hall 70a402094986739a2ce1942363370f8e097305933Jesse HallWe follow the [Chromium coding style](https://www.chromium.org/developers/coding-style) for naming and formatting, except with four-space indentation instead of two spaces. In general, any C++ features supported by the prebuilt platform toolchain are allowed. 80a402094986739a2ce1942363370f8e097305933Jesse Hall 90a402094986739a2ce1942363370f8e097305933Jesse HallUse "clang-format -style=file" to format all C/C++ code, except code imported verbatim from elsewhere. Setting up git-clang-format in your environment is recommended. 100a402094986739a2ce1942363370f8e097305933Jesse Hall 110a402094986739a2ce1942363370f8e097305933Jesse Hall## Code Generation 120a402094986739a2ce1942363370f8e097305933Jesse Hall 130a402094986739a2ce1942363370f8e097305933Jesse HallWe generate several parts of the loader and tools from a Vulkan API description file, stored in `api/vulkan.api`. Code generation must be done manually because the generator tools aren't part of the platform toolchain (yet?). Files named `foo_gen.*` are generated from the API file and a template file named `foo.tmpl`. 140a402094986739a2ce1942363370f8e097305933Jesse Hall 150a402094986739a2ce1942363370f8e097305933Jesse Hall To run the generator: 160a402094986739a2ce1942363370f8e097305933Jesse Hall 170a402094986739a2ce1942363370f8e097305933Jesse Hall### One-time setup 180a402094986739a2ce1942363370f8e097305933Jesse Hall- Install [golang](https://golang.org/), if you don't have it already. 190a402094986739a2ce1942363370f8e097305933Jesse Hall- Create a directory (e.g. `$HOME/lib/go`) for local go sources and binaries and add it to `$GOPATH`. 200a402094986739a2ce1942363370f8e097305933Jesse Hall- `$ git clone https://android.googlesource.com/platform/tools/gpu $GOPATH/src/android.googlesource.com/platform/tools/gpu` 210a402094986739a2ce1942363370f8e097305933Jesse Hall- `$ go get android.googlesource.com/platform/tools/gpu/api/...` 220a402094986739a2ce1942363370f8e097305933Jesse Hall- You should now have `$GOPATH/bin/apic`. You might want to add `$GOPATH/bin` to your `$PATH`. 230a402094986739a2ce1942363370f8e097305933Jesse Hall 240a402094986739a2ce1942363370f8e097305933Jesse Hall### Generating code 250c2032490b80178ec823bf22a7f5d08398851cc3Chia-I WuTo generate `libvulkan/*_gen.*`, 260a402094986739a2ce1942363370f8e097305933Jesse Hall- `$ cd libvulkan` 270c2032490b80178ec823bf22a7f5d08398851cc3Chia-I Wu- `$ apic template ../api/vulkan.api code-generator.tmpl` 280c2032490b80178ec823bf22a7f5d08398851cc3Chia-I WuSimilar for `nulldrv/null_driver_gen.*`. 29