test/intrinsics/gen: Use '0' for level parameters

The level parameter needs to be zero for a number of texture overloads.
Bodging the template to emit 0 instead of 1 for any `level : i32` parameter is the easiest fix here.

Change-Id: I69222578efcd0d4f4f267fb59fec691b52786d9c
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/57301
Auto-Submit: Ben Clayton <bclayton@google.com>
Reviewed-by: James Price <jrprice@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2021-07-08 21:04:53 +00:00
committed by Tint LUCI CQ
parent 79fae01483
commit e4fd4a2ecd
196 changed files with 335 additions and 448 deletions

View File

@@ -27,7 +27,7 @@
// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: i32) -> f32
fn textureSampleLevel_02be59() {
var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1);
var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 0);
}
[[stage(vertex)]]

View File

@@ -2,7 +2,7 @@ Texture2D arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
void textureSampleLevel_02be59() {
float res = arg_0.SampleLevel(arg_1, float2(0.0f, 0.0f), 1).x;
float res = arg_0.SampleLevel(arg_1, float2(0.0f, 0.0f), 0).x;
}
struct tint_symbol {

View File

@@ -6,7 +6,7 @@ struct tint_symbol {
};
void textureSampleLevel_02be59(depth2d<float, access::sample> tint_symbol_2, sampler tint_symbol_3) {
float res = tint_symbol_2.sample(tint_symbol_3, float2(), level(1));
float res = tint_symbol_2.sample(tint_symbol_3, float2(), level(0));
}
vertex tint_symbol vertex_main(depth2d<float, access::sample> tint_symbol_4 [[texture(0)]], sampler tint_symbol_5 [[sampler(1)]]) {

View File

@@ -47,7 +47,7 @@
%v2float = OpTypeVector %float 2
%26 = OpConstantNull %v2float
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%_ptr_Function_float = OpTypePointer Function %float
%32 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
@@ -57,7 +57,7 @@
%21 = OpLoad %10 %arg_1
%22 = OpLoad %7 %arg_0
%24 = OpSampledImage %23 %22 %21
%27 = OpConvertSToF %float %int_1
%27 = OpConvertSToF %float %int_0
%20 = OpImageSampleExplicitLod %v4float %24 %26 Lod %27
%19 = OpCompositeExtract %float %20 0
OpStore %res %19

View File

@@ -3,7 +3,7 @@
[[group(1), binding(1)]] var arg_1 : sampler;
fn textureSampleLevel_02be59() {
var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1);
var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 0);
}
[[stage(vertex)]]

View File

@@ -27,7 +27,7 @@
// fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>, level: i32) -> f32
fn textureSampleLevel_1b0291() {
var res: f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1);
var res: f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 0);
}
[[stage(vertex)]]

View File

@@ -2,7 +2,7 @@ TextureCube arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
void textureSampleLevel_1b0291() {
float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, 0.0f), 1).x;
float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, 0.0f), 0).x;
}
struct tint_symbol {

View File

@@ -6,7 +6,7 @@ struct tint_symbol {
};
void textureSampleLevel_1b0291(depthcube<float, access::sample> tint_symbol_2, sampler tint_symbol_3) {
float res = tint_symbol_2.sample(tint_symbol_3, float3(), level(1));
float res = tint_symbol_2.sample(tint_symbol_3, float3(), level(0));
}
vertex tint_symbol vertex_main(depthcube<float, access::sample> tint_symbol_4 [[texture(0)]], sampler tint_symbol_5 [[sampler(1)]]) {

View File

@@ -47,7 +47,7 @@
%v3float = OpTypeVector %float 3
%26 = OpConstantNull %v3float
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%_ptr_Function_float = OpTypePointer Function %float
%32 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
@@ -57,7 +57,7 @@
%21 = OpLoad %10 %arg_1
%22 = OpLoad %7 %arg_0
%24 = OpSampledImage %23 %22 %21
%27 = OpConvertSToF %float %int_1
%27 = OpConvertSToF %float %int_0
%20 = OpImageSampleExplicitLod %v4float %24 %26 Lod %27
%19 = OpCompositeExtract %float %20 0
OpStore %res %19

View File

@@ -3,7 +3,7 @@
[[group(1), binding(1)]] var arg_1 : sampler;
fn textureSampleLevel_1b0291() {
var res : f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1);
var res : f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 0);
}
[[stage(vertex)]]

View File

@@ -27,7 +27,7 @@
// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, level: i32) -> f32
fn textureSampleLevel_1bf73e() {
var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, 1);
var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, 0);
}
[[stage(vertex)]]

View File

@@ -2,7 +2,7 @@ Texture2DArray arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
void textureSampleLevel_1bf73e() {
float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1).x;
float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0).x;
}
struct tint_symbol {

View File

@@ -6,7 +6,7 @@ struct tint_symbol {
};
void textureSampleLevel_1bf73e(depth2d_array<float, access::sample> tint_symbol_2, sampler tint_symbol_3) {
float res = tint_symbol_2.sample(tint_symbol_3, float2(), 1, level(1));
float res = tint_symbol_2.sample(tint_symbol_3, float2(), 1, level(0));
}
vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]], sampler tint_symbol_5 [[sampler(1)]]) {

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 49
; Bound: 50
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -48,8 +48,9 @@
%float_0 = OpConstant %float 0
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%_ptr_Function_float = OpTypePointer Function %float
%34 = OpTypeFunction %void %v4float
%35 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
%textureSampleLevel_1bf73e = OpFunction %void None %15
%18 = OpLabel
@@ -59,32 +60,32 @@
%24 = OpSampledImage %23 %22 %21
%27 = OpConvertSToF %float %int_1
%30 = OpCompositeConstruct %v3float %float_0 %float_0 %27
%31 = OpConvertSToF %float %int_1
%31 = OpConvertSToF %float %int_0
%20 = OpImageSampleExplicitLod %v4float %24 %30 Lod %31
%19 = OpCompositeExtract %float %20 0
OpStore %res %19
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %34
%tint_symbol_2 = OpFunction %void None %35
%tint_symbol = OpFunctionParameter %v4float
%37 = OpLabel
%38 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %15
%39 = OpLabel
%40 = OpLabel
OpStore %tint_pointsize %float_1
%41 = OpFunctionCall %void %textureSampleLevel_1bf73e
%42 = OpFunctionCall %void %tint_symbol_2 %14
%42 = OpFunctionCall %void %textureSampleLevel_1bf73e
%43 = OpFunctionCall %void %tint_symbol_2 %14
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %15
%44 = OpLabel
%45 = OpFunctionCall %void %textureSampleLevel_1bf73e
%45 = OpLabel
%46 = OpFunctionCall %void %textureSampleLevel_1bf73e
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %15
%47 = OpLabel
%48 = OpFunctionCall %void %textureSampleLevel_1bf73e
%48 = OpLabel
%49 = OpFunctionCall %void %textureSampleLevel_1bf73e
OpReturn
OpFunctionEnd

View File

@@ -3,7 +3,7 @@
[[group(1), binding(1)]] var arg_1 : sampler;
fn textureSampleLevel_1bf73e() {
var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, 1);
var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, 0);
}
[[stage(vertex)]]

View File

@@ -27,7 +27,7 @@
// fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: i32, offset: vec2<i32>) -> f32
fn textureSampleLevel_47daa4() {
var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, vec2<i32>());
var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 0, vec2<i32>());
}
[[stage(vertex)]]

View File

@@ -2,7 +2,7 @@ Texture2D arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
void textureSampleLevel_47daa4() {
float res = arg_0.SampleLevel(arg_1, float2(0.0f, 0.0f), 1, int2(0, 0)).x;
float res = arg_0.SampleLevel(arg_1, float2(0.0f, 0.0f), 0, int2(0, 0)).x;
}
struct tint_symbol {

View File

@@ -6,7 +6,7 @@ struct tint_symbol {
};
void textureSampleLevel_47daa4(depth2d<float, access::sample> tint_symbol_2, sampler tint_symbol_3) {
float res = tint_symbol_2.sample(tint_symbol_3, float2(), level(1), int2());
float res = tint_symbol_2.sample(tint_symbol_3, float2(), level(0), int2());
}
vertex tint_symbol vertex_main(depth2d<float, access::sample> tint_symbol_4 [[texture(0)]], sampler tint_symbol_5 [[sampler(1)]]) {

View File

@@ -47,7 +47,7 @@
%v2float = OpTypeVector %float 2
%26 = OpConstantNull %v2float
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%v2int = OpTypeVector %int 2
%31 = OpConstantNull %v2int
%_ptr_Function_float = OpTypePointer Function %float
@@ -59,7 +59,7 @@
%21 = OpLoad %10 %arg_1
%22 = OpLoad %7 %arg_0
%24 = OpSampledImage %23 %22 %21
%27 = OpConvertSToF %float %int_1
%27 = OpConvertSToF %float %int_0
%20 = OpImageSampleExplicitLod %v4float %24 %26 Lod|ConstOffset %27 %31
%19 = OpCompositeExtract %float %20 0
OpStore %res %19

View File

@@ -3,7 +3,7 @@
[[group(1), binding(1)]] var arg_1 : sampler;
fn textureSampleLevel_47daa4() {
var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, vec2<i32>());
var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 0, vec2<i32>());
}
[[stage(vertex)]]

View File

@@ -27,7 +27,7 @@
// fn textureSampleLevel(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: i32, level: i32) -> f32
fn textureSampleLevel_ae5e39() {
var res: f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1, 1);
var res: f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1, 0);
}
[[stage(vertex)]]

View File

@@ -2,7 +2,7 @@ TextureCubeArray arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
void textureSampleLevel_ae5e39() {
float res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 1).x;
float res = arg_0.SampleLevel(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)), 0).x;
}
struct tint_symbol {

View File

@@ -6,7 +6,7 @@ struct tint_symbol {
};
void textureSampleLevel_ae5e39(depthcube_array<float, access::sample> tint_symbol_2, sampler tint_symbol_3) {
float res = tint_symbol_2.sample(tint_symbol_3, float3(), 1, level(1));
float res = tint_symbol_2.sample(tint_symbol_3, float3(), 1, level(0));
}
vertex tint_symbol vertex_main(depthcube_array<float, access::sample> tint_symbol_4 [[texture(0)]], sampler tint_symbol_5 [[sampler(1)]]) {

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 48
; Bound: 49
; Schema: 0
OpCapability Shader
OpCapability SampledCubeArray
@@ -48,8 +48,9 @@
%float_0 = OpConstant %float 0
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%_ptr_Function_float = OpTypePointer Function %float
%33 = OpTypeFunction %void %v4float
%34 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
%textureSampleLevel_ae5e39 = OpFunction %void None %15
%18 = OpLabel
@@ -59,32 +60,32 @@
%24 = OpSampledImage %23 %22 %21
%26 = OpConvertSToF %float %int_1
%29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %26
%30 = OpConvertSToF %float %int_1
%30 = OpConvertSToF %float %int_0
%20 = OpImageSampleExplicitLod %v4float %24 %29 Lod %30
%19 = OpCompositeExtract %float %20 0
OpStore %res %19
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %33
%tint_symbol_2 = OpFunction %void None %34
%tint_symbol = OpFunctionParameter %v4float
%36 = OpLabel
%37 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %15
%38 = OpLabel
%39 = OpLabel
OpStore %tint_pointsize %float_1
%40 = OpFunctionCall %void %textureSampleLevel_ae5e39
%41 = OpFunctionCall %void %tint_symbol_2 %14
%41 = OpFunctionCall %void %textureSampleLevel_ae5e39
%42 = OpFunctionCall %void %tint_symbol_2 %14
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %15
%43 = OpLabel
%44 = OpFunctionCall %void %textureSampleLevel_ae5e39
%44 = OpLabel
%45 = OpFunctionCall %void %textureSampleLevel_ae5e39
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %15
%46 = OpLabel
%47 = OpFunctionCall %void %textureSampleLevel_ae5e39
%47 = OpLabel
%48 = OpFunctionCall %void %textureSampleLevel_ae5e39
OpReturn
OpFunctionEnd

View File

@@ -3,7 +3,7 @@
[[group(1), binding(1)]] var arg_1 : sampler;
fn textureSampleLevel_ae5e39() {
var res : f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1, 1);
var res : f32 = textureSampleLevel(arg_0, arg_1, vec3<f32>(), 1, 0);
}
[[stage(vertex)]]

View File

@@ -27,7 +27,7 @@
// fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, level: i32, offset: vec2<i32>) -> f32
fn textureSampleLevel_ba93b3() {
var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, 1, vec2<i32>());
var res: f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, 0, vec2<i32>());
}
[[stage(vertex)]]

View File

@@ -2,7 +2,7 @@ Texture2DArray arg_0 : register(t0, space1);
SamplerState arg_1 : register(s1, space1);
void textureSampleLevel_ba93b3() {
float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 1, int2(0, 0)).x;
float res = arg_0.SampleLevel(arg_1, float3(0.0f, 0.0f, float(1)), 0, int2(0, 0)).x;
}
struct tint_symbol {

View File

@@ -6,7 +6,7 @@ struct tint_symbol {
};
void textureSampleLevel_ba93b3(depth2d_array<float, access::sample> tint_symbol_2, sampler tint_symbol_3) {
float res = tint_symbol_2.sample(tint_symbol_3, float2(), 1, level(1), int2());
float res = tint_symbol_2.sample(tint_symbol_3, float2(), 1, level(0), int2());
}
vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_4 [[texture(0)]], sampler tint_symbol_5 [[sampler(1)]]) {

View File

@@ -1,7 +1,7 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 51
; Bound: 52
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
@@ -48,10 +48,11 @@
%float_0 = OpConstant %float 0
%int = OpTypeInt 32 1
%int_1 = OpConstant %int 1
%int_0 = OpConstant %int 0
%v2int = OpTypeVector %int 2
%33 = OpConstantNull %v2int
%34 = OpConstantNull %v2int
%_ptr_Function_float = OpTypePointer Function %float
%36 = OpTypeFunction %void %v4float
%37 = OpTypeFunction %void %v4float
%float_1 = OpConstant %float 1
%textureSampleLevel_ba93b3 = OpFunction %void None %15
%18 = OpLabel
@@ -61,32 +62,32 @@
%24 = OpSampledImage %23 %22 %21
%27 = OpConvertSToF %float %int_1
%30 = OpCompositeConstruct %v3float %float_0 %float_0 %27
%31 = OpConvertSToF %float %int_1
%20 = OpImageSampleExplicitLod %v4float %24 %30 Lod|ConstOffset %31 %33
%31 = OpConvertSToF %float %int_0
%20 = OpImageSampleExplicitLod %v4float %24 %30 Lod|ConstOffset %31 %34
%19 = OpCompositeExtract %float %20 0
OpStore %res %19
OpReturn
OpFunctionEnd
%tint_symbol_2 = OpFunction %void None %36
%tint_symbol_2 = OpFunction %void None %37
%tint_symbol = OpFunctionParameter %v4float
%39 = OpLabel
%40 = OpLabel
OpStore %tint_symbol_1 %tint_symbol
OpReturn
OpFunctionEnd
%vertex_main = OpFunction %void None %15
%41 = OpLabel
%42 = OpLabel
OpStore %tint_pointsize %float_1
%43 = OpFunctionCall %void %textureSampleLevel_ba93b3
%44 = OpFunctionCall %void %tint_symbol_2 %14
%44 = OpFunctionCall %void %textureSampleLevel_ba93b3
%45 = OpFunctionCall %void %tint_symbol_2 %14
OpReturn
OpFunctionEnd
%fragment_main = OpFunction %void None %15
%46 = OpLabel
%47 = OpFunctionCall %void %textureSampleLevel_ba93b3
%47 = OpLabel
%48 = OpFunctionCall %void %textureSampleLevel_ba93b3
OpReturn
OpFunctionEnd
%compute_main = OpFunction %void None %15
%49 = OpLabel
%50 = OpFunctionCall %void %textureSampleLevel_ba93b3
%50 = OpLabel
%51 = OpFunctionCall %void %textureSampleLevel_ba93b3
OpReturn
OpFunctionEnd

View File

@@ -3,7 +3,7 @@
[[group(1), binding(1)]] var arg_1 : sampler;
fn textureSampleLevel_ba93b3() {
var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, 1, vec2<i32>());
var res : f32 = textureSampleLevel(arg_0, arg_1, vec2<f32>(), 1, 0, vec2<i32>());
}
[[stage(vertex)]]