test/tint: Show that tint:1183 is fixed

Fixed: tint:1183
Change-Id: I06c8faf37218c58836c2a30d2b1e89abf8dc2be8
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/108643
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
Ben Clayton 2022-11-04 17:49:47 +00:00 committed by Dawn LUCI CQ
parent 4b60615eae
commit 279864c774
7 changed files with 137 additions and 0 deletions

View File

@ -0,0 +1,7 @@
@binding(0) @group(0) var t : texture_2d<f32>;
@binding(0) @group(1) var s : sampler;
@fragment
fn f() -> @location(0) vec4<f32> {
return textureSample(t, s, vec2<f32>(), vec2<i32>(1, 2) + vec2<i32>(3, 4));
}

View File

@ -0,0 +1,17 @@
Texture2D<float4> t : register(t0, space0);
SamplerState s : register(s0, space1);
struct tint_symbol {
float4 value : SV_Target0;
};
float4 f_inner() {
return t.Sample(s, (0.0f).xx, int2(4, 6));
}
tint_symbol f() {
const float4 inner_result = f_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}

View File

@ -0,0 +1,17 @@
Texture2D<float4> t : register(t0, space0);
SamplerState s : register(s0, space1);
struct tint_symbol {
float4 value : SV_Target0;
};
float4 f_inner() {
return t.Sample(s, (0.0f).xx, int2(4, 6));
}
tint_symbol f() {
const float4 inner_result = f_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.value = inner_result;
return wrapper_result;
}

View File

@ -0,0 +1,15 @@
#version 310 es
precision mediump float;
layout(location = 0) out vec4 value;
uniform highp sampler2D t_s;
vec4 f() {
return textureOffset(t_s, vec2(0.0f), ivec2(4, 6));
}
void main() {
vec4 inner_result = f();
value = inner_result;
return;
}

View File

@ -0,0 +1,18 @@
#include <metal_stdlib>
using namespace metal;
struct tint_symbol {
float4 value [[color(0)]];
};
float4 f_inner(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
return tint_symbol_1.sample(tint_symbol_2, float2(0.0f), int2(4, 6));
}
fragment tint_symbol f(texture2d<float, access::sample> tint_symbol_3 [[texture(0)]], sampler tint_symbol_4 [[sampler(0)]]) {
float4 const inner_result = f_inner(tint_symbol_3, tint_symbol_4);
tint_symbol wrapper_result = {};
wrapper_result.value = inner_result;
return wrapper_result;
}

View File

@ -0,0 +1,55 @@
; SPIR-V
; Version: 1.3
; Generator: Google Tint Compiler; 0
; Bound: 32
; Schema: 0
OpCapability Shader
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %f "f" %value
OpExecutionMode %f OriginUpperLeft
OpName %value "value"
OpName %t "t"
OpName %s "s"
OpName %f_inner "f_inner"
OpName %f "f"
OpDecorate %value Location 0
OpDecorate %t Binding 0
OpDecorate %t DescriptorSet 0
OpDecorate %s Binding 0
OpDecorate %s DescriptorSet 1
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%5 = OpConstantNull %v4float
%value = OpVariable %_ptr_Output_v4float Output %5
%8 = OpTypeImage %float 2D 0 0 0 1 Unknown
%_ptr_UniformConstant_8 = OpTypePointer UniformConstant %8
%t = OpVariable %_ptr_UniformConstant_8 UniformConstant
%11 = OpTypeSampler
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
%s = OpVariable %_ptr_UniformConstant_11 UniformConstant
%12 = OpTypeFunction %v4float
%18 = OpTypeSampledImage %8
%v2float = OpTypeVector %float 2
%21 = OpConstantNull %v2float
%int = OpTypeInt 32 1
%v2int = OpTypeVector %int 2
%int_4 = OpConstant %int 4
%int_6 = OpConstant %int 6
%26 = OpConstantComposite %v2int %int_4 %int_6
%void = OpTypeVoid
%27 = OpTypeFunction %void
%f_inner = OpFunction %v4float None %12
%14 = OpLabel
%16 = OpLoad %11 %s
%17 = OpLoad %8 %t
%19 = OpSampledImage %18 %17 %16
%15 = OpImageSampleImplicitLod %v4float %19 %21 ConstOffset %26
OpReturnValue %15
OpFunctionEnd
%f = OpFunction %void None %27
%30 = OpLabel
%31 = OpFunctionCall %v4float %f_inner
OpStore %value %31
OpReturn
OpFunctionEnd

View File

@ -0,0 +1,8 @@
@binding(0) @group(0) var t : texture_2d<f32>;
@binding(0) @group(1) var s : sampler;
@fragment
fn f() -> @location(0) vec4<f32> {
return textureSample(t, s, vec2<f32>(), (vec2<i32>(1, 2) + vec2<i32>(3, 4)));
}