GLSL: fix arrayLength().
Bug: tint:1222
Change-Id: I6f9576908a41f3b37036ef7afe10cb74a99cd63f
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/79440
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: David Neto <dneto@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/src/transform/glsl.cc b/src/transform/glsl.cc
index 5c24e3a..29b10d4 100644
--- a/src/transform/glsl.cc
+++ b/src/transform/glsl.cc
@@ -20,7 +20,6 @@
#include "src/transform/add_empty_entry_point.h"
#include "src/transform/add_spirv_block_attribute.h"
#include "src/transform/binding_remapper.h"
-#include "src/transform/calculate_array_length.h"
#include "src/transform/canonicalize_entry_point_io.h"
#include "src/transform/combine_samplers.h"
#include "src/transform/decompose_memory_access.h"
@@ -86,7 +85,6 @@
BindingRemapper::AccessControls ac;
data.Add<BindingRemapper::Remappings>(bp, ac, /* mayCollide */ true);
}
- manager.Add<CalculateArrayLength>();
manager.Add<ExternalTextureTransform>();
data.Add<PromoteSideEffectsToDecl::Config>(
diff --git a/src/writer/glsl/generator_impl.cc b/src/writer/glsl/generator_impl.cc
index c982ffe..3215086 100644
--- a/src/writer/glsl/generator_impl.cc
+++ b/src/writer/glsl/generator_impl.cc
@@ -44,7 +44,6 @@
#include "src/sem/type_constructor.h"
#include "src/sem/type_conversion.h"
#include "src/sem/variable.h"
-#include "src/transform/calculate_array_length.h"
#include "src/transform/glsl.h"
#include "src/utils/defer.h"
#include "src/utils/map.h"
@@ -467,8 +466,8 @@
auto* call = builder_.Sem().Get(expr);
auto* target = call->Target();
- if (auto* func = target->As<sem::Function>()) {
- return EmitFunctionCall(out, call, func);
+ if (target->Is<sem::Function>()) {
+ return EmitFunctionCall(out, call);
}
if (auto* builtin = target->As<sem::Builtin>()) {
return EmitBuiltinCall(out, call, builtin);
@@ -484,9 +483,7 @@
return false;
}
-bool GeneratorImpl::EmitFunctionCall(std::ostream& out,
- const sem::Call* call,
- const sem::Function* func) {
+bool GeneratorImpl::EmitFunctionCall(std::ostream& out, const sem::Call* call) {
const auto& args = call->Arguments();
auto* decl = call->Declaration();
auto* ident = decl->target.name;
@@ -494,21 +491,6 @@
auto name = builder_.Symbols().NameFor(ident->symbol);
auto caller_sym = ident->symbol;
- if (ast::HasAttribute<transform::CalculateArrayLength::BufferSizeIntrinsic>(
- func->Declaration()->attributes)) {
- // Special function generated by the CalculateArrayLength transform for
- // calling X.GetDimensions(Y)
- if (!EmitExpression(out, args[0]->Declaration())) {
- return false;
- }
- out << ".GetDimensions(";
- if (!EmitExpression(out, args[1]->Declaration())) {
- return false;
- }
- out << ")";
- return true;
- }
-
out << name << "(";
bool first = true;
@@ -555,6 +537,9 @@
if (builtin->Type() == sem::BuiltinType::kRadians) {
return EmitRadiansCall(out, expr, builtin);
}
+ if (builtin->Type() == sem::BuiltinType::kArrayLength) {
+ return EmitArrayLength(out, expr);
+ }
if (builtin->IsDataPacking()) {
return EmitDataPackingCall(out, expr, builtin);
}
@@ -754,6 +739,16 @@
return false;
}
+bool GeneratorImpl::EmitArrayLength(std::ostream& out,
+ const ast::CallExpression* expr) {
+ out << "uint(";
+ if (!EmitExpression(out, expr->args[0])) {
+ return false;
+ }
+ out << ".length())";
+ return true;
+}
+
bool GeneratorImpl::EmitSelectCall(std::ostream& out,
const ast::CallExpression* expr) {
auto* expr_false = expr->args[0];
diff --git a/src/writer/glsl/generator_impl.h b/src/writer/glsl/generator_impl.h
index 92667d1..3f71501 100644
--- a/src/writer/glsl/generator_impl.h
+++ b/src/writer/glsl/generator_impl.h
@@ -111,11 +111,8 @@
/// Handles generating a function call expression
/// @param out the output of the expression stream
/// @param call the call expression
- /// @param function the function being called
/// @returns true if the expression is emitted
- bool EmitFunctionCall(std::ostream& out,
- const sem::Call* call,
- const sem::Function* function);
+ bool EmitFunctionCall(std::ostream& out, const sem::Call* call);
/// Handles generating a builtin call expression
/// @param out the output of the expression stream
/// @param call the call expression
@@ -162,6 +159,11 @@
bool EmitWorkgroupAtomicCall(std::ostream& out,
const ast::CallExpression* expr,
const sem::Builtin* builtin);
+ /// Handles generating an array.length() call
+ /// @param out the output of the expression stream
+ /// @param expr the call expression
+ /// @returns true if the array length expression is emitted
+ bool EmitArrayLength(std::ostream& out, const ast::CallExpression* expr);
/// Handles generating a call to a texture function (`textureSample`,
/// `textureSampleGrad`, etc)
/// @param out the output of the expression stream
diff --git a/src/writer/glsl/generator_impl_sanitizer_test.cc b/src/writer/glsl/generator_impl_sanitizer_test.cc
index 2b663d1..0329bc0 100644
--- a/src/writer/glsl/generator_impl_sanitizer_test.cc
+++ b/src/writer/glsl/generator_impl_sanitizer_test.cc
@@ -55,10 +55,7 @@
float a[];
} b;
void a_func() {
- uint tint_symbol_1 = 0u;
- b.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint len = tint_symbol_2;
+ uint len = uint(b.a.length());
}
void main() {
@@ -104,10 +101,7 @@
float a[];
} b;
void a_func() {
- uint tint_symbol_1 = 0u;
- b.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 4u) / 4u);
- uint len = tint_symbol_2;
+ uint len = uint(b.a.length());
}
void main() {
@@ -154,10 +148,7 @@
float a[];
} b;
void a_func() {
- uint tint_symbol_1 = 0u;
- b.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint len = tint_symbol_2;
+ uint len = uint(b.a.length());
}
void main() {
diff --git a/test/bug/chromium/1290107.wgsl.expected.glsl b/test/bug/chromium/1290107.wgsl.expected.glsl
index a68fe94..c60fe6c 100644
--- a/test/bug/chromium/1290107.wgsl.expected.glsl
+++ b/test/bug/chromium/1290107.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -11,10 +9,7 @@
S inner[];
} arr;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- arr.inner.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = (tint_symbol_2 / 4u);
- uint len = tint_symbol_3;
+ uint len = uint(arr.inner.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -22,10 +17,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:13: '.' : cannot apply to an array: GetDimensions
-ERROR: 0:13: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/arrayLength/complex_via_let.wgsl.expected.glsl b/test/builtins/arrayLength/complex_via_let.wgsl.expected.glsl
index 6f43d16..e2d85d0 100644
--- a/test/builtins/arrayLength/complex_via_let.wgsl.expected.glsl
+++ b/test/builtins/arrayLength/complex_via_let.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int a[];
} G;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- G.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
- uint l1 = tint_symbol_3;
+ uint l1 = uint(G.a.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -18,10 +13,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.glsl b/test/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.glsl
index 2df0269..f962064 100644
--- a/test/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.glsl
+++ b/test/builtins/arrayLength/complex_via_let_no_struct.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int inner[];
} G;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- G.inner.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = (tint_symbol_2 / 4u);
- uint l1 = tint_symbol_3;
+ uint l1 = uint(G.inner.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -18,10 +13,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: '.' : cannot apply to an array: GetDimensions
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/arrayLength/deprecated.wgsl.expected.glsl b/test/builtins/arrayLength/deprecated.wgsl.expected.glsl
index d447f38..c45f59b 100644
--- a/test/builtins/arrayLength/deprecated.wgsl.expected.glsl
+++ b/test/builtins/arrayLength/deprecated.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,11 +5,8 @@
int a[];
} G;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- G.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
- uint l1 = tint_symbol_3;
- uint l2 = tint_symbol_3;
+ uint l1 = uint(G.a.length());
+ uint l2 = uint(G.a.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -19,10 +14,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/arrayLength/simple.wgsl.expected.glsl b/test/builtins/arrayLength/simple.wgsl.expected.glsl
index 6f43d16..e2d85d0 100644
--- a/test/builtins/arrayLength/simple.wgsl.expected.glsl
+++ b/test/builtins/arrayLength/simple.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int a[];
} G;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- G.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
- uint l1 = tint_symbol_3;
+ uint l1 = uint(G.a.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -18,10 +13,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/arrayLength/simple_no_struct.wgsl.expected.glsl b/test/builtins/arrayLength/simple_no_struct.wgsl.expected.glsl
index 2df0269..f962064 100644
--- a/test/builtins/arrayLength/simple_no_struct.wgsl.expected.glsl
+++ b/test/builtins/arrayLength/simple_no_struct.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int inner[];
} G;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- G.inner.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = (tint_symbol_2 / 4u);
- uint l1 = tint_symbol_3;
+ uint l1 = uint(G.inner.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -18,10 +13,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: '.' : cannot apply to an array: GetDimensions
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/arrayLength/via_let.wgsl.expected.glsl b/test/builtins/arrayLength/via_let.wgsl.expected.glsl
index 6f43d16..e2d85d0 100644
--- a/test/builtins/arrayLength/via_let.wgsl.expected.glsl
+++ b/test/builtins/arrayLength/via_let.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int a[];
} G;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- G.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
- uint l1 = tint_symbol_3;
+ uint l1 = uint(G.a.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -18,10 +13,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/arrayLength/via_let_complex.wgsl.expected.glsl b/test/builtins/arrayLength/via_let_complex.wgsl.expected.glsl
index 6f43d16..e2d85d0 100644
--- a/test/builtins/arrayLength/via_let_complex.wgsl.expected.glsl
+++ b/test/builtins/arrayLength/via_let_complex.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int a[];
} G;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- G.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = ((tint_symbol_2 - 0u) / 4u);
- uint l1 = tint_symbol_3;
+ uint l1 = uint(G.a.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -18,10 +13,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.glsl b/test/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.glsl
index 2df0269..f962064 100644
--- a/test/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.glsl
+++ b/test/builtins/arrayLength/via_let_complex_no_struct.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int inner[];
} G;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- G.inner.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = (tint_symbol_2 / 4u);
- uint l1 = tint_symbol_3;
+ uint l1 = uint(G.inner.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -18,10 +13,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: '.' : cannot apply to an array: GetDimensions
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/arrayLength/via_let_no_struct.wgsl.expected.glsl b/test/builtins/arrayLength/via_let_no_struct.wgsl.expected.glsl
index 2df0269..f962064 100644
--- a/test/builtins/arrayLength/via_let_no_struct.wgsl.expected.glsl
+++ b/test/builtins/arrayLength/via_let_no_struct.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int inner[];
} G;
void tint_symbol() {
- uint tint_symbol_2 = 0u;
- G.inner.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = (tint_symbol_2 / 4u);
- uint l1 = tint_symbol_3;
+ uint l1 = uint(G.inner.length());
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -18,10 +13,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: '.' : cannot apply to an array: GetDimensions
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/arrayLength/1588cd.wgsl.expected.glsl b/test/builtins/gen/arrayLength/1588cd.wgsl.expected.glsl
index af7a607..6c55ac3 100644
--- a/test/builtins/gen/arrayLength/1588cd.wgsl.expected.glsl
+++ b/test/builtins/gen/arrayLength/1588cd.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int arg_0[];
} sb_ro;
void arrayLength_1588cd() {
- uint tint_symbol_1 = 0u;
- sb_ro.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_ro.arg_0.length());
}
vec4 vertex_main() {
@@ -25,13 +20,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -39,10 +27,7 @@
int arg_0[];
} sb_ro;
void arrayLength_1588cd() {
- uint tint_symbol_1 = 0u;
- sb_ro.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_ro.arg_0.length());
}
void fragment_main() {
@@ -53,13 +38,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -67,10 +45,7 @@
int arg_0[];
} sb_ro;
void arrayLength_1588cd() {
- uint tint_symbol_1 = 0u;
- sb_ro.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_ro.arg_0.length());
}
void compute_main() {
@@ -82,10 +57,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/arrayLength/61b1c7.wgsl.expected.glsl b/test/builtins/gen/arrayLength/61b1c7.wgsl.expected.glsl
index c8e824f..a5d0229 100644
--- a/test/builtins/gen/arrayLength/61b1c7.wgsl.expected.glsl
+++ b/test/builtins/gen/arrayLength/61b1c7.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
int arg_0[];
} sb_rw;
void arrayLength_61b1c7() {
- uint tint_symbol_1 = 0u;
- sb_rw.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_rw.arg_0.length());
}
vec4 vertex_main() {
@@ -25,13 +20,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -39,10 +27,7 @@
int arg_0[];
} sb_rw;
void arrayLength_61b1c7() {
- uint tint_symbol_1 = 0u;
- sb_rw.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_rw.arg_0.length());
}
void fragment_main() {
@@ -53,13 +38,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -67,10 +45,7 @@
int arg_0[];
} sb_rw;
void arrayLength_61b1c7() {
- uint tint_symbol_1 = 0u;
- sb_rw.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_rw.arg_0.length());
}
void compute_main() {
@@ -82,10 +57,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/arrayLength/a0f5ca.wgsl.expected.glsl b/test/builtins/gen/arrayLength/a0f5ca.wgsl.expected.glsl
index 730e08d..d0bf4a5 100644
--- a/test/builtins/gen/arrayLength/a0f5ca.wgsl.expected.glsl
+++ b/test/builtins/gen/arrayLength/a0f5ca.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
float arg_0[];
} sb_ro;
void arrayLength_a0f5ca() {
- uint tint_symbol_1 = 0u;
- sb_ro.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_ro.arg_0.length());
}
vec4 vertex_main() {
@@ -25,13 +20,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -39,10 +27,7 @@
float arg_0[];
} sb_ro;
void arrayLength_a0f5ca() {
- uint tint_symbol_1 = 0u;
- sb_ro.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_ro.arg_0.length());
}
void fragment_main() {
@@ -53,13 +38,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -67,10 +45,7 @@
float arg_0[];
} sb_ro;
void arrayLength_a0f5ca() {
- uint tint_symbol_1 = 0u;
- sb_ro.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_ro.arg_0.length());
}
void compute_main() {
@@ -82,10 +57,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/arrayLength/cdd123.wgsl.expected.glsl b/test/builtins/gen/arrayLength/cdd123.wgsl.expected.glsl
index 3367d5b..92e73df 100644
--- a/test/builtins/gen/arrayLength/cdd123.wgsl.expected.glsl
+++ b/test/builtins/gen/arrayLength/cdd123.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
float arg_0[];
} sb_rw;
void arrayLength_cdd123() {
- uint tint_symbol_1 = 0u;
- sb_rw.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_rw.arg_0.length());
}
vec4 vertex_main() {
@@ -25,13 +20,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -39,10 +27,7 @@
float arg_0[];
} sb_rw;
void arrayLength_cdd123() {
- uint tint_symbol_1 = 0u;
- sb_rw.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_rw.arg_0.length());
}
void fragment_main() {
@@ -53,13 +38,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -67,10 +45,7 @@
float arg_0[];
} sb_rw;
void arrayLength_cdd123() {
- uint tint_symbol_1 = 0u;
- sb_rw.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_rw.arg_0.length());
}
void compute_main() {
@@ -82,10 +57,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/arrayLength/cfca0a.wgsl.expected.glsl b/test/builtins/gen/arrayLength/cfca0a.wgsl.expected.glsl
index 55bfb57..99cab31 100644
--- a/test/builtins/gen/arrayLength/cfca0a.wgsl.expected.glsl
+++ b/test/builtins/gen/arrayLength/cfca0a.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
uint arg_0[];
} sb_ro;
void arrayLength_cfca0a() {
- uint tint_symbol_1 = 0u;
- sb_ro.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_ro.arg_0.length());
}
vec4 vertex_main() {
@@ -25,13 +20,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -39,10 +27,7 @@
uint arg_0[];
} sb_ro;
void arrayLength_cfca0a() {
- uint tint_symbol_1 = 0u;
- sb_ro.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_ro.arg_0.length());
}
void fragment_main() {
@@ -53,13 +38,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -67,10 +45,7 @@
uint arg_0[];
} sb_ro;
void arrayLength_cfca0a() {
- uint tint_symbol_1 = 0u;
- sb_ro.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_ro.arg_0.length());
}
void compute_main() {
@@ -82,10 +57,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/arrayLength/eb510f.wgsl.expected.glsl b/test/builtins/gen/arrayLength/eb510f.wgsl.expected.glsl
index e48d0cf..52cd14e 100644
--- a/test/builtins/gen/arrayLength/eb510f.wgsl.expected.glsl
+++ b/test/builtins/gen/arrayLength/eb510f.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
precision mediump float;
@@ -7,10 +5,7 @@
uint arg_0[];
} sb_rw;
void arrayLength_eb510f() {
- uint tint_symbol_1 = 0u;
- sb_rw.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_rw.arg_0.length());
}
vec4 vertex_main() {
@@ -25,13 +20,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -39,10 +27,7 @@
uint arg_0[];
} sb_rw;
void arrayLength_eb510f() {
- uint tint_symbol_1 = 0u;
- sb_rw.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_rw.arg_0.length());
}
void fragment_main() {
@@ -53,13 +38,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -67,10 +45,7 @@
uint arg_0[];
} sb_rw;
void arrayLength_eb510f() {
- uint tint_symbol_1 = 0u;
- sb_rw.GetDimensions(tint_symbol_1);
- uint tint_symbol_2 = ((tint_symbol_1 - 0u) / 4u);
- uint res = tint_symbol_2;
+ uint res = uint(sb_rw.arg_0.length());
}
void compute_main() {
@@ -82,10 +57,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'GetDimensions' : no such field in structure
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.glsl
index 2e8e85b..644c948 100644
--- a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.glsl
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromAccessChain.spvasm.expected.glsl
@@ -13,10 +13,7 @@
uint rtarr[];
} myvar;
void main_1() {
- uint tint_symbol_2 = 0u;
- myvar.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = ((tint_symbol_2 - 4u) / 4u);
- uint x_1 = tint_symbol_3;
+ uint x_1 = uint(myvar.rtarr.length());
return;
}
diff --git a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.glsl b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.glsl
index 2e8e85b..644c948 100644
--- a/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.glsl
+++ b/test/unittest/reader/spirv/SpvParserMemoryTest_ArrayLength_FromVar.spvasm.expected.glsl
@@ -13,10 +13,7 @@
uint rtarr[];
} myvar;
void main_1() {
- uint tint_symbol_2 = 0u;
- myvar.GetDimensions(tint_symbol_2);
- uint tint_symbol_3 = ((tint_symbol_2 - 4u) / 4u);
- uint x_1 = tint_symbol_3;
+ uint x_1 = uint(myvar.rtarr.length());
return;
}