diff options
author | dan sinclair <dj2@everburning.com> | 2018-09-28 16:12:38 -0400 |
---|---|---|
committer | David Neto <dneto@google.com> | 2018-11-09 13:47:51 -0500 |
commit | 70d430c0fb3dd7832265815cde48866fada1eb3b (patch) | |
tree | 3e85912ed7eb1b30edb183c8d91b413fb421cf2a /src/command_data.cc | |
download | amber-70d430c0fb3dd7832265815cde48866fada1eb3b.tar.gz |
Initial commit of Amber for open source
Amber is a multi-API shader test framework.
Amber lets you capture and communicate shader bugs with the fluidity and ease of a scripting flow:
* No graphics API programming is required.
* WIP: Supports Vulkan and [Dawn][Dawn] graphics APIs.
* A single text string (or file) maps to a single graphics API pipeline test case. The text includes:
* Input data, including buffers and images.
* Shaders.
* Expectations for the result of running the pipeline.
* Shaders can be expressed in binary form (as hex), in SPIR-V assembly, or in a higher level shader language.
* After executing the pipeline, result buffers and images can be saved to output files.
This is not an officially supported Google product.
Diffstat (limited to 'src/command_data.cc')
-rw-r--r-- | src/command_data.cc | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/command_data.cc b/src/command_data.cc new file mode 100644 index 0000000..6037907 --- /dev/null +++ b/src/command_data.cc @@ -0,0 +1,57 @@ +// Copyright 2018 The Amber 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. + +#include "src/command_data.h" + +namespace amber { + +Topology NameToTopology(const std::string& name) { + const static struct { + const char* name; + Topology val; + } topologies[] = { + {"PATCH_LIST", Topology::kPatchList}, + {"POINT_LIST", Topology::kPointList}, + {"GL_LINE_STRIP_ADJACENCY", Topology::kLineStripWithAdjacency}, + {"GL_LINE_STRIP", Topology::kLineStrip}, + {"GL_LINES", Topology::kLineList}, + {"GL_LINES_ADJACENCY", Topology::kLineListWithAdjacency}, + {"GL_PATCHES", Topology::kPatchList}, + {"GL_POINTS", Topology::kPointList}, + {"GL_TRIANGLE_STRIP", Topology::kTriangleStrip}, + {"GL_TRIANGLE_FAN", Topology::kTriangleFan}, + {"GL_TRIANGLES", Topology::kTriangleList}, + {"GL_TRIANGLES_ADJACENCY", Topology::kTriangleListWithAdjacency}, + {"GL_TRIANGLE_STRIP_ADJACENCY", Topology::kTriangleStripWithAdjacency}, + {"LINE_LIST", Topology::kLineList}, + {"LINE_LIST_WITH_ADJACENCY", Topology::kLineListWithAdjacency}, + {"LINE_STRIP", Topology::kLineStrip}, + {"LINE_STRIP_WITH_ADJACENCY", Topology::kLineStripWithAdjacency}, + {"TRIANGLE_FAN", Topology::kTriangleFan}, + {"TRIANGLE_LIST", Topology::kTriangleList}, + {"TRIANGLE_LIST_WITH_ADJACENCY", Topology::kTriangleListWithAdjacency}, + {"TRIANGLE_STRIP", Topology::kTriangleStrip}, + {"TRIANGLE_STRIP_WITH_ADJACENCY", Topology::kTriangleStripWithAdjacency}, + }; + + // TODO(dsinclair): Make smarter if needed + for (auto& topo : topologies) { + if (topo.name == name) + return topo.val; + } + + return Topology::kUnknown; +} + +} // namespace amber |