tint/transform: Implement div / mod polyfill
Prevents UB for divide-by-zero and integer overflow when dividing
Fixed: tint:1349
Change-Id: Ieef66d27d7aec3011628ced076b2bccc7770a8af
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108925
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h
index 2f5b5e0..3d1f40e 100644
--- a/src/tint/program_builder.h
+++ b/src/tint/program_builder.h
@@ -3267,6 +3267,14 @@
//! @cond Doxygen_Suppress
// Various template specializations for ProgramBuilder::TypesBuilder::CToAST.
template <>
+struct ProgramBuilder::TypesBuilder::CToAST<AInt> {
+ static const ast::Type* get(const ProgramBuilder::TypesBuilder*) { return nullptr; }
+};
+template <>
+struct ProgramBuilder::TypesBuilder::CToAST<AFloat> {
+ static const ast::Type* get(const ProgramBuilder::TypesBuilder*) { return nullptr; }
+};
+template <>
struct ProgramBuilder::TypesBuilder::CToAST<i32> {
static const ast::Type* get(const ProgramBuilder::TypesBuilder* t) { return t->i32(); }
};