1 #ifndef VVGL_GLCPUToTexCopier_hpp 2 #define VVGL_GLCPUToTexCopier_hpp 4 #include "VVGL_Defines.hpp" 5 #include "GLBufferPool.hpp" 14 #if !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3) 38 recursive_mutex _queueLock;
39 GLContextRef _queueCtx =
nullptr;
41 queue<GLBufferRef> _cpuQueue;
42 queue<GLBufferRef> _pboQueue;
43 queue<GLBufferRef> _texQueue;
44 bool _swapBytes =
false;
45 GLBufferPoolRef _privatePool =
nullptr;
49 void _beginProcessing(
const GLBufferRef & inCPUBuffer,
const GLBufferRef & inPBOBuffer,
const GLBufferRef & inTexBuffer);
50 void _finishProcessing(
const GLBufferRef & inCPUBuffer,
const GLBufferRef & inPBOBuffer,
const GLBufferRef & inTexBuffer);
58 GLContextRef
context() {
return _queueCtx; }
64 void setQueueSize(
const int & inNewQueueSize);
66 inline int queueSize() { lock_guard<recursive_mutex> lock(_queueLock);
return _queueSize; };
68 void setSwapBytes(
const bool & n) { lock_guard<recursive_mutex> lock(_queueLock); _swapBytes=n; }
69 bool swapBytes() { lock_guard<recursive_mutex> lock(_queueLock);
return _swapBytes; }
72 GLBufferRef uploadCPUToTex(
const GLBufferRef & inCPUBuffer,
const bool & createInCurrentContext=
false);
74 GLBufferRef uploadCPUToTex(
const GLBufferRef & inCPUBuffer,
const GLBufferRef & inTexBuffer,
const bool & createInCurrentContext=
false);
82 GLBufferRef streamCPUToTex(
const GLBufferRef & inCPUBuffer,
const bool & createInCurrentContext=
false);
89 GLBufferRef streamCPUToTex(
const GLBufferRef & inCPUBuffer,
const GLBufferRef & inTexBuffer,
const bool & createInCurrentContext=
false);
119 #endif // !defined(VVGL_TARGETENV_GLES) && !defined(VVGL_TARGETENV_GLES3) Definition: GLBuffer.hpp:13
shared_ptr< GLCPUToTexCopier > GLCPUToTexCopierRef
A GLCPUToTexCopierRef is a shared pointer around a GLCPUToTexCopier.
Definition: VVGL_Base.hpp:85
GLContextRef context()
Gets the context.
Definition: GLCPUToTexCopier.hpp:58
void setPrivatePool(const GLBufferPoolRef &n)
Sets the receiver's private buffer pool (which should default to null). If non-null, this buffer pool will be used to generate any GL resources required by this scene. Handy if you have a variety of GL contexts that aren't shared and you have to switch between them rapidly on a per-frame basis.
Definition: GLCPUToTexCopier.hpp:92
Uploads CPU-based GLBuffers (Type_CPU) to textures.
Definition: GLCPUToTexCopier.hpp:36
GLCPUToTexCopierRef CreateGLCPUToTexCopierRef()
Creates and returns a GLCPUToTexCopier. The scene makes a new GL context which shares the context of ...
Definition: GLCPUToTexCopier.hpp:104
GLCPUToTexCopierRef CreateGLCPUToTexCopierRefUsing(const GLContextRef &inCtx)
Creates and returns a GLCPUToTexCopier. The downloader uses the passed GL context to perform its GL o...
Definition: GLCPUToTexCopier.hpp:109
GLBufferPoolRef privatePool()
Gets the receiver's private buffer pool- null by default, only non-null if something called setPrivat...
Definition: GLCPUToTexCopier.hpp:94
int queueSize()
Returns the size of the queue used for streaming.
Definition: GLCPUToTexCopier.hpp:66