1// Copyright 2021 The Tint Authors. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15//////////////////////////////////////////////////////////////////////////////// 16// WGSL intrinsic definition file // 17// // 18// This file is used to generate parts of the Tint IntrinsicTable, various // 19// enum definition files, as well as test .wgsl files. // 20//////////////////////////////////////////////////////////////////////////////// 21 22//////////////////////////////////////////////////////////////////////////////// 23// Enumerators // 24//////////////////////////////////////////////////////////////////////////////// 25 26// https://gpuweb.github.io/gpuweb/wgsl/#storage-class 27enum storage_class { 28 function 29 private 30 workgroup 31 uniform 32 storage 33 [[internal]] handle 34} 35 36// https://gpuweb.github.io/gpuweb/wgsl/#memory-access-mode 37enum access { 38 read 39 write 40 read_write 41} 42 43// https://gpuweb.github.io/gpuweb/wgsl/#texel-formats 44enum texel_format { 45 rgba8unorm 46 rgba8snorm 47 rgba8uint 48 rgba8sint 49 rgba16uint 50 rgba16sint 51 rgba16float 52 r32uint 53 r32sint 54 r32float 55 rg32uint 56 rg32sint 57 rg32float 58 rgba32uint 59 rgba32sint 60 rgba32float 61} 62 63//////////////////////////////////////////////////////////////////////////////// 64// WGSL primitive types // 65//////////////////////////////////////////////////////////////////////////////// 66 67// https://gpuweb.github.io/gpuweb/wgsl/#plain-types-section 68type bool 69type f32 70type i32 71type u32 72type vec2<T> 73type vec3<T> 74type vec4<T> 75[[display("vec{N}<{T}>")]] type vec<N: num, T> 76[[display("mat{N}x{M}<{T}>")]] type mat<N: num, M: num, T> 77type ptr<S: storage_class, T, A: access> 78type atomic<T> 79type array<T> 80type sampler 81type sampler_comparison 82type texture_1d<T> 83type texture_2d<T> 84type texture_2d_array<T> 85type texture_3d<T> 86type texture_cube<T> 87type texture_cube_array<T> 88type texture_multisampled_2d<T> 89type texture_depth_2d 90type texture_depth_2d_array 91type texture_depth_cube 92type texture_depth_cube_array 93type texture_depth_multisampled_2d 94type texture_storage_1d<F: texel_format, A: access> 95type texture_storage_2d<F: texel_format, A: access> 96type texture_storage_2d_array<F: texel_format, A: access> 97type texture_storage_3d<F: texel_format, A: access> 98type texture_external 99 100type __modf_result 101[[display("__modf_result_vec{N}")]] type __modf_result_vec<N: num> 102type __frexp_result 103[[display("__frexp_result_vec{N}")]] type __frexp_result_vec<N: num> 104 105//////////////////////////////////////////////////////////////////////////////// 106// Type matchers // 107// // 108// A type matcher that can match one or more types. // 109//////////////////////////////////////////////////////////////////////////////// 110 111match fiu32: f32 | i32 | u32 112match iu32: i32 | u32 113match scalar: f32 | i32 | u32 | bool 114 115//////////////////////////////////////////////////////////////////////////////// 116// Enum matchers // 117// // 118// A number matcher that can match one or more enumerator values. // 119// All enumerator values listed in the match declaration need to be from the // 120// same enum. // 121//////////////////////////////////////////////////////////////////////////////// 122 123// https://gpuweb.github.io/gpuweb/wgsl/#texel-formats 124match f32_texel_format: 125 rgba8unorm | rgba8snorm | rgba16float | r32float | rg32float | rgba32float 126match i32_texel_format: 127 rgba8sint | rgba16sint | r32sint | rg32sint | rgba32sint 128match u32_texel_format: 129 rgba8uint | rgba16uint | r32uint | rg32uint | rgba32uint 130 131match write_only: write 132 133match function_private_workgroup: function | private | workgroup 134match workgroup_or_storage: workgroup | storage 135 136//////////////////////////////////////////////////////////////////////////////// 137// Intrinsic Functions // 138// // 139// The intrinsic function declarations below declare all the built-in // 140// functions supported by the WGSL language. This intrinsic definition // 141// language supports simple static-type function declarations, as well as // 142// single overload declarations that can match a number of different // 143// argument types via the use of 'open-types' and 'open-numbers'. // 144// // 145// * Basic example: // 146// // 147// fn isInf(f32) -> bool // 148// // 149// Declares an overload of the function 'isInf' that accepts a single // 150// parameter of type 'f32' and returns a 'bool'. // 151// // 152// An 'open-type' can be thought as a template type that is determined by the // 153// arguments to the intrinsic. // 154// // 155// * Open-type example without constraint: // 156// // 157// fn arrayLength<T>(array<T>) -> u32 // 158// // 159// Declares an overload of the function 'arrayLength' that accepts a // 160// single argument of an array type with no constraints on the array // 161// element type. This overload will always return a value of the same type // 162// as its single argument. // 163// // 164// * Open-type example with constraint: // 165// // 166// fn abs<T: fiu32>(T) -> T // 167// // 168// Declares an overload of the function 'abs' that accepts a single // 169// argument of type 'f32', 'i32' or 'u32', which returns a value of the // 170// same argument type. // 171// // 172// Similarly an 'open-number' can be thought as a template number or // 173// enumerator that is determined by the arguments to the intrinsic. // 174// // 175// * Open-number example: // 176// // 177// fn dpdx<N: num>(vec<N, f32>) -> vec<N, f32> // 178// // 179// Declares an overload of the function 'dpdx' that accepts a single // 180// argument of a variable-sized vector of 'f32', which returns a value of // 181// the same argument type. // 182// // 183// // 184// Matching algorithm: // 185// ------------------- // 186// // 187// Prior to matching an overload, all open-types are undefined. // 188// // 189// Open-types become closed-types (pinned to a fixed type) on the first // 190// attempt to match an argument to that open-type. // 191// Once open-types are closed, they remain that type for the rest of the // 192// overload evaluation. // 193// // 194// To better understand, let's consider the following hypothetical overload // 195// declaration: // 196// // 197// fn foo<T: scalar>(T, T); // 198// // 199// T - is the open-type // 200// scalar - is a matcher for the types 'f32', 'i32', 'u32' or 'bool' // 201// (declared above) // 202// <T: scalar> - declares the open-type T, with the constraint that T must // 203// match one of 'f32', 'i32', 'u32' or 'bool'. // 204// // 205// The process for resolving this overload is as follows: // 206// // 207// (1) The overload resolver begins by attempting to match the argument // 208// types from left to right. // 209// The first parameter type is compared against the argument type. // 210// As the open-type T has not been closed yet, T is closed as the type // 211// of the first argument. // 212// There's no verification that the T type is a scalar at this stage. // 213// (2) The second parameter is then compared against the second argument. // 214// As the open-type T is now closed, the argument type is compared // 215// against the value of the closed-type of T. If the types match, then // 216// the overload is still a candidate for matching, otherwise the // 217// overload is no longer considered. // 218// (3) If all the parameters matched, constraints on the open-types need // 219// to be checked next. If the closed-type does not match the 'match' // 220// constraint, then the overload is no longer considered. // 221// // 222// The algorithm for matching open-numbers is almost identical to open-types, // 223// except of course, they match against integer numbers or enumerators // 224// instead of types. // 225// // 226// // 227// * More examples: // 228// // 229// fn F() // 230// - Function called F. // 231// No open types or numbers, no parameters, no return value // 232// // 233// fn F() -> RETURN_TYPE // 234// - Function with RETURN_TYPE as the return type value // 235// // 236// fn F(f32, i32) // 237// - Two fixed-type, anonymous parameters // 238// // 239// fn F(USAGE : f32) // 240// - Single parameter with name USAGE. // 241// Note: Parameter names are used by Tint to infer parameter order for // 242// some intrinsic functions // 243// // 244// fn F<T>(T) // 245// - Single parameter of unconstrained open-type T (any type) // 246// // 247// fn F<T: scalar>(T) // 248// - Single parameter of constrained open-type T (must be a scalar) // 249// // 250// fn F<T: fiu32>(T) -> T // 251// - Single parameter of constrained open-type T (must be a one of fiu32) // 252// Return type matches parameter type // 253// // 254// fn F<T, N: num>(vec<N, T>) // 255// - Single parameter of vector type with open-number size N and element // 256// open-type T // 257// // 258// fn F<A: access>(texture_storage_1d<f32_texel_format, A>) // 259// - Single parameter of texture_storage_1d type with open-number // 260// access-control C, and of a texel format that is listed in // 261// f32_texel_format // 262// // 263//////////////////////////////////////////////////////////////////////////////// 264 265// https://gpuweb.github.io/gpuweb/wgsl/#builtin-functions 266fn abs<T: fiu32>(T) -> T 267fn abs<N: num, T: fiu32>(vec<N, T>) -> vec<N, T> 268fn acos(f32) -> f32 269fn acos<N: num>(vec<N, f32>) -> vec<N, f32> 270fn all(bool) -> bool 271fn all<N: num>(vec<N, bool>) -> bool 272fn any(bool) -> bool 273fn any<N: num>(vec<N, bool>) -> bool 274fn arrayLength<T, A: access>(ptr<storage, array<T>, A>) -> u32 275fn asin(f32) -> f32 276fn asin<N: num>(vec<N, f32>) -> vec<N, f32> 277fn atan(f32) -> f32 278fn atan<N: num>(vec<N, f32>) -> vec<N, f32> 279fn atan2(f32, f32) -> f32 280fn atan2<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32> 281fn ceil(f32) -> f32 282fn ceil<N: num>(vec<N, f32>) -> vec<N, f32> 283fn clamp<T: fiu32>(T, T, T) -> T 284fn clamp<N: num, T: fiu32>(vec<N, T>, vec<N, T>, vec<N, T>) -> vec<N, T> 285fn cos(f32) -> f32 286fn cos<N: num>(vec<N, f32>) -> vec<N, f32> 287fn cosh(f32) -> f32 288fn cosh<N: num>(vec<N, f32>) -> vec<N, f32> 289fn countOneBits<T: iu32>(T) -> T 290fn countOneBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T> 291fn cross(vec3<f32>, vec3<f32>) -> vec3<f32> 292fn determinant<N: num>(mat<N, N, f32>) -> f32 293fn distance(f32, f32) -> f32 294fn distance<N: num>(vec<N, f32>, vec<N, f32>) -> f32 295fn dot<N: num, T: fiu32>(vec<N, T>, vec<N, T>) -> T 296[[stage("fragment")]] fn dpdx(f32) -> f32 297[[stage("fragment")]] fn dpdx<N: num>(vec<N, f32>) -> vec<N, f32> 298[[stage("fragment")]] fn dpdxCoarse(f32) -> f32 299[[stage("fragment")]] fn dpdxCoarse<N: num>(vec<N, f32>) -> vec<N, f32> 300[[stage("fragment")]] fn dpdxFine(f32) -> f32 301[[stage("fragment")]] fn dpdxFine<N: num>(vec<N, f32>) -> vec<N, f32> 302[[stage("fragment")]] fn dpdy(f32) -> f32 303[[stage("fragment")]] fn dpdy<N: num>(vec<N, f32>) -> vec<N, f32> 304[[stage("fragment")]] fn dpdyCoarse(f32) -> f32 305[[stage("fragment")]] fn dpdyCoarse<N: num>(vec<N, f32>) -> vec<N, f32> 306[[stage("fragment")]] fn dpdyFine(f32) -> f32 307[[stage("fragment")]] fn dpdyFine<N: num>(vec<N, f32>) -> vec<N, f32> 308fn exp(f32) -> f32 309fn exp<N: num>(vec<N, f32>) -> vec<N, f32> 310fn exp2(f32) -> f32 311fn exp2<N: num>(vec<N, f32>) -> vec<N, f32> 312fn faceForward<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32> 313fn floor(f32) -> f32 314fn floor<N: num>(vec<N, f32>) -> vec<N, f32> 315fn fma(f32, f32, f32) -> f32 316fn fma<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32> 317fn fract(f32) -> f32 318fn fract<N: num>(vec<N, f32>) -> vec<N, f32> 319fn frexp(f32) -> __frexp_result 320fn frexp<N: num>(vec<N, f32>) -> __frexp_result_vec<N> 321[[stage("fragment")]] fn fwidth(f32) -> f32 322[[stage("fragment")]] fn fwidth<N: num>(vec<N, f32>) -> vec<N, f32> 323[[stage("fragment")]] fn fwidthCoarse(f32) -> f32 324[[stage("fragment")]] fn fwidthCoarse<N: num>(vec<N, f32>) -> vec<N, f32> 325[[stage("fragment")]] fn fwidthFine(f32) -> f32 326[[stage("fragment")]] fn fwidthFine<N: num>(vec<N, f32>) -> vec<N, f32> 327[[deprecated]] fn ignore<T>(T) 328fn inverseSqrt(f32) -> f32 329fn inverseSqrt<N: num>(vec<N, f32>) -> vec<N, f32> 330[[deprecated]] fn isFinite(f32) -> bool 331[[deprecated]] fn isFinite<N: num>(vec<N, f32>) -> vec<N, bool> 332[[deprecated]] fn isInf(f32) -> bool 333[[deprecated]] fn isInf<N: num>(vec<N, f32>) -> vec<N, bool> 334[[deprecated]] fn isNan(f32) -> bool 335[[deprecated]] fn isNan<N: num>(vec<N, f32>) -> vec<N, bool> 336[[deprecated]] fn isNormal(f32) -> bool 337[[deprecated]] fn isNormal<N: num>(vec<N, f32>) -> vec<N, bool> 338fn ldexp(f32, i32) -> f32 339fn ldexp<N: num>(vec<N, f32>, vec<N, i32>) -> vec<N, f32> 340fn length(f32) -> f32 341fn length<N: num>(vec<N, f32>) -> f32 342fn log(f32) -> f32 343fn log<N: num>(vec<N, f32>) -> vec<N, f32> 344fn log2(f32) -> f32 345fn log2<N: num>(vec<N, f32>) -> vec<N, f32> 346fn max<T: fiu32>(T, T) -> T 347fn max<N: num, T: fiu32>(vec<N, T>, vec<N, T>) -> vec<N, T> 348fn min<T: fiu32>(T, T) -> T 349fn min<N: num, T: fiu32>(vec<N, T>, vec<N, T>) -> vec<N, T> 350fn mix(f32, f32, f32) -> f32 351fn mix<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32> 352fn mix<N: num>(vec<N, f32>, vec<N, f32>, f32) -> vec<N, f32> 353fn modf(f32) -> __modf_result 354fn modf<N: num>(vec<N, f32>) -> __modf_result_vec<N> 355fn normalize<N: num>(vec<N, f32>) -> vec<N, f32> 356fn pack2x16float(vec2<f32>) -> u32 357fn pack2x16snorm(vec2<f32>) -> u32 358fn pack2x16unorm(vec2<f32>) -> u32 359fn pack4x8snorm(vec4<f32>) -> u32 360fn pack4x8unorm(vec4<f32>) -> u32 361fn pow(f32, f32) -> f32 362fn pow<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32> 363fn reflect<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32> 364fn refract<N: num>(vec<N, f32>, vec<N, f32>, f32) -> vec<N, f32> 365fn reverseBits<T: iu32>(T) -> T 366fn reverseBits<N: num, T: iu32>(vec<N, T>) -> vec<N, T> 367fn round(f32) -> f32 368fn round<N: num>(vec<N, f32>) -> vec<N, f32> 369fn select<T: scalar>(T, T, bool) -> T 370fn select<T: scalar, N: num>(vec<N, T>, vec<N, T>, bool) -> vec<N, T> 371fn select<N: num, T: scalar>(vec<N, T>, vec<N, T>, vec<N, bool>) -> vec<N, T> 372fn sign(f32) -> f32 373fn sign<N: num>(vec<N, f32>) -> vec<N, f32> 374fn sin(f32) -> f32 375fn sin<N: num>(vec<N, f32>) -> vec<N, f32> 376fn sinh(f32) -> f32 377fn sinh<N: num>(vec<N, f32>) -> vec<N, f32> 378fn smoothStep(f32, f32, f32) -> f32 379fn smoothStep<N: num>(vec<N, f32>, vec<N, f32>, vec<N, f32>) -> vec<N, f32> 380fn sqrt(f32) -> f32 381fn sqrt<N: num>(vec<N, f32>) -> vec<N, f32> 382fn step(f32, f32) -> f32 383fn step<N: num>(vec<N, f32>, vec<N, f32>) -> vec<N, f32> 384[[stage("compute")]] fn storageBarrier() 385fn tan(f32) -> f32 386fn tan<N: num>(vec<N, f32>) -> vec<N, f32> 387fn tanh(f32) -> f32 388fn tanh<N: num>(vec<N, f32>) -> vec<N, f32> 389fn transpose<M: num, N: num>(mat<M, N, f32>) -> mat<N, M, f32> 390fn trunc(f32) -> f32 391fn trunc<N: num>(vec<N, f32>) -> vec<N, f32> 392fn unpack2x16float(u32) -> vec2<f32> 393fn unpack2x16snorm(u32) -> vec2<f32> 394fn unpack2x16unorm(u32) -> vec2<f32> 395fn unpack4x8snorm(u32) -> vec4<f32> 396fn unpack4x8unorm(u32) -> vec4<f32> 397[[stage("compute")]] fn workgroupBarrier() 398 399fn textureDimensions<T: fiu32>(texture: texture_1d<T>) -> i32 400fn textureDimensions<T: fiu32>(texture: texture_1d<T>, level: i32) -> i32 401fn textureDimensions<T: fiu32>(texture: texture_2d<T>) -> vec2<i32> 402fn textureDimensions<T: fiu32>(texture: texture_2d<T>, level: i32) -> vec2<i32> 403fn textureDimensions<T: fiu32>(texture: texture_2d_array<T>) -> vec2<i32> 404fn textureDimensions<T: fiu32>(texture: texture_2d_array<T>, level: i32) -> vec2<i32> 405fn textureDimensions<T: fiu32>(texture: texture_3d<T>) -> vec3<i32> 406fn textureDimensions<T: fiu32>(texture: texture_3d<T>, level: i32) -> vec3<i32> 407fn textureDimensions<T: fiu32>(texture: texture_cube<T>) -> vec2<i32> 408fn textureDimensions<T: fiu32>(texture: texture_cube<T>, level: i32) -> vec2<i32> 409fn textureDimensions<T: fiu32>(texture: texture_cube_array<T>) -> vec2<i32> 410fn textureDimensions<T: fiu32>(texture: texture_cube_array<T>, level: i32) -> vec2<i32> 411fn textureDimensions<T: fiu32>(texture: texture_multisampled_2d<T>) -> vec2<i32> 412fn textureDimensions(texture: texture_depth_2d) -> vec2<i32> 413fn textureDimensions(texture: texture_depth_2d, level: i32) -> vec2<i32> 414fn textureDimensions(texture: texture_depth_2d_array) -> vec2<i32> 415fn textureDimensions(texture: texture_depth_2d_array, level: i32) -> vec2<i32> 416fn textureDimensions(texture: texture_depth_cube) -> vec2<i32> 417fn textureDimensions(texture: texture_depth_cube, level: i32) -> vec2<i32> 418fn textureDimensions(texture: texture_depth_cube_array) -> vec2<i32> 419fn textureDimensions(texture: texture_depth_cube_array, level: i32) -> vec2<i32> 420fn textureDimensions(texture: texture_depth_multisampled_2d) -> vec2<i32> 421fn textureDimensions<F: texel_format, A: write_only>(texture: texture_storage_1d<F, A>) -> i32 422fn textureDimensions<F: texel_format, A: write_only>(texture: texture_storage_2d<F, A>) -> vec2<i32> 423fn textureDimensions<F: texel_format, A: write_only>(texture: texture_storage_2d_array<F, A>) -> vec2<i32> 424fn textureDimensions<F: texel_format, A: write_only>(texture: texture_storage_3d<F, A>) -> vec3<i32> 425fn textureDimensions(texture: texture_external) -> vec2<i32> 426fn textureGather<T: fiu32>(component: i32, texture: texture_2d<T>, sampler: sampler, coords: vec2<f32>) -> vec4<T> 427fn textureGather<T: fiu32>(component: i32, texture: texture_2d<T>, sampler: sampler, coords: vec2<f32>, offset: vec2<i32>) -> vec4<T> 428fn textureGather<T: fiu32>(component: i32, texture: texture_2d_array<T>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<T> 429fn textureGather<T: fiu32>(component: i32, texture: texture_2d_array<T>, sampler: sampler, coords: vec2<f32>, array_index: i32, offset: vec2<i32>) -> vec4<T> 430fn textureGather<T: fiu32>(component: i32, texture: texture_cube<T>, sampler: sampler, coords: vec3<f32>) -> vec4<T> 431fn textureGather<T: fiu32>(component: i32, texture: texture_cube_array<T>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<T> 432fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>) -> vec4<f32> 433fn textureGather(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, offset: vec2<i32>) -> vec4<f32> 434fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<f32> 435fn textureGather(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, offset: vec2<i32>) -> vec4<f32> 436fn textureGather(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>) -> vec4<f32> 437fn textureGather(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<f32> 438fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32) -> vec4<f32> 439fn textureGatherCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32, offset: vec2<i32>) -> vec4<f32> 440fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32) -> vec4<f32> 441fn textureGatherCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32, offset: vec2<i32>) -> vec4<f32> 442fn textureGatherCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3<f32>, depth_ref: f32) -> vec4<f32> 443fn textureGatherCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3<f32>, array_index: i32, depth_ref: f32) -> vec4<f32> 444fn textureNumLayers<T: fiu32>(texture: texture_2d_array<T>) -> i32 445fn textureNumLayers<T: fiu32>(texture: texture_cube_array<T>) -> i32 446fn textureNumLayers(texture: texture_depth_2d_array) -> i32 447fn textureNumLayers(texture: texture_depth_cube_array) -> i32 448fn textureNumLayers<F: texel_format, A: write_only>(texture: texture_storage_2d_array<F, A>) -> i32 449fn textureNumLevels<T: fiu32>(texture: texture_1d<T>) -> i32 450fn textureNumLevels<T: fiu32>(texture: texture_2d<T>) -> i32 451fn textureNumLevels<T: fiu32>(texture: texture_2d_array<T>) -> i32 452fn textureNumLevels<T: fiu32>(texture: texture_3d<T>) -> i32 453fn textureNumLevels<T: fiu32>(texture: texture_cube<T>) -> i32 454fn textureNumLevels<T: fiu32>(texture: texture_cube_array<T>) -> i32 455fn textureNumLevels(texture: texture_depth_2d) -> i32 456fn textureNumLevels(texture: texture_depth_2d_array) -> i32 457fn textureNumLevels(texture: texture_depth_cube) -> i32 458fn textureNumLevels(texture: texture_depth_cube_array) -> i32 459fn textureNumSamples<T: fiu32>(texture: texture_multisampled_2d<T>) -> i32 460fn textureNumSamples(texture: texture_depth_multisampled_2d) -> i32 461[[stage("fragment")]] fn textureSample(texture: texture_1d<f32>, sampler: sampler, coords: f32) -> vec4<f32> 462[[stage("fragment")]] fn textureSample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>) -> vec4<f32> 463[[stage("fragment")]] fn textureSample(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, offset: vec2<i32>) -> vec4<f32> 464[[stage("fragment")]] fn textureSample(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32) -> vec4<f32> 465[[stage("fragment")]] fn textureSample(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, offset: vec2<i32>) -> vec4<f32> 466[[stage("fragment")]] fn textureSample(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>) -> vec4<f32> 467[[stage("fragment")]] fn textureSample(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, offset: vec3<i32>) -> vec4<f32> 468[[stage("fragment")]] fn textureSample(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>) -> vec4<f32> 469[[stage("fragment")]] fn textureSample(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32) -> vec4<f32> 470[[stage("fragment")]] fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>) -> f32 471[[stage("fragment")]] fn textureSample(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, offset: vec2<i32>) -> f32 472[[stage("fragment")]] fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32) -> f32 473[[stage("fragment")]] fn textureSample(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, offset: vec2<i32>) -> f32 474[[stage("fragment")]] fn textureSample(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>) -> f32 475[[stage("fragment")]] fn textureSample(texture: texture_depth_cube_array, sampler: sampler, coords: vec3<f32>, array_index: i32) -> f32 476[[stage("fragment")]] fn textureSampleBias(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, bias: f32) -> vec4<f32> 477[[stage("fragment")]] fn textureSampleBias(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, bias: f32, offset: vec2<i32>) -> vec4<f32> 478[[stage("fragment")]] fn textureSampleBias(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, bias: f32) -> vec4<f32> 479[[stage("fragment")]] fn textureSampleBias(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, bias: f32, offset: vec2<i32>) -> vec4<f32> 480[[stage("fragment")]] fn textureSampleBias(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, bias: f32) -> vec4<f32> 481[[stage("fragment")]] fn textureSampleBias(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, bias: f32, offset: vec3<i32>) -> vec4<f32> 482[[stage("fragment")]] fn textureSampleBias(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>, bias: f32) -> vec4<f32> 483[[stage("fragment")]] fn textureSampleBias(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32, bias: f32) -> vec4<f32> 484[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32) -> f32 485[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32, offset: vec2<i32>) -> f32 486[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32) -> f32 487[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32, offset: vec2<i32>) -> f32 488[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3<f32>, depth_ref: f32) -> f32 489[[stage("fragment")]] fn textureSampleCompare(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3<f32>, array_index: i32, depth_ref: f32) -> f32 490fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32) -> f32 491fn textureSampleCompareLevel(texture: texture_depth_2d, sampler: sampler_comparison, coords: vec2<f32>, depth_ref: f32, offset: vec2<i32>) -> f32 492fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32) -> f32 493fn textureSampleCompareLevel(texture: texture_depth_2d_array, sampler: sampler_comparison, coords: vec2<f32>, array_index: i32, depth_ref: f32, offset: vec2<i32>) -> f32 494fn textureSampleCompareLevel(texture: texture_depth_cube, sampler: sampler_comparison, coords: vec3<f32>, depth_ref: f32) -> f32 495fn textureSampleCompareLevel(texture: texture_depth_cube_array, sampler: sampler_comparison, coords: vec3<f32>, array_index: i32, depth_ref: f32) -> f32 496fn textureSampleGrad(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, ddx: vec2<f32>, ddy: vec2<f32>) -> vec4<f32> 497fn textureSampleGrad(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, ddx: vec2<f32>, ddy: vec2<f32>, offset: vec2<i32>) -> vec4<f32> 498fn textureSampleGrad(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, ddx: vec2<f32>, ddy: vec2<f32>) -> vec4<f32> 499fn textureSampleGrad(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, ddx: vec2<f32>, ddy: vec2<f32>, offset: vec2<i32>) -> vec4<f32> 500fn textureSampleGrad(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, ddx: vec3<f32>, ddy: vec3<f32>) -> vec4<f32> 501fn textureSampleGrad(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, ddx: vec3<f32>, ddy: vec3<f32>, offset: vec3<i32>) -> vec4<f32> 502fn textureSampleGrad(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>, ddx: vec3<f32>, ddy: vec3<f32>) -> vec4<f32> 503fn textureSampleGrad(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32, ddx: vec3<f32>, ddy: vec3<f32>) -> vec4<f32> 504fn textureSampleLevel(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, level: f32) -> vec4<f32> 505fn textureSampleLevel(texture: texture_2d<f32>, sampler: sampler, coords: vec2<f32>, level: f32, offset: vec2<i32>) -> vec4<f32> 506fn textureSampleLevel(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, level: f32) -> vec4<f32> 507fn textureSampleLevel(texture: texture_2d_array<f32>, sampler: sampler, coords: vec2<f32>, array_index: i32, level: f32, offset: vec2<i32>) -> vec4<f32> 508fn textureSampleLevel(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, level: f32) -> vec4<f32> 509fn textureSampleLevel(texture: texture_3d<f32>, sampler: sampler, coords: vec3<f32>, level: f32, offset: vec3<i32>) -> vec4<f32> 510fn textureSampleLevel(texture: texture_cube<f32>, sampler: sampler, coords: vec3<f32>, level: f32) -> vec4<f32> 511fn textureSampleLevel(texture: texture_cube_array<f32>, sampler: sampler, coords: vec3<f32>, array_index: i32, level: f32) -> vec4<f32> 512fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: i32) -> f32 513fn textureSampleLevel(texture: texture_depth_2d, sampler: sampler, coords: vec2<f32>, level: i32, offset: vec2<i32>) -> f32 514fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, level: i32) -> f32 515fn textureSampleLevel(texture: texture_depth_2d_array, sampler: sampler, coords: vec2<f32>, array_index: i32, level: i32, offset: vec2<i32>) -> f32 516fn textureSampleLevel(texture: texture_depth_cube, sampler: sampler, coords: vec3<f32>, level: i32) -> f32 517fn textureSampleLevel(texture: texture_depth_cube_array,sampler: sampler, coords: vec3<f32>, array_index: i32, level: i32) -> f32 518fn textureSampleLevel(texture: texture_external, sampler: sampler, coords: vec2<f32>) -> vec4<f32> 519fn textureStore(texture: texture_storage_1d<f32_texel_format, write>, coords: i32, value: vec4<f32>) 520fn textureStore(texture: texture_storage_2d<f32_texel_format, write>, coords: vec2<i32>, value: vec4<f32>) 521fn textureStore(texture: texture_storage_2d_array<f32_texel_format, write>, coords: vec2<i32>, array_index: i32, value: vec4<f32>) 522fn textureStore(texture: texture_storage_3d<f32_texel_format, write>, coords: vec3<i32>, value: vec4<f32>) 523fn textureStore(texture: texture_storage_1d<i32_texel_format, write>, coords: i32, value: vec4<i32>) 524fn textureStore(texture: texture_storage_2d<i32_texel_format, write>, coords: vec2<i32>, value: vec4<i32>) 525fn textureStore(texture: texture_storage_2d_array<i32_texel_format, write>, coords: vec2<i32>, array_index: i32, value: vec4<i32>) 526fn textureStore(texture: texture_storage_3d<i32_texel_format, write>, coords: vec3<i32>, value: vec4<i32>) 527fn textureStore(texture: texture_storage_1d<u32_texel_format, write>, coords: i32, value: vec4<u32>) 528fn textureStore(texture: texture_storage_2d<u32_texel_format, write>, coords: vec2<i32>, value: vec4<u32>) 529fn textureStore(texture: texture_storage_2d_array<u32_texel_format, write>, coords: vec2<i32>, array_index: i32, value: vec4<u32>) 530fn textureStore(texture: texture_storage_3d<u32_texel_format, write>, coords: vec3<i32>, value: vec4<u32>) 531fn textureLoad<T: fiu32>(texture: texture_1d<T>, coords: i32, level: i32) -> vec4<T> 532fn textureLoad<T: fiu32>(texture: texture_2d<T>, coords: vec2<i32>, level: i32) -> vec4<T> 533fn textureLoad<T: fiu32>(texture: texture_2d_array<T>, coords: vec2<i32>, array_index: i32, level: i32) -> vec4<T> 534fn textureLoad<T: fiu32>(texture: texture_3d<T>, coords: vec3<i32>, level: i32) -> vec4<T> 535fn textureLoad<T: fiu32>(texture: texture_multisampled_2d<T>, coords: vec2<i32>, sample_index: i32) -> vec4<T> 536fn textureLoad(texture: texture_depth_2d, coords: vec2<i32>, level: i32) -> f32 537fn textureLoad(texture: texture_depth_2d_array, coords: vec2<i32>, array_index: i32, level: i32) -> f32 538fn textureLoad(texture: texture_depth_multisampled_2d, coords: vec2<i32>, sample_index: i32) -> f32 539fn textureLoad(texture: texture_external, coords: vec2<i32>) -> vec4<f32> 540 541[[stage("fragment", "compute")]] fn atomicLoad<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>) -> T 542[[stage("fragment", "compute")]] fn atomicStore<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T) 543[[stage("fragment", "compute")]] fn atomicAdd<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T) -> T 544[[stage("fragment", "compute")]] fn atomicSub<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T) -> T 545[[stage("fragment", "compute")]] fn atomicMax<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T) -> T 546[[stage("fragment", "compute")]] fn atomicMin<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T) -> T 547[[stage("fragment", "compute")]] fn atomicAnd<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T) -> T 548[[stage("fragment", "compute")]] fn atomicOr<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T) -> T 549[[stage("fragment", "compute")]] fn atomicXor<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T) -> T 550[[stage("fragment", "compute")]] fn atomicExchange<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T) -> T 551[[stage("fragment", "compute")]] fn atomicCompareExchangeWeak<T: iu32, S: workgroup_or_storage>(ptr<S, atomic<T>, read_write>, T, T) -> vec2<T> 552