VuoGlContext implementation.
Definition in file VuoGlContext.cc.
Go to the source code of this file.
Macros | |
#define | VuoGlContext_checkGL(cap, value) |
Logs a warning if the specified OpenGL cap ability doesn't have value . | |
#define | VuoGlContext_checkGLInt(key, value) |
Logs a warning if the specified OpenGL key doesn't have value . | |
#define | VuoGlCheckBinding(pname) |
Check whether the specified attachment point pname is still bound. | |
#define | VuoGlCheckTextureBinding(pname, unit) |
Check whether the specified attachment point pname is still bound. | |
Typedefs | |
typedef std::map< VuoGlContext, GLuint > | VuoShaderContextType |
Type for VuoShaderContextMap. | |
Functions | |
static CGLContextObj | VuoGlContext_create (CGLContextObj rootContext) |
Creates a new OpenGL context, optionally shared with rootContext . | |
void | VuoGlContext_setInfoLogging (bool enabled) |
Specifies whether to log general info about each OpenGL Renderer and Metal Device. | |
static void | VuoGlContext_renderers (void) |
Logs info about all available renderers. | |
static void | VuoGlContext_init () |
Returns the process-wide pool singleton instance. | |
VuoGlContext | VuoGlContext_use (void) |
Finds an unused GL context in the process-wide shared context pool (or creates one if none is available), marks it used, and returns it. | |
void | VuoGlContext_disuseF (VuoGlContext glContext, const char *file, const unsigned int linenumber, const char *func) |
Throws the specified context back in the pool. | |
void | VuoGlContext_perform (void(^function)(CGLContextObj cgl_ctx)) |
Executes code using the global OpenGL context. | |
void | VuoGlContext_setGlobalRootContext (void *rootContext) |
Specifies a platform-specific context to be used as the base for all of Vuo's shared GL contexts. | |
int | VuoGlContext_getMaximumSupportedMultisampling (VuoGlContext context) |
Returns the maximum supported multisampling level for this GPU. | |
void * | VuoGlContext_makePlatformPixelFormat (bool hasDepthBuffer, bool openGL32Core, GLint displayMask) |
Returns a platform-specific OpenGL pixelformat description. | |
bool | VuoGlContext_isOpenGL32Core (VuoGlContext context) |
Returns true if the specified context is OpenGL 3.2+ Core Profile. | |
Variables | |
dispatch_semaphore_t | VuoGlContext_poolSemaphore |
Serializes access to VuoGlContext_root , VuoGlContext_allSharedContexts and VuoGlContext_avaialbleSharedContexts . | |
static CGLContextObj | VuoGlContext_root = NULL |
This process's global root context. | |
vector< CGLContextObj > | VuoGlContext_allSharedContexts |
All contexts created by VuoGlContext_create (including those currently being used). | |
vector< CGLContextObj > | VuoGlContext_avaialbleSharedContexts |
All unused contexts created by VuoGlContext_create. | |
static dispatch_once_t | VuoGlContextPoolCreated = 0 |
Make sure this process only has a single GL Context Pool. | |
static pthread_key_t | VuoGlContextPerformKey |
Tracks whether perform is already in the current thread's callstack. | |
static bool | VuoGlContext_infoLogging = true |
Whether to log info about each OpenGL Renderer and Metal Device. | |
VuoShaderContextType | VuoShaderContextMap |
The currently-active shader on each context. | |
#define VuoGlCheckBinding | ( | pname | ) |
Check whether the specified attachment point pname
is still bound.
(This is defined as a macro in order to stringify the argument.)
Definition at line 650 of file VuoGlContext.cc.
#define VuoGlCheckTextureBinding | ( | pname, | |
unit | |||
) |
Check whether the specified attachment point pname
is still bound.
(This is defined as a macro in order to stringify the argument.)
Definition at line 665 of file VuoGlContext.cc.
#define VuoGlContext_checkGL | ( | cap, | |
value | |||
) |
Logs a warning if the specified OpenGL cap
ability doesn't have value
.
Definition at line 440 of file VuoGlContext.cc.
#define VuoGlContext_checkGLInt | ( | key, | |
value | |||
) |
Logs a warning if the specified OpenGL key
doesn't have value
.
Definition at line 452 of file VuoGlContext.cc.
typedef std::map<VuoGlContext, GLuint> VuoShaderContextType |
Type for VuoShaderContextMap.
Definition at line 938 of file VuoGlContext.cc.
|
static |
Creates a new OpenGL context, optionally shared with rootContext
.
Definition at line 536 of file VuoGlContext.cc.
void VuoGlContext_disuseF | ( | VuoGlContext | glContext, |
const char * | file, | ||
const unsigned int | linenumber, | ||
const char * | func | ||
) |
Throws the specified context back in the pool.
This function may be called from any thread.
Definition at line 378 of file VuoGlContext.cc.
int VuoGlContext_getMaximumSupportedMultisampling | ( | VuoGlContext | context | ) |
Returns the maximum supported multisampling level for this GPU.
Multisampling is known to break point rendering on some GPUs, so we intentionally disable it on those.
Definition at line 681 of file VuoGlContext.cc.
|
static |
Returns the process-wide pool singleton instance.
Definition at line 319 of file VuoGlContext.cc.
bool VuoGlContext_isOpenGL32Core | ( | VuoGlContext | context | ) |
Returns true if the specified context
is OpenGL 3.2+ Core Profile.
Definition at line 843 of file VuoGlContext.cc.
void * VuoGlContext_makePlatformPixelFormat | ( | bool | hasDepthBuffer, |
bool | openGL32Core, | ||
GLint | displayMask | ||
) |
Returns a platform-specific OpenGL pixelformat description.
On Mac OS X, this is a CGLPixelFormatObj
.
hasDepthBuffer | If true, the returned context will have a depth buffer. |
openGL32Core | If true, the returned context will be OpenGL 3.2 Core Profile. If false, OpenGL 2.1. |
displayMask | If -1, the context will not be restricted by display. If nonzero, the context will be restricted to the specified displays (CGDisplayIDToOpenGLDisplayMask() ). If the low byte is 0xff, the context will use the Apple Software Renderer. |
Definition at line 723 of file VuoGlContext.cc.
void VuoGlContext_perform | ( | void(^)(CGLContextObj cgl_ctx) | function | ) |
Executes code using the global OpenGL context.
This function may be called from any thread.
Definition at line 477 of file VuoGlContext.cc.
|
static |
Logs info about all available renderers.
Definition at line 54 of file VuoGlContext.cc.
void VuoGlContext_setGlobalRootContext | ( | void * | rootContext | ) |
Specifies a platform-specific context to be used as the base for all of Vuo's shared GL contexts.
On Mac, this should be a CGLContext
. The CGLContext
must be unlocked when calling this function, but after that you may lock it at any time (Vuo doesn't require it to be locked or unlocked).
Must be called before any Vuo composition is loaded, and before any other VuoGlContext_*
methods.
This function may be called from any thread.
Definition at line 634 of file VuoGlContext.cc.
void VuoGlContext_setInfoLogging | ( | bool | enabled | ) |
Specifies whether to log general info about each OpenGL Renderer and Metal Device.
(Errors and warnings are always logged regardless of this value.)
Definition at line 46 of file VuoGlContext.cc.
VuoGlContext VuoGlContext_use | ( | void | ) |
Finds an unused GL context in the process-wide shared context pool (or creates one if none is available), marks it used, and returns it.
This function may be called from any thread.
Definition at line 339 of file VuoGlContext.cc.
vector<CGLContextObj> VuoGlContext_allSharedContexts |
All contexts created by VuoGlContext_create (including those currently being used).
Definition at line 34 of file VuoGlContext.cc.
vector<CGLContextObj> VuoGlContext_avaialbleSharedContexts |
All unused contexts created by VuoGlContext_create.
Definition at line 35 of file VuoGlContext.cc.
|
static |
Whether to log info about each OpenGL Renderer and Metal Device.
Definition at line 40 of file VuoGlContext.cc.
dispatch_semaphore_t VuoGlContext_poolSemaphore |
Serializes access to VuoGlContext_root
, VuoGlContext_allSharedContexts
and VuoGlContext_avaialbleSharedContexts
.
Definition at line 32 of file VuoGlContext.cc.
|
static |
This process's global root context.
Definition at line 33 of file VuoGlContext.cc.
|
static |
Tracks whether perform is already in the current thread's callstack.
Definition at line 38 of file VuoGlContext.cc.
|
static |
Make sure this process only has a single GL Context Pool.
Definition at line 37 of file VuoGlContext.cc.
VuoShaderContextType VuoShaderContextMap |
The currently-active shader on each context.
This is placed in VuoGlContext (a dylib) instead of VuoShader (a static module) to ensure there's only one instance per process.
Definition at line 944 of file VuoGlContext.cc.