xref: /aosp_15_r20/external/executorch/backends/vulkan/runtime/VulkanDelegateHeader.h (revision 523fa7a60841cd1ecfb9cc4201f1ca8b03ed023a)
1 /*
2  * Copyright (c) Meta Platforms, Inc. and affiliates.
3  * All rights reserved.
4  *
5  * This source code is licensed under the BSD-style license found in the
6  * LICENSE file in the root directory of this source tree.
7  */
8 
9 #pragma once
10 
11 #include <executorch/runtime/core/result.h>
12 
13 namespace executorch {
14 namespace backends {
15 namespace vulkan {
16 
17 // Byte decoding utilities
18 uint64_t getUInt64LE(const uint8_t* data);
19 uint32_t getUInt32LE(const uint8_t* data);
20 uint32_t getUInt16LE(const uint8_t* data);
21 
22 struct VulkanDelegateHeader {
23   bool is_valid() const;
24 
25   static executorch::runtime::Result<VulkanDelegateHeader> parse(
26       const void* data);
27 
28   uint32_t header_size;
29   uint32_t flatbuffer_offset;
30   uint32_t flatbuffer_size;
31   uint32_t bytes_offset;
32   uint64_t bytes_size;
33 };
34 
35 } // namespace vulkan
36 } // namespace backends
37 } // namespace executorch
38