aboutsummaryrefslogtreecommitdiff
path: root/include/amber/amber.h
diff options
context:
space:
mode:
authordan sinclair <dj2@everburning.com>2018-12-04 16:59:45 -0500
committerGitHub <noreply@github.com>2018-12-04 16:59:45 -0500
commit9801210390d6913312aae55d032c13598993d338 (patch)
tree616992d8de290cf32af43e2dcaec59dee1598393 /include/amber/amber.h
parentfd37e79e4d3bec73c9d96f8fce46220a5751146c (diff)
downloadamber-9801210390d6913312aae55d032c13598993d338.tar.gz
Allow host to provide a shader map. (#138)
This CL extends the Amber interface to allow a Shader map to be provided. This map allows the caller to pre-compile the shaders and provide the name to data mapping. The ShaderCompiler will then pull from the map before attempting to do a compile.
Diffstat (limited to 'include/amber/amber.h')
-rw-r--r--include/amber/amber.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/amber/amber.h b/include/amber/amber.h
index 1940df2..d01748c 100644
--- a/include/amber/amber.h
+++ b/include/amber/amber.h
@@ -15,13 +15,19 @@
#ifndef AMBER_AMBER_H_
#define AMBER_AMBER_H_
+#include <map>
#include <memory>
#include <string>
+#include <vector>
#include "amber/result.h"
namespace amber {
+/// The shader map is a map from the name of a shader to the spirv-binary
+/// which is the compiled representation of that named shader.
+using ShaderMap = std::map<std::string, std::vector<uint32_t>>;
+
enum class EngineType : uint8_t {
/// Use the Vulkan backend, if available
kVulkan = 0,
@@ -50,6 +56,13 @@ class Amber {
/// Executes the given |data| script with the provided |opts|. Returns a
/// |Result| which indicates if the execution succeded.
amber::Result Execute(const std::string& data, const Options& opts);
+
+ /// Executes the given |data| script with the provided |opts|. Will use
+ /// |shader_map| to lookup shader data before attempting to compile the
+ /// shader if possible.
+ amber::Result ExecuteWithShaderData(const std::string& data,
+ const Options& opts,
+ const ShaderMap& shader_data);
};
} // namespace amber