glsl: Wrap non-struct buffer types in structs

Use the AddSpirvBlockDecoration transform to do this.

Add expected results for all of the new E2E tests. The arrayLength()
tests all fail as this is not yet implemented for the GLSL
backend. The other tests all pass except two that assign whole structs
to buffers, which is also a pre-existing issue.

Bug: tint:1372
Change-Id: I230197b43a5561e619866419d642ffc1ed085aac
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/76164
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Stephen White <senorblanco@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
James Price
2022-01-19 15:55:56 +00:00
parent 51e55b244e
commit ae8c65620e
30 changed files with 707 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
#include <utility>
#include "src/program_builder.h"
#include "src/transform/add_spirv_block_decoration.h"
#include "src/transform/calculate_array_length.h"
#include "src/transform/canonicalize_entry_point_io.h"
#include "src/transform/decompose_memory_access.h"
@@ -75,6 +76,7 @@ Output Glsl::Run(const Program* in, const DataMap& inputs) {
manager.Add<ExternalTextureTransform>();
manager.Add<PromoteInitializersToConstVar>();
manager.Add<PadArrayElements>();
manager.Add<AddSpirvBlockDecoration>();
// For now, canonicalize to structs for all IO, as in HLSL.
// TODO(senorblanco): we could skip this by accessing global entry point