| // Copyright 2023 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. |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // Spirv builtin definition file // |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| // TODO(crbug.com/2036): add an include facility and move these duplicate match and type lines |
| // into a common file. |
| match f32_f16: f32 | f16 |
| |
| type f32 |
| type f16 |
| type vec2<T> |
| type vec3<T> |
| type vec4<T> |
| @display("vec{N}<{T}>") type vec<N: num, T> |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // Enumerators // |
| //////////////////////////////////////////////////////////////////////////////// |
| |
| enum intrinsic { |
| array_length |
| atomic_and |
| atomic_compare_exchange |
| atomic_exchange |
| atomic_iadd |
| atomic_isub |
| atomic_load |
| atomic_or |
| atomic_smax |
| atomic_smin |
| atomic_store |
| atomic_umax |
| atomic_umin |
| atomic_xor |
| dot |
| image_fetch |
| image_gather |
| image_dref_gather |
| image_query_size |
| image_query_size_lod |
| image_sample_implicit_lod |
| image_sample_explicit_lod |
| image_sample_dref_implicit_lod |
| image_sample_dref_explicit_lod |
| image_write |
| matrix_times_matrix |
| matrix_times_scalar |
| matrix_times_vector |
| sampled_image |
| select |
| vector_times_matrix |
| } |
| |
| //////////////////////////////////////////////////////////////////////////////// |
| // Builtin Functions // |
| //////////////////////////////////////////////////////////////////////////////// |
| fn vector_times_scalar<T: f32_f16, N: num>(vec<N, T>, T) -> vec<N, T> |
| |