-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This Cl adds `Convert` support to the GLSL IR backend. Bug: 42251044 Change-Id: I43c7e470b4d055fecebcff0a3db8edb7643ca314 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/204894 Reviewed-by: James Price <[email protected]> Commit-Queue: dan sinclair <[email protected]>
- Loading branch information
Showing
181 changed files
with
1,949 additions
and
1,755 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// Copyright 2024 The Dawn & Tint Authors | ||
// | ||
// Redistribution and use in source and binary forms, with or without | ||
// modification, are permitted provided that the following conditions are met: | ||
// | ||
// 1. Redistributions of source code must retain the above copyright notice, this | ||
// list of conditions and the following disclaimer. | ||
// | ||
// 2. Redistributions in binary form must reproduce the above copyright notice, | ||
// this list of conditions and the following disclaimer in the documentation | ||
// and/or other materials provided with the distribution. | ||
// | ||
// 3. Neither the name of the copyright holder nor the names of its | ||
// contributors may be used to endorse or promote products derived from | ||
// this software without specific prior written permission. | ||
// | ||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
#include "src/tint/lang/glsl/writer/helper_test.h" | ||
|
||
using namespace tint::core::fluent_types; // NOLINT | ||
using namespace tint::core::number_suffixes; // NOLINT | ||
|
||
namespace tint::glsl::writer { | ||
namespace { | ||
|
||
TEST_F(GlslWriterTest, ConvertU32) { | ||
auto* f = b.Function("a", ty.u32()); | ||
b.Append(f->Block(), [&] { | ||
auto* v = b.Var("v", 2_i); | ||
b.Return(f, b.Convert(ty.u32(), v)); | ||
}); | ||
|
||
ASSERT_TRUE(Generate()) << err_ << output_.glsl; | ||
EXPECT_EQ(output_.glsl, GlslHeader() + R"( | ||
uint a() { | ||
int v = 2; | ||
return uint(v); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} | ||
)"); | ||
} | ||
|
||
} // namespace | ||
} // namespace tint::glsl::writer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:482 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Access | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
float foo() { | ||
int oob = 99; | ||
float b = vec4(0.0f)[min(uint(oob), 3u)]; | ||
vec4 v = vec4(0.0f); | ||
v[min(uint(oob), 3u)] = b; | ||
return b; | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
23 changes: 13 additions & 10 deletions
23
test/tint/expressions/type_conv/mat2x2/function/f16-f32.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:252 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Store | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
float16_t t = 0.0hf; | ||
f16mat2 m() { | ||
t = (t + 1.0hf); | ||
return f16mat2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf)); | ||
} | ||
void f() { | ||
mat2 v = mat2(m()); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
23 changes: 13 additions & 10 deletions
23
test/tint/expressions/type_conv/mat2x2/function/f32-f16.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:252 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Store | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
float t = 0.0f; | ||
mat2 m() { | ||
t = (t + 1.0f); | ||
return mat2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)); | ||
} | ||
void f() { | ||
f16mat2 v = f16mat2(m()); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
19 changes: 9 additions & 10 deletions
19
test/tint/expressions/type_conv/mat2x2/var/f16-f32.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:482 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Convert | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
f16mat2 u = f16mat2(f16vec2(1.0hf, 2.0hf), f16vec2(3.0hf, 4.0hf)); | ||
void f() { | ||
mat2 v = mat2(u); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
19 changes: 9 additions & 10 deletions
19
test/tint/expressions/type_conv/mat2x2/var/f32-f16.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:482 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Convert | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
mat2 u = mat2(vec2(1.0f, 2.0f), vec2(3.0f, 4.0f)); | ||
void f() { | ||
f16mat2 v = f16mat2(u); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
23 changes: 13 additions & 10 deletions
23
test/tint/expressions/type_conv/mat2x3/function/f16-f32.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:252 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Store | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
float16_t t = 0.0hf; | ||
f16mat2x3 m() { | ||
t = (t + 1.0hf); | ||
return f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf)); | ||
} | ||
void f() { | ||
mat2x3 v = mat2x3(m()); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
23 changes: 13 additions & 10 deletions
23
test/tint/expressions/type_conv/mat2x3/function/f32-f16.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:252 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Store | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
float t = 0.0f; | ||
mat2x3 m() { | ||
t = (t + 1.0f); | ||
return mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); | ||
} | ||
void f() { | ||
f16mat2x3 v = f16mat2x3(m()); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
19 changes: 9 additions & 10 deletions
19
test/tint/expressions/type_conv/mat2x3/var/f16-f32.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:482 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Convert | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
f16mat2x3 u = f16mat2x3(f16vec3(1.0hf, 2.0hf, 3.0hf), f16vec3(4.0hf, 5.0hf, 6.0hf)); | ||
void f() { | ||
mat2x3 v = mat2x3(u); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
19 changes: 9 additions & 10 deletions
19
test/tint/expressions/type_conv/mat2x3/var/f32-f16.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:482 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Convert | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
mat2x3 u = mat2x3(vec3(1.0f, 2.0f, 3.0f), vec3(4.0f, 5.0f, 6.0f)); | ||
void f() { | ||
f16mat2x3 v = f16mat2x3(u); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
23 changes: 13 additions & 10 deletions
23
test/tint/expressions/type_conv/mat2x4/function/f16-f32.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:252 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Store | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
float16_t t = 0.0hf; | ||
f16mat2x4 m() { | ||
t = (t + 1.0hf); | ||
return f16mat2x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf)); | ||
} | ||
void f() { | ||
mat2x4 v = mat2x4(m()); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
23 changes: 13 additions & 10 deletions
23
test/tint/expressions/type_conv/mat2x4/function/f32-f16.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:252 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Store | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
float t = 0.0f; | ||
mat2x4 m() { | ||
t = (t + 1.0f); | ||
return mat2x4(vec4(1.0f, 2.0f, 3.0f, 4.0f), vec4(5.0f, 6.0f, 7.0f, 8.0f)); | ||
} | ||
void f() { | ||
f16mat2x4 v = f16mat2x4(m()); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
19 changes: 9 additions & 10 deletions
19
test/tint/expressions/type_conv/mat2x4/var/f16-f32.wgsl.expected.ir.glsl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
SKIP: FAILED | ||
#version 310 es | ||
#extension GL_AMD_gpu_shader_half_float: require | ||
|
||
<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:482 internal compiler error: Switch() matched no cases. Type: tint::core::ir::Convert | ||
******************************************************************** | ||
* The tint shader compiler has encountered an unexpected error. * | ||
* * | ||
* Please help us fix this issue by submitting a bug report at * | ||
* crbug.com/tint with the source program that triggered the bug. * | ||
******************************************************************** | ||
|
||
tint executable returned error: signal: illegal instruction | ||
f16mat2x4 u = f16mat2x4(f16vec4(1.0hf, 2.0hf, 3.0hf, 4.0hf), f16vec4(5.0hf, 6.0hf, 7.0hf, 8.0hf)); | ||
void f() { | ||
mat2x4 v = mat2x4(u); | ||
} | ||
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in; | ||
void main() { | ||
} |
Oops, something went wrong.