aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJaebaek Seo <duke.acacia@gmail.com>2019-01-08 15:26:25 -0500
committerGitHub <noreply@github.com>2019-01-08 15:26:25 -0500
commitfa990893ef842a0447522b15ec5f8b8e094ed603 (patch)
tree33891a9d7568cd52b724611dfcc4fa3a8bb40cfe /include
parent90b061ab8a69a9082726c2c9c6cd0195f071ca30 (diff)
downloadamber-fa990893ef842a0447522b15ec5f8b8e094ed603.tar.gz
Vulkan: reuse device using config (#205)
If `VkPhysicalDevice`, `VkDevice`, `VkQueue`, queue family index, required features and extensions are given, Amber reuses them. Fixes #124
Diffstat (limited to 'include')
-rw-r--r--include/amber/amber_vulkan.h28
-rw-r--r--include/amber/recipe.h13
2 files changed, 39 insertions, 2 deletions
diff --git a/include/amber/amber_vulkan.h b/include/amber/amber_vulkan.h
index 084a2c9..1f38ab1 100644
--- a/include/amber/amber_vulkan.h
+++ b/include/amber/amber_vulkan.h
@@ -15,14 +15,38 @@
#ifndef AMBER_AMBER_VULKAN_H_
#define AMBER_AMBER_VULKAN_H_
+#include <limits>
+#include <string>
+#include <vector>
+
+#include "amber/amber.h"
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"
#include "vulkan/vulkan.h"
+#pragma clang diagnostic pop
namespace amber {
/// Configuration for the Vulkan Engine.
struct VulkanEngineConfig : public EngineConfig {
- /// The VkDevice to use for the tests.
- VkDevice device;
+ /// The VkPhysicalDevice to use.
+ VkPhysicalDevice physical_device = VK_NULL_HANDLE;
+
+ /// Physical device features available for |physical_device|.
+ VkPhysicalDeviceFeatures available_features = {};
+
+ /// Physical device extensions available for |physical_device|.
+ std::vector<std::string> available_extensions;
+
+ /// The given queue family index to use.
+ uint32_t queue_family_index = std::numeric_limits<uint32_t>::max();
+
+ /// The VkDevice to use.
+ VkDevice device = VK_NULL_HANDLE;
+
+ /// The VkQueue to use.
+ VkQueue queue = VK_NULL_HANDLE;
};
} // namespace amber
diff --git a/include/amber/recipe.h b/include/amber/recipe.h
index 3dd932c..d33c479 100644
--- a/include/amber/recipe.h
+++ b/include/amber/recipe.h
@@ -16,6 +16,7 @@
#define AMBER_RECIPE_H_
#include <memory>
+#include <string>
#include <utility>
#include <vector>
@@ -31,6 +32,12 @@ class RecipeImpl {
/// Retrieves information on all the shaders in the given recipe.
virtual std::vector<ShaderInfo> GetShaderInfo() const = 0;
+ /// Returns required features in the given recipe.
+ virtual std::vector<std::string> GetRequiredFeatures() const = 0;
+
+ /// Returns required extensions in the given recipe.
+ virtual std::vector<std::string> GetRequiredExtensions() const = 0;
+
protected:
RecipeImpl();
};
@@ -47,6 +54,12 @@ class Recipe {
RecipeImpl* GetImpl() const { return impl_.get(); }
void SetImpl(std::unique_ptr<RecipeImpl> impl) { impl_ = std::move(impl); }
+ /// Returns required features in the given recipe.
+ std::vector<std::string> GetRequiredFeatures() const;
+
+ /// Returns required extensions in the given recipe.
+ std::vector<std::string> GetRequiredExtensions() const;
+
private:
std::unique_ptr<RecipeImpl> impl_;
};