aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordan sinclair <dj2@everburning.com>2018-09-28 16:12:38 -0400
committerDavid Neto <dneto@google.com>2018-11-09 13:47:51 -0500
commit70d430c0fb3dd7832265815cde48866fada1eb3b (patch)
tree3e85912ed7eb1b30edb183c8d91b413fb421cf2a /include
downloadamber-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 'include')
-rw-r--r--include/amber/amber.h44
-rw-r--r--include/amber/result.h50
2 files changed, 94 insertions, 0 deletions
diff --git a/include/amber/amber.h b/include/amber/amber.h
new file mode 100644
index 0000000..f723c1b
--- /dev/null
+++ b/include/amber/amber.h
@@ -0,0 +1,44 @@
+// 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.
+
+#ifndef AMBER_AMBER_H_
+#define AMBER_AMBER_H_
+
+#include "amber/result.h"
+
+#include <string>
+
+namespace amber {
+
+enum class EngineType : uint8_t {
+ kVulkan = 0,
+};
+
+struct Options {
+ EngineType engine = EngineType::kVulkan;
+ void* default_device = nullptr;
+ bool parse_only = false;
+};
+
+class Amber {
+ public:
+ Amber();
+ ~Amber();
+
+ amber::Result Execute(const std::string& data, const Options& opts);
+};
+
+} // namespace amber
+
+#endif // AMBER_AMBER_H_
diff --git a/include/amber/result.h b/include/amber/result.h
new file mode 100644
index 0000000..ec57289
--- /dev/null
+++ b/include/amber/result.h
@@ -0,0 +1,50 @@
+// 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.
+
+#ifndef AMBER_RESULT_H_
+#define AMBER_RESULT_H_
+
+#include <string>
+#include <vector>
+
+namespace amber {
+
+class Result {
+ public:
+ Result();
+ Result(const std::string& err);
+ Result(const Result&);
+ ~Result();
+
+ Result& operator=(const Result&);
+
+ bool IsSuccess() const { return succeeded_; }
+ const std::string& Error() const { return error_; }
+
+ void SetImageData(const std::vector<uint8_t>& data) { image_data_ = data; }
+ const std::vector<uint8_t>& ImageData() const { return image_data_; }
+
+ void SetBufferData(const std::vector<uint8_t>& data) { buffer_data_ = data; }
+ const std::vector<uint8_t>& BufferData() const { return buffer_data_; }
+
+ private:
+ bool succeeded_;
+ std::string error_;
+ std::vector<uint8_t> image_data_;
+ std::vector<uint8_t> buffer_data_;
+};
+
+} // namespace amber
+
+#endif // AMBER_RESULT_H_