mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-07-01 10:53:33 +00:00
Reorders the output of the CanonicalizeEntryPointIO transform, but otherwise is a no-op. This will help with diagnostics that print the enum values. Bug: tint:1629 Change-Id: Iff517d88836d2a8cd42ce3cfde6363c1973df0dd Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/105321 Commit-Queue: Ben Clayton <bclayton@chromium.org> Reviewed-by: Dan Sinclair <dsinclair@chromium.org> Kokoro: Kokoro <noreply+kokoro@google.com>
105 lines
3.5 KiB
C++
105 lines
3.5 KiB
C++
// Copyright 2020 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/src/cmd/gen
|
|
// using the template:
|
|
// src/tint/ast/builtin_value.cc.tmpl
|
|
//
|
|
// Do not modify this file directly
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
#include "src/tint/ast/builtin_value.h"
|
|
|
|
namespace tint::ast {
|
|
|
|
/// ParseBuiltinValue parses a BuiltinValue from a string.
|
|
/// @param str the string to parse
|
|
/// @returns the parsed enum, or BuiltinValue::kInvalid if the string could not be parsed.
|
|
BuiltinValue ParseBuiltinValue(std::string_view str) {
|
|
if (str == "frag_depth") {
|
|
return BuiltinValue::kFragDepth;
|
|
}
|
|
if (str == "front_facing") {
|
|
return BuiltinValue::kFrontFacing;
|
|
}
|
|
if (str == "global_invocation_id") {
|
|
return BuiltinValue::kGlobalInvocationId;
|
|
}
|
|
if (str == "instance_index") {
|
|
return BuiltinValue::kInstanceIndex;
|
|
}
|
|
if (str == "local_invocation_id") {
|
|
return BuiltinValue::kLocalInvocationId;
|
|
}
|
|
if (str == "local_invocation_index") {
|
|
return BuiltinValue::kLocalInvocationIndex;
|
|
}
|
|
if (str == "num_workgroups") {
|
|
return BuiltinValue::kNumWorkgroups;
|
|
}
|
|
if (str == "position") {
|
|
return BuiltinValue::kPosition;
|
|
}
|
|
if (str == "sample_index") {
|
|
return BuiltinValue::kSampleIndex;
|
|
}
|
|
if (str == "sample_mask") {
|
|
return BuiltinValue::kSampleMask;
|
|
}
|
|
if (str == "vertex_index") {
|
|
return BuiltinValue::kVertexIndex;
|
|
}
|
|
if (str == "workgroup_id") {
|
|
return BuiltinValue::kWorkgroupId;
|
|
}
|
|
return BuiltinValue::kInvalid;
|
|
}
|
|
|
|
std::ostream& operator<<(std::ostream& out, BuiltinValue value) {
|
|
switch (value) {
|
|
case BuiltinValue::kInvalid:
|
|
return out << "invalid";
|
|
case BuiltinValue::kFragDepth:
|
|
return out << "frag_depth";
|
|
case BuiltinValue::kFrontFacing:
|
|
return out << "front_facing";
|
|
case BuiltinValue::kGlobalInvocationId:
|
|
return out << "global_invocation_id";
|
|
case BuiltinValue::kInstanceIndex:
|
|
return out << "instance_index";
|
|
case BuiltinValue::kLocalInvocationId:
|
|
return out << "local_invocation_id";
|
|
case BuiltinValue::kLocalInvocationIndex:
|
|
return out << "local_invocation_index";
|
|
case BuiltinValue::kNumWorkgroups:
|
|
return out << "num_workgroups";
|
|
case BuiltinValue::kPointSize:
|
|
return out << "point_size";
|
|
case BuiltinValue::kPosition:
|
|
return out << "position";
|
|
case BuiltinValue::kSampleIndex:
|
|
return out << "sample_index";
|
|
case BuiltinValue::kSampleMask:
|
|
return out << "sample_mask";
|
|
case BuiltinValue::kVertexIndex:
|
|
return out << "vertex_index";
|
|
case BuiltinValue::kWorkgroupId:
|
|
return out << "workgroup_id";
|
|
}
|
|
return out << "<unknown>";
|
|
}
|
|
|
|
} // namespace tint::ast
|