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