diff options
author | Hugues Evrard <hevrard@users.noreply.github.com> | 2019-03-08 16:28:07 +0100 |
---|---|---|
committer | dan sinclair <dj2@everburning.com> | 2019-03-08 10:28:07 -0500 |
commit | 5bd86e6705c3d91247fbca5c447dc7a6ef054aed (patch) | |
tree | 224ab7504d3472f4b019bdc2584c87055e6a38c5 /include | |
parent | d9e823e5ab380fcf417452581721ad9c3bdcf60b (diff) | |
download | amber-5bd86e6705c3d91247fbca5c447dc7a6ef054aed.tar.gz |
Add Delegate and --log-graphics-calls flag (#334)
This adds a Delegate which enables users of the amber library to
define some hook functions as they like. The first usage here is a
Delegate::Log() function to log graphics API calls.
In practice, a pointer to the delegate object is passed at engine
creation and the Vulkan engine eventually pass it to
LoadVulkanPointers() which calls the functions produced by
update_vk_wrappers.py. This enable to choose, when loading the Vulkan
functions, whether to load a straighforward wrapper to the API
command, or to load a lambda that surround the API command with calls
to the delegate methods.
The --log-graphics-calls flag in the samples sets the delegate to
produce a log of API calls.
Diffstat (limited to 'include')
-rw-r--r-- | include/amber/amber.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/amber/amber.h b/include/amber/amber.h index b332129..5a89b88 100644 --- a/include/amber/amber.h +++ b/include/amber/amber.h @@ -52,6 +52,17 @@ struct BufferInfo { std::vector<Value> values; }; +/// Delegate class for various hook functions +class Delegate { + public: + virtual ~Delegate(); + + /// Log the given message + virtual void Log(const std::string& message) = 0; + /// Tells whether to log the graphics API calls + virtual bool LogGraphicsCalls() const = 0; +}; + struct Options { /// Sets the engine to be created. Default Vulkan. EngineType engine; @@ -63,6 +74,8 @@ struct Options { std::vector<BufferInfo> extractions; /// Terminate after creating the pipelines. bool pipeline_create_only; + /// Delegate implementation + Delegate* delegate; }; /// Main interface to the Amber environment. |