tree: b1f4e5fe6c81d323b7736680b7c4a8028b2102e2 [path history] [tgz]
  1. README.md
  2. construct.cc
  3. construct.h
  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_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. spirv_tools_helpers_test.cc
  44. spirv_tools_helpers_test.h
  45. usage.cc
  46. usage.h
  47. 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

Validation

The SPIR-V module must pass validation for the SPV_ENV_WEBGPU_0 target environment in SPIRV-Tools.

That set of rules is experimental and was originally intended to constraint SPIR-V modules being ingested directly by the WebGPU API. Those rules are now too restrictive, because some amount of sanitization and normalization occurs during translation from SPIR-V to WGSL. The validation rules will be relaxed at some point TBD.

Generally, validation of functionality used will remain, e.g. WebGPU currently does not support CullDistance or subgroup operations.

However, detailed rules about the form of SPIR-V can be relaxed, e.g. the requirement to use SPIR-V 1.3, and restrictive rules about statically unreachable code.

Feedback

Please file issues at https://crbug.com/tint, and put spirv-reader in the issue title.

Outstanding issues can be found by using the spirv-reader label in the Chromium project's bug tracker: https://bugs.chromium.org/p/tint/issues/list?q=label:spirv-reader