From 279864c774bca5249194811249c2ec5fe7b1a14b Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Fri, 4 Nov 2022 17:49:47 +0000 Subject: [PATCH] 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 Commit-Queue: Ben Clayton Reviewed-by: Antonio Maiorano --- test/tint/bug/tint/1183.wgsl | 7 +++ .../tint/bug/tint/1183.wgsl.expected.dxc.hlsl | 17 ++++++ .../tint/bug/tint/1183.wgsl.expected.fxc.hlsl | 17 ++++++ test/tint/bug/tint/1183.wgsl.expected.glsl | 15 +++++ test/tint/bug/tint/1183.wgsl.expected.msl | 18 ++++++ test/tint/bug/tint/1183.wgsl.expected.spvasm | 55 +++++++++++++++++++ test/tint/bug/tint/1183.wgsl.expected.wgsl | 8 +++ 7 files changed, 137 insertions(+) create mode 100644 test/tint/bug/tint/1183.wgsl create mode 100644 test/tint/bug/tint/1183.wgsl.expected.dxc.hlsl create mode 100644 test/tint/bug/tint/1183.wgsl.expected.fxc.hlsl create mode 100644 test/tint/bug/tint/1183.wgsl.expected.glsl create mode 100644 test/tint/bug/tint/1183.wgsl.expected.msl create mode 100644 test/tint/bug/tint/1183.wgsl.expected.spvasm create mode 100644 test/tint/bug/tint/1183.wgsl.expected.wgsl diff --git a/test/tint/bug/tint/1183.wgsl b/test/tint/bug/tint/1183.wgsl new file mode 100644 index 0000000000..3447e90053 --- /dev/null +++ b/test/tint/bug/tint/1183.wgsl @@ -0,0 +1,7 @@ +@binding(0) @group(0) var t : texture_2d; +@binding(0) @group(1) var s : sampler; + +@fragment +fn f() -> @location(0) vec4 { + return textureSample(t, s, vec2(), vec2(1, 2) + vec2(3, 4)); +} diff --git a/test/tint/bug/tint/1183.wgsl.expected.dxc.hlsl b/test/tint/bug/tint/1183.wgsl.expected.dxc.hlsl new file mode 100644 index 0000000000..d4fcab073e --- /dev/null +++ b/test/tint/bug/tint/1183.wgsl.expected.dxc.hlsl @@ -0,0 +1,17 @@ +Texture2D 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; +} diff --git a/test/tint/bug/tint/1183.wgsl.expected.fxc.hlsl b/test/tint/bug/tint/1183.wgsl.expected.fxc.hlsl new file mode 100644 index 0000000000..d4fcab073e --- /dev/null +++ b/test/tint/bug/tint/1183.wgsl.expected.fxc.hlsl @@ -0,0 +1,17 @@ +Texture2D 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; +} diff --git a/test/tint/bug/tint/1183.wgsl.expected.glsl b/test/tint/bug/tint/1183.wgsl.expected.glsl new file mode 100644 index 0000000000..ea49d5491b --- /dev/null +++ b/test/tint/bug/tint/1183.wgsl.expected.glsl @@ -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; +} diff --git a/test/tint/bug/tint/1183.wgsl.expected.msl b/test/tint/bug/tint/1183.wgsl.expected.msl new file mode 100644 index 0000000000..0b37ff6953 --- /dev/null +++ b/test/tint/bug/tint/1183.wgsl.expected.msl @@ -0,0 +1,18 @@ +#include + +using namespace metal; +struct tint_symbol { + float4 value [[color(0)]]; +}; + +float4 f_inner(texture2d 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 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; +} + diff --git a/test/tint/bug/tint/1183.wgsl.expected.spvasm b/test/tint/bug/tint/1183.wgsl.expected.spvasm new file mode 100644 index 0000000000..5a64dc6885 --- /dev/null +++ b/test/tint/bug/tint/1183.wgsl.expected.spvasm @@ -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 diff --git a/test/tint/bug/tint/1183.wgsl.expected.wgsl b/test/tint/bug/tint/1183.wgsl.expected.wgsl new file mode 100644 index 0000000000..973d5bdf47 --- /dev/null +++ b/test/tint/bug/tint/1183.wgsl.expected.wgsl @@ -0,0 +1,8 @@ +@binding(0) @group(0) var t : texture_2d; + +@binding(0) @group(1) var s : sampler; + +@fragment +fn f() -> @location(0) vec4 { + return textureSample(t, s, vec2(), (vec2(1, 2) + vec2(3, 4))); +}