Remove storage textures from vertex tests
The template change in test/tint/builtins/gen/gen.wgsl.tmpl removes the
remaining usages of storage textures in vertex shaders in Tint end2end
tests, replacing them instead with a VertexOutput object to prevent DCE.
The template is the only manually modified file in this change, the rest
were created with:
./tools/run gen
./tools/run tests --generate-expected
Binding numbers and entry point ordering had to be slightly shuffled to
work around: crbug.com/42250109
Bug: 344846829
Change-Id: I6c2c80b78168a13c6c545e7a0dc924d64997ff0e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/193260
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Natalie Chouinard <chouinard@google.com>
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl b/test/tint/builtins/gen/literal/floor/218952.wgsl
index d049051..ed7c959 100644
--- a/test/tint/builtins/gen/literal/floor/218952.wgsl
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl
@@ -39,12 +39,6 @@
fn floor_218952() {
var res = floor(vec4(1.5));
}
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_218952();
- return vec4<f32>();
-}
-
@fragment
fn fragment_main() {
floor_218952();
@@ -54,3 +48,15 @@
fn compute_main() {
floor_218952();
}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ floor_218952();
+ return out;
+}
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.dxc.hlsl
index 122980b..2adb23c 100644
--- a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.dxc.hlsl
@@ -2,22 +2,6 @@
float4 res = (1.0f).xxxx;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_218952();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
void fragment_main() {
floor_218952();
return;
@@ -28,3 +12,24 @@
floor_218952();
return;
}
+
+struct VertexOutput {
+ float4 pos;
+};
+struct tint_symbol_1 {
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ floor_218952();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.fxc.hlsl
index 122980b..2adb23c 100644
--- a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.fxc.hlsl
@@ -2,22 +2,6 @@
float4 res = (1.0f).xxxx;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_218952();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
void fragment_main() {
floor_218952();
return;
@@ -28,3 +12,24 @@
floor_218952();
return;
}
+
+struct VertexOutput {
+ float4 pos;
+};
+struct tint_symbol_1 {
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ floor_218952();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.glsl
index 205690c..cb4c0af 100644
--- a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.glsl
@@ -1,23 +1,4 @@
#version 310 es
-
-void floor_218952() {
- vec4 res = vec4(1.0f);
-}
-
-vec4 vertex_main() {
- floor_218952();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
precision highp float;
precision highp int;
@@ -25,6 +6,10 @@
vec4 res = vec4(1.0f);
}
+struct VertexOutput {
+ vec4 pos;
+};
+
void fragment_main() {
floor_218952();
}
@@ -39,6 +24,10 @@
vec4 res = vec4(1.0f);
}
+struct VertexOutput {
+ vec4 pos;
+};
+
void compute_main() {
floor_218952();
}
@@ -48,3 +37,28 @@
compute_main();
return;
}
+#version 310 es
+
+void floor_218952() {
+ vec4 res = vec4(1.0f);
+}
+
+struct VertexOutput {
+ vec4 pos;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f));
+ tint_symbol.pos = vec4(0.0f);
+ floor_218952();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.msl
index 9c419db..40bcc3a 100644
--- a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.msl
@@ -5,22 +5,6 @@
float4 res = float4(1.0f);
}
-struct tint_symbol {
- float4 value [[position]];
-};
-
-float4 vertex_main_inner() {
- floor_218952();
- return float4(0.0f);
-}
-
-vertex tint_symbol vertex_main() {
- float4 const inner_result = vertex_main_inner();
- tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
fragment void fragment_main() {
floor_218952();
return;
@@ -31,3 +15,25 @@
return;
}
+struct VertexOutput {
+ float4 pos;
+};
+
+struct tint_symbol {
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ floor_218952();
+ return out;
+}
+
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
+
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.spvasm
index 34d7ace..73cffdc 100644
--- a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.spvasm
@@ -1,30 +1,34 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 30
+; Bound: 39
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
OpName %vertex_point_size "vertex_point_size"
OpName %floor_218952 "floor_218952"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
+ OpMemberDecorate %VertexOutput 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
@@ -33,32 +37,42 @@
%float_1 = OpConstant %float 1
%14 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %17 = OpTypeFunction %v4float
+%VertexOutput = OpTypeStruct %v4float
+ %23 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %29 = OpConstantNull %VertexOutput
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
%floor_218952 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
OpStore %res %14
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %17
- %19 = OpLabel
- %20 = OpFunctionCall %void %floor_218952
- OpReturnValue %5
- OpFunctionEnd
-%vertex_main = OpFunction %void None %9
- %22 = OpLabel
- %23 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %23
- OpStore %vertex_point_size %float_1
- OpReturn
- OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %25 = OpLabel
- %26 = OpFunctionCall %void %floor_218952
+ %18 = OpLabel
+ %19 = OpFunctionCall %void %floor_218952
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %28 = OpLabel
- %29 = OpFunctionCall %void %floor_218952
+ %21 = OpLabel
+ %22 = OpFunctionCall %void %floor_218952
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %VertexOutput None %23
+ %26 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %29
+ %32 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %32 %5
+ %33 = OpFunctionCall %void %floor_218952
+ %34 = OpLoad %VertexOutput %out
+ OpReturnValue %34
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %38 = OpCompositeExtract %v4float %37 0
+ OpStore %pos_1 %38
+ OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.wgsl
index 95bbf50..6ae7aed 100644
--- a/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/218952.wgsl.expected.wgsl
@@ -2,12 +2,6 @@
var res = floor(vec4(1.5));
}
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_218952();
- return vec4<f32>();
-}
-
@fragment
fn fragment_main() {
floor_218952();
@@ -17,3 +11,16 @@
fn compute_main() {
floor_218952();
}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ floor_218952();
+ return out;
+}
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl
index 7682dd0..b2c65dc 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl
@@ -41,24 +41,31 @@
enable f16;
// fn floor(vec<3, f16>) -> vec<3, f16>
-fn floor_3802c0() {
+fn floor_3802c0() -> vec3<f16>{
var res: vec3<f16> = floor(vec3<f16>(1.5h));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec3<f16>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_3802c0();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec3<f16>;
@fragment
fn fragment_main() {
- floor_3802c0();
+ prevent_dce = floor_3802c0();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_3802c0();
+ prevent_dce = floor_3802c0();
+}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+ @location(0) @interpolate(flat) prevent_dce : vec3<f16>
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_3802c0();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl
index b32a367..e1ec2c0 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.dxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_3802c0() {
+vector<float16_t, 3> floor_3802c0() {
vector<float16_t, 3> res = (float16_t(1.0h)).xxx;
- prevent_dce.Store<vector<float16_t, 3> >(0u, res);
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_3802c0();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_3802c0();
+ prevent_dce.Store<vector<float16_t, 3> >(0u, floor_3802c0());
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_3802c0();
+ prevent_dce.Store<vector<float16_t, 3> >(0u, floor_3802c0());
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ vector<float16_t, 3> prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation vector<float16_t, 3> prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_3802c0();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl
index 0d8a561..a654024 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.glsl
@@ -1,44 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-
-layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
- f16vec3 inner;
-} prevent_dce;
-
-void floor_3802c0() {
- f16vec3 res = f16vec3(1.0hf);
- prevent_dce.inner = res;
-}
-
-vec4 vertex_main() {
- floor_3802c0();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
-#extension GL_AMD_gpu_shader_half_float : require
precision highp float;
precision highp int;
+f16vec3 floor_3802c0() {
+ f16vec3 res = f16vec3(1.0hf);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec3 inner;
} prevent_dce;
-void floor_3802c0() {
- f16vec3 res = f16vec3(1.0hf);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ f16vec3 prevent_dce;
+};
void fragment_main() {
- floor_3802c0();
+ prevent_dce.inner = floor_3802c0();
}
void main() {
@@ -48,17 +28,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16vec3 floor_3802c0() {
+ f16vec3 res = f16vec3(1.0hf);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec3 inner;
} prevent_dce;
-void floor_3802c0() {
- f16vec3 res = f16vec3(1.0hf);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ f16vec3 prevent_dce;
+};
void compute_main() {
- floor_3802c0();
+ prevent_dce.inner = floor_3802c0();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -66,3 +51,33 @@
compute_main();
return;
}
+#version 310 es
+#extension GL_AMD_gpu_shader_half_float : require
+
+layout(location = 0) flat out f16vec3 prevent_dce_1;
+f16vec3 floor_3802c0() {
+ f16vec3 res = f16vec3(1.0hf);
+ return res;
+}
+
+struct VertexOutput {
+ vec4 pos;
+ f16vec3 prevent_dce;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), f16vec3(0.0hf, 0.0hf, 0.0hf));
+ tint_symbol.pos = vec4(0.0f);
+ tint_symbol.prevent_dce = floor_3802c0();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ prevent_dce_1 = inner_result.prevent_dce;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl
index d7bb980..4d52eff 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.msl
@@ -1,34 +1,43 @@
#include <metal_stdlib>
using namespace metal;
-void floor_3802c0(device packed_half3* const tint_symbol_1) {
+half3 floor_3802c0() {
half3 res = half3(1.0h);
- *(tint_symbol_1) = packed_half3(res);
+ return res;
}
-struct tint_symbol {
- float4 value [[position]];
+fragment void fragment_main(device packed_half3* tint_symbol_1 [[buffer(0)]]) {
+ *(tint_symbol_1) = packed_half3(floor_3802c0());
+ return;
+}
+
+kernel void compute_main(device packed_half3* tint_symbol_2 [[buffer(0)]]) {
+ *(tint_symbol_2) = packed_half3(floor_3802c0());
+ return;
+}
+
+struct VertexOutput {
+ float4 pos;
+ half3 prevent_dce;
};
-float4 vertex_main_inner(device packed_half3* const tint_symbol_2) {
- floor_3802c0(tint_symbol_2);
- return float4(0.0f);
+struct tint_symbol {
+ half3 prevent_dce [[user(locn0)]] [[flat]];
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ out.prevent_dce = floor_3802c0();
+ return out;
}
-vertex tint_symbol vertex_main(device packed_half3* tint_symbol_3 [[buffer(0)]]) {
- float4 const inner_result = vertex_main_inner(tint_symbol_3);
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
return wrapper_result;
}
-fragment void fragment_main(device packed_half3* tint_symbol_4 [[buffer(0)]]) {
- floor_3802c0(tint_symbol_4);
- return;
-}
-
-kernel void compute_main(device packed_half3* tint_symbol_5 [[buffer(0)]]) {
- floor_3802c0(tint_symbol_5);
- return;
-}
-
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm
index b1ec40e..f0729ba 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.spvasm
@@ -1,87 +1,116 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 57
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
+ OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %prevent_dce_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
+ OpName %prevent_dce_1 "prevent_dce_1"
OpName %vertex_point_size "vertex_point_size"
OpName %prevent_dce_block "prevent_dce_block"
OpMemberName %prevent_dce_block 0 "inner"
OpName %prevent_dce "prevent_dce"
OpName %floor_3802c0 "floor_3802c0"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpMemberName %VertexOutput 1 "prevent_dce"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
+ OpDecorate %prevent_dce_1 Location 0
+ OpDecorate %prevent_dce_1 Flat
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %prevent_dce_block Block
OpMemberDecorate %prevent_dce_block 0 Offset 0
- OpDecorate %prevent_dce DescriptorSet 2
+ OpDecorate %prevent_dce DescriptorSet 0
OpDecorate %prevent_dce Binding 0
+ OpMemberDecorate %VertexOutput 0 Offset 0
+ OpMemberDecorate %VertexOutput 1 Offset 16
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
-%_ptr_Output_float = OpTypePointer Output %float
- %8 = OpConstantNull %float
-%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%half = OpTypeFloat 16
%v3half = OpTypeVector %half 3
+%_ptr_Output_v3half = OpTypePointer Output %v3half
+ %10 = OpConstantNull %v3half
+%prevent_dce_1 = OpVariable %_ptr_Output_v3half Output %10
+%_ptr_Output_float = OpTypePointer Output %float
+ %13 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %13
%prevent_dce_block = OpTypeStruct %v3half
%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
- %void = OpTypeVoid
- %14 = OpTypeFunction %void
+ %17 = OpTypeFunction %v3half
%half_0x1p_0 = OpConstant %half 0x1p+0
- %19 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+ %21 = OpConstantComposite %v3half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v3half = OpTypePointer Function %v3half
- %22 = OpConstantNull %v3half
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v3half = OpTypePointer StorageBuffer %v3half
- %28 = OpTypeFunction %v4float
+%VertexOutput = OpTypeStruct %v4float %v3half
+ %38 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %44 = OpConstantNull %VertexOutput
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %uint_1 = OpConstant %uint 1
%float_1 = OpConstant %float 1
-%floor_3802c0 = OpFunction %void None %14
- %17 = OpLabel
- %res = OpVariable %_ptr_Function_v3half Function %22
- OpStore %res %19
- %26 = OpAccessChain %_ptr_StorageBuffer_v3half %prevent_dce %uint_0
- %27 = OpLoad %v3half %res
- OpStore %26 %27
+%floor_3802c0 = OpFunction %v3half None %17
+ %19 = OpLabel
+ %res = OpVariable %_ptr_Function_v3half Function %10
+ OpStore %res %21
+ %24 = OpLoad %v3half %res
+ OpReturnValue %24
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v3half %prevent_dce %uint_0
+ %33 = OpFunctionCall %v3half %floor_3802c0
+ OpStore %32 %33
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %28
- %30 = OpLabel
- %31 = OpFunctionCall %void %floor_3802c0
- OpReturnValue %5
+%compute_main = OpFunction %void None %25
+ %35 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v3half %prevent_dce %uint_0
+ %37 = OpFunctionCall %v3half %floor_3802c0
+ OpStore %36 %37
+ OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %14
- %33 = OpLabel
- %34 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %34
+%vertex_main_inner = OpFunction %VertexOutput None %38
+ %41 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %44
+ %46 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %46 %5
+ %48 = OpAccessChain %_ptr_Function_v3half %out %uint_1
+ %49 = OpFunctionCall %v3half %floor_3802c0
+ OpStore %48 %49
+ %50 = OpLoad %VertexOutput %out
+ OpReturnValue %50
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %52 = OpLabel
+ %53 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %54 = OpCompositeExtract %v4float %53 0
+ OpStore %pos_1 %54
+ %55 = OpCompositeExtract %v3half %53 1
+ OpStore %prevent_dce_1 %55
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %14
- %37 = OpLabel
- %38 = OpFunctionCall %void %floor_3802c0
- OpReturn
- OpFunctionEnd
-%compute_main = OpFunction %void None %14
- %40 = OpLabel
- %41 = OpFunctionCall %void %floor_3802c0
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl
index 9ef8ea0..739b5b8 100644
--- a/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/3802c0.wgsl.expected.wgsl
@@ -1,24 +1,33 @@
enable f16;
-fn floor_3802c0() {
+fn floor_3802c0() -> vec3<f16> {
var res : vec3<f16> = floor(vec3<f16>(1.5h));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec3<f16>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_3802c0();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec3<f16>;
@fragment
fn fragment_main() {
- floor_3802c0();
+ prevent_dce = floor_3802c0();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_3802c0();
+ prevent_dce = floor_3802c0();
+}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+ @location(0) @interpolate(flat)
+ prevent_dce : vec3<f16>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_3802c0();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl
index 78350d8..1a93842 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl
@@ -36,24 +36,31 @@
// fn floor(vec<4, f32>) -> vec<4, f32>
-fn floor_3bccc4() {
+fn floor_3bccc4() -> vec4<f32>{
var res: vec4<f32> = floor(vec4<f32>(1.5f));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec4<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_3bccc4();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec4<f32>;
@fragment
fn fragment_main() {
- floor_3bccc4();
+ prevent_dce = floor_3bccc4();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_3bccc4();
+ prevent_dce = floor_3bccc4();
+}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+ @location(0) @interpolate(flat) prevent_dce : vec4<f32>
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_3bccc4();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl
index 17ad281..b0eb0d5 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.dxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_3bccc4() {
+float4 floor_3bccc4() {
float4 res = (1.0f).xxxx;
- prevent_dce.Store4(0u, asuint(res));
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_3bccc4();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_3bccc4();
+ prevent_dce.Store4(0u, asuint(floor_3bccc4()));
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_3bccc4();
+ prevent_dce.Store4(0u, asuint(floor_3bccc4()));
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ float4 prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation float4 prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_3bccc4();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl
index 17ad281..b0eb0d5 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.fxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_3bccc4() {
+float4 floor_3bccc4() {
float4 res = (1.0f).xxxx;
- prevent_dce.Store4(0u, asuint(res));
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_3bccc4();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_3bccc4();
+ prevent_dce.Store4(0u, asuint(floor_3bccc4()));
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_3bccc4();
+ prevent_dce.Store4(0u, asuint(floor_3bccc4()));
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ float4 prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation float4 prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_3bccc4();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl
index 009a09a..4b209af 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.glsl
@@ -1,42 +1,23 @@
#version 310 es
-
-layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
- vec4 inner;
-} prevent_dce;
-
-void floor_3bccc4() {
- vec4 res = vec4(1.0f);
- prevent_dce.inner = res;
-}
-
-vec4 vertex_main() {
- floor_3bccc4();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
precision highp float;
precision highp int;
+vec4 floor_3bccc4() {
+ vec4 res = vec4(1.0f);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec4 inner;
} prevent_dce;
-void floor_3bccc4() {
- vec4 res = vec4(1.0f);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ vec4 prevent_dce;
+};
void fragment_main() {
- floor_3bccc4();
+ prevent_dce.inner = floor_3bccc4();
}
void main() {
@@ -45,17 +26,22 @@
}
#version 310 es
+vec4 floor_3bccc4() {
+ vec4 res = vec4(1.0f);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec4 inner;
} prevent_dce;
-void floor_3bccc4() {
- vec4 res = vec4(1.0f);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ vec4 prevent_dce;
+};
void compute_main() {
- floor_3bccc4();
+ prevent_dce.inner = floor_3bccc4();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -63,3 +49,32 @@
compute_main();
return;
}
+#version 310 es
+
+layout(location = 0) flat out vec4 prevent_dce_1;
+vec4 floor_3bccc4() {
+ vec4 res = vec4(1.0f);
+ return res;
+}
+
+struct VertexOutput {
+ vec4 pos;
+ vec4 prevent_dce;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec4(0.0f, 0.0f, 0.0f, 0.0f));
+ tint_symbol.pos = vec4(0.0f);
+ tint_symbol.prevent_dce = floor_3bccc4();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ prevent_dce_1 = inner_result.prevent_dce;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl
index 2bb489e..aae2612 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.msl
@@ -1,34 +1,43 @@
#include <metal_stdlib>
using namespace metal;
-void floor_3bccc4(device float4* const tint_symbol_1) {
+float4 floor_3bccc4() {
float4 res = float4(1.0f);
- *(tint_symbol_1) = res;
+ return res;
}
-struct tint_symbol {
- float4 value [[position]];
+fragment void fragment_main(device float4* tint_symbol_1 [[buffer(0)]]) {
+ *(tint_symbol_1) = floor_3bccc4();
+ return;
+}
+
+kernel void compute_main(device float4* tint_symbol_2 [[buffer(0)]]) {
+ *(tint_symbol_2) = floor_3bccc4();
+ return;
+}
+
+struct VertexOutput {
+ float4 pos;
+ float4 prevent_dce;
};
-float4 vertex_main_inner(device float4* const tint_symbol_2) {
- floor_3bccc4(tint_symbol_2);
- return float4(0.0f);
+struct tint_symbol {
+ float4 prevent_dce [[user(locn0)]] [[flat]];
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ out.prevent_dce = floor_3bccc4();
+ return out;
}
-vertex tint_symbol vertex_main(device float4* tint_symbol_3 [[buffer(0)]]) {
- float4 const inner_result = vertex_main_inner(tint_symbol_3);
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
return wrapper_result;
}
-fragment void fragment_main(device float4* tint_symbol_4 [[buffer(0)]]) {
- floor_3bccc4(tint_symbol_4);
- return;
-}
-
-kernel void compute_main(device float4* tint_symbol_5 [[buffer(0)]]) {
- floor_3bccc4(tint_symbol_5);
- return;
-}
-
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm
index 312b151..8cec648 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.spvasm
@@ -1,80 +1,106 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 38
+; Bound: 51
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %prevent_dce_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
+ OpName %prevent_dce_1 "prevent_dce_1"
OpName %vertex_point_size "vertex_point_size"
OpName %prevent_dce_block "prevent_dce_block"
OpMemberName %prevent_dce_block 0 "inner"
OpName %prevent_dce "prevent_dce"
OpName %floor_3bccc4 "floor_3bccc4"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpMemberName %VertexOutput 1 "prevent_dce"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
+ OpDecorate %prevent_dce_1 Location 0
+ OpDecorate %prevent_dce_1 Flat
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %prevent_dce_block Block
OpMemberDecorate %prevent_dce_block 0 Offset 0
- OpDecorate %prevent_dce DescriptorSet 2
+ OpDecorate %prevent_dce DescriptorSet 0
OpDecorate %prevent_dce Binding 0
+ OpMemberDecorate %VertexOutput 0 Offset 0
+ OpMemberDecorate %VertexOutput 1 Offset 16
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
+%prevent_dce_1 = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
- %8 = OpConstantNull %float
-%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %9 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %9
%prevent_dce_block = OpTypeStruct %v4float
%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
- %void = OpTypeVoid
- %12 = OpTypeFunction %void
+ %13 = OpTypeFunction %v4float
%float_1 = OpConstant %float 1
%17 = OpConstantComposite %v4float %float_1 %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %void = OpTypeVoid
+ %21 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
- %25 = OpTypeFunction %v4float
-%floor_3bccc4 = OpFunction %void None %12
+%VertexOutput = OpTypeStruct %v4float %v4float
+ %34 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %40 = OpConstantNull %VertexOutput
+ %uint_1 = OpConstant %uint 1
+%floor_3bccc4 = OpFunction %v4float None %13
%15 = OpLabel
%res = OpVariable %_ptr_Function_v4float Function %5
OpStore %res %17
- %23 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
- %24 = OpLoad %v4float %res
- OpStore %23 %24
+ %20 = OpLoad %v4float %res
+ OpReturnValue %20
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %21
+ %24 = OpLabel
+ %28 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
+ %29 = OpFunctionCall %v4float %floor_3bccc4
+ OpStore %28 %29
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %25
- %27 = OpLabel
- %28 = OpFunctionCall %void %floor_3bccc4
- OpReturnValue %5
+%compute_main = OpFunction %void None %21
+ %31 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v4float %prevent_dce %uint_0
+ %33 = OpFunctionCall %v4float %floor_3bccc4
+ OpStore %32 %33
+ OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %12
- %30 = OpLabel
- %31 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %31
+%vertex_main_inner = OpFunction %VertexOutput None %34
+ %37 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %40
+ %41 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %41 %5
+ %43 = OpAccessChain %_ptr_Function_v4float %out %uint_1
+ %44 = OpFunctionCall %v4float %floor_3bccc4
+ OpStore %43 %44
+ %45 = OpLoad %VertexOutput %out
+ OpReturnValue %45
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %21
+ %47 = OpLabel
+ %48 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %49 = OpCompositeExtract %v4float %48 0
+ OpStore %pos_1 %49
+ %50 = OpCompositeExtract %v4float %48 1
+ OpStore %prevent_dce_1 %50
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %12
- %33 = OpLabel
- %34 = OpFunctionCall %void %floor_3bccc4
- OpReturn
- OpFunctionEnd
-%compute_main = OpFunction %void None %12
- %36 = OpLabel
- %37 = OpFunctionCall %void %floor_3bccc4
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl
index 54f8206..7aa1f04 100644
--- a/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/3bccc4.wgsl.expected.wgsl
@@ -1,22 +1,31 @@
-fn floor_3bccc4() {
+fn floor_3bccc4() -> vec4<f32> {
var res : vec4<f32> = floor(vec4<f32>(1.5f));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec4<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_3bccc4();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec4<f32>;
@fragment
fn fragment_main() {
- floor_3bccc4();
+ prevent_dce = floor_3bccc4();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_3bccc4();
+ prevent_dce = floor_3bccc4();
+}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+ @location(0) @interpolate(flat)
+ prevent_dce : vec4<f32>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_3bccc4();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl
index 60c3e0d..dc0d143 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl
@@ -36,24 +36,31 @@
// fn floor(vec<2, f32>) -> vec<2, f32>
-fn floor_5fc9ac() {
+fn floor_5fc9ac() -> vec2<f32>{
var res: vec2<f32> = floor(vec2<f32>(1.5f));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec2<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_5fc9ac();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec2<f32>;
@fragment
fn fragment_main() {
- floor_5fc9ac();
+ prevent_dce = floor_5fc9ac();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_5fc9ac();
+ prevent_dce = floor_5fc9ac();
+}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+ @location(0) @interpolate(flat) prevent_dce : vec2<f32>
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_5fc9ac();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl
index 353ed0e..95ced87 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.dxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_5fc9ac() {
+float2 floor_5fc9ac() {
float2 res = (1.0f).xx;
- prevent_dce.Store2(0u, asuint(res));
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_5fc9ac();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_5fc9ac();
+ prevent_dce.Store2(0u, asuint(floor_5fc9ac()));
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_5fc9ac();
+ prevent_dce.Store2(0u, asuint(floor_5fc9ac()));
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ float2 prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation float2 prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_5fc9ac();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl
index 353ed0e..95ced87 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.fxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_5fc9ac() {
+float2 floor_5fc9ac() {
float2 res = (1.0f).xx;
- prevent_dce.Store2(0u, asuint(res));
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_5fc9ac();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_5fc9ac();
+ prevent_dce.Store2(0u, asuint(floor_5fc9ac()));
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_5fc9ac();
+ prevent_dce.Store2(0u, asuint(floor_5fc9ac()));
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ float2 prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation float2 prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_5fc9ac();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl
index e0149af..a3538f9 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.glsl
@@ -1,42 +1,23 @@
#version 310 es
-
-layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
- vec2 inner;
-} prevent_dce;
-
-void floor_5fc9ac() {
- vec2 res = vec2(1.0f);
- prevent_dce.inner = res;
-}
-
-vec4 vertex_main() {
- floor_5fc9ac();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
precision highp float;
precision highp int;
+vec2 floor_5fc9ac() {
+ vec2 res = vec2(1.0f);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec2 inner;
} prevent_dce;
-void floor_5fc9ac() {
- vec2 res = vec2(1.0f);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ vec2 prevent_dce;
+};
void fragment_main() {
- floor_5fc9ac();
+ prevent_dce.inner = floor_5fc9ac();
}
void main() {
@@ -45,17 +26,22 @@
}
#version 310 es
+vec2 floor_5fc9ac() {
+ vec2 res = vec2(1.0f);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec2 inner;
} prevent_dce;
-void floor_5fc9ac() {
- vec2 res = vec2(1.0f);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ vec2 prevent_dce;
+};
void compute_main() {
- floor_5fc9ac();
+ prevent_dce.inner = floor_5fc9ac();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -63,3 +49,32 @@
compute_main();
return;
}
+#version 310 es
+
+layout(location = 0) flat out vec2 prevent_dce_1;
+vec2 floor_5fc9ac() {
+ vec2 res = vec2(1.0f);
+ return res;
+}
+
+struct VertexOutput {
+ vec4 pos;
+ vec2 prevent_dce;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec2(0.0f, 0.0f));
+ tint_symbol.pos = vec4(0.0f);
+ tint_symbol.prevent_dce = floor_5fc9ac();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ prevent_dce_1 = inner_result.prevent_dce;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl
index 84d618c..21949f4 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.msl
@@ -1,34 +1,43 @@
#include <metal_stdlib>
using namespace metal;
-void floor_5fc9ac(device float2* const tint_symbol_1) {
+float2 floor_5fc9ac() {
float2 res = float2(1.0f);
- *(tint_symbol_1) = res;
+ return res;
}
-struct tint_symbol {
- float4 value [[position]];
+fragment void fragment_main(device float2* tint_symbol_1 [[buffer(0)]]) {
+ *(tint_symbol_1) = floor_5fc9ac();
+ return;
+}
+
+kernel void compute_main(device float2* tint_symbol_2 [[buffer(0)]]) {
+ *(tint_symbol_2) = floor_5fc9ac();
+ return;
+}
+
+struct VertexOutput {
+ float4 pos;
+ float2 prevent_dce;
};
-float4 vertex_main_inner(device float2* const tint_symbol_2) {
- floor_5fc9ac(tint_symbol_2);
- return float4(0.0f);
+struct tint_symbol {
+ float2 prevent_dce [[user(locn0)]] [[flat]];
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ out.prevent_dce = floor_5fc9ac();
+ return out;
}
-vertex tint_symbol vertex_main(device float2* tint_symbol_3 [[buffer(0)]]) {
- float4 const inner_result = vertex_main_inner(tint_symbol_3);
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
return wrapper_result;
}
-fragment void fragment_main(device float2* tint_symbol_4 [[buffer(0)]]) {
- floor_5fc9ac(tint_symbol_4);
- return;
-}
-
-kernel void compute_main(device float2* tint_symbol_5 [[buffer(0)]]) {
- floor_5fc9ac(tint_symbol_5);
- return;
-}
-
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm
index 3f69b77..ffcf4f5 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.spvasm
@@ -1,82 +1,110 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 40
+; Bound: 55
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %prevent_dce_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
+ OpName %prevent_dce_1 "prevent_dce_1"
OpName %vertex_point_size "vertex_point_size"
OpName %prevent_dce_block "prevent_dce_block"
OpMemberName %prevent_dce_block 0 "inner"
OpName %prevent_dce "prevent_dce"
OpName %floor_5fc9ac "floor_5fc9ac"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpMemberName %VertexOutput 1 "prevent_dce"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
+ OpDecorate %prevent_dce_1 Location 0
+ OpDecorate %prevent_dce_1 Flat
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %prevent_dce_block Block
OpMemberDecorate %prevent_dce_block 0 Offset 0
- OpDecorate %prevent_dce DescriptorSet 2
+ OpDecorate %prevent_dce DescriptorSet 0
OpDecorate %prevent_dce Binding 0
+ OpMemberDecorate %VertexOutput 0 Offset 0
+ OpMemberDecorate %VertexOutput 1 Offset 16
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
-%_ptr_Output_float = OpTypePointer Output %float
- %8 = OpConstantNull %float
-%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%v2float = OpTypeVector %float 2
+%_ptr_Output_v2float = OpTypePointer Output %v2float
+ %9 = OpConstantNull %v2float
+%prevent_dce_1 = OpVariable %_ptr_Output_v2float Output %9
+%_ptr_Output_float = OpTypePointer Output %float
+ %12 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %12
%prevent_dce_block = OpTypeStruct %v2float
%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
- %void = OpTypeVoid
- %13 = OpTypeFunction %void
+ %16 = OpTypeFunction %v2float
%float_1 = OpConstant %float 1
- %18 = OpConstantComposite %v2float %float_1 %float_1
+ %20 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
- %21 = OpConstantNull %v2float
+ %void = OpTypeVoid
+ %24 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v2float = OpTypePointer StorageBuffer %v2float
- %27 = OpTypeFunction %v4float
-%floor_5fc9ac = OpFunction %void None %13
- %16 = OpLabel
- %res = OpVariable %_ptr_Function_v2float Function %21
- OpStore %res %18
- %25 = OpAccessChain %_ptr_StorageBuffer_v2float %prevent_dce %uint_0
- %26 = OpLoad %v2float %res
- OpStore %25 %26
+%VertexOutput = OpTypeStruct %v4float %v2float
+ %37 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %43 = OpConstantNull %VertexOutput
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %uint_1 = OpConstant %uint 1
+%floor_5fc9ac = OpFunction %v2float None %16
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_v2float Function %9
+ OpStore %res %20
+ %23 = OpLoad %v2float %res
+ OpReturnValue %23
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %24
+ %27 = OpLabel
+ %31 = OpAccessChain %_ptr_StorageBuffer_v2float %prevent_dce %uint_0
+ %32 = OpFunctionCall %v2float %floor_5fc9ac
+ OpStore %31 %32
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %27
- %29 = OpLabel
- %30 = OpFunctionCall %void %floor_5fc9ac
- OpReturnValue %5
+%compute_main = OpFunction %void None %24
+ %34 = OpLabel
+ %35 = OpAccessChain %_ptr_StorageBuffer_v2float %prevent_dce %uint_0
+ %36 = OpFunctionCall %v2float %floor_5fc9ac
+ OpStore %35 %36
+ OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %13
- %32 = OpLabel
- %33 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %33
+%vertex_main_inner = OpFunction %VertexOutput None %37
+ %40 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %43
+ %45 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %45 %5
+ %47 = OpAccessChain %_ptr_Function_v2float %out %uint_1
+ %48 = OpFunctionCall %v2float %floor_5fc9ac
+ OpStore %47 %48
+ %49 = OpLoad %VertexOutput %out
+ OpReturnValue %49
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %24
+ %51 = OpLabel
+ %52 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %53 = OpCompositeExtract %v4float %52 0
+ OpStore %pos_1 %53
+ %54 = OpCompositeExtract %v2float %52 1
+ OpStore %prevent_dce_1 %54
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %13
- %35 = OpLabel
- %36 = OpFunctionCall %void %floor_5fc9ac
- OpReturn
- OpFunctionEnd
-%compute_main = OpFunction %void None %13
- %38 = OpLabel
- %39 = OpFunctionCall %void %floor_5fc9ac
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl
index c8534bb..b744e5c 100644
--- a/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/5fc9ac.wgsl.expected.wgsl
@@ -1,22 +1,31 @@
-fn floor_5fc9ac() {
+fn floor_5fc9ac() -> vec2<f32> {
var res : vec2<f32> = floor(vec2<f32>(1.5f));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec2<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_5fc9ac();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec2<f32>;
@fragment
fn fragment_main() {
- floor_5fc9ac();
+ prevent_dce = floor_5fc9ac();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_5fc9ac();
+ prevent_dce = floor_5fc9ac();
+}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+ @location(0) @interpolate(flat)
+ prevent_dce : vec2<f32>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_5fc9ac();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl
index 1c725b5..be11379 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl
@@ -36,24 +36,31 @@
// fn floor(vec<3, f32>) -> vec<3, f32>
-fn floor_60d7ea() {
+fn floor_60d7ea() -> vec3<f32>{
var res: vec3<f32> = floor(vec3<f32>(1.5f));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec3<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_60d7ea();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec3<f32>;
@fragment
fn fragment_main() {
- floor_60d7ea();
+ prevent_dce = floor_60d7ea();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_60d7ea();
+ prevent_dce = floor_60d7ea();
+}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+ @location(0) @interpolate(flat) prevent_dce : vec3<f32>
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_60d7ea();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl
index 96cfc08..3c60441 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.dxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_60d7ea() {
+float3 floor_60d7ea() {
float3 res = (1.0f).xxx;
- prevent_dce.Store3(0u, asuint(res));
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_60d7ea();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_60d7ea();
+ prevent_dce.Store3(0u, asuint(floor_60d7ea()));
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_60d7ea();
+ prevent_dce.Store3(0u, asuint(floor_60d7ea()));
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ float3 prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation float3 prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_60d7ea();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl
index 96cfc08..3c60441 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.fxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_60d7ea() {
+float3 floor_60d7ea() {
float3 res = (1.0f).xxx;
- prevent_dce.Store3(0u, asuint(res));
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_60d7ea();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_60d7ea();
+ prevent_dce.Store3(0u, asuint(floor_60d7ea()));
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_60d7ea();
+ prevent_dce.Store3(0u, asuint(floor_60d7ea()));
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ float3 prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation float3 prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_60d7ea();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl
index 2a07177..d260d49 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.glsl
@@ -1,44 +1,24 @@
#version 310 es
-
-layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
- vec3 inner;
- uint pad;
-} prevent_dce;
-
-void floor_60d7ea() {
- vec3 res = vec3(1.0f);
- prevent_dce.inner = res;
-}
-
-vec4 vertex_main() {
- floor_60d7ea();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
precision highp float;
precision highp int;
+vec3 floor_60d7ea() {
+ vec3 res = vec3(1.0f);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec3 inner;
uint pad;
} prevent_dce;
-void floor_60d7ea() {
- vec3 res = vec3(1.0f);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ vec3 prevent_dce;
+};
void fragment_main() {
- floor_60d7ea();
+ prevent_dce.inner = floor_60d7ea();
}
void main() {
@@ -47,18 +27,23 @@
}
#version 310 es
+vec3 floor_60d7ea() {
+ vec3 res = vec3(1.0f);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
vec3 inner;
uint pad;
} prevent_dce;
-void floor_60d7ea() {
- vec3 res = vec3(1.0f);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ vec3 prevent_dce;
+};
void compute_main() {
- floor_60d7ea();
+ prevent_dce.inner = floor_60d7ea();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -66,3 +51,32 @@
compute_main();
return;
}
+#version 310 es
+
+layout(location = 0) flat out vec3 prevent_dce_1;
+vec3 floor_60d7ea() {
+ vec3 res = vec3(1.0f);
+ return res;
+}
+
+struct VertexOutput {
+ vec4 pos;
+ vec3 prevent_dce;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), vec3(0.0f, 0.0f, 0.0f));
+ tint_symbol.pos = vec4(0.0f);
+ tint_symbol.prevent_dce = floor_60d7ea();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ prevent_dce_1 = inner_result.prevent_dce;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl
index 44b19ad..722bfe2 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.msl
@@ -1,34 +1,43 @@
#include <metal_stdlib>
using namespace metal;
-void floor_60d7ea(device packed_float3* const tint_symbol_1) {
+float3 floor_60d7ea() {
float3 res = float3(1.0f);
- *(tint_symbol_1) = packed_float3(res);
+ return res;
}
-struct tint_symbol {
- float4 value [[position]];
+fragment void fragment_main(device packed_float3* tint_symbol_1 [[buffer(0)]]) {
+ *(tint_symbol_1) = packed_float3(floor_60d7ea());
+ return;
+}
+
+kernel void compute_main(device packed_float3* tint_symbol_2 [[buffer(0)]]) {
+ *(tint_symbol_2) = packed_float3(floor_60d7ea());
+ return;
+}
+
+struct VertexOutput {
+ float4 pos;
+ float3 prevent_dce;
};
-float4 vertex_main_inner(device packed_float3* const tint_symbol_2) {
- floor_60d7ea(tint_symbol_2);
- return float4(0.0f);
+struct tint_symbol {
+ float3 prevent_dce [[user(locn0)]] [[flat]];
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ out.prevent_dce = floor_60d7ea();
+ return out;
}
-vertex tint_symbol vertex_main(device packed_float3* tint_symbol_3 [[buffer(0)]]) {
- float4 const inner_result = vertex_main_inner(tint_symbol_3);
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
return wrapper_result;
}
-fragment void fragment_main(device packed_float3* tint_symbol_4 [[buffer(0)]]) {
- floor_60d7ea(tint_symbol_4);
- return;
-}
-
-kernel void compute_main(device packed_float3* tint_symbol_5 [[buffer(0)]]) {
- floor_60d7ea(tint_symbol_5);
- return;
-}
-
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm
index d4c0f3f..b8ec1ec 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.spvasm
@@ -1,82 +1,110 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 40
+; Bound: 55
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %prevent_dce_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
+ OpName %prevent_dce_1 "prevent_dce_1"
OpName %vertex_point_size "vertex_point_size"
OpName %prevent_dce_block "prevent_dce_block"
OpMemberName %prevent_dce_block 0 "inner"
OpName %prevent_dce "prevent_dce"
OpName %floor_60d7ea "floor_60d7ea"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpMemberName %VertexOutput 1 "prevent_dce"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
+ OpDecorate %prevent_dce_1 Location 0
+ OpDecorate %prevent_dce_1 Flat
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %prevent_dce_block Block
OpMemberDecorate %prevent_dce_block 0 Offset 0
- OpDecorate %prevent_dce DescriptorSet 2
+ OpDecorate %prevent_dce DescriptorSet 0
OpDecorate %prevent_dce Binding 0
+ OpMemberDecorate %VertexOutput 0 Offset 0
+ OpMemberDecorate %VertexOutput 1 Offset 16
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
-%_ptr_Output_float = OpTypePointer Output %float
- %8 = OpConstantNull %float
-%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%v3float = OpTypeVector %float 3
+%_ptr_Output_v3float = OpTypePointer Output %v3float
+ %9 = OpConstantNull %v3float
+%prevent_dce_1 = OpVariable %_ptr_Output_v3float Output %9
+%_ptr_Output_float = OpTypePointer Output %float
+ %12 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %12
%prevent_dce_block = OpTypeStruct %v3float
%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
- %void = OpTypeVoid
- %13 = OpTypeFunction %void
+ %16 = OpTypeFunction %v3float
%float_1 = OpConstant %float 1
- %18 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %20 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
- %21 = OpConstantNull %v3float
+ %void = OpTypeVoid
+ %24 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v3float = OpTypePointer StorageBuffer %v3float
- %27 = OpTypeFunction %v4float
-%floor_60d7ea = OpFunction %void None %13
- %16 = OpLabel
- %res = OpVariable %_ptr_Function_v3float Function %21
- OpStore %res %18
- %25 = OpAccessChain %_ptr_StorageBuffer_v3float %prevent_dce %uint_0
- %26 = OpLoad %v3float %res
- OpStore %25 %26
+%VertexOutput = OpTypeStruct %v4float %v3float
+ %37 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %43 = OpConstantNull %VertexOutput
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %uint_1 = OpConstant %uint 1
+%floor_60d7ea = OpFunction %v3float None %16
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_v3float Function %9
+ OpStore %res %20
+ %23 = OpLoad %v3float %res
+ OpReturnValue %23
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %24
+ %27 = OpLabel
+ %31 = OpAccessChain %_ptr_StorageBuffer_v3float %prevent_dce %uint_0
+ %32 = OpFunctionCall %v3float %floor_60d7ea
+ OpStore %31 %32
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %27
- %29 = OpLabel
- %30 = OpFunctionCall %void %floor_60d7ea
- OpReturnValue %5
+%compute_main = OpFunction %void None %24
+ %34 = OpLabel
+ %35 = OpAccessChain %_ptr_StorageBuffer_v3float %prevent_dce %uint_0
+ %36 = OpFunctionCall %v3float %floor_60d7ea
+ OpStore %35 %36
+ OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %13
- %32 = OpLabel
- %33 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %33
+%vertex_main_inner = OpFunction %VertexOutput None %37
+ %40 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %43
+ %45 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %45 %5
+ %47 = OpAccessChain %_ptr_Function_v3float %out %uint_1
+ %48 = OpFunctionCall %v3float %floor_60d7ea
+ OpStore %47 %48
+ %49 = OpLoad %VertexOutput %out
+ OpReturnValue %49
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %24
+ %51 = OpLabel
+ %52 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %53 = OpCompositeExtract %v4float %52 0
+ OpStore %pos_1 %53
+ %54 = OpCompositeExtract %v3float %52 1
+ OpStore %prevent_dce_1 %54
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %13
- %35 = OpLabel
- %36 = OpFunctionCall %void %floor_60d7ea
- OpReturn
- OpFunctionEnd
-%compute_main = OpFunction %void None %13
- %38 = OpLabel
- %39 = OpFunctionCall %void %floor_60d7ea
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl
index 326899d..3988c9e 100644
--- a/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/60d7ea.wgsl.expected.wgsl
@@ -1,22 +1,31 @@
-fn floor_60d7ea() {
+fn floor_60d7ea() -> vec3<f32> {
var res : vec3<f32> = floor(vec3<f32>(1.5f));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec3<f32>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_60d7ea();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec3<f32>;
@fragment
fn fragment_main() {
- floor_60d7ea();
+ prevent_dce = floor_60d7ea();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_60d7ea();
+ prevent_dce = floor_60d7ea();
+}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+ @location(0) @interpolate(flat)
+ prevent_dce : vec3<f32>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_60d7ea();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl
index 3e86e11..647ccd0 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl
@@ -36,24 +36,31 @@
// fn floor(f32) -> f32
-fn floor_66f154() {
+fn floor_66f154() -> f32{
var res: f32 = floor(1.5f);
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_66f154();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : f32;
@fragment
fn fragment_main() {
- floor_66f154();
+ prevent_dce = floor_66f154();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_66f154();
+ prevent_dce = floor_66f154();
+}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+ @location(0) @interpolate(flat) prevent_dce : f32
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_66f154();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl
index fa3c233..e7c8415 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.dxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_66f154() {
+float floor_66f154() {
float res = 1.0f;
- prevent_dce.Store(0u, asuint(res));
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_66f154();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_66f154();
+ prevent_dce.Store(0u, asuint(floor_66f154()));
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_66f154();
+ prevent_dce.Store(0u, asuint(floor_66f154()));
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ float prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation float prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_66f154();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl
index fa3c233..e7c8415 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.fxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_66f154() {
+float floor_66f154() {
float res = 1.0f;
- prevent_dce.Store(0u, asuint(res));
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_66f154();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_66f154();
+ prevent_dce.Store(0u, asuint(floor_66f154()));
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_66f154();
+ prevent_dce.Store(0u, asuint(floor_66f154()));
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ float prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation float prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_66f154();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl
index eb672fd..0702579 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.glsl
@@ -1,42 +1,23 @@
#version 310 es
-
-layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
- float inner;
-} prevent_dce;
-
-void floor_66f154() {
- float res = 1.0f;
- prevent_dce.inner = res;
-}
-
-vec4 vertex_main() {
- floor_66f154();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
precision highp float;
precision highp int;
+float floor_66f154() {
+ float res = 1.0f;
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
float inner;
} prevent_dce;
-void floor_66f154() {
- float res = 1.0f;
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ float prevent_dce;
+};
void fragment_main() {
- floor_66f154();
+ prevent_dce.inner = floor_66f154();
}
void main() {
@@ -45,17 +26,22 @@
}
#version 310 es
+float floor_66f154() {
+ float res = 1.0f;
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
float inner;
} prevent_dce;
-void floor_66f154() {
- float res = 1.0f;
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ float prevent_dce;
+};
void compute_main() {
- floor_66f154();
+ prevent_dce.inner = floor_66f154();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -63,3 +49,32 @@
compute_main();
return;
}
+#version 310 es
+
+layout(location = 0) flat out float prevent_dce_1;
+float floor_66f154() {
+ float res = 1.0f;
+ return res;
+}
+
+struct VertexOutput {
+ vec4 pos;
+ float prevent_dce;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0f);
+ tint_symbol.pos = vec4(0.0f);
+ tint_symbol.prevent_dce = floor_66f154();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ prevent_dce_1 = inner_result.prevent_dce;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl
index a03434a..65a8bcd 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.msl
@@ -1,34 +1,43 @@
#include <metal_stdlib>
using namespace metal;
-void floor_66f154(device float* const tint_symbol_1) {
+float floor_66f154() {
float res = 1.0f;
- *(tint_symbol_1) = res;
+ return res;
}
-struct tint_symbol {
- float4 value [[position]];
+fragment void fragment_main(device float* tint_symbol_1 [[buffer(0)]]) {
+ *(tint_symbol_1) = floor_66f154();
+ return;
+}
+
+kernel void compute_main(device float* tint_symbol_2 [[buffer(0)]]) {
+ *(tint_symbol_2) = floor_66f154();
+ return;
+}
+
+struct VertexOutput {
+ float4 pos;
+ float prevent_dce;
};
-float4 vertex_main_inner(device float* const tint_symbol_2) {
- floor_66f154(tint_symbol_2);
- return float4(0.0f);
+struct tint_symbol {
+ float prevent_dce [[user(locn0)]] [[flat]];
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ out.prevent_dce = floor_66f154();
+ return out;
}
-vertex tint_symbol vertex_main(device float* tint_symbol_3 [[buffer(0)]]) {
- float4 const inner_result = vertex_main_inner(tint_symbol_3);
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
return wrapper_result;
}
-fragment void fragment_main(device float* tint_symbol_4 [[buffer(0)]]) {
- floor_66f154(tint_symbol_4);
- return;
-}
-
-kernel void compute_main(device float* tint_symbol_5 [[buffer(0)]]) {
- floor_66f154(tint_symbol_5);
- return;
-}
-
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm
index 2eb5bc3..d46fe9a 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.spvasm
@@ -1,79 +1,106 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 37
+; Bound: 51
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %prevent_dce_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
+ OpName %prevent_dce_1 "prevent_dce_1"
OpName %vertex_point_size "vertex_point_size"
OpName %prevent_dce_block "prevent_dce_block"
OpMemberName %prevent_dce_block 0 "inner"
OpName %prevent_dce "prevent_dce"
OpName %floor_66f154 "floor_66f154"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpMemberName %VertexOutput 1 "prevent_dce"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
+ OpDecorate %prevent_dce_1 Location 0
+ OpDecorate %prevent_dce_1 Flat
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %prevent_dce_block Block
OpMemberDecorate %prevent_dce_block 0 Offset 0
- OpDecorate %prevent_dce DescriptorSet 2
+ OpDecorate %prevent_dce DescriptorSet 0
OpDecorate %prevent_dce Binding 0
+ OpMemberDecorate %VertexOutput 0 Offset 0
+ OpMemberDecorate %VertexOutput 1 Offset 16
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
+%prevent_dce_1 = OpVariable %_ptr_Output_float Output %8
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
%prevent_dce_block = OpTypeStruct %float
%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
- %void = OpTypeVoid
- %12 = OpTypeFunction %void
+ %13 = OpTypeFunction %float
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
+ %void = OpTypeVoid
+ %20 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
- %24 = OpTypeFunction %v4float
-%floor_66f154 = OpFunction %void None %12
+%VertexOutput = OpTypeStruct %v4float %float
+ %33 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %39 = OpConstantNull %VertexOutput
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %uint_1 = OpConstant %uint 1
+%floor_66f154 = OpFunction %float None %13
%15 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_1
- %22 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
- %23 = OpLoad %float %res
- OpStore %22 %23
+ %19 = OpLoad %float %res
+ OpReturnValue %19
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %20
+ %23 = OpLabel
+ %27 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+ %28 = OpFunctionCall %float %floor_66f154
+ OpStore %27 %28
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %24
- %26 = OpLabel
- %27 = OpFunctionCall %void %floor_66f154
- OpReturnValue %5
+%compute_main = OpFunction %void None %20
+ %30 = OpLabel
+ %31 = OpAccessChain %_ptr_StorageBuffer_float %prevent_dce %uint_0
+ %32 = OpFunctionCall %float %floor_66f154
+ OpStore %31 %32
+ OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %12
- %29 = OpLabel
- %30 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %30
+%vertex_main_inner = OpFunction %VertexOutput None %33
+ %36 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %39
+ %41 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %41 %5
+ %43 = OpAccessChain %_ptr_Function_float %out %uint_1
+ %44 = OpFunctionCall %float %floor_66f154
+ OpStore %43 %44
+ %45 = OpLoad %VertexOutput %out
+ OpReturnValue %45
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %20
+ %47 = OpLabel
+ %48 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %49 = OpCompositeExtract %v4float %48 0
+ OpStore %pos_1 %49
+ %50 = OpCompositeExtract %float %48 1
+ OpStore %prevent_dce_1 %50
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %12
- %32 = OpLabel
- %33 = OpFunctionCall %void %floor_66f154
- OpReturn
- OpFunctionEnd
-%compute_main = OpFunction %void None %12
- %35 = OpLabel
- %36 = OpFunctionCall %void %floor_66f154
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl
index c80b77b..c2c04c2 100644
--- a/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/66f154.wgsl.expected.wgsl
@@ -1,22 +1,31 @@
-fn floor_66f154() {
+fn floor_66f154() -> f32 {
var res : f32 = floor(1.5f);
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : f32;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_66f154();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : f32;
@fragment
fn fragment_main() {
- floor_66f154();
+ prevent_dce = floor_66f154();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_66f154();
+ prevent_dce = floor_66f154();
+}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+ @location(0) @interpolate(flat)
+ prevent_dce : f32,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_66f154();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl
index 649b844..f0b2a91 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl
@@ -41,24 +41,31 @@
enable f16;
// fn floor(vec<2, f16>) -> vec<2, f16>
-fn floor_84658c() {
+fn floor_84658c() -> vec2<f16>{
var res: vec2<f16> = floor(vec2<f16>(1.5h));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec2<f16>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_84658c();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec2<f16>;
@fragment
fn fragment_main() {
- floor_84658c();
+ prevent_dce = floor_84658c();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_84658c();
+ prevent_dce = floor_84658c();
+}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+ @location(0) @interpolate(flat) prevent_dce : vec2<f16>
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_84658c();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl
index 2d30777..4b7a3e1 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.dxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_84658c() {
+vector<float16_t, 2> floor_84658c() {
vector<float16_t, 2> res = (float16_t(1.0h)).xx;
- prevent_dce.Store<vector<float16_t, 2> >(0u, res);
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_84658c();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_84658c();
+ prevent_dce.Store<vector<float16_t, 2> >(0u, floor_84658c());
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_84658c();
+ prevent_dce.Store<vector<float16_t, 2> >(0u, floor_84658c());
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ vector<float16_t, 2> prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation vector<float16_t, 2> prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_84658c();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl
index abb61eb..2289267 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.glsl
@@ -1,44 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-
-layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
- f16vec2 inner;
-} prevent_dce;
-
-void floor_84658c() {
- f16vec2 res = f16vec2(1.0hf);
- prevent_dce.inner = res;
-}
-
-vec4 vertex_main() {
- floor_84658c();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
-#extension GL_AMD_gpu_shader_half_float : require
precision highp float;
precision highp int;
+f16vec2 floor_84658c() {
+ f16vec2 res = f16vec2(1.0hf);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec2 inner;
} prevent_dce;
-void floor_84658c() {
- f16vec2 res = f16vec2(1.0hf);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ f16vec2 prevent_dce;
+};
void fragment_main() {
- floor_84658c();
+ prevent_dce.inner = floor_84658c();
}
void main() {
@@ -48,17 +28,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16vec2 floor_84658c() {
+ f16vec2 res = f16vec2(1.0hf);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec2 inner;
} prevent_dce;
-void floor_84658c() {
- f16vec2 res = f16vec2(1.0hf);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ f16vec2 prevent_dce;
+};
void compute_main() {
- floor_84658c();
+ prevent_dce.inner = floor_84658c();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -66,3 +51,33 @@
compute_main();
return;
}
+#version 310 es
+#extension GL_AMD_gpu_shader_half_float : require
+
+layout(location = 0) flat out f16vec2 prevent_dce_1;
+f16vec2 floor_84658c() {
+ f16vec2 res = f16vec2(1.0hf);
+ return res;
+}
+
+struct VertexOutput {
+ vec4 pos;
+ f16vec2 prevent_dce;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), f16vec2(0.0hf, 0.0hf));
+ tint_symbol.pos = vec4(0.0f);
+ tint_symbol.prevent_dce = floor_84658c();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ prevent_dce_1 = inner_result.prevent_dce;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl
index 688dc20..cb4e241 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.msl
@@ -1,34 +1,43 @@
#include <metal_stdlib>
using namespace metal;
-void floor_84658c(device half2* const tint_symbol_1) {
+half2 floor_84658c() {
half2 res = half2(1.0h);
- *(tint_symbol_1) = res;
+ return res;
}
-struct tint_symbol {
- float4 value [[position]];
+fragment void fragment_main(device half2* tint_symbol_1 [[buffer(0)]]) {
+ *(tint_symbol_1) = floor_84658c();
+ return;
+}
+
+kernel void compute_main(device half2* tint_symbol_2 [[buffer(0)]]) {
+ *(tint_symbol_2) = floor_84658c();
+ return;
+}
+
+struct VertexOutput {
+ float4 pos;
+ half2 prevent_dce;
};
-float4 vertex_main_inner(device half2* const tint_symbol_2) {
- floor_84658c(tint_symbol_2);
- return float4(0.0f);
+struct tint_symbol {
+ half2 prevent_dce [[user(locn0)]] [[flat]];
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ out.prevent_dce = floor_84658c();
+ return out;
}
-vertex tint_symbol vertex_main(device half2* tint_symbol_3 [[buffer(0)]]) {
- float4 const inner_result = vertex_main_inner(tint_symbol_3);
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
return wrapper_result;
}
-fragment void fragment_main(device half2* tint_symbol_4 [[buffer(0)]]) {
- floor_84658c(tint_symbol_4);
- return;
-}
-
-kernel void compute_main(device half2* tint_symbol_5 [[buffer(0)]]) {
- floor_84658c(tint_symbol_5);
- return;
-}
-
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm
index 31b0816..22a55e5 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.spvasm
@@ -1,87 +1,116 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 57
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
+ OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %prevent_dce_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
+ OpName %prevent_dce_1 "prevent_dce_1"
OpName %vertex_point_size "vertex_point_size"
OpName %prevent_dce_block "prevent_dce_block"
OpMemberName %prevent_dce_block 0 "inner"
OpName %prevent_dce "prevent_dce"
OpName %floor_84658c "floor_84658c"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpMemberName %VertexOutput 1 "prevent_dce"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
+ OpDecorate %prevent_dce_1 Location 0
+ OpDecorate %prevent_dce_1 Flat
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %prevent_dce_block Block
OpMemberDecorate %prevent_dce_block 0 Offset 0
- OpDecorate %prevent_dce DescriptorSet 2
+ OpDecorate %prevent_dce DescriptorSet 0
OpDecorate %prevent_dce Binding 0
+ OpMemberDecorate %VertexOutput 0 Offset 0
+ OpMemberDecorate %VertexOutput 1 Offset 16
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
-%_ptr_Output_float = OpTypePointer Output %float
- %8 = OpConstantNull %float
-%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%half = OpTypeFloat 16
%v2half = OpTypeVector %half 2
+%_ptr_Output_v2half = OpTypePointer Output %v2half
+ %10 = OpConstantNull %v2half
+%prevent_dce_1 = OpVariable %_ptr_Output_v2half Output %10
+%_ptr_Output_float = OpTypePointer Output %float
+ %13 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %13
%prevent_dce_block = OpTypeStruct %v2half
%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
- %void = OpTypeVoid
- %14 = OpTypeFunction %void
+ %17 = OpTypeFunction %v2half
%half_0x1p_0 = OpConstant %half 0x1p+0
- %19 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
+ %21 = OpConstantComposite %v2half %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v2half = OpTypePointer Function %v2half
- %22 = OpConstantNull %v2half
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v2half = OpTypePointer StorageBuffer %v2half
- %28 = OpTypeFunction %v4float
+%VertexOutput = OpTypeStruct %v4float %v2half
+ %38 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %44 = OpConstantNull %VertexOutput
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %uint_1 = OpConstant %uint 1
%float_1 = OpConstant %float 1
-%floor_84658c = OpFunction %void None %14
- %17 = OpLabel
- %res = OpVariable %_ptr_Function_v2half Function %22
- OpStore %res %19
- %26 = OpAccessChain %_ptr_StorageBuffer_v2half %prevent_dce %uint_0
- %27 = OpLoad %v2half %res
- OpStore %26 %27
+%floor_84658c = OpFunction %v2half None %17
+ %19 = OpLabel
+ %res = OpVariable %_ptr_Function_v2half Function %10
+ OpStore %res %21
+ %24 = OpLoad %v2half %res
+ OpReturnValue %24
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v2half %prevent_dce %uint_0
+ %33 = OpFunctionCall %v2half %floor_84658c
+ OpStore %32 %33
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %28
- %30 = OpLabel
- %31 = OpFunctionCall %void %floor_84658c
- OpReturnValue %5
+%compute_main = OpFunction %void None %25
+ %35 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v2half %prevent_dce %uint_0
+ %37 = OpFunctionCall %v2half %floor_84658c
+ OpStore %36 %37
+ OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %14
- %33 = OpLabel
- %34 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %34
+%vertex_main_inner = OpFunction %VertexOutput None %38
+ %41 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %44
+ %46 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %46 %5
+ %48 = OpAccessChain %_ptr_Function_v2half %out %uint_1
+ %49 = OpFunctionCall %v2half %floor_84658c
+ OpStore %48 %49
+ %50 = OpLoad %VertexOutput %out
+ OpReturnValue %50
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %52 = OpLabel
+ %53 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %54 = OpCompositeExtract %v4float %53 0
+ OpStore %pos_1 %54
+ %55 = OpCompositeExtract %v2half %53 1
+ OpStore %prevent_dce_1 %55
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %14
- %37 = OpLabel
- %38 = OpFunctionCall %void %floor_84658c
- OpReturn
- OpFunctionEnd
-%compute_main = OpFunction %void None %14
- %40 = OpLabel
- %41 = OpFunctionCall %void %floor_84658c
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl
index b9d8599..eca687f 100644
--- a/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/84658c.wgsl.expected.wgsl
@@ -1,24 +1,33 @@
enable f16;
-fn floor_84658c() {
+fn floor_84658c() -> vec2<f16> {
var res : vec2<f16> = floor(vec2<f16>(1.5h));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec2<f16>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_84658c();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec2<f16>;
@fragment
fn fragment_main() {
- floor_84658c();
+ prevent_dce = floor_84658c();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_84658c();
+ prevent_dce = floor_84658c();
+}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+ @location(0) @interpolate(flat)
+ prevent_dce : vec2<f16>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_84658c();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl b/test/tint/builtins/gen/literal/floor/953774.wgsl
index 9845c88..ab1d2a2 100644
--- a/test/tint/builtins/gen/literal/floor/953774.wgsl
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl
@@ -39,12 +39,6 @@
fn floor_953774() {
var res = floor(vec3(1.5));
}
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_953774();
- return vec4<f32>();
-}
-
@fragment
fn fragment_main() {
floor_953774();
@@ -54,3 +48,15 @@
fn compute_main() {
floor_953774();
}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ floor_953774();
+ return out;
+}
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.dxc.hlsl
index 9b92779..28a7447 100644
--- a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.dxc.hlsl
@@ -2,22 +2,6 @@
float3 res = (1.0f).xxx;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_953774();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
void fragment_main() {
floor_953774();
return;
@@ -28,3 +12,24 @@
floor_953774();
return;
}
+
+struct VertexOutput {
+ float4 pos;
+};
+struct tint_symbol_1 {
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ floor_953774();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.fxc.hlsl
index 9b92779..28a7447 100644
--- a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.fxc.hlsl
@@ -2,22 +2,6 @@
float3 res = (1.0f).xxx;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_953774();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
void fragment_main() {
floor_953774();
return;
@@ -28,3 +12,24 @@
floor_953774();
return;
}
+
+struct VertexOutput {
+ float4 pos;
+};
+struct tint_symbol_1 {
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ floor_953774();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.glsl
index 159d56c..edf6b9b 100644
--- a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.glsl
@@ -1,23 +1,4 @@
#version 310 es
-
-void floor_953774() {
- vec3 res = vec3(1.0f);
-}
-
-vec4 vertex_main() {
- floor_953774();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
precision highp float;
precision highp int;
@@ -25,6 +6,10 @@
vec3 res = vec3(1.0f);
}
+struct VertexOutput {
+ vec4 pos;
+};
+
void fragment_main() {
floor_953774();
}
@@ -39,6 +24,10 @@
vec3 res = vec3(1.0f);
}
+struct VertexOutput {
+ vec4 pos;
+};
+
void compute_main() {
floor_953774();
}
@@ -48,3 +37,28 @@
compute_main();
return;
}
+#version 310 es
+
+void floor_953774() {
+ vec3 res = vec3(1.0f);
+}
+
+struct VertexOutput {
+ vec4 pos;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f));
+ tint_symbol.pos = vec4(0.0f);
+ floor_953774();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.msl
index f717392..7f725d3 100644
--- a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.msl
@@ -5,22 +5,6 @@
float3 res = float3(1.0f);
}
-struct tint_symbol {
- float4 value [[position]];
-};
-
-float4 vertex_main_inner() {
- floor_953774();
- return float4(0.0f);
-}
-
-vertex tint_symbol vertex_main() {
- float4 const inner_result = vertex_main_inner();
- tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
fragment void fragment_main() {
floor_953774();
return;
@@ -31,3 +15,25 @@
return;
}
+struct VertexOutput {
+ float4 pos;
+};
+
+struct tint_symbol {
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ floor_953774();
+ return out;
+}
+
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
+
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.spvasm
index 5349ca5..bb5eb44 100644
--- a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.spvasm
@@ -1,30 +1,34 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 42
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
OpName %vertex_point_size "vertex_point_size"
OpName %floor_953774 "floor_953774"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
+ OpMemberDecorate %VertexOutput 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
@@ -35,32 +39,43 @@
%15 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v3float = OpTypePointer Function %v3float
%18 = OpConstantNull %v3float
- %19 = OpTypeFunction %v4float
+%VertexOutput = OpTypeStruct %v4float
+ %25 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %31 = OpConstantNull %VertexOutput
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_v4float = OpTypePointer Function %v4float
%floor_953774 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v3float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
- %21 = OpLabel
- %22 = OpFunctionCall %void %floor_953774
- OpReturnValue %5
- OpFunctionEnd
-%vertex_main = OpFunction %void None %9
- %24 = OpLabel
- %25 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %25
- OpStore %vertex_point_size %float_1
- OpReturn
- OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %void %floor_953774
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %floor_953774
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %30 = OpLabel
- %31 = OpFunctionCall %void %floor_953774
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %floor_953774
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %VertexOutput None %25
+ %28 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %31
+ %35 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %35 %5
+ %36 = OpFunctionCall %void %floor_953774
+ %37 = OpLoad %VertexOutput %out
+ OpReturnValue %37
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %39 = OpLabel
+ %40 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %41 = OpCompositeExtract %v4float %40 0
+ OpStore %pos_1 %41
+ OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.wgsl
index 7cb39a8..9ae142a 100644
--- a/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/953774.wgsl.expected.wgsl
@@ -2,12 +2,6 @@
var res = floor(vec3(1.5));
}
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_953774();
- return vec4<f32>();
-}
-
@fragment
fn fragment_main() {
floor_953774();
@@ -17,3 +11,16 @@
fn compute_main() {
floor_953774();
}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ floor_953774();
+ return out;
+}
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl
index 0c8f0ca..b8c475f 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl
@@ -41,24 +41,31 @@
enable f16;
// fn floor(vec<4, f16>) -> vec<4, f16>
-fn floor_a2d31b() {
+fn floor_a2d31b() -> vec4<f16>{
var res: vec4<f16> = floor(vec4<f16>(1.5h));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec4<f16>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_a2d31b();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec4<f16>;
@fragment
fn fragment_main() {
- floor_a2d31b();
+ prevent_dce = floor_a2d31b();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_a2d31b();
+ prevent_dce = floor_a2d31b();
+}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+ @location(0) @interpolate(flat) prevent_dce : vec4<f16>
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_a2d31b();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl
index 2d4739c..171d7a1 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.dxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_a2d31b() {
+vector<float16_t, 4> floor_a2d31b() {
vector<float16_t, 4> res = (float16_t(1.0h)).xxxx;
- prevent_dce.Store<vector<float16_t, 4> >(0u, res);
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_a2d31b();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_a2d31b();
+ prevent_dce.Store<vector<float16_t, 4> >(0u, floor_a2d31b());
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_a2d31b();
+ prevent_dce.Store<vector<float16_t, 4> >(0u, floor_a2d31b());
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ vector<float16_t, 4> prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation vector<float16_t, 4> prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_a2d31b();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl
index 94d2423..428bf26 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.glsl
@@ -1,44 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-
-layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
- f16vec4 inner;
-} prevent_dce;
-
-void floor_a2d31b() {
- f16vec4 res = f16vec4(1.0hf);
- prevent_dce.inner = res;
-}
-
-vec4 vertex_main() {
- floor_a2d31b();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
-#extension GL_AMD_gpu_shader_half_float : require
precision highp float;
precision highp int;
+f16vec4 floor_a2d31b() {
+ f16vec4 res = f16vec4(1.0hf);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec4 inner;
} prevent_dce;
-void floor_a2d31b() {
- f16vec4 res = f16vec4(1.0hf);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ f16vec4 prevent_dce;
+};
void fragment_main() {
- floor_a2d31b();
+ prevent_dce.inner = floor_a2d31b();
}
void main() {
@@ -48,17 +28,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+f16vec4 floor_a2d31b() {
+ f16vec4 res = f16vec4(1.0hf);
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
f16vec4 inner;
} prevent_dce;
-void floor_a2d31b() {
- f16vec4 res = f16vec4(1.0hf);
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ f16vec4 prevent_dce;
+};
void compute_main() {
- floor_a2d31b();
+ prevent_dce.inner = floor_a2d31b();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -66,3 +51,33 @@
compute_main();
return;
}
+#version 310 es
+#extension GL_AMD_gpu_shader_half_float : require
+
+layout(location = 0) flat out f16vec4 prevent_dce_1;
+f16vec4 floor_a2d31b() {
+ f16vec4 res = f16vec4(1.0hf);
+ return res;
+}
+
+struct VertexOutput {
+ vec4 pos;
+ f16vec4 prevent_dce;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), f16vec4(0.0hf, 0.0hf, 0.0hf, 0.0hf));
+ tint_symbol.pos = vec4(0.0f);
+ tint_symbol.prevent_dce = floor_a2d31b();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ prevent_dce_1 = inner_result.prevent_dce;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl
index dc86bdd..c200818 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.msl
@@ -1,34 +1,43 @@
#include <metal_stdlib>
using namespace metal;
-void floor_a2d31b(device half4* const tint_symbol_1) {
+half4 floor_a2d31b() {
half4 res = half4(1.0h);
- *(tint_symbol_1) = res;
+ return res;
}
-struct tint_symbol {
- float4 value [[position]];
+fragment void fragment_main(device half4* tint_symbol_1 [[buffer(0)]]) {
+ *(tint_symbol_1) = floor_a2d31b();
+ return;
+}
+
+kernel void compute_main(device half4* tint_symbol_2 [[buffer(0)]]) {
+ *(tint_symbol_2) = floor_a2d31b();
+ return;
+}
+
+struct VertexOutput {
+ float4 pos;
+ half4 prevent_dce;
};
-float4 vertex_main_inner(device half4* const tint_symbol_2) {
- floor_a2d31b(tint_symbol_2);
- return float4(0.0f);
+struct tint_symbol {
+ half4 prevent_dce [[user(locn0)]] [[flat]];
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ out.prevent_dce = floor_a2d31b();
+ return out;
}
-vertex tint_symbol vertex_main(device half4* tint_symbol_3 [[buffer(0)]]) {
- float4 const inner_result = vertex_main_inner(tint_symbol_3);
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
return wrapper_result;
}
-fragment void fragment_main(device half4* tint_symbol_4 [[buffer(0)]]) {
- floor_a2d31b(tint_symbol_4);
- return;
-}
-
-kernel void compute_main(device half4* tint_symbol_5 [[buffer(0)]]) {
- floor_a2d31b(tint_symbol_5);
- return;
-}
-
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm
index f8ccbe4..8b24fc7 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.spvasm
@@ -1,87 +1,116 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 42
+; Bound: 57
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
+ OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %prevent_dce_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
+ OpName %prevent_dce_1 "prevent_dce_1"
OpName %vertex_point_size "vertex_point_size"
OpName %prevent_dce_block "prevent_dce_block"
OpMemberName %prevent_dce_block 0 "inner"
OpName %prevent_dce "prevent_dce"
OpName %floor_a2d31b "floor_a2d31b"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpMemberName %VertexOutput 1 "prevent_dce"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
+ OpDecorate %prevent_dce_1 Location 0
+ OpDecorate %prevent_dce_1 Flat
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %prevent_dce_block Block
OpMemberDecorate %prevent_dce_block 0 Offset 0
- OpDecorate %prevent_dce DescriptorSet 2
+ OpDecorate %prevent_dce DescriptorSet 0
OpDecorate %prevent_dce Binding 0
+ OpMemberDecorate %VertexOutput 0 Offset 0
+ OpMemberDecorate %VertexOutput 1 Offset 16
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
-%_ptr_Output_float = OpTypePointer Output %float
- %8 = OpConstantNull %float
-%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%half = OpTypeFloat 16
%v4half = OpTypeVector %half 4
+%_ptr_Output_v4half = OpTypePointer Output %v4half
+ %10 = OpConstantNull %v4half
+%prevent_dce_1 = OpVariable %_ptr_Output_v4half Output %10
+%_ptr_Output_float = OpTypePointer Output %float
+ %13 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %13
%prevent_dce_block = OpTypeStruct %v4half
%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
- %void = OpTypeVoid
- %14 = OpTypeFunction %void
+ %17 = OpTypeFunction %v4half
%half_0x1p_0 = OpConstant %half 0x1p+0
- %19 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
+ %21 = OpConstantComposite %v4half %half_0x1p_0 %half_0x1p_0 %half_0x1p_0 %half_0x1p_0
%_ptr_Function_v4half = OpTypePointer Function %v4half
- %22 = OpConstantNull %v4half
+ %void = OpTypeVoid
+ %25 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_v4half = OpTypePointer StorageBuffer %v4half
- %28 = OpTypeFunction %v4float
+%VertexOutput = OpTypeStruct %v4float %v4half
+ %38 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %44 = OpConstantNull %VertexOutput
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %uint_1 = OpConstant %uint 1
%float_1 = OpConstant %float 1
-%floor_a2d31b = OpFunction %void None %14
- %17 = OpLabel
- %res = OpVariable %_ptr_Function_v4half Function %22
- OpStore %res %19
- %26 = OpAccessChain %_ptr_StorageBuffer_v4half %prevent_dce %uint_0
- %27 = OpLoad %v4half %res
- OpStore %26 %27
+%floor_a2d31b = OpFunction %v4half None %17
+ %19 = OpLabel
+ %res = OpVariable %_ptr_Function_v4half Function %10
+ OpStore %res %21
+ %24 = OpLoad %v4half %res
+ OpReturnValue %24
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %25
+ %28 = OpLabel
+ %32 = OpAccessChain %_ptr_StorageBuffer_v4half %prevent_dce %uint_0
+ %33 = OpFunctionCall %v4half %floor_a2d31b
+ OpStore %32 %33
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %28
- %30 = OpLabel
- %31 = OpFunctionCall %void %floor_a2d31b
- OpReturnValue %5
+%compute_main = OpFunction %void None %25
+ %35 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_v4half %prevent_dce %uint_0
+ %37 = OpFunctionCall %v4half %floor_a2d31b
+ OpStore %36 %37
+ OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %14
- %33 = OpLabel
- %34 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %34
+%vertex_main_inner = OpFunction %VertexOutput None %38
+ %41 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %44
+ %46 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %46 %5
+ %48 = OpAccessChain %_ptr_Function_v4half %out %uint_1
+ %49 = OpFunctionCall %v4half %floor_a2d31b
+ OpStore %48 %49
+ %50 = OpLoad %VertexOutput %out
+ OpReturnValue %50
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %25
+ %52 = OpLabel
+ %53 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %54 = OpCompositeExtract %v4float %53 0
+ OpStore %pos_1 %54
+ %55 = OpCompositeExtract %v4half %53 1
+ OpStore %prevent_dce_1 %55
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %14
- %37 = OpLabel
- %38 = OpFunctionCall %void %floor_a2d31b
- OpReturn
- OpFunctionEnd
-%compute_main = OpFunction %void None %14
- %40 = OpLabel
- %41 = OpFunctionCall %void %floor_a2d31b
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl
index e6f67df1..391e36d 100644
--- a/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/a2d31b.wgsl.expected.wgsl
@@ -1,24 +1,33 @@
enable f16;
-fn floor_a2d31b() {
+fn floor_a2d31b() -> vec4<f16> {
var res : vec4<f16> = floor(vec4<f16>(1.5h));
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : vec4<f16>;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_a2d31b();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : vec4<f16>;
@fragment
fn fragment_main() {
- floor_a2d31b();
+ prevent_dce = floor_a2d31b();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_a2d31b();
+ prevent_dce = floor_a2d31b();
+}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+ @location(0) @interpolate(flat)
+ prevent_dce : vec4<f16>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_a2d31b();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl
index cc6bee1..5577b1f 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl
@@ -41,24 +41,31 @@
enable f16;
// fn floor(f16) -> f16
-fn floor_b6e09c() {
+fn floor_b6e09c() -> f16{
var res: f16 = floor(1.5h);
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : f16;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_b6e09c();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : f16;
@fragment
fn fragment_main() {
- floor_b6e09c();
+ prevent_dce = floor_b6e09c();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_b6e09c();
+ prevent_dce = floor_b6e09c();
+}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+ @location(0) @interpolate(flat) prevent_dce : f16
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_b6e09c();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl
index d08b3e3..b1869a3 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.dxc.hlsl
@@ -1,33 +1,41 @@
-RWByteAddressBuffer prevent_dce : register(u0, space2);
-
-void floor_b6e09c() {
+float16_t floor_b6e09c() {
float16_t res = float16_t(1.0h);
- prevent_dce.Store<float16_t>(0u, res);
+ return res;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_b6e09c();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
+RWByteAddressBuffer prevent_dce : register(u0);
void fragment_main() {
- floor_b6e09c();
+ prevent_dce.Store<float16_t>(0u, floor_b6e09c());
return;
}
[numthreads(1, 1, 1)]
void compute_main() {
- floor_b6e09c();
+ prevent_dce.Store<float16_t>(0u, floor_b6e09c());
return;
}
+
+struct VertexOutput {
+ float4 pos;
+ float16_t prevent_dce;
+};
+struct tint_symbol_1 {
+ nointerpolation float16_t prevent_dce : TEXCOORD0;
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ tint_symbol.prevent_dce = floor_b6e09c();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl
index 0f90ea2..16b65aa 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.glsl
@@ -1,44 +1,24 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
-
-layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
- float16_t inner;
-} prevent_dce;
-
-void floor_b6e09c() {
- float16_t res = 1.0hf;
- prevent_dce.inner = res;
-}
-
-vec4 vertex_main() {
- floor_b6e09c();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
-#extension GL_AMD_gpu_shader_half_float : require
precision highp float;
precision highp int;
+float16_t floor_b6e09c() {
+ float16_t res = 1.0hf;
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
float16_t inner;
} prevent_dce;
-void floor_b6e09c() {
- float16_t res = 1.0hf;
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ float16_t prevent_dce;
+};
void fragment_main() {
- floor_b6e09c();
+ prevent_dce.inner = floor_b6e09c();
}
void main() {
@@ -48,17 +28,22 @@
#version 310 es
#extension GL_AMD_gpu_shader_half_float : require
+float16_t floor_b6e09c() {
+ float16_t res = 1.0hf;
+ return res;
+}
+
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
float16_t inner;
} prevent_dce;
-void floor_b6e09c() {
- float16_t res = 1.0hf;
- prevent_dce.inner = res;
-}
+struct VertexOutput {
+ vec4 pos;
+ float16_t prevent_dce;
+};
void compute_main() {
- floor_b6e09c();
+ prevent_dce.inner = floor_b6e09c();
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
@@ -66,3 +51,33 @@
compute_main();
return;
}
+#version 310 es
+#extension GL_AMD_gpu_shader_half_float : require
+
+layout(location = 0) flat out float16_t prevent_dce_1;
+float16_t floor_b6e09c() {
+ float16_t res = 1.0hf;
+ return res;
+}
+
+struct VertexOutput {
+ vec4 pos;
+ float16_t prevent_dce;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f), 0.0hf);
+ tint_symbol.pos = vec4(0.0f);
+ tint_symbol.prevent_dce = floor_b6e09c();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ prevent_dce_1 = inner_result.prevent_dce;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl
index b30d763..c23b7f6 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.msl
@@ -1,34 +1,43 @@
#include <metal_stdlib>
using namespace metal;
-void floor_b6e09c(device half* const tint_symbol_1) {
+half floor_b6e09c() {
half res = 1.0h;
- *(tint_symbol_1) = res;
+ return res;
}
-struct tint_symbol {
- float4 value [[position]];
+fragment void fragment_main(device half* tint_symbol_1 [[buffer(0)]]) {
+ *(tint_symbol_1) = floor_b6e09c();
+ return;
+}
+
+kernel void compute_main(device half* tint_symbol_2 [[buffer(0)]]) {
+ *(tint_symbol_2) = floor_b6e09c();
+ return;
+}
+
+struct VertexOutput {
+ float4 pos;
+ half prevent_dce;
};
-float4 vertex_main_inner(device half* const tint_symbol_2) {
- floor_b6e09c(tint_symbol_2);
- return float4(0.0f);
+struct tint_symbol {
+ half prevent_dce [[user(locn0)]] [[flat]];
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ out.prevent_dce = floor_b6e09c();
+ return out;
}
-vertex tint_symbol vertex_main(device half* tint_symbol_3 [[buffer(0)]]) {
- float4 const inner_result = vertex_main_inner(tint_symbol_3);
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
+ wrapper_result.pos = inner_result.pos;
+ wrapper_result.prevent_dce = inner_result.prevent_dce;
return wrapper_result;
}
-fragment void fragment_main(device half* tint_symbol_4 [[buffer(0)]]) {
- floor_b6e09c(tint_symbol_4);
- return;
-}
-
-kernel void compute_main(device half* tint_symbol_5 [[buffer(0)]]) {
- floor_b6e09c(tint_symbol_5);
- return;
-}
-
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm
index 1bc8ea5..3d176f3 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.spvasm
@@ -1,85 +1,114 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 40
+; Bound: 55
; Schema: 0
OpCapability Shader
OpCapability Float16
OpCapability UniformAndStorageBuffer16BitAccess
OpCapability StorageBuffer16BitAccess
+ OpCapability StorageInputOutput16
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %prevent_dce_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
+ OpName %prevent_dce_1 "prevent_dce_1"
OpName %vertex_point_size "vertex_point_size"
OpName %prevent_dce_block "prevent_dce_block"
OpMemberName %prevent_dce_block 0 "inner"
OpName %prevent_dce "prevent_dce"
OpName %floor_b6e09c "floor_b6e09c"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpMemberName %VertexOutput 1 "prevent_dce"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
+ OpDecorate %prevent_dce_1 Location 0
+ OpDecorate %prevent_dce_1 Flat
OpDecorate %vertex_point_size BuiltIn PointSize
OpDecorate %prevent_dce_block Block
OpMemberDecorate %prevent_dce_block 0 Offset 0
- OpDecorate %prevent_dce DescriptorSet 2
+ OpDecorate %prevent_dce DescriptorSet 0
OpDecorate %prevent_dce Binding 0
+ OpMemberDecorate %VertexOutput 0 Offset 0
+ OpMemberDecorate %VertexOutput 1 Offset 16
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
-%_ptr_Output_float = OpTypePointer Output %float
- %8 = OpConstantNull %float
-%vertex_point_size = OpVariable %_ptr_Output_float Output %8
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%half = OpTypeFloat 16
+%_ptr_Output_half = OpTypePointer Output %half
+ %9 = OpConstantNull %half
+%prevent_dce_1 = OpVariable %_ptr_Output_half Output %9
+%_ptr_Output_float = OpTypePointer Output %float
+ %12 = OpConstantNull %float
+%vertex_point_size = OpVariable %_ptr_Output_float Output %12
%prevent_dce_block = OpTypeStruct %half
%_ptr_StorageBuffer_prevent_dce_block = OpTypePointer StorageBuffer %prevent_dce_block
%prevent_dce = OpVariable %_ptr_StorageBuffer_prevent_dce_block StorageBuffer
- %void = OpTypeVoid
- %13 = OpTypeFunction %void
+ %16 = OpTypeFunction %half
%half_0x1p_0 = OpConstant %half 0x1p+0
%_ptr_Function_half = OpTypePointer Function %half
- %20 = OpConstantNull %half
+ %void = OpTypeVoid
+ %23 = OpTypeFunction %void
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
%_ptr_StorageBuffer_half = OpTypePointer StorageBuffer %half
- %26 = OpTypeFunction %v4float
+%VertexOutput = OpTypeStruct %v4float %half
+ %36 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %42 = OpConstantNull %VertexOutput
+%_ptr_Function_v4float = OpTypePointer Function %v4float
+ %uint_1 = OpConstant %uint 1
%float_1 = OpConstant %float 1
-%floor_b6e09c = OpFunction %void None %13
- %16 = OpLabel
- %res = OpVariable %_ptr_Function_half Function %20
+%floor_b6e09c = OpFunction %half None %16
+ %18 = OpLabel
+ %res = OpVariable %_ptr_Function_half Function %9
OpStore %res %half_0x1p_0
- %24 = OpAccessChain %_ptr_StorageBuffer_half %prevent_dce %uint_0
- %25 = OpLoad %half %res
- OpStore %24 %25
+ %22 = OpLoad %half %res
+ OpReturnValue %22
+ OpFunctionEnd
+%fragment_main = OpFunction %void None %23
+ %26 = OpLabel
+ %30 = OpAccessChain %_ptr_StorageBuffer_half %prevent_dce %uint_0
+ %31 = OpFunctionCall %half %floor_b6e09c
+ OpStore %30 %31
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %26
- %28 = OpLabel
- %29 = OpFunctionCall %void %floor_b6e09c
- OpReturnValue %5
+%compute_main = OpFunction %void None %23
+ %33 = OpLabel
+ %34 = OpAccessChain %_ptr_StorageBuffer_half %prevent_dce %uint_0
+ %35 = OpFunctionCall %half %floor_b6e09c
+ OpStore %34 %35
+ OpReturn
OpFunctionEnd
-%vertex_main = OpFunction %void None %13
- %31 = OpLabel
- %32 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %32
+%vertex_main_inner = OpFunction %VertexOutput None %36
+ %39 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %42
+ %44 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %44 %5
+ %46 = OpAccessChain %_ptr_Function_half %out %uint_1
+ %47 = OpFunctionCall %half %floor_b6e09c
+ OpStore %46 %47
+ %48 = OpLoad %VertexOutput %out
+ OpReturnValue %48
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %23
+ %50 = OpLabel
+ %51 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %52 = OpCompositeExtract %v4float %51 0
+ OpStore %pos_1 %52
+ %53 = OpCompositeExtract %half %51 1
+ OpStore %prevent_dce_1 %53
OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
-%fragment_main = OpFunction %void None %13
- %35 = OpLabel
- %36 = OpFunctionCall %void %floor_b6e09c
- OpReturn
- OpFunctionEnd
-%compute_main = OpFunction %void None %13
- %38 = OpLabel
- %39 = OpFunctionCall %void %floor_b6e09c
- OpReturn
- OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl
index ec51f13..83df4b3 100644
--- a/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/b6e09c.wgsl.expected.wgsl
@@ -1,24 +1,33 @@
enable f16;
-fn floor_b6e09c() {
+fn floor_b6e09c() -> f16 {
var res : f16 = floor(1.5h);
- prevent_dce = res;
+ return res;
}
-@group(2) @binding(0) var<storage, read_write> prevent_dce : f16;
-
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_b6e09c();
- return vec4<f32>();
-}
+@group(0) @binding(0) var<storage, read_write> prevent_dce : f16;
@fragment
fn fragment_main() {
- floor_b6e09c();
+ prevent_dce = floor_b6e09c();
}
@compute @workgroup_size(1)
fn compute_main() {
- floor_b6e09c();
+ prevent_dce = floor_b6e09c();
+}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+ @location(0) @interpolate(flat)
+ prevent_dce : f16,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ out.prevent_dce = floor_b6e09c();
+ return out;
}
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl
index 785c753..be5ff08 100644
--- a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl
@@ -39,12 +39,6 @@
fn floor_dcd5a2() {
var res = floor(1.5);
}
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_dcd5a2();
- return vec4<f32>();
-}
-
@fragment
fn fragment_main() {
floor_dcd5a2();
@@ -54,3 +48,15 @@
fn compute_main() {
floor_dcd5a2();
}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ floor_dcd5a2();
+ return out;
+}
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.dxc.hlsl
index d87affb..6c74bbb 100644
--- a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.dxc.hlsl
@@ -2,22 +2,6 @@
float res = 1.0f;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_dcd5a2();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
void fragment_main() {
floor_dcd5a2();
return;
@@ -28,3 +12,24 @@
floor_dcd5a2();
return;
}
+
+struct VertexOutput {
+ float4 pos;
+};
+struct tint_symbol_1 {
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ floor_dcd5a2();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.fxc.hlsl
index d87affb..6c74bbb 100644
--- a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.fxc.hlsl
@@ -2,22 +2,6 @@
float res = 1.0f;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_dcd5a2();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
void fragment_main() {
floor_dcd5a2();
return;
@@ -28,3 +12,24 @@
floor_dcd5a2();
return;
}
+
+struct VertexOutput {
+ float4 pos;
+};
+struct tint_symbol_1 {
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ floor_dcd5a2();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.glsl
index 287bcf1..0ed28ab 100644
--- a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.glsl
@@ -1,23 +1,4 @@
#version 310 es
-
-void floor_dcd5a2() {
- float res = 1.0f;
-}
-
-vec4 vertex_main() {
- floor_dcd5a2();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
precision highp float;
precision highp int;
@@ -25,6 +6,10 @@
float res = 1.0f;
}
+struct VertexOutput {
+ vec4 pos;
+};
+
void fragment_main() {
floor_dcd5a2();
}
@@ -39,6 +24,10 @@
float res = 1.0f;
}
+struct VertexOutput {
+ vec4 pos;
+};
+
void compute_main() {
floor_dcd5a2();
}
@@ -48,3 +37,28 @@
compute_main();
return;
}
+#version 310 es
+
+void floor_dcd5a2() {
+ float res = 1.0f;
+}
+
+struct VertexOutput {
+ vec4 pos;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f));
+ tint_symbol.pos = vec4(0.0f);
+ floor_dcd5a2();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.msl
index 396fa07..1f9d4f3 100644
--- a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.msl
@@ -5,22 +5,6 @@
float res = 1.0f;
}
-struct tint_symbol {
- float4 value [[position]];
-};
-
-float4 vertex_main_inner() {
- floor_dcd5a2();
- return float4(0.0f);
-}
-
-vertex tint_symbol vertex_main() {
- float4 const inner_result = vertex_main_inner();
- tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
fragment void fragment_main() {
floor_dcd5a2();
return;
@@ -31,3 +15,25 @@
return;
}
+struct VertexOutput {
+ float4 pos;
+};
+
+struct tint_symbol {
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ floor_dcd5a2();
+ return out;
+}
+
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
+
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.spvasm
index ad4f786..f1265d3 100644
--- a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.spvasm
@@ -1,30 +1,34 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 29
+; Bound: 39
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
OpName %vertex_point_size "vertex_point_size"
OpName %floor_dcd5a2 "floor_dcd5a2"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
+ OpMemberDecorate %VertexOutput 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
@@ -32,32 +36,43 @@
%9 = OpTypeFunction %void
%float_1 = OpConstant %float 1
%_ptr_Function_float = OpTypePointer Function %float
- %16 = OpTypeFunction %v4float
+%VertexOutput = OpTypeStruct %v4float
+ %22 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %28 = OpConstantNull %VertexOutput
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_v4float = OpTypePointer Function %v4float
%floor_dcd5a2 = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_float Function %8
OpStore %res %float_1
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %16
- %18 = OpLabel
- %19 = OpFunctionCall %void %floor_dcd5a2
- OpReturnValue %5
- OpFunctionEnd
-%vertex_main = OpFunction %void None %9
- %21 = OpLabel
- %22 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %22
- OpStore %vertex_point_size %float_1
- OpReturn
- OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %24 = OpLabel
- %25 = OpFunctionCall %void %floor_dcd5a2
+ %17 = OpLabel
+ %18 = OpFunctionCall %void %floor_dcd5a2
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %void %floor_dcd5a2
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %floor_dcd5a2
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %VertexOutput None %22
+ %25 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %28
+ %32 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %32 %5
+ %33 = OpFunctionCall %void %floor_dcd5a2
+ %34 = OpLoad %VertexOutput %out
+ OpReturnValue %34
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %36 = OpLabel
+ %37 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %38 = OpCompositeExtract %v4float %37 0
+ OpStore %pos_1 %38
+ OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.wgsl
index 7befeb5..3ceabee 100644
--- a/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/dcd5a2.wgsl.expected.wgsl
@@ -2,12 +2,6 @@
var res = floor(1.5);
}
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_dcd5a2();
- return vec4<f32>();
-}
-
@fragment
fn fragment_main() {
floor_dcd5a2();
@@ -17,3 +11,16 @@
fn compute_main() {
floor_dcd5a2();
}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ floor_dcd5a2();
+ return out;
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl
index a10ab0f..1021cda 100644
--- a/test/tint/builtins/gen/literal/floor/e585ef.wgsl
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl
@@ -39,12 +39,6 @@
fn floor_e585ef() {
var res = floor(vec2(1.5));
}
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_e585ef();
- return vec4<f32>();
-}
-
@fragment
fn fragment_main() {
floor_e585ef();
@@ -54,3 +48,15 @@
fn compute_main() {
floor_e585ef();
}
+
+struct VertexOutput {
+ @builtin(position) pos: vec4<f32>,
+};
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ floor_e585ef();
+ return out;
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.dxc.hlsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.dxc.hlsl
index 48fd643..a149605 100644
--- a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.dxc.hlsl
@@ -2,22 +2,6 @@
float2 res = (1.0f).xx;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_e585ef();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
void fragment_main() {
floor_e585ef();
return;
@@ -28,3 +12,24 @@
floor_e585ef();
return;
}
+
+struct VertexOutput {
+ float4 pos;
+};
+struct tint_symbol_1 {
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ floor_e585ef();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.fxc.hlsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.fxc.hlsl
index 48fd643..a149605 100644
--- a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.fxc.hlsl
@@ -2,22 +2,6 @@
float2 res = (1.0f).xx;
}
-struct tint_symbol {
- float4 value : SV_Position;
-};
-
-float4 vertex_main_inner() {
- floor_e585ef();
- return (0.0f).xxxx;
-}
-
-tint_symbol vertex_main() {
- float4 inner_result = vertex_main_inner();
- tint_symbol wrapper_result = (tint_symbol)0;
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
void fragment_main() {
floor_e585ef();
return;
@@ -28,3 +12,24 @@
floor_e585ef();
return;
}
+
+struct VertexOutput {
+ float4 pos;
+};
+struct tint_symbol_1 {
+ float4 pos : SV_Position;
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput tint_symbol = (VertexOutput)0;
+ tint_symbol.pos = (0.0f).xxxx;
+ floor_e585ef();
+ return tint_symbol;
+}
+
+tint_symbol_1 vertex_main() {
+ VertexOutput inner_result = vertex_main_inner();
+ tint_symbol_1 wrapper_result = (tint_symbol_1)0;
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.glsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.glsl
index 5f737bb..a5632de 100644
--- a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.glsl
@@ -1,23 +1,4 @@
#version 310 es
-
-void floor_e585ef() {
- vec2 res = vec2(1.0f);
-}
-
-vec4 vertex_main() {
- floor_e585ef();
- return vec4(0.0f);
-}
-
-void main() {
- gl_PointSize = 1.0;
- vec4 inner_result = vertex_main();
- gl_Position = inner_result;
- gl_Position.y = -(gl_Position.y);
- gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
- return;
-}
-#version 310 es
precision highp float;
precision highp int;
@@ -25,6 +6,10 @@
vec2 res = vec2(1.0f);
}
+struct VertexOutput {
+ vec4 pos;
+};
+
void fragment_main() {
floor_e585ef();
}
@@ -39,6 +24,10 @@
vec2 res = vec2(1.0f);
}
+struct VertexOutput {
+ vec4 pos;
+};
+
void compute_main() {
floor_e585ef();
}
@@ -48,3 +37,28 @@
compute_main();
return;
}
+#version 310 es
+
+void floor_e585ef() {
+ vec2 res = vec2(1.0f);
+}
+
+struct VertexOutput {
+ vec4 pos;
+};
+
+VertexOutput vertex_main() {
+ VertexOutput tint_symbol = VertexOutput(vec4(0.0f, 0.0f, 0.0f, 0.0f));
+ tint_symbol.pos = vec4(0.0f);
+ floor_e585ef();
+ return tint_symbol;
+}
+
+void main() {
+ gl_PointSize = 1.0;
+ VertexOutput inner_result = vertex_main();
+ gl_Position = inner_result.pos;
+ gl_Position.y = -(gl_Position.y);
+ gl_Position.z = ((2.0f * gl_Position.z) - gl_Position.w);
+ return;
+}
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.msl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.msl
index 862988b..28042ac 100644
--- a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.msl
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.msl
@@ -5,22 +5,6 @@
float2 res = float2(1.0f);
}
-struct tint_symbol {
- float4 value [[position]];
-};
-
-float4 vertex_main_inner() {
- floor_e585ef();
- return float4(0.0f);
-}
-
-vertex tint_symbol vertex_main() {
- float4 const inner_result = vertex_main_inner();
- tint_symbol wrapper_result = {};
- wrapper_result.value = inner_result;
- return wrapper_result;
-}
-
fragment void fragment_main() {
floor_e585ef();
return;
@@ -31,3 +15,25 @@
return;
}
+struct VertexOutput {
+ float4 pos;
+};
+
+struct tint_symbol {
+ float4 pos [[position]];
+};
+
+VertexOutput vertex_main_inner() {
+ VertexOutput out = {};
+ out.pos = float4(0.0f);
+ floor_e585ef();
+ return out;
+}
+
+vertex tint_symbol vertex_main() {
+ VertexOutput const inner_result = vertex_main_inner();
+ tint_symbol wrapper_result = {};
+ wrapper_result.pos = inner_result.pos;
+ return wrapper_result;
+}
+
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.spvasm
index 3b4d9f3..06f0877 100644
--- a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.spvasm
@@ -1,30 +1,34 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 42
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
- OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
OpEntryPoint Fragment %fragment_main "fragment_main"
OpEntryPoint GLCompute %compute_main "compute_main"
+ OpEntryPoint Vertex %vertex_main "vertex_main" %pos_1 %vertex_point_size
OpExecutionMode %fragment_main OriginUpperLeft
OpExecutionMode %compute_main LocalSize 1 1 1
- OpName %value "value"
+ OpName %pos_1 "pos_1"
OpName %vertex_point_size "vertex_point_size"
OpName %floor_e585ef "floor_e585ef"
OpName %res "res"
- OpName %vertex_main_inner "vertex_main_inner"
- OpName %vertex_main "vertex_main"
OpName %fragment_main "fragment_main"
OpName %compute_main "compute_main"
- OpDecorate %value BuiltIn Position
+ OpName %VertexOutput "VertexOutput"
+ OpMemberName %VertexOutput 0 "pos"
+ OpName %vertex_main_inner "vertex_main_inner"
+ OpName %out "out"
+ OpName %vertex_main "vertex_main"
+ OpDecorate %pos_1 BuiltIn Position
OpDecorate %vertex_point_size BuiltIn PointSize
+ OpMemberDecorate %VertexOutput 0 Offset 0
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
- %value = OpVariable %_ptr_Output_v4float Output %5
+ %pos_1 = OpVariable %_ptr_Output_v4float Output %5
%_ptr_Output_float = OpTypePointer Output %float
%8 = OpConstantNull %float
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
@@ -35,32 +39,43 @@
%15 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v2float = OpTypePointer Function %v2float
%18 = OpConstantNull %v2float
- %19 = OpTypeFunction %v4float
+%VertexOutput = OpTypeStruct %v4float
+ %25 = OpTypeFunction %VertexOutput
+%_ptr_Function_VertexOutput = OpTypePointer Function %VertexOutput
+ %31 = OpConstantNull %VertexOutput
+ %uint = OpTypeInt 32 0
+ %uint_0 = OpConstant %uint 0
+%_ptr_Function_v4float = OpTypePointer Function %v4float
%floor_e585ef = OpFunction %void None %9
%12 = OpLabel
%res = OpVariable %_ptr_Function_v2float Function %18
OpStore %res %15
OpReturn
OpFunctionEnd
-%vertex_main_inner = OpFunction %v4float None %19
- %21 = OpLabel
- %22 = OpFunctionCall %void %floor_e585ef
- OpReturnValue %5
- OpFunctionEnd
-%vertex_main = OpFunction %void None %9
- %24 = OpLabel
- %25 = OpFunctionCall %v4float %vertex_main_inner
- OpStore %value %25
- OpStore %vertex_point_size %float_1
- OpReturn
- OpFunctionEnd
%fragment_main = OpFunction %void None %9
- %27 = OpLabel
- %28 = OpFunctionCall %void %floor_e585ef
+ %20 = OpLabel
+ %21 = OpFunctionCall %void %floor_e585ef
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %9
- %30 = OpLabel
- %31 = OpFunctionCall %void %floor_e585ef
+ %23 = OpLabel
+ %24 = OpFunctionCall %void %floor_e585ef
+ OpReturn
+ OpFunctionEnd
+%vertex_main_inner = OpFunction %VertexOutput None %25
+ %28 = OpLabel
+ %out = OpVariable %_ptr_Function_VertexOutput Function %31
+ %35 = OpAccessChain %_ptr_Function_v4float %out %uint_0
+ OpStore %35 %5
+ %36 = OpFunctionCall %void %floor_e585ef
+ %37 = OpLoad %VertexOutput %out
+ OpReturnValue %37
+ OpFunctionEnd
+%vertex_main = OpFunction %void None %9
+ %39 = OpLabel
+ %40 = OpFunctionCall %VertexOutput %vertex_main_inner
+ %41 = OpCompositeExtract %v4float %40 0
+ OpStore %pos_1 %41
+ OpStore %vertex_point_size %float_1
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.wgsl b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.wgsl
index 607b8d8..af31dec1 100644
--- a/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.wgsl
+++ b/test/tint/builtins/gen/literal/floor/e585ef.wgsl.expected.wgsl
@@ -2,12 +2,6 @@
var res = floor(vec2(1.5));
}
-@vertex
-fn vertex_main() -> @builtin(position) vec4<f32> {
- floor_e585ef();
- return vec4<f32>();
-}
-
@fragment
fn fragment_main() {
floor_e585ef();
@@ -17,3 +11,16 @@
fn compute_main() {
floor_e585ef();
}
+
+struct VertexOutput {
+ @builtin(position)
+ pos : vec4<f32>,
+}
+
+@vertex
+fn vertex_main() -> VertexOutput {
+ var out : VertexOutput;
+ out.pos = vec4<f32>();
+ floor_e585ef();
+ return out;
+}