tree: 90a5703f91c2bee9caa3af49b4cb9bc774b77dc8 [path history] [tgz]
  1. construct.cc
  2. construct.h
  3. entry_point_info.cc
  4. entry_point_info.h
  5. enum_converter.cc
  6. enum_converter.h
  7. enum_converter_test.cc
  8. fail_stream.h
  9. fail_stream_test.cc
  10. function.cc
  11. function.h
  12. function_arithmetic_test.cc
  13. function_bit_test.cc
  14. function_call_test.cc
  15. function_cfg_test.cc
  16. function_composite_test.cc
  17. function_conversion_test.cc
  18. function_decl_test.cc
  19. function_glsl_std_450_test.cc
  20. function_logical_test.cc
  21. function_memory_test.cc
  22. function_misc_test.cc
  23. function_var_test.cc
  24. namer.cc
  25. namer.h
  26. namer_test.cc
  27. parser.cc
  28. parser.h
  29. parser_impl.cc
  30. parser_impl.h
  31. parser_impl_barrier_test.cc
  32. parser_impl_convert_member_decoration_test.cc
  33. parser_impl_convert_type_test.cc
  34. parser_impl_function_decl_test.cc
  35. parser_impl_get_decorations_test.cc
  36. parser_impl_handle_test.cc
  37. parser_impl_import_test.cc
  38. parser_impl_module_var_test.cc
  39. parser_impl_named_types_test.cc
  40. parser_impl_test.cc
  41. parser_impl_test_helper.cc
  42. parser_impl_test_helper.h
  43. parser_impl_user_name_test.cc
  44. parser_test.cc
  45. parser_type.cc
  46. parser_type.h
  47. parser_type_test.cc
  48. README.md
  49. spirv_tools_helpers_test.cc
  50. spirv_tools_helpers_test.h
  51. usage.cc
  52. usage.h
  53. usage_test.cc
src/tint/reader/spirv/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::reader::spirv::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