Fix new-style WGSL I/O with OpenGL backend

Fixes issues with OpenGL when using the newer style of WGSL I/O that
relies on function parameters and return values. Also added several
end2end tests to cover different variants of that style of I/O.

BUG: dawn:755
Change-Id: I73b4b07ce924ce22e917bf399be705dc67519037
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/47701
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
Brandon Jones
2021-04-14 16:29:57 +00:00
committed by Commit Bot service account
parent 891ece5d16
commit d798f331a2
2 changed files with 222 additions and 2 deletions

View File

@@ -84,7 +84,14 @@ namespace dawn_native { namespace opengl {
// Tint currently does not support emitting GLSL, so when provided a Tint program need to
// generate SPIRV and SPIRV-Cross reflection data to be used in this backend.
if (GetDevice()->IsToggleEnabled(Toggle::UseTintGenerator)) {
tint::writer::spirv::Generator generator(GetTintProgram());
tint::transform::Manager transformManager;
transformManager.append(std::make_unique<tint::transform::Spirv>());
tint::Program program;
DAWN_TRY_ASSIGN(
program, RunTransforms(&transformManager, GetTintProgram(), CompilationMessages()));
tint::writer::spirv::Generator generator(&program);
if (!generator.Generate()) {
std::ostringstream errorStream;
errorStream << "Generator: " << generator.error() << std::endl;