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