mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-08 13:14:56 +00:00
[spirv-writer] Support optional trailing return.
This CL updates the SPIRV-Writer to inject an OpReturn as the trailing statement in a function if the function does not end with a `discard` or a `return` statement. R=bclayton@google.com, dneto@google.com Fixes: tint:302 Change-Id: I2e7c7beff15ad30c779c591bb75cf97fc0960bf7 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/33160 Reviewed-by: David Neto <dneto@google.com> Commit-Queue: dan sinclair <dsinclair@chromium.org> Auto-Submit: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
46d9c7745e
commit
a7c9391dc6
@@ -26,7 +26,6 @@ fn vert_main() -> void {
|
||||
(a_pos.x * cos(angle)) - (a_pos.y * sin(angle)),
|
||||
(a_pos.x * sin(angle)) + (a_pos.y * cos(angle)));
|
||||
gl_Position = vec4<f32>(pos + a_particlePos, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
# fragment shader
|
||||
@@ -35,7 +34,6 @@ fn vert_main() -> void {
|
||||
[[stage(fragment)]]
|
||||
fn frag_main() -> void {
|
||||
fragColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
# compute shader
|
||||
@@ -137,6 +135,4 @@ fn comp_main() -> void {
|
||||
# Write back
|
||||
particlesB.particles[index].pos = vPos;
|
||||
particlesB.particles[index].vel = vVel;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
fn vtx_main() -> void {
|
||||
Position = uniforms.modelViewProjectionMatrix * cur_position;
|
||||
vtxFragColor = color;
|
||||
return;
|
||||
}
|
||||
|
||||
# Fragment shader
|
||||
@@ -38,5 +37,4 @@ fn vtx_main() -> void {
|
||||
[[stage(fragment)]]
|
||||
fn frag_main() -> void {
|
||||
outColor = fragColor;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,5 +19,4 @@ fn main() -> f32 {
|
||||
[[stage(compute)]]
|
||||
[[workgroup_size(2)]]
|
||||
fn ep() -> void {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
[[location(0)]] var<out> gl_FragColor : vec4<f32>;
|
||||
|
||||
fn bar() -> void {
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
@@ -23,5 +22,4 @@ fn main() -> void {
|
||||
var a : vec2<f32> = vec2<f32>();
|
||||
gl_FragColor = vec4<f32>(0.4, 0.4, 0.8, 1.0);
|
||||
bar();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||
[[stage(vertex)]]
|
||||
fn vtx_main() -> void {
|
||||
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
# Fragment shader
|
||||
@@ -33,5 +32,4 @@ fn vtx_main() -> void {
|
||||
[[stage(fragment)]]
|
||||
fn frag_main() -> void {
|
||||
outColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user