tree: e5bf2e32b2969f2e259405ba2955370a89ae7add [path history] [tgz]
  1. ast_parser.cc
  2. ast_parser.h
  3. ast_parser_test.cc
  4. attributes.h
  5. barrier_test.cc
  6. constant_test.cc
  7. construct.cc
  8. construct.h
  9. convert_member_decoration_test.cc
  10. convert_type_test.cc
  11. entry_point_info.cc
  12. entry_point_info.h
  13. enum_converter.cc
  14. enum_converter.h
  15. enum_converter_test.cc
  16. fail_stream.h
  17. fail_stream_test.cc
  18. function.cc
  19. function.h
  20. function_arithmetic_test.cc
  21. function_bit_test.cc
  22. function_call_test.cc
  23. function_cfg_test.cc
  24. function_composite_test.cc
  25. function_conversion_test.cc
  26. function_decl_test.cc
  27. function_glsl_std_450_test.cc
  28. function_logical_test.cc
  29. function_memory_test.cc
  30. function_misc_test.cc
  31. function_var_test.cc
  32. get_decorations_test.cc
  33. handle_test.cc
  34. helper_test.cc
  35. helper_test.h
  36. import_test.cc
  37. module_function_decl_test.cc
  38. module_var_test.cc
  39. named_types_test.cc
  40. namer.cc
  41. namer.h
  42. namer_test.cc
  43. parse.cc
  44. parse.h
  45. parser_test.cc
  46. README.md
  47. spirv_tools_helpers_test.cc
  48. spirv_tools_helpers_test.h
  49. type.cc
  50. type.h
  51. type_test.cc
  52. usage.cc
  53. usage.h
  54. usage_test.cc
  55. user_name_test.cc
src/tint/lang/spirv/reader/ast_parser/README.md

SPIR-V Reader

This component translates SPIR-V written for Vulkan into the Tint AST.

The SPIR-V reader entry point is tint::spirv::reader::Read(), which performs the translation of SPIR-V to a tint::Program.

It's usable from the Tint command line:

# Translate SPIR-V into WGSL.
tint --format wgsl a.spv

Supported dialects

The SPIR-V module must pass validation for the Vulkan 1.1 environment in SPIRV-Tools. In particular, SPIR-V 1.4 and later are not supported.

For example, the equivalent of the following must pass:

spirv-val --target-env vulkan1.1 a.spv

Additionally, the reader imposes additional constraints based on:

  • The features supported by WGSL. Some Vulkan features might not be supportable because WebGPU must be portable to other graphics APIs.
  • Limitations of the reader itself. These might be relaxed in the future with extra engineering work.

Feedback

Please file issues at https://crbug.com/tint, and apply label SpirvReader.

Outstanding issues can be found by using the SpirvReader label in the Chromium project's bug tracker: https://bugs.chromium.org/p/tint/issues/list?q=label:SpirvReader