[tint] Preserve derivatives in DemoteToHelper
Avoid conditionalizing the RHS of an assignment statement when it
might contain a derivative. Do this by marking derivative builtins as
side-effecting (since they affect values in other invocations).
Bug: tint:1638
Fixed: tint:2185
Change-Id: If9e3a0c94208e4ee4a6a93385a0777c665814ed6
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/177980
Auto-Submit: James Price <jrprice@google.com>
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/lang/wgsl/ast/transform/demote_to_helper.cc b/src/tint/lang/wgsl/ast/transform/demote_to_helper.cc
index 1b88f20..30b3982 100644
--- a/src/tint/lang/wgsl/ast/transform/demote_to_helper.cc
+++ b/src/tint/lang/wgsl/ast/transform/demote_to_helper.cc
@@ -153,6 +153,14 @@
<< "write to unhandled address space: " << ref->AddressSpace();
}
+ // If the RHS has side effects (which may contain derivative operations), we need to
+ // hoist it out to a separate declaration so that it does not get masked.
+ auto* rhs = sem.GetVal(assign->rhs);
+ if (rhs->HasSideEffects()) {
+ hoist_to_decl_before.Add(rhs, assign->rhs,
+ HoistToDeclBefore::VariableKind::kLet);
+ }
+
// Mask the assignment using the invocation-discarded flag.
ctx.Replace(assign, b.If(b.Not(flag), b.Block(ctx.Clone(assign))));
},
diff --git a/src/tint/lang/wgsl/ast/transform/demote_to_helper_test.cc b/src/tint/lang/wgsl/ast/transform/demote_to_helper_test.cc
index 0af6dd1..ce447c0 100644
--- a/src/tint/lang/wgsl/ast/transform/demote_to_helper_test.cc
+++ b/src/tint/lang/wgsl/ast/transform/demote_to_helper_test.cc
@@ -1307,5 +1307,93 @@
EXPECT_EQ(expect, str(got));
}
+TEST_F(DemoteToHelperTest, Assignment_HoistExplicitDerivative) {
+ auto* src = R"(
+@group(0) @binding(0)
+var<storage, read_write> output : array<f32, 4>;
+
+@fragment
+fn foo(@location(0) in : f32) {
+ if (in == 0.0) {
+ discard;
+ }
+ output[u32(in)] = dpdx(in);
+}
+)";
+
+ auto* expect = R"(
+var<private> tint_discarded = false;
+
+@group(0) @binding(0) var<storage, read_write> output : array<f32, 4>;
+
+@fragment
+fn foo(@location(0) in : f32) {
+ if ((in == 0.0)) {
+ tint_discarded = true;
+ }
+ let tint_symbol : f32 = dpdx(in);
+ if (!(tint_discarded)) {
+ output[u32(in)] = tint_symbol;
+ }
+ if (tint_discarded) {
+ discard;
+ }
+}
+)";
+
+ auto got = Run<DemoteToHelper>(src);
+
+ EXPECT_EQ(expect, str(got));
+}
+
+TEST_F(DemoteToHelperTest, Assignment_HoistImplicitDerivative) {
+ auto* src = R"(
+@group(0) @binding(0)
+var<storage, read_write> output : array<vec4f, 4>;
+
+@group(0) @binding(1)
+var t : texture_2d<f32>;
+
+@group(0) @binding(2)
+var s : sampler;
+
+@fragment
+fn foo(@interpolate(flat) @location(0) in : u32) {
+ if (in == 0) {
+ discard;
+ }
+ output[in] = textureSample(t, s, vec2());
+}
+)";
+
+ auto* expect = R"(
+var<private> tint_discarded = false;
+
+@group(0) @binding(0) var<storage, read_write> output : array<vec4f, 4>;
+
+@group(0) @binding(1) var t : texture_2d<f32>;
+
+@group(0) @binding(2) var s : sampler;
+
+@fragment
+fn foo(@interpolate(flat) @location(0) in : u32) {
+ if ((in == 0)) {
+ tint_discarded = true;
+ }
+ let tint_symbol : vec4<f32> = textureSample(t, s, vec2());
+ if (!(tint_discarded)) {
+ output[in] = tint_symbol;
+ }
+ if (tint_discarded) {
+ discard;
+ }
+}
+)";
+
+ auto got = Run<DemoteToHelper>(src);
+
+ EXPECT_EQ(expect, str(got));
+}
+
} // namespace
} // namespace tint::ast::transform
diff --git a/src/tint/lang/wgsl/builtin_fn.cc b/src/tint/lang/wgsl/builtin_fn.cc
index a601143..78afd1b 100644
--- a/src/tint/lang/wgsl/builtin_fn.cc
+++ b/src/tint/lang/wgsl/builtin_fn.cc
@@ -752,6 +752,18 @@
case BuiltinFn::kAtomicStore:
case BuiltinFn::kAtomicSub:
case BuiltinFn::kAtomicXor:
+ case BuiltinFn::kDpdx:
+ case BuiltinFn::kDpdxCoarse:
+ case BuiltinFn::kDpdxFine:
+ case BuiltinFn::kDpdy:
+ case BuiltinFn::kDpdyCoarse:
+ case BuiltinFn::kDpdyFine:
+ case BuiltinFn::kFwidth:
+ case BuiltinFn::kFwidthCoarse:
+ case BuiltinFn::kFwidthFine:
+ case BuiltinFn::kTextureSample:
+ case BuiltinFn::kTextureSampleBias:
+ case BuiltinFn::kTextureSampleCompare:
case BuiltinFn::kTextureStore:
case BuiltinFn::kWorkgroupUniformLoad:
return true;
diff --git a/src/tint/lang/wgsl/builtin_fn.cc.tmpl b/src/tint/lang/wgsl/builtin_fn.cc.tmpl
index ee359d0..613a862 100644
--- a/src/tint/lang/wgsl/builtin_fn.cc.tmpl
+++ b/src/tint/lang/wgsl/builtin_fn.cc.tmpl
@@ -123,6 +123,18 @@
case BuiltinFn::kAtomicStore:
case BuiltinFn::kAtomicSub:
case BuiltinFn::kAtomicXor:
+ case BuiltinFn::kDpdx:
+ case BuiltinFn::kDpdxCoarse:
+ case BuiltinFn::kDpdxFine:
+ case BuiltinFn::kDpdy:
+ case BuiltinFn::kDpdyCoarse:
+ case BuiltinFn::kDpdyFine:
+ case BuiltinFn::kFwidth:
+ case BuiltinFn::kFwidthCoarse:
+ case BuiltinFn::kFwidthFine:
+ case BuiltinFn::kTextureSample:
+ case BuiltinFn::kTextureSampleBias:
+ case BuiltinFn::kTextureSampleCompare:
case BuiltinFn::kTextureStore:
case BuiltinFn::kWorkgroupUniformLoad:
return true;
diff --git a/src/tint/lang/wgsl/resolver/side_effects_test.cc b/src/tint/lang/wgsl/resolver/side_effects_test.cc
index b9fa38b..7d8bd2c 100644
--- a/src/tint/lang/wgsl/resolver/side_effects_test.cc
+++ b/src/tint/lang/wgsl/resolver/side_effects_test.cc
@@ -108,7 +108,7 @@
TEST_F(SideEffectsTest, Call_Builtin_NoSE) {
GlobalVar("a", ty.f32(), core::AddressSpace::kPrivate);
- auto* expr = Call("dpdx", "a");
+ auto* expr = Call("sqrt", "a");
Func("f", tint::Empty, ty.void_(), Vector{Ignore(expr)},
Vector{create<ast::StageAttribute>(ast::PipelineStage::kFragment)});
@@ -334,30 +334,30 @@
C("textureSampleCompareLevel",
Vector{"tdepth2d", "scomp", "vf2", "f"},
false,
- true), //
- C("textureSampleGrad", Vector{"t2d", "s2d", "vf2", "vf2", "vf2"}, false, true), //
- C("textureSampleLevel", Vector{"t2d", "s2d", "vf2", "f"}, false, true), //
- C("transpose", Vector{"m"}, false, true), //
- C("trunc", Vector{"f"}, false, true), //
- C("unpack2x16float", Vector{"u"}, false, true), //
- C("unpack2x16snorm", Vector{"u"}, false, true), //
- C("unpack2x16unorm", Vector{"u"}, false, true), //
- C("unpack4x8snorm", Vector{"u"}, false, true), //
- C("unpack4x8unorm", Vector{"u"}, false, true), //
- C("storageBarrier", tint::Empty, false, false, ast::PipelineStage::kCompute), //
- C("workgroupBarrier", tint::Empty, false, false, ast::PipelineStage::kCompute), //
- C("textureSample", Vector{"t2d", "s2d", "vf2"}, false, true), //
- C("textureSampleBias", Vector{"t2d", "s2d", "vf2", "f"}, false, true), //
- C("textureSampleCompare", Vector{"tdepth2d", "scomp", "vf2", "f"}, false, true), //
- C("dpdx", Vector{"f"}, false, true), //
- C("dpdxCoarse", Vector{"f"}, false, true), //
- C("dpdxFine", Vector{"f"}, false, true), //
- C("dpdy", Vector{"f"}, false, true), //
- C("dpdyCoarse", Vector{"f"}, false, true), //
- C("dpdyFine", Vector{"f"}, false, true), //
- C("fwidth", Vector{"f"}, false, true), //
- C("fwidthCoarse", Vector{"f"}, false, true), //
- C("fwidthFine", Vector{"f"}, false, true), //
+ true), //
+ C("textureSampleGrad", Vector{"t2d", "s2d", "vf2", "vf2", "vf2"}, false, true), //
+ C("textureSampleLevel", Vector{"t2d", "s2d", "vf2", "f"}, false, true), //
+ C("transpose", Vector{"m"}, false, true), //
+ C("trunc", Vector{"f"}, false, true), //
+ C("unpack2x16float", Vector{"u"}, false, true), //
+ C("unpack2x16snorm", Vector{"u"}, false, true), //
+ C("unpack2x16unorm", Vector{"u"}, false, true), //
+ C("unpack4x8snorm", Vector{"u"}, false, true), //
+ C("unpack4x8unorm", Vector{"u"}, false, true), //
+ C("storageBarrier", tint::Empty, false, false, ast::PipelineStage::kCompute), //
+ C("workgroupBarrier", tint::Empty, false, false, ast::PipelineStage::kCompute), //
+ C("textureSample", Vector{"t2d", "s2d", "vf2"}, true, true), //
+ C("textureSampleBias", Vector{"t2d", "s2d", "vf2", "f"}, true, true), //
+ C("textureSampleCompare", Vector{"tdepth2d", "scomp", "vf2", "f"}, true, true), //
+ C("dpdx", Vector{"f"}, true, true), //
+ C("dpdxCoarse", Vector{"f"}, true, true), //
+ C("dpdxFine", Vector{"f"}, true, true), //
+ C("dpdy", Vector{"f"}, true, true), //
+ C("dpdyCoarse", Vector{"f"}, true, true), //
+ C("dpdyFine", Vector{"f"}, true, true), //
+ C("fwidth", Vector{"f"}, true, true), //
+ C("fwidthCoarse", Vector{"f"}, true, true), //
+ C("fwidthFine", Vector{"f"}, true, true), //
// Side-effect builtins
C("atomicAdd", Vector{"pa", "i"}, true, true), //
diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.dxc.hlsl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.dxc.hlsl
index 13e05d4..7b71b78 100644
--- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.dxc.hlsl
+++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.dxc.hlsl
@@ -2,15 +2,16 @@
Texture2D<float4> randomTexture : register(t1);
Texture2D<float4> depthTexture : register(t2);
-struct tint_symbol_2 {
+struct tint_symbol_3 {
float2 vUV : TEXCOORD0;
};
-struct tint_symbol_3 {
+struct tint_symbol_4 {
float4 value : SV_Target0;
};
float4 main_inner(float2 vUV) {
- float3 random = randomTexture.Sample(tint_symbol, vUV).rgb;
+ float4 tint_symbol_1 = randomTexture.Sample(tint_symbol, vUV);
+ float3 random = tint_symbol_1.rgb;
int i = 0;
while (true) {
if ((i < 1)) {
@@ -40,9 +41,9 @@
return (1.0f).xxxx;
}
-tint_symbol_3 main(tint_symbol_2 tint_symbol_1) {
- float4 inner_result = main_inner(tint_symbol_1.vUV);
- tint_symbol_3 wrapper_result = (tint_symbol_3)0;
+tint_symbol_4 main(tint_symbol_3 tint_symbol_2) {
+ float4 inner_result = main_inner(tint_symbol_2.vUV);
+ tint_symbol_4 wrapper_result = (tint_symbol_4)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.fxc.hlsl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.fxc.hlsl
index 13e05d4..7b71b78 100644
--- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.fxc.hlsl
+++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.fxc.hlsl
@@ -2,15 +2,16 @@
Texture2D<float4> randomTexture : register(t1);
Texture2D<float4> depthTexture : register(t2);
-struct tint_symbol_2 {
+struct tint_symbol_3 {
float2 vUV : TEXCOORD0;
};
-struct tint_symbol_3 {
+struct tint_symbol_4 {
float4 value : SV_Target0;
};
float4 main_inner(float2 vUV) {
- float3 random = randomTexture.Sample(tint_symbol, vUV).rgb;
+ float4 tint_symbol_1 = randomTexture.Sample(tint_symbol, vUV);
+ float3 random = tint_symbol_1.rgb;
int i = 0;
while (true) {
if ((i < 1)) {
@@ -40,9 +41,9 @@
return (1.0f).xxxx;
}
-tint_symbol_3 main(tint_symbol_2 tint_symbol_1) {
- float4 inner_result = main_inner(tint_symbol_1.vUV);
- tint_symbol_3 wrapper_result = (tint_symbol_3)0;
+tint_symbol_4 main(tint_symbol_3 tint_symbol_2) {
+ float4 inner_result = main_inner(tint_symbol_2.vUV);
+ tint_symbol_4 wrapper_result = (tint_symbol_4)0;
wrapper_result.value = inner_result;
return wrapper_result;
}
diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.glsl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.glsl
index 2c669d2..761da23 100644
--- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.glsl
+++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.glsl
@@ -7,7 +7,8 @@
uniform highp sampler2D randomTexture_Sampler;
vec4 tint_symbol(vec2 vUV) {
- vec3 random = texture(randomTexture_Sampler, vUV).rgb;
+ vec4 tint_symbol_1 = texture(randomTexture_Sampler, vUV);
+ vec3 random = tint_symbol_1.rgb;
int i = 0;
while (true) {
if ((i < 1)) {
diff --git a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.msl b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.msl
index d5797f0..7efaf69 100644
--- a/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.msl
+++ b/test/tint/bug/fxc/gradient_in_varying_loop/1112.wgsl.expected.msl
@@ -6,16 +6,17 @@
volatile bool VOLATILE_NAME = true; \
if (VOLATILE_NAME)
-struct tint_symbol_2 {
+struct tint_symbol_3 {
float2 vUV [[user(locn0)]];
};
-struct tint_symbol_3 {
+struct tint_symbol_4 {
float4 value [[color(0)]];
};
-float4 tint_symbol_inner(float2 vUV, texture2d<float, access::sample> tint_symbol_4, sampler tint_symbol_5) {
- float3 const random = tint_symbol_4.sample(tint_symbol_5, vUV).rgb;
+float4 tint_symbol_inner(float2 vUV, texture2d<float, access::sample> tint_symbol_5, sampler tint_symbol_6) {
+ float4 const tint_symbol_1 = tint_symbol_5.sample(tint_symbol_6, vUV);
+ float3 const random = tint_symbol_1.rgb;
int i = 0;
TINT_ISOLATE_UB(tint_volatile_true) while(true) {
if ((i < 1)) {
@@ -33,9 +34,9 @@
return float4(1.0f);
}
-fragment tint_symbol_3 tint_symbol(texture2d<float, access::sample> tint_symbol_6 [[texture(0)]], sampler tint_symbol_7 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- float4 const inner_result = tint_symbol_inner(tint_symbol_1.vUV, tint_symbol_6, tint_symbol_7);
- tint_symbol_3 wrapper_result = {};
+fragment tint_symbol_4 tint_symbol(texture2d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]], tint_symbol_3 tint_symbol_2 [[stage_in]]) {
+ float4 const inner_result = tint_symbol_inner(tint_symbol_2.vUV, tint_symbol_7, tint_symbol_8);
+ tint_symbol_4 wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}
diff --git a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.dxc.hlsl
index 1095835..a58ca70 100644
--- a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.dxc.hlsl
@@ -24,6 +24,7 @@
void main_inner(float x) {
switch(tint_ftoi(x)) {
case 0: {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
break;
}
default: {
diff --git a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.fxc.hlsl
index 1095835..a58ca70 100644
--- a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.fxc.hlsl
@@ -24,6 +24,7 @@
void main_inner(float x) {
switch(tint_ftoi(x)) {
case 0: {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
break;
}
default: {
diff --git a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.glsl
index 1d41e44..6e69e9a 100644
--- a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.glsl
@@ -19,9 +19,12 @@
return ((v < 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
}
+uniform highp sampler2D t_s;
+
void tint_symbol(float x) {
switch(tint_ftoi(x)) {
case 0: {
+ vec4 tint_phony = texture(t_s, vec2(0.0f));
break;
}
default: {
diff --git a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.msl
index cc12273..bd13c9c2 100644
--- a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.msl
@@ -21,9 +21,10 @@
float x [[user(locn0)]];
};
-void tint_symbol_inner(float x) {
+void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
switch(tint_ftoi(x)) {
case 0: {
+ float4 const tint_phony = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
break;
}
default: {
@@ -32,8 +33,8 @@
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
return;
}
diff --git a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.spvasm
index 1b216ac..1222a17 100644
--- a/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/case_body_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 39
+; Bound: 47
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -50,7 +50,11 @@
%int_2147483647 = OpConstant %int 2147483647
%void = OpTypeVoid
%25 = OpTypeFunction %void %float
- %34 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %38 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %41 = OpConstantNull %v2float
+ %42 = OpTypeFunction %void
%tint_ftoi = OpFunction %int None %10
%v = OpFunctionParameter %float
%14 = OpLabel
@@ -68,15 +72,19 @@
OpSelectionMerge %30 None
OpSwitch %31 %32 0 %33
%33 = OpLabel
+ %36 = OpLoad %9 %s
+ %37 = OpLoad %6 %t
+ %39 = OpSampledImage %38 %37 %36
+ %34 = OpImageSampleImplicitLod %v4float %39 %41
OpBranch %30
%32 = OpLabel
OpBranch %30
%30 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %34
- %36 = OpLabel
- %38 = OpLoad %float %x_1
- %37 = OpFunctionCall %void %main_inner %38
+ %main = OpFunction %void None %42
+ %44 = OpLabel
+ %46 = OpLoad %float %x_1
+ %45 = OpFunctionCall %void %main_inner %46
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.dxc.hlsl
index 69080f2..c4ea405 100644
--- a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.dxc.hlsl
@@ -20,6 +20,7 @@
void main_inner(float x) {
{
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
}
diff --git a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.fxc.hlsl
index 69080f2..c4ea405 100644
--- a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.fxc.hlsl
@@ -20,6 +20,7 @@
void main_inner(float x) {
{
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
}
diff --git a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.glsl
index 79703a5..354d7fc 100644
--- a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.glsl
@@ -15,9 +15,12 @@
precision highp int;
layout(location = 0) in float x_1;
+uniform highp sampler2D t_s;
+
void tint_symbol(float x) {
{
if ((x > 0.0f)) {
+ vec4 tint_phony = texture(t_s, vec2(0.0f));
}
}
}
diff --git a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.msl
index 7e429ff..c11059f 100644
--- a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.msl
@@ -17,15 +17,16 @@
float x [[user(locn0)]];
};
-void tint_symbol_inner(float x) {
+void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
{
if ((x > 0.0f)) {
+ float4 const tint_phony = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
}
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
return;
}
diff --git a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.spvasm
index 7545108..41875ca 100644
--- a/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/compound_statement_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 25
+; Bound: 33
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -43,7 +43,11 @@
%10 = OpTypeFunction %void %float
%15 = OpConstantNull %float
%bool = OpTypeBool
- %20 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %27 = OpConstantNull %v2float
+ %28 = OpTypeFunction %void
%main_inner = OpFunction %void None %10
%x = OpFunctionParameter %float
%14 = OpLabel
@@ -51,13 +55,17 @@
OpSelectionMerge %18 None
OpBranchConditional %16 %19 %18
%19 = OpLabel
+ %22 = OpLoad %9 %s
+ %23 = OpLoad %6 %t
+ %25 = OpSampledImage %24 %23 %22
+ %20 = OpImageSampleImplicitLod %v4float %25 %27
OpBranch %18
%18 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %20
- %22 = OpLabel
- %24 = OpLoad %float %x_1
- %23 = OpFunctionCall %void %main_inner %24
+ %main = OpFunction %void None %28
+ %30 = OpLabel
+ %32 = OpLoad %float %x_1
+ %31 = OpFunctionCall %void %main_inner %32
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.dxc.hlsl
index 564755f..1bb03f9 100644
--- a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.dxc.hlsl
@@ -24,6 +24,7 @@
void main_inner(float x) {
tint_ftoi(x);
do {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
} while (false);
}
diff --git a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.fxc.hlsl
index 564755f..1bb03f9 100644
--- a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.fxc.hlsl
@@ -24,6 +24,7 @@
void main_inner(float x) {
tint_ftoi(x);
do {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
} while (false);
}
diff --git a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.glsl
index cb34a17..8f95c5a 100644
--- a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.glsl
@@ -19,9 +19,12 @@
return ((v < 2147483520.0f) ? ((v < -2147483648.0f) ? (-2147483647 - 1) : int(v)) : 2147483647);
}
+uniform highp sampler2D t_s;
+
void tint_symbol(float x) {
switch(tint_ftoi(x)) {
default: {
+ vec4 tint_phony = texture(t_s, vec2(0.0f));
break;
}
}
diff --git a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.msl
index 8ba0d2b..0e35ccd 100644
--- a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.msl
@@ -21,16 +21,17 @@
float x [[user(locn0)]];
};
-void tint_symbol_inner(float x) {
+void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
switch(tint_ftoi(x)) {
default: {
+ float4 const tint_phony = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
break;
}
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
return;
}
diff --git a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.spvasm
index da201a0..229ee64 100644
--- a/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/default_case_body_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 38
+; Bound: 46
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -50,7 +50,11 @@
%int_2147483647 = OpConstant %int 2147483647
%void = OpTypeVoid
%25 = OpTypeFunction %void %float
- %33 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %37 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %40 = OpConstantNull %v2float
+ %41 = OpTypeFunction %void
%tint_ftoi = OpFunction %int None %10
%v = OpFunctionParameter %float
%14 = OpLabel
@@ -68,13 +72,17 @@
OpSelectionMerge %30 None
OpSwitch %31 %32
%32 = OpLabel
+ %35 = OpLoad %9 %s
+ %36 = OpLoad %6 %t
+ %38 = OpSampledImage %37 %36 %35
+ %33 = OpImageSampleImplicitLod %v4float %38 %40
OpBranch %30
%30 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %33
- %35 = OpLabel
- %37 = OpLoad %float %x_1
- %36 = OpFunctionCall %void %main_inner %37
+ %main = OpFunction %void None %41
+ %43 = OpLabel
+ %45 = OpLoad %float %x_1
+ %44 = OpFunctionCall %void %main_inner %45
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/directive.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/directive.wgsl.expected.dxc.hlsl
index 86ec60b..e3f60aa 100644
--- a/test/tint/diagnostic_filtering/directive.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/directive.wgsl.expected.dxc.hlsl
@@ -19,6 +19,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/directive.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/directive.wgsl.expected.fxc.hlsl
index 86ec60b..e3f60aa 100644
--- a/test/tint/diagnostic_filtering/directive.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/directive.wgsl.expected.fxc.hlsl
@@ -19,6 +19,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/directive.wgsl.expected.glsl b/test/tint/diagnostic_filtering/directive.wgsl.expected.glsl
index 8c8247e6..1757b84 100644
--- a/test/tint/diagnostic_filtering/directive.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/directive.wgsl.expected.glsl
@@ -15,8 +15,11 @@
precision highp int;
layout(location = 0) in float x_1;
+uniform highp sampler2D t_s;
+
void tint_symbol(float x) {
if ((x > 0.0f)) {
+ vec4 tint_phony = texture(t_s, vec2(0.0f));
}
}
diff --git a/test/tint/diagnostic_filtering/directive.wgsl.expected.msl b/test/tint/diagnostic_filtering/directive.wgsl.expected.msl
index 3edac24..75e834a 100644
--- a/test/tint/diagnostic_filtering/directive.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/directive.wgsl.expected.msl
@@ -17,13 +17,14 @@
float x [[user(locn0)]];
};
-void tint_symbol_inner(float x) {
+void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
if ((x > 0.0f)) {
+ float4 const tint_phony = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
return;
}
diff --git a/test/tint/diagnostic_filtering/directive.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/directive.wgsl.expected.spvasm
index 33e1d35..9e7b3ac 100644
--- a/test/tint/diagnostic_filtering/directive.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/directive.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 25
+; Bound: 33
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -43,7 +43,11 @@
%10 = OpTypeFunction %void %float
%15 = OpConstantNull %float
%bool = OpTypeBool
- %20 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %27 = OpConstantNull %v2float
+ %28 = OpTypeFunction %void
%main_inner = OpFunction %void None %10
%x = OpFunctionParameter %float
%14 = OpLabel
@@ -51,13 +55,17 @@
OpSelectionMerge %18 None
OpBranchConditional %16 %19 %18
%19 = OpLabel
+ %22 = OpLoad %9 %s
+ %23 = OpLoad %6 %t
+ %25 = OpSampledImage %24 %23 %22
+ %20 = OpImageSampleImplicitLod %v4float %25 %27
OpBranch %18
%18 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %20
- %22 = OpLabel
- %24 = OpLoad %float %x_1
- %23 = OpFunctionCall %void %main_inner %24
+ %main = OpFunction %void None %28
+ %30 = OpLabel
+ %32 = OpLoad %float %x_1
+ %31 = OpFunctionCall %void %main_inner %32
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.dxc.hlsl
index 9258f07..1bdf31a 100644
--- a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.dxc.hlsl
@@ -20,6 +20,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
} else {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.fxc.hlsl
index 9258f07..1bdf31a 100644
--- a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.fxc.hlsl
@@ -20,6 +20,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
} else {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.glsl
index 2dd1d95..5ec08bf 100644
--- a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.glsl
@@ -15,9 +15,12 @@
precision highp int;
layout(location = 0) in float x_1;
+uniform highp sampler2D t_s;
+
void tint_symbol(float x) {
if ((x > 0.0f)) {
} else {
+ vec4 tint_phony = texture(t_s, vec2(0.0f));
}
}
diff --git a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.msl
index 351f979..61777af 100644
--- a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.msl
@@ -17,14 +17,15 @@
float x [[user(locn0)]];
};
-void tint_symbol_inner(float x) {
+void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
if ((x > 0.0f)) {
} else {
+ float4 const tint_phony = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
return;
}
diff --git a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.spvasm
index 80ae665..d029e02 100644
--- a/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/else_body_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 26
+; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -43,7 +43,11 @@
%10 = OpTypeFunction %void %float
%15 = OpConstantNull %float
%bool = OpTypeBool
- %21 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %25 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %28 = OpConstantNull %v2float
+ %29 = OpTypeFunction %void
%main_inner = OpFunction %void None %10
%x = OpFunctionParameter %float
%14 = OpLabel
@@ -53,13 +57,17 @@
%19 = OpLabel
OpBranch %18
%20 = OpLabel
+ %23 = OpLoad %9 %s
+ %24 = OpLoad %6 %t
+ %26 = OpSampledImage %25 %24 %23
+ %21 = OpImageSampleImplicitLod %v4float %26 %28
OpBranch %18
%18 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %21
- %23 = OpLabel
- %25 = OpLoad %float %x_1
- %24 = OpFunctionCall %void %main_inner %25
+ %main = OpFunction %void None %29
+ %31 = OpLabel
+ %33 = OpLoad %float %x_1
+ %32 = OpFunctionCall %void %main_inner %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.dxc.hlsl
index 798c54d..e6ecd18 100644
--- a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.dxc.hlsl
@@ -21,6 +21,7 @@
if ((x > 0.0f)) {
} else {
if ((x < 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
}
diff --git a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.fxc.hlsl
index 798c54d..e6ecd18 100644
--- a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.fxc.hlsl
@@ -21,6 +21,7 @@
if ((x > 0.0f)) {
} else {
if ((x < 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
}
diff --git a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.glsl
index 818ad6e..d80e3a6 100644
--- a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.glsl
@@ -15,10 +15,13 @@
precision highp int;
layout(location = 0) in float x_1;
+uniform highp sampler2D t_s;
+
void tint_symbol(float x) {
if ((x > 0.0f)) {
} else {
if ((x < 0.0f)) {
+ vec4 tint_phony = texture(t_s, vec2(0.0f));
}
}
}
diff --git a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.msl
index 6a945fa..a785da1 100644
--- a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.msl
@@ -17,16 +17,17 @@
float x [[user(locn0)]];
};
-void tint_symbol_inner(float x) {
+void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
if ((x > 0.0f)) {
} else {
if ((x < 0.0f)) {
+ float4 const tint_phony = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
}
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
return;
}
diff --git a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.spvasm
index ef8afdc..e1a1b72 100644
--- a/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/else_if_body_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 29
+; Bound: 37
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -43,7 +43,11 @@
%10 = OpTypeFunction %void %float
%15 = OpConstantNull %float
%bool = OpTypeBool
- %24 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %28 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %31 = OpConstantNull %v2float
+ %32 = OpTypeFunction %void
%main_inner = OpFunction %void None %10
%x = OpFunctionParameter %float
%14 = OpLabel
@@ -57,15 +61,19 @@
OpSelectionMerge %22 None
OpBranchConditional %21 %23 %22
%23 = OpLabel
+ %26 = OpLoad %9 %s
+ %27 = OpLoad %6 %t
+ %29 = OpSampledImage %28 %27 %26
+ %24 = OpImageSampleImplicitLod %v4float %29 %31
OpBranch %22
%22 = OpLabel
OpBranch %18
%18 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %24
- %26 = OpLabel
- %28 = OpLoad %float %x_1
- %27 = OpFunctionCall %void %main_inner %28
+ %main = OpFunction %void None %32
+ %34 = OpLabel
+ %36 = OpLoad %float %x_1
+ %35 = OpFunctionCall %void %main_inner %36
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.dxc.hlsl
index 21667c1..2174e99 100644
--- a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.dxc.hlsl
@@ -10,24 +10,27 @@
for (; x > v.x && dpdx(1.0) > 0.0; ) {
^^^^^^^^^
-struct tint_symbol_1 {
+struct tint_symbol_3 {
float x : TEXCOORD0;
};
void main_inner(float x) {
float4 v = (0.0f).xxxx;
- {
- while (true) {
- bool tint_tmp = (x > v.x);
- if (tint_tmp) {
- tint_tmp = (ddx(1.0f) > 0.0f);
- }
- if (!((tint_tmp))) { break; }
+ while (true) {
+ bool tint_symbol = (x > v.x);
+ if (tint_symbol) {
+ float tint_symbol_1 = ddx(1.0f);
+ tint_symbol = (tint_symbol_1 > 0.0f);
+ }
+ if (!(tint_symbol)) {
+ break;
+ }
+ {
}
}
}
-void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.x);
+void main(tint_symbol_3 tint_symbol_2) {
+ main_inner(tint_symbol_2.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.fxc.hlsl
index 21667c1..2174e99 100644
--- a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.fxc.hlsl
@@ -10,24 +10,27 @@
for (; x > v.x && dpdx(1.0) > 0.0; ) {
^^^^^^^^^
-struct tint_symbol_1 {
+struct tint_symbol_3 {
float x : TEXCOORD0;
};
void main_inner(float x) {
float4 v = (0.0f).xxxx;
- {
- while (true) {
- bool tint_tmp = (x > v.x);
- if (tint_tmp) {
- tint_tmp = (ddx(1.0f) > 0.0f);
- }
- if (!((tint_tmp))) { break; }
+ while (true) {
+ bool tint_symbol = (x > v.x);
+ if (tint_symbol) {
+ float tint_symbol_1 = ddx(1.0f);
+ tint_symbol = (tint_symbol_1 > 0.0f);
+ }
+ if (!(tint_symbol)) {
+ break;
+ }
+ {
}
}
}
-void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.x);
+void main(tint_symbol_3 tint_symbol_2) {
+ main_inner(tint_symbol_2.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.glsl
index ef105d8..9caa7f2 100644
--- a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.glsl
@@ -17,13 +17,16 @@
layout(location = 0) in float x_1;
void tint_symbol(float x) {
vec4 v = vec4(0.0f);
- {
- while (true) {
- bool tint_tmp = (x > v.x);
- if (tint_tmp) {
- tint_tmp = (dFdx(1.0f) > 0.0f);
- }
- if (!((tint_tmp))) { break; }
+ while (true) {
+ bool tint_symbol_1 = (x > v.x);
+ if (tint_symbol_1) {
+ float tint_symbol_2 = dFdx(1.0f);
+ tint_symbol_1 = (tint_symbol_2 > 0.0f);
+ }
+ if (!(tint_symbol_1)) {
+ break;
+ }
+ {
}
}
}
diff --git a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.msl
index 63a1789..6354472 100644
--- a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.msl
@@ -18,18 +18,28 @@
volatile bool VOLATILE_NAME = true; \
if (VOLATILE_NAME)
-struct tint_symbol_2 {
+struct tint_symbol_4 {
float x [[user(locn0)]];
};
void tint_symbol_inner(float x) {
float4 v = float4(0.0f);
- TINT_ISOLATE_UB(tint_volatile_true) for(; ((x > v[0]) && (dfdx(1.0f) > 0.0f)); ) {
+ TINT_ISOLATE_UB(tint_volatile_true) while(true) {
+ bool tint_symbol_1 = (x > v[0]);
+ if (tint_symbol_1) {
+ float const tint_symbol_2 = dfdx(1.0f);
+ tint_symbol_1 = (tint_symbol_2 > 0.0f);
+ }
+ if (!(tint_symbol_1)) {
+ break;
+ }
+ {
+ }
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(tint_symbol_4 tint_symbol_3 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_3.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.spvasm
index 34c425f..9228b53 100644
--- a/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/for_loop_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 39
+; Bound: 43
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -23,6 +23,7 @@
OpName %main_inner "main_inner"
OpName %x "x"
OpName %v "v"
+ OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %x_1 Location 0
%float = OpTypeFloat 32
@@ -37,45 +38,51 @@
%uint_0 = OpConstant %uint 0
%_ptr_Function_float = OpTypePointer Function %float
%bool = OpTypeBool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %26 = OpConstantNull %bool
%float_1 = OpConstant %float 1
- %29 = OpConstantNull %float
- %34 = OpTypeFunction %void
+ %32 = OpConstantNull %float
+ %38 = OpTypeFunction %void
%main_inner = OpFunction %void None %4
%x = OpFunctionParameter %float
%8 = OpLabel
%v = OpVariable %_ptr_Function_v4float Function %10
+%tint_symbol = OpVariable %_ptr_Function_bool Function %26
OpStore %v %10
OpBranch %13
%13 = OpLabel
OpLoopMerge %14 %15 None
OpBranch %16
%16 = OpLabel
- %21 = OpAccessChain %_ptr_Function_float %v %uint_0
- %22 = OpLoad %float %21
- %23 = OpFOrdGreaterThan %bool %x %22
- OpSelectionMerge %25 None
- OpBranchConditional %23 %26 %25
- %26 = OpLabel
- %27 = OpDPdx %float %float_1
- %30 = OpFOrdGreaterThan %bool %27 %29
- OpBranch %25
- %25 = OpLabel
- %31 = OpPhi %bool %23 %16 %30 %26
- %17 = OpLogicalNot %bool %31
- OpSelectionMerge %32 None
- OpBranchConditional %17 %33 %32
- %33 = OpLabel
+ %20 = OpAccessChain %_ptr_Function_float %v %uint_0
+ %21 = OpLoad %float %20
+ %22 = OpFOrdGreaterThan %bool %x %21
+ OpStore %tint_symbol %22
+ %27 = OpLoad %bool %tint_symbol
+ OpSelectionMerge %28 None
+ OpBranchConditional %27 %29 %28
+ %29 = OpLabel
+ %30 = OpDPdx %float %float_1
+ %33 = OpFOrdGreaterThan %bool %30 %32
+ OpStore %tint_symbol %33
+ OpBranch %28
+ %28 = OpLabel
+ %35 = OpLoad %bool %tint_symbol
+ %34 = OpLogicalNot %bool %35
+ OpSelectionMerge %36 None
+ OpBranchConditional %34 %37 %36
+ %37 = OpLabel
OpBranch %14
- %32 = OpLabel
+ %36 = OpLabel
OpBranch %15
%15 = OpLabel
OpBranch %13
%14 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %34
- %36 = OpLabel
- %38 = OpLoad %float %x_1
- %37 = OpFunctionCall %void %main_inner %38
+ %main = OpFunction %void None %38
+ %40 = OpLabel
+ %42 = OpLoad %float %x_1
+ %41 = OpFunctionCall %void %main_inner %42
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.dxc.hlsl
index d3ca32f..44dae4a 100644
--- a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.dxc.hlsl
@@ -19,6 +19,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.fxc.hlsl
index d3ca32f..44dae4a 100644
--- a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.fxc.hlsl
@@ -19,6 +19,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.glsl
index 36ed75c..e39827f 100644
--- a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.glsl
@@ -15,8 +15,11 @@
precision highp int;
layout(location = 0) in float x_1;
+uniform highp sampler2D t_s;
+
void tint_symbol(float x) {
if ((x > 0.0f)) {
+ vec4 tint_phony = texture(t_s, vec2(0.0f));
}
}
diff --git a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.msl
index 83f50fe..e65a4f2 100644
--- a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.msl
@@ -17,13 +17,14 @@
float x [[user(locn0)]];
};
-void tint_symbol_inner(float x) {
+void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
if ((x > 0.0f)) {
+ float4 const tint_phony = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
return;
}
diff --git a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.spvasm
index 24c7c9e..24ca30e 100644
--- a/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/function_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 25
+; Bound: 33
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -43,7 +43,11 @@
%10 = OpTypeFunction %void %float
%15 = OpConstantNull %float
%bool = OpTypeBool
- %20 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %27 = OpConstantNull %v2float
+ %28 = OpTypeFunction %void
%main_inner = OpFunction %void None %10
%x = OpFunctionParameter %float
%14 = OpLabel
@@ -51,13 +55,17 @@
OpSelectionMerge %18 None
OpBranchConditional %16 %19 %18
%19 = OpLabel
+ %22 = OpLoad %9 %s
+ %23 = OpLoad %6 %t
+ %25 = OpSampledImage %24 %23 %22
+ %20 = OpImageSampleImplicitLod %v4float %25 %27
OpBranch %18
%18 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %20
- %22 = OpLabel
- %24 = OpLoad %float %x_1
- %23 = OpFunctionCall %void %main_inner %24
+ %main = OpFunction %void None %28
+ %30 = OpLabel
+ %32 = OpLoad %float %x_1
+ %31 = OpFunctionCall %void %main_inner %32
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.dxc.hlsl
index 9ce0bb8..873c285 100644
--- a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.dxc.hlsl
@@ -19,6 +19,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.fxc.hlsl
index 9ce0bb8..873c285 100644
--- a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.fxc.hlsl
@@ -19,6 +19,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.glsl
index 555a879..d3f174a 100644
--- a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.glsl
@@ -15,8 +15,11 @@
precision highp int;
layout(location = 0) in float x_1;
+uniform highp sampler2D t_s;
+
void tint_symbol(float x) {
if ((x > 0.0f)) {
+ vec4 tint_phony = texture(t_s, vec2(0.0f));
}
}
diff --git a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.msl
index d69cb8d..0ef8d78 100644
--- a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.msl
@@ -17,13 +17,14 @@
float x [[user(locn0)]];
};
-void tint_symbol_inner(float x) {
+void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
if ((x > 0.0f)) {
+ float4 const tint_phony = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
return;
}
diff --git a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.spvasm
index 8ba4515..7b798c9 100644
--- a/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/function_body_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 25
+; Bound: 33
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -43,7 +43,11 @@
%10 = OpTypeFunction %void %float
%15 = OpConstantNull %float
%bool = OpTypeBool
- %20 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %27 = OpConstantNull %v2float
+ %28 = OpTypeFunction %void
%main_inner = OpFunction %void None %10
%x = OpFunctionParameter %float
%14 = OpLabel
@@ -51,13 +55,17 @@
OpSelectionMerge %18 None
OpBranchConditional %16 %19 %18
%19 = OpLabel
+ %22 = OpLoad %9 %s
+ %23 = OpLoad %6 %t
+ %25 = OpSampledImage %24 %23 %22
+ %20 = OpImageSampleImplicitLod %v4float %25 %27
OpBranch %18
%18 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %20
- %22 = OpLabel
- %24 = OpLoad %float %x_1
- %23 = OpFunctionCall %void %main_inner %24
+ %main = OpFunction %void None %28
+ %30 = OpLabel
+ %32 = OpLoad %float %x_1
+ %31 = OpFunctionCall %void %main_inner %32
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.dxc.hlsl
index 9154d1d..fb6d833 100644
--- a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.dxc.hlsl
@@ -19,6 +19,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.fxc.hlsl
index 9154d1d..fb6d833 100644
--- a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.fxc.hlsl
@@ -19,6 +19,7 @@
void main_inner(float x) {
if ((x > 0.0f)) {
+ float4 tint_phony = t.Sample(s, (0.0f).xx);
}
}
diff --git a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.glsl
index bf1cae7..901c8cc 100644
--- a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.glsl
@@ -15,8 +15,11 @@
precision highp int;
layout(location = 0) in float x_1;
+uniform highp sampler2D t_s;
+
void tint_symbol(float x) {
if ((x > 0.0f)) {
+ vec4 tint_phony = texture(t_s, vec2(0.0f));
}
}
diff --git a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.msl
index 07bc9c0..af0be75 100644
--- a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.msl
@@ -17,13 +17,14 @@
float x [[user(locn0)]];
};
-void tint_symbol_inner(float x) {
+void tint_symbol_inner(float x, texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
if ((x > 0.0f)) {
+ float4 const tint_phony = tint_symbol_3.sample(tint_symbol_4, float2(0.0f));
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_1.x, tint_symbol_5, tint_symbol_6);
return;
}
diff --git a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.spvasm
index 533a15d..ba7c3d3 100644
--- a/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/if_body_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 25
+; Bound: 33
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -43,7 +43,11 @@
%10 = OpTypeFunction %void %float
%15 = OpConstantNull %float
%bool = OpTypeBool
- %20 = OpTypeFunction %void
+ %v4float = OpTypeVector %float 4
+ %24 = OpTypeSampledImage %6
+ %v2float = OpTypeVector %float 2
+ %27 = OpConstantNull %v2float
+ %28 = OpTypeFunction %void
%main_inner = OpFunction %void None %10
%x = OpFunctionParameter %float
%14 = OpLabel
@@ -51,13 +55,17 @@
OpSelectionMerge %18 None
OpBranchConditional %16 %19 %18
%19 = OpLabel
+ %22 = OpLoad %9 %s
+ %23 = OpLoad %6 %t
+ %25 = OpSampledImage %24 %23 %22
+ %20 = OpImageSampleImplicitLod %v4float %25 %27
OpBranch %18
%18 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %20
- %22 = OpLabel
- %24 = OpLoad %float %x_1
- %23 = OpFunctionCall %void %main_inner %24
+ %main = OpFunction %void None %28
+ %30 = OpLabel
+ %32 = OpLoad %float %x_1
+ %31 = OpFunctionCall %void %main_inner %32
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.dxc.hlsl
index 13f36cb..9a3a9a8 100644
--- a/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.dxc.hlsl
@@ -13,19 +13,20 @@
Texture2D<float4> t : register(t1);
SamplerState s : register(s2);
-struct tint_symbol_1 {
+struct tint_symbol_2 {
float x : TEXCOORD0;
};
void main_inner(float x) {
if ((x > 0.0f)) {
} else {
- if ((ddx(1.0f) > 0.0f)) {
+ float tint_symbol = ddx(1.0f);
+ if ((tint_symbol > 0.0f)) {
}
}
}
-void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.x);
+void main(tint_symbol_2 tint_symbol_1) {
+ main_inner(tint_symbol_1.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.fxc.hlsl
index 13f36cb..9a3a9a8 100644
--- a/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.fxc.hlsl
@@ -13,19 +13,20 @@
Texture2D<float4> t : register(t1);
SamplerState s : register(s2);
-struct tint_symbol_1 {
+struct tint_symbol_2 {
float x : TEXCOORD0;
};
void main_inner(float x) {
if ((x > 0.0f)) {
} else {
- if ((ddx(1.0f) > 0.0f)) {
+ float tint_symbol = ddx(1.0f);
+ if ((tint_symbol > 0.0f)) {
}
}
}
-void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.x);
+void main(tint_symbol_2 tint_symbol_1) {
+ main_inner(tint_symbol_1.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.glsl
index eb06c0e..c87dcd9 100644
--- a/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.glsl
@@ -18,7 +18,8 @@
void tint_symbol(float x) {
if ((x > 0.0f)) {
} else {
- if ((dFdx(1.0f) > 0.0f)) {
+ float tint_symbol_1 = dFdx(1.0f);
+ if ((tint_symbol_1 > 0.0f)) {
}
}
}
diff --git a/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.msl
index 689da4e..eae5ff3 100644
--- a/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/if_statement_attribute.wgsl.expected.msl
@@ -13,20 +13,21 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_symbol_2 {
+struct tint_symbol_3 {
float x [[user(locn0)]];
};
void tint_symbol_inner(float x) {
if ((x > 0.0f)) {
} else {
- if ((dfdx(1.0f) > 0.0f)) {
+ float const tint_symbol_1 = dfdx(1.0f);
+ if ((tint_symbol_1 > 0.0f)) {
}
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(tint_symbol_3 tint_symbol_2 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_2.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.dxc.hlsl
index f15782f..fc69c42 100644
--- a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.dxc.hlsl
@@ -16,6 +16,7 @@
void main_inner(float x) {
while (true) {
+ float tint_phony = ddx(1.0f);
{
if ((x > 0.0f)) { break; }
}
diff --git a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.fxc.hlsl
index f15782f..fc69c42 100644
--- a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.fxc.hlsl
@@ -16,6 +16,7 @@
void main_inner(float x) {
while (true) {
+ float tint_phony = ddx(1.0f);
{
if ((x > 0.0f)) { break; }
}
diff --git a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.glsl
index 2ddaac4..a796906 100644
--- a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.glsl
@@ -17,6 +17,7 @@
layout(location = 0) in float x_1;
void tint_symbol(float x) {
while (true) {
+ float tint_phony = dFdx(1.0f);
{
if ((x > 0.0f)) { break; }
}
diff --git a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.msl
index e8e448f..98e918f 100644
--- a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.msl
@@ -24,6 +24,7 @@
void tint_symbol_inner(float x) {
TINT_ISOLATE_UB(tint_volatile_true) while(true) {
+ float const tint_phony = dfdx(1.0f);
{
if ((x > 0.0f)) { break; }
}
diff --git a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.spvasm
index 2de9615..9abcd4f 100644
--- a/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/loop_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 23
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -29,9 +29,10 @@
%x_1 = OpVariable %_ptr_Input_float Input
%void = OpTypeVoid
%4 = OpTypeFunction %void %float
- %13 = OpConstantNull %float
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantNull %float
%bool = OpTypeBool
- %16 = OpTypeFunction %void
+ %18 = OpTypeFunction %void
%main_inner = OpFunction %void None %4
%x = OpFunctionParameter %float
%8 = OpLabel
@@ -40,16 +41,17 @@
OpLoopMerge %10 %11 None
OpBranch %12
%12 = OpLabel
+ %13 = OpDPdx %float %float_1
OpBranch %11
%11 = OpLabel
- %14 = OpFOrdGreaterThan %bool %x %13
- OpBranchConditional %14 %10 %9
+ %16 = OpFOrdGreaterThan %bool %x %15
+ OpBranchConditional %16 %10 %9
%10 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %16
- %18 = OpLabel
- %20 = OpLoad %float %x_1
- %19 = OpFunctionCall %void %main_inner %20
+ %main = OpFunction %void None %18
+ %20 = OpLabel
+ %22 = OpLoad %float %x_1
+ %21 = OpFunctionCall %void %main_inner %22
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.dxc.hlsl
index 4dc3724..0e7171b 100644
--- a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.dxc.hlsl
@@ -16,6 +16,7 @@
void main_inner(float x) {
while (true) {
+ float tint_phony = ddx(1.0f);
{
if ((x > 0.0f)) { break; }
}
diff --git a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.fxc.hlsl
index 4dc3724..0e7171b 100644
--- a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.fxc.hlsl
@@ -16,6 +16,7 @@
void main_inner(float x) {
while (true) {
+ float tint_phony = ddx(1.0f);
{
if ((x > 0.0f)) { break; }
}
diff --git a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.glsl
index c75001b..5399447 100644
--- a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.glsl
@@ -17,6 +17,7 @@
layout(location = 0) in float x_1;
void tint_symbol(float x) {
while (true) {
+ float tint_phony = dFdx(1.0f);
{
if ((x > 0.0f)) { break; }
}
diff --git a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.msl
index 1d37883..dde39cd 100644
--- a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.msl
@@ -24,6 +24,7 @@
void tint_symbol_inner(float x) {
TINT_ISOLATE_UB(tint_volatile_true) while(true) {
+ float const tint_phony = dfdx(1.0f);
{
if ((x > 0.0f)) { break; }
}
diff --git a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.spvasm
index ce95602..fecad8c 100644
--- a/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/loop_body_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 23
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -29,9 +29,10 @@
%x_1 = OpVariable %_ptr_Input_float Input
%void = OpTypeVoid
%4 = OpTypeFunction %void %float
- %13 = OpConstantNull %float
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantNull %float
%bool = OpTypeBool
- %16 = OpTypeFunction %void
+ %18 = OpTypeFunction %void
%main_inner = OpFunction %void None %4
%x = OpFunctionParameter %float
%8 = OpLabel
@@ -40,16 +41,17 @@
OpLoopMerge %10 %11 None
OpBranch %12
%12 = OpLabel
+ %13 = OpDPdx %float %float_1
OpBranch %11
%11 = OpLabel
- %14 = OpFOrdGreaterThan %bool %x %13
- OpBranchConditional %14 %10 %9
+ %16 = OpFOrdGreaterThan %bool %x %15
+ OpBranchConditional %16 %10 %9
%10 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %16
- %18 = OpLabel
- %20 = OpLoad %float %x_1
- %19 = OpFunctionCall %void %main_inner %20
+ %main = OpFunction %void None %18
+ %20 = OpLabel
+ %22 = OpLoad %float %x_1
+ %21 = OpFunctionCall %void %main_inner %22
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.dxc.hlsl
index 5460a69..4e426fc 100644
--- a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.dxc.hlsl
@@ -17,6 +17,7 @@
void main_inner(float x) {
while (true) {
{
+ float tint_phony = ddx(1.0f);
if ((x > 0.0f)) { break; }
}
}
diff --git a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.fxc.hlsl
index 5460a69..4e426fc 100644
--- a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.fxc.hlsl
@@ -17,6 +17,7 @@
void main_inner(float x) {
while (true) {
{
+ float tint_phony = ddx(1.0f);
if ((x > 0.0f)) { break; }
}
}
diff --git a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.glsl
index 217c032..23c3041 100644
--- a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.glsl
@@ -18,6 +18,7 @@
void tint_symbol(float x) {
while (true) {
{
+ float tint_phony = dFdx(1.0f);
if ((x > 0.0f)) { break; }
}
}
diff --git a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.msl
index 93fca0d..3a6f0c6 100644
--- a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.msl
@@ -25,6 +25,7 @@
void tint_symbol_inner(float x) {
TINT_ISOLATE_UB(tint_volatile_true) while(true) {
{
+ float const tint_phony = dfdx(1.0f);
if ((x > 0.0f)) { break; }
}
}
diff --git a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.spvasm
index d1c7513..5878c14 100644
--- a/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/loop_continuing_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 21
+; Bound: 23
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -29,9 +29,10 @@
%x_1 = OpVariable %_ptr_Input_float Input
%void = OpTypeVoid
%4 = OpTypeFunction %void %float
- %13 = OpConstantNull %float
+ %float_1 = OpConstant %float 1
+ %15 = OpConstantNull %float
%bool = OpTypeBool
- %16 = OpTypeFunction %void
+ %18 = OpTypeFunction %void
%main_inner = OpFunction %void None %4
%x = OpFunctionParameter %float
%8 = OpLabel
@@ -42,14 +43,15 @@
%12 = OpLabel
OpBranch %11
%11 = OpLabel
- %14 = OpFOrdGreaterThan %bool %x %13
- OpBranchConditional %14 %10 %9
+ %13 = OpDPdx %float %float_1
+ %16 = OpFOrdGreaterThan %bool %x %15
+ OpBranchConditional %16 %10 %9
%10 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %16
- %18 = OpLabel
- %20 = OpLoad %float %x_1
- %19 = OpFunctionCall %void %main_inner %20
+ %main = OpFunction %void None %18
+ %20 = OpLabel
+ %22 = OpLoad %float %x_1
+ %21 = OpFunctionCall %void %main_inner %22
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.dxc.hlsl
index 97e8269..046ad14 100644
--- a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.dxc.hlsl
@@ -21,6 +21,7 @@
void main_inner(float x) {
tint_ftoi(x);
do {
+ float tint_phony = ddx(1.0f);
} while (false);
}
diff --git a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.fxc.hlsl
index 97e8269..046ad14 100644
--- a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.fxc.hlsl
@@ -21,6 +21,7 @@
void main_inner(float x) {
tint_ftoi(x);
do {
+ float tint_phony = ddx(1.0f);
} while (false);
}
diff --git a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.glsl
index 0cf09db..c4b9fd5 100644
--- a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.glsl
@@ -22,6 +22,7 @@
void tint_symbol(float x) {
switch(tint_ftoi(x)) {
default: {
+ float tint_phony = dFdx(1.0f);
break;
}
}
diff --git a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.msl
index 164c3f5..b80a1db 100644
--- a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.msl
@@ -24,6 +24,7 @@
void tint_symbol_inner(float x) {
switch(tint_ftoi(x)) {
default: {
+ float const tint_phony = dfdx(1.0f);
break;
}
}
diff --git a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.spvasm
index 6649b62..1a6b511 100644
--- a/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/switch_body_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 32
+; Bound: 34
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -38,7 +38,8 @@
%int_2147483647 = OpConstant %int 2147483647
%void = OpTypeVoid
%19 = OpTypeFunction %void %float
- %27 = OpTypeFunction %void
+ %float_1 = OpConstant %float 1
+ %29 = OpTypeFunction %void
%tint_ftoi = OpFunction %int None %4
%v = OpFunctionParameter %float
%8 = OpLabel
@@ -56,13 +57,14 @@
OpSelectionMerge %24 None
OpSwitch %25 %26
%26 = OpLabel
+ %27 = OpDPdx %float %float_1
OpBranch %24
%24 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %27
- %29 = OpLabel
- %31 = OpLoad %float %x_1
- %30 = OpFunctionCall %void %main_inner %31
+ %main = OpFunction %void None %29
+ %31 = OpLabel
+ %33 = OpLoad %float %x_1
+ %32 = OpFunctionCall %void %main_inner %33
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.dxc.hlsl
index d8caf58..c417607 100644
--- a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.dxc.hlsl
@@ -13,16 +13,21 @@
Texture2D<float4> t : register(t1);
SamplerState s : register(s2);
-struct tint_symbol_1 {
+struct tint_symbol_3 {
float x : TEXCOORD0;
};
void main_inner(float x) {
+ bool tint_symbol = (x == 0.0f);
+ if (tint_symbol) {
+ float tint_symbol_1 = ddx(1.0f);
+ tint_symbol = (tint_symbol_1 == 0.0f);
+ }
do {
} while (false);
}
-void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.x);
+void main(tint_symbol_3 tint_symbol_2) {
+ main_inner(tint_symbol_2.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.fxc.hlsl
index d8caf58..c417607 100644
--- a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.fxc.hlsl
@@ -13,16 +13,21 @@
Texture2D<float4> t : register(t1);
SamplerState s : register(s2);
-struct tint_symbol_1 {
+struct tint_symbol_3 {
float x : TEXCOORD0;
};
void main_inner(float x) {
+ bool tint_symbol = (x == 0.0f);
+ if (tint_symbol) {
+ float tint_symbol_1 = ddx(1.0f);
+ tint_symbol = (tint_symbol_1 == 0.0f);
+ }
do {
} while (false);
}
-void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.x);
+void main(tint_symbol_3 tint_symbol_2) {
+ main_inner(tint_symbol_2.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.glsl
index 03384d3..c74117a 100644
--- a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.glsl
@@ -16,11 +16,12 @@
layout(location = 0) in float x_1;
void tint_symbol(float x) {
- bool tint_tmp = (x == 0.0f);
- if (tint_tmp) {
- tint_tmp = (dFdx(1.0f) == 0.0f);
+ bool tint_symbol_1 = (x == 0.0f);
+ if (tint_symbol_1) {
+ float tint_symbol_2 = dFdx(1.0f);
+ tint_symbol_1 = (tint_symbol_2 == 0.0f);
}
- switch(int((tint_tmp))) {
+ switch(int(tint_symbol_1)) {
default: {
break;
}
diff --git a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.msl
index a0e4688..bfe39bb 100644
--- a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.msl
@@ -13,20 +13,25 @@
#include <metal_stdlib>
using namespace metal;
-struct tint_symbol_2 {
+struct tint_symbol_4 {
float x [[user(locn0)]];
};
void tint_symbol_inner(float x) {
- switch(int(((x == 0.0f) && (dfdx(1.0f) == 0.0f)))) {
+ bool tint_symbol_1 = (x == 0.0f);
+ if (tint_symbol_1) {
+ float const tint_symbol_2 = dfdx(1.0f);
+ tint_symbol_1 = (tint_symbol_2 == 0.0f);
+ }
+ switch(int(tint_symbol_1)) {
default: {
break;
}
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(tint_symbol_4 tint_symbol_3 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_3.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.spvasm
index 9de664b..e3d5f92 100644
--- a/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/switch_statement_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 35
+; Bound: 39
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -24,6 +24,7 @@
OpName %s "s"
OpName %main_inner "main_inner"
OpName %x "x"
+ OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %x_1 Location 0
OpDecorate %t DescriptorSet 0
@@ -41,36 +42,42 @@
%s = OpVariable %_ptr_UniformConstant_9 UniformConstant
%void = OpTypeVoid
%10 = OpTypeFunction %void %float
- %int = OpTypeInt 32 1
- %18 = OpConstantNull %float
+ %15 = OpConstantNull %float
%bool = OpTypeBool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %20 = OpConstantNull %bool
%float_1 = OpConstant %float 1
+ %int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%int_1 = OpConstant %int 1
- %30 = OpTypeFunction %void
+ %34 = OpTypeFunction %void
%main_inner = OpFunction %void None %10
%x = OpFunctionParameter %float
%14 = OpLabel
- %19 = OpFOrdEqual %bool %x %18
- OpSelectionMerge %21 None
- OpBranchConditional %19 %22 %21
+%tint_symbol = OpVariable %_ptr_Function_bool Function %20
+ %16 = OpFOrdEqual %bool %x %15
+ OpStore %tint_symbol %16
+ %21 = OpLoad %bool %tint_symbol
+ OpSelectionMerge %22 None
+ OpBranchConditional %21 %23 %22
+ %23 = OpLabel
+ %24 = OpDPdx %float %float_1
+ %26 = OpFOrdEqual %bool %24 %15
+ OpStore %tint_symbol %26
+ OpBranch %22
%22 = OpLabel
- %23 = OpDPdx %float %float_1
- %25 = OpFOrdEqual %bool %23 %18
- OpBranch %21
- %21 = OpLabel
- %26 = OpPhi %bool %19 %14 %25 %22
- %16 = OpSelect %int %26 %int_1 %int_0
- OpSelectionMerge %15 None
- OpSwitch %16 %29
- %29 = OpLabel
- OpBranch %15
- %15 = OpLabel
+ %30 = OpLoad %bool %tint_symbol
+ %28 = OpSelect %int %30 %int_1 %int_0
+ OpSelectionMerge %27 None
+ OpSwitch %28 %33
+ %33 = OpLabel
+ OpBranch %27
+ %27 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %30
- %32 = OpLabel
- %34 = OpLoad %float %x_1
- %33 = OpFunctionCall %void %main_inner %34
+ %main = OpFunction %void None %34
+ %36 = OpLabel
+ %38 = OpLoad %float %x_1
+ %37 = OpFunctionCall %void %main_inner %38
OpReturn
OpFunctionEnd
diff --git a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.dxc.hlsl b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.dxc.hlsl
index f724471..02eafeb 100644
--- a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.dxc.hlsl
+++ b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.dxc.hlsl
@@ -10,22 +10,27 @@
while (x > 0.0 && dpdx(1.0) > 0.0) {
^^^^^^^^^
-struct tint_symbol_1 {
+struct tint_symbol_3 {
float x : TEXCOORD0;
};
void main_inner(float x) {
float4 v = (0.0f).xxxx;
while (true) {
- bool tint_tmp = (x > 0.0f);
- if (tint_tmp) {
- tint_tmp = (ddx(1.0f) > 0.0f);
+ bool tint_symbol = (x > 0.0f);
+ if (tint_symbol) {
+ float tint_symbol_1 = ddx(1.0f);
+ tint_symbol = (tint_symbol_1 > 0.0f);
}
- if (!((tint_tmp))) { break; }
+ if (!(tint_symbol)) {
+ break;
+ }
+ {
+ }
}
}
-void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.x);
+void main(tint_symbol_3 tint_symbol_2) {
+ main_inner(tint_symbol_2.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.fxc.hlsl b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.fxc.hlsl
index f724471..02eafeb 100644
--- a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.fxc.hlsl
+++ b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.fxc.hlsl
@@ -10,22 +10,27 @@
while (x > 0.0 && dpdx(1.0) > 0.0) {
^^^^^^^^^
-struct tint_symbol_1 {
+struct tint_symbol_3 {
float x : TEXCOORD0;
};
void main_inner(float x) {
float4 v = (0.0f).xxxx;
while (true) {
- bool tint_tmp = (x > 0.0f);
- if (tint_tmp) {
- tint_tmp = (ddx(1.0f) > 0.0f);
+ bool tint_symbol = (x > 0.0f);
+ if (tint_symbol) {
+ float tint_symbol_1 = ddx(1.0f);
+ tint_symbol = (tint_symbol_1 > 0.0f);
}
- if (!((tint_tmp))) { break; }
+ if (!(tint_symbol)) {
+ break;
+ }
+ {
+ }
}
}
-void main(tint_symbol_1 tint_symbol) {
- main_inner(tint_symbol.x);
+void main(tint_symbol_3 tint_symbol_2) {
+ main_inner(tint_symbol_2.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.glsl b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.glsl
index 2be490c..cf4f659 100644
--- a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.glsl
+++ b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.glsl
@@ -18,11 +18,16 @@
void tint_symbol(float x) {
vec4 v = vec4(0.0f);
while (true) {
- bool tint_tmp = (x > 0.0f);
- if (tint_tmp) {
- tint_tmp = (dFdx(1.0f) > 0.0f);
+ bool tint_symbol_1 = (x > 0.0f);
+ if (tint_symbol_1) {
+ float tint_symbol_2 = dFdx(1.0f);
+ tint_symbol_1 = (tint_symbol_2 > 0.0f);
}
- if (!((tint_tmp))) { break; }
+ if (!(tint_symbol_1)) {
+ break;
+ }
+ {
+ }
}
}
diff --git a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.msl b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.msl
index 686748f..67d0ba6 100644
--- a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.msl
+++ b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.msl
@@ -18,18 +18,28 @@
volatile bool VOLATILE_NAME = true; \
if (VOLATILE_NAME)
-struct tint_symbol_2 {
+struct tint_symbol_4 {
float x [[user(locn0)]];
};
void tint_symbol_inner(float x) {
float4 v = float4(0.0f);
- TINT_ISOLATE_UB(tint_volatile_true) while(((x > 0.0f) && (dfdx(1.0f) > 0.0f))) {
+ TINT_ISOLATE_UB(tint_volatile_true) while(true) {
+ bool tint_symbol_1 = (x > 0.0f);
+ if (tint_symbol_1) {
+ float const tint_symbol_2 = dfdx(1.0f);
+ tint_symbol_1 = (tint_symbol_2 > 0.0f);
+ }
+ if (!(tint_symbol_1)) {
+ break;
+ }
+ {
+ }
}
}
-fragment void tint_symbol(tint_symbol_2 tint_symbol_1 [[stage_in]]) {
- tint_symbol_inner(tint_symbol_1.x);
+fragment void tint_symbol(tint_symbol_4 tint_symbol_3 [[stage_in]]) {
+ tint_symbol_inner(tint_symbol_3.x);
return;
}
diff --git a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.spvasm b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.spvasm
index 523e3e9..b765834 100644
--- a/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.spvasm
+++ b/test/tint/diagnostic_filtering/while_loop_attribute.wgsl.expected.spvasm
@@ -13,7 +13,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
-; Bound: 34
+; Bound: 38
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -23,6 +23,7 @@
OpName %main_inner "main_inner"
OpName %x "x"
OpName %v "v"
+ OpName %tint_symbol "tint_symbol"
OpName %main "main"
OpDecorate %x_1 Location 0
%float = OpTypeFloat 32
@@ -33,44 +34,50 @@
%v4float = OpTypeVector %float 4
%10 = OpConstantNull %v4float
%_ptr_Function_v4float = OpTypePointer Function %v4float
- %18 = OpConstantNull %float
+ %17 = OpConstantNull %float
%bool = OpTypeBool
+%_ptr_Function_bool = OpTypePointer Function %bool
+ %22 = OpConstantNull %bool
%float_1 = OpConstant %float 1
- %29 = OpTypeFunction %void
+ %33 = OpTypeFunction %void
%main_inner = OpFunction %void None %4
%x = OpFunctionParameter %float
%8 = OpLabel
%v = OpVariable %_ptr_Function_v4float Function %10
+%tint_symbol = OpVariable %_ptr_Function_bool Function %22
OpStore %v %10
OpBranch %13
%13 = OpLabel
OpLoopMerge %14 %15 None
OpBranch %16
%16 = OpLabel
- %19 = OpFOrdGreaterThan %bool %x %18
- OpSelectionMerge %21 None
- OpBranchConditional %19 %22 %21
- %22 = OpLabel
- %23 = OpDPdx %float %float_1
- %25 = OpFOrdGreaterThan %bool %23 %18
- OpBranch %21
- %21 = OpLabel
- %26 = OpPhi %bool %19 %16 %25 %22
- %17 = OpLogicalNot %bool %26
- OpSelectionMerge %27 None
- OpBranchConditional %17 %28 %27
- %28 = OpLabel
+ %18 = OpFOrdGreaterThan %bool %x %17
+ OpStore %tint_symbol %18
+ %23 = OpLoad %bool %tint_symbol
+ OpSelectionMerge %24 None
+ OpBranchConditional %23 %25 %24
+ %25 = OpLabel
+ %26 = OpDPdx %float %float_1
+ %28 = OpFOrdGreaterThan %bool %26 %17
+ OpStore %tint_symbol %28
+ OpBranch %24
+ %24 = OpLabel
+ %30 = OpLoad %bool %tint_symbol
+ %29 = OpLogicalNot %bool %30
+ OpSelectionMerge %31 None
+ OpBranchConditional %29 %32 %31
+ %32 = OpLabel
OpBranch %14
- %27 = OpLabel
+ %31 = OpLabel
OpBranch %15
%15 = OpLabel
OpBranch %13
%14 = OpLabel
OpReturn
OpFunctionEnd
- %main = OpFunction %void None %29
- %31 = OpLabel
- %33 = OpLoad %float %x_1
- %32 = OpFunctionCall %void %main_inner %33
+ %main = OpFunction %void None %33
+ %35 = OpLabel
+ %37 = OpLoad %float %x_1
+ %36 = OpFunctionCall %void %main_inner %37
OpReturn
OpFunctionEnd
diff --git a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.dxc.hlsl b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.dxc.hlsl
index 4d11905..2552ae9 100644
--- a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.dxc.hlsl
+++ b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.dxc.hlsl
@@ -8,11 +8,11 @@
SamplerState s : register(s1);
RWByteAddressBuffer a : register(u2);
-struct tint_symbol_2 {
+struct tint_symbol_3 {
float tint_symbol : TEXCOORD0;
float2 coord : TEXCOORD1;
};
-struct tint_symbol_3 {
+struct tint_symbol_4 {
int value : SV_Target0;
};
@@ -27,7 +27,8 @@
if ((tint_symbol == 0.0f)) {
tint_discarded = true;
}
- int result = tint_ftoi(t.Sample(s, coord).x);
+ float4 tint_symbol_1 = t.Sample(s, coord);
+ int result = tint_ftoi(tint_symbol_1.x);
{
int i = 0;
while (true) {
@@ -38,20 +39,20 @@
result = (result + i);
}
{
- int tint_symbol_4 = 0;
+ int tint_symbol_5 = 0;
if (!(tint_discarded)) {
- tint_symbol_4 = aatomicAdd(0u, 1);
+ tint_symbol_5 = aatomicAdd(0u, 1);
}
- i = tint_symbol_4;
+ i = tint_symbol_5;
}
}
}
return result;
}
-tint_symbol_3 foo(tint_symbol_2 tint_symbol_1) {
- int inner_result = foo_inner(tint_symbol_1.tint_symbol, tint_symbol_1.coord);
- tint_symbol_3 wrapper_result = (tint_symbol_3)0;
+tint_symbol_4 foo(tint_symbol_3 tint_symbol_2) {
+ int inner_result = foo_inner(tint_symbol_2.tint_symbol, tint_symbol_2.coord);
+ tint_symbol_4 wrapper_result = (tint_symbol_4)0;
wrapper_result.value = inner_result;
if (tint_discarded) {
discard;
diff --git a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.fxc.hlsl b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.fxc.hlsl
index 4d11905..2552ae9 100644
--- a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.fxc.hlsl
+++ b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.fxc.hlsl
@@ -8,11 +8,11 @@
SamplerState s : register(s1);
RWByteAddressBuffer a : register(u2);
-struct tint_symbol_2 {
+struct tint_symbol_3 {
float tint_symbol : TEXCOORD0;
float2 coord : TEXCOORD1;
};
-struct tint_symbol_3 {
+struct tint_symbol_4 {
int value : SV_Target0;
};
@@ -27,7 +27,8 @@
if ((tint_symbol == 0.0f)) {
tint_discarded = true;
}
- int result = tint_ftoi(t.Sample(s, coord).x);
+ float4 tint_symbol_1 = t.Sample(s, coord);
+ int result = tint_ftoi(tint_symbol_1.x);
{
int i = 0;
while (true) {
@@ -38,20 +39,20 @@
result = (result + i);
}
{
- int tint_symbol_4 = 0;
+ int tint_symbol_5 = 0;
if (!(tint_discarded)) {
- tint_symbol_4 = aatomicAdd(0u, 1);
+ tint_symbol_5 = aatomicAdd(0u, 1);
}
- i = tint_symbol_4;
+ i = tint_symbol_5;
}
}
}
return result;
}
-tint_symbol_3 foo(tint_symbol_2 tint_symbol_1) {
- int inner_result = foo_inner(tint_symbol_1.tint_symbol, tint_symbol_1.coord);
- tint_symbol_3 wrapper_result = (tint_symbol_3)0;
+tint_symbol_4 foo(tint_symbol_3 tint_symbol_2) {
+ int inner_result = foo_inner(tint_symbol_2.tint_symbol, tint_symbol_2.coord);
+ tint_symbol_4 wrapper_result = (tint_symbol_4)0;
wrapper_result.value = inner_result;
if (tint_discarded) {
discard;
diff --git a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.glsl b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.glsl
index acdd613..fc8af4a 100644
--- a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.glsl
+++ b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.glsl
@@ -3,7 +3,7 @@
precision highp int;
bool tint_discarded = false;
-layout(location = 0) in float tint_symbol_1;
+layout(location = 0) in float tint_symbol_2;
layout(location = 1) in vec2 coord_1;
layout(location = 0) out int value;
int tint_ftoi(float v) {
@@ -20,7 +20,8 @@
if ((tint_symbol == 0.0f)) {
tint_discarded = true;
}
- int result = tint_ftoi(texture(t_s, coord).x);
+ vec4 tint_symbol_1 = texture(t_s, coord);
+ int result = tint_ftoi(tint_symbol_1.x);
{
int i = 0;
while (true) {
@@ -31,11 +32,11 @@
result = (result + i);
}
{
- int tint_symbol_2 = 0;
+ int tint_symbol_3 = 0;
if (!(tint_discarded)) {
- tint_symbol_2 = atomicAdd(a.inner, 1);
+ tint_symbol_3 = atomicAdd(a.inner, 1);
}
- i = tint_symbol_2;
+ i = tint_symbol_3;
}
}
}
@@ -43,7 +44,7 @@
}
void main() {
- int inner_result = foo(tint_symbol_1, coord_1);
+ int inner_result = foo(tint_symbol_2, coord_1);
value = inner_result;
if (tint_discarded) {
discard;
diff --git a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.msl b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.msl
index 75776fc..c1ac153 100644
--- a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.msl
+++ b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.msl
@@ -14,20 +14,21 @@
return select(2147483647, select(int(v), (-2147483647 - 1), (v < -2147483648.0f)), (v < 2147483520.0f));
}
-struct tint_symbol_1 {
+struct tint_symbol_2 {
float in [[user(locn0)]];
float2 coord [[user(locn1)]];
};
-struct tint_symbol_2 {
+struct tint_symbol_3 {
int value [[color(0)]];
};
-int foo_inner(float in, float2 coord, thread tint_private_vars_struct* const tint_private_vars, texture2d<float, access::sample> tint_symbol_4, sampler tint_symbol_5, device atomic_int* const tint_symbol_6) {
+int foo_inner(float in, float2 coord, thread tint_private_vars_struct* const tint_private_vars, texture2d<float, access::sample> tint_symbol_5, sampler tint_symbol_6, device atomic_int* const tint_symbol_7) {
if ((in == 0.0f)) {
(*(tint_private_vars)).tint_discarded = true;
}
- int result = tint_ftoi(tint_symbol_4.sample(tint_symbol_5, coord)[0]);
+ float4 const tint_symbol = tint_symbol_5.sample(tint_symbol_6, coord);
+ int result = tint_ftoi(tint_symbol[0]);
{
int i = 0;
TINT_ISOLATE_UB(tint_volatile_true) while(true) {
@@ -38,22 +39,22 @@
result = as_type<int>((as_type<uint>(result) + as_type<uint>(i)));
}
{
- int tint_symbol_3 = 0;
+ int tint_symbol_4 = 0;
if (!((*(tint_private_vars)).tint_discarded)) {
- tint_symbol_3 = atomic_fetch_add_explicit(tint_symbol_6, 1, memory_order_relaxed);
+ tint_symbol_4 = atomic_fetch_add_explicit(tint_symbol_7, 1, memory_order_relaxed);
}
- i = tint_symbol_3;
+ i = tint_symbol_4;
}
}
}
return result;
}
-fragment tint_symbol_2 foo(texture2d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]], device atomic_int* tint_symbol_9 [[buffer(0)]], tint_symbol_1 tint_symbol [[stage_in]]) {
+fragment tint_symbol_3 foo(texture2d<float, access::sample> tint_symbol_8 [[texture(0)]], sampler tint_symbol_9 [[sampler(0)]], device atomic_int* tint_symbol_10 [[buffer(0)]], tint_symbol_2 tint_symbol_1 [[stage_in]]) {
thread tint_private_vars_struct tint_private_vars = {};
tint_private_vars.tint_discarded = false;
- int const inner_result = foo_inner(tint_symbol.in, tint_symbol.coord, &(tint_private_vars), tint_symbol_7, tint_symbol_8, tint_symbol_9);
- tint_symbol_2 wrapper_result = {};
+ int const inner_result = foo_inner(tint_symbol_1.in, tint_symbol_1.coord, &(tint_private_vars), tint_symbol_8, tint_symbol_9, tint_symbol_10);
+ tint_symbol_3 wrapper_result = {};
wrapper_result.value = inner_result;
if (tint_private_vars.tint_discarded) {
discard_fragment();
diff --git a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.spvasm b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.spvasm
index 7aca938..354114a 100644
--- a/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.spvasm
+++ b/test/tint/statements/discard/atomic_in_for_loop_continuing.wgsl.expected.spvasm
@@ -23,7 +23,7 @@
OpName %coord "coord"
OpName %result "result"
OpName %i "i"
- OpName %tint_symbol "tint_symbol"
+ OpName %tint_symbol_1 "tint_symbol_1"
OpName %foo "foo"
OpDecorate %in_1 Location 0
OpDecorate %coord_1 Location 1
@@ -68,7 +68,7 @@
%42 = OpConstantNull %float
%true = OpConstantTrue %bool
%v4float = OpTypeVector %float 4
- %52 = OpTypeSampledImage %17
+ %51 = OpTypeSampledImage %17
%_ptr_Function_int = OpTypePointer Function %int
%int_10 = OpConstant %int 10
%uint = OpTypeInt 32 0
@@ -94,7 +94,7 @@
%41 = OpLabel
%result = OpVariable %_ptr_Function_int Function %14
%i = OpVariable %_ptr_Function_int Function %14
-%tint_symbol = OpVariable %_ptr_Function_int Function %14
+%tint_symbol_1 = OpVariable %_ptr_Function_int Function %14
%43 = OpFOrdEqual %bool %in %42
OpSelectionMerge %44 None
OpBranchConditional %43 %45 %44
@@ -102,13 +102,13 @@
OpStore %tint_discarded %true
OpBranch %44
%44 = OpLabel
- %50 = OpLoad %20 %s
- %51 = OpLoad %17 %t
- %53 = OpSampledImage %52 %51 %50
- %48 = OpImageSampleImplicitLod %v4float %53 %coord
- %54 = OpCompositeExtract %float %48 0
- %47 = OpFunctionCall %int %tint_ftoi %54
- OpStore %result %47
+ %49 = OpLoad %20 %s
+ %50 = OpLoad %17 %t
+ %52 = OpSampledImage %51 %50 %49
+ %47 = OpImageSampleImplicitLod %v4float %52 %coord
+ %54 = OpCompositeExtract %float %47 0
+ %53 = OpFunctionCall %int %tint_ftoi %54
+ OpStore %result %53
OpStore %i %14
OpBranch %58
%58 = OpLabel
@@ -136,10 +136,10 @@
%75 = OpLabel
%82 = OpAccessChain %_ptr_StorageBuffer_int %a %uint_0
%76 = OpAtomicIAdd %int %82 %uint_1 %uint_0 %int_1
- OpStore %tint_symbol %76
+ OpStore %tint_symbol_1 %76
OpBranch %74
%74 = OpLabel
- %84 = OpLoad %int %tint_symbol
+ %84 = OpLoad %int %tint_symbol_1
OpStore %i %84
OpBranch %58
%59 = OpLabel
diff --git a/test/tint/statements/discard/helper_functions.wgsl.expected.dxc.hlsl b/test/tint/statements/discard/helper_functions.wgsl.expected.dxc.hlsl
index 73c10ec..5953270 100644
--- a/test/tint/statements/discard/helper_functions.wgsl.expected.dxc.hlsl
+++ b/test/tint/statements/discard/helper_functions.wgsl.expected.dxc.hlsl
@@ -9,8 +9,9 @@
}
void bar() {
+ float tint_symbol = ddx(1.0f);
if (!(tint_discarded)) {
- output.Store(0u, asuint(ddx(1.0f)));
+ output.Store(0u, asuint(tint_symbol));
}
}
diff --git a/test/tint/statements/discard/helper_functions.wgsl.expected.fxc.hlsl b/test/tint/statements/discard/helper_functions.wgsl.expected.fxc.hlsl
index 73c10ec..5953270 100644
--- a/test/tint/statements/discard/helper_functions.wgsl.expected.fxc.hlsl
+++ b/test/tint/statements/discard/helper_functions.wgsl.expected.fxc.hlsl
@@ -9,8 +9,9 @@
}
void bar() {
+ float tint_symbol = ddx(1.0f);
if (!(tint_discarded)) {
- output.Store(0u, asuint(ddx(1.0f)));
+ output.Store(0u, asuint(tint_symbol));
}
}
diff --git a/test/tint/statements/discard/helper_functions.wgsl.expected.glsl b/test/tint/statements/discard/helper_functions.wgsl.expected.glsl
index 356f56a..01b01f7 100644
--- a/test/tint/statements/discard/helper_functions.wgsl.expected.glsl
+++ b/test/tint/statements/discard/helper_functions.wgsl.expected.glsl
@@ -18,8 +18,9 @@
}
void bar() {
+ float tint_symbol_2 = dFdx(1.0f);
if (!(tint_discarded)) {
- tint_symbol.inner = dFdx(1.0f);
+ tint_symbol.inner = tint_symbol_2;
}
}
diff --git a/test/tint/statements/discard/helper_functions.wgsl.expected.msl b/test/tint/statements/discard/helper_functions.wgsl.expected.msl
index 5fe7b84..4f6c8a4 100644
--- a/test/tint/statements/discard/helper_functions.wgsl.expected.msl
+++ b/test/tint/statements/discard/helper_functions.wgsl.expected.msl
@@ -5,23 +5,24 @@
bool tint_discarded;
};
-void foo(thread tint_private_vars_struct* const tint_private_vars, device int* const tint_symbol_1) {
- if ((*(tint_symbol_1) < 0)) {
+void foo(thread tint_private_vars_struct* const tint_private_vars, device int* const tint_symbol_2) {
+ if ((*(tint_symbol_2) < 0)) {
(*(tint_private_vars)).tint_discarded = true;
}
}
-void bar(thread tint_private_vars_struct* const tint_private_vars, device float* const tint_symbol_2) {
+void bar(thread tint_private_vars_struct* const tint_private_vars, device float* const tint_symbol_3) {
+ float const tint_symbol_1 = dfdx(1.0f);
if (!((*(tint_private_vars)).tint_discarded)) {
- *(tint_symbol_2) = dfdx(1.0f);
+ *(tint_symbol_3) = tint_symbol_1;
}
}
-fragment void tint_symbol(device int* tint_symbol_3 [[buffer(0)]], device float* tint_symbol_4 [[buffer(1)]]) {
+fragment void tint_symbol(device int* tint_symbol_4 [[buffer(0)]], device float* tint_symbol_5 [[buffer(1)]]) {
thread tint_private_vars_struct tint_private_vars = {};
tint_private_vars.tint_discarded = false;
- foo(&(tint_private_vars), tint_symbol_3);
- bar(&(tint_private_vars), tint_symbol_4);
+ foo(&(tint_private_vars), tint_symbol_4);
+ bar(&(tint_private_vars), tint_symbol_5);
if (tint_private_vars.tint_discarded) {
discard_fragment();
}
diff --git a/test/tint/statements/discard/helper_functions.wgsl.expected.spvasm b/test/tint/statements/discard/helper_functions.wgsl.expected.spvasm
index 9758c25..24c3f98 100644
--- a/test/tint/statements/discard/helper_functions.wgsl.expected.spvasm
+++ b/test/tint/statements/discard/helper_functions.wgsl.expected.spvasm
@@ -44,8 +44,8 @@
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%22 = OpConstantNull %int
%true = OpConstantTrue %bool
-%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%float_1 = OpConstant %float 1
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%foo = OpFunction %void None %13
%16 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer_int %non_uniform_global %uint_0
@@ -61,16 +61,16 @@
OpFunctionEnd
%bar = OpFunction %void None %13
%28 = OpLabel
- %30 = OpLoad %bool %tint_discarded
- %29 = OpLogicalNot %bool %30
- OpSelectionMerge %31 None
- OpBranchConditional %29 %32 %31
- %32 = OpLabel
- %34 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
- %35 = OpDPdx %float %float_1
- OpStore %34 %35
- OpBranch %31
- %31 = OpLabel
+ %29 = OpDPdx %float %float_1
+ %32 = OpLoad %bool %tint_discarded
+ %31 = OpLogicalNot %bool %32
+ OpSelectionMerge %33 None
+ OpBranchConditional %31 %34 %33
+ %34 = OpLabel
+ %36 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
+ OpStore %36 %29
+ OpBranch %33
+ %33 = OpLabel
OpReturn
OpFunctionEnd
%main = OpFunction %void None %13
diff --git a/test/tint/statements/discard/multiple_returns.wgsl.expected.dxc.hlsl b/test/tint/statements/discard/multiple_returns.wgsl.expected.dxc.hlsl
index 3c87268..da7c406 100644
--- a/test/tint/statements/discard/multiple_returns.wgsl.expected.dxc.hlsl
+++ b/test/tint/statements/discard/multiple_returns.wgsl.expected.dxc.hlsl
@@ -6,8 +6,9 @@
if ((asint(non_uniform_global.Load(0u)) < 0)) {
tint_discarded = true;
}
+ float tint_symbol = ddx(1.0f);
if (!(tint_discarded)) {
- output.Store(0u, asuint(ddx(1.0f)));
+ output.Store(0u, asuint(tint_symbol));
}
if ((asfloat(output.Load(0u)) < 0.0f)) {
int i = 0;
diff --git a/test/tint/statements/discard/multiple_returns.wgsl.expected.fxc.hlsl b/test/tint/statements/discard/multiple_returns.wgsl.expected.fxc.hlsl
index 3c87268..da7c406 100644
--- a/test/tint/statements/discard/multiple_returns.wgsl.expected.fxc.hlsl
+++ b/test/tint/statements/discard/multiple_returns.wgsl.expected.fxc.hlsl
@@ -6,8 +6,9 @@
if ((asint(non_uniform_global.Load(0u)) < 0)) {
tint_discarded = true;
}
+ float tint_symbol = ddx(1.0f);
if (!(tint_discarded)) {
- output.Store(0u, asuint(ddx(1.0f)));
+ output.Store(0u, asuint(tint_symbol));
}
if ((asfloat(output.Load(0u)) < 0.0f)) {
int i = 0;
diff --git a/test/tint/statements/discard/multiple_returns.wgsl.expected.glsl b/test/tint/statements/discard/multiple_returns.wgsl.expected.glsl
index 7772c6a..633ca80 100644
--- a/test/tint/statements/discard/multiple_returns.wgsl.expected.glsl
+++ b/test/tint/statements/discard/multiple_returns.wgsl.expected.glsl
@@ -15,8 +15,9 @@
if ((non_uniform_global.inner < 0)) {
tint_discarded = true;
}
+ float tint_symbol_2 = dFdx(1.0f);
if (!(tint_discarded)) {
- tint_symbol.inner = dFdx(1.0f);
+ tint_symbol.inner = tint_symbol_2;
}
if ((tint_symbol.inner < 0.0f)) {
int i = 0;
diff --git a/test/tint/statements/discard/multiple_returns.wgsl.expected.msl b/test/tint/statements/discard/multiple_returns.wgsl.expected.msl
index 281e9bb..6373d1b 100644
--- a/test/tint/statements/discard/multiple_returns.wgsl.expected.msl
+++ b/test/tint/statements/discard/multiple_returns.wgsl.expected.msl
@@ -10,21 +10,22 @@
bool tint_discarded;
};
-fragment void tint_symbol(device int* tint_symbol_1 [[buffer(0)]], device float* tint_symbol_2 [[buffer(1)]]) {
+fragment void tint_symbol(device int* tint_symbol_2 [[buffer(0)]], device float* tint_symbol_3 [[buffer(1)]]) {
thread tint_private_vars_struct tint_private_vars = {};
tint_private_vars.tint_discarded = false;
- if ((*(tint_symbol_1) < 0)) {
+ if ((*(tint_symbol_2) < 0)) {
tint_private_vars.tint_discarded = true;
}
+ float const tint_symbol_1 = dfdx(1.0f);
if (!(tint_private_vars.tint_discarded)) {
- *(tint_symbol_2) = dfdx(1.0f);
+ *(tint_symbol_3) = tint_symbol_1;
}
- if ((*(tint_symbol_2) < 0.0f)) {
+ if ((*(tint_symbol_3) < 0.0f)) {
int i = 0;
TINT_ISOLATE_UB(tint_volatile_true) while(true) {
- if ((*(tint_symbol_2) > float(i))) {
+ if ((*(tint_symbol_3) > float(i))) {
if (!(tint_private_vars.tint_discarded)) {
- *(tint_symbol_2) = float(i);
+ *(tint_symbol_3) = float(i);
}
if (tint_private_vars.tint_discarded) {
discard_fragment();
diff --git a/test/tint/statements/discard/multiple_returns.wgsl.expected.spvasm b/test/tint/statements/discard/multiple_returns.wgsl.expected.spvasm
index 6e83367..9eed8e2 100644
--- a/test/tint/statements/discard/multiple_returns.wgsl.expected.spvasm
+++ b/test/tint/statements/discard/multiple_returns.wgsl.expected.spvasm
@@ -43,8 +43,8 @@
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%22 = OpConstantNull %int
%true = OpConstantTrue %bool
-%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%float_1 = OpConstant %float 1
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%37 = OpConstantNull %float
%_ptr_Function_int = OpTypePointer Function %int
%int_1 = OpConstant %int 1
@@ -61,16 +61,16 @@
OpStore %tint_discarded %true
OpBranch %24
%24 = OpLabel
- %28 = OpLoad %bool %tint_discarded
- %27 = OpLogicalNot %bool %28
- OpSelectionMerge %29 None
- OpBranchConditional %27 %30 %29
- %30 = OpLabel
- %32 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
- %33 = OpDPdx %float %float_1
- OpStore %32 %33
- OpBranch %29
- %29 = OpLabel
+ %27 = OpDPdx %float %float_1
+ %30 = OpLoad %bool %tint_discarded
+ %29 = OpLogicalNot %bool %30
+ OpSelectionMerge %31 None
+ OpBranchConditional %29 %32 %31
+ %32 = OpLabel
+ %34 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
+ OpStore %34 %27
+ OpBranch %31
+ %31 = OpLabel
%35 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
%36 = OpLoad %float %35
%38 = OpFOrdLessThan %bool %36 %37
diff --git a/test/tint/statements/discard/non_uniform.wgsl.expected.dxc.hlsl b/test/tint/statements/discard/non_uniform.wgsl.expected.dxc.hlsl
index 57ecc37..b3afbb5 100644
--- a/test/tint/statements/discard/non_uniform.wgsl.expected.dxc.hlsl
+++ b/test/tint/statements/discard/non_uniform.wgsl.expected.dxc.hlsl
@@ -6,8 +6,9 @@
if ((asint(non_uniform_global.Load(0u)) < 0)) {
tint_discarded = true;
}
+ float tint_symbol = ddx(1.0f);
if (!(tint_discarded)) {
- output.Store(0u, asuint(ddx(1.0f)));
+ output.Store(0u, asuint(tint_symbol));
}
if (tint_discarded) {
discard;
diff --git a/test/tint/statements/discard/non_uniform.wgsl.expected.fxc.hlsl b/test/tint/statements/discard/non_uniform.wgsl.expected.fxc.hlsl
index 57ecc37..b3afbb5 100644
--- a/test/tint/statements/discard/non_uniform.wgsl.expected.fxc.hlsl
+++ b/test/tint/statements/discard/non_uniform.wgsl.expected.fxc.hlsl
@@ -6,8 +6,9 @@
if ((asint(non_uniform_global.Load(0u)) < 0)) {
tint_discarded = true;
}
+ float tint_symbol = ddx(1.0f);
if (!(tint_discarded)) {
- output.Store(0u, asuint(ddx(1.0f)));
+ output.Store(0u, asuint(tint_symbol));
}
if (tint_discarded) {
discard;
diff --git a/test/tint/statements/discard/non_uniform.wgsl.expected.glsl b/test/tint/statements/discard/non_uniform.wgsl.expected.glsl
index 6acd4e0..d9a0a13 100644
--- a/test/tint/statements/discard/non_uniform.wgsl.expected.glsl
+++ b/test/tint/statements/discard/non_uniform.wgsl.expected.glsl
@@ -15,8 +15,9 @@
if ((non_uniform_global.inner < 0)) {
tint_discarded = true;
}
+ float tint_symbol_2 = dFdx(1.0f);
if (!(tint_discarded)) {
- tint_symbol.inner = dFdx(1.0f);
+ tint_symbol.inner = tint_symbol_2;
}
}
diff --git a/test/tint/statements/discard/non_uniform.wgsl.expected.msl b/test/tint/statements/discard/non_uniform.wgsl.expected.msl
index d069100..1d5de8d 100644
--- a/test/tint/statements/discard/non_uniform.wgsl.expected.msl
+++ b/test/tint/statements/discard/non_uniform.wgsl.expected.msl
@@ -5,14 +5,15 @@
bool tint_discarded;
};
-fragment void tint_symbol(device int* tint_symbol_1 [[buffer(0)]], device float* tint_symbol_2 [[buffer(1)]]) {
+fragment void tint_symbol(device int* tint_symbol_2 [[buffer(0)]], device float* tint_symbol_3 [[buffer(1)]]) {
thread tint_private_vars_struct tint_private_vars = {};
tint_private_vars.tint_discarded = false;
- if ((*(tint_symbol_1) < 0)) {
+ if ((*(tint_symbol_2) < 0)) {
tint_private_vars.tint_discarded = true;
}
+ float const tint_symbol_1 = dfdx(1.0f);
if (!(tint_private_vars.tint_discarded)) {
- *(tint_symbol_2) = dfdx(1.0f);
+ *(tint_symbol_3) = tint_symbol_1;
}
if (tint_private_vars.tint_discarded) {
discard_fragment();
diff --git a/test/tint/statements/discard/non_uniform.wgsl.expected.spvasm b/test/tint/statements/discard/non_uniform.wgsl.expected.spvasm
index a023542..d9daba9 100644
--- a/test/tint/statements/discard/non_uniform.wgsl.expected.spvasm
+++ b/test/tint/statements/discard/non_uniform.wgsl.expected.spvasm
@@ -42,8 +42,8 @@
%_ptr_StorageBuffer_int = OpTypePointer StorageBuffer %int
%22 = OpConstantNull %int
%true = OpConstantTrue %bool
-%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%float_1 = OpConstant %float 1
+%_ptr_StorageBuffer_float = OpTypePointer StorageBuffer %float
%main = OpFunction %void None %13
%16 = OpLabel
%20 = OpAccessChain %_ptr_StorageBuffer_int %non_uniform_global %uint_0
@@ -55,16 +55,16 @@
OpStore %tint_discarded %true
OpBranch %24
%24 = OpLabel
- %28 = OpLoad %bool %tint_discarded
- %27 = OpLogicalNot %bool %28
- OpSelectionMerge %29 None
- OpBranchConditional %27 %30 %29
- %30 = OpLabel
- %32 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
- %33 = OpDPdx %float %float_1
- OpStore %32 %33
- OpBranch %29
- %29 = OpLabel
+ %27 = OpDPdx %float %float_1
+ %30 = OpLoad %bool %tint_discarded
+ %29 = OpLogicalNot %bool %30
+ OpSelectionMerge %31 None
+ OpBranchConditional %29 %32 %31
+ %32 = OpLabel
+ %34 = OpAccessChain %_ptr_StorageBuffer_float %output %uint_0
+ OpStore %34 %27
+ OpBranch %31
+ %31 = OpLabel
%35 = OpLoad %bool %tint_discarded
OpSelectionMerge %36 None
OpBranchConditional %35 %37 %36