| 1 |
// Copyright (c) 2015-2016 The Khronos Group Inc. |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 |
// you may not use this file except in compliance with the License. |
| 5 |
// You may obtain a copy of the License at |
| 6 |
// |
| 7 |
// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 |
// |
| 9 |
// Unless required by applicable law or agreed to in writing, software |
| 10 |
// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 |
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 |
// See the License for the specific language governing permissions and |
| 13 |
// limitations under the License. |
| 14 |
|
| 15 |
#ifndef SOURCE_BINARY_H_ |
| 16 |
#define SOURCE_BINARY_H_ |
| 17 |
|
| 18 |
#include "source/spirv_definition.h" |
| 19 |
#include "spirv-tools/libspirv.h" |
| 20 |
|
| 21 |
// Functions |
| 22 |
|
| 23 |
// Grabs the header from the SPIR-V module given in the binary parameter. The |
| 24 |
// endian parameter specifies the endianness of the binary module. On success, |
| 25 |
// returns SPV_SUCCESS and writes the parsed header into *header. |
| 26 |
spv_result_t spvBinaryHeaderGet(const spv_const_binary binary, |
| 27 |
const spv_endianness_t endian, |
| 28 |
spv_header_t* header); |
| 29 |
|
| 30 |
// Returns the number of non-null characters in str before the first null |
| 31 |
// character, or strsz if there is no null character. Examines at most the |
| 32 |
// first strsz characters in str. Returns 0 if str is nullptr. This is a |
| 33 |
// replacement for C11's strnlen_s which might not exist in all environments. |
| 34 |
size_t spv_strnlen_s(const char* str, size_t strsz); |
| 35 |
|
| 36 |
#endif // SOURCE_BINARY_H_ |