tree: f7214d81c219feb79ecc0cdfd6f7317392ef167d [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. import_test.cc
  35. module_function_decl_test.cc
  36. module_var_test.cc
  37. named_types_test.cc
  38. namer.cc
  39. namer.h
  40. namer_test.cc
  41. parser_test.cc
  42. README.md
  43. spirv_tools_helpers_test.cc
  44. spirv_tools_helpers_test.h
  45. test_helper.cc
  46. test_helper.h
  47. type.cc
  48. type.h
  49. type_test.cc
  50. usage.cc
  51. usage.h
  52. usage_test.cc
  53. 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::Parser, which implements the Reader interface in tint::reader::Reader.

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