mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-14 23:56:16 +00:00
writer: Move sanitizers into the backends
Adds a new single-function API for the generators, which applies the sanitizing transform and performs the generation in one step, and returns a result object which contains the generated code and success status/diagnostics. The new APIs take an `Option` structure to control backend-specific generation details (e.g. MSL fixed sample mask). The result objects also provide backend-specific feedback (e.g. whether a UBO of buffer lengths was generated). HLSL needs a list of entry points to validate, and it's the HLSL sanitizer that generates an entry point for programs that do not have one. This change makes the HLSL generator return the list of post-sanitize entry points so that the Tint executable can forward them to the validation code. Change-Id: I2d5aa27fda95d7c50c5bef41e206aee38f2fd2eb Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57101 Auto-Submit: James Price <jrprice@google.com> Kokoro: Kokoro <noreply+kokoro@google.com> Commit-Queue: James Price <jrprice@google.com> Reviewed-by: Ben Clayton <bclayton@chromium.org>
This commit is contained in:
committed by
Tint LUCI CQ
parent
08b0ab9b92
commit
af89c729ed
@@ -144,11 +144,12 @@ let declaration_order_check_3 : i32 = 1;
|
||||
// Regenerate the wgsl for the src program. We use this instead of the
|
||||
// original source so that reformatting doesn't impact the final wgsl
|
||||
// comparison.
|
||||
writer::wgsl::Options options;
|
||||
std::string src_wgsl;
|
||||
{
|
||||
writer::wgsl::Generator src_gen(&src);
|
||||
ASSERT_TRUE(src_gen.Generate()) << src_gen.error();
|
||||
src_wgsl = src_gen.result();
|
||||
auto result = writer::wgsl::Generate(&src, options);
|
||||
ASSERT_TRUE(result.success) << result.error;
|
||||
src_wgsl = result.wgsl;
|
||||
|
||||
// Move the src program to a temporary that'll be dropped, so that the src
|
||||
// program is released before we attempt to print the dst program. This
|
||||
@@ -159,9 +160,9 @@ let declaration_order_check_3 : i32 = 1;
|
||||
}
|
||||
|
||||
// Print the dst module, check it matches the original source
|
||||
writer::wgsl::Generator dst_gen(&dst);
|
||||
ASSERT_TRUE(dst_gen.Generate());
|
||||
auto dst_wgsl = dst_gen.result();
|
||||
auto result = writer::wgsl::Generate(&dst, options);
|
||||
ASSERT_TRUE(result.success);
|
||||
auto dst_wgsl = result.wgsl;
|
||||
ASSERT_EQ(src_wgsl, dst_wgsl);
|
||||
|
||||
#else // #if TINT_BUILD_WGSL_READER && TINT_BUILD_WGSL_WRITER
|
||||
|
||||
Reference in New Issue
Block a user