binary.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. #ifndef SOURCE_BINARY_H_
  15. #define SOURCE_BINARY_H_
  16. #include "source/spirv_definition.h"
  17. #include "spirv-tools/libspirv.h"
  18. // Functions
  19. // Grabs the header from the SPIR-V module given in the binary parameter. The
  20. // endian parameter specifies the endianness of the binary module. On success,
  21. // returns SPV_SUCCESS and writes the parsed header into *header.
  22. spv_result_t spvBinaryHeaderGet(const spv_const_binary binary,
  23. const spv_endianness_t endian,
  24. spv_header_t* header);
  25. // Returns the number of non-null characters in str before the first null
  26. // character, or strsz if there is no null character. Examines at most the
  27. // first strsz characters in str. Returns 0 if str is nullptr. This is a
  28. // replacement for C11's strnlen_s which might not exist in all environments.
  29. size_t spv_strnlen_s(const char* str, size_t strsz);
  30. #endif // SOURCE_BINARY_H_