21template <
typename ReturnType,
typename... Arguments>
26 return reinterpret_cast<typename
glbinding::Function<ReturnType, Arguments...
>::Signature>(function->
address())(std::forward<Arguments>(arguments)...);
34template <
typename... Arguments>
35struct BasicCallHelper<
glbinding::Boolean8, Arguments...>
45template <
typename ReturnType,
typename... Arguments>
67 auto value = BasicCallHelper<ReturnType, Arguments ...>::call(function, std::forward<Arguments>(arguments)...);
80 function->
afterCallback()(value, std::forward<Arguments>(arguments)...);
94template <
typename... Arguments>
112 function->
beforeCallback()(std::forward<Arguments>(arguments)...);
116 BasicCallHelper<void, Arguments ...>::call(function, std::forward<Arguments>(arguments)...);
136template <
typename ReturnType,
typename... Arguments>
139, m_beforeCallback{nullptr}
140, m_afterCallback{nullptr}
144template <
typename ReturnType,
typename... Arguments>
147 return call(arguments...);
150template <
typename ReturnType,
typename... Arguments>
153 const auto myAddress = address();
155 if (myAddress ==
nullptr)
178 return BasicCallHelper<ReturnType, Arguments...>::call(
this, std::forward<Arguments>(arguments)...);
182template <
typename ReturnType,
typename... Arguments>
185 if (address() ==
nullptr)
190 return BasicCallHelper<ReturnType, Arguments...>::call(
this, std::forward<Arguments>(arguments)...);
193template <
typename ReturnType,
typename... Arguments>
196 m_beforeCallback = std::move(callback);
199template <
typename ReturnType,
typename... Arguments>
202 m_beforeCallback =
nullptr;
205template <
typename ReturnType,
typename... Arguments>
208 m_afterCallback = std::move(callback);
211template <
typename ReturnType,
typename... Arguments>
214 m_afterCallback =
nullptr;
217template <
typename ReturnType,
typename... Arguments>
220 return m_beforeCallback;
223template <
typename ReturnType,
typename... Arguments>
226 return m_afterCallback;
229template <
typename ReturnType,
typename... Arguments>
235template <
typename ReturnType,
typename... Arguments>
241template <
typename ReturnType,
typename... Arguments>
247template <
typename ReturnType,
typename... Arguments>
253 return m_states.at(pos);
256template <
typename ReturnType,
typename... Arguments>
259 m_states.resize(
static_cast<std::size_t
>(count));
The AbstractFunction represents an OpenGL API function by its name and entry point after dynamic addr...
Definition AbstractFunction.h:30
static void unresolved(const AbstractFunction *function)
Call unresolved callback.
bool isAnyEnabled(CallbackMask mask) const
Check if any bit of the parameter is set in the currently configured callback mask of the current sta...
ProcAddress address() const
Get function pointer.
static void before(const FunctionCall &call)
Call before callback.
static int currentPos()
Get index of current state.
bool isEnabled(CallbackMask mask) const
Check if all bits of the parameter are set in the currently configured callback mask of the current s...
static int maxPos()
Get highest state index currently used.
static void log(FunctionCall &&call)
Call log callback.
static void after(const FunctionCall &call)
Call after callback.
The State struct represents the configuration of a single OpenGL function for one thread....
Definition AbstractState.h:21
Boolean type based on an 8-bit integer.
Definition Boolean8.h:20
unsigned char underlying_type
Type used for storing the value.
Definition Boolean8.h:22
A FunctionCall represents a function call of an OpenGL API function, including the parameter and retu...
Definition FunctionCall.h:27
std::vector< std::unique_ptr< AbstractValue > > parameters
The list of parameter values; doesn't have to be filled.
Definition FunctionCall.h:72
std::unique_ptr< AbstractValue > returnValue
The return value; doesn't have to be filled.
Definition FunctionCall.h:73
The Function represents an OpenGL API function with additional features.
Definition Function.h:78
void setAfterCallback(AfterCallback callback)
Register a callback that is triggered after a function call to the OpenGL driver.
Definition Function.inl:206
AfterCallback afterCallback() const
The accessor for the afterCallback.
Definition Function.inl:224
ReturnType operator()(Arguments &... arguments) const
Executes a function call on the resolved function pointer and passes the arguments.
Definition Function.inl:145
ReturnType call(Arguments &... arguments) const
Executes a function call on the resolved function pointer and passes the arguments.
Definition Function.inl:151
ReturnType directCall(Arguments... arguments) const
Executes a function call on the resolved function pointer and passes the arguments.
Definition Function.inl:183
typename CallbackType< ReturnType, Arguments... >::type AfterCallback
The callback type for the after callback.
Definition Function.h:84
virtual AbstractState & state() const override
Get current state.
Definition Function.inl:242
Function(const char *name)
Constructor.
Definition Function.inl:137
void setBeforeCallback(BeforeCallback callback)
Register a callback that is triggered before a function call to the OpenGL driver.
Definition Function.inl:194
void clearBeforeCallback()
Clears any previously registered before callback.
Definition Function.inl:200
void clearAfterCallback()
Clears any previously registered after callback.
Definition Function.inl:212
virtual void resizeStates(int count) override
Resize internal cache of states.
Definition Function.inl:257
BeforeCallback beforeCallback() const
The accessor for the beforeCallback.
Definition Function.inl:218
virtual bool hasState() const override
Checks for existence of the current configured state.
Definition Function.inl:230
typename CallbackType< void, Arguments... >::type BeforeCallback
The callback type for the before callback.
Definition Function.h:83
Contains all the classes of glbinding.
std::vector< std::unique_ptr< AbstractValue > > createValues(Arguments &&... arguments)
A wrapper around the creation of a vector of arguments.
Definition Value.inl:64
@ Parameters
Enables the provision of parameter values in the before and after callbacks.
@ Unresolved
Enables the callback for unresolved function calls.
@ After
Enables the after callbacks.
@ Logging
Enables logging.
@ Before
Enables the before callbacks.
@ ReturnValue
Enables the provision of a return value in the after callback.
std::unique_ptr< AbstractValue > createValue(const Argument &argument)
A wrapper around the type deduction and memory allocation of a specific argument.
Definition Value.inl:58
Helper struct for calling GL functions and registered callbacks.
Definition Function.inl:47
static ReturnType call(const glbinding::Function< ReturnType, Arguments... > *function, Arguments &&... arguments)
Definition Function.inl:48