[msl] Fix default interpolation sampling
WGSL specifies that when the sampling type is not `flat`, the default
sampling mode is `center`. MSL has no default sampling mode so make
sure we emit `center` when the default is used.
Fixed: tint:2118
Change-Id: I202bcb0319200fccabc95227c664a303b556fc4e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/165641
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Auto-Submit: James Price <jrprice@google.com>
diff --git a/src/tint/lang/msl/writer/common/printer_support.cc b/src/tint/lang/msl/writer/common/printer_support.cc
index 037e54e..63a561c 100644
--- a/src/tint/lang/msl/writer/common/printer_support.cc
+++ b/src/tint/lang/msl/writer/common/printer_support.cc
@@ -97,6 +97,9 @@
attr = "sample_";
break;
case core::InterpolationSampling::kUndefined:
+ if (type != core::InterpolationType::kFlat) {
+ attr = "center_";
+ }
break;
}
switch (type) {
diff --git a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl
index 599fe9c..6122646 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl
@@ -7,5 +7,7 @@
@location(4) @interpolate(perspective, sample) perspective_sample : f32,
@location(5) @interpolate(linear, center) linear_center : f32,
@location(6) @interpolate(linear, centroid) linear_centroid : f32,
- @location(7) @interpolate(linear, sample) linear_sample : f32) {
+ @location(7) @interpolate(linear, sample) linear_sample : f32,
+ @location(8) @interpolate(perspective) perspective_default : f32,
+ @location(9) @interpolate(linear) linear_default : f32) {
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.dxc.hlsl b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.dxc.hlsl
index bb78da9..9b3fd4f 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.dxc.hlsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.dxc.hlsl
@@ -7,12 +7,14 @@
noperspective float linear_center : TEXCOORD5;
noperspective centroid float linear_centroid : TEXCOORD6;
noperspective sample float linear_sample : TEXCOORD7;
+ linear float perspective_default : TEXCOORD8;
+ noperspective float linear_default : TEXCOORD9;
};
-void main_inner(float none, float flat, float perspective_center, float perspective_centroid, float perspective_sample, float linear_center, float linear_centroid, float linear_sample) {
+void main_inner(float none, float flat, float perspective_center, float perspective_centroid, float perspective_sample, float linear_center, float linear_centroid, float linear_sample, float perspective_default, float linear_default) {
}
void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.none, tint_symbol.flat, tint_symbol.perspective_center, tint_symbol.perspective_centroid, tint_symbol.perspective_sample, tint_symbol.linear_center, tint_symbol.linear_centroid, tint_symbol.linear_sample);
+ main_inner(tint_symbol.none, tint_symbol.flat, tint_symbol.perspective_center, tint_symbol.perspective_centroid, tint_symbol.perspective_sample, tint_symbol.linear_center, tint_symbol.linear_centroid, tint_symbol.linear_sample, tint_symbol.perspective_default, tint_symbol.linear_default);
return;
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.fxc.hlsl b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.fxc.hlsl
index bb78da9..9b3fd4f 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.fxc.hlsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.fxc.hlsl
@@ -7,12 +7,14 @@
noperspective float linear_center : TEXCOORD5;
noperspective centroid float linear_centroid : TEXCOORD6;
noperspective sample float linear_sample : TEXCOORD7;
+ linear float perspective_default : TEXCOORD8;
+ noperspective float linear_default : TEXCOORD9;
};
-void main_inner(float none, float flat, float perspective_center, float perspective_centroid, float perspective_sample, float linear_center, float linear_centroid, float linear_sample) {
+void main_inner(float none, float flat, float perspective_center, float perspective_centroid, float perspective_sample, float linear_center, float linear_centroid, float linear_sample, float perspective_default, float linear_default) {
}
void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.none, tint_symbol.flat, tint_symbol.perspective_center, tint_symbol.perspective_centroid, tint_symbol.perspective_sample, tint_symbol.linear_center, tint_symbol.linear_centroid, tint_symbol.linear_sample);
+ main_inner(tint_symbol.none, tint_symbol.flat, tint_symbol.perspective_center, tint_symbol.perspective_centroid, tint_symbol.perspective_sample, tint_symbol.linear_center, tint_symbol.linear_centroid, tint_symbol.linear_sample, tint_symbol.perspective_default, tint_symbol.linear_default);
return;
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.glsl b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.glsl
index b424018..32e3f9b 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.glsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.glsl
@@ -9,10 +9,12 @@
layout(location = 5) in float linear_center_1;
layout(location = 6) centroid in float linear_centroid_1;
layout(location = 7) in float linear_sample_1;
-void tint_symbol(float none, float tint_symbol_1, float perspective_center, float perspective_centroid, float perspective_sample, float linear_center, float linear_centroid, float linear_sample) {
+layout(location = 8) in float perspective_default_1;
+layout(location = 9) in float linear_default_1;
+void tint_symbol(float none, float tint_symbol_1, float perspective_center, float perspective_centroid, float perspective_sample, float linear_center, float linear_centroid, float linear_sample, float perspective_default, float linear_default) {
}
void main() {
- tint_symbol(none_1, tint_symbol_1_1, perspective_center_1, perspective_centroid_1, perspective_sample_1, linear_center_1, linear_centroid_1, linear_sample_1);
+ tint_symbol(none_1, tint_symbol_1_1, perspective_center_1, perspective_centroid_1, perspective_sample_1, linear_center_1, linear_centroid_1, linear_sample_1, perspective_default_1, linear_default_1);
return;
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.msl b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.msl
index d460bb0..24b2e8e 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.msl
+++ b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.msl
@@ -10,13 +10,15 @@
float linear_center [[user(locn5)]] [[center_no_perspective]];
float linear_centroid [[user(locn6)]] [[centroid_no_perspective]];
float linear_sample [[user(locn7)]] [[sample_no_perspective]];
+ float perspective_default [[user(locn8)]] [[center_perspective]];
+ float linear_default [[user(locn9)]] [[center_no_perspective]];
};
-void tint_symbol_inner(float none, float flat, float perspective_center, float perspective_centroid, float perspective_sample, float linear_center, float linear_centroid, float linear_sample) {
+void tint_symbol_inner(float none, float flat, float perspective_center, float perspective_centroid, float perspective_sample, float linear_center, float linear_centroid, float linear_sample, float perspective_default, float linear_default) {
}
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.none, tint_symbol_1.flat, tint_symbol_1.perspective_center, tint_symbol_1.perspective_centroid, tint_symbol_1.perspective_sample, tint_symbol_1.linear_center, tint_symbol_1.linear_centroid, tint_symbol_1.linear_sample);
+ tint_symbol_inner(tint_symbol_1.none, tint_symbol_1.flat, tint_symbol_1.perspective_center, tint_symbol_1.perspective_centroid, tint_symbol_1.perspective_sample, tint_symbol_1.linear_center, tint_symbol_1.linear_centroid, tint_symbol_1.linear_sample, tint_symbol_1.perspective_default, tint_symbol_1.linear_default);
return;
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.spvasm b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.spvasm
index 9e2378a..5666be3 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.spvasm
+++ b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.spvasm
@@ -1,12 +1,12 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 35
+; Bound: 41
; Schema: 0
OpCapability Shader
OpCapability SampleRateShading
OpMemoryModel Logical GLSL450
- OpEntryPoint Fragment %main "main" %none_1 %flat_1 %perspective_center_1 %perspective_centroid_1 %perspective_sample_1 %linear_center_1 %linear_centroid_1 %linear_sample_1
+ OpEntryPoint Fragment %main "main" %none_1 %flat_1 %perspective_center_1 %perspective_centroid_1 %perspective_sample_1 %linear_center_1 %linear_centroid_1 %linear_sample_1 %perspective_default_1 %linear_default_1
OpExecutionMode %main OriginUpperLeft
OpName %none_1 "none_1"
OpName %flat_1 "flat_1"
@@ -16,6 +16,8 @@
OpName %linear_center_1 "linear_center_1"
OpName %linear_centroid_1 "linear_centroid_1"
OpName %linear_sample_1 "linear_sample_1"
+ OpName %perspective_default_1 "perspective_default_1"
+ OpName %linear_default_1 "linear_default_1"
OpName %main_inner "main_inner"
OpName %none "none"
OpName %flat "flat"
@@ -25,6 +27,8 @@
OpName %linear_center "linear_center"
OpName %linear_centroid "linear_centroid"
OpName %linear_sample "linear_sample"
+ OpName %perspective_default "perspective_default"
+ OpName %linear_default "linear_default"
OpName %main "main"
OpDecorate %none_1 Location 0
OpDecorate %flat_1 Location 1
@@ -42,6 +46,9 @@
OpDecorate %linear_sample_1 Location 7
OpDecorate %linear_sample_1 NoPerspective
OpDecorate %linear_sample_1 Sample
+ OpDecorate %perspective_default_1 Location 8
+ OpDecorate %linear_default_1 Location 9
+ OpDecorate %linear_default_1 NoPerspective
%float = OpTypeFloat 32
%_ptr_Input_float = OpTypePointer Input %float
%none_1 = OpVariable %_ptr_Input_float Input
@@ -52,10 +59,12 @@
%linear_center_1 = OpVariable %_ptr_Input_float Input
%linear_centroid_1 = OpVariable %_ptr_Input_float Input
%linear_sample_1 = OpVariable %_ptr_Input_float Input
+%perspective_default_1 = OpVariable %_ptr_Input_float Input
+%linear_default_1 = OpVariable %_ptr_Input_float Input
%void = OpTypeVoid
- %11 = OpTypeFunction %void %float %float %float %float %float %float %float %float
- %23 = OpTypeFunction %void
- %main_inner = OpFunction %void None %11
+ %13 = OpTypeFunction %void %float %float %float %float %float %float %float %float %float %float
+ %27 = OpTypeFunction %void
+ %main_inner = OpFunction %void None %13
%none = OpFunctionParameter %float
%flat = OpFunctionParameter %float
%perspective_center = OpFunctionParameter %float
@@ -64,19 +73,23 @@
%linear_center = OpFunctionParameter %float
%linear_centroid = OpFunctionParameter %float
%linear_sample = OpFunctionParameter %float
- %22 = OpLabel
+%perspective_default = OpFunctionParameter %float
+%linear_default = OpFunctionParameter %float
+ %26 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %23
- %25 = OpLabel
- %27 = OpLoad %float %none_1
- %28 = OpLoad %float %flat_1
- %29 = OpLoad %float %perspective_center_1
- %30 = OpLoad %float %perspective_centroid_1
- %31 = OpLoad %float %perspective_sample_1
- %32 = OpLoad %float %linear_center_1
- %33 = OpLoad %float %linear_centroid_1
- %34 = OpLoad %float %linear_sample_1
- %26 = OpFunctionCall %void %main_inner %27 %28 %29 %30 %31 %32 %33 %34
+ %main = OpFunction %void None %27
+ %29 = OpLabel
+ %31 = OpLoad %float %none_1
+ %32 = OpLoad %float %flat_1
+ %33 = OpLoad %float %perspective_center_1
+ %34 = OpLoad %float %perspective_centroid_1
+ %35 = OpLoad %float %perspective_sample_1
+ %36 = OpLoad %float %linear_center_1
+ %37 = OpLoad %float %linear_centroid_1
+ %38 = OpLoad %float %linear_sample_1
+ %39 = OpLoad %float %perspective_default_1
+ %40 = OpLoad %float %linear_default_1
+ %30 = OpFunctionCall %void %main_inner %31 %32 %33 %34 %35 %36 %37 %38 %39 %40
OpReturn
OpFunctionEnd
diff --git a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.wgsl b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.wgsl
index df06a21..28d5740 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.wgsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_parameters.wgsl.expected.wgsl
@@ -1,3 +1,3 @@
@fragment
-fn main(@location(0) none : f32, @location(1) @interpolate(flat) flat : f32, @location(2) @interpolate(perspective, center) perspective_center : f32, @location(3) @interpolate(perspective, centroid) perspective_centroid : f32, @location(4) @interpolate(perspective, sample) perspective_sample : f32, @location(5) @interpolate(linear, center) linear_center : f32, @location(6) @interpolate(linear, centroid) linear_centroid : f32, @location(7) @interpolate(linear, sample) linear_sample : f32) {
+fn main(@location(0) none : f32, @location(1) @interpolate(flat) flat : f32, @location(2) @interpolate(perspective, center) perspective_center : f32, @location(3) @interpolate(perspective, centroid) perspective_centroid : f32, @location(4) @interpolate(perspective, sample) perspective_sample : f32, @location(5) @interpolate(linear, center) linear_center : f32, @location(6) @interpolate(linear, centroid) linear_centroid : f32, @location(7) @interpolate(linear, sample) linear_sample : f32, @location(8) @interpolate(perspective) perspective_default : f32, @location(9) @interpolate(linear) linear_default : f32) {
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl
index 93cfec8..b2fb40a 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl
@@ -7,6 +7,8 @@
@location(5) @interpolate(linear, center) linear_center : f32,
@location(6) @interpolate(linear, centroid) linear_centroid : f32,
@location(7) @interpolate(linear, sample) linear_sample : f32,
+ @location(8) @interpolate(perspective) perspective_default : f32,
+ @location(9) @interpolate(linear) linear_default : f32,
};
@fragment
diff --git a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.dxc.hlsl b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.dxc.hlsl
index cfc7acd..8e884cd 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.dxc.hlsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.dxc.hlsl
@@ -7,6 +7,8 @@
float linear_center;
float linear_centroid;
float linear_sample;
+ float perspective_default;
+ float linear_default;
};
struct tint_symbol_2 {
float none : TEXCOORD0;
@@ -17,13 +19,15 @@
noperspective float linear_center : TEXCOORD5;
noperspective centroid float linear_centroid : TEXCOORD6;
noperspective sample float linear_sample : TEXCOORD7;
+ linear float perspective_default : TEXCOORD8;
+ noperspective float linear_default : TEXCOORD9;
};
void main_inner(In tint_symbol) {
}
void main(tint_symbol_2 tint_symbol_1) {
- const In tint_symbol_3 = {tint_symbol_1.none, tint_symbol_1.flat, tint_symbol_1.perspective_center, tint_symbol_1.perspective_centroid, tint_symbol_1.perspective_sample, tint_symbol_1.linear_center, tint_symbol_1.linear_centroid, tint_symbol_1.linear_sample};
+ const In tint_symbol_3 = {tint_symbol_1.none, tint_symbol_1.flat, tint_symbol_1.perspective_center, tint_symbol_1.perspective_centroid, tint_symbol_1.perspective_sample, tint_symbol_1.linear_center, tint_symbol_1.linear_centroid, tint_symbol_1.linear_sample, tint_symbol_1.perspective_default, tint_symbol_1.linear_default};
main_inner(tint_symbol_3);
return;
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.fxc.hlsl b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.fxc.hlsl
index cfc7acd..8e884cd 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.fxc.hlsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.fxc.hlsl
@@ -7,6 +7,8 @@
float linear_center;
float linear_centroid;
float linear_sample;
+ float perspective_default;
+ float linear_default;
};
struct tint_symbol_2 {
float none : TEXCOORD0;
@@ -17,13 +19,15 @@
noperspective float linear_center : TEXCOORD5;
noperspective centroid float linear_centroid : TEXCOORD6;
noperspective sample float linear_sample : TEXCOORD7;
+ linear float perspective_default : TEXCOORD8;
+ noperspective float linear_default : TEXCOORD9;
};
void main_inner(In tint_symbol) {
}
void main(tint_symbol_2 tint_symbol_1) {
- const In tint_symbol_3 = {tint_symbol_1.none, tint_symbol_1.flat, tint_symbol_1.perspective_center, tint_symbol_1.perspective_centroid, tint_symbol_1.perspective_sample, tint_symbol_1.linear_center, tint_symbol_1.linear_centroid, tint_symbol_1.linear_sample};
+ const In tint_symbol_3 = {tint_symbol_1.none, tint_symbol_1.flat, tint_symbol_1.perspective_center, tint_symbol_1.perspective_centroid, tint_symbol_1.perspective_sample, tint_symbol_1.linear_center, tint_symbol_1.linear_centroid, tint_symbol_1.linear_sample, tint_symbol_1.perspective_default, tint_symbol_1.linear_default};
main_inner(tint_symbol_3);
return;
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.glsl b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.glsl
index c4ba99d..3ab5b8e 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.glsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.glsl
@@ -9,6 +9,8 @@
layout(location = 5) in float linear_center_1;
layout(location = 6) centroid in float linear_centroid_1;
layout(location = 7) in float linear_sample_1;
+layout(location = 8) in float perspective_default_1;
+layout(location = 9) in float linear_default_1;
struct In {
float none;
float tint_symbol;
@@ -18,13 +20,15 @@
float linear_center;
float linear_centroid;
float linear_sample;
+ float perspective_default;
+ float linear_default;
};
void tint_symbol_1(In tint_symbol_2) {
}
void main() {
- In tint_symbol_4 = In(none_1, tint_symbol_3, perspective_center_1, perspective_centroid_1, perspective_sample_1, linear_center_1, linear_centroid_1, linear_sample_1);
+ In tint_symbol_4 = In(none_1, tint_symbol_3, perspective_center_1, perspective_centroid_1, perspective_sample_1, linear_center_1, linear_centroid_1, linear_sample_1, perspective_default_1, linear_default_1);
tint_symbol_1(tint_symbol_4);
return;
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.msl b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.msl
index 4f68cb4..0ebceec 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.msl
+++ b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.msl
@@ -10,6 +10,8 @@
float linear_center;
float linear_centroid;
float linear_sample;
+ float perspective_default;
+ float linear_default;
};
struct tint_symbol_2 {
@@ -21,13 +23,15 @@
float linear_center [[user(locn5)]] [[center_no_perspective]];
float linear_centroid [[user(locn6)]] [[centroid_no_perspective]];
float linear_sample [[user(locn7)]] [[sample_no_perspective]];
+ float perspective_default [[user(locn8)]] [[center_perspective]];
+ float linear_default [[user(locn9)]] [[center_no_perspective]];
};
void tint_symbol_inner(In in) {
}
fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- In const tint_symbol_3 = {.none=tint_symbol_1.none, .flat=tint_symbol_1.flat, .perspective_center=tint_symbol_1.perspective_center, .perspective_centroid=tint_symbol_1.perspective_centroid, .perspective_sample=tint_symbol_1.perspective_sample, .linear_center=tint_symbol_1.linear_center, .linear_centroid=tint_symbol_1.linear_centroid, .linear_sample=tint_symbol_1.linear_sample};
+ In const tint_symbol_3 = {.none=tint_symbol_1.none, .flat=tint_symbol_1.flat, .perspective_center=tint_symbol_1.perspective_center, .perspective_centroid=tint_symbol_1.perspective_centroid, .perspective_sample=tint_symbol_1.perspective_sample, .linear_center=tint_symbol_1.linear_center, .linear_centroid=tint_symbol_1.linear_centroid, .linear_sample=tint_symbol_1.linear_sample, .perspective_default=tint_symbol_1.perspective_default, .linear_default=tint_symbol_1.linear_default};
tint_symbol_inner(tint_symbol_3);
return;
}
diff --git a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.spvasm b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.spvasm
index a13e5d6..3af678b 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.spvasm
+++ b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.spvasm
@@ -1,12 +1,12 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 30
+; Bound: 34
; Schema: 0
OpCapability Shader
OpCapability SampleRateShading
OpMemoryModel Logical GLSL450
- OpEntryPoint Fragment %main "main" %none_1 %flat_1 %perspective_center_1 %perspective_centroid_1 %perspective_sample_1 %linear_center_1 %linear_centroid_1 %linear_sample_1
+ OpEntryPoint Fragment %main "main" %none_1 %flat_1 %perspective_center_1 %perspective_centroid_1 %perspective_sample_1 %linear_center_1 %linear_centroid_1 %linear_sample_1 %perspective_default_1 %linear_default_1
OpExecutionMode %main OriginUpperLeft
OpName %none_1 "none_1"
OpName %flat_1 "flat_1"
@@ -16,6 +16,8 @@
OpName %linear_center_1 "linear_center_1"
OpName %linear_centroid_1 "linear_centroid_1"
OpName %linear_sample_1 "linear_sample_1"
+ OpName %perspective_default_1 "perspective_default_1"
+ OpName %linear_default_1 "linear_default_1"
OpName %In "In"
OpMemberName %In 0 "none"
OpMemberName %In 1 "flat"
@@ -25,6 +27,8 @@
OpMemberName %In 5 "linear_center"
OpMemberName %In 6 "linear_centroid"
OpMemberName %In 7 "linear_sample"
+ OpMemberName %In 8 "perspective_default"
+ OpMemberName %In 9 "linear_default"
OpName %main_inner "main_inner"
OpName %in "in"
OpName %main "main"
@@ -44,6 +48,9 @@
OpDecorate %linear_sample_1 Location 7
OpDecorate %linear_sample_1 NoPerspective
OpDecorate %linear_sample_1 Sample
+ OpDecorate %perspective_default_1 Location 8
+ OpDecorate %linear_default_1 Location 9
+ OpDecorate %linear_default_1 NoPerspective
OpMemberDecorate %In 0 Offset 0
OpMemberDecorate %In 1 Offset 4
OpMemberDecorate %In 2 Offset 8
@@ -52,6 +59,8 @@
OpMemberDecorate %In 5 Offset 20
OpMemberDecorate %In 6 Offset 24
OpMemberDecorate %In 7 Offset 28
+ OpMemberDecorate %In 8 Offset 32
+ OpMemberDecorate %In 9 Offset 36
%float = OpTypeFloat 32
%_ptr_Input_float = OpTypePointer Input %float
%none_1 = OpVariable %_ptr_Input_float Input
@@ -62,26 +71,30 @@
%linear_center_1 = OpVariable %_ptr_Input_float Input
%linear_centroid_1 = OpVariable %_ptr_Input_float Input
%linear_sample_1 = OpVariable %_ptr_Input_float Input
+%perspective_default_1 = OpVariable %_ptr_Input_float Input
+%linear_default_1 = OpVariable %_ptr_Input_float Input
%void = OpTypeVoid
- %In = OpTypeStruct %float %float %float %float %float %float %float %float
- %11 = OpTypeFunction %void %In
- %17 = OpTypeFunction %void
- %main_inner = OpFunction %void None %11
+ %In = OpTypeStruct %float %float %float %float %float %float %float %float %float %float
+ %13 = OpTypeFunction %void %In
+ %19 = OpTypeFunction %void
+ %main_inner = OpFunction %void None %13
%in = OpFunctionParameter %In
- %16 = OpLabel
+ %18 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %17
- %19 = OpLabel
- %21 = OpLoad %float %none_1
- %22 = OpLoad %float %flat_1
- %23 = OpLoad %float %perspective_center_1
- %24 = OpLoad %float %perspective_centroid_1
- %25 = OpLoad %float %perspective_sample_1
- %26 = OpLoad %float %linear_center_1
- %27 = OpLoad %float %linear_centroid_1
- %28 = OpLoad %float %linear_sample_1
- %29 = OpCompositeConstruct %In %21 %22 %23 %24 %25 %26 %27 %28
- %20 = OpFunctionCall %void %main_inner %29
+ %main = OpFunction %void None %19
+ %21 = OpLabel
+ %23 = OpLoad %float %none_1
+ %24 = OpLoad %float %flat_1
+ %25 = OpLoad %float %perspective_center_1
+ %26 = OpLoad %float %perspective_centroid_1
+ %27 = OpLoad %float %perspective_sample_1
+ %28 = OpLoad %float %linear_center_1
+ %29 = OpLoad %float %linear_centroid_1
+ %30 = OpLoad %float %linear_sample_1
+ %31 = OpLoad %float %perspective_default_1
+ %32 = OpLoad %float %linear_default_1
+ %33 = OpCompositeConstruct %In %23 %24 %25 %26 %27 %28 %29 %30 %31 %32
+ %22 = OpFunctionCall %void %main_inner %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.wgsl b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.wgsl
index d6f2f04..2832622 100644
--- a/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.wgsl
+++ b/test/tint/types/functions/shader_io/interpolate_input_struct.wgsl.expected.wgsl
@@ -15,6 +15,10 @@
linear_centroid : f32,
@location(7) @interpolate(linear, sample)
linear_sample : f32,
+ @location(8) @interpolate(perspective)
+ perspective_default : f32,
+ @location(9) @interpolate(linear)
+ linear_default : f32,
}
@fragment