[glsl][ir] Polyfill `textureSampleCompareLevel`

This Cl replaces the WGSL `textureSampleCompareLevel` call with the
needed GLSL polyfill.

Bug: 42251044
Change-Id: Idf3b920aaaa427742d9b6f51daccb2c30060182a
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/209537
Commit-Queue: dan sinclair <dsinclair@chromium.org>
Reviewed-by: James Price <jrprice@google.com>
diff --git a/src/tint/lang/glsl/writer/builtin_test.cc b/src/tint/lang/glsl/writer/builtin_test.cc
index 67aaf4f..f0b8030 100644
--- a/src/tint/lang/glsl/writer/builtin_test.cc
+++ b/src/tint/lang/glsl/writer/builtin_test.cc
@@ -4028,5 +4028,227 @@
 )");
 }
 
+TEST_F(GlslWriterTest, BuiltinTextureSampleCompareLevel_2d) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(
+            ty.ptr(handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::k2d)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec2<f32>(), b.Value(1_f), b.Value(2_f));
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, 3_f));
+        b.Return(func);
+    });
+
+    ASSERT_TRUE(Generate()) << err_ << output_.glsl;
+    EXPECT_EQ(output_.glsl, GlslHeader() + R"(precision highp float;
+precision highp int;
+
+uniform highp sampler2DShadow t_s;
+void main() {
+  float x = texture(t_s, vec3(vec2(1.0f, 2.0f), 3.0f));
+}
+)");
+}
+
+TEST_F(GlslWriterTest, BuiltinTextureSampleCompareLevel_2d_Offset) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(
+            ty.ptr(handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::k2d)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec2<f32>(), b.Value(1_f), b.Value(2_f));
+        auto* offset = b.Composite<vec2<i32>>(4_i, 5_i);
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x",
+              b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, 3_f, offset));
+        b.Return(func);
+    });
+
+    ASSERT_TRUE(Generate()) << err_ << output_.glsl;
+    EXPECT_EQ(output_.glsl, GlslHeader() + R"(precision highp float;
+precision highp int;
+
+uniform highp sampler2DShadow t_s;
+void main() {
+  float x = textureOffset(t_s, vec3(vec2(1.0f, 2.0f), 3.0f), ivec2(4, 5));
+}
+)");
+}
+
+TEST_F(GlslWriterTest, BuiltinTextureSampleCompareLevel_2d_Array) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(ty.ptr(
+            handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::k2dArray)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec2<f32>(), b.Value(1_f), b.Value(2_f));
+        auto* array_idx = b.Value(4_u);
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, array_idx,
+                               3_f));
+        b.Return(func);
+    });
+
+    ASSERT_TRUE(Generate()) << err_ << output_.glsl;
+    EXPECT_EQ(output_.glsl, GlslHeader() + R"(precision highp float;
+precision highp int;
+
+uniform highp sampler2DArrayShadow t_s;
+void main() {
+  vec2 v = vec2(1.0f, 2.0f);
+  float x = texture(t_s, vec4(v, float(4u), 3.0f));
+}
+)");
+}
+
+TEST_F(GlslWriterTest, BuiltinTextureSampleCompareLevel_2d_Array_Offset) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(ty.ptr(
+            handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::k2dArray)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec2<f32>(), b.Value(1_f), b.Value(2_f));
+        auto* array_idx = b.Value(4_u);
+        auto* offset = b.Composite<vec2<i32>>(4_i, 5_i);
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, array_idx,
+                               3_f, offset));
+        b.Return(func);
+    });
+
+    Options opts{};
+    opts.version = Version(Version::Standard::kDesktop, 4, 6);
+    ASSERT_TRUE(Generate(opts)) << err_ << output_.glsl;
+    EXPECT_EQ(output_.glsl, R"(#version 460
+precision highp float;
+precision highp int;
+
+uniform highp sampler2DArrayShadow t_s;
+void main() {
+  vec2 v = vec2(1.0f, 2.0f);
+  float x = textureOffset(t_s, vec4(v, float(4u), 3.0f), ivec2(4, 5));
+}
+)");
+}
+
+TEST_F(GlslWriterTest, BuiltinTextureSampleCompareLevel_Cube) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(
+            ty.ptr(handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::kCube)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec3<f32>(), b.Value(1_f), b.Value(2_f), b.Value(3_f));
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, 3_f));
+        b.Return(func);
+    });
+
+    ASSERT_TRUE(Generate()) << err_ << output_.glsl;
+    EXPECT_EQ(output_.glsl, GlslHeader() + R"(precision highp float;
+precision highp int;
+
+uniform highp samplerCubeShadow t_s;
+void main() {
+  float x = texture(t_s, vec4(vec3(1.0f, 2.0f, 3.0f), 3.0f));
+}
+)");
+}
+
+TEST_F(GlslWriterTest, BuiltinTextureSampleCompareLevel_Cube_Array) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(ty.ptr(
+            handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::kCubeArray)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec3<f32>(), b.Value(1_f), b.Value(2_f), b.Value(3_f));
+        auto* array_idx = b.Value(4_u);
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, array_idx,
+                               3_f));
+        b.Return(func);
+    });
+
+    Options opts{};
+    opts.version = Version(Version::Standard::kDesktop, 4, 6);
+    ASSERT_TRUE(Generate(opts)) << err_ << output_.glsl;
+    EXPECT_EQ(output_.glsl, R"(#version 460
+precision highp float;
+precision highp int;
+
+uniform highp samplerCubeArrayShadow t_s;
+void main() {
+  vec3 v = vec3(1.0f, 2.0f, 3.0f);
+  float x = texture(t_s, vec4(v, float(4u)), 3.0f);
+}
+)");
+}
+
 }  // namespace
 }  // namespace tint::glsl::writer
diff --git a/src/tint/lang/glsl/writer/raise/texture_polyfill.cc b/src/tint/lang/glsl/writer/raise/texture_polyfill.cc
index 0c7a821..8f69170 100644
--- a/src/tint/lang/glsl/writer/raise/texture_polyfill.cc
+++ b/src/tint/lang/glsl/writer/raise/texture_polyfill.cc
@@ -141,6 +141,9 @@
                 case core::BuiltinFn::kTextureSampleCompare:
                     TextureSampleCompare(call);
                     break;
+                case core::BuiltinFn::kTextureSampleCompareLevel:
+                    TextureSampleCompareLevel(call);
+                    break;
                 case core::BuiltinFn::kTextureSampleGrad:
                     TextureSampleGrad(call);
                     break;
@@ -150,9 +153,8 @@
                 case core::BuiltinFn::kTextureStore:
                     TextureStore(call);
                     break;
-                case core::BuiltinFn::kTextureSampleCompareLevel:
                 default:
-                    TINT_UNREACHABLE() << "TODO(dsinclair): " << call->Func();
+                    TINT_UNREACHABLE() << call->Func();
             }
         }
 
@@ -1100,6 +1102,62 @@
         });
         call->Destroy();
     }
+
+    void TextureSampleCompareLevel(core::ir::BuiltinCall* call) {
+        auto args = call->Args();
+        b.InsertBefore(call, [&] {
+            Vector<core::ir::Value*, 4> params;
+
+            uint32_t idx = 0;
+            uint32_t tex_arg = idx++;
+            uint32_t sampler_arg = idx++;
+
+            auto* tex = GetNewTexture(args[tex_arg], args[sampler_arg]);
+            auto* tex_type = tex->Type()->As<core::type::Texture>();
+            TINT_ASSERT(tex_type);
+
+            params.Push(tex);
+
+            core::ir::Value* coords = args[idx++];
+            switch (tex_type->Dim()) {
+                case core::type::TextureDimension::k2d:
+                    coords = b.Construct(ty.vec3<f32>(), coords, args[idx++])->Result(0);
+                    params.Push(coords);
+
+                    break;
+                case core::type::TextureDimension::k2dArray: {
+                    Vector<core::ir::Value*, 3> new_coords;
+                    new_coords.Push(coords);
+                    new_coords.Push(b.Convert<f32>(args[idx++])->Result(0));
+                    new_coords.Push(b.Value(args[idx++]));
+
+                    params.Push(b.Construct(ty.vec4<f32>(), new_coords)->Result(0));
+                    break;
+                }
+                case core::type::TextureDimension::kCube:
+                    coords = b.Construct(ty.vec4<f32>(), coords, args[idx++])->Result(0);
+                    params.Push(coords);
+                    break;
+                case core::type::TextureDimension::kCubeArray:
+                    params.Push(b.Construct(ty.vec4<f32>(), coords, b.Convert<f32>(args[idx++]))
+                                    ->Result(0));
+
+                    params.Push(b.Value(args[idx++]));
+                    break;
+                default:
+                    TINT_UNREACHABLE();
+            }
+
+            auto fn = glsl::BuiltinFn::kTexture;
+            if (idx < args.Length()) {
+                fn = glsl::BuiltinFn::kTextureOffset;
+                params.Push(args[idx++]);
+            }
+
+            b.CallWithResult<glsl::ir::BuiltinCall>(call->DetachResult(), fn, params);
+        });
+        call->Destroy();
+    }
 };
 
 }  // namespace
diff --git a/src/tint/lang/glsl/writer/raise/texture_polyfill_test.cc b/src/tint/lang/glsl/writer/raise/texture_polyfill_test.cc
index 7bc6a18..a24eb77 100644
--- a/src/tint/lang/glsl/writer/raise/texture_polyfill_test.cc
+++ b/src/tint/lang/glsl/writer/raise/texture_polyfill_test.cc
@@ -5725,5 +5725,455 @@
     EXPECT_EQ(expect, str());
 }
 
+TEST_F(GlslWriter_TexturePolyfillTest, TextureSampleCompareLevel_2d) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(
+            ty.ptr(handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::k2d)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec2<f32>(), b.Value(1_f), b.Value(2_f));
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, 3_f));
+        b.Return(func);
+    });
+
+    auto* src = R"(
+$B1: {  # root
+  %1:ptr<handle, texture_depth_2d, read> = var @binding_point(0, 0)
+  %2:ptr<handle, sampler_comparison, read> = var @binding_point(0, 1)
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %4:vec2<f32> = construct 1.0f, 2.0f
+    %5:texture_depth_2d = load %1
+    %6:sampler_comparison = load %2
+    %7:f32 = textureSampleCompareLevel %5, %6, %4, 3.0f
+    %x:f32 = let %7
+    ret
+  }
+}
+)";
+    ASSERT_EQ(src, str());
+
+    auto* expect = R"(
+$B1: {  # root
+  %my_tex:ptr<handle, texture_depth_2d, read> = var
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %3:vec2<f32> = construct 1.0f, 2.0f
+    %4:texture_depth_2d = load %my_tex
+    %5:vec3<f32> = construct %3, 3.0f
+    %6:f32 = glsl.texture %4, %5
+    %x:f32 = let %6
+    ret
+  }
+}
+)";
+
+    capabilities = core::ir::Capabilities{core::ir::Capability::kAllowHandleVarsWithoutBindings};
+
+    TexturePolyfillConfig cfg;
+    cfg.placeholder_sampler_bind_point = {2, 2};
+
+    binding::CombinedTextureSamplerPair pair;
+    pair.texture = {0, 0};
+    pair.sampler = {0, 1};
+    cfg.sampler_texture_to_name[pair] = "my_tex";
+
+    Run(TexturePolyfill, cfg);
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(GlslWriter_TexturePolyfillTest, TextureSampleCompareLevel_2d_Offset) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(
+            ty.ptr(handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::k2d)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec2<f32>(), b.Value(1_f), b.Value(2_f));
+        auto* offset = b.Composite<vec2<i32>>(4_i, 5_i);
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x",
+              b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, 3_f, offset));
+        b.Return(func);
+    });
+
+    auto* src = R"(
+$B1: {  # root
+  %1:ptr<handle, texture_depth_2d, read> = var @binding_point(0, 0)
+  %2:ptr<handle, sampler_comparison, read> = var @binding_point(0, 1)
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %4:vec2<f32> = construct 1.0f, 2.0f
+    %5:texture_depth_2d = load %1
+    %6:sampler_comparison = load %2
+    %7:f32 = textureSampleCompareLevel %5, %6, %4, 3.0f, vec2<i32>(4i, 5i)
+    %x:f32 = let %7
+    ret
+  }
+}
+)";
+    ASSERT_EQ(src, str());
+
+    auto* expect = R"(
+$B1: {  # root
+  %my_tex:ptr<handle, texture_depth_2d, read> = var
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %3:vec2<f32> = construct 1.0f, 2.0f
+    %4:texture_depth_2d = load %my_tex
+    %5:vec3<f32> = construct %3, 3.0f
+    %6:f32 = glsl.textureOffset %4, %5, vec2<i32>(4i, 5i)
+    %x:f32 = let %6
+    ret
+  }
+}
+)";
+
+    capabilities = core::ir::Capabilities{core::ir::Capability::kAllowHandleVarsWithoutBindings};
+
+    TexturePolyfillConfig cfg;
+    cfg.placeholder_sampler_bind_point = {2, 2};
+
+    binding::CombinedTextureSamplerPair pair;
+    pair.texture = {0, 0};
+    pair.sampler = {0, 1};
+    cfg.sampler_texture_to_name[pair] = "my_tex";
+
+    Run(TexturePolyfill, cfg);
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(GlslWriter_TexturePolyfillTest, TextureSampleCompareLevel_2d_Array) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(ty.ptr(
+            handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::k2dArray)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec2<f32>(), b.Value(1_f), b.Value(2_f));
+        auto* array_idx = b.Value(4_u);
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, array_idx,
+                               3_f));
+        b.Return(func);
+    });
+
+    auto* src = R"(
+$B1: {  # root
+  %1:ptr<handle, texture_depth_2d_array, read> = var @binding_point(0, 0)
+  %2:ptr<handle, sampler_comparison, read> = var @binding_point(0, 1)
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %4:vec2<f32> = construct 1.0f, 2.0f
+    %5:texture_depth_2d_array = load %1
+    %6:sampler_comparison = load %2
+    %7:f32 = textureSampleCompareLevel %5, %6, %4, 4u, 3.0f
+    %x:f32 = let %7
+    ret
+  }
+}
+)";
+    ASSERT_EQ(src, str());
+
+    auto* expect = R"(
+$B1: {  # root
+  %my_tex:ptr<handle, texture_depth_2d_array, read> = var
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %3:vec2<f32> = construct 1.0f, 2.0f
+    %4:texture_depth_2d_array = load %my_tex
+    %5:f32 = convert 4u
+    %6:vec4<f32> = construct %3, %5, 3.0f
+    %7:f32 = glsl.texture %4, %6
+    %x:f32 = let %7
+    ret
+  }
+}
+)";
+
+    capabilities = core::ir::Capabilities{core::ir::Capability::kAllowHandleVarsWithoutBindings};
+
+    TexturePolyfillConfig cfg;
+    cfg.placeholder_sampler_bind_point = {2, 2};
+
+    binding::CombinedTextureSamplerPair pair;
+    pair.texture = {0, 0};
+    pair.sampler = {0, 1};
+    cfg.sampler_texture_to_name[pair] = "my_tex";
+
+    Run(TexturePolyfill, cfg);
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(GlslWriter_TexturePolyfillTest, TextureSampleCompareLevel_2d_Array_Offset) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(ty.ptr(
+            handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::k2dArray)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec2<f32>(), b.Value(1_f), b.Value(2_f));
+        auto* array_idx = b.Value(4_u);
+        auto* offset = b.Composite<vec2<i32>>(4_i, 5_i);
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, array_idx,
+                               3_f, offset));
+        b.Return(func);
+    });
+
+    auto* src = R"(
+$B1: {  # root
+  %1:ptr<handle, texture_depth_2d_array, read> = var @binding_point(0, 0)
+  %2:ptr<handle, sampler_comparison, read> = var @binding_point(0, 1)
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %4:vec2<f32> = construct 1.0f, 2.0f
+    %5:texture_depth_2d_array = load %1
+    %6:sampler_comparison = load %2
+    %7:f32 = textureSampleCompareLevel %5, %6, %4, 4u, 3.0f, vec2<i32>(4i, 5i)
+    %x:f32 = let %7
+    ret
+  }
+}
+)";
+    ASSERT_EQ(src, str());
+
+    auto* expect = R"(
+$B1: {  # root
+  %my_tex:ptr<handle, texture_depth_2d_array, read> = var
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %3:vec2<f32> = construct 1.0f, 2.0f
+    %4:texture_depth_2d_array = load %my_tex
+    %5:f32 = convert 4u
+    %6:vec4<f32> = construct %3, %5, 3.0f
+    %7:f32 = glsl.textureOffset %4, %6, vec2<i32>(4i, 5i)
+    %x:f32 = let %7
+    ret
+  }
+}
+)";
+
+    capabilities = core::ir::Capabilities{core::ir::Capability::kAllowHandleVarsWithoutBindings};
+
+    TexturePolyfillConfig cfg;
+    cfg.placeholder_sampler_bind_point = {2, 2};
+
+    binding::CombinedTextureSamplerPair pair;
+    pair.texture = {0, 0};
+    pair.sampler = {0, 1};
+    cfg.sampler_texture_to_name[pair] = "my_tex";
+
+    Run(TexturePolyfill, cfg);
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(GlslWriter_TexturePolyfillTest, TextureSampleCompareLevel_Cube) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(
+            ty.ptr(handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::kCube)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec3<f32>(), b.Value(1_f), b.Value(2_f), b.Value(3_f));
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, 3_f));
+        b.Return(func);
+    });
+
+    auto* src = R"(
+$B1: {  # root
+  %1:ptr<handle, texture_depth_cube, read> = var @binding_point(0, 0)
+  %2:ptr<handle, sampler_comparison, read> = var @binding_point(0, 1)
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %4:vec3<f32> = construct 1.0f, 2.0f, 3.0f
+    %5:texture_depth_cube = load %1
+    %6:sampler_comparison = load %2
+    %7:f32 = textureSampleCompareLevel %5, %6, %4, 3.0f
+    %x:f32 = let %7
+    ret
+  }
+}
+)";
+    ASSERT_EQ(src, str());
+
+    auto* expect = R"(
+$B1: {  # root
+  %my_tex:ptr<handle, texture_depth_cube, read> = var
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %3:vec3<f32> = construct 1.0f, 2.0f, 3.0f
+    %4:texture_depth_cube = load %my_tex
+    %5:vec4<f32> = construct %3, 3.0f
+    %6:f32 = glsl.texture %4, %5
+    %x:f32 = let %6
+    ret
+  }
+}
+)";
+
+    capabilities = core::ir::Capabilities{core::ir::Capability::kAllowHandleVarsWithoutBindings};
+
+    TexturePolyfillConfig cfg;
+    cfg.placeholder_sampler_bind_point = {2, 2};
+
+    binding::CombinedTextureSamplerPair pair;
+    pair.texture = {0, 0};
+    pair.sampler = {0, 1};
+    cfg.sampler_texture_to_name[pair] = "my_tex";
+
+    Run(TexturePolyfill, cfg);
+    EXPECT_EQ(expect, str());
+}
+
+TEST_F(GlslWriter_TexturePolyfillTest, TextureSampleCompareLevel_Cube_Array) {
+    core::ir::Var* tex = nullptr;
+    core::ir::Var* sampler = nullptr;
+    b.Append(b.ir.root_block, [&] {
+        tex = b.Var(ty.ptr(
+            handle, ty.Get<core::type::DepthTexture>(core::type::TextureDimension::kCubeArray)));
+        tex->SetBindingPoint(0, 0);
+
+        sampler = b.Var(ty.ptr(
+            handle, ty.Get<core::type::Sampler>(core::type::SamplerKind::kComparisonSampler)));
+        sampler->SetBindingPoint(0, 1);
+    });
+
+    auto* func = b.Function("foo", ty.void_(), core::ir::Function::PipelineStage::kFragment);
+    b.Append(func->Block(), [&] {
+        auto* coords = b.Construct(ty.vec3<f32>(), b.Value(1_f), b.Value(2_f), b.Value(3_f));
+        auto* array_idx = b.Value(4_u);
+
+        auto* t = b.Load(tex);
+        auto* s = b.Load(sampler);
+        b.Let("x", b.Call<f32>(core::BuiltinFn::kTextureSampleCompareLevel, t, s, coords, array_idx,
+                               3_f));
+        b.Return(func);
+    });
+
+    auto* src = R"(
+$B1: {  # root
+  %1:ptr<handle, texture_depth_cube_array, read> = var @binding_point(0, 0)
+  %2:ptr<handle, sampler_comparison, read> = var @binding_point(0, 1)
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %4:vec3<f32> = construct 1.0f, 2.0f, 3.0f
+    %5:texture_depth_cube_array = load %1
+    %6:sampler_comparison = load %2
+    %7:f32 = textureSampleCompareLevel %5, %6, %4, 4u, 3.0f
+    %x:f32 = let %7
+    ret
+  }
+}
+)";
+    ASSERT_EQ(src, str());
+
+    auto* expect = R"(
+$B1: {  # root
+  %my_tex:ptr<handle, texture_depth_cube_array, read> = var
+}
+
+%foo = @fragment func():void {
+  $B2: {
+    %3:vec3<f32> = construct 1.0f, 2.0f, 3.0f
+    %4:texture_depth_cube_array = load %my_tex
+    %5:f32 = convert 4u
+    %6:vec4<f32> = construct %3, %5
+    %7:f32 = glsl.texture %4, %6, 3.0f
+    %x:f32 = let %7
+    ret
+  }
+}
+)";
+
+    capabilities = core::ir::Capabilities{core::ir::Capability::kAllowHandleVarsWithoutBindings};
+
+    TexturePolyfillConfig cfg;
+    cfg.placeholder_sampler_bind_point = {2, 2};
+
+    binding::CombinedTextureSamplerPair pair;
+    pair.texture = {0, 0};
+    pair.sampler = {0, 1};
+    cfg.sampler_texture_to_name[pair] = "my_tex";
+
+    Run(TexturePolyfill, cfg);
+    EXPECT_EQ(expect, str());
+}
+
 }  // namespace
 }  // namespace tint::glsl::writer::raise
diff --git a/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl.expected.ir.glsl b/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl.expected.ir.glsl
deleted file mode 100644
index e159074..0000000
--- a/test/tint/benchmark/skinned-shadowed-pbr-fragment.wgsl.expected.ir.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-SKIP: FAILED
-
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
-
-tint executable returned error: signal: trace/BPT trap
diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.ir.glsl
index e159074..bb16db3 100644
--- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1116ed.wgsl.expected.ir.glsl
@@ -1,11 +1,59 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_1116ed() {
+  float res = texture(arg_0_arg_1, vec4(vec2(1.0f), float(1), 1.0f));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_1116ed();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_1116ed() {
+  float res = texture(arg_0_arg_1, vec4(vec2(1.0f), float(1), 1.0f));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_1116ed();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_1116ed() {
+  float res = texture(arg_0_arg_1, vec4(vec2(1.0f), float(1), 1.0f));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_1116ed();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.ir.glsl
index e159074..8a181dd 100644
--- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/1568e3.wgsl.expected.ir.glsl
@@ -1,11 +1,59 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeShadow arg_0_arg_1;
+float textureSampleCompareLevel_1568e3() {
+  float res = texture(arg_0_arg_1, vec4(vec3(1.0f), 1.0f));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_1568e3();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeShadow arg_0_arg_1;
+float textureSampleCompareLevel_1568e3() {
+  float res = texture(arg_0_arg_1, vec4(vec3(1.0f), 1.0f));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_1568e3();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_1568e3() {
+  float res = texture(arg_0_arg_1, vec4(vec3(1.0f), 1.0f));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_1568e3();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.ir.glsl
index e159074..7991dca 100644
--- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/2ad2b1.wgsl.expected.ir.glsl
@@ -1,11 +1,59 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DShadow arg_0_arg_1;
+float textureSampleCompareLevel_2ad2b1() {
+  float res = texture(arg_0_arg_1, vec3(vec2(1.0f), 1.0f));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_2ad2b1();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DShadow arg_0_arg_1;
+float textureSampleCompareLevel_2ad2b1() {
+  float res = texture(arg_0_arg_1, vec3(vec2(1.0f), 1.0f));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_2ad2b1();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp sampler2DShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_2ad2b1() {
+  float res = texture(arg_0_arg_1, vec3(vec2(1.0f), 1.0f));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_2ad2b1();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.ir.glsl
index e159074..19761ef 100644
--- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/4cf3a2.wgsl.expected.ir.glsl
@@ -1,11 +1,59 @@
-SKIP: FAILED
+#version 460
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_4cf3a2() {
+  float res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1)), 1.0f);
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_4cf3a2();
+}
+#version 460
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_4cf3a2() {
+  float res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1)), 1.0f);
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_4cf3a2();
+}
+#version 460
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_4cf3a2() {
+  float res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1)), 1.0f);
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_4cf3a2();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7dc3c0.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7dc3c0.wgsl.expected.ir.glsl
index e159074..be8716f 100644
--- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7dc3c0.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7dc3c0.wgsl.expected.ir.glsl
@@ -1,11 +1,59 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_7dc3c0() {
+  float res = texture(arg_0_arg_1, vec4(vec2(1.0f), float(1u), 1.0f));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_7dc3c0();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_7dc3c0() {
+  float res = texture(arg_0_arg_1, vec4(vec2(1.0f), float(1u), 1.0f));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_7dc3c0();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_7dc3c0() {
+  float res = texture(arg_0_arg_1, vec4(vec2(1.0f), float(1u), 1.0f));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_7dc3c0();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.ir.glsl
index e159074..2f95b3b 100644
--- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/7f2b9a.wgsl.expected.ir.glsl
@@ -1,11 +1,59 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DShadow arg_0_arg_1;
+float textureSampleCompareLevel_7f2b9a() {
+  float res = textureOffset(arg_0_arg_1, vec3(vec2(1.0f), 1.0f), ivec2(1));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_7f2b9a();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DShadow arg_0_arg_1;
+float textureSampleCompareLevel_7f2b9a() {
+  float res = textureOffset(arg_0_arg_1, vec3(vec2(1.0f), 1.0f), ivec2(1));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_7f2b9a();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp sampler2DShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_7f2b9a() {
+  float res = textureOffset(arg_0_arg_1, vec3(vec2(1.0f), 1.0f), ivec2(1));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_7f2b9a();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/literal/textureSampleCompareLevel/958c87.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleCompareLevel/958c87.wgsl.expected.ir.glsl
index e159074..da7d731 100644
--- a/test/tint/builtins/gen/literal/textureSampleCompareLevel/958c87.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleCompareLevel/958c87.wgsl.expected.ir.glsl
@@ -1,11 +1,59 @@
-SKIP: FAILED
+#version 460
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_958c87() {
+  float res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1u)), 1.0f);
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_958c87();
+}
+#version 460
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_958c87() {
+  float res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1u)), 1.0f);
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_958c87();
+}
+#version 460
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_958c87() {
+  float res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1u)), 1.0f);
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_958c87();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.ir.glsl
index e159074..2bb9e5c 100644
--- a/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1116ed.wgsl.expected.ir.glsl
@@ -1,11 +1,74 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_1116ed() {
+  vec2 arg_2 = vec2(1.0f);
+  int arg_3 = 1;
+  float arg_4 = 1.0f;
+  vec2 v_1 = arg_2;
+  float v_2 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v_1, float(arg_3), v_2));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_1116ed();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_1116ed() {
+  vec2 arg_2 = vec2(1.0f);
+  int arg_3 = 1;
+  float arg_4 = 1.0f;
+  vec2 v_1 = arg_2;
+  float v_2 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v_1, float(arg_3), v_2));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_1116ed();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_1116ed() {
+  vec2 arg_2 = vec2(1.0f);
+  int arg_3 = 1;
+  float arg_4 = 1.0f;
+  vec2 v = arg_2;
+  float v_1 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v, float(arg_3), v_1));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_1116ed();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v_2 = vertex_main_inner();
+  gl_Position = v_2.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v_2.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.ir.glsl
index e159074..e9ebd07 100644
--- a/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/1568e3.wgsl.expected.ir.glsl
@@ -1,11 +1,65 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeShadow arg_0_arg_1;
+float textureSampleCompareLevel_1568e3() {
+  vec3 arg_2 = vec3(1.0f);
+  float arg_3 = 1.0f;
+  float res = texture(arg_0_arg_1, vec4(arg_2, arg_3));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_1568e3();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeShadow arg_0_arg_1;
+float textureSampleCompareLevel_1568e3() {
+  vec3 arg_2 = vec3(1.0f);
+  float arg_3 = 1.0f;
+  float res = texture(arg_0_arg_1, vec4(arg_2, arg_3));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_1568e3();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp samplerCubeShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_1568e3() {
+  vec3 arg_2 = vec3(1.0f);
+  float arg_3 = 1.0f;
+  float res = texture(arg_0_arg_1, vec4(arg_2, arg_3));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_1568e3();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.ir.glsl
index e159074..5e86cd2 100644
--- a/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/2ad2b1.wgsl.expected.ir.glsl
@@ -1,11 +1,65 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DShadow arg_0_arg_1;
+float textureSampleCompareLevel_2ad2b1() {
+  vec2 arg_2 = vec2(1.0f);
+  float arg_3 = 1.0f;
+  float res = texture(arg_0_arg_1, vec3(arg_2, arg_3));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_2ad2b1();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DShadow arg_0_arg_1;
+float textureSampleCompareLevel_2ad2b1() {
+  vec2 arg_2 = vec2(1.0f);
+  float arg_3 = 1.0f;
+  float res = texture(arg_0_arg_1, vec3(arg_2, arg_3));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_2ad2b1();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp sampler2DShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_2ad2b1() {
+  vec2 arg_2 = vec2(1.0f);
+  float arg_3 = 1.0f;
+  float res = texture(arg_0_arg_1, vec3(arg_2, arg_3));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_2ad2b1();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.ir.glsl
index e159074..687c543 100644
--- a/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/4cf3a2.wgsl.expected.ir.glsl
@@ -1,11 +1,74 @@
-SKIP: FAILED
+#version 460
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_4cf3a2() {
+  vec3 arg_2 = vec3(1.0f);
+  int arg_3 = 1;
+  float arg_4 = 1.0f;
+  vec3 v_1 = arg_2;
+  float v_2 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v_1, float(arg_3)), v_2);
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_4cf3a2();
+}
+#version 460
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_4cf3a2() {
+  vec3 arg_2 = vec3(1.0f);
+  int arg_3 = 1;
+  float arg_4 = 1.0f;
+  vec3 v_1 = arg_2;
+  float v_2 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v_1, float(arg_3)), v_2);
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_4cf3a2();
+}
+#version 460
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_4cf3a2() {
+  vec3 arg_2 = vec3(1.0f);
+  int arg_3 = 1;
+  float arg_4 = 1.0f;
+  vec3 v = arg_2;
+  float v_1 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v, float(arg_3)), v_1);
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_4cf3a2();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v_2 = vertex_main_inner();
+  gl_Position = v_2.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v_2.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7dc3c0.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7dc3c0.wgsl.expected.ir.glsl
index e159074..cac7ec5 100644
--- a/test/tint/builtins/gen/var/textureSampleCompareLevel/7dc3c0.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7dc3c0.wgsl.expected.ir.glsl
@@ -1,11 +1,74 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_7dc3c0() {
+  vec2 arg_2 = vec2(1.0f);
+  uint arg_3 = 1u;
+  float arg_4 = 1.0f;
+  vec2 v_1 = arg_2;
+  float v_2 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v_1, float(arg_3), v_2));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_7dc3c0();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_7dc3c0() {
+  vec2 arg_2 = vec2(1.0f);
+  uint arg_3 = 1u;
+  float arg_4 = 1.0f;
+  vec2 v_1 = arg_2;
+  float v_2 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v_1, float(arg_3), v_2));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_7dc3c0();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp sampler2DArrayShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_7dc3c0() {
+  vec2 arg_2 = vec2(1.0f);
+  uint arg_3 = 1u;
+  float arg_4 = 1.0f;
+  vec2 v = arg_2;
+  float v_1 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v, float(arg_3), v_1));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_7dc3c0();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v_2 = vertex_main_inner();
+  gl_Position = v_2.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v_2.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.ir.glsl
index e159074..1f264d9 100644
--- a/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/7f2b9a.wgsl.expected.ir.glsl
@@ -1,11 +1,65 @@
-SKIP: FAILED
+#version 310 es
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DShadow arg_0_arg_1;
+float textureSampleCompareLevel_7f2b9a() {
+  vec2 arg_2 = vec2(1.0f);
+  float arg_3 = 1.0f;
+  float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(1));
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_7f2b9a();
+}
+#version 310 es
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp sampler2DShadow arg_0_arg_1;
+float textureSampleCompareLevel_7f2b9a() {
+  vec2 arg_2 = vec2(1.0f);
+  float arg_3 = 1.0f;
+  float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(1));
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_7f2b9a();
+}
+#version 310 es
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp sampler2DShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_7f2b9a() {
+  vec2 arg_2 = vec2(1.0f);
+  float arg_3 = 1.0f;
+  float res = textureOffset(arg_0_arg_1, vec3(arg_2, arg_3), ivec2(1));
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_7f2b9a();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v = vertex_main_inner();
+  gl_Position = v.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/builtins/gen/var/textureSampleCompareLevel/958c87.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleCompareLevel/958c87.wgsl.expected.ir.glsl
index e159074..2a1ddff 100644
--- a/test/tint/builtins/gen/var/textureSampleCompareLevel/958c87.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleCompareLevel/958c87.wgsl.expected.ir.glsl
@@ -1,11 +1,74 @@
-SKIP: FAILED
+#version 460
+precision highp float;
+precision highp int;
 
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_958c87() {
+  vec3 arg_2 = vec3(1.0f);
+  uint arg_3 = 1u;
+  float arg_4 = 1.0f;
+  vec3 v_1 = arg_2;
+  float v_2 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v_1, float(arg_3)), v_2);
+  return res;
+}
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_958c87();
+}
+#version 460
 
-tint executable returned error: signal: trace/BPT trap
+layout(binding = 0, std430)
+buffer tint_symbol_1_1_ssbo {
+  float tint_symbol;
+} v;
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+float textureSampleCompareLevel_958c87() {
+  vec3 arg_2 = vec3(1.0f);
+  uint arg_3 = 1u;
+  float arg_4 = 1.0f;
+  vec3 v_1 = arg_2;
+  float v_2 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v_1, float(arg_3)), v_2);
+  return res;
+}
+layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
+void main() {
+  v.tint_symbol = textureSampleCompareLevel_958c87();
+}
+#version 460
+
+
+struct VertexOutput {
+  vec4 pos;
+  float prevent_dce;
+};
+
+uniform highp samplerCubeArrayShadow arg_0_arg_1;
+layout(location = 0) flat out float vertex_main_loc0_Output;
+float textureSampleCompareLevel_958c87() {
+  vec3 arg_2 = vec3(1.0f);
+  uint arg_3 = 1u;
+  float arg_4 = 1.0f;
+  vec3 v = arg_2;
+  float v_1 = arg_4;
+  float res = texture(arg_0_arg_1, vec4(v, float(arg_3)), v_1);
+  return res;
+}
+VertexOutput vertex_main_inner() {
+  VertexOutput tint_symbol = VertexOutput(vec4(0.0f), 0.0f);
+  tint_symbol.pos = vec4(0.0f);
+  tint_symbol.prevent_dce = textureSampleCompareLevel_958c87();
+  return tint_symbol;
+}
+void main() {
+  VertexOutput v_2 = vertex_main_inner();
+  gl_Position = v_2.pos;
+  gl_Position[1u] = -(gl_Position.y);
+  gl_Position[2u] = ((2.0f * gl_Position.z) - gl_Position.w);
+  vertex_main_loc0_Output = v_2.prevent_dce;
+  gl_PointSize = 1.0f;
+}
diff --git a/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.ir.glsl b/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.ir.glsl
deleted file mode 100644
index e159074..0000000
--- a/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_0.spvasm.expected.ir.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-SKIP: FAILED
-
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
-
-tint executable returned error: signal: trace/BPT trap
diff --git a/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.ir.glsl b/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.ir.glsl
deleted file mode 100644
index e159074..0000000
--- a/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_1.spvasm.expected.ir.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-SKIP: FAILED
-
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
-
-tint executable returned error: signal: trace/BPT trap
diff --git a/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.ir.glsl b/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.ir.glsl
deleted file mode 100644
index e159074..0000000
--- a/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_2.spvasm.expected.ir.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-SKIP: FAILED
-
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
-
-tint executable returned error: signal: trace/BPT trap
diff --git a/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.ir.glsl b/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.ir.glsl
deleted file mode 100644
index e159074..0000000
--- a/test/tint/unittest/reader/spirv/ImageSampleDrefExplicitLod_SpvParserHandleTest_SampledImageAccessTest_Variable_4.spvasm.expected.ir.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-SKIP: FAILED
-
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
-
-tint executable returned error: signal: trace/BPT trap
diff --git a/test/tint/unittest/reader/spirv/ImageSampleProjDrefExplicitLod_CheckForLod0_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.ir.glsl b/test/tint/unittest/reader/spirv/ImageSampleProjDrefExplicitLod_CheckForLod0_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.ir.glsl
deleted file mode 100644
index e159074..0000000
--- a/test/tint/unittest/reader/spirv/ImageSampleProjDrefExplicitLod_CheckForLod0_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_0.spvasm.expected.ir.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-SKIP: FAILED
-
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
-
-tint executable returned error: signal: trace/BPT trap
diff --git a/test/tint/unittest/reader/spirv/ImageSampleProjDrefExplicitLod_CheckForLod0_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.ir.glsl b/test/tint/unittest/reader/spirv/ImageSampleProjDrefExplicitLod_CheckForLod0_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.ir.glsl
deleted file mode 100644
index e159074..0000000
--- a/test/tint/unittest/reader/spirv/ImageSampleProjDrefExplicitLod_CheckForLod0_SpvParserHandleTest_ImageCoordsTest_MakeCoordinateOperandsForImageAccess_1.spvasm.expected.ir.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-SKIP: FAILED
-
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
-
-tint executable returned error: signal: trace/BPT trap
diff --git a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_9.spvasm.expected.ir.glsl b/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_9.spvasm.expected.ir.glsl
deleted file mode 100644
index e159074..0000000
--- a/test/tint/unittest/reader/spirv/Samples_SpvParserHandleTest_RegisterHandleUsage_SampledImage_Variable_9.spvasm.expected.ir.glsl
+++ /dev/null
@@ -1,11 +0,0 @@
-SKIP: FAILED
-
-<dawn>/src/tint/lang/glsl/writer/printer/printer.cc:1468 internal compiler error: TINT_UNREACHABLE unhandled core builtin: textureSampleCompareLevel
-********************************************************************
-*  The tint shader compiler has encountered an unexpected error.   *
-*                                                                  *
-*  Please help us fix this issue by submitting a bug report at     *
-*  crbug.com/tint with the source program that triggered the bug.  *
-********************************************************************
-
-tint executable returned error: signal: trace/BPT trap