[tint] Clamp lod bias from -16.0 to 15.99
This simply aligns all platform with the dx API.
Bug: 371033198
Change-Id: I6e7d0b6f3a4e127259ca3c4916c25a2c962cc54c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/211214
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Peter McNeeley <petermcneeley@google.com>
diff --git a/src/tint/lang/core/ir/module.cc b/src/tint/lang/core/ir/module.cc
index 617f00d..31e7363 100644
--- a/src/tint/lang/core/ir/module.cc
+++ b/src/tint/lang/core/ir/module.cc
@@ -133,7 +133,7 @@
void Module::SetName(Instruction* inst, std::string_view name) {
TINT_ASSERT(inst->Results().Length() == 1);
- return SetName(inst->Result(0), name);
+ SetName(inst->Result(0), name);
}
void Module::SetName(Value* value, std::string_view name) {
diff --git a/src/tint/lang/core/ir/transform/builtin_polyfill.cc b/src/tint/lang/core/ir/transform/builtin_polyfill.cc
index aeaa696..789cd71 100644
--- a/src/tint/lang/core/ir/transform/builtin_polyfill.cc
+++ b/src/tint/lang/core/ir/transform/builtin_polyfill.cc
@@ -31,6 +31,7 @@
#include "src/tint/lang/core/ir/module.h"
#include "src/tint/lang/core/ir/validator.h"
#include "src/tint/lang/core/type/sampled_texture.h"
+#include "src/tint/lang/core/type/texture.h"
using namespace tint::core::fluent_types; // NOLINT
using namespace tint::core::number_suffixes; // NOLINT
@@ -125,6 +126,9 @@
worklist.Push(builtin);
}
break;
+ case core::BuiltinFn::kTextureSampleBias:
+ worklist.Push(builtin);
+ break;
case core::BuiltinFn::kTextureSampleBaseClampToEdge:
if (config.texture_sample_base_clamp_to_edge_2d_f32) {
auto* tex =
@@ -203,6 +207,9 @@
case core::BuiltinFn::kTextureSampleBaseClampToEdge:
TextureSampleBaseClampToEdge_2d_f32(builtin);
break;
+ case core::BuiltinFn::kTextureSampleBias:
+ TextureSampleBiasClamp(builtin);
+ break;
case core::BuiltinFn::kDot4I8Packed:
Dot4I8Packed(builtin);
break;
@@ -707,6 +714,23 @@
call->Destroy();
}
+ /// Polyfill clamping for the (f32) bias parameter of TextureSampleBias
+ /// @param call the builtin call instruction
+ void TextureSampleBiasClamp(ir::CoreBuiltinCall* call) {
+ b.InsertBefore(call, [&] {
+ auto* texture_type = call->Args()[0]->Type()->As<core::type::Texture>();
+ bool is_array_texture = type::IsTextureArray(texture_type->Dim());
+ const uint32_t kBiasParameterIndex = is_array_texture ? 4 : 3;
+ auto* bias_parameter = call->Args()[kBiasParameterIndex];
+ // TODO(crbug.com/371033198): Consider applying clamp here if 'bias_parameter' is a
+ // constant. This might not be the most prudent idea for two reasons: 1. the platform
+ // compilers will perform this optimization 2. it will bifurcate the testing paths.
+ call->SetArg(kBiasParameterIndex, b.Call(ty.f32(), core::BuiltinFn::kClamp,
+ bias_parameter, -16.00_f, 15.99_f)
+ ->Result(0));
+ });
+ }
+
/// Polyfill a `dot4I8Packed()` builtin call
/// @param call the builtin call instruction
void Dot4I8Packed(ir::CoreBuiltinCall* call) {
diff --git a/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc b/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc
index eecff1e..6dfbd61 100644
--- a/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc
+++ b/src/tint/lang/core/ir/transform/builtin_polyfill_test.cc
@@ -2101,6 +2101,70 @@
EXPECT_EQ(expect, str());
}
+TEST_F(IR_BuiltinPolyfillTest, TextureSampleBiasClampNonArray) {
+ auto* texture_ty =
+ ty.Get<core::type::SampledTexture>(core::type::TextureDimension::k2d, ty.f32());
+ Build(core::BuiltinFn::kTextureSampleBias, ty.vec4<f32>(),
+ Vector{texture_ty, ty.sampler(), ty.vec2<f32>(), ty.f32()});
+
+ auto* src = R"(
+%foo = func(%arg:texture_2d<f32>, %arg_1:sampler, %arg_2:vec2<f32>, %arg_3:f32):vec4<f32> { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg'
+ $B1: {
+ %result:vec4<f32> = textureSampleBias %arg, %arg_1, %arg_2, %arg_3
+ ret %result
+ }
+}
+)";
+ auto* expect = R"(
+%foo = func(%arg:texture_2d<f32>, %arg_1:sampler, %arg_2:vec2<f32>, %arg_3:f32):vec4<f32> { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg'
+ $B1: {
+ %6:f32 = clamp %arg_3, -16.0f, 15.9899997711181640625f
+ %result:vec4<f32> = textureSampleBias %arg, %arg_1, %arg_2, %6
+ ret %result
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ BuiltinPolyfillConfig config;
+ config.texture_sample_base_clamp_to_edge_2d_f32 = true;
+ Run(BuiltinPolyfill, config);
+ EXPECT_EQ(expect, str());
+}
+
+TEST_F(IR_BuiltinPolyfillTest, TextureSampleBiasClampWithArray) {
+ auto* texture_ty =
+ ty.Get<core::type::SampledTexture>(core::type::TextureDimension::k2dArray, ty.f32());
+ Build(core::BuiltinFn::kTextureSampleBias, ty.vec4<f32>(),
+ Vector{texture_ty, ty.sampler(), ty.vec2<f32>(), ty.i32(), ty.f32()});
+
+ auto* src = R"(
+%foo = func(%arg:texture_2d_array<f32>, %arg_1:sampler, %arg_2:vec2<f32>, %arg_3:i32, %arg_4:f32):vec4<f32> { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg', %arg_4: 'arg'
+ $B1: {
+ %result:vec4<f32> = textureSampleBias %arg, %arg_1, %arg_2, %arg_3, %arg_4
+ ret %result
+ }
+}
+)";
+ auto* expect = R"(
+%foo = func(%arg:texture_2d_array<f32>, %arg_1:sampler, %arg_2:vec2<f32>, %arg_3:i32, %arg_4:f32):vec4<f32> { # %arg_1: 'arg', %arg_2: 'arg', %arg_3: 'arg', %arg_4: 'arg'
+ $B1: {
+ %7:f32 = clamp %arg_4, -16.0f, 15.9899997711181640625f
+ %result:vec4<f32> = textureSampleBias %arg, %arg_1, %arg_2, %arg_3, %7
+ ret %result
+ }
+}
+)";
+
+ EXPECT_EQ(src, str());
+
+ BuiltinPolyfillConfig config;
+ config.texture_sample_base_clamp_to_edge_2d_f32 = true;
+ Run(BuiltinPolyfill, config);
+ EXPECT_EQ(expect, str());
+}
+
TEST_F(IR_BuiltinPolyfillTest, Pack4xI8) {
Build(core::BuiltinFn::kPack4XI8, ty.u32(), Vector{ty.vec4<i32>()});
diff --git a/src/tint/lang/glsl/writer/builtin_test.cc b/src/tint/lang/glsl/writer/builtin_test.cc
index 6f1834c..07b815c 100644
--- a/src/tint/lang/glsl/writer/builtin_test.cc
+++ b/src/tint/lang/glsl/writer/builtin_test.cc
@@ -2739,7 +2739,8 @@
uniform highp sampler2D t_s;
void main() {
- vec4 x = texture(t_s, vec2(1.0f, 2.0f), 3.0f);
+ vec2 v = vec2(1.0f, 2.0f);
+ vec4 x = texture(t_s, v, clamp(3.0f, -16.0f, 15.9899997711181640625f));
}
)");
}
@@ -2775,7 +2776,8 @@
uniform highp sampler2D t_s;
void main() {
- vec4 x = textureOffset(t_s, vec2(1.0f, 2.0f), ivec2(4, 5), 3.0f);
+ vec2 v = vec2(1.0f, 2.0f);
+ vec4 x = textureOffset(t_s, v, ivec2(4, 5), clamp(3.0f, -16.0f, 15.9899997711181640625f));
}
)");
}
@@ -2812,7 +2814,8 @@
uniform highp sampler2DArray t_s;
void main() {
vec2 v = vec2(1.0f, 2.0f);
- vec4 x = texture(t_s, vec3(v, float(4u)), 3.0f);
+ float v_1 = clamp(3.0f, -16.0f, 15.9899997711181640625f);
+ vec4 x = texture(t_s, vec3(v, float(4u)), v_1);
}
)");
}
@@ -2850,7 +2853,8 @@
uniform highp sampler2DArray t_s;
void main() {
vec2 v = vec2(1.0f, 2.0f);
- vec4 x = textureOffset(t_s, vec3(v, float(4u)), ivec2(4, 5), 3.0f);
+ float v_1 = clamp(3.0f, -16.0f, 15.9899997711181640625f);
+ vec4 x = textureOffset(t_s, vec3(v, float(4u)), ivec2(4, 5), v_1);
}
)");
}
@@ -2884,7 +2888,8 @@
uniform highp sampler3D t_s;
void main() {
- vec4 x = texture(t_s, vec3(1.0f, 2.0f, 3.0f), 3.0f);
+ vec3 v = vec3(1.0f, 2.0f, 3.0f);
+ vec4 x = texture(t_s, v, clamp(3.0f, -16.0f, 15.9899997711181640625f));
}
)");
}
@@ -2920,7 +2925,8 @@
uniform highp sampler3D t_s;
void main() {
- vec4 x = textureOffset(t_s, vec3(1.0f, 2.0f, 3.0f), ivec3(4, 5, 6), 3.0f);
+ vec3 v = vec3(1.0f, 2.0f, 3.0f);
+ vec4 x = textureOffset(t_s, v, ivec3(4, 5, 6), clamp(3.0f, -16.0f, 15.9899997711181640625f));
}
)");
}
@@ -2954,7 +2960,8 @@
uniform highp samplerCube t_s;
void main() {
- vec4 x = texture(t_s, vec3(1.0f, 2.0f, 3.0f), 3.0f);
+ vec3 v = vec3(1.0f, 2.0f, 3.0f);
+ vec4 x = texture(t_s, v, clamp(3.0f, -16.0f, 15.9899997711181640625f));
}
)");
}
@@ -2994,7 +3001,8 @@
uniform highp samplerCubeArray t_s;
void main() {
vec3 v = vec3(1.0f, 2.0f, 3.0f);
- vec4 x = texture(t_s, vec4(v, float(4u)), 3.0f);
+ float v_1 = clamp(3.0f, -16.0f, 15.9899997711181640625f);
+ vec4 x = texture(t_s, vec4(v, float(4u)), v_1);
}
)");
}
diff --git a/src/tint/lang/hlsl/writer/builtin_test.cc b/src/tint/lang/hlsl/writer/builtin_test.cc
index 71e10ed..5c934bb 100644
--- a/src/tint/lang/hlsl/writer/builtin_test.cc
+++ b/src/tint/lang/hlsl/writer/builtin_test.cc
@@ -2781,7 +2781,8 @@
Texture2D<float4> v : register(t0);
SamplerState v_1 : register(s1);
void foo() {
- float4 x = v.SampleBias(v_1, float2(1.0f, 2.0f), 3.0f);
+ float2 v_2 = float2(1.0f, 2.0f);
+ float4 x = v.SampleBias(v_1, v_2, clamp(3.0f, -16.0f, 15.9899997711181640625f));
}
)");
@@ -2817,7 +2818,8 @@
Texture2D<float4> v : register(t0);
SamplerState v_1 : register(s1);
void foo() {
- float4 x = v.SampleBias(v_1, float2(1.0f, 2.0f), 3.0f, int2(int(4), int(5)));
+ float2 v_2 = float2(1.0f, 2.0f);
+ float4 x = v.SampleBias(v_1, v_2, clamp(3.0f, -16.0f, 15.9899997711181640625f), int2(int(4), int(5)));
}
)");
@@ -2854,7 +2856,8 @@
SamplerState v_1 : register(s1);
void foo() {
float2 v_2 = float2(1.0f, 2.0f);
- float4 x = v.SampleBias(v_1, float3(v_2, float(4u)), 3.0f);
+ float v_3 = clamp(3.0f, -16.0f, 15.9899997711181640625f);
+ float4 x = v.SampleBias(v_1, float3(v_2, float(4u)), v_3);
}
)");
@@ -2892,7 +2895,8 @@
SamplerState v_1 : register(s1);
void foo() {
float2 v_2 = float2(1.0f, 2.0f);
- float4 x = v.SampleBias(v_1, float3(v_2, float(4u)), 3.0f, int2(int(4), int(5)));
+ float v_3 = clamp(3.0f, -16.0f, 15.9899997711181640625f);
+ float4 x = v.SampleBias(v_1, float3(v_2, float(4u)), v_3, int2(int(4), int(5)));
}
)");
@@ -2926,7 +2930,8 @@
Texture3D<float4> v : register(t0);
SamplerState v_1 : register(s1);
void foo() {
- float4 x = v.SampleBias(v_1, float3(1.0f, 2.0f, 3.0f), 3.0f);
+ float3 v_2 = float3(1.0f, 2.0f, 3.0f);
+ float4 x = v.SampleBias(v_1, v_2, clamp(3.0f, -16.0f, 15.9899997711181640625f));
}
)");
@@ -2962,7 +2967,8 @@
Texture3D<float4> v : register(t0);
SamplerState v_1 : register(s1);
void foo() {
- float4 x = v.SampleBias(v_1, float3(1.0f, 2.0f, 3.0f), 3.0f, int3(int(4), int(5), int(6)));
+ float3 v_2 = float3(1.0f, 2.0f, 3.0f);
+ float4 x = v.SampleBias(v_1, v_2, clamp(3.0f, -16.0f, 15.9899997711181640625f), int3(int(4), int(5), int(6)));
}
)");
@@ -2996,7 +3002,8 @@
TextureCube<float4> v : register(t0);
SamplerState v_1 : register(s1);
void foo() {
- float4 x = v.SampleBias(v_1, float3(1.0f, 2.0f, 3.0f), 3.0f);
+ float3 v_2 = float3(1.0f, 2.0f, 3.0f);
+ float4 x = v.SampleBias(v_1, v_2, clamp(3.0f, -16.0f, 15.9899997711181640625f));
}
)");
@@ -3033,7 +3040,8 @@
SamplerState v_1 : register(s1);
void foo() {
float3 v_2 = float3(1.0f, 2.0f, 3.0f);
- float4 x = v.SampleBias(v_1, float4(v_2, float(4u)), 3.0f);
+ float v_3 = clamp(3.0f, -16.0f, 15.9899997711181640625f);
+ float4 x = v.SampleBias(v_1, float4(v_2, float(4u)), v_3);
}
)");
diff --git a/src/tint/lang/spirv/writer/texture_builtin_test.cc b/src/tint/lang/spirv/writer/texture_builtin_test.cc
index 315316a..432dc0d 100644
--- a/src/tint/lang/spirv/writer/texture_builtin_test.cc
+++ b/src/tint/lang/spirv/writer/texture_builtin_test.cc
@@ -426,8 +426,9 @@
{{"coords", 2, kF32}, {"bias", 1, kF32}},
{"result", 4, kF32},
{
- "%10 = OpSampledImage %11 %t %s",
- "OpImageSampleImplicitLod %v4float %10 %coords Bias %bias",
+ "OpExtInst %float %11 NClamp %bias %float_n16 %float_15_9899998",
+ "OpSampledImage %16 %t %s",
+ "OpImageSampleImplicitLod %v4float %15 %coords Bias %10",
},
},
TextureBuiltinTestCase{
@@ -437,8 +438,9 @@
{{"coords", 2, kF32}, {"bias", 1, kF32}, {"offset", 2, kI32}},
{"result", 4, kF32},
{
- "%10 = OpSampledImage %11 %t %s",
- "OpImageSampleImplicitLod %v4float %10 %coords Bias|ConstOffset %bias %offset",
+ "OpExtInst %float %11 NClamp %bias %float_n16 %float_15_9899998",
+ "OpSampledImage %16 %t %s",
+ "OpImageSampleImplicitLod %v4float %15 %coords Bias|ConstOffset %10 %offset",
},
},
TextureBuiltinTestCase{
@@ -448,10 +450,11 @@
{{"coords", 2, kF32}, {"array_idx", 1, kI32}, {"bias", 1, kF32}},
{"result", 4, kF32},
{
- "%10 = OpSampledImage %11 %t %s",
- "%12 = OpConvertSToF %float %array_idx",
- "%16 = OpCompositeConstruct %v3float %coords %12",
- "OpImageSampleImplicitLod %v4float %10 %16 Bias %bias",
+ "OpExtInst %float %11 NClamp %bias %float_n16 %float_15_9899998",
+ "OpSampledImage %16 %t %s",
+ "OpConvertSToF %float %array_idx",
+ "OpCompositeConstruct %v3float %coords %17",
+ "OpImageSampleImplicitLod %v4float %15 %21 Bias %10",
},
},
TextureBuiltinTestCase{
@@ -461,10 +464,11 @@
{{"coords", 2, kF32}, {"array_idx", 1, kI32}, {"bias", 1, kF32}, {"offset", 2, kI32}},
{"result", 4, kF32},
{
- "%10 = OpSampledImage %11 %t %s",
- "%12 = OpConvertSToF %float %array_idx",
- "%16 = OpCompositeConstruct %v3float %coords %12",
- "OpImageSampleImplicitLod %v4float %10 %16 Bias|ConstOffset %bias %offset",
+ "OpExtInst %float %11 NClamp %bias %float_n16 %float_15_9899998",
+ "OpSampledImage %16 %t %s",
+ "OpConvertSToF %float %array_idx",
+ "OpCompositeConstruct %v3float %coords %17",
+ "OpImageSampleImplicitLod %v4float %15 %21 Bias|ConstOffset %10 %offset",
},
},
TextureBuiltinTestCase{
@@ -474,8 +478,9 @@
{{"coords", 3, kF32}, {"bias", 1, kF32}},
{"result", 4, kF32},
{
- "%10 = OpSampledImage %11 %t %s",
- "OpImageSampleImplicitLod %v4float %10 %coords Bias %bias",
+ "OpExtInst %float %11 NClamp %bias %float_n16 %float_15_9899998",
+ "OpSampledImage %16 %t %s",
+ "OpImageSampleImplicitLod %v4float %15 %coords Bias %10",
},
},
TextureBuiltinTestCase{
@@ -485,8 +490,9 @@
{{"coords", 3, kF32}, {"bias", 1, kF32}, {"offset", 3, kI32}},
{"result", 4, kF32},
{
- "%10 = OpSampledImage %11 %t %s",
- "OpImageSampleImplicitLod %v4float %10 %coords Bias|ConstOffset %bias %offset",
+ "OpExtInst %float %11 NClamp %bias %float_n16 %float_15_9899998",
+ "OpSampledImage %16 %t %s",
+ "OpImageSampleImplicitLod %v4float %15 %coords Bias|ConstOffset %10 %offset",
},
},
TextureBuiltinTestCase{
@@ -496,8 +502,9 @@
{{"coords", 3, kF32}, {"bias", 1, kF32}},
{"result", 4, kF32},
{
- "%10 = OpSampledImage %11 %t %s",
- "OpImageSampleImplicitLod %v4float %10 %coords Bias %bias",
+ "OpExtInst %float %11 NClamp %bias %float_n16 %float_15_9899998",
+ "OpSampledImage %16 %t %s",
+ "OpImageSampleImplicitLod %v4float %15 %coords Bias %10",
},
},
TextureBuiltinTestCase{
@@ -507,10 +514,11 @@
{{"coords", 3, kF32}, {"array_idx", 1, kI32}, {"bias", 1, kF32}},
{"result", 4, kF32},
{
- "%10 = OpSampledImage %11 %t %s",
- "%12 = OpConvertSToF %float %array_idx",
- "%15 = OpCompositeConstruct %v4float %coords %12",
- "OpImageSampleImplicitLod %v4float %10 %15 Bias %bias",
+ "OpExtInst %float %11 NClamp %bias %float_n16 %float_15_9899998",
+ "OpSampledImage %16 %t %s",
+ "OpConvertSToF %float %array_idx",
+ "OpCompositeConstruct %v4float %coords %17",
+ "OpImageSampleImplicitLod %v4float %15 %20 Bias %10",
},
}),
PrintCase);
diff --git a/test/tint/bug/tint/1703.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/1703.wgsl.expected.ir.dxc.hlsl
index 4923d92..2b6ffcc 100644
--- a/test/tint/bug/tint/1703.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/bug/tint/1703.wgsl.expected.ir.dxc.hlsl
@@ -11,7 +11,7 @@
vb2[0u] = (asfloat(my_uniform[0u].x) == -1.0f);
vb2 = bool2((asfloat(my_uniform[0u].x) == -1.0f), false);
if (vb2.x) {
- float4 r = my_texture.SampleBias(my_sampler, (0.0f).xx, 0.0f);
+ float4 r = my_texture.SampleBias(my_sampler, (0.0f).xx, clamp(0.0f, -16.0f, 15.9899997711181640625f));
}
}
@@ -21,7 +21,7 @@
vb2[0u] = (asfloat(my_uniform[0u].x) == -1.0f);
vb2 = (false).xx;
if (vb2.x) {
- float4 r = my_texture.SampleBias(my_sampler, (0.0f).xx, 0.0f);
+ float4 r = my_texture.SampleBias(my_sampler, (0.0f).xx, clamp(0.0f, -16.0f, 15.9899997711181640625f));
}
}
diff --git a/test/tint/bug/tint/1703.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/1703.wgsl.expected.ir.fxc.hlsl
index 4923d92..2b6ffcc 100644
--- a/test/tint/bug/tint/1703.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/tint/1703.wgsl.expected.ir.fxc.hlsl
@@ -11,7 +11,7 @@
vb2[0u] = (asfloat(my_uniform[0u].x) == -1.0f);
vb2 = bool2((asfloat(my_uniform[0u].x) == -1.0f), false);
if (vb2.x) {
- float4 r = my_texture.SampleBias(my_sampler, (0.0f).xx, 0.0f);
+ float4 r = my_texture.SampleBias(my_sampler, (0.0f).xx, clamp(0.0f, -16.0f, 15.9899997711181640625f));
}
}
@@ -21,7 +21,7 @@
vb2[0u] = (asfloat(my_uniform[0u].x) == -1.0f);
vb2 = (false).xx;
if (vb2.x) {
- float4 r = my_texture.SampleBias(my_sampler, (0.0f).xx, 0.0f);
+ float4 r = my_texture.SampleBias(my_sampler, (0.0f).xx, clamp(0.0f, -16.0f, 15.9899997711181640625f));
}
}
diff --git a/test/tint/bug/tint/1703.wgsl.expected.ir.glsl b/test/tint/bug/tint/1703.wgsl.expected.ir.glsl
index f0cca2c..c48a5ec 100644
--- a/test/tint/bug/tint/1703.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/1703.wgsl.expected.ir.glsl
@@ -12,7 +12,7 @@
vb2[0u] = (v.inner == -1.0f);
vb2 = bvec2((v.inner == -1.0f), false);
if (vb2.x) {
- vec4 r = texture(my_texture_my_sampler, vec2(0.0f), 0.0f);
+ vec4 r = texture(my_texture_my_sampler, vec2(0.0f), clamp(0.0f, -16.0f, 15.9899997711181640625f));
}
}
void foo_default_initialize() {
@@ -21,7 +21,7 @@
vb2[0u] = (v.inner == -1.0f);
vb2 = bvec2(false);
if (vb2.x) {
- vec4 r = texture(my_texture_my_sampler, vec2(0.0f), 0.0f);
+ vec4 r = texture(my_texture_my_sampler, vec2(0.0f), clamp(0.0f, -16.0f, 15.9899997711181640625f));
}
}
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
diff --git a/test/tint/bug/tint/1703.wgsl.expected.ir.msl b/test/tint/bug/tint/1703.wgsl.expected.ir.msl
index 351719e..3fa03a0 100644
--- a/test/tint/bug/tint/1703.wgsl.expected.ir.msl
+++ b/test/tint/bug/tint/1703.wgsl.expected.ir.msl
@@ -14,7 +14,7 @@
vb2[0u] = ((*tint_module_vars.my_uniform) == -1.0f);
vb2 = bool2(((*tint_module_vars.my_uniform) == -1.0f), false);
if (vb2[0u]) {
- float4 const r = tint_module_vars.my_texture.sample(tint_module_vars.my_sampler, float2(0.0f), bias(0.0f));
+ float4 const r = tint_module_vars.my_texture.sample(tint_module_vars.my_sampler, float2(0.0f), bias(clamp(0.0f, -16.0f, 15.9899997711181640625f)));
}
}
@@ -24,6 +24,6 @@
vb2[0u] = ((*tint_module_vars.my_uniform) == -1.0f);
vb2 = bool2(false);
if (vb2[0u]) {
- float4 const r = tint_module_vars.my_texture.sample(tint_module_vars.my_sampler, float2(0.0f), bias(0.0f));
+ float4 const r = tint_module_vars.my_texture.sample(tint_module_vars.my_sampler, float2(0.0f), bias(clamp(0.0f, -16.0f, 15.9899997711181640625f)));
}
}
diff --git a/test/tint/bug/tint/1703.wgsl.expected.spvasm b/test/tint/bug/tint/1703.wgsl.expected.spvasm
index 6fc959b..d3c723b 100644
--- a/test/tint/bug/tint/1703.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/1703.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 77
+; Bound: 82
; Schema: 0
OpCapability Shader
+ %52 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint GLCompute %unused_entry_point "unused_entry_point"
OpExecutionMode %unused_entry_point LocalSize 1 1 1
@@ -57,9 +58,11 @@
%_ptr_Uniform_float = OpTypePointer Uniform %float
%float_n1 = OpConstant %float -1
%false = OpConstantFalse %bool
- %52 = OpTypeSampledImage %11
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %56 = OpTypeSampledImage %11
%v2float = OpTypeVector %float 2
- %54 = OpConstantNull %v2float
+ %58 = OpConstantNull %v2float
%foo_member_initialize = OpFunction %void None %17
%18 = OpLabel
%vb2 = OpVariable %_ptr_Function_v2bool Function %23
@@ -85,40 +88,42 @@
%48 = OpLabel
%49 = OpLoad %11 %my_texture None
%50 = OpLoad %14 %my_sampler None
- %51 = OpSampledImage %52 %49 %50
- %r = OpImageSampleImplicitLod %v4float %51 %54 Bias %float_0
+ %51 = OpExtInst %float %52 NClamp %float_0 %float_n16 %float_15_9899998
+ %55 = OpSampledImage %56 %49 %50
+ %r = OpImageSampleImplicitLod %v4float %55 %58 Bias %51
OpBranch %47
%47 = OpLabel
OpReturn
OpFunctionEnd
%foo_default_initialize = OpFunction %void None %17
- %57 = OpLabel
+ %61 = OpLabel
%vb2_0 = OpVariable %_ptr_Function_v2bool Function %23
- %59 = OpAccessChain %_ptr_Private_float %my_global %uint_2
- %60 = OpLoad %float %59 None
- %61 = OpFOrdNotEqual %bool %60 %float_0
- %62 = OpAccessChain %_ptr_Function_bool %vb2_0 %uint_0
- OpStore %62 %61 None
- %63 = OpAccessChain %_ptr_Uniform_float %6 %uint_0
+ %63 = OpAccessChain %_ptr_Private_float %my_global %uint_2
%64 = OpLoad %float %63 None
- %65 = OpFOrdEqual %bool %64 %float_n1
+ %65 = OpFOrdNotEqual %bool %64 %float_0
%66 = OpAccessChain %_ptr_Function_bool %vb2_0 %uint_0
OpStore %66 %65 None
+ %67 = OpAccessChain %_ptr_Uniform_float %6 %uint_0
+ %68 = OpLoad %float %67 None
+ %69 = OpFOrdEqual %bool %68 %float_n1
+ %70 = OpAccessChain %_ptr_Function_bool %vb2_0 %uint_0
+ OpStore %70 %69 None
OpStore %vb2_0 %23 None
- %67 = OpAccessChain %_ptr_Function_bool %vb2_0 %uint_0
- %68 = OpLoad %bool %67 None
- OpSelectionMerge %69 None
- OpBranchConditional %68 %70 %69
- %70 = OpLabel
- %71 = OpLoad %11 %my_texture None
- %72 = OpLoad %14 %my_sampler None
- %73 = OpSampledImage %52 %71 %72
- %r_0 = OpImageSampleImplicitLod %v4float %73 %54 Bias %float_0
- OpBranch %69
- %69 = OpLabel
+ %71 = OpAccessChain %_ptr_Function_bool %vb2_0 %uint_0
+ %72 = OpLoad %bool %71 None
+ OpSelectionMerge %73 None
+ OpBranchConditional %72 %74 %73
+ %74 = OpLabel
+ %75 = OpLoad %11 %my_texture None
+ %76 = OpLoad %14 %my_sampler None
+ %77 = OpExtInst %float %52 NClamp %float_0 %float_n16 %float_15_9899998
+ %78 = OpSampledImage %56 %75 %76
+ %r_0 = OpImageSampleImplicitLod %v4float %78 %58 Bias %77
+ OpBranch %73
+ %73 = OpLabel
OpReturn
OpFunctionEnd
%unused_entry_point = OpFunction %void None %17
- %76 = OpLabel
+ %81 = OpLabel
OpReturn
OpFunctionEnd
diff --git a/test/tint/bug/tint/948.wgsl.expected.ir.dxc.hlsl b/test/tint/bug/tint/948.wgsl.expected.ir.dxc.hlsl
index 7075d75..f6cbb6c 100644
--- a/test/tint/bug/tint/948.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/bug/tint/948.wgsl.expected.ir.dxc.hlsl
@@ -42,14 +42,17 @@
float x_25 = asfloat(x_20[6u].w);
fX = (x_15 / x_25);
float x_37 = fX;
- float4 x_40 = frameMapTexture.SampleBias(frameMapSampler, float2(x_37, 0.0f), 0.0f);
+ float2 v = float2(x_37, 0.0f);
+ float4 x_40 = frameMapTexture.SampleBias(frameMapSampler, v, clamp(0.0f, -16.0f, 15.9899997711181640625f));
float x_44 = fX;
- float4 x_47 = frameMapTexture.SampleBias(frameMapSampler, float2(x_44, 0.25f), 0.0f);
+ float2 v_1 = float2(x_44, 0.25f);
+ float4 x_47 = frameMapTexture.SampleBias(frameMapSampler, v_1, clamp(0.0f, -16.0f, 15.9899997711181640625f));
float x_51 = fX;
- float4 x_54 = frameMapTexture.SampleBias(frameMapSampler, float2(x_51, 0.5f), 0.0f);
- float4 v = float4(x_40[0u], x_40[1u], x_40[2u], x_40[3u]);
- float4 v_1 = float4(x_47[0u], x_47[1u], x_47[2u], x_47[3u]);
- return float4x4(v, v_1, float4(x_54[0u], x_54[1u], x_54[2u], x_54[3u]), (0.0f).xxxx);
+ float2 v_2 = float2(x_51, 0.5f);
+ float4 x_54 = frameMapTexture.SampleBias(frameMapSampler, v_2, clamp(0.0f, -16.0f, 15.9899997711181640625f));
+ float4 v_3 = float4(x_40[0u], x_40[1u], x_40[2u], x_40[3u]);
+ float4 v_4 = float4(x_47[0u], x_47[1u], x_47[2u], x_47[3u]);
+ return float4x4(v_3, v_4, float4(x_54[0u], x_54[1u], x_54[2u], x_54[3u]), (0.0f).xxxx);
}
void main_1() {
@@ -98,7 +101,7 @@
{
float2 x_150 = tileID;
float2 x_154 = asfloat(x_20[5u].zw);
- float4 x_156 = tileMapsTexture1.SampleBias(tileMapsSampler, ((x_150 + (0.5f).xx) / x_154), 0.0f);
+ float4 x_156 = tileMapsTexture1.SampleBias(tileMapsSampler, ((x_150 + (0.5f).xx) / x_154), clamp(0.0f, -16.0f, 15.9899997711181640625f));
frameID_1 = x_156[0u];
break;
}
@@ -106,7 +109,7 @@
{
float2 x_136 = tileID;
float2 x_140 = asfloat(x_20[5u].zw);
- float4 x_142 = tileMapsTexture0.SampleBias(tileMapsSampler, ((x_136 + (0.5f).xx) / x_140), 0.0f);
+ float4 x_142 = tileMapsTexture0.SampleBias(tileMapsSampler, ((x_136 + (0.5f).xx) / x_140), clamp(0.0f, -16.0f, 15.9899997711181640625f));
frameID_1 = x_142[0u];
break;
}
@@ -117,15 +120,16 @@
}
float x_166 = frameID_1;
float x_169 = asfloat(x_20[6u].w);
- float4 x_172 = animationMapTexture.SampleBias(animationMapSampler, float2(((x_166 + 0.5f) / x_169), 0.0f), 0.0f);
+ float2 v_5 = float2(((x_166 + 0.5f) / x_169), 0.0f);
+ float4 x_172 = animationMapTexture.SampleBias(animationMapSampler, v_5, clamp(0.0f, -16.0f, 15.9899997711181640625f));
animationData = x_172;
float x_174 = animationData.y;
if ((x_174 > 0.0f)) {
float x_181 = asfloat(x_20[0u].x);
float x_184 = animationData.z;
- float v_2 = ((x_181 * x_184) / 1.0f);
- float v_3 = floor(v_2);
- mt = (((x_181 * x_184) - (((v_2 < 0.0f)) ? (ceil(v_2)) : (v_3))) * 1.0f);
+ float v_6 = ((x_181 * x_184) / 1.0f);
+ float v_7 = floor(v_6);
+ mt = (((x_181 * x_184) - (((v_6 < 0.0f)) ? (ceil(v_6)) : (v_7))) * 1.0f);
f = 0.0f;
{
while(true) {
@@ -166,8 +170,8 @@
offset_1 = (float2(x_235[0u], x_235[1u]) * x_237);
float4 x_241 = frameData[int(2)];
float4 x_244 = frameData[int(0)];
- float2 v_4 = float2(x_241[0u], x_241[1u]);
- ratio = (v_4 / float2(x_244[3u], x_244[2u]));
+ float2 v_8 = float2(x_241[0u], x_241[1u]);
+ ratio = (v_8 / float2(x_244[3u], x_244[2u]));
float x_248 = frameData[int(2)].z;
if ((x_248 == 1.0f)) {
float2 x_252 = tileUV;
@@ -192,9 +196,9 @@
float4 x_290 = color;
float4 x_292 = nc;
float x_295 = nc.w;
- float3 v_5 = float3(x_290[0u], x_290[1u], x_290[2u]);
- float3 v_6 = float3(x_292[0u], x_292[1u], x_292[2u]);
- mixed = lerp(v_5, v_6, float3(x_295, x_295, x_295));
+ float3 v_9 = float3(x_290[0u], x_290[1u], x_290[2u]);
+ float3 v_10 = float3(x_292[0u], x_292[1u], x_292[2u]);
+ mixed = lerp(v_9, v_10, float3(x_295, x_295, x_295));
float3 x_298 = mixed;
float x_299 = alpha;
color = float4(x_298[0u], x_298[1u], x_298[2u], x_299);
@@ -223,13 +227,13 @@
vPosition = vPosition_param;
vUV = vUV_param;
main_1();
- main_out v_7 = {glFragColor};
- return v_7;
+ main_out v_11 = {glFragColor};
+ return v_11;
}
main_outputs main(main_inputs inputs) {
- main_out v_8 = main_inner(inputs.tUV_param, inputs.tileID_1_param, inputs.levelUnits_param, inputs.stageUnits_1_param, inputs.vPosition_param, inputs.vUV_param);
- main_outputs v_9 = {v_8.glFragColor_1};
- return v_9;
+ main_out v_12 = main_inner(inputs.tUV_param, inputs.tileID_1_param, inputs.levelUnits_param, inputs.stageUnits_1_param, inputs.vPosition_param, inputs.vUV_param);
+ main_outputs v_13 = {v_12.glFragColor_1};
+ return v_13;
}
diff --git a/test/tint/bug/tint/948.wgsl.expected.ir.fxc.hlsl b/test/tint/bug/tint/948.wgsl.expected.ir.fxc.hlsl
index 7075d75..f6cbb6c 100644
--- a/test/tint/bug/tint/948.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/bug/tint/948.wgsl.expected.ir.fxc.hlsl
@@ -42,14 +42,17 @@
float x_25 = asfloat(x_20[6u].w);
fX = (x_15 / x_25);
float x_37 = fX;
- float4 x_40 = frameMapTexture.SampleBias(frameMapSampler, float2(x_37, 0.0f), 0.0f);
+ float2 v = float2(x_37, 0.0f);
+ float4 x_40 = frameMapTexture.SampleBias(frameMapSampler, v, clamp(0.0f, -16.0f, 15.9899997711181640625f));
float x_44 = fX;
- float4 x_47 = frameMapTexture.SampleBias(frameMapSampler, float2(x_44, 0.25f), 0.0f);
+ float2 v_1 = float2(x_44, 0.25f);
+ float4 x_47 = frameMapTexture.SampleBias(frameMapSampler, v_1, clamp(0.0f, -16.0f, 15.9899997711181640625f));
float x_51 = fX;
- float4 x_54 = frameMapTexture.SampleBias(frameMapSampler, float2(x_51, 0.5f), 0.0f);
- float4 v = float4(x_40[0u], x_40[1u], x_40[2u], x_40[3u]);
- float4 v_1 = float4(x_47[0u], x_47[1u], x_47[2u], x_47[3u]);
- return float4x4(v, v_1, float4(x_54[0u], x_54[1u], x_54[2u], x_54[3u]), (0.0f).xxxx);
+ float2 v_2 = float2(x_51, 0.5f);
+ float4 x_54 = frameMapTexture.SampleBias(frameMapSampler, v_2, clamp(0.0f, -16.0f, 15.9899997711181640625f));
+ float4 v_3 = float4(x_40[0u], x_40[1u], x_40[2u], x_40[3u]);
+ float4 v_4 = float4(x_47[0u], x_47[1u], x_47[2u], x_47[3u]);
+ return float4x4(v_3, v_4, float4(x_54[0u], x_54[1u], x_54[2u], x_54[3u]), (0.0f).xxxx);
}
void main_1() {
@@ -98,7 +101,7 @@
{
float2 x_150 = tileID;
float2 x_154 = asfloat(x_20[5u].zw);
- float4 x_156 = tileMapsTexture1.SampleBias(tileMapsSampler, ((x_150 + (0.5f).xx) / x_154), 0.0f);
+ float4 x_156 = tileMapsTexture1.SampleBias(tileMapsSampler, ((x_150 + (0.5f).xx) / x_154), clamp(0.0f, -16.0f, 15.9899997711181640625f));
frameID_1 = x_156[0u];
break;
}
@@ -106,7 +109,7 @@
{
float2 x_136 = tileID;
float2 x_140 = asfloat(x_20[5u].zw);
- float4 x_142 = tileMapsTexture0.SampleBias(tileMapsSampler, ((x_136 + (0.5f).xx) / x_140), 0.0f);
+ float4 x_142 = tileMapsTexture0.SampleBias(tileMapsSampler, ((x_136 + (0.5f).xx) / x_140), clamp(0.0f, -16.0f, 15.9899997711181640625f));
frameID_1 = x_142[0u];
break;
}
@@ -117,15 +120,16 @@
}
float x_166 = frameID_1;
float x_169 = asfloat(x_20[6u].w);
- float4 x_172 = animationMapTexture.SampleBias(animationMapSampler, float2(((x_166 + 0.5f) / x_169), 0.0f), 0.0f);
+ float2 v_5 = float2(((x_166 + 0.5f) / x_169), 0.0f);
+ float4 x_172 = animationMapTexture.SampleBias(animationMapSampler, v_5, clamp(0.0f, -16.0f, 15.9899997711181640625f));
animationData = x_172;
float x_174 = animationData.y;
if ((x_174 > 0.0f)) {
float x_181 = asfloat(x_20[0u].x);
float x_184 = animationData.z;
- float v_2 = ((x_181 * x_184) / 1.0f);
- float v_3 = floor(v_2);
- mt = (((x_181 * x_184) - (((v_2 < 0.0f)) ? (ceil(v_2)) : (v_3))) * 1.0f);
+ float v_6 = ((x_181 * x_184) / 1.0f);
+ float v_7 = floor(v_6);
+ mt = (((x_181 * x_184) - (((v_6 < 0.0f)) ? (ceil(v_6)) : (v_7))) * 1.0f);
f = 0.0f;
{
while(true) {
@@ -166,8 +170,8 @@
offset_1 = (float2(x_235[0u], x_235[1u]) * x_237);
float4 x_241 = frameData[int(2)];
float4 x_244 = frameData[int(0)];
- float2 v_4 = float2(x_241[0u], x_241[1u]);
- ratio = (v_4 / float2(x_244[3u], x_244[2u]));
+ float2 v_8 = float2(x_241[0u], x_241[1u]);
+ ratio = (v_8 / float2(x_244[3u], x_244[2u]));
float x_248 = frameData[int(2)].z;
if ((x_248 == 1.0f)) {
float2 x_252 = tileUV;
@@ -192,9 +196,9 @@
float4 x_290 = color;
float4 x_292 = nc;
float x_295 = nc.w;
- float3 v_5 = float3(x_290[0u], x_290[1u], x_290[2u]);
- float3 v_6 = float3(x_292[0u], x_292[1u], x_292[2u]);
- mixed = lerp(v_5, v_6, float3(x_295, x_295, x_295));
+ float3 v_9 = float3(x_290[0u], x_290[1u], x_290[2u]);
+ float3 v_10 = float3(x_292[0u], x_292[1u], x_292[2u]);
+ mixed = lerp(v_9, v_10, float3(x_295, x_295, x_295));
float3 x_298 = mixed;
float x_299 = alpha;
color = float4(x_298[0u], x_298[1u], x_298[2u], x_299);
@@ -223,13 +227,13 @@
vPosition = vPosition_param;
vUV = vUV_param;
main_1();
- main_out v_7 = {glFragColor};
- return v_7;
+ main_out v_11 = {glFragColor};
+ return v_11;
}
main_outputs main(main_inputs inputs) {
- main_out v_8 = main_inner(inputs.tUV_param, inputs.tileID_1_param, inputs.levelUnits_param, inputs.stageUnits_1_param, inputs.vPosition_param, inputs.vUV_param);
- main_outputs v_9 = {v_8.glFragColor_1};
- return v_9;
+ main_out v_12 = main_inner(inputs.tUV_param, inputs.tileID_1_param, inputs.levelUnits_param, inputs.stageUnits_1_param, inputs.vPosition_param, inputs.vUV_param);
+ main_outputs v_13 = {v_12.glFragColor_1};
+ return v_13;
}
diff --git a/test/tint/bug/tint/948.wgsl.expected.ir.glsl b/test/tint/bug/tint/948.wgsl.expected.ir.glsl
index 878117a..0ba58c7 100644
--- a/test/tint/bug/tint/948.wgsl.expected.ir.glsl
+++ b/test/tint/bug/tint/948.wgsl.expected.ir.glsl
@@ -52,14 +52,17 @@
float x_25 = v.inner.spriteCount;
fX = (x_15 / x_25);
float x_37 = fX;
- vec4 x_40 = texture(frameMapTexture_frameMapSampler, vec2(x_37, 0.0f), 0.0f);
+ vec2 v_1 = vec2(x_37, 0.0f);
+ vec4 x_40 = texture(frameMapTexture_frameMapSampler, v_1, clamp(0.0f, -16.0f, 15.9899997711181640625f));
float x_44 = fX;
- vec4 x_47 = texture(frameMapTexture_frameMapSampler, vec2(x_44, 0.25f), 0.0f);
+ vec2 v_2 = vec2(x_44, 0.25f);
+ vec4 x_47 = texture(frameMapTexture_frameMapSampler, v_2, clamp(0.0f, -16.0f, 15.9899997711181640625f));
float x_51 = fX;
- vec4 x_54 = texture(frameMapTexture_frameMapSampler, vec2(x_51, 0.5f), 0.0f);
- vec4 v_1 = vec4(x_40[0u], x_40[1u], x_40[2u], x_40[3u]);
- vec4 v_2 = vec4(x_47[0u], x_47[1u], x_47[2u], x_47[3u]);
- return mat4(v_1, v_2, vec4(x_54[0u], x_54[1u], x_54[2u], x_54[3u]), vec4(0.0f));
+ vec2 v_3 = vec2(x_51, 0.5f);
+ vec4 x_54 = texture(frameMapTexture_frameMapSampler, v_3, clamp(0.0f, -16.0f, 15.9899997711181640625f));
+ vec4 v_4 = vec4(x_40[0u], x_40[1u], x_40[2u], x_40[3u]);
+ vec4 v_5 = vec4(x_47[0u], x_47[1u], x_47[2u], x_47[3u]);
+ return mat4(v_4, v_5, vec4(x_54[0u], x_54[1u], x_54[2u], x_54[3u]), vec4(0.0f));
}
float tint_float_modulo(float x, float y) {
return (x - (y * trunc((x / y))));
@@ -110,7 +113,7 @@
{
vec2 x_150 = tileID;
vec2 x_154 = v.inner.stageSize;
- vec4 x_156 = texture(tileMapsTexture1_tileMapsSampler, ((x_150 + vec2(0.5f)) / x_154), 0.0f);
+ vec4 x_156 = texture(tileMapsTexture1_tileMapsSampler, ((x_150 + vec2(0.5f)) / x_154), clamp(0.0f, -16.0f, 15.9899997711181640625f));
frameID_1 = x_156[0u];
break;
}
@@ -118,7 +121,7 @@
{
vec2 x_136 = tileID;
vec2 x_140 = v.inner.stageSize;
- vec4 x_142 = texture(tileMapsTexture0_tileMapsSampler, ((x_136 + vec2(0.5f)) / x_140), 0.0f);
+ vec4 x_142 = texture(tileMapsTexture0_tileMapsSampler, ((x_136 + vec2(0.5f)) / x_140), clamp(0.0f, -16.0f, 15.9899997711181640625f));
frameID_1 = x_142[0u];
break;
}
@@ -129,7 +132,8 @@
}
float x_166 = frameID_1;
float x_169 = v.inner.spriteCount;
- vec4 x_172 = texture(animationMapTexture_animationMapSampler, vec2(((x_166 + 0.5f) / x_169), 0.0f), 0.0f);
+ vec2 v_6 = vec2(((x_166 + 0.5f) / x_169), 0.0f);
+ vec4 x_172 = texture(animationMapTexture_animationMapSampler, v_6, clamp(0.0f, -16.0f, 15.9899997711181640625f));
animationData = x_172;
float x_174 = animationData.y;
if ((x_174 > 0.0f)) {
@@ -176,8 +180,8 @@
offset_1 = (vec2(x_235[0u], x_235[1u]) * x_237);
vec4 x_241 = frameData[2];
vec4 x_244 = frameData[0];
- vec2 v_3 = vec2(x_241[0u], x_241[1u]);
- ratio = (v_3 / vec2(x_244[3u], x_244[2u]));
+ vec2 v_7 = vec2(x_241[0u], x_241[1u]);
+ ratio = (v_7 / vec2(x_244[3u], x_244[2u]));
float x_248 = frameData[2].z;
if ((x_248 == 1.0f)) {
vec2 x_252 = tileUV;
@@ -202,9 +206,9 @@
vec4 x_290 = color;
vec4 x_292 = nc;
float x_295 = nc.w;
- vec3 v_4 = vec3(x_290[0u], x_290[1u], x_290[2u]);
- vec3 v_5 = vec3(x_292[0u], x_292[1u], x_292[2u]);
- mixed = mix(v_4, v_5, vec3(x_295, x_295, x_295));
+ vec3 v_8 = vec3(x_290[0u], x_290[1u], x_290[2u]);
+ vec3 v_9 = vec3(x_292[0u], x_292[1u], x_292[2u]);
+ mixed = mix(v_8, v_9, vec3(x_295, x_295, x_295));
vec3 x_298 = mixed;
float x_299 = alpha;
color = vec4(x_298[0u], x_298[1u], x_298[2u], x_299);
diff --git a/test/tint/bug/tint/948.wgsl.expected.ir.msl b/test/tint/bug/tint/948.wgsl.expected.ir.msl
index d738f09..c1995e6 100644
--- a/test/tint/bug/tint/948.wgsl.expected.ir.msl
+++ b/test/tint/bug/tint/948.wgsl.expected.ir.msl
@@ -75,13 +75,13 @@
fX = (x_15 / x_25);
float const x_37 = fX;
float2 const v = float2(x_37, 0.0f);
- float4 const x_40 = tint_module_vars.frameMapTexture.sample(tint_module_vars.frameMapSampler, v, bias(0.0f));
+ float4 const x_40 = tint_module_vars.frameMapTexture.sample(tint_module_vars.frameMapSampler, v, bias(clamp(0.0f, -16.0f, 15.9899997711181640625f)));
float const x_44 = fX;
float2 const v_1 = float2(x_44, 0.25f);
- float4 const x_47 = tint_module_vars.frameMapTexture.sample(tint_module_vars.frameMapSampler, v_1, bias(0.0f));
+ float4 const x_47 = tint_module_vars.frameMapTexture.sample(tint_module_vars.frameMapSampler, v_1, bias(clamp(0.0f, -16.0f, 15.9899997711181640625f)));
float const x_51 = fX;
float2 const v_2 = float2(x_51, 0.5f);
- float4 const x_54 = tint_module_vars.frameMapTexture.sample(tint_module_vars.frameMapSampler, v_2, bias(0.0f));
+ float4 const x_54 = tint_module_vars.frameMapTexture.sample(tint_module_vars.frameMapSampler, v_2, bias(clamp(0.0f, -16.0f, 15.9899997711181640625f)));
float4 const v_3 = float4(x_40[0u], x_40[1u], x_40[2u], x_40[3u]);
float4 const v_4 = float4(x_47[0u], x_47[1u], x_47[2u], x_47[3u]);
return float4x4(v_3, v_4, float4(x_54[0u], x_54[1u], x_54[2u], x_54[3u]), float4(0.0f));
@@ -134,7 +134,7 @@
{
float2 const x_150 = tileID;
float2 const x_154 = (*tint_module_vars.x_20).stageSize;
- float4 const x_156 = tint_module_vars.tileMapsTexture1.sample(tint_module_vars.tileMapsSampler, ((x_150 + float2(0.5f)) / x_154), bias(0.0f));
+ float4 const x_156 = tint_module_vars.tileMapsTexture1.sample(tint_module_vars.tileMapsSampler, ((x_150 + float2(0.5f)) / x_154), bias(clamp(0.0f, -16.0f, 15.9899997711181640625f)));
frameID_1 = x_156[0u];
break;
}
@@ -142,7 +142,7 @@
{
float2 const x_136 = tileID;
float2 const x_140 = (*tint_module_vars.x_20).stageSize;
- float4 const x_142 = tint_module_vars.tileMapsTexture0.sample(tint_module_vars.tileMapsSampler, ((x_136 + float2(0.5f)) / x_140), bias(0.0f));
+ float4 const x_142 = tint_module_vars.tileMapsTexture0.sample(tint_module_vars.tileMapsSampler, ((x_136 + float2(0.5f)) / x_140), bias(clamp(0.0f, -16.0f, 15.9899997711181640625f)));
frameID_1 = x_142[0u];
break;
}
@@ -154,7 +154,7 @@
float const x_166 = frameID_1;
float const x_169 = (*tint_module_vars.x_20).spriteCount;
float2 const v_5 = float2(((x_166 + 0.5f) / x_169), 0.0f);
- float4 const x_172 = tint_module_vars.animationMapTexture.sample(tint_module_vars.animationMapSampler, v_5, bias(0.0f));
+ float4 const x_172 = tint_module_vars.animationMapTexture.sample(tint_module_vars.animationMapSampler, v_5, bias(clamp(0.0f, -16.0f, 15.9899997711181640625f)));
animationData = x_172;
float const x_174 = animationData[1u];
if ((x_174 > 0.0f)) {
diff --git a/test/tint/bug/tint/948.wgsl.expected.spvasm b/test/tint/bug/tint/948.wgsl.expected.spvasm
index e5037a2..b4ff42a 100644
--- a/test/tint/bug/tint/948.wgsl.expected.spvasm
+++ b/test/tint/bug/tint/948.wgsl.expected.spvasm
@@ -1,10 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 369
+; Bound: 377
; Schema: 0
OpCapability Shader
- %133 = OpExtInstImport "GLSL.std.450"
+ %69 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %main_loc2_Input %main_loc5_Input %main_loc4_Input %main_loc3_Input %main_loc0_Input %main_loc1_Input %main_loc0_Output
OpExecutionMode %main OriginUpperLeft
@@ -242,29 +242,31 @@
%uint_0 = OpConstant %uint 0
%uint_7 = OpConstant %uint 7
%float_0 = OpConstant %float 0
- %69 = OpTypeSampledImage %13
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %73 = OpTypeSampledImage %13
%float_0_25 = OpConstant %float 0.25
%float_0_5 = OpConstant %float 0.5
%void = OpTypeVoid
- %103 = OpTypeFunction %void
+ %109 = OpTypeFunction %void
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_ptr_Function_v2float = OpTypePointer Function %v2float
%int = OpTypeInt 32 1
%_ptr_Function_int = OpTypePointer Function %int
- %116 = OpConstantNull %int
+ %122 = OpConstantNull %int
%_ptr_Function_mat4v4float = OpTypePointer Function %mat4v4float
- %122 = OpConstantNull %mat4v4float
+ %128 = OpConstantNull %mat4v4float
%_ptr_Function_v3float = OpTypePointer Function %v3float
%uint_1 = OpConstant %uint 1
%float_1 = OpConstant %float 1
%_ptr_Uniform_v2float = OpTypePointer Uniform %v2float
%uint_5 = OpConstant %uint 5
- %147 = OpConstantComposite %v2float %float_1 %float_1
+ %152 = OpConstantComposite %v2float %float_1 %float_1
%uint_4 = OpConstant %uint 4
%int_0 = OpConstant %int 0
%int_2 = OpConstant %int 2
%bool = OpTypeBool
- %177 = OpConstantComposite %v2float %float_0_5 %float_0_5
+ %182 = OpConstantComposite %v2float %float_0_5 %float_0_5
%uint_2 = OpConstant %uint 2
%float_8 = OpConstant %float 8
%uint_3 = OpConstant %uint 3
@@ -272,7 +274,7 @@
%_ptr_Uniform_v3float = OpTypePointer Uniform %v3float
%uint_8 = OpConstant %uint 8
%main_out = OpTypeStruct %v4float
- %354 = OpTypeFunction %main_out %v2float %v2float %v2float %v2float %v3float %v2float
+ %362 = OpTypeFunction %main_out %v2float %v2float %v2float %v2float %v3float %v2float
%getFrameData_f1_ = OpFunction %mat4v4float None %53
%frameID_root = OpFunctionParameter %_ptr_Function_float
%54 = OpLabel
@@ -286,51 +288,54 @@
%64 = OpLoad %13 %frameMapTexture None
%65 = OpLoad %16 %frameMapSampler None
%66 = OpCompositeConstruct %v2float %x_37 %float_0
- %68 = OpSampledImage %69 %64 %65
- %x_40 = OpImageSampleImplicitLod %v4float %68 %66 Bias %float_0
+ %68 = OpExtInst %float %69 NClamp %float_0 %float_n16 %float_15_9899998
+ %72 = OpSampledImage %73 %64 %65
+ %x_40 = OpImageSampleImplicitLod %v4float %72 %66 Bias %68
%x_44 = OpLoad %float %fX None
- %72 = OpLoad %13 %frameMapTexture None
- %73 = OpLoad %16 %frameMapSampler None
- %74 = OpCompositeConstruct %v2float %x_44 %float_0_25
- %76 = OpSampledImage %69 %72 %73
- %x_47 = OpImageSampleImplicitLod %v4float %76 %74 Bias %float_0
+ %76 = OpLoad %13 %frameMapTexture None
+ %77 = OpLoad %16 %frameMapSampler None
+ %78 = OpCompositeConstruct %v2float %x_44 %float_0_25
+ %80 = OpExtInst %float %69 NClamp %float_0 %float_n16 %float_15_9899998
+ %81 = OpSampledImage %73 %76 %77
+ %x_47 = OpImageSampleImplicitLod %v4float %81 %78 Bias %80
%x_51 = OpLoad %float %fX None
- %79 = OpLoad %13 %frameMapTexture None
- %80 = OpLoad %16 %frameMapSampler None
- %81 = OpCompositeConstruct %v2float %x_51 %float_0_5
- %83 = OpSampledImage %69 %79 %80
- %x_54 = OpImageSampleImplicitLod %v4float %83 %81 Bias %float_0
- %85 = OpCompositeExtract %float %x_40 0
- %86 = OpCompositeExtract %float %x_40 1
- %87 = OpCompositeExtract %float %x_40 2
- %88 = OpCompositeExtract %float %x_40 3
- %89 = OpCompositeConstruct %v4float %85 %86 %87 %88
- %90 = OpCompositeExtract %float %x_47 0
- %91 = OpCompositeExtract %float %x_47 1
- %92 = OpCompositeExtract %float %x_47 2
- %93 = OpCompositeExtract %float %x_47 3
- %94 = OpCompositeConstruct %v4float %90 %91 %92 %93
- %95 = OpCompositeExtract %float %x_54 0
- %96 = OpCompositeExtract %float %x_54 1
- %97 = OpCompositeExtract %float %x_54 2
- %98 = OpCompositeExtract %float %x_54 3
- %99 = OpCompositeConstruct %v4float %95 %96 %97 %98
- %100 = OpCompositeConstruct %mat4v4float %89 %94 %99 %x_217
- OpReturnValue %100
+ %84 = OpLoad %13 %frameMapTexture None
+ %85 = OpLoad %16 %frameMapSampler None
+ %86 = OpCompositeConstruct %v2float %x_51 %float_0_5
+ %88 = OpExtInst %float %69 NClamp %float_0 %float_n16 %float_15_9899998
+ %89 = OpSampledImage %73 %84 %85
+ %x_54 = OpImageSampleImplicitLod %v4float %89 %86 Bias %88
+ %91 = OpCompositeExtract %float %x_40 0
+ %92 = OpCompositeExtract %float %x_40 1
+ %93 = OpCompositeExtract %float %x_40 2
+ %94 = OpCompositeExtract %float %x_40 3
+ %95 = OpCompositeConstruct %v4float %91 %92 %93 %94
+ %96 = OpCompositeExtract %float %x_47 0
+ %97 = OpCompositeExtract %float %x_47 1
+ %98 = OpCompositeExtract %float %x_47 2
+ %99 = OpCompositeExtract %float %x_47 3
+ %100 = OpCompositeConstruct %v4float %96 %97 %98 %99
+ %101 = OpCompositeExtract %float %x_54 0
+ %102 = OpCompositeExtract %float %x_54 1
+ %103 = OpCompositeExtract %float %x_54 2
+ %104 = OpCompositeExtract %float %x_54 3
+ %105 = OpCompositeConstruct %v4float %101 %102 %103 %104
+ %106 = OpCompositeConstruct %mat4v4float %95 %100 %105 %x_217
+ OpReturnValue %106
OpFunctionEnd
- %main_1 = OpFunction %void None %103
- %104 = OpLabel
+ %main_1 = OpFunction %void None %109
+ %110 = OpLabel
%color = OpVariable %_ptr_Function_v4float Function %x_217
%tileUV = OpVariable %_ptr_Function_v2float Function %19
%tileID = OpVariable %_ptr_Function_v2float Function %19
%sheetUnits = OpVariable %_ptr_Function_v2float Function %19
%spriteUnits = OpVariable %_ptr_Function_float Function %27
%stageUnits = OpVariable %_ptr_Function_v2float Function %19
- %i = OpVariable %_ptr_Function_int Function %116
+ %i = OpVariable %_ptr_Function_int Function %122
%frameID_1 = OpVariable %_ptr_Function_float Function %27
%animationData = OpVariable %_ptr_Function_v4float Function %x_217
%f = OpVariable %_ptr_Function_float Function %27
- %frameData = OpVariable %_ptr_Function_mat4v4float Function %122
+ %frameData = OpVariable %_ptr_Function_mat4v4float Function %128
%param = OpVariable %_ptr_Function_float Function %27
%frameSize = OpVariable %_ptr_Function_v2float Function %19
%offset_1 = OpVariable %_ptr_Function_v2float Function %19
@@ -340,297 +345,300 @@
%mixed = OpVariable %_ptr_Function_v3float Function %38
OpStore %color %x_217 None
%x_86 = OpLoad %v2float %tUV None
- %132 = OpExtInst %v2float %133 Fract %x_86
- OpStore %tileUV %132 None
- %134 = OpAccessChain %_ptr_Function_float %tileUV %uint_1
- %x_91 = OpLoad %float %134 None
- %137 = OpFSub %float %float_1 %x_91
+ %138 = OpExtInst %v2float %69 Fract %x_86
+ OpStore %tileUV %138 None
%139 = OpAccessChain %_ptr_Function_float %tileUV %uint_1
- OpStore %139 %137 None
+ %x_91 = OpLoad %float %139 None
+ %142 = OpFSub %float %float_1 %x_91
+ %144 = OpAccessChain %_ptr_Function_float %tileUV %uint_1
+ OpStore %144 %142 None
%x_95 = OpLoad %v2float %tUV None
- %141 = OpExtInst %v2float %133 Floor %x_95
- OpStore %tileID %141 None
- %142 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_5
- %x_101 = OpLoad %v2float %142 None
- %146 = OpFDiv %v2float %147 %x_101
- OpStore %sheetUnits %146 None
- %148 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_7
- %x_106 = OpLoad %float %148 None
- %150 = OpFDiv %float %float_1 %x_106
- OpStore %spriteUnits %150 None
- %151 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_4
- %x_111 = OpLoad %v2float %151 None
- %154 = OpFDiv %v2float %147 %x_111
- OpStore %stageUnits %154 None
+ %146 = OpExtInst %v2float %69 Floor %x_95
+ OpStore %tileID %146 None
+ %147 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_5
+ %x_101 = OpLoad %v2float %147 None
+ %151 = OpFDiv %v2float %152 %x_101
+ OpStore %sheetUnits %151 None
+ %153 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_7
+ %x_106 = OpLoad %float %153 None
+ %155 = OpFDiv %float %float_1 %x_106
+ OpStore %spriteUnits %155 None
+ %156 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_4
+ %x_111 = OpLoad %v2float %156 None
+ %159 = OpFDiv %v2float %152 %x_111
+ OpStore %stageUnits %159 None
OpStore %i %int_0 None
- OpBranch %158
- %158 = OpLabel
- OpLoopMerge %159 %157 None
- OpBranch %156
- %156 = OpLabel
+ OpBranch %163
+ %163 = OpLabel
+ OpLoopMerge %164 %162 None
+ OpBranch %161
+ %161 = OpLabel
%x_122 = OpLoad %int %i None
- %161 = OpSLessThan %bool %x_122 %int_2
- OpSelectionMerge %164 None
- OpBranchConditional %161 %164 %165
- %165 = OpLabel
- OpBranch %159
- %164 = OpLabel
- %x_126 = OpLoad %int %i None
- OpSelectionMerge %170 None
- OpSwitch %x_126 %167 1 %168 0 %169
- %168 = OpLabel
- %x_150 = OpLoad %v2float %tileID None
- %172 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_4
- %x_154 = OpLoad %v2float %172 None
- %174 = OpLoad %13 %tileMapsTexture1 None
- %175 = OpLoad %16 %tileMapsSampler None
- %176 = OpFAdd %v2float %x_150 %177
- %178 = OpFDiv %v2float %176 %x_154
- %179 = OpSampledImage %69 %174 %175
- %x_156 = OpImageSampleImplicitLod %v4float %179 %178 Bias %float_0
- %181 = OpCompositeExtract %float %x_156 0
- OpStore %frameID_1 %181 None
- OpBranch %170
- %169 = OpLabel
- %x_136 = OpLoad %v2float %tileID None
- %183 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_4
- %x_140 = OpLoad %v2float %183 None
- %185 = OpLoad %13 %tileMapsTexture0 None
- %186 = OpLoad %16 %tileMapsSampler None
- %187 = OpFAdd %v2float %x_136 %177
- %188 = OpFDiv %v2float %187 %x_140
- %189 = OpSampledImage %69 %185 %186
- %x_142 = OpImageSampleImplicitLod %v4float %189 %188 Bias %float_0
- %191 = OpCompositeExtract %float %x_142 0
- OpStore %frameID_1 %191 None
- OpBranch %170
- %167 = OpLabel
- OpBranch %170
+ %166 = OpSLessThan %bool %x_122 %int_2
+ OpSelectionMerge %169 None
+ OpBranchConditional %166 %169 %170
%170 = OpLabel
+ OpBranch %164
+ %169 = OpLabel
+ %x_126 = OpLoad %int %i None
+ OpSelectionMerge %175 None
+ OpSwitch %x_126 %172 1 %173 0 %174
+ %173 = OpLabel
+ %x_150 = OpLoad %v2float %tileID None
+ %177 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_4
+ %x_154 = OpLoad %v2float %177 None
+ %179 = OpLoad %13 %tileMapsTexture1 None
+ %180 = OpLoad %16 %tileMapsSampler None
+ %181 = OpFAdd %v2float %x_150 %182
+ %183 = OpFDiv %v2float %181 %x_154
+ %184 = OpExtInst %float %69 NClamp %float_0 %float_n16 %float_15_9899998
+ %185 = OpSampledImage %73 %179 %180
+ %x_156 = OpImageSampleImplicitLod %v4float %185 %183 Bias %184
+ %187 = OpCompositeExtract %float %x_156 0
+ OpStore %frameID_1 %187 None
+ OpBranch %175
+ %174 = OpLabel
+ %x_136 = OpLoad %v2float %tileID None
+ %189 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_4
+ %x_140 = OpLoad %v2float %189 None
+ %191 = OpLoad %13 %tileMapsTexture0 None
+ %192 = OpLoad %16 %tileMapsSampler None
+ %193 = OpFAdd %v2float %x_136 %182
+ %194 = OpFDiv %v2float %193 %x_140
+ %195 = OpExtInst %float %69 NClamp %float_0 %float_n16 %float_15_9899998
+ %196 = OpSampledImage %73 %191 %192
+ %x_142 = OpImageSampleImplicitLod %v4float %196 %194 Bias %195
+ %198 = OpCompositeExtract %float %x_142 0
+ OpStore %frameID_1 %198 None
+ OpBranch %175
+ %172 = OpLabel
+ OpBranch %175
+ %175 = OpLabel
%x_166 = OpLoad %float %frameID_1 None
- %193 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_7
- %x_169 = OpLoad %float %193 None
- %195 = OpLoad %13 %animationMapTexture None
- %196 = OpLoad %16 %animationMapSampler None
- %197 = OpFAdd %float %x_166 %float_0_5
- %198 = OpFDiv %float %197 %x_169
- %199 = OpCompositeConstruct %v2float %198 %float_0
- %200 = OpSampledImage %69 %195 %196
- %x_172 = OpImageSampleImplicitLod %v4float %200 %199 Bias %float_0
+ %200 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_7
+ %x_169 = OpLoad %float %200 None
+ %202 = OpLoad %13 %animationMapTexture None
+ %203 = OpLoad %16 %animationMapSampler None
+ %204 = OpFAdd %float %x_166 %float_0_5
+ %205 = OpFDiv %float %204 %x_169
+ %206 = OpCompositeConstruct %v2float %205 %float_0
+ %207 = OpExtInst %float %69 NClamp %float_0 %float_n16 %float_15_9899998
+ %208 = OpSampledImage %73 %202 %203
+ %x_172 = OpImageSampleImplicitLod %v4float %208 %206 Bias %207
OpStore %animationData %x_172 None
- %202 = OpAccessChain %_ptr_Function_float %animationData %uint_1
- %x_174 = OpLoad %float %202 None
- %204 = OpFOrdGreaterThan %bool %x_174 %float_0
- OpSelectionMerge %205 None
- OpBranchConditional %204 %206 %205
- %206 = OpLabel
- %207 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_0
- %x_181 = OpLoad %float %207 None
- %209 = OpAccessChain %_ptr_Function_float %animationData %uint_2
- %x_184 = OpLoad %float %209 None
- %212 = OpFMul %float %x_181 %x_184
- %213 = OpFRem %float %212 %float_1
- OpStore %mt %213 None
- OpStore %f %float_0 None
- OpBranch %216
- %216 = OpLabel
- OpLoopMerge %217 %215 None
- OpBranch %214
+ %210 = OpAccessChain %_ptr_Function_float %animationData %uint_1
+ %x_174 = OpLoad %float %210 None
+ %212 = OpFOrdGreaterThan %bool %x_174 %float_0
+ OpSelectionMerge %213 None
+ OpBranchConditional %212 %214 %213
%214 = OpLabel
- %x_193 = OpLoad %float %f None
- %219 = OpFOrdLessThan %bool %x_193 %float_8
- OpSelectionMerge %221 None
- OpBranchConditional %219 %221 %222
+ %215 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_0
+ %x_181 = OpLoad %float %215 None
+ %217 = OpAccessChain %_ptr_Function_float %animationData %uint_2
+ %x_184 = OpLoad %float %217 None
+ %220 = OpFMul %float %x_181 %x_184
+ %221 = OpFRem %float %220 %float_1
+ OpStore %mt %221 None
+ OpStore %f %float_0 None
+ OpBranch %224
+ %224 = OpLabel
+ OpLoopMerge %225 %223 None
+ OpBranch %222
%222 = OpLabel
- OpBranch %217
- %221 = OpLabel
- %223 = OpAccessChain %_ptr_Function_float %animationData %uint_1
- %x_197 = OpLoad %float %223 None
+ %x_193 = OpLoad %float %f None
+ %227 = OpFOrdLessThan %bool %x_193 %float_8
+ OpSelectionMerge %229 None
+ OpBranchConditional %227 %229 %230
+ %230 = OpLabel
+ OpBranch %225
+ %229 = OpLabel
+ %231 = OpAccessChain %_ptr_Function_float %animationData %uint_1
+ %x_197 = OpLoad %float %231 None
%x_198 = OpLoad %float %mt None
- %226 = OpFOrdGreaterThan %bool %x_197 %x_198
- OpSelectionMerge %227 None
- OpBranchConditional %226 %228 %227
- %228 = OpLabel
- %229 = OpAccessChain %_ptr_Function_float %animationData %uint_0
- %x_203 = OpLoad %float %229 None
+ %234 = OpFOrdGreaterThan %bool %x_197 %x_198
+ OpSelectionMerge %235 None
+ OpBranchConditional %234 %236 %235
+ %236 = OpLabel
+ %237 = OpAccessChain %_ptr_Function_float %animationData %uint_0
+ %x_203 = OpLoad %float %237 None
OpStore %frameID_1 %x_203 None
- OpBranch %217
- %227 = OpLabel
+ OpBranch %225
+ %235 = OpLabel
%x_208 = OpLoad %float %frameID_1 None
- %232 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_7
- %x_211 = OpLoad %float %232 None
+ %240 = OpAccessChain %_ptr_Uniform_float %1 %uint_0 %uint_7
+ %x_211 = OpLoad %float %240 None
%x_214 = OpLoad %float %f None
OpStore %animationData %x_217 None
- OpBranch %215
- %215 = OpLabel
+ OpBranch %223
+ %223 = OpLabel
%x_218 = OpLoad %float %f None
- %236 = OpFAdd %float %x_218 %float_1
- OpStore %f %236 None
- OpBranch %216
- %217 = OpLabel
- OpBranch %205
- %205 = OpLabel
+ %244 = OpFAdd %float %x_218 %float_1
+ OpStore %f %244 None
+ OpBranch %224
+ %225 = OpLabel
+ OpBranch %213
+ %213 = OpLabel
%x_222 = OpLoad %float %frameID_1 None
- %238 = OpFAdd %float %x_222 %float_0_5
- OpStore %param %238 None
+ %246 = OpFAdd %float %x_222 %float_0_5
+ OpStore %param %246 None
%x_225 = OpFunctionCall %mat4v4float %getFrameData_f1_ %param
OpStore %frameData %x_225 None
- %240 = OpAccessChain %_ptr_Function_v4float %frameData %int_0
- %x_228 = OpLoad %v4float %240 None
- %242 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_5
- %x_231 = OpLoad %v2float %242 None
- %244 = OpCompositeExtract %float %x_228 3
- %245 = OpCompositeExtract %float %x_228 2
- %246 = OpCompositeConstruct %v2float %244 %245
- %247 = OpFDiv %v2float %246 %x_231
- OpStore %frameSize %247 None
%248 = OpAccessChain %_ptr_Function_v4float %frameData %int_0
- %x_235 = OpLoad %v4float %248 None
+ %x_228 = OpLoad %v4float %248 None
+ %250 = OpAccessChain %_ptr_Uniform_v2float %1 %uint_0 %uint_5
+ %x_231 = OpLoad %v2float %250 None
+ %252 = OpCompositeExtract %float %x_228 3
+ %253 = OpCompositeExtract %float %x_228 2
+ %254 = OpCompositeConstruct %v2float %252 %253
+ %255 = OpFDiv %v2float %254 %x_231
+ OpStore %frameSize %255 None
+ %256 = OpAccessChain %_ptr_Function_v4float %frameData %int_0
+ %x_235 = OpLoad %v4float %256 None
%x_237 = OpLoad %v2float %sheetUnits None
- %251 = OpCompositeExtract %float %x_235 0
- %252 = OpCompositeExtract %float %x_235 1
- %253 = OpCompositeConstruct %v2float %251 %252
- %254 = OpFMul %v2float %253 %x_237
- OpStore %offset_1 %254 None
- %255 = OpAccessChain %_ptr_Function_v4float %frameData %int_2
- %x_241 = OpLoad %v4float %255 None
- %257 = OpAccessChain %_ptr_Function_v4float %frameData %int_0
- %x_244 = OpLoad %v4float %257 None
- %259 = OpCompositeExtract %float %x_241 0
- %260 = OpCompositeExtract %float %x_241 1
+ %259 = OpCompositeExtract %float %x_235 0
+ %260 = OpCompositeExtract %float %x_235 1
%261 = OpCompositeConstruct %v2float %259 %260
- %262 = OpCompositeExtract %float %x_244 3
- %263 = OpCompositeExtract %float %x_244 2
- %264 = OpCompositeConstruct %v2float %262 %263
- %265 = OpFDiv %v2float %261 %264
- OpStore %ratio %265 None
- %266 = OpAccessChain %_ptr_Function_v4float %frameData %int_2
- %267 = OpAccessChain %_ptr_Function_float %266 %uint_2
- %x_248 = OpLoad %float %267 None
- %269 = OpFOrdEqual %bool %x_248 %float_1
- OpSelectionMerge %270 None
- OpBranchConditional %269 %271 %270
- %271 = OpLabel
- %x_252 = OpLoad %v2float %tileUV None
- %273 = OpCompositeExtract %float %x_252 1
- %274 = OpCompositeExtract %float %x_252 0
- %275 = OpCompositeConstruct %v2float %273 %274
- OpStore %tileUV %275 None
- OpBranch %270
- %270 = OpLabel
- %x_254 = OpLoad %int %i None
- %277 = OpIEqual %bool %x_254 %int_0
+ %262 = OpFMul %v2float %261 %x_237
+ OpStore %offset_1 %262 None
+ %263 = OpAccessChain %_ptr_Function_v4float %frameData %int_2
+ %x_241 = OpLoad %v4float %263 None
+ %265 = OpAccessChain %_ptr_Function_v4float %frameData %int_0
+ %x_244 = OpLoad %v4float %265 None
+ %267 = OpCompositeExtract %float %x_241 0
+ %268 = OpCompositeExtract %float %x_241 1
+ %269 = OpCompositeConstruct %v2float %267 %268
+ %270 = OpCompositeExtract %float %x_244 3
+ %271 = OpCompositeExtract %float %x_244 2
+ %272 = OpCompositeConstruct %v2float %270 %271
+ %273 = OpFDiv %v2float %269 %272
+ OpStore %ratio %273 None
+ %274 = OpAccessChain %_ptr_Function_v4float %frameData %int_2
+ %275 = OpAccessChain %_ptr_Function_float %274 %uint_2
+ %x_248 = OpLoad %float %275 None
+ %277 = OpFOrdEqual %bool %x_248 %float_1
OpSelectionMerge %278 None
- OpBranchConditional %277 %279 %280
+ OpBranchConditional %277 %279 %278
%279 = OpLabel
+ %x_252 = OpLoad %v2float %tileUV None
+ %281 = OpCompositeExtract %float %x_252 1
+ %282 = OpCompositeExtract %float %x_252 0
+ %283 = OpCompositeConstruct %v2float %281 %282
+ OpStore %tileUV %283 None
+ OpBranch %278
+ %278 = OpLabel
+ %x_254 = OpLoad %int %i None
+ %285 = OpIEqual %bool %x_254 %int_0
+ OpSelectionMerge %286 None
+ OpBranchConditional %285 %287 %288
+ %287 = OpLabel
%x_263 = OpLoad %v2float %tileUV None
%x_264 = OpLoad %v2float %frameSize None
%x_266 = OpLoad %v2float %offset_1 None
- %284 = OpLoad %13 %spriteSheetTexture None
- %285 = OpLoad %16 %spriteSheetSampler None
- %286 = OpFMul %v2float %x_263 %x_264
- %287 = OpFAdd %v2float %286 %x_266
- %288 = OpSampledImage %69 %284 %285
- %x_268 = OpImageSampleImplicitLod %v4float %288 %287 None
+ %292 = OpLoad %13 %spriteSheetTexture None
+ %293 = OpLoad %16 %spriteSheetSampler None
+ %294 = OpFMul %v2float %x_263 %x_264
+ %295 = OpFAdd %v2float %294 %x_266
+ %296 = OpSampledImage %73 %292 %293
+ %x_268 = OpImageSampleImplicitLod %v4float %296 %295 None
OpStore %color %x_268 None
- OpBranch %278
- %280 = OpLabel
+ OpBranch %286
+ %288 = OpLabel
%x_274 = OpLoad %v2float %tileUV None
%x_275 = OpLoad %v2float %frameSize None
%x_277 = OpLoad %v2float %offset_1 None
- %293 = OpLoad %13 %spriteSheetTexture None
- %294 = OpLoad %16 %spriteSheetSampler None
- %295 = OpFMul %v2float %x_274 %x_275
- %296 = OpFAdd %v2float %295 %x_277
- %297 = OpSampledImage %69 %293 %294
- %x_279 = OpImageSampleImplicitLod %v4float %297 %296 None
+ %301 = OpLoad %13 %spriteSheetTexture None
+ %302 = OpLoad %16 %spriteSheetSampler None
+ %303 = OpFMul %v2float %x_274 %x_275
+ %304 = OpFAdd %v2float %303 %x_277
+ %305 = OpSampledImage %73 %301 %302
+ %x_279 = OpImageSampleImplicitLod %v4float %305 %304 None
OpStore %nc %x_279 None
- %299 = OpAccessChain %_ptr_Function_float %color %uint_3
- %x_283 = OpLoad %float %299 None
- %302 = OpAccessChain %_ptr_Function_float %nc %uint_3
- %x_285 = OpLoad %float %302 None
- %304 = OpFAdd %float %x_283 %x_285
- %305 = OpExtInst %float %133 FMin %304 %float_1
- OpStore %alpha %305 None
+ %307 = OpAccessChain %_ptr_Function_float %color %uint_3
+ %x_283 = OpLoad %float %307 None
+ %310 = OpAccessChain %_ptr_Function_float %nc %uint_3
+ %x_285 = OpLoad %float %310 None
+ %312 = OpFAdd %float %x_283 %x_285
+ %313 = OpExtInst %float %69 FMin %312 %float_1
+ OpStore %alpha %313 None
%x_290 = OpLoad %v4float %color None
%x_292 = OpLoad %v4float %nc None
- %308 = OpAccessChain %_ptr_Function_float %nc %uint_3
- %x_295 = OpLoad %float %308 None
- %310 = OpCompositeExtract %float %x_290 0
- %311 = OpCompositeExtract %float %x_290 1
- %312 = OpCompositeExtract %float %x_290 2
- %313 = OpCompositeConstruct %v3float %310 %311 %312
- %314 = OpCompositeExtract %float %x_292 0
- %315 = OpCompositeExtract %float %x_292 1
- %316 = OpCompositeExtract %float %x_292 2
- %317 = OpCompositeConstruct %v3float %314 %315 %316
- %318 = OpCompositeConstruct %v3float %x_295 %x_295 %x_295
- %319 = OpExtInst %v3float %133 FMix %313 %317 %318
- OpStore %mixed %319 None
+ %316 = OpAccessChain %_ptr_Function_float %nc %uint_3
+ %x_295 = OpLoad %float %316 None
+ %318 = OpCompositeExtract %float %x_290 0
+ %319 = OpCompositeExtract %float %x_290 1
+ %320 = OpCompositeExtract %float %x_290 2
+ %321 = OpCompositeConstruct %v3float %318 %319 %320
+ %322 = OpCompositeExtract %float %x_292 0
+ %323 = OpCompositeExtract %float %x_292 1
+ %324 = OpCompositeExtract %float %x_292 2
+ %325 = OpCompositeConstruct %v3float %322 %323 %324
+ %326 = OpCompositeConstruct %v3float %x_295 %x_295 %x_295
+ %327 = OpExtInst %v3float %69 FMix %321 %325 %326
+ OpStore %mixed %327 None
%x_298 = OpLoad %v3float %mixed None
%x_299 = OpLoad %float %alpha None
- %322 = OpCompositeExtract %float %x_298 0
- %323 = OpCompositeExtract %float %x_298 1
- %324 = OpCompositeExtract %float %x_298 2
- %325 = OpCompositeConstruct %v4float %322 %323 %324 %x_299
- OpStore %color %325 None
- OpBranch %278
- %278 = OpLabel
- OpBranch %157
- %157 = OpLabel
+ %330 = OpCompositeExtract %float %x_298 0
+ %331 = OpCompositeExtract %float %x_298 1
+ %332 = OpCompositeExtract %float %x_298 2
+ %333 = OpCompositeConstruct %v4float %330 %331 %332 %x_299
+ OpStore %color %333 None
+ OpBranch %286
+ %286 = OpLabel
+ OpBranch %162
+ %162 = OpLabel
%x_304 = OpLoad %int %i None
- %327 = OpIAdd %int %x_304 %int_1
- OpStore %i %327 None
- OpBranch %158
- %159 = OpLabel
- %329 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_8
- %x_310 = OpLoad %v3float %329 None
+ %335 = OpIAdd %int %x_304 %int_1
+ OpStore %i %335 None
+ OpBranch %163
+ %164 = OpLabel
+ %337 = OpAccessChain %_ptr_Uniform_v3float %1 %uint_0 %uint_8
+ %x_310 = OpLoad %v3float %337 None
%x_311 = OpLoad %v4float %color None
- %334 = OpCompositeExtract %float %x_311 0
- %335 = OpCompositeExtract %float %x_311 1
- %336 = OpCompositeExtract %float %x_311 2
- %337 = OpCompositeConstruct %v3float %334 %335 %336
- %x_313 = OpFMul %v3float %337 %x_310
+ %342 = OpCompositeExtract %float %x_311 0
+ %343 = OpCompositeExtract %float %x_311 1
+ %344 = OpCompositeExtract %float %x_311 2
+ %345 = OpCompositeConstruct %v3float %342 %343 %344
+ %x_313 = OpFMul %v3float %345 %x_310
%x_314 = OpLoad %v4float %color None
- %340 = OpCompositeExtract %float %x_313 0
- %341 = OpCompositeExtract %float %x_313 1
- %342 = OpCompositeExtract %float %x_313 2
- %343 = OpCompositeExtract %float %x_314 3
- %344 = OpCompositeConstruct %v4float %340 %341 %342 %343
- OpStore %color %344 None
+ %348 = OpCompositeExtract %float %x_313 0
+ %349 = OpCompositeExtract %float %x_313 1
+ %350 = OpCompositeExtract %float %x_313 2
+ %351 = OpCompositeExtract %float %x_314 3
+ %352 = OpCompositeConstruct %v4float %348 %349 %350 %351
+ OpStore %color %352 None
%x_318 = OpLoad %v4float %color None
OpStore %glFragColor %x_318 None
OpReturn
OpFunctionEnd
- %main_inner = OpFunction %main_out None %354
+ %main_inner = OpFunction %main_out None %362
%tUV_param = OpFunctionParameter %v2float
%tileID_1_param = OpFunctionParameter %v2float
%levelUnits_param = OpFunctionParameter %v2float
%stageUnits_1_param = OpFunctionParameter %v2float
%vPosition_param = OpFunctionParameter %v3float
%vUV_param = OpFunctionParameter %v2float
- %355 = OpLabel
+ %363 = OpLabel
OpStore %tUV %tUV_param None
OpStore %tileID_1 %tileID_1_param None
OpStore %levelUnits %levelUnits_param None
OpStore %stageUnits_1 %stageUnits_1_param None
OpStore %vPosition %vPosition_param None
OpStore %vUV %vUV_param None
- %356 = OpFunctionCall %void %main_1
- %357 = OpLoad %v4float %glFragColor None
- %358 = OpCompositeConstruct %main_out %357
- OpReturnValue %358
+ %364 = OpFunctionCall %void %main_1
+ %365 = OpLoad %v4float %glFragColor None
+ %366 = OpCompositeConstruct %main_out %365
+ OpReturnValue %366
OpFunctionEnd
- %main = OpFunction %void None %103
- %360 = OpLabel
- %361 = OpLoad %v2float %main_loc2_Input None
- %362 = OpLoad %v2float %main_loc5_Input None
- %363 = OpLoad %v2float %main_loc4_Input None
- %364 = OpLoad %v2float %main_loc3_Input None
- %365 = OpLoad %v3float %main_loc0_Input None
- %366 = OpLoad %v2float %main_loc1_Input None
- %367 = OpFunctionCall %main_out %main_inner %361 %362 %363 %364 %365 %366
- %368 = OpCompositeExtract %v4float %367 0
- OpStore %main_loc0_Output %368 None
+ %main = OpFunction %void None %109
+ %368 = OpLabel
+ %369 = OpLoad %v2float %main_loc2_Input None
+ %370 = OpLoad %v2float %main_loc5_Input None
+ %371 = OpLoad %v2float %main_loc4_Input None
+ %372 = OpLoad %v2float %main_loc3_Input None
+ %373 = OpLoad %v3float %main_loc0_Input None
+ %374 = OpLoad %v2float %main_loc1_Input None
+ %375 = OpFunctionCall %main_out %main_inner %369 %370 %371 %372 %373 %374
+ %376 = OpCompositeExtract %v4float %375 0
+ OpStore %main_loc0_Output %376 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.dxc.hlsl
index df89034..24bab18 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,8 @@
Texture2DArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_1c707e() {
- float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(1u)), 1.0f);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(1u)), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.fxc.hlsl
index df89034..24bab18 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,8 @@
Texture2DArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_1c707e() {
- float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(1u)), 1.0f);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(1u)), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.glsl
index 8fdd8d5..8413fda 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.glsl
@@ -8,7 +8,8 @@
} v;
uniform highp sampler2DArray arg_0_arg_1;
vec4 textureSampleBias_1c707e() {
- vec4 res = texture(arg_0_arg_1, vec3(vec2(1.0f), float(1u)), 1.0f);
+ float v_1 = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ vec4 res = texture(arg_0_arg_1, vec3(vec2(1.0f), float(1u)), v_1);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.msl
index fbee790..1612021 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_1c707e(tint_module_vars_struct tint_module_vars) {
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), 1u, bias(1.0f));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), 1u, bias(clamp(1.0f, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.spvasm
index 818eee1..d1b4df7 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/1c707e.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 39
+; Bound: 43
; Schema: 0
OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -35,16 +36,18 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
+ %float_1 = OpConstant %float 1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%v3float = OpTypeVector %float 3
%v2float = OpTypeVector %float 2
- %float_1 = OpConstant %float 1
- %24 = OpConstantComposite %v2float %float_1 %float_1
+ %29 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %33 = OpTypeFunction %void
+ %37 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint_0 = OpConstant %uint 0
%textureSampleBias_1c707e = OpFunction %v4float None %13
@@ -52,18 +55,19 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpConvertUToF %float %uint_1
- %23 = OpCompositeConstruct %v3float %24 %19
- %27 = OpImageSampleImplicitLod %v4float %17 %23 Bias %float_1
- OpStore %res %27
- %30 = OpLoad %v4float %res None
- OpReturnValue %30
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpConvertUToF %float %uint_1
+ %28 = OpCompositeConstruct %v3float %29 %24
+ %31 = OpImageSampleImplicitLod %v4float %22 %28 Bias %17
+ OpStore %res %31
+ %34 = OpLoad %v4float %res None
+ OpReturnValue %34
OpFunctionEnd
-%fragment_main = OpFunction %void None %33
- %34 = OpLabel
- %35 = OpFunctionCall %v4float %textureSampleBias_1c707e
- %36 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %36 %35 None
+%fragment_main = OpFunction %void None %37
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %textureSampleBias_1c707e
+ %40 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %40 %39 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.dxc.hlsl
index ab7028c..2dfed2f 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,7 @@
TextureCube<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_53b9f7() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, 1.0f);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.fxc.hlsl
index ab7028c..2dfed2f 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,7 @@
TextureCube<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_53b9f7() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, 1.0f);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.glsl
index e4012f0..94d8a0f 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
uniform highp samplerCube arg_0_arg_1;
vec4 textureSampleBias_53b9f7() {
- vec4 res = texture(arg_0_arg_1, vec3(1.0f), 1.0f);
+ vec4 res = texture(arg_0_arg_1, vec3(1.0f), clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.msl
index d09e0b9..6d3df1e 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_53b9f7(tint_module_vars_struct tint_module_vars) {
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float3(1.0f), bias(1.0f));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float3(1.0f), bias(clamp(1.0f, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.spvasm
index dab6416..4606b11 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/53b9f7.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 35
+; Bound: 39
; Schema: 0
OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -35,13 +36,15 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
- %v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
- %20 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
+ %v3float = OpTypeVector %float 3
+ %25 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %28 = OpTypeFunction %void
+ %32 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -50,16 +53,17 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpImageSampleImplicitLod %v4float %17 %20 Bias %float_1
- OpStore %res %19
- %25 = OpLoad %v4float %res None
- OpReturnValue %25
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpImageSampleImplicitLod %v4float %22 %25 Bias %17
+ OpStore %res %24
+ %29 = OpLoad %v4float %res None
+ OpReturnValue %29
OpFunctionEnd
-%fragment_main = OpFunction %void None %28
- %29 = OpLabel
- %30 = OpFunctionCall %v4float %textureSampleBias_53b9f7
- %31 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %31 %30 None
+%fragment_main = OpFunction %void None %32
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %textureSampleBias_53b9f7
+ %35 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %35 %34 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.dxc.hlsl
index d5289e1..b25bad2 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,7 @@
Texture3D<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_594824() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, 1.0f, (int(1)).xxx);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, clamp(1.0f, -16.0f, 15.9899997711181640625f), (int(1)).xxx);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.fxc.hlsl
index d5289e1..b25bad2 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,7 @@
Texture3D<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_594824() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, 1.0f, (int(1)).xxx);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, clamp(1.0f, -16.0f, 15.9899997711181640625f), (int(1)).xxx);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.glsl
index 42f2231..d7b1a19 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
uniform highp sampler3D arg_0_arg_1;
vec4 textureSampleBias_594824() {
- vec4 res = textureOffset(arg_0_arg_1, vec3(1.0f), ivec3(1), 1.0f);
+ vec4 res = textureOffset(arg_0_arg_1, vec3(1.0f), ivec3(1), clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.msl
index 669ac92..10469d4 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_594824(tint_module_vars_struct tint_module_vars) {
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float3(1.0f), bias(1.0f), int3(1));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float3(1.0f), bias(clamp(1.0f, -16.0f, 15.9899997711181640625f)), int3(1));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm
index 2161688..df42989 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/594824.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 39
+; Bound: 43
; Schema: 0
OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -35,17 +36,19 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
- %v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
- %20 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
+ %v3float = OpTypeVector %float 3
+ %25 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%int_1 = OpConstant %int 1
- %23 = OpConstantComposite %v3int %int_1 %int_1 %int_1
+ %27 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %32 = OpTypeFunction %void
+ %36 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -54,16 +57,17 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpImageSampleImplicitLod %v4float %17 %20 Bias|ConstOffset %float_1 %23
- OpStore %res %19
- %29 = OpLoad %v4float %res None
- OpReturnValue %29
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpImageSampleImplicitLod %v4float %22 %25 Bias|ConstOffset %17 %27
+ OpStore %res %24
+ %33 = OpLoad %v4float %res None
+ OpReturnValue %33
OpFunctionEnd
-%fragment_main = OpFunction %void None %32
- %33 = OpLabel
- %34 = OpFunctionCall %v4float %textureSampleBias_594824
- %35 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %35 %34 None
+%fragment_main = OpFunction %void None %36
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %textureSampleBias_594824
+ %39 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %39 %38 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.dxc.hlsl
index 32690b5..80cdbd3 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,7 @@
Texture2D<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_6a9113() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xx, 1.0f);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xx, clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.fxc.hlsl
index 32690b5..80cdbd3 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,7 @@
Texture2D<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_6a9113() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xx, 1.0f);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xx, clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.glsl
index 0e9fd46..b0903f6 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
uniform highp sampler2D arg_0_arg_1;
vec4 textureSampleBias_6a9113() {
- vec4 res = texture(arg_0_arg_1, vec2(1.0f), 1.0f);
+ vec4 res = texture(arg_0_arg_1, vec2(1.0f), clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.msl
index 8261d83..9c1f92d 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_6a9113(tint_module_vars_struct tint_module_vars) {
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), bias(1.0f));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), bias(clamp(1.0f, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.spvasm
index 9239730..17708dc 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/6a9113.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 35
+; Bound: 39
; Schema: 0
OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -35,13 +36,15 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
- %v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
- %20 = OpConstantComposite %v2float %float_1 %float_1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
+ %v2float = OpTypeVector %float 2
+ %25 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %28 = OpTypeFunction %void
+ %32 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -50,16 +53,17 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpImageSampleImplicitLod %v4float %17 %20 Bias %float_1
- OpStore %res %19
- %25 = OpLoad %v4float %res None
- OpReturnValue %25
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpImageSampleImplicitLod %v4float %22 %25 Bias %17
+ OpStore %res %24
+ %29 = OpLoad %v4float %res None
+ OpReturnValue %29
OpFunctionEnd
-%fragment_main = OpFunction %void None %28
- %29 = OpLabel
- %30 = OpFunctionCall %v4float %textureSampleBias_6a9113
- %31 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %31 %30 None
+%fragment_main = OpFunction %void None %32
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %textureSampleBias_6a9113
+ %35 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %35 %34 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.dxc.hlsl
index a7f90f1..a725e32 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,8 @@
Texture2DArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_80e579() {
- float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(int(1))), 1.0f);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(int(1))), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.fxc.hlsl
index a7f90f1..a725e32 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,8 @@
Texture2DArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_80e579() {
- float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(int(1))), 1.0f);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(int(1))), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.glsl
index f990a13..86e2fd2 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.glsl
@@ -8,7 +8,8 @@
} v;
uniform highp sampler2DArray arg_0_arg_1;
vec4 textureSampleBias_80e579() {
- vec4 res = texture(arg_0_arg_1, vec3(vec2(1.0f), float(1)), 1.0f);
+ float v_1 = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ vec4 res = texture(arg_0_arg_1, vec3(vec2(1.0f), float(1)), v_1);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.msl
index d7a327d..86ce71d 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_80e579(tint_module_vars_struct tint_module_vars) {
- bias const v = bias(1.0f);
+ bias const v = bias(clamp(1.0f, -16.0f, 15.9899997711181640625f));
float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), max(1, 0), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.spvasm
index 2137bab..0008ea3 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/80e579.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 40
+; Bound: 44
; Schema: 0
OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -35,16 +36,18 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
+ %float_1 = OpConstant %float 1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%v3float = OpTypeVector %float 3
%v2float = OpTypeVector %float 2
- %float_1 = OpConstant %float 1
- %24 = OpConstantComposite %v2float %float_1 %float_1
+ %29 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %33 = OpTypeFunction %void
+ %37 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -53,18 +56,19 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpConvertSToF %float %int_1
- %23 = OpCompositeConstruct %v3float %24 %19
- %27 = OpImageSampleImplicitLod %v4float %17 %23 Bias %float_1
- OpStore %res %27
- %30 = OpLoad %v4float %res None
- OpReturnValue %30
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpConvertSToF %float %int_1
+ %28 = OpCompositeConstruct %v3float %29 %24
+ %31 = OpImageSampleImplicitLod %v4float %22 %28 Bias %17
+ OpStore %res %31
+ %34 = OpLoad %v4float %res None
+ OpReturnValue %34
OpFunctionEnd
-%fragment_main = OpFunction %void None %33
- %34 = OpLabel
- %35 = OpFunctionCall %v4float %textureSampleBias_80e579
- %36 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %36 %35 None
+%fragment_main = OpFunction %void None %37
+ %38 = OpLabel
+ %39 = OpFunctionCall %v4float %textureSampleBias_80e579
+ %40 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %40 %39 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.dxc.hlsl
index 891ac22..11706fd 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,8 @@
Texture2DArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_87915c() {
- float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(1u)), 1.0f, (int(1)).xx);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(1u)), v, (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.fxc.hlsl
index 891ac22..11706fd 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,8 @@
Texture2DArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_87915c() {
- float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(1u)), 1.0f, (int(1)).xx);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(1u)), v, (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.glsl
index 616723b..40b8a92 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.glsl
@@ -8,7 +8,8 @@
} v;
uniform highp sampler2DArray arg_0_arg_1;
vec4 textureSampleBias_87915c() {
- vec4 res = textureOffset(arg_0_arg_1, vec3(vec2(1.0f), float(1u)), ivec2(1), 1.0f);
+ float v_1 = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ vec4 res = textureOffset(arg_0_arg_1, vec3(vec2(1.0f), float(1u)), ivec2(1), v_1);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.msl
index 5fc3e2a..7e818a4 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_87915c(tint_module_vars_struct tint_module_vars) {
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), 1u, bias(1.0f), int2(1));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), 1u, bias(clamp(1.0f, -16.0f, 15.9899997711181640625f)), int2(1));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.spvasm
index d76d7c4..0724f93 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/87915c.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 43
+; Bound: 47
; Schema: 0
OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -35,20 +36,22 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
+ %float_1 = OpConstant %float 1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%v3float = OpTypeVector %float 3
%v2float = OpTypeVector %float 2
- %float_1 = OpConstant %float 1
- %24 = OpConstantComposite %v2float %float_1 %float_1
+ %29 = OpConstantComposite %v2float %float_1 %float_1
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
- %28 = OpConstantComposite %v2int %int_1 %int_1
+ %32 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %37 = OpTypeFunction %void
+ %41 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint_0 = OpConstant %uint 0
%textureSampleBias_87915c = OpFunction %v4float None %13
@@ -56,18 +59,19 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpConvertUToF %float %uint_1
- %23 = OpCompositeConstruct %v3float %24 %19
- %27 = OpImageSampleImplicitLod %v4float %17 %23 Bias|ConstOffset %float_1 %28
- OpStore %res %27
- %34 = OpLoad %v4float %res None
- OpReturnValue %34
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpConvertUToF %float %uint_1
+ %28 = OpCompositeConstruct %v3float %29 %24
+ %31 = OpImageSampleImplicitLod %v4float %22 %28 Bias|ConstOffset %17 %32
+ OpStore %res %31
+ %38 = OpLoad %v4float %res None
+ OpReturnValue %38
OpFunctionEnd
-%fragment_main = OpFunction %void None %37
- %38 = OpLabel
- %39 = OpFunctionCall %v4float %textureSampleBias_87915c
- %40 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %40 %39 None
+%fragment_main = OpFunction %void None %41
+ %42 = OpLabel
+ %43 = OpFunctionCall %v4float %textureSampleBias_87915c
+ %44 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %44 %43 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.dxc.hlsl
index e1674b7..5b23918 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,8 @@
Texture2DArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_9dbb51() {
- float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(int(1))), 1.0f, (int(1)).xx);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(int(1))), v, (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.fxc.hlsl
index e1674b7..5b23918 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,8 @@
Texture2DArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_9dbb51() {
- float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(int(1))), 1.0f, (int(1)).xx);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3((1.0f).xx, float(int(1))), v, (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.glsl
index 01a5606..4d09aa9 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.glsl
@@ -8,7 +8,8 @@
} v;
uniform highp sampler2DArray arg_0_arg_1;
vec4 textureSampleBias_9dbb51() {
- vec4 res = textureOffset(arg_0_arg_1, vec3(vec2(1.0f), float(1)), ivec2(1), 1.0f);
+ float v_1 = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ vec4 res = textureOffset(arg_0_arg_1, vec3(vec2(1.0f), float(1)), ivec2(1), v_1);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.msl
index 19948af..4cee582 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_9dbb51(tint_module_vars_struct tint_module_vars) {
- bias const v = bias(1.0f);
+ bias const v = bias(clamp(1.0f, -16.0f, 15.9899997711181640625f));
float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), max(1, 0), v, int2(1));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm
index ba017f5..5012829 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/9dbb51.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 42
+; Bound: 46
; Schema: 0
OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -35,18 +36,20 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
+ %float_1 = OpConstant %float 1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%v3float = OpTypeVector %float 3
%v2float = OpTypeVector %float 2
- %float_1 = OpConstant %float 1
- %24 = OpConstantComposite %v2float %float_1 %float_1
+ %29 = OpConstantComposite %v2float %float_1 %float_1
%v2int = OpTypeVector %int 2
- %28 = OpConstantComposite %v2int %int_1 %int_1
+ %32 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %35 = OpTypeFunction %void
+ %39 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -55,18 +58,19 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpConvertSToF %float %int_1
- %23 = OpCompositeConstruct %v3float %24 %19
- %27 = OpImageSampleImplicitLod %v4float %17 %23 Bias|ConstOffset %float_1 %28
- OpStore %res %27
- %32 = OpLoad %v4float %res None
- OpReturnValue %32
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpConvertSToF %float %int_1
+ %28 = OpCompositeConstruct %v3float %29 %24
+ %31 = OpImageSampleImplicitLod %v4float %22 %28 Bias|ConstOffset %17 %32
+ OpStore %res %31
+ %36 = OpLoad %v4float %res None
+ OpReturnValue %36
OpFunctionEnd
-%fragment_main = OpFunction %void None %35
- %36 = OpLabel
- %37 = OpFunctionCall %v4float %textureSampleBias_9dbb51
- %38 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %38 %37 None
+%fragment_main = OpFunction %void None %39
+ %40 = OpLabel
+ %41 = OpFunctionCall %v4float %textureSampleBias_9dbb51
+ %42 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %42 %41 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.dxc.hlsl
index 84901a1..3d8f3a4 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,7 @@
Texture2D<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_a161cf() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xx, 1.0f, (int(1)).xx);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xx, clamp(1.0f, -16.0f, 15.9899997711181640625f), (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.fxc.hlsl
index 84901a1..3d8f3a4 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,7 @@
Texture2D<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_a161cf() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xx, 1.0f, (int(1)).xx);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xx, clamp(1.0f, -16.0f, 15.9899997711181640625f), (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.glsl
index 36bc575..1c82e21 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
uniform highp sampler2D arg_0_arg_1;
vec4 textureSampleBias_a161cf() {
- vec4 res = textureOffset(arg_0_arg_1, vec2(1.0f), ivec2(1), 1.0f);
+ vec4 res = textureOffset(arg_0_arg_1, vec2(1.0f), ivec2(1), clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.msl
index 5c4286b..31b690b 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_a161cf(tint_module_vars_struct tint_module_vars) {
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), bias(1.0f), int2(1));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float2(1.0f), bias(clamp(1.0f, -16.0f, 15.9899997711181640625f)), int2(1));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm
index 845c533..8f2c3c0 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/a161cf.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 39
+; Bound: 43
; Schema: 0
OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -35,17 +36,19 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
- %v2float = OpTypeVector %float 2
%float_1 = OpConstant %float 1
- %20 = OpConstantComposite %v2float %float_1 %float_1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
+ %v2float = OpTypeVector %float 2
+ %25 = OpConstantComposite %v2float %float_1 %float_1
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
- %23 = OpConstantComposite %v2int %int_1 %int_1
+ %27 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %32 = OpTypeFunction %void
+ %36 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -54,16 +57,17 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpImageSampleImplicitLod %v4float %17 %20 Bias|ConstOffset %float_1 %23
- OpStore %res %19
- %29 = OpLoad %v4float %res None
- OpReturnValue %29
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpImageSampleImplicitLod %v4float %22 %25 Bias|ConstOffset %17 %27
+ OpStore %res %24
+ %33 = OpLoad %v4float %res None
+ OpReturnValue %33
OpFunctionEnd
-%fragment_main = OpFunction %void None %32
- %33 = OpLabel
- %34 = OpFunctionCall %v4float %textureSampleBias_a161cf
- %35 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %35 %34 None
+%fragment_main = OpFunction %void None %36
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %textureSampleBias_a161cf
+ %39 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %39 %38 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.dxc.hlsl
index 82a143f..aff9eb8 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,8 @@
TextureCubeArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_c6953d() {
- float4 res = arg_0.SampleBias(arg_1, float4((1.0f).xxx, float(1u)), 1.0f);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float4((1.0f).xxx, float(1u)), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.fxc.hlsl
index 82a143f..aff9eb8 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,8 @@
TextureCubeArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_c6953d() {
- float4 res = arg_0.SampleBias(arg_1, float4((1.0f).xxx, float(1u)), 1.0f);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float4((1.0f).xxx, float(1u)), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.glsl
index c3e43a0..ac22f82 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.glsl
@@ -8,7 +8,8 @@
} v;
uniform highp samplerCubeArray arg_0_arg_1;
vec4 textureSampleBias_c6953d() {
- vec4 res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1u)), 1.0f);
+ float v_1 = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ vec4 res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1u)), v_1);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.msl
index 3ee58f5..255a33e 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_c6953d(tint_module_vars_struct tint_module_vars) {
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float3(1.0f), 1u, bias(1.0f));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float3(1.0f), 1u, bias(clamp(1.0f, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.spvasm
index 56be299..020a4f8 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/c6953d.wgsl.expected.spvasm
@@ -1,10 +1,11 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 38
+; Bound: 42
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -36,15 +37,17 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
+ %float_1 = OpConstant %float 1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
%uint = OpTypeInt 32 0
%uint_1 = OpConstant %uint 1
%v3float = OpTypeVector %float 3
- %float_1 = OpConstant %float 1
- %23 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %28 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %32 = OpTypeFunction %void
+ %36 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint_0 = OpConstant %uint 0
%textureSampleBias_c6953d = OpFunction %v4float None %13
@@ -52,18 +55,19 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpConvertUToF %float %uint_1
- %22 = OpCompositeConstruct %v4float %23 %19
- %26 = OpImageSampleImplicitLod %v4float %17 %22 Bias %float_1
- OpStore %res %26
- %29 = OpLoad %v4float %res None
- OpReturnValue %29
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpConvertUToF %float %uint_1
+ %27 = OpCompositeConstruct %v4float %28 %24
+ %30 = OpImageSampleImplicitLod %v4float %22 %27 Bias %17
+ OpStore %res %30
+ %33 = OpLoad %v4float %res None
+ OpReturnValue %33
OpFunctionEnd
-%fragment_main = OpFunction %void None %32
- %33 = OpLabel
- %34 = OpFunctionCall %v4float %textureSampleBias_c6953d
- %35 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %35 %34 None
+%fragment_main = OpFunction %void None %36
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %textureSampleBias_c6953d
+ %39 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %39 %38 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.dxc.hlsl
index fe38756..5d3899d 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,7 @@
Texture3D<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_d3fa1b() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, 1.0f);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.fxc.hlsl
index fe38756..5d3899d 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,7 @@
Texture3D<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_d3fa1b() {
- float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, 1.0f);
+ float4 res = arg_0.SampleBias(arg_1, (1.0f).xxx, clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.glsl
index fbbcc8d..6691103 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.glsl
@@ -8,7 +8,7 @@
} v;
uniform highp sampler3D arg_0_arg_1;
vec4 textureSampleBias_d3fa1b() {
- vec4 res = texture(arg_0_arg_1, vec3(1.0f), 1.0f);
+ vec4 res = texture(arg_0_arg_1, vec3(1.0f), clamp(1.0f, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.msl
index e55c864..8b1b733 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_d3fa1b(tint_module_vars_struct tint_module_vars) {
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float3(1.0f), bias(1.0f));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float3(1.0f), bias(clamp(1.0f, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.spvasm
index 0025644..275ac63 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/d3fa1b.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 35
+; Bound: 39
; Schema: 0
OpCapability Shader
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -35,13 +36,15 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
- %v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
- %20 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
+ %v3float = OpTypeVector %float 3
+ %25 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %28 = OpTypeFunction %void
+ %32 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -50,16 +53,17 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpImageSampleImplicitLod %v4float %17 %20 Bias %float_1
- OpStore %res %19
- %25 = OpLoad %v4float %res None
- OpReturnValue %25
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpImageSampleImplicitLod %v4float %22 %25 Bias %17
+ OpStore %res %24
+ %29 = OpLoad %v4float %res None
+ OpReturnValue %29
OpFunctionEnd
-%fragment_main = OpFunction %void None %28
- %29 = OpLabel
- %30 = OpFunctionCall %v4float %textureSampleBias_d3fa1b
- %31 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %31 %30 None
+%fragment_main = OpFunction %void None %32
+ %33 = OpLabel
+ %34 = OpFunctionCall %v4float %textureSampleBias_d3fa1b
+ %35 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %35 %34 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.dxc.hlsl
index f239304..3500cde 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.dxc.hlsl
@@ -3,7 +3,8 @@
TextureCubeArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_eed7c4() {
- float4 res = arg_0.SampleBias(arg_1, float4((1.0f).xxx, float(int(1))), 1.0f);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float4((1.0f).xxx, float(int(1))), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.fxc.hlsl
index f239304..3500cde 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.fxc.hlsl
@@ -3,7 +3,8 @@
TextureCubeArray<float4> arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
float4 textureSampleBias_eed7c4() {
- float4 res = arg_0.SampleBias(arg_1, float4((1.0f).xxx, float(int(1))), 1.0f);
+ float v = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float4((1.0f).xxx, float(int(1))), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.glsl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.glsl
index 050d1ff..7cb50ed 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.glsl
@@ -8,7 +8,8 @@
} v;
uniform highp samplerCubeArray arg_0_arg_1;
vec4 textureSampleBias_eed7c4() {
- vec4 res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1)), 1.0f);
+ float v_1 = clamp(1.0f, -16.0f, 15.9899997711181640625f);
+ vec4 res = texture(arg_0_arg_1, vec4(vec3(1.0f), float(1)), v_1);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.msl b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.msl
index 7d34af6..fc89a09 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.ir.msl
@@ -8,7 +8,7 @@
};
float4 textureSampleBias_eed7c4(tint_module_vars_struct tint_module_vars) {
- bias const v = bias(1.0f);
+ bias const v = bias(clamp(1.0f, -16.0f, 15.9899997711181640625f));
float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, float3(1.0f), max(1, 0), v);
return res;
}
diff --git a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.spvasm b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.spvasm
index 4c93d33..80422eb 100644
--- a/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/literal/textureSampleBias/eed7c4.wgsl.expected.spvasm
@@ -1,10 +1,11 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 39
+; Bound: 43
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
+ %18 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -36,15 +37,17 @@
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
%13 = OpTypeFunction %v4float
- %18 = OpTypeSampledImage %8
+ %float_1 = OpConstant %float 1
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %23 = OpTypeSampledImage %8
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%v3float = OpTypeVector %float 3
- %float_1 = OpConstant %float 1
- %23 = OpConstantComposite %v3float %float_1 %float_1 %float_1
+ %28 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %32 = OpTypeFunction %void
+ %36 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -53,18 +56,19 @@
%res = OpVariable %_ptr_Function_v4float Function
%15 = OpLoad %8 %arg_0 None
%16 = OpLoad %11 %arg_1 None
- %17 = OpSampledImage %18 %15 %16
- %19 = OpConvertSToF %float %int_1
- %22 = OpCompositeConstruct %v4float %23 %19
- %26 = OpImageSampleImplicitLod %v4float %17 %22 Bias %float_1
- OpStore %res %26
- %29 = OpLoad %v4float %res None
- OpReturnValue %29
+ %17 = OpExtInst %float %18 NClamp %float_1 %float_n16 %float_15_9899998
+ %22 = OpSampledImage %23 %15 %16
+ %24 = OpConvertSToF %float %int_1
+ %27 = OpCompositeConstruct %v4float %28 %24
+ %30 = OpImageSampleImplicitLod %v4float %22 %27 Bias %17
+ OpStore %res %30
+ %33 = OpLoad %v4float %res None
+ OpReturnValue %33
OpFunctionEnd
-%fragment_main = OpFunction %void None %32
- %33 = OpLabel
- %34 = OpFunctionCall %v4float %textureSampleBias_eed7c4
- %35 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %35 %34 None
+%fragment_main = OpFunction %void None %36
+ %37 = OpLabel
+ %38 = OpFunctionCall %v4float %textureSampleBias_eed7c4
+ %39 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %39 %38 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.dxc.hlsl
index fe40d53..f4507d5 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.dxc.hlsl
@@ -7,8 +7,9 @@
uint arg_3 = 1u;
float arg_4 = 1.0f;
float2 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float3(v, float(arg_3)), v_1);
+ uint v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3(v, float(v_1)), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.fxc.hlsl
index fe40d53..f4507d5 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.fxc.hlsl
@@ -7,8 +7,9 @@
uint arg_3 = 1u;
float arg_4 = 1.0f;
float2 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float3(v, float(arg_3)), v_1);
+ uint v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3(v, float(v_1)), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.glsl
index e8ecd66..612aa3a 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.glsl
@@ -12,8 +12,9 @@
uint arg_3 = 1u;
float arg_4 = 1.0f;
vec2 v_1 = arg_2;
- float v_2 = arg_4;
- vec4 res = texture(arg_0_arg_1, vec3(v_1, float(arg_3)), v_2);
+ uint v_2 = arg_3;
+ float v_3 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ vec4 res = texture(arg_0_arg_1, vec3(v_1, float(v_2)), v_3);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.msl
index 0caae1e..bc48775 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.ir.msl
@@ -13,7 +13,7 @@
float arg_4 = 1.0f;
float2 const v = arg_2;
uint const v_1 = arg_3;
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, v_1, bias(arg_4));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, v_1, bias(clamp(arg_4, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.spvasm
index 6c0f96b..ea6ec86 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/1c707e.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 48
+; Bound: 52
; Schema: 0
OpCapability Shader
+ %32 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -46,11 +47,13 @@
%_ptr_Function_uint = OpTypePointer Function %uint
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
- %32 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %36 = OpTypeSampledImage %8
%v3float = OpTypeVector %float 3
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %42 = OpTypeFunction %void
+ %46 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint_0 = OpConstant %uint 0
%textureSampleBias_1c707e = OpFunction %v4float None %13
@@ -67,18 +70,19 @@
%28 = OpLoad %v2float %arg_2 None
%29 = OpLoad %uint %arg_3 None
%30 = OpLoad %float %arg_4 None
- %31 = OpSampledImage %32 %26 %27
- %33 = OpConvertUToF %float %29
- %35 = OpCompositeConstruct %v3float %28 %33
- %36 = OpImageSampleImplicitLod %v4float %31 %35 Bias %30
- OpStore %res %36
- %39 = OpLoad %v4float %res None
- OpReturnValue %39
+ %31 = OpExtInst %float %32 NClamp %30 %float_n16 %float_15_9899998
+ %35 = OpSampledImage %36 %26 %27
+ %37 = OpConvertUToF %float %29
+ %39 = OpCompositeConstruct %v3float %28 %37
+ %40 = OpImageSampleImplicitLod %v4float %35 %39 Bias %31
+ OpStore %res %40
+ %43 = OpLoad %v4float %res None
+ OpReturnValue %43
OpFunctionEnd
-%fragment_main = OpFunction %void None %42
- %43 = OpLabel
- %44 = OpFunctionCall %v4float %textureSampleBias_1c707e
- %45 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %45 %44 None
+%fragment_main = OpFunction %void None %46
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %textureSampleBias_1c707e
+ %49 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %49 %48 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.dxc.hlsl
index b33a566..45976f5 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.dxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_53b9f7() {
float3 arg_2 = (1.0f).xxx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3);
+ float3 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.fxc.hlsl
index b33a566..45976f5 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.fxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_53b9f7() {
float3 arg_2 = (1.0f).xxx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3);
+ float3 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.glsl
index 8978f3d..497f9bd 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.glsl
@@ -10,7 +10,8 @@
vec4 textureSampleBias_53b9f7() {
vec3 arg_2 = vec3(1.0f);
float arg_3 = 1.0f;
- vec4 res = texture(arg_0_arg_1, arg_2, arg_3);
+ vec3 v_1 = arg_2;
+ vec4 res = texture(arg_0_arg_1, v_1, clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.msl
index ee058d1..5b23b7c 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.ir.msl
@@ -11,7 +11,7 @@
float3 arg_2 = float3(1.0f);
float arg_3 = 1.0f;
float3 const v = arg_2;
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(arg_3));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(clamp(arg_3, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm
index ca6b99f..1e0a77b 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/53b9f7.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 41
+; Bound: 45
; Schema: 0
OpCapability Shader
+ %27 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -42,10 +43,12 @@
%float_1 = OpConstant %float 1
%18 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_float = OpTypePointer Function %float
- %27 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %31 = OpTypeSampledImage %8
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %34 = OpTypeFunction %void
+ %38 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -60,16 +63,17 @@
%23 = OpLoad %11 %arg_1 None
%24 = OpLoad %v3float %arg_2 None
%25 = OpLoad %float %arg_3 None
- %26 = OpSampledImage %27 %22 %23
- %28 = OpImageSampleImplicitLod %v4float %26 %24 Bias %25
- OpStore %res %28
- %31 = OpLoad %v4float %res None
- OpReturnValue %31
+ %26 = OpExtInst %float %27 NClamp %25 %float_n16 %float_15_9899998
+ %30 = OpSampledImage %31 %22 %23
+ %32 = OpImageSampleImplicitLod %v4float %30 %24 Bias %26
+ OpStore %res %32
+ %35 = OpLoad %v4float %res None
+ OpReturnValue %35
OpFunctionEnd
-%fragment_main = OpFunction %void None %34
- %35 = OpLabel
- %36 = OpFunctionCall %v4float %textureSampleBias_53b9f7
- %37 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %37 %36 None
+%fragment_main = OpFunction %void None %38
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %textureSampleBias_53b9f7
+ %41 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %41 %40 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.dxc.hlsl
index 1c2ce29..06a3d35 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.dxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_594824() {
float3 arg_2 = (1.0f).xxx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (int(1)).xxx);
+ float3 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f), (int(1)).xxx);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.fxc.hlsl
index 1c2ce29..06a3d35 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.fxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_594824() {
float3 arg_2 = (1.0f).xxx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (int(1)).xxx);
+ float3 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f), (int(1)).xxx);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.glsl
index 2ac139e..f8f69e2 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.glsl
@@ -10,7 +10,8 @@
vec4 textureSampleBias_594824() {
vec3 arg_2 = vec3(1.0f);
float arg_3 = 1.0f;
- vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec3(1), arg_3);
+ vec3 v_1 = arg_2;
+ vec4 res = textureOffset(arg_0_arg_1, v_1, ivec3(1), clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.msl
index d6c7484..0f64878 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.ir.msl
@@ -11,7 +11,7 @@
float3 arg_2 = float3(1.0f);
float arg_3 = 1.0f;
float3 const v = arg_2;
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(arg_3), int3(1));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(clamp(arg_3, -16.0f, 15.9899997711181640625f)), int3(1));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm
index ec07abf..8bb4d3b 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/594824.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 45
+; Bound: 49
; Schema: 0
OpCapability Shader
+ %27 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -42,14 +43,16 @@
%float_1 = OpConstant %float 1
%18 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_float = OpTypePointer Function %float
- %27 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %31 = OpTypeSampledImage %8
%int = OpTypeInt 32 1
%v3int = OpTypeVector %int 3
%int_1 = OpConstant %int 1
- %29 = OpConstantComposite %v3int %int_1 %int_1 %int_1
+ %33 = OpConstantComposite %v3int %int_1 %int_1 %int_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %38 = OpTypeFunction %void
+ %42 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -64,16 +67,17 @@
%23 = OpLoad %11 %arg_1 None
%24 = OpLoad %v3float %arg_2 None
%25 = OpLoad %float %arg_3 None
- %26 = OpSampledImage %27 %22 %23
- %28 = OpImageSampleImplicitLod %v4float %26 %24 Bias|ConstOffset %25 %29
- OpStore %res %28
- %35 = OpLoad %v4float %res None
- OpReturnValue %35
+ %26 = OpExtInst %float %27 NClamp %25 %float_n16 %float_15_9899998
+ %30 = OpSampledImage %31 %22 %23
+ %32 = OpImageSampleImplicitLod %v4float %30 %24 Bias|ConstOffset %26 %33
+ OpStore %res %32
+ %39 = OpLoad %v4float %res None
+ OpReturnValue %39
OpFunctionEnd
-%fragment_main = OpFunction %void None %38
- %39 = OpLabel
- %40 = OpFunctionCall %v4float %textureSampleBias_594824
- %41 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %41 %40 None
+%fragment_main = OpFunction %void None %42
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %textureSampleBias_594824
+ %45 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %45 %44 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.dxc.hlsl
index 62eca0e..de9229f 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.dxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_6a9113() {
float2 arg_2 = (1.0f).xx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3);
+ float2 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.fxc.hlsl
index 62eca0e..de9229f 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.fxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_6a9113() {
float2 arg_2 = (1.0f).xx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3);
+ float2 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.glsl
index 14fde84..e004614 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.glsl
@@ -10,7 +10,8 @@
vec4 textureSampleBias_6a9113() {
vec2 arg_2 = vec2(1.0f);
float arg_3 = 1.0f;
- vec4 res = texture(arg_0_arg_1, arg_2, arg_3);
+ vec2 v_1 = arg_2;
+ vec4 res = texture(arg_0_arg_1, v_1, clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.msl
index 375c4c8..5446fcf 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.ir.msl
@@ -11,7 +11,7 @@
float2 arg_2 = float2(1.0f);
float arg_3 = 1.0f;
float2 const v = arg_2;
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(arg_3));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(clamp(arg_3, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm
index 52da530..43101a1 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/6a9113.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 41
+; Bound: 45
; Schema: 0
OpCapability Shader
+ %27 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -42,10 +43,12 @@
%float_1 = OpConstant %float 1
%18 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_float = OpTypePointer Function %float
- %27 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %31 = OpTypeSampledImage %8
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %34 = OpTypeFunction %void
+ %38 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -60,16 +63,17 @@
%23 = OpLoad %11 %arg_1 None
%24 = OpLoad %v2float %arg_2 None
%25 = OpLoad %float %arg_3 None
- %26 = OpSampledImage %27 %22 %23
- %28 = OpImageSampleImplicitLod %v4float %26 %24 Bias %25
- OpStore %res %28
- %31 = OpLoad %v4float %res None
- OpReturnValue %31
+ %26 = OpExtInst %float %27 NClamp %25 %float_n16 %float_15_9899998
+ %30 = OpSampledImage %31 %22 %23
+ %32 = OpImageSampleImplicitLod %v4float %30 %24 Bias %26
+ OpStore %res %32
+ %35 = OpLoad %v4float %res None
+ OpReturnValue %35
OpFunctionEnd
-%fragment_main = OpFunction %void None %34
- %35 = OpLabel
- %36 = OpFunctionCall %v4float %textureSampleBias_6a9113
- %37 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %37 %36 None
+%fragment_main = OpFunction %void None %38
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %textureSampleBias_6a9113
+ %41 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %41 %40 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.dxc.hlsl
index d672cb2..979bf89 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.dxc.hlsl
@@ -7,8 +7,9 @@
int arg_3 = int(1);
float arg_4 = 1.0f;
float2 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float3(v, float(arg_3)), v_1);
+ int v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3(v, float(v_1)), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.fxc.hlsl
index d672cb2..979bf89 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.fxc.hlsl
@@ -7,8 +7,9 @@
int arg_3 = int(1);
float arg_4 = 1.0f;
float2 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float3(v, float(arg_3)), v_1);
+ int v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3(v, float(v_1)), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.glsl
index be39e76..3884411 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.glsl
@@ -12,8 +12,9 @@
int arg_3 = 1;
float arg_4 = 1.0f;
vec2 v_1 = arg_2;
- float v_2 = arg_4;
- vec4 res = texture(arg_0_arg_1, vec3(v_1, float(arg_3)), v_2);
+ int v_2 = arg_3;
+ float v_3 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ vec4 res = texture(arg_0_arg_1, vec3(v_1, float(v_2)), v_3);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.msl
index 1a35485..444cc90 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.ir.msl
@@ -13,7 +13,7 @@
float arg_4 = 1.0f;
float2 const v = arg_2;
int const v_1 = arg_3;
- bias const v_2 = bias(arg_4);
+ bias const v_2 = bias(clamp(arg_4, -16.0f, 15.9899997711181640625f));
float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, max(v_1, 0), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm
index 79bee62..2fcfb91 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/80e579.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 49
+; Bound: 53
; Schema: 0
OpCapability Shader
+ %32 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -46,11 +47,13 @@
%_ptr_Function_int = OpTypePointer Function %int
%int_1 = OpConstant %int 1
%_ptr_Function_float = OpTypePointer Function %float
- %32 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %36 = OpTypeSampledImage %8
%v3float = OpTypeVector %float 3
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %42 = OpTypeFunction %void
+ %46 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -68,18 +71,19 @@
%28 = OpLoad %v2float %arg_2 None
%29 = OpLoad %int %arg_3 None
%30 = OpLoad %float %arg_4 None
- %31 = OpSampledImage %32 %26 %27
- %33 = OpConvertSToF %float %29
- %35 = OpCompositeConstruct %v3float %28 %33
- %36 = OpImageSampleImplicitLod %v4float %31 %35 Bias %30
- OpStore %res %36
- %39 = OpLoad %v4float %res None
- OpReturnValue %39
+ %31 = OpExtInst %float %32 NClamp %30 %float_n16 %float_15_9899998
+ %35 = OpSampledImage %36 %26 %27
+ %37 = OpConvertSToF %float %29
+ %39 = OpCompositeConstruct %v3float %28 %37
+ %40 = OpImageSampleImplicitLod %v4float %35 %39 Bias %31
+ OpStore %res %40
+ %43 = OpLoad %v4float %res None
+ OpReturnValue %43
OpFunctionEnd
-%fragment_main = OpFunction %void None %42
- %43 = OpLabel
- %44 = OpFunctionCall %v4float %textureSampleBias_80e579
- %45 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %45 %44 None
+%fragment_main = OpFunction %void None %46
+ %47 = OpLabel
+ %48 = OpFunctionCall %v4float %textureSampleBias_80e579
+ %49 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %49 %48 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.dxc.hlsl
index 6e644cf..bbbf2fc 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.dxc.hlsl
@@ -7,8 +7,9 @@
uint arg_3 = 1u;
float arg_4 = 1.0f;
float2 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float3(v, float(arg_3)), v_1, (int(1)).xx);
+ uint v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3(v, float(v_1)), v_2, (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.fxc.hlsl
index 6e644cf..bbbf2fc 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.fxc.hlsl
@@ -7,8 +7,9 @@
uint arg_3 = 1u;
float arg_4 = 1.0f;
float2 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float3(v, float(arg_3)), v_1, (int(1)).xx);
+ uint v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3(v, float(v_1)), v_2, (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.glsl
index 8ca5734..6dcb90b 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.glsl
@@ -12,8 +12,9 @@
uint arg_3 = 1u;
float arg_4 = 1.0f;
vec2 v_1 = arg_2;
- float v_2 = arg_4;
- vec4 res = textureOffset(arg_0_arg_1, vec3(v_1, float(arg_3)), ivec2(1), v_2);
+ uint v_2 = arg_3;
+ float v_3 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ vec4 res = textureOffset(arg_0_arg_1, vec3(v_1, float(v_2)), ivec2(1), v_3);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.msl
index 9b236d1..96505cf 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.ir.msl
@@ -13,7 +13,7 @@
float arg_4 = 1.0f;
float2 const v = arg_2;
uint const v_1 = arg_3;
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, v_1, bias(arg_4), int2(1));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, v_1, bias(clamp(arg_4, -16.0f, 15.9899997711181640625f)), int2(1));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.spvasm
index 9f3c989..19bb67a 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/87915c.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 52
+; Bound: 56
; Schema: 0
OpCapability Shader
+ %32 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -46,15 +47,17 @@
%_ptr_Function_uint = OpTypePointer Function %uint
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
- %32 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %36 = OpTypeSampledImage %8
%v3float = OpTypeVector %float 3
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
- %37 = OpConstantComposite %v2int %int_1 %int_1
+ %41 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %46 = OpTypeFunction %void
+ %50 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint_0 = OpConstant %uint 0
%textureSampleBias_87915c = OpFunction %v4float None %13
@@ -71,18 +74,19 @@
%28 = OpLoad %v2float %arg_2 None
%29 = OpLoad %uint %arg_3 None
%30 = OpLoad %float %arg_4 None
- %31 = OpSampledImage %32 %26 %27
- %33 = OpConvertUToF %float %29
- %35 = OpCompositeConstruct %v3float %28 %33
- %36 = OpImageSampleImplicitLod %v4float %31 %35 Bias|ConstOffset %30 %37
- OpStore %res %36
- %43 = OpLoad %v4float %res None
- OpReturnValue %43
+ %31 = OpExtInst %float %32 NClamp %30 %float_n16 %float_15_9899998
+ %35 = OpSampledImage %36 %26 %27
+ %37 = OpConvertUToF %float %29
+ %39 = OpCompositeConstruct %v3float %28 %37
+ %40 = OpImageSampleImplicitLod %v4float %35 %39 Bias|ConstOffset %31 %41
+ OpStore %res %40
+ %47 = OpLoad %v4float %res None
+ OpReturnValue %47
OpFunctionEnd
-%fragment_main = OpFunction %void None %46
- %47 = OpLabel
- %48 = OpFunctionCall %v4float %textureSampleBias_87915c
- %49 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %49 %48 None
+%fragment_main = OpFunction %void None %50
+ %51 = OpLabel
+ %52 = OpFunctionCall %v4float %textureSampleBias_87915c
+ %53 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %53 %52 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.dxc.hlsl
index 8f9f66c..241afcd 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.dxc.hlsl
@@ -7,8 +7,9 @@
int arg_3 = int(1);
float arg_4 = 1.0f;
float2 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float3(v, float(arg_3)), v_1, (int(1)).xx);
+ int v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3(v, float(v_1)), v_2, (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.fxc.hlsl
index 8f9f66c..241afcd 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.fxc.hlsl
@@ -7,8 +7,9 @@
int arg_3 = int(1);
float arg_4 = 1.0f;
float2 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float3(v, float(arg_3)), v_1, (int(1)).xx);
+ int v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float3(v, float(v_1)), v_2, (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.glsl
index 27ba869..f7c301a 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.glsl
@@ -12,8 +12,9 @@
int arg_3 = 1;
float arg_4 = 1.0f;
vec2 v_1 = arg_2;
- float v_2 = arg_4;
- vec4 res = textureOffset(arg_0_arg_1, vec3(v_1, float(arg_3)), ivec2(1), v_2);
+ int v_2 = arg_3;
+ float v_3 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ vec4 res = textureOffset(arg_0_arg_1, vec3(v_1, float(v_2)), ivec2(1), v_3);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.msl
index 21295ed..b3d12fd 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.ir.msl
@@ -13,7 +13,7 @@
float arg_4 = 1.0f;
float2 const v = arg_2;
int const v_1 = arg_3;
- bias const v_2 = bias(arg_4);
+ bias const v_2 = bias(clamp(arg_4, -16.0f, 15.9899997711181640625f));
float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, max(v_1, 0), v_2, int2(1));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm
index 543f919..86c1386 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/9dbb51.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 51
+; Bound: 55
; Schema: 0
OpCapability Shader
+ %32 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -46,13 +47,15 @@
%_ptr_Function_int = OpTypePointer Function %int
%int_1 = OpConstant %int 1
%_ptr_Function_float = OpTypePointer Function %float
- %32 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %36 = OpTypeSampledImage %8
%v3float = OpTypeVector %float 3
%v2int = OpTypeVector %int 2
- %37 = OpConstantComposite %v2int %int_1 %int_1
+ %41 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %44 = OpTypeFunction %void
+ %48 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -70,18 +73,19 @@
%28 = OpLoad %v2float %arg_2 None
%29 = OpLoad %int %arg_3 None
%30 = OpLoad %float %arg_4 None
- %31 = OpSampledImage %32 %26 %27
- %33 = OpConvertSToF %float %29
- %35 = OpCompositeConstruct %v3float %28 %33
- %36 = OpImageSampleImplicitLod %v4float %31 %35 Bias|ConstOffset %30 %37
- OpStore %res %36
- %41 = OpLoad %v4float %res None
- OpReturnValue %41
+ %31 = OpExtInst %float %32 NClamp %30 %float_n16 %float_15_9899998
+ %35 = OpSampledImage %36 %26 %27
+ %37 = OpConvertSToF %float %29
+ %39 = OpCompositeConstruct %v3float %28 %37
+ %40 = OpImageSampleImplicitLod %v4float %35 %39 Bias|ConstOffset %31 %41
+ OpStore %res %40
+ %45 = OpLoad %v4float %res None
+ OpReturnValue %45
OpFunctionEnd
-%fragment_main = OpFunction %void None %44
- %45 = OpLabel
- %46 = OpFunctionCall %v4float %textureSampleBias_9dbb51
- %47 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %47 %46 None
+%fragment_main = OpFunction %void None %48
+ %49 = OpLabel
+ %50 = OpFunctionCall %v4float %textureSampleBias_9dbb51
+ %51 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %51 %50 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.dxc.hlsl
index a21ddd9..9d373d9 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.dxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_a161cf() {
float2 arg_2 = (1.0f).xx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (int(1)).xx);
+ float2 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f), (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.fxc.hlsl
index a21ddd9..9d373d9 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.fxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_a161cf() {
float2 arg_2 = (1.0f).xx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3, (int(1)).xx);
+ float2 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f), (int(1)).xx);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.glsl
index cfd7f2b..709925d 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.glsl
@@ -10,7 +10,8 @@
vec4 textureSampleBias_a161cf() {
vec2 arg_2 = vec2(1.0f);
float arg_3 = 1.0f;
- vec4 res = textureOffset(arg_0_arg_1, arg_2, ivec2(1), arg_3);
+ vec2 v_1 = arg_2;
+ vec4 res = textureOffset(arg_0_arg_1, v_1, ivec2(1), clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.msl
index 360f4df..cc67506 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.ir.msl
@@ -11,7 +11,7 @@
float2 arg_2 = float2(1.0f);
float arg_3 = 1.0f;
float2 const v = arg_2;
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(arg_3), int2(1));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(clamp(arg_3, -16.0f, 15.9899997711181640625f)), int2(1));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm
index 5dae720..7dddf5d 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/a161cf.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 45
+; Bound: 49
; Schema: 0
OpCapability Shader
+ %27 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -42,14 +43,16 @@
%float_1 = OpConstant %float 1
%18 = OpConstantComposite %v2float %float_1 %float_1
%_ptr_Function_float = OpTypePointer Function %float
- %27 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %31 = OpTypeSampledImage %8
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%int_1 = OpConstant %int 1
- %29 = OpConstantComposite %v2int %int_1 %int_1
+ %33 = OpConstantComposite %v2int %int_1 %int_1
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %38 = OpTypeFunction %void
+ %42 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -64,16 +67,17 @@
%23 = OpLoad %11 %arg_1 None
%24 = OpLoad %v2float %arg_2 None
%25 = OpLoad %float %arg_3 None
- %26 = OpSampledImage %27 %22 %23
- %28 = OpImageSampleImplicitLod %v4float %26 %24 Bias|ConstOffset %25 %29
- OpStore %res %28
- %35 = OpLoad %v4float %res None
- OpReturnValue %35
+ %26 = OpExtInst %float %27 NClamp %25 %float_n16 %float_15_9899998
+ %30 = OpSampledImage %31 %22 %23
+ %32 = OpImageSampleImplicitLod %v4float %30 %24 Bias|ConstOffset %26 %33
+ OpStore %res %32
+ %39 = OpLoad %v4float %res None
+ OpReturnValue %39
OpFunctionEnd
-%fragment_main = OpFunction %void None %38
- %39 = OpLabel
- %40 = OpFunctionCall %v4float %textureSampleBias_a161cf
- %41 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %41 %40 None
+%fragment_main = OpFunction %void None %42
+ %43 = OpLabel
+ %44 = OpFunctionCall %v4float %textureSampleBias_a161cf
+ %45 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %45 %44 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.dxc.hlsl
index 4398413..bbc99e5 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.dxc.hlsl
@@ -7,8 +7,9 @@
uint arg_3 = 1u;
float arg_4 = 1.0f;
float3 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float4(v, float(arg_3)), v_1);
+ uint v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float4(v, float(v_1)), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.fxc.hlsl
index 4398413..bbc99e5 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.fxc.hlsl
@@ -7,8 +7,9 @@
uint arg_3 = 1u;
float arg_4 = 1.0f;
float3 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float4(v, float(arg_3)), v_1);
+ uint v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float4(v, float(v_1)), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.glsl
index 635f5c2..ac88071 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.glsl
@@ -12,8 +12,9 @@
uint arg_3 = 1u;
float arg_4 = 1.0f;
vec3 v_1 = arg_2;
- float v_2 = arg_4;
- vec4 res = texture(arg_0_arg_1, vec4(v_1, float(arg_3)), v_2);
+ uint v_2 = arg_3;
+ float v_3 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ vec4 res = texture(arg_0_arg_1, vec4(v_1, float(v_2)), v_3);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.msl
index 7aec3c1..9e28a33 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.ir.msl
@@ -13,7 +13,7 @@
float arg_4 = 1.0f;
float3 const v = arg_2;
uint const v_1 = arg_3;
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, v_1, bias(arg_4));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, v_1, bias(clamp(arg_4, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.spvasm
index 4da0f5a..3283e8b 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/c6953d.wgsl.expected.spvasm
@@ -1,10 +1,11 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 47
+; Bound: 51
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
+ %32 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -47,10 +48,12 @@
%_ptr_Function_uint = OpTypePointer Function %uint
%uint_1 = OpConstant %uint 1
%_ptr_Function_float = OpTypePointer Function %float
- %32 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %36 = OpTypeSampledImage %8
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %41 = OpTypeFunction %void
+ %45 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint_0 = OpConstant %uint 0
%textureSampleBias_c6953d = OpFunction %v4float None %13
@@ -67,18 +70,19 @@
%28 = OpLoad %v3float %arg_2 None
%29 = OpLoad %uint %arg_3 None
%30 = OpLoad %float %arg_4 None
- %31 = OpSampledImage %32 %26 %27
- %33 = OpConvertUToF %float %29
- %34 = OpCompositeConstruct %v4float %28 %33
- %35 = OpImageSampleImplicitLod %v4float %31 %34 Bias %30
- OpStore %res %35
- %38 = OpLoad %v4float %res None
- OpReturnValue %38
+ %31 = OpExtInst %float %32 NClamp %30 %float_n16 %float_15_9899998
+ %35 = OpSampledImage %36 %26 %27
+ %37 = OpConvertUToF %float %29
+ %38 = OpCompositeConstruct %v4float %28 %37
+ %39 = OpImageSampleImplicitLod %v4float %35 %38 Bias %31
+ OpStore %res %39
+ %42 = OpLoad %v4float %res None
+ OpReturnValue %42
OpFunctionEnd
-%fragment_main = OpFunction %void None %41
- %42 = OpLabel
- %43 = OpFunctionCall %v4float %textureSampleBias_c6953d
- %44 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %44 %43 None
+%fragment_main = OpFunction %void None %45
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %textureSampleBias_c6953d
+ %48 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %48 %47 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.dxc.hlsl
index 23a0213..933da98 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.dxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_d3fa1b() {
float3 arg_2 = (1.0f).xxx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3);
+ float3 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.fxc.hlsl
index 23a0213..933da98 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.fxc.hlsl
@@ -5,7 +5,8 @@
float4 textureSampleBias_d3fa1b() {
float3 arg_2 = (1.0f).xxx;
float arg_3 = 1.0f;
- float4 res = arg_0.SampleBias(arg_1, arg_2, arg_3);
+ float3 v = arg_2;
+ float4 res = arg_0.SampleBias(arg_1, v, clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.glsl
index 2d961ed..bf6a847 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.glsl
@@ -10,7 +10,8 @@
vec4 textureSampleBias_d3fa1b() {
vec3 arg_2 = vec3(1.0f);
float arg_3 = 1.0f;
- vec4 res = texture(arg_0_arg_1, arg_2, arg_3);
+ vec3 v_1 = arg_2;
+ vec4 res = texture(arg_0_arg_1, v_1, clamp(arg_3, -16.0f, 15.9899997711181640625f));
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.msl
index 1fd4845..8459c0d 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.ir.msl
@@ -11,7 +11,7 @@
float3 arg_2 = float3(1.0f);
float arg_3 = 1.0f;
float3 const v = arg_2;
- float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(arg_3));
+ float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, bias(clamp(arg_3, -16.0f, 15.9899997711181640625f)));
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm
index 50d7afa..72c8238 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/d3fa1b.wgsl.expected.spvasm
@@ -1,9 +1,10 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 41
+; Bound: 45
; Schema: 0
OpCapability Shader
+ %27 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -42,10 +43,12 @@
%float_1 = OpConstant %float 1
%18 = OpConstantComposite %v3float %float_1 %float_1 %float_1
%_ptr_Function_float = OpTypePointer Function %float
- %27 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %31 = OpTypeSampledImage %8
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %34 = OpTypeFunction %void
+ %38 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -60,16 +63,17 @@
%23 = OpLoad %11 %arg_1 None
%24 = OpLoad %v3float %arg_2 None
%25 = OpLoad %float %arg_3 None
- %26 = OpSampledImage %27 %22 %23
- %28 = OpImageSampleImplicitLod %v4float %26 %24 Bias %25
- OpStore %res %28
- %31 = OpLoad %v4float %res None
- OpReturnValue %31
+ %26 = OpExtInst %float %27 NClamp %25 %float_n16 %float_15_9899998
+ %30 = OpSampledImage %31 %22 %23
+ %32 = OpImageSampleImplicitLod %v4float %30 %24 Bias %26
+ OpStore %res %32
+ %35 = OpLoad %v4float %res None
+ OpReturnValue %35
OpFunctionEnd
-%fragment_main = OpFunction %void None %34
- %35 = OpLabel
- %36 = OpFunctionCall %v4float %textureSampleBias_d3fa1b
- %37 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %37 %36 None
+%fragment_main = OpFunction %void None %38
+ %39 = OpLabel
+ %40 = OpFunctionCall %v4float %textureSampleBias_d3fa1b
+ %41 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %41 %40 None
OpReturn
OpFunctionEnd
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.dxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.dxc.hlsl
index 9b60da7..3a63937 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.dxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.dxc.hlsl
@@ -7,8 +7,9 @@
int arg_3 = int(1);
float arg_4 = 1.0f;
float3 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float4(v, float(arg_3)), v_1);
+ int v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float4(v, float(v_1)), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.fxc.hlsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.fxc.hlsl
index 9b60da7..3a63937 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.fxc.hlsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.fxc.hlsl
@@ -7,8 +7,9 @@
int arg_3 = int(1);
float arg_4 = 1.0f;
float3 v = arg_2;
- float v_1 = arg_4;
- float4 res = arg_0.SampleBias(arg_1, float4(v, float(arg_3)), v_1);
+ int v_1 = arg_3;
+ float v_2 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ float4 res = arg_0.SampleBias(arg_1, float4(v, float(v_1)), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.glsl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.glsl
index 9e27c26..fa9eee1 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.glsl
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.glsl
@@ -12,8 +12,9 @@
int arg_3 = 1;
float arg_4 = 1.0f;
vec3 v_1 = arg_2;
- float v_2 = arg_4;
- vec4 res = texture(arg_0_arg_1, vec4(v_1, float(arg_3)), v_2);
+ int v_2 = arg_3;
+ float v_3 = clamp(arg_4, -16.0f, 15.9899997711181640625f);
+ vec4 res = texture(arg_0_arg_1, vec4(v_1, float(v_2)), v_3);
return res;
}
void main() {
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.msl b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.msl
index 8c0e76d..4632eb9 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.msl
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.ir.msl
@@ -13,7 +13,7 @@
float arg_4 = 1.0f;
float3 const v = arg_2;
int const v_1 = arg_3;
- bias const v_2 = bias(arg_4);
+ bias const v_2 = bias(clamp(arg_4, -16.0f, 15.9899997711181640625f));
float4 res = tint_module_vars.arg_0.sample(tint_module_vars.arg_1, v, max(v_1, 0), v_2);
return res;
}
diff --git a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm
index bc99d78..0447c33 100644
--- a/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm
+++ b/test/tint/builtins/gen/var/textureSampleBias/eed7c4.wgsl.expected.spvasm
@@ -1,10 +1,11 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 1
-; Bound: 48
+; Bound: 52
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
+ %32 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %fragment_main "fragment_main"
OpExecutionMode %fragment_main OriginUpperLeft
@@ -47,10 +48,12 @@
%_ptr_Function_int = OpTypePointer Function %int
%int_1 = OpConstant %int 1
%_ptr_Function_float = OpTypePointer Function %float
- %32 = OpTypeSampledImage %8
+ %float_n16 = OpConstant %float -16
+%float_15_9899998 = OpConstant %float 15.9899998
+ %36 = OpTypeSampledImage %8
%_ptr_Function_v4float = OpTypePointer Function %v4float
%void = OpTypeVoid
- %41 = OpTypeFunction %void
+ %45 = OpTypeFunction %void
%_ptr_StorageBuffer_v4float = OpTypePointer StorageBuffer %v4float
%uint = OpTypeInt 32 0
%uint_0 = OpConstant %uint 0
@@ -68,18 +71,19 @@
%28 = OpLoad %v3float %arg_2 None
%29 = OpLoad %int %arg_3 None
%30 = OpLoad %float %arg_4 None
- %31 = OpSampledImage %32 %26 %27
- %33 = OpConvertSToF %float %29
- %34 = OpCompositeConstruct %v4float %28 %33
- %35 = OpImageSampleImplicitLod %v4float %31 %34 Bias %30
- OpStore %res %35
- %38 = OpLoad %v4float %res None
- OpReturnValue %38
+ %31 = OpExtInst %float %32 NClamp %30 %float_n16 %float_15_9899998
+ %35 = OpSampledImage %36 %26 %27
+ %37 = OpConvertSToF %float %29
+ %38 = OpCompositeConstruct %v4float %28 %37
+ %39 = OpImageSampleImplicitLod %v4float %35 %38 Bias %31
+ OpStore %res %39
+ %42 = OpLoad %v4float %res None
+ OpReturnValue %42
OpFunctionEnd
-%fragment_main = OpFunction %void None %41
- %42 = OpLabel
- %43 = OpFunctionCall %v4float %textureSampleBias_eed7c4
- %44 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
- OpStore %44 %43 None
+%fragment_main = OpFunction %void None %45
+ %46 = OpLabel
+ %47 = OpFunctionCall %v4float %textureSampleBias_eed7c4
+ %48 = OpAccessChain %_ptr_StorageBuffer_v4float %1 %uint_0
+ OpStore %48 %47 None
OpReturn
OpFunctionEnd
diff --git a/webgpu-cts/expectations.txt b/webgpu-cts/expectations.txt
index 606ae6a..6d17168 100644
--- a/webgpu-cts/expectations.txt
+++ b/webgpu-cts/expectations.txt
@@ -1574,6 +1574,10 @@
crbug.com/dawn/366000875 webgpu:shader,validation,decl,var:var_access_mode_bad_other_template_contents:accessMode="read";prefix="storage,";suffix="," [ Failure ]
crbug.com/dawn/366000875 webgpu:shader,validation,decl,var:var_access_mode_bad_other_template_contents:accessMode="read_write";prefix="storage,";suffix="," [ Failure ]
+# Minor accuracy issue with the introduction of texture sample bias clampling
+# specific subtest case: samplePoints="spiral";addressModeU="clamp-to-edge";addressModeV="mirror-repeat";minFilter="linear"
+crbug.com/dawn/371033198 [ amd mac ] webgpu:shader,execution,expression,call,builtin,textureSampleBias:sampled_2d_coords:format="bc1-rgba-unorm";offset=true [ Failure ]
+
################################################################################
# AMD Macbook 16" Qualification (NEEDS TRIAGE)
################################################################################