1 // Copyright 2020 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 #include "src/ast/type/sampled_texture_type.h" 16 17 #include <cassert> 18 #include <sstream> 19 20 namespace tint { 21 namespace ast { 22 namespace type { 23 SampledTextureType(TextureDimension dim,Type * type)24SampledTextureType::SampledTextureType(TextureDimension dim, Type* type) 25 : TextureType(dim), type_(type) { 26 assert(type_); 27 } 28 29 SampledTextureType::SampledTextureType(SampledTextureType&&) = default; 30 31 SampledTextureType::~SampledTextureType() = default; 32 IsSampled() const33bool SampledTextureType::IsSampled() const { 34 return true; 35 } 36 type_name() const37std::string SampledTextureType::type_name() const { 38 std::ostringstream out; 39 out << "__sampled_texture_" << dim() << type_->type_name(); 40 return out.str(); 41 } 42 43 } // namespace type 44 } // namespace ast 45 } // namespace tint 46