MCPcopy Create free account
hub / github.com/baldurk/renderdoc / ConvertFunc

Function ConvertFunc

qrenderdoc/Code/pyrenderdoc/function_conversion.h:285–307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

283
284template <typename funcType>
285funcType ConvertFunc(const char *funcname, PyObject *func, ExceptionHandler exHandle)
286{
287 // allow None to indicate no callback
288 if(Py_IsNone(func))
289 return funcType();
290
291 // add a reference to the global object so it stays alive while we execute, in case this is an
292 // async call
293 PyObject *global_internal_handle = GetCurrentGlobalHandle();
294
295 // process any dangling functions that may need to be cleared up
296 ProcessDecRefQueue();
297
298 // create a copy that will keep the function object alive as long as the lambda is
299 PyObjectRefCounter funcptr(func);
300
301 return [global_internal_handle, funcname, funcptr, exHandle](auto... param) {
302 ScopedFuncCall gil(global_internal_handle);
303
304 varfunc<typename funcType::result_type, decltype(param)...> f(funcname, param...);
305 return f.call(funcname, funcptr.obj, global_internal_handle, exHandle);
306 };
307}

Callers

nothing calls this directly

Calls 3

GetCurrentGlobalHandleFunction · 0.70
ProcessDecRefQueueFunction · 0.70
callMethod · 0.45

Tested by

no test coverage detected