mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-09 21:47:47 +00:00
Implement textureGather, textureGatherCompare
All writers implemented, along with resolving and validation. TODO: SPIR-V Reader. Bug: tint:1330 Change-Id: I8ba2f6023749474f80efb8a5422ac187e6c73a69 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/71820 Reviewed-by: David Neto <dneto@google.com> Commit-Queue: Ben Clayton <bclayton@google.com> Kokoro: Ben Clayton <bclayton@google.com>
This commit is contained in:
committed by
Tint LUCI CQ
parent
2f7730a16e
commit
3703522d41
47
test/intrinsics/gen/textureGather/01305f.wgsl
Normal file
47
test/intrinsics/gen/textureGather/01305f.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d_array<u32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d_array<u32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<u32>
|
||||
fn textureGather_01305f() {
|
||||
var res: vec4<u32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_01305f();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_01305f();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_01305f();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/01305f.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/01305f.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2DArray<uint4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_01305f() {
|
||||
uint4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_01305f();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_01305f();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_01305f();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/01305f.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/01305f.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_01305f(texture2d_array<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(0), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d_array<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_01305f(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d_array<uint, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d_array<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_01305f(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d_array<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_01305f(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 49
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_01305f "textureGather_01305f"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%uint = OpTypeInt 32 0
|
||||
%11 = OpTypeImage %uint 2D 0 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%15 = OpTypeSampler
|
||||
%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%24 = OpTypeSampledImage %11
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_0 = OpConstant %float 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%34 = OpConstantNull %v4uint
|
||||
%35 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_01305f = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4uint Function %34
|
||||
%22 = OpLoad %15 %arg_2
|
||||
%23 = OpLoad %11 %arg_1
|
||||
%25 = OpSampledImage %24 %23 %22
|
||||
%28 = OpConvertSToF %float %int_1
|
||||
%31 = OpCompositeConstruct %v3float %float_0 %float_0 %28
|
||||
%20 = OpImageGather %v4uint %25 %31 %int_1
|
||||
OpStore %res %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %35
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %void %textureGather_01305f
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %41
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%44 = OpLabel
|
||||
%45 = OpFunctionCall %void %textureGather_01305f
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%47 = OpLabel
|
||||
%48 = OpFunctionCall %void %textureGather_01305f
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/01305f.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/01305f.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d_array<u32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_01305f() {
|
||||
var res : vec4<u32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_01305f();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_01305f();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_01305f();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/06030a.wgsl
Normal file
47
test/intrinsics/gen/textureGather/06030a.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d_array<f32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, offset: vec2<i32>) -> vec4<f32>
|
||||
fn textureGather_06030a() {
|
||||
var res: vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1, vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_06030a();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_06030a();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_06030a();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/06030a.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/06030a.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2DArray<float4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_06030a() {
|
||||
float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), int2(0, 0));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_06030a();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_06030a();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_06030a();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/06030a.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/06030a.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_06030a(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_06030a(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_06030a(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_06030a(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 48
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_06030a "textureGather_06030a"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 0 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_0 = OpConstant %float 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%31 = OpConstantNull %v2int
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%34 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_06030a = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_2
|
||||
%21 = OpLoad %11 %arg_1
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%26 = OpConvertSToF %float %int_1
|
||||
%29 = OpCompositeConstruct %v3float %float_0 %float_0 %26
|
||||
%19 = OpImageGather %v4float %23 %29 %int_1 ConstOffset %31
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %34
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %textureGather_06030a
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %40
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %textureGather_06030a
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%46 = OpLabel
|
||||
%47 = OpFunctionCall %void %textureGather_06030a
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/06030a.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/06030a.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d_array<f32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_06030a() {
|
||||
var res : vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1, vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_06030a();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_06030a();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_06030a();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/10c554.wgsl
Normal file
47
test/intrinsics/gen/textureGather/10c554.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_cube;
|
||||
[[group(1), binding(1)]] var arg_1: sampler;
|
||||
|
||||
// fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>) -> vec4<f32>
|
||||
fn textureGather_10c554() {
|
||||
var res: vec4<f32> = textureGather(arg_0, arg_1, vec3<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_10c554();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_10c554();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_10c554();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/10c554.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/10c554.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
TextureCube arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
void textureGather_10c554() {
|
||||
float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_10c554();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_10c554();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_10c554();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/10c554.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/10c554.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_10c554(depthcube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float3());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(depthcube<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_10c554(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depthcube<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depthcube<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_10c554(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depthcube<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_10c554(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 44
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %textureGather_10c554 "textureGather_10c554"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float Cube 1 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v3float = OpTypeVector %float 3
|
||||
%25 = OpConstantNull %v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%30 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_10c554 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_1
|
||||
%21 = OpLoad %11 %arg_0
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%19 = OpImageGather %v4float %23 %25 %int_0
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %30
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %textureGather_10c554
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %36
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %textureGather_10c554
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%42 = OpLabel
|
||||
%43 = OpFunctionCall %void %textureGather_10c554
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/10c554.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/10c554.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(0)]] var arg_0 : texture_depth_cube;
|
||||
|
||||
[[group(1), binding(1)]] var arg_1 : sampler;
|
||||
|
||||
fn textureGather_10c554() {
|
||||
var res : vec4<f32> = textureGather(arg_0, arg_1, vec3<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_10c554();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_10c554();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_10c554();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/15d79c.wgsl
Normal file
47
test/intrinsics/gen/textureGather/15d79c.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d<f32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, offset: vec2<i32>) -> vec4<f32>
|
||||
fn textureGather_15d79c() {
|
||||
var res: vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_15d79c();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_15d79c();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_15d79c();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/15d79c.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/15d79c.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2D<float4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_15d79c() {
|
||||
float4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f), int2(0, 0));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_15d79c();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_15d79c();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_15d79c();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/15d79c.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/15d79c.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_15d79c(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_15d79c(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_15d79c(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_15d79c(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 46
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_15d79c "textureGather_15d79c"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v2float = OpTypeVector %float 2
|
||||
%25 = OpConstantNull %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%29 = OpConstantNull %v2int
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%32 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_15d79c = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_2
|
||||
%21 = OpLoad %11 %arg_1
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%19 = OpImageGather %v4float %23 %25 %int_1 ConstOffset %29
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %textureGather_15d79c
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %textureGather_15d79c
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%44 = OpLabel
|
||||
%45 = OpFunctionCall %void %textureGather_15d79c
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/15d79c.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/15d79c.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d<f32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_15d79c() {
|
||||
var res : vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_15d79c();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_15d79c();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_15d79c();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/2e0ed5.wgsl
Normal file
47
test/intrinsics/gen/textureGather/2e0ed5.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_2d;
|
||||
[[group(1), binding(1)]] var arg_1: sampler;
|
||||
|
||||
// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
|
||||
fn textureGather_2e0ed5() {
|
||||
var res: vec4<f32> = textureGather(arg_0, arg_1, vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_2e0ed5();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_2e0ed5();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_2e0ed5();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/2e0ed5.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/2e0ed5.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2D arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
void textureGather_2e0ed5() {
|
||||
float4 res = arg_0.Gather(arg_1, float2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_2e0ed5();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_2e0ed5();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_2e0ed5();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/2e0ed5.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/2e0ed5.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_2e0ed5(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float2());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_2e0ed5(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_2e0ed5(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_2e0ed5(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 44
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %textureGather_2e0ed5 "textureGather_2e0ed5"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 1 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v2float = OpTypeVector %float 2
|
||||
%25 = OpConstantNull %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%30 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_2e0ed5 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_1
|
||||
%21 = OpLoad %11 %arg_0
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%19 = OpImageGather %v4float %23 %25 %int_0
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %30
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %textureGather_2e0ed5
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %36
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %textureGather_2e0ed5
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%42 = OpLabel
|
||||
%43 = OpFunctionCall %void %textureGather_2e0ed5
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/2e0ed5.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/2e0ed5.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(0)]] var arg_0 : texture_depth_2d;
|
||||
|
||||
[[group(1), binding(1)]] var arg_1 : sampler;
|
||||
|
||||
fn textureGather_2e0ed5() {
|
||||
var res : vec4<f32> = textureGather(arg_0, arg_1, vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_2e0ed5();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_2e0ed5();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_2e0ed5();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/3112e8.wgsl
Normal file
47
test/intrinsics/gen/textureGather/3112e8.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_cube_array<f32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<f32>
|
||||
fn textureGather_3112e8() {
|
||||
var res: vec4<f32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_3112e8();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_3112e8();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_3112e8();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/3112e8.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/3112e8.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
TextureCubeArray<float4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_3112e8() {
|
||||
float4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1)));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_3112e8();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_3112e8();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_3112e8();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/3112e8.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/3112e8.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_3112e8(texturecube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float3(), 1, component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texturecube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_3112e8(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texturecube_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texturecube_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_3112e8(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texturecube_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_3112e8(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 45
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability SampledCubeArray
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_3112e8 "textureGather_3112e8"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float Cube 0 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%float_0 = OpConstant %float 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%31 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_3112e8 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_2
|
||||
%21 = OpLoad %11 %arg_1
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%25 = OpConvertSToF %float %int_1
|
||||
%28 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %25
|
||||
%19 = OpImageGather %v4float %23 %28 %int_1
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %31
|
||||
%33 = OpLabel
|
||||
%34 = OpFunctionCall %void %textureGather_3112e8
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %37
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %void %textureGather_3112e8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %textureGather_3112e8
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/3112e8.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/3112e8.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_cube_array<f32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_3112e8() {
|
||||
var res : vec4<f32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_3112e8();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_3112e8();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_3112e8();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/3c527e.wgsl
Normal file
47
test/intrinsics/gen/textureGather/3c527e.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_cube_array<u32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_cube_array<u32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<u32>
|
||||
fn textureGather_3c527e() {
|
||||
var res: vec4<u32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_3c527e();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_3c527e();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_3c527e();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/3c527e.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/3c527e.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
TextureCubeArray<uint4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_3c527e() {
|
||||
uint4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1)));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_3c527e();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_3c527e();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_3c527e();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/3c527e.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/3c527e.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_3c527e(texturecube_array<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
uint4 res = tint_symbol_1.gather(tint_symbol_2, float3(), 1, component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texturecube_array<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_3c527e(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texturecube_array<uint, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texturecube_array<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_3c527e(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texturecube_array<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_3c527e(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 48
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability SampledCubeArray
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_3c527e "textureGather_3c527e"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%uint = OpTypeInt 32 0
|
||||
%11 = OpTypeImage %uint Cube 0 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%15 = OpTypeSampler
|
||||
%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%24 = OpTypeSampledImage %11
|
||||
%float_0 = OpConstant %float 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%33 = OpConstantNull %v4uint
|
||||
%34 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_3c527e = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4uint Function %33
|
||||
%22 = OpLoad %15 %arg_2
|
||||
%23 = OpLoad %11 %arg_1
|
||||
%25 = OpSampledImage %24 %23 %22
|
||||
%27 = OpConvertSToF %float %int_1
|
||||
%30 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27
|
||||
%20 = OpImageGather %v4uint %25 %30 %int_1
|
||||
OpStore %res %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %34
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %textureGather_3c527e
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %40
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %textureGather_3c527e
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%46 = OpLabel
|
||||
%47 = OpFunctionCall %void %textureGather_3c527e
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/3c527e.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/3c527e.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_cube_array<u32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_3c527e() {
|
||||
var res : vec4<u32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_3c527e();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_3c527e();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_3c527e();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/43025d.wgsl
Normal file
47
test/intrinsics/gen/textureGather/43025d.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_cube_array;
|
||||
[[group(1), binding(1)]] var arg_1: sampler;
|
||||
|
||||
// fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<f32>
|
||||
fn textureGather_43025d() {
|
||||
var res: vec4<f32> = textureGather(arg_0, arg_1, vec3<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_43025d();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_43025d();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_43025d();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/43025d.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/43025d.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
TextureCubeArray arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
void textureGather_43025d() {
|
||||
float4 res = arg_0.Gather(arg_1, float4(0.0f, 0.0f, 0.0f, float(1)));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_43025d();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_43025d();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_43025d();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/43025d.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/43025d.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_43025d(depthcube_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float3(), 1);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(depthcube_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_43025d(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depthcube_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depthcube_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_43025d(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depthcube_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_43025d(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 46
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability SampledCubeArray
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %textureGather_43025d "textureGather_43025d"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float Cube 1 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%float_0 = OpConstant %float 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%32 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_43025d = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_1
|
||||
%21 = OpLoad %11 %arg_0
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%25 = OpConvertSToF %float %int_1
|
||||
%28 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %25
|
||||
%19 = OpImageGather %v4float %23 %28 %int_0
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %textureGather_43025d
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %textureGather_43025d
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%44 = OpLabel
|
||||
%45 = OpFunctionCall %void %textureGather_43025d
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/43025d.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/43025d.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(0)]] var arg_0 : texture_depth_cube_array;
|
||||
|
||||
[[group(1), binding(1)]] var arg_1 : sampler;
|
||||
|
||||
fn textureGather_43025d() {
|
||||
var res : vec4<f32> = textureGather(arg_0, arg_1, vec3<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_43025d();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_43025d();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_43025d();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/4f2350.wgsl
Normal file
47
test/intrinsics/gen/textureGather/4f2350.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d_array<i32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: i32, offset: vec2<i32>) -> vec4<i32>
|
||||
fn textureGather_4f2350() {
|
||||
var res: vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1, vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_4f2350();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_4f2350();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_4f2350();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/4f2350.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/4f2350.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2DArray<int4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_4f2350() {
|
||||
int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)), int2(0, 0));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_4f2350();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_4f2350();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_4f2350();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/4f2350.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/4f2350.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_4f2350(texture2d_array<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_4f2350(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_4f2350(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_4f2350(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 50
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_4f2350 "textureGather_4f2350"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%int = OpTypeInt 32 1
|
||||
%11 = OpTypeImage %int 2D 0 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%15 = OpTypeSampler
|
||||
%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%v4int = OpTypeVector %int 4
|
||||
%24 = OpTypeSampledImage %11
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%32 = OpConstantNull %v2int
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%35 = OpConstantNull %v4int
|
||||
%36 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_4f2350 = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4int Function %35
|
||||
%22 = OpLoad %15 %arg_2
|
||||
%23 = OpLoad %11 %arg_1
|
||||
%25 = OpSampledImage %24 %23 %22
|
||||
%28 = OpConvertSToF %float %int_1
|
||||
%30 = OpCompositeConstruct %v3float %float_0 %float_0 %28
|
||||
%20 = OpImageGather %v4int %25 %30 %int_1 ConstOffset %32
|
||||
OpStore %res %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %36
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %void %textureGather_4f2350
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %42
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%45 = OpLabel
|
||||
%46 = OpFunctionCall %void %textureGather_4f2350
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%48 = OpLabel
|
||||
%49 = OpFunctionCall %void %textureGather_4f2350
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/4f2350.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/4f2350.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d_array<i32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_4f2350() {
|
||||
var res : vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1, vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_4f2350();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_4f2350();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_4f2350();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/51cf0b.wgsl
Normal file
47
test/intrinsics/gen/textureGather/51cf0b.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d_array<i32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d_array<i32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<i32>
|
||||
fn textureGather_51cf0b() {
|
||||
var res: vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_51cf0b();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_51cf0b();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_51cf0b();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/51cf0b.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/51cf0b.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2DArray<int4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_51cf0b() {
|
||||
int4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_51cf0b();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_51cf0b();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_51cf0b();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/51cf0b.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/51cf0b.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_51cf0b(texture2d_array<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(0), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d_array<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_51cf0b(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d_array<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d_array<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_51cf0b(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d_array<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_51cf0b(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 48
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_51cf0b "textureGather_51cf0b"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%int = OpTypeInt 32 1
|
||||
%11 = OpTypeImage %int 2D 0 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%15 = OpTypeSampler
|
||||
%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%v4int = OpTypeVector %int 4
|
||||
%24 = OpTypeSampledImage %11
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%33 = OpConstantNull %v4int
|
||||
%34 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_51cf0b = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4int Function %33
|
||||
%22 = OpLoad %15 %arg_2
|
||||
%23 = OpLoad %11 %arg_1
|
||||
%25 = OpSampledImage %24 %23 %22
|
||||
%28 = OpConvertSToF %float %int_1
|
||||
%30 = OpCompositeConstruct %v3float %float_0 %float_0 %28
|
||||
%20 = OpImageGather %v4int %25 %30 %int_1
|
||||
OpStore %res %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %34
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %textureGather_51cf0b
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %40
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %textureGather_51cf0b
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%46 = OpLabel
|
||||
%47 = OpFunctionCall %void %textureGather_51cf0b
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/51cf0b.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/51cf0b.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d_array<i32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_51cf0b() {
|
||||
var res : vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_51cf0b();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_51cf0b();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_51cf0b();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/53ece6.wgsl
Normal file
47
test/intrinsics/gen/textureGather/53ece6.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_2d_array;
|
||||
[[group(1), binding(1)]] var arg_1: sampler;
|
||||
|
||||
// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, offset: vec2<i32>) -> vec4<f32>
|
||||
fn textureGather_53ece6() {
|
||||
var res: vec4<f32> = textureGather(arg_0, arg_1, vec2<f32>(), 1, vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_53ece6();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_53ece6();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_53ece6();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/53ece6.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/53ece6.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2DArray arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
void textureGather_53ece6() {
|
||||
float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1)), int2(0, 0));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_53ece6();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_53ece6();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_53ece6();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/53ece6.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/53ece6.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_53ece6(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_53ece6(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_53ece6(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_53ece6(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 49
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %textureGather_53ece6 "textureGather_53ece6"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 1 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_0 = OpConstant %float 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v2int = OpTypeVector %int 2
|
||||
%32 = OpConstantNull %v2int
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%35 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_53ece6 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_1
|
||||
%21 = OpLoad %11 %arg_0
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%26 = OpConvertSToF %float %int_1
|
||||
%29 = OpCompositeConstruct %v3float %float_0 %float_0 %26
|
||||
%19 = OpImageGather %v4float %23 %29 %int_0 ConstOffset %32
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %35
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %void %textureGather_53ece6
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %41
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%44 = OpLabel
|
||||
%45 = OpFunctionCall %void %textureGather_53ece6
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%47 = OpLabel
|
||||
%48 = OpFunctionCall %void %textureGather_53ece6
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/53ece6.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/53ece6.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(0)]] var arg_0 : texture_depth_2d_array;
|
||||
|
||||
[[group(1), binding(1)]] var arg_1 : sampler;
|
||||
|
||||
fn textureGather_53ece6() {
|
||||
var res : vec4<f32> = textureGather(arg_0, arg_1, vec2<f32>(), 1, vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_53ece6();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_53ece6();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_53ece6();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/57bfc6.wgsl
Normal file
47
test/intrinsics/gen/textureGather/57bfc6.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_cube<f32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>) -> vec4<f32>
|
||||
fn textureGather_57bfc6() {
|
||||
var res: vec4<f32> = textureGather(1, arg_1, arg_2, vec3<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_57bfc6();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_57bfc6();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_57bfc6();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/57bfc6.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/57bfc6.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
TextureCube<float4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_57bfc6() {
|
||||
float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_57bfc6();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_57bfc6();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_57bfc6();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/57bfc6.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/57bfc6.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_57bfc6(texturecube<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float3(), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texturecube<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_57bfc6(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texturecube<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texturecube<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_57bfc6(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texturecube<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_57bfc6(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 44
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_57bfc6 "textureGather_57bfc6"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float Cube 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v3float = OpTypeVector %float 3
|
||||
%25 = OpConstantNull %v3float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%30 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_57bfc6 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_2
|
||||
%21 = OpLoad %11 %arg_1
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%19 = OpImageGather %v4float %23 %25 %int_1
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %30
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %textureGather_57bfc6
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %36
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %textureGather_57bfc6
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%42 = OpLabel
|
||||
%43 = OpFunctionCall %void %textureGather_57bfc6
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/57bfc6.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/57bfc6.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_cube<f32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_57bfc6() {
|
||||
var res : vec4<f32> = textureGather(1, arg_1, arg_2, vec3<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_57bfc6();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_57bfc6();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_57bfc6();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/587ba3.wgsl
Normal file
47
test/intrinsics/gen/textureGather/587ba3.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d<i32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d<i32>, sampler: sampler, coords: vec2<f32>) -> vec4<i32>
|
||||
fn textureGather_587ba3() {
|
||||
var res: vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_587ba3();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_587ba3();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_587ba3();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/587ba3.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/587ba3.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2D<int4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_587ba3() {
|
||||
int4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_587ba3();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_587ba3();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_587ba3();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/587ba3.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/587ba3.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_587ba3(texture2d<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_587ba3(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_587ba3(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_587ba3(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 46
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_587ba3 "textureGather_587ba3"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%int = OpTypeInt 32 1
|
||||
%11 = OpTypeImage %int 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%15 = OpTypeSampler
|
||||
%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%v4int = OpTypeVector %int 4
|
||||
%24 = OpTypeSampledImage %11
|
||||
%v2float = OpTypeVector %float 2
|
||||
%27 = OpConstantNull %v2float
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%31 = OpConstantNull %v4int
|
||||
%32 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_587ba3 = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4int Function %31
|
||||
%22 = OpLoad %15 %arg_2
|
||||
%23 = OpLoad %11 %arg_1
|
||||
%25 = OpSampledImage %24 %23 %22
|
||||
%20 = OpImageGather %v4int %25 %27 %int_1
|
||||
OpStore %res %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %textureGather_587ba3
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %textureGather_587ba3
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%44 = OpLabel
|
||||
%45 = OpFunctionCall %void %textureGather_587ba3
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/587ba3.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/587ba3.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d<i32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_587ba3() {
|
||||
var res : vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_587ba3();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_587ba3();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_587ba3();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/69e0fb.wgsl
Normal file
47
test/intrinsics/gen/textureGather/69e0fb.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d<i32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d<i32>, sampler: sampler, coords: vec2<f32>, offset: vec2<i32>) -> vec4<i32>
|
||||
fn textureGather_69e0fb() {
|
||||
var res: vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_69e0fb();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_69e0fb();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_69e0fb();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/69e0fb.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/69e0fb.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2D<int4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_69e0fb() {
|
||||
int4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f), int2(0, 0));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_69e0fb();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_69e0fb();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_69e0fb();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/69e0fb.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/69e0fb.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_69e0fb(texture2d<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
int4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_69e0fb(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_69e0fb(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_69e0fb(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 48
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_69e0fb "textureGather_69e0fb"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%int = OpTypeInt 32 1
|
||||
%11 = OpTypeImage %int 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%15 = OpTypeSampler
|
||||
%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%v4int = OpTypeVector %int 4
|
||||
%24 = OpTypeSampledImage %11
|
||||
%v2float = OpTypeVector %float 2
|
||||
%27 = OpConstantNull %v2float
|
||||
%int_1 = OpConstant %int 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%30 = OpConstantNull %v2int
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%33 = OpConstantNull %v4int
|
||||
%34 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_69e0fb = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4int Function %33
|
||||
%22 = OpLoad %15 %arg_2
|
||||
%23 = OpLoad %11 %arg_1
|
||||
%25 = OpSampledImage %24 %23 %22
|
||||
%20 = OpImageGather %v4int %25 %27 %int_1 ConstOffset %30
|
||||
OpStore %res %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %34
|
||||
%36 = OpLabel
|
||||
%37 = OpFunctionCall %void %textureGather_69e0fb
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %40
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%43 = OpLabel
|
||||
%44 = OpFunctionCall %void %textureGather_69e0fb
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%46 = OpLabel
|
||||
%47 = OpFunctionCall %void %textureGather_69e0fb
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/69e0fb.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/69e0fb.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d<i32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_69e0fb() {
|
||||
var res : vec4<i32> = textureGather(1, arg_1, arg_2, vec2<f32>(), vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_69e0fb();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_69e0fb();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_69e0fb();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/93003d.wgsl
Normal file
47
test/intrinsics/gen/textureGather/93003d.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d<u32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d<u32>, sampler: sampler, coords: vec2<f32>, offset: vec2<i32>) -> vec4<u32>
|
||||
fn textureGather_93003d() {
|
||||
var res: vec4<u32> = textureGather(1, arg_1, arg_2, vec2<f32>(), vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_93003d();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_93003d();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_93003d();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/93003d.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/93003d.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2D<uint4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_93003d() {
|
||||
uint4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f), int2(0, 0));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_93003d();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_93003d();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_93003d();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/93003d.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/93003d.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_93003d(texture2d<uint, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
uint4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d<uint, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_93003d(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d<uint, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d<uint, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_93003d(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d<uint, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_93003d(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 49
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_93003d "textureGather_93003d"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%uint = OpTypeInt 32 0
|
||||
%11 = OpTypeImage %uint 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%15 = OpTypeSampler
|
||||
%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%v4uint = OpTypeVector %uint 4
|
||||
%24 = OpTypeSampledImage %11
|
||||
%v2float = OpTypeVector %float 2
|
||||
%27 = OpConstantNull %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%v2int = OpTypeVector %int 2
|
||||
%31 = OpConstantNull %v2int
|
||||
%_ptr_Function_v4uint = OpTypePointer Function %v4uint
|
||||
%34 = OpConstantNull %v4uint
|
||||
%35 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_93003d = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4uint Function %34
|
||||
%22 = OpLoad %15 %arg_2
|
||||
%23 = OpLoad %11 %arg_1
|
||||
%25 = OpSampledImage %24 %23 %22
|
||||
%20 = OpImageGather %v4uint %25 %27 %int_1 ConstOffset %31
|
||||
OpStore %res %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %35
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %void %textureGather_93003d
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%40 = OpLabel
|
||||
%41 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %41
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%44 = OpLabel
|
||||
%45 = OpFunctionCall %void %textureGather_93003d
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%47 = OpLabel
|
||||
%48 = OpFunctionCall %void %textureGather_93003d
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/93003d.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/93003d.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d<u32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_93003d() {
|
||||
var res : vec4<u32> = textureGather(1, arg_1, arg_2, vec2<f32>(), vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_93003d();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_93003d();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_93003d();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/9a6358.wgsl
Normal file
47
test/intrinsics/gen/textureGather/9a6358.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_2d_array;
|
||||
[[group(1), binding(1)]] var arg_1: sampler;
|
||||
|
||||
// fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<f32>
|
||||
fn textureGather_9a6358() {
|
||||
var res: vec4<f32> = textureGather(arg_0, arg_1, vec2<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_9a6358();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_9a6358();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_9a6358();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/9a6358.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/9a6358.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2DArray arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
void textureGather_9a6358() {
|
||||
float4 res = arg_0.Gather(arg_1, float3(0.0f, 0.0f, float(1)));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_9a6358();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_9a6358();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_9a6358();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/9a6358.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/9a6358.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_9a6358(depth2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(depth2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_9a6358(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depth2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_9a6358(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_9a6358(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 47
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %textureGather_9a6358 "textureGather_9a6358"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 1 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_0 = OpConstant %float 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%33 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_9a6358 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_1
|
||||
%21 = OpLoad %11 %arg_0
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%26 = OpConvertSToF %float %int_1
|
||||
%29 = OpCompositeConstruct %v3float %float_0 %float_0 %26
|
||||
%19 = OpImageGather %v4float %23 %29 %int_0
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %33
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %textureGather_9a6358
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %39
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%42 = OpLabel
|
||||
%43 = OpFunctionCall %void %textureGather_9a6358
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%45 = OpLabel
|
||||
%46 = OpFunctionCall %void %textureGather_9a6358
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/9a6358.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/9a6358.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(0)]] var arg_0 : texture_depth_2d_array;
|
||||
|
||||
[[group(1), binding(1)]] var arg_1 : sampler;
|
||||
|
||||
fn textureGather_9a6358() {
|
||||
var res : vec4<f32> = textureGather(arg_0, arg_1, vec2<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_9a6358();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_9a6358();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_9a6358();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/9efca2.wgsl
Normal file
47
test/intrinsics/gen/textureGather/9efca2.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d_array<f32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<f32>
|
||||
fn textureGather_9efca2() {
|
||||
var res: vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_9efca2();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_9efca2();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_9efca2();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/9efca2.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/9efca2.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2DArray<float4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_9efca2() {
|
||||
float4 res = arg_1.GatherGreen(arg_2, float3(0.0f, 0.0f, float(1)));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_9efca2();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_9efca2();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_9efca2();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/9efca2.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/9efca2.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_9efca2(texture2d_array<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), 1, int2(0), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d_array<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_9efca2(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d_array<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d_array<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_9efca2(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d_array<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_9efca2(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 46
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_9efca2 "textureGather_9efca2"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 0 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v3float = OpTypeVector %float 3
|
||||
%float_0 = OpConstant %float 0
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%32 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_9efca2 = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_2
|
||||
%21 = OpLoad %11 %arg_1
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%26 = OpConvertSToF %float %int_1
|
||||
%29 = OpCompositeConstruct %v3float %float_0 %float_0 %26
|
||||
%19 = OpImageGather %v4float %23 %29 %int_1
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %textureGather_9efca2
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %textureGather_9efca2
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%44 = OpLabel
|
||||
%45 = OpFunctionCall %void %textureGather_9efca2
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/9efca2.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/9efca2.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d_array<f32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_9efca2() {
|
||||
var res : vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_9efca2();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_9efca2();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_9efca2();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/bd0b1e.wgsl
Normal file
47
test/intrinsics/gen/textureGather/bd0b1e.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_2d<f32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>) -> vec4<f32>
|
||||
fn textureGather_bd0b1e() {
|
||||
var res: vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_bd0b1e();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_bd0b1e();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_bd0b1e();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/bd0b1e.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/bd0b1e.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2D<float4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_bd0b1e() {
|
||||
float4 res = arg_1.GatherGreen(arg_2, float2(0.0f, 0.0f));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_bd0b1e();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_bd0b1e();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_bd0b1e();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/bd0b1e.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/bd0b1e.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_bd0b1e(texture2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2(0), component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texture2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_bd0b1e(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texture2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texture2d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_bd0b1e(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texture2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_bd0b1e(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 44
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_bd0b1e "textureGather_bd0b1e"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 0 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v2float = OpTypeVector %float 2
|
||||
%25 = OpConstantNull %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%30 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_bd0b1e = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_2
|
||||
%21 = OpLoad %11 %arg_1
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%19 = OpImageGather %v4float %23 %25 %int_1
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %30
|
||||
%32 = OpLabel
|
||||
%33 = OpFunctionCall %void %textureGather_bd0b1e
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %36
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%39 = OpLabel
|
||||
%40 = OpFunctionCall %void %textureGather_bd0b1e
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%42 = OpLabel
|
||||
%43 = OpFunctionCall %void %textureGather_bd0b1e
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/bd0b1e.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/bd0b1e.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_2d<f32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_bd0b1e() {
|
||||
var res : vec4<f32> = textureGather(1, arg_1, arg_2, vec2<f32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_bd0b1e();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_bd0b1e();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_bd0b1e();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/c409ae.wgsl
Normal file
47
test/intrinsics/gen/textureGather/c409ae.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(0)]] var arg_0: texture_depth_2d;
|
||||
[[group(1), binding(1)]] var arg_1: sampler;
|
||||
|
||||
// fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, offset: vec2<i32>) -> vec4<f32>
|
||||
fn textureGather_c409ae() {
|
||||
var res: vec4<f32> = textureGather(arg_0, arg_1, vec2<f32>(), vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_c409ae();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_c409ae();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_c409ae();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/c409ae.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/c409ae.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
Texture2D arg_0 : register(t0, space1);
|
||||
SamplerState arg_1 : register(s1, space1);
|
||||
|
||||
void textureGather_c409ae() {
|
||||
float4 res = arg_0.Gather(arg_1, float2(0.0f, 0.0f), int2(0, 0));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_c409ae();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_c409ae();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_c409ae();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/c409ae.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/c409ae.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_c409ae(depth2d<float, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
float4 res = tint_symbol_1.gather(tint_symbol_2, float2(), int2());
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(depth2d<float, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_c409ae(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(depth2d<float, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(depth2d<float, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_c409ae(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(depth2d<float, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_c409ae(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 46
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_0 "arg_0"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %textureGather_c409ae "textureGather_c409ae"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_0 DescriptorSet 1
|
||||
OpDecorate %arg_0 Binding 0
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%11 = OpTypeImage %float 2D 1 0 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_0 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%14 = OpTypeSampler
|
||||
%_ptr_UniformConstant_14 = OpTypePointer UniformConstant %14
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_14 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%15 = OpTypeFunction %void
|
||||
%22 = OpTypeSampledImage %11
|
||||
%v2float = OpTypeVector %float 2
|
||||
%25 = OpConstantNull %v2float
|
||||
%int = OpTypeInt 32 1
|
||||
%int_0 = OpConstant %int 0
|
||||
%v2int = OpTypeVector %int 2
|
||||
%29 = OpConstantNull %v2int
|
||||
%_ptr_Function_v4float = OpTypePointer Function %v4float
|
||||
%32 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_c409ae = OpFunction %void None %15
|
||||
%18 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4float Function %5
|
||||
%20 = OpLoad %14 %arg_1
|
||||
%21 = OpLoad %11 %arg_0
|
||||
%23 = OpSampledImage %22 %21 %20
|
||||
%19 = OpImageGather %v4float %23 %25 %int_0 ConstOffset %29
|
||||
OpStore %res %19
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %32
|
||||
%34 = OpLabel
|
||||
%35 = OpFunctionCall %void %textureGather_c409ae
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %15
|
||||
%37 = OpLabel
|
||||
%38 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %38
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %15
|
||||
%41 = OpLabel
|
||||
%42 = OpFunctionCall %void %textureGather_c409ae
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %15
|
||||
%44 = OpLabel
|
||||
%45 = OpFunctionCall %void %textureGather_c409ae
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/c409ae.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/c409ae.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(0)]] var arg_0 : texture_depth_2d;
|
||||
|
||||
[[group(1), binding(1)]] var arg_1 : sampler;
|
||||
|
||||
fn textureGather_c409ae() {
|
||||
var res : vec4<f32> = textureGather(arg_0, arg_1, vec2<f32>(), vec2<i32>());
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_c409ae();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_c409ae();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_c409ae();
|
||||
}
|
||||
47
test/intrinsics/gen/textureGather/c55822.wgsl
Normal file
47
test/intrinsics/gen/textureGather/c55822.wgsl
Normal file
@@ -0,0 +1,47 @@
|
||||
// Copyright 2021 The Tint Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// File generated by tools/intrinsic-gen
|
||||
// using the template:
|
||||
// test/intrinsics/intrinsics.wgsl.tmpl
|
||||
// and the intrinsic defintion file:
|
||||
// src/intrinsics.def
|
||||
//
|
||||
// Do not modify this file directly
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[[group(1), binding(1)]] var arg_1: texture_cube_array<i32>;
|
||||
[[group(1), binding(2)]] var arg_2: sampler;
|
||||
|
||||
// fn textureGather(component: i32, texture: texture_cube_array<i32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<i32>
|
||||
fn textureGather_c55822() {
|
||||
var res: vec4<i32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_c55822();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_c55822();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_c55822();
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/c55822.wgsl.expected.hlsl
Normal file
33
test/intrinsics/gen/textureGather/c55822.wgsl.expected.hlsl
Normal file
@@ -0,0 +1,33 @@
|
||||
TextureCubeArray<int4> arg_1 : register(t1, space1);
|
||||
SamplerState arg_2 : register(s2, space1);
|
||||
|
||||
void textureGather_c55822() {
|
||||
int4 res = arg_1.GatherGreen(arg_2, float4(0.0f, 0.0f, 0.0f, float(1)));
|
||||
}
|
||||
|
||||
struct tint_symbol {
|
||||
float4 value : SV_Position;
|
||||
};
|
||||
|
||||
float4 vertex_main_inner() {
|
||||
textureGather_c55822();
|
||||
return float4(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
tint_symbol vertex_main() {
|
||||
const float4 inner_result = vertex_main_inner();
|
||||
tint_symbol wrapper_result = (tint_symbol)0;
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
void fragment_main() {
|
||||
textureGather_c55822();
|
||||
return;
|
||||
}
|
||||
|
||||
[numthreads(1, 1, 1)]
|
||||
void compute_main() {
|
||||
textureGather_c55822();
|
||||
return;
|
||||
}
|
||||
33
test/intrinsics/gen/textureGather/c55822.wgsl.expected.msl
Normal file
33
test/intrinsics/gen/textureGather/c55822.wgsl.expected.msl
Normal file
@@ -0,0 +1,33 @@
|
||||
#include <metal_stdlib>
|
||||
|
||||
using namespace metal;
|
||||
struct tint_symbol {
|
||||
float4 value [[position]];
|
||||
};
|
||||
|
||||
void textureGather_c55822(texturecube_array<int, access::sample> tint_symbol_1, sampler tint_symbol_2) {
|
||||
int4 res = tint_symbol_1.gather(tint_symbol_2, float3(), 1, component::y);
|
||||
}
|
||||
|
||||
float4 vertex_main_inner(texturecube_array<int, access::sample> tint_symbol_3, sampler tint_symbol_4) {
|
||||
textureGather_c55822(tint_symbol_3, tint_symbol_4);
|
||||
return float4();
|
||||
}
|
||||
|
||||
vertex tint_symbol vertex_main(texturecube_array<int, access::sample> tint_symbol_5 [[texture(0)]], sampler tint_symbol_6 [[sampler(0)]]) {
|
||||
float4 const inner_result = vertex_main_inner(tint_symbol_5, tint_symbol_6);
|
||||
tint_symbol wrapper_result = {};
|
||||
wrapper_result.value = inner_result;
|
||||
return wrapper_result;
|
||||
}
|
||||
|
||||
fragment void fragment_main(texturecube_array<int, access::sample> tint_symbol_7 [[texture(0)]], sampler tint_symbol_8 [[sampler(0)]]) {
|
||||
textureGather_c55822(tint_symbol_7, tint_symbol_8);
|
||||
return;
|
||||
}
|
||||
|
||||
kernel void compute_main(texturecube_array<int, access::sample> tint_symbol_9 [[texture(0)]], sampler tint_symbol_10 [[sampler(0)]]) {
|
||||
textureGather_c55822(tint_symbol_9, tint_symbol_10);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
; SPIR-V
|
||||
; Version: 1.3
|
||||
; Generator: Google Tint Compiler; 0
|
||||
; Bound: 47
|
||||
; Schema: 0
|
||||
OpCapability Shader
|
||||
OpCapability SampledCubeArray
|
||||
OpMemoryModel Logical GLSL450
|
||||
OpEntryPoint Vertex %vertex_main "vertex_main" %value %vertex_point_size
|
||||
OpEntryPoint Fragment %fragment_main "fragment_main"
|
||||
OpEntryPoint GLCompute %compute_main "compute_main"
|
||||
OpExecutionMode %fragment_main OriginUpperLeft
|
||||
OpExecutionMode %compute_main LocalSize 1 1 1
|
||||
OpName %value "value"
|
||||
OpName %vertex_point_size "vertex_point_size"
|
||||
OpName %arg_1 "arg_1"
|
||||
OpName %arg_2 "arg_2"
|
||||
OpName %textureGather_c55822 "textureGather_c55822"
|
||||
OpName %res "res"
|
||||
OpName %vertex_main_inner "vertex_main_inner"
|
||||
OpName %vertex_main "vertex_main"
|
||||
OpName %fragment_main "fragment_main"
|
||||
OpName %compute_main "compute_main"
|
||||
OpDecorate %value BuiltIn Position
|
||||
OpDecorate %vertex_point_size BuiltIn PointSize
|
||||
OpDecorate %arg_1 DescriptorSet 1
|
||||
OpDecorate %arg_1 Binding 1
|
||||
OpDecorate %arg_2 DescriptorSet 1
|
||||
OpDecorate %arg_2 Binding 2
|
||||
%float = OpTypeFloat 32
|
||||
%v4float = OpTypeVector %float 4
|
||||
%_ptr_Output_v4float = OpTypePointer Output %v4float
|
||||
%5 = OpConstantNull %v4float
|
||||
%value = OpVariable %_ptr_Output_v4float Output %5
|
||||
%_ptr_Output_float = OpTypePointer Output %float
|
||||
%8 = OpConstantNull %float
|
||||
%vertex_point_size = OpVariable %_ptr_Output_float Output %8
|
||||
%int = OpTypeInt 32 1
|
||||
%11 = OpTypeImage %int Cube 0 1 0 1 Unknown
|
||||
%_ptr_UniformConstant_11 = OpTypePointer UniformConstant %11
|
||||
%arg_1 = OpVariable %_ptr_UniformConstant_11 UniformConstant
|
||||
%15 = OpTypeSampler
|
||||
%_ptr_UniformConstant_15 = OpTypePointer UniformConstant %15
|
||||
%arg_2 = OpVariable %_ptr_UniformConstant_15 UniformConstant
|
||||
%void = OpTypeVoid
|
||||
%16 = OpTypeFunction %void
|
||||
%v4int = OpTypeVector %int 4
|
||||
%24 = OpTypeSampledImage %11
|
||||
%float_0 = OpConstant %float 0
|
||||
%int_1 = OpConstant %int 1
|
||||
%_ptr_Function_v4int = OpTypePointer Function %v4int
|
||||
%32 = OpConstantNull %v4int
|
||||
%33 = OpTypeFunction %v4float
|
||||
%float_1 = OpConstant %float 1
|
||||
%textureGather_c55822 = OpFunction %void None %16
|
||||
%19 = OpLabel
|
||||
%res = OpVariable %_ptr_Function_v4int Function %32
|
||||
%22 = OpLoad %15 %arg_2
|
||||
%23 = OpLoad %11 %arg_1
|
||||
%25 = OpSampledImage %24 %23 %22
|
||||
%27 = OpConvertSToF %float %int_1
|
||||
%29 = OpCompositeConstruct %v4float %float_0 %float_0 %float_0 %27
|
||||
%20 = OpImageGather %v4int %25 %29 %int_1
|
||||
OpStore %res %20
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%vertex_main_inner = OpFunction %v4float None %33
|
||||
%35 = OpLabel
|
||||
%36 = OpFunctionCall %void %textureGather_c55822
|
||||
OpReturnValue %5
|
||||
OpFunctionEnd
|
||||
%vertex_main = OpFunction %void None %16
|
||||
%38 = OpLabel
|
||||
%39 = OpFunctionCall %v4float %vertex_main_inner
|
||||
OpStore %value %39
|
||||
OpStore %vertex_point_size %float_1
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%fragment_main = OpFunction %void None %16
|
||||
%42 = OpLabel
|
||||
%43 = OpFunctionCall %void %textureGather_c55822
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
%compute_main = OpFunction %void None %16
|
||||
%45 = OpLabel
|
||||
%46 = OpFunctionCall %void %textureGather_c55822
|
||||
OpReturn
|
||||
OpFunctionEnd
|
||||
23
test/intrinsics/gen/textureGather/c55822.wgsl.expected.wgsl
Normal file
23
test/intrinsics/gen/textureGather/c55822.wgsl.expected.wgsl
Normal file
@@ -0,0 +1,23 @@
|
||||
[[group(1), binding(1)]] var arg_1 : texture_cube_array<i32>;
|
||||
|
||||
[[group(1), binding(2)]] var arg_2 : sampler;
|
||||
|
||||
fn textureGather_c55822() {
|
||||
var res : vec4<i32> = textureGather(1, arg_1, arg_2, vec3<f32>(), 1);
|
||||
}
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> [[builtin(position)]] vec4<f32> {
|
||||
textureGather_c55822();
|
||||
return vec4<f32>();
|
||||
}
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() {
|
||||
textureGather_c55822();
|
||||
}
|
||||
|
||||
[[stage(compute), workgroup_size(1)]]
|
||||
fn compute_main() {
|
||||
textureGather_c55822();
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user