aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordan sinclair <dj2@everburning.com>2018-12-04 15:57:36 -0500
committerGitHub <noreply@github.com>2018-12-04 15:57:36 -0500
commit4fec7af7ef536a13d7159a057fb48275d55a8ed5 (patch)
tree81b9b2c84a4acda92bc9bd3cf73b4556a85d7589 /include
parent242cc178a6eeebe5a043a14a4ba43c40f94a090b (diff)
downloadamber-4fec7af7ef536a13d7159a057fb48275d55a8ed5.tar.gz
Extend engine configuration options. (#137)
Currently an InitializeWithDevice method is provided to the engines which is populated with the device given when calling Execute. This CL extends that mechanism to have EngineConfig structs for each engine. Those structs are given to Execute and passed to the engine. This will allow extending the Vulkan code to accept PhysicalDevice and available feature/extension information along with the device.
Diffstat (limited to 'include')
-rw-r--r--include/amber/amber.h10
-rw-r--r--include/amber/amber_dawn.h31
-rw-r--r--include/amber/amber_vulkan.h30
3 files changed, 67 insertions, 4 deletions
diff --git a/include/amber/amber.h b/include/amber/amber.h
index a20fce7..1940df2 100644
--- a/include/amber/amber.h
+++ b/include/amber/amber.h
@@ -15,6 +15,7 @@
#ifndef AMBER_AMBER_H_
#define AMBER_AMBER_H_
+#include <memory>
#include <string>
#include "amber/result.h"
@@ -28,13 +29,14 @@ enum class EngineType : uint8_t {
kDawn,
};
+/// Override point of engines to add their own configuration.
+struct EngineConfig {};
+
struct Options {
/// Sets the engine to be created. Default Vulkan.
EngineType engine = EngineType::kVulkan;
- /// Holds the device for the given engine. If the device is a |nullptr|
- /// a device will be created. If a |default_device| is provided it must
- /// outlive the Amber instance and clean is the callers responsibility.
- void* default_device = nullptr;
+ /// Holds engine specific configuration.
+ std::unique_ptr<EngineConfig> config;
/// Set true to only parse the given script, does not execute the engine.
bool parse_only = false;
};
diff --git a/include/amber/amber_dawn.h b/include/amber/amber_dawn.h
new file mode 100644
index 0000000..af6e8a6
--- /dev/null
+++ b/include/amber/amber_dawn.h
@@ -0,0 +1,31 @@
+// 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_DAWN_H_
+#define AMBER_AMBER_DAWN_H_
+
+#include "amber/amber.h"
+#include "dawn/dawncpp.h"
+
+namespace amber {
+
+/// Configuration for the Dawn engine.
+struct DawnEngineConfig : public EngineConfig {
+ /// The dawn Device to use for running tests.
+ ::dawn::Device* device;
+};
+
+} // namespace amber
+
+#endif // AMBER_AMBER_DAWN_H_
diff --git a/include/amber/amber_vulkan.h b/include/amber/amber_vulkan.h
new file mode 100644
index 0000000..084a2c9
--- /dev/null
+++ b/include/amber/amber_vulkan.h
@@ -0,0 +1,30 @@
+// 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_VULKAN_H_
+#define AMBER_AMBER_VULKAN_H_
+
+#include "vulkan/vulkan.h"
+
+namespace amber {
+
+/// Configuration for the Vulkan Engine.
+struct VulkanEngineConfig : public EngineConfig {
+ /// The VkDevice to use for the tests.
+ VkDevice device;
+};
+
+} // namespace amber
+
+#endif // AMBER_AMBER_VULKAN_H_