Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e9c59646 authored by Jesse Hall's avatar Jesse Hall Committed by Android (Google) Code Review
Browse files

Merge "vulkan: Document codegen instructions and code style"

parents b776ba1c e0d27bb1
Loading
Loading
Loading
Loading

vulkan/README.md

0 → 100644
+28 −0
Original line number Original line Diff line number Diff line
# frameworks/native/vulkan

This subdirectory contains Android's Vulkan loader, as well as some Vulkan-related tools useful to platform developers.

## Coding Style

We 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.

Use "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.

## Code Generation

We 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`.

 To run the generator:

### One-time setup
- Install [golang](https://golang.org/), if you don't have it already.
- Create a directory (e.g. `$HOME/lib/go`) for local go sources and binaries and add it to `$GOPATH`.
- `$ git clone https://android.googlesource.com/platform/tools/gpu $GOPATH/src/android.googlesource.com/platform/tools/gpu`
- `$ go get android.googlesource.com/platform/tools/gpu/api/...`
- You should now have `$GOPATH/bin/apic`. You might want to add `$GOPATH/bin` to your `$PATH`.

### Generating code
To generate `libvulkan/dispatch_gen.*`,
- `$ cd libvulkan`
- `$ apic template ../api/vulkan.api dispatch.tmpl`
Similar for `nulldrv/null_driver_gen.*`.
 No newline at end of file
+4 −0
Original line number Original line Diff line number Diff line
@@ -42,6 +42,8 @@
•* limitations under the License.
•* limitations under the License.
•*/
•*/


// WARNING: This file is generated. See ../README.md for instructions.

#define VK_USE_PLATFORM_ANDROID_KHR
#define VK_USE_PLATFORM_ANDROID_KHR
#include <vulkan/vk_android_native_buffer.h>
#include <vulkan/vk_android_native_buffer.h>
#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vk_ext_debug_report.h>
@@ -124,6 +126,8 @@ struct DriverDispatchTable {«
•* limitations under the License.
•* limitations under the License.
•*/
•*/


// WARNING: This file is generated. See ../README.md for instructions.

#include <log/log.h>
#include <log/log.h>
#include <algorithm>
#include <algorithm>
#include "loader.h"
#include "loader.h"
+2 −0
Original line number Original line Diff line number Diff line
@@ -14,6 +14,8 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


// WARNING: This file is generated. See ../README.md for instructions.

#include <log/log.h>
#include <log/log.h>
#include <algorithm>
#include <algorithm>
#include "loader.h"
#include "loader.h"
+2 −0
Original line number Original line Diff line number Diff line
@@ -14,6 +14,8 @@
 * limitations under the License.
 * limitations under the License.
 */
 */


// WARNING: This file is generated. See ../README.md for instructions.

#define VK_USE_PLATFORM_ANDROID_KHR
#define VK_USE_PLATFORM_ANDROID_KHR
#include <vulkan/vk_android_native_buffer.h>
#include <vulkan/vk_android_native_buffer.h>
#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vk_ext_debug_report.h>
+2 −6
Original line number Original line Diff line number Diff line
@@ -43,9 +43,7 @@
•* limitations under the License.
•* limitations under the License.
•*/
•*/


// This file is generated. Do not edit manually!
// WARNING: This file is generated. See ../README.md for instructions.
// To regenerate: $ apic template ../api/vulkan.api null_driver.tmpl
// Requires apic from https://android.googlesource.com/platform/tools/gpu/.


#ifndef NULLDRV_NULL_DRIVER_H
#ifndef NULLDRV_NULL_DRIVER_H
#define NULLDRV_NULL_DRIVER_H 1
#define NULLDRV_NULL_DRIVER_H 1
@@ -98,9 +96,7 @@ VKAPI_ATTR VkResult QueueSignalReleaseImageANDROID(VkQueue queue, uint32_t waitS
•* limitations under the License.
•* limitations under the License.
•*/
•*/


// This file is generated. Do not edit manually!
// WARNING: This file is generated. See ../README.md for instructions.
// To regenerate: $ apic template ../api/vulkan.api null_driver.tmpl
// Requires apic from https://android.googlesource.com/platform/tools/gpu/.


#include "null_driver_gen.h"
#include "null_driver_gen.h"
#include <algorithm>
#include <algorithm>
Loading