2021-06-28 18:20:23 +00:00
|
|
|
// 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.
|
|
|
|
|
2022-02-21 15:19:07 +00:00
|
|
|
#include "src/tint/ast/interpolate_attribute.h"
|
2021-06-28 18:20:23 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2022-02-21 15:19:07 +00:00
|
|
|
#include "src/tint/program_builder.h"
|
2021-06-28 18:20:23 +00:00
|
|
|
|
2022-02-02 23:07:11 +00:00
|
|
|
TINT_INSTANTIATE_TYPEINFO(tint::ast::InterpolateAttribute);
|
2021-06-28 18:20:23 +00:00
|
|
|
|
2022-04-07 18:39:35 +00:00
|
|
|
namespace tint::ast {
|
2021-06-28 18:20:23 +00:00
|
|
|
|
2022-02-02 23:07:11 +00:00
|
|
|
InterpolateAttribute::InterpolateAttribute(ProgramID pid,
|
2022-07-18 20:50:02 +00:00
|
|
|
NodeID nid,
|
2022-02-02 23:07:11 +00:00
|
|
|
const Source& src,
|
2023-02-21 21:05:28 +00:00
|
|
|
const Expression* ty,
|
|
|
|
const Expression* smpl)
|
2022-07-18 20:50:02 +00:00
|
|
|
: Base(pid, nid, src), type(ty), sampling(smpl) {}
|
2021-06-28 18:20:23 +00:00
|
|
|
|
2022-02-02 23:07:11 +00:00
|
|
|
InterpolateAttribute::~InterpolateAttribute() = default;
|
2021-06-28 18:20:23 +00:00
|
|
|
|
2022-02-02 23:07:11 +00:00
|
|
|
std::string InterpolateAttribute::Name() const {
|
2022-05-01 14:40:55 +00:00
|
|
|
return "interpolate";
|
2021-06-28 18:20:23 +00:00
|
|
|
}
|
|
|
|
|
2022-05-01 14:40:55 +00:00
|
|
|
const InterpolateAttribute* InterpolateAttribute::Clone(CloneContext* ctx) const {
|
|
|
|
// Clone arguments outside of create() call to have deterministic ordering
|
|
|
|
auto src = ctx->Clone(source);
|
2023-02-21 21:05:28 +00:00
|
|
|
auto* ty = ctx->Clone(type);
|
|
|
|
auto* smpl = ctx->Clone(sampling);
|
|
|
|
return ctx->dst->create<InterpolateAttribute>(src, ty, smpl);
|
2021-06-28 18:20:23 +00:00
|
|
|
}
|
|
|
|
|
2022-04-07 18:39:35 +00:00
|
|
|
} // namespace tint::ast
|