From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/GfxDevice/threaded/WorkerIDMapper.h | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 Runtime/GfxDevice/threaded/WorkerIDMapper.h (limited to 'Runtime/GfxDevice/threaded/WorkerIDMapper.h') diff --git a/Runtime/GfxDevice/threaded/WorkerIDMapper.h b/Runtime/GfxDevice/threaded/WorkerIDMapper.h new file mode 100644 index 0000000..9b563f5 --- /dev/null +++ b/Runtime/GfxDevice/threaded/WorkerIDMapper.h @@ -0,0 +1,33 @@ +#ifndef WORKERIDMAPPER_H +#define WORKERIDMAPPER_H + +#include "ClientIDMapper.h" +#include "Runtime/Utilities/dynamic_array.h" + +template +class WorkerIDMapper { +public: + + WorkerIDMapper () + { + (*this)[0] = NULL; + } + + T*& operator [] (ClientIDMapper::ClientID cid) + { + if (m_IDMapping.size() <= cid) + m_IDMapping.resize_uninitialized(cid+1); + return m_IDMapping[cid]; + } + +private: + dynamic_array m_IDMapping; +}; + +#if ENABLE_GFXDEVICE_REMOTE_PROCESS +#define WorkerIDWrapper(type,val) m_##type##Mapper[val] +#else +#define WorkerIDWrapper(type,val) val +#endif + +#endif \ No newline at end of file -- cgit v1.1-26-g67d0