GLSL: fix frexp and modf builtins.
These still had vestiges of HLSL.
Bug: tint:1222
Change-Id: I5f93f75e7384db641f0c5421dca24a3e8f2b716e
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/80140
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Stephen White <senorblanco@chromium.org>
diff --git a/src/writer/glsl/generator_impl.cc b/src/writer/glsl/generator_impl.cc
index 4f4a477..5cd4bdc 100644
--- a/src/writer/glsl/generator_impl.cc
+++ b/src/writer/glsl/generator_impl.cc
@@ -865,14 +865,6 @@
return CallBuiltinHelper(
out, expr, builtin,
[&](TextBuffer* b, const std::vector<std::string>& params) {
- auto* ty = builtin->Parameters()[0]->Type();
- auto in = params[0];
-
- std::string width;
- if (auto* vec = ty->As<sem::Vector>()) {
- width = std::to_string(vec->Width());
- }
-
// Emit the builtin return type unique to this overload. This does not
// exist in the AST, so it will not be generated in Generate().
if (!EmitStructType(&helpers_,
@@ -880,16 +872,15 @@
return false;
}
- line(b) << "float" << width << " whole;";
- line(b) << "float" << width << " fract = modf(" << in << ", whole);";
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), ast::StorageClass::kNone,
ast::Access::kUndefined, "")) {
return false;
}
- l << " result = {fract, whole};";
+ l << " result;";
}
+ line(b) << "result.fract = modf(" << params[0] << ", result.whole);";
line(b) << "return result;";
return true;
});
@@ -915,14 +906,6 @@
return CallBuiltinHelper(
out, expr, builtin,
[&](TextBuffer* b, const std::vector<std::string>& params) {
- auto* ty = builtin->Parameters()[0]->Type();
- auto in = params[0];
-
- std::string width;
- if (auto* vec = ty->As<sem::Vector>()) {
- width = std::to_string(vec->Width());
- }
-
// Emit the builtin return type unique to this overload. This does not
// exist in the AST, so it will not be generated in Generate().
if (!EmitStructType(&helpers_,
@@ -930,16 +913,15 @@
return false;
}
- line(b) << "float" << width << " exp;";
- line(b) << "float" << width << " sig = frexp(" << in << ", exp);";
{
auto l = line(b);
if (!EmitType(l, builtin->ReturnType(), ast::StorageClass::kNone,
ast::Access::kUndefined, "")) {
return false;
}
- l << " result = {sig, int" << width << "(exp)};";
+ l << " result;";
}
+ line(b) << "result.sig = frexp(" << params[0] << ", result.exp);";
line(b) << "return result;";
return true;
});
diff --git a/src/writer/glsl/generator_impl_builtin_test.cc b/src/writer/glsl/generator_impl_builtin_test.cc
index 5888872..bac0b61 100644
--- a/src/writer/glsl/generator_impl_builtin_test.cc
+++ b/src/writer/glsl/generator_impl_builtin_test.cc
@@ -290,61 +290,132 @@
EXPECT_EQ(out.str(), "(bvec2(true, false) ? ivec2(3, 4) : ivec2(1, 2))");
}
-#if 0
TEST_F(GlslGeneratorImplTest_Builtin, Modf_Scalar) {
- auto* res = Var("res", ty.f32());
- auto* call = Call("modf", 1.0f, AddressOf(res));
- WrapInFunction(res, call);
+ auto* call = Call("modf", 1.0f);
+ WrapInFunction(CallStmt(call));
GeneratorImpl& gen = SanitizeAndBuild();
ASSERT_TRUE(gen.Generate()) << gen.error();
- EXPECT_THAT(gen.result(), HasSubstr("modf(1.0f, res)"));
+ EXPECT_EQ(gen.result(), R"(#version 310 es
+
+struct modf_result {
+ float fract;
+ float whole;
+};
+
+modf_result tint_modf(float param_0) {
+ modf_result result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void test_function() {
+ tint_modf(1.0f);
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ test_function();
+ return;
+}
+)");
}
TEST_F(GlslGeneratorImplTest_Builtin, Modf_Vector) {
- auto* res = Var("res", ty.vec3<f32>());
- auto* call = Call("modf", vec3<f32>(), AddressOf(res));
- WrapInFunction(res, call);
+ auto* call = Call("modf", vec3<f32>());
+ WrapInFunction(CallStmt(call));
GeneratorImpl& gen = SanitizeAndBuild();
ASSERT_TRUE(gen.Generate()) << gen.error();
- EXPECT_THAT(gen.result(), HasSubstr("modf(vec3(0.0f, 0.0f, 0.0f), res)"));
+ EXPECT_EQ(gen.result(), R"(#version 310 es
+
+struct modf_result_vec3 {
+ vec3 fract;
+ vec3 whole;
+};
+
+modf_result_vec3 tint_modf(vec3 param_0) {
+ modf_result_vec3 result;
+ result.fract = modf(param_0, result.whole);
+ return result;
+}
+
+
+void test_function() {
+ tint_modf(vec3(0.0f, 0.0f, 0.0f));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ test_function();
+ return;
+}
+)");
}
TEST_F(GlslGeneratorImplTest_Builtin, Frexp_Scalar_i32) {
- auto* exp = Var("exp", ty.i32());
- auto* call = Call("frexp", 1.0f, AddressOf(exp));
- WrapInFunction(exp, call);
+ auto* call = Call("frexp", 1.0f);
+ WrapInFunction(CallStmt(call));
GeneratorImpl& gen = SanitizeAndBuild();
ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_THAT(gen.result(), HasSubstr(R"(
- float tint_tmp;
- float tint_tmp_1 = frexp(1.0f, tint_tmp);
- exp = int(tint_tmp);
- tint_tmp_1;
+ float sig;
+ int exp;
+};
+
+frexp_result tint_frexp(float param_0) {
+ frexp_result result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void test_function() {
+ tint_frexp(1.0f);
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
)"));
}
TEST_F(GlslGeneratorImplTest_Builtin, Frexp_Vector_i32) {
- auto* res = Var("res", ty.vec3<i32>());
- auto* call = Call("frexp", vec3<f32>(), AddressOf(res));
- WrapInFunction(res, call);
+ auto* call = Call("frexp", vec3<f32>());
+ WrapInFunction(CallStmt(call));
GeneratorImpl& gen = SanitizeAndBuild();
ASSERT_TRUE(gen.Generate()) << gen.error();
EXPECT_THAT(gen.result(), HasSubstr(R"(
- vec3 tint_tmp;
- vec3 tint_tmp_1 = frexp(vec3(0.0f, 0.0f, 0.0f), tint_tmp);
- res = ivec3(tint_tmp);
- tint_tmp_1;
+
+struct frexp_result_vec3 {
+ vec3 sig;
+ ivec3 exp;
+};
+
+frexp_result_vec3 tint_frexp(vec3 param_0) {
+ frexp_result_vec3 result;
+ result.sig = frexp(param_0, result.exp);
+ return result;
+}
+
+
+void test_function() {
+ tint_frexp(vec3(0.0f, 0.0f, 0.0f));
+}
+
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+ test_function();
+ return;
)"));
}
+#if 0
TEST_F(GlslGeneratorImplTest_Builtin, IsNormal_Scalar) {
auto* val = Var("val", ty.f32());
auto* call = Call("isNormal", val);
diff --git a/test/bug/chromium/1236161.wgsl.expected.glsl b/test/bug/chromium/1236161.wgsl.expected.glsl
index f99eeaf..a7666fb 100644
--- a/test/bug/chromium/1236161.wgsl.expected.glsl
+++ b/test/bug/chromium/1236161.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct modf_result {
@@ -8,9 +6,8 @@
};
modf_result tint_modf(float param_0) {
- float whole;
- float fract = modf(param_0, whole);
- modf_result result = {fract, whole};
+ modf_result result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -23,10 +20,3 @@
float tint_symbol_1 = tint_modf(1.0f).whole;
}
-Error parsing GLSL shader:
-ERROR: 0:11: '{ } style initializers' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/frexp.wgsl.expected.glsl b/test/builtins/frexp.wgsl.expected.glsl
index 58191f0..3e0135f 100644
--- a/test/builtins/frexp.wgsl.expected.glsl
+++ b/test/builtins/frexp.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct frexp_result {
@@ -8,9 +6,8 @@
};
frexp_result tint_frexp(float param_0) {
- float exp;
- float sig = frexp(param_0, exp);
- frexp_result result = {sig, int(exp)};
+ frexp_result result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -26,10 +23,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:10: 'frexp' : no matching overloaded function found
-ERROR: 0:10: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/frexp/368997.wgsl.expected.glsl b/test/builtins/gen/frexp/368997.wgsl.expected.glsl
index 93b9879..c2e4d77 100644
--- a/test/builtins/gen/frexp/368997.wgsl.expected.glsl
+++ b/test/builtins/gen/frexp/368997.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct frexp_result_vec3 {
@@ -8,9 +6,8 @@
};
frexp_result_vec3 tint_frexp(vec3 param_0) {
- float3 exp;
- float3 sig = frexp(param_0, exp);
- frexp_result_vec3 result = {sig, int3(exp)};
+ frexp_result_vec3 result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -31,13 +28,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float3' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -47,9 +37,8 @@
};
frexp_result_vec3 tint_frexp(vec3 param_0) {
- float3 exp;
- float3 sig = frexp(param_0, exp);
- frexp_result_vec3 result = {sig, int3(exp)};
+ frexp_result_vec3 result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -66,13 +55,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:10: 'float3' : undeclared identifier
-ERROR: 0:10: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
struct frexp_result_vec3 {
@@ -81,9 +63,8 @@
};
frexp_result_vec3 tint_frexp(vec3 param_0) {
- float3 exp;
- float3 sig = frexp(param_0, exp);
- frexp_result_vec3 result = {sig, int3(exp)};
+ frexp_result_vec3 result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -101,10 +82,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float3' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/frexp/3c4f48.wgsl.expected.glsl b/test/builtins/gen/frexp/3c4f48.wgsl.expected.glsl
index d17806d..b2b3ee5 100644
--- a/test/builtins/gen/frexp/3c4f48.wgsl.expected.glsl
+++ b/test/builtins/gen/frexp/3c4f48.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct frexp_result_vec4 {
@@ -8,9 +6,8 @@
};
frexp_result_vec4 tint_frexp(vec4 param_0) {
- float4 exp;
- float4 sig = frexp(param_0, exp);
- frexp_result_vec4 result = {sig, int4(exp)};
+ frexp_result_vec4 result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -31,13 +28,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float4' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -47,9 +37,8 @@
};
frexp_result_vec4 tint_frexp(vec4 param_0) {
- float4 exp;
- float4 sig = frexp(param_0, exp);
- frexp_result_vec4 result = {sig, int4(exp)};
+ frexp_result_vec4 result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -66,13 +55,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:10: 'float4' : undeclared identifier
-ERROR: 0:10: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
struct frexp_result_vec4 {
@@ -81,9 +63,8 @@
};
frexp_result_vec4 tint_frexp(vec4 param_0) {
- float4 exp;
- float4 sig = frexp(param_0, exp);
- frexp_result_vec4 result = {sig, int4(exp)};
+ frexp_result_vec4 result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -101,10 +82,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float4' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/frexp/4bdfc7.wgsl.expected.glsl b/test/builtins/gen/frexp/4bdfc7.wgsl.expected.glsl
index f336b48..ba983f9 100644
--- a/test/builtins/gen/frexp/4bdfc7.wgsl.expected.glsl
+++ b/test/builtins/gen/frexp/4bdfc7.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct frexp_result_vec2 {
@@ -8,9 +6,8 @@
};
frexp_result_vec2 tint_frexp(vec2 param_0) {
- float2 exp;
- float2 sig = frexp(param_0, exp);
- frexp_result_vec2 result = {sig, int2(exp)};
+ frexp_result_vec2 result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -31,13 +28,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float2' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -47,9 +37,8 @@
};
frexp_result_vec2 tint_frexp(vec2 param_0) {
- float2 exp;
- float2 sig = frexp(param_0, exp);
- frexp_result_vec2 result = {sig, int2(exp)};
+ frexp_result_vec2 result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -66,13 +55,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:10: 'float2' : undeclared identifier
-ERROR: 0:10: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
struct frexp_result_vec2 {
@@ -81,9 +63,8 @@
};
frexp_result_vec2 tint_frexp(vec2 param_0) {
- float2 exp;
- float2 sig = frexp(param_0, exp);
- frexp_result_vec2 result = {sig, int2(exp)};
+ frexp_result_vec2 result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -101,10 +82,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float2' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/frexp/eabd40.wgsl.expected.glsl b/test/builtins/gen/frexp/eabd40.wgsl.expected.glsl
index e5f44f6..4547f79 100644
--- a/test/builtins/gen/frexp/eabd40.wgsl.expected.glsl
+++ b/test/builtins/gen/frexp/eabd40.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct frexp_result {
@@ -8,9 +6,8 @@
};
frexp_result tint_frexp(float param_0) {
- float exp;
- float sig = frexp(param_0, exp);
- frexp_result result = {sig, int(exp)};
+ frexp_result result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -31,13 +28,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:10: 'frexp' : no matching overloaded function found
-ERROR: 0:10: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -47,9 +37,8 @@
};
frexp_result tint_frexp(float param_0) {
- float exp;
- float sig = frexp(param_0, exp);
- frexp_result result = {sig, int(exp)};
+ frexp_result result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -66,13 +55,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:11: 'frexp' : no matching overloaded function found
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
struct frexp_result {
@@ -81,9 +63,8 @@
};
frexp_result tint_frexp(float param_0) {
- float exp;
- float sig = frexp(param_0, exp);
- frexp_result result = {sig, int(exp)};
+ frexp_result result;
+ result.sig = frexp(param_0, result.exp);
return result;
}
@@ -101,10 +82,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:10: 'frexp' : no matching overloaded function found
-ERROR: 0:10: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/modf/180fed.wgsl.expected.glsl b/test/builtins/gen/modf/180fed.wgsl.expected.glsl
index e99661d..3e2593e 100644
--- a/test/builtins/gen/modf/180fed.wgsl.expected.glsl
+++ b/test/builtins/gen/modf/180fed.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct modf_result {
@@ -8,9 +6,8 @@
};
modf_result tint_modf(float param_0) {
- float whole;
- float fract = modf(param_0, whole);
- modf_result result = {fract, whole};
+ modf_result result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -31,13 +28,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:11: '{ } style initializers' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -47,9 +37,8 @@
};
modf_result tint_modf(float param_0) {
- float whole;
- float fract = modf(param_0, whole);
- modf_result result = {fract, whole};
+ modf_result result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -66,13 +55,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:12: '{ } style initializers' : not supported with this profile: es
-ERROR: 0:12: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
struct modf_result {
@@ -81,9 +63,8 @@
};
modf_result tint_modf(float param_0) {
- float whole;
- float fract = modf(param_0, whole);
- modf_result result = {fract, whole};
+ modf_result result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -101,10 +82,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:11: '{ } style initializers' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/modf/9b75f7.wgsl.expected.glsl b/test/builtins/gen/modf/9b75f7.wgsl.expected.glsl
index 9280f97..20e0358 100644
--- a/test/builtins/gen/modf/9b75f7.wgsl.expected.glsl
+++ b/test/builtins/gen/modf/9b75f7.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct modf_result_vec3 {
@@ -8,9 +6,8 @@
};
modf_result_vec3 tint_modf(vec3 param_0) {
- float3 whole;
- float3 fract = modf(param_0, whole);
- modf_result_vec3 result = {fract, whole};
+ modf_result_vec3 result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -31,13 +28,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float3' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -47,9 +37,8 @@
};
modf_result_vec3 tint_modf(vec3 param_0) {
- float3 whole;
- float3 fract = modf(param_0, whole);
- modf_result_vec3 result = {fract, whole};
+ modf_result_vec3 result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -66,13 +55,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:10: 'float3' : undeclared identifier
-ERROR: 0:10: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
struct modf_result_vec3 {
@@ -81,9 +63,8 @@
};
modf_result_vec3 tint_modf(vec3 param_0) {
- float3 whole;
- float3 fract = modf(param_0, whole);
- modf_result_vec3 result = {fract, whole};
+ modf_result_vec3 result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -101,10 +82,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float3' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/modf/ec2dbc.wgsl.expected.glsl b/test/builtins/gen/modf/ec2dbc.wgsl.expected.glsl
index eda1680..285e682 100644
--- a/test/builtins/gen/modf/ec2dbc.wgsl.expected.glsl
+++ b/test/builtins/gen/modf/ec2dbc.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct modf_result_vec4 {
@@ -8,9 +6,8 @@
};
modf_result_vec4 tint_modf(vec4 param_0) {
- float4 whole;
- float4 fract = modf(param_0, whole);
- modf_result_vec4 result = {fract, whole};
+ modf_result_vec4 result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -31,13 +28,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float4' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -47,9 +37,8 @@
};
modf_result_vec4 tint_modf(vec4 param_0) {
- float4 whole;
- float4 fract = modf(param_0, whole);
- modf_result_vec4 result = {fract, whole};
+ modf_result_vec4 result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -66,13 +55,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:10: 'float4' : undeclared identifier
-ERROR: 0:10: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
struct modf_result_vec4 {
@@ -81,9 +63,8 @@
};
modf_result_vec4 tint_modf(vec4 param_0) {
- float4 whole;
- float4 fract = modf(param_0, whole);
- modf_result_vec4 result = {fract, whole};
+ modf_result_vec4 result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -101,10 +82,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float4' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/gen/modf/f5f20d.wgsl.expected.glsl b/test/builtins/gen/modf/f5f20d.wgsl.expected.glsl
index 0e7f161..e237e87 100644
--- a/test/builtins/gen/modf/f5f20d.wgsl.expected.glsl
+++ b/test/builtins/gen/modf/f5f20d.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct modf_result_vec2 {
@@ -8,9 +6,8 @@
};
modf_result_vec2 tint_modf(vec2 param_0) {
- float2 whole;
- float2 fract = modf(param_0, whole);
- modf_result_vec2 result = {fract, whole};
+ modf_result_vec2 result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -31,13 +28,6 @@
gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float2' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
precision mediump float;
@@ -47,9 +37,8 @@
};
modf_result_vec2 tint_modf(vec2 param_0) {
- float2 whole;
- float2 fract = modf(param_0, whole);
- modf_result_vec2 result = {fract, whole};
+ modf_result_vec2 result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -66,13 +55,6 @@
fragment_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:10: 'float2' : undeclared identifier
-ERROR: 0:10: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
#version 310 es
struct modf_result_vec2 {
@@ -81,9 +63,8 @@
};
modf_result_vec2 tint_modf(vec2 param_0) {
- float2 whole;
- float2 fract = modf(param_0, whole);
- modf_result_vec2 result = {fract, whole};
+ modf_result_vec2 result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -101,10 +82,3 @@
compute_main();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:9: 'float2' : undeclared identifier
-ERROR: 0:9: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-
diff --git a/test/builtins/modf.wgsl.expected.glsl b/test/builtins/modf.wgsl.expected.glsl
index c9c5a1f..00fa668 100644
--- a/test/builtins/modf.wgsl.expected.glsl
+++ b/test/builtins/modf.wgsl.expected.glsl
@@ -1,5 +1,3 @@
-SKIP: FAILED
-
#version 310 es
struct modf_result {
@@ -8,9 +6,8 @@
};
modf_result tint_modf(float param_0) {
- float whole;
- float fract = modf(param_0, whole);
- modf_result result = {fract, whole};
+ modf_result result;
+ result.fract = modf(param_0, result.whole);
return result;
}
@@ -26,10 +23,3 @@
tint_symbol();
return;
}
-Error parsing GLSL shader:
-ERROR: 0:11: '{ } style initializers' : not supported with this profile: es
-ERROR: 0:11: '' : compilation terminated
-ERROR: 2 compilation errors. No code generated.
-
-
-