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

# Dump the Tint AST after reading SPIR-V.
tint --dump-ast --parse-only a.spv

# 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