From d71e80b710f3cd70a28cdee8d8147648e6dcf779 Mon Sep 17 00:00:00 2001 From: David Neto Date: Tue, 21 Jul 2020 17:11:50 +0000 Subject: [PATCH] [spirv-reader] Add README.md Bug: tint:3 Change-Id: Ie711f7bdbb870c9f370ce777653884c5942a0622 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/25260 Reviewed-by: dan sinclair Commit-Queue: dan sinclair --- src/reader/spirv/README.md | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/reader/spirv/README.md diff --git a/src/reader/spirv/README.md b/src/reader/spirv/README.md new file mode 100644 index 0000000000..9d132b04d7 --- /dev/null +++ b/src/reader/spirv/README.md @@ -0,0 +1,39 @@ +# 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