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