CGLMQuery::CGLMQuery( GLMContext *ctx, GLMQueryParams *params ) { // make sure context is current // get the type of query requested // generate name(s) needed // set initial state appropriately ctx->MakeCurrent(); m_ctx = ctx; m_params = *params; m_name = 0; m_started = m_stopped = m_done = false; m_nullQuery = false; // assume value of convar at start time // does not change during individual query lifetime // started null = stays null // started live = stays live switch(m_params.m_type) { case EOcclusion: { //make an occlusion query (and a fence to go with it) glGenQueriesARB( 1, &m_name ); GLMPRINTF(("-A- CGLMQuery(OQ) created name %d", m_name)); GLenum errorcode = GetQueryError(); if (errorcode) { const char *decodedStr = GLMDecode( eGL_ERROR, errorcode ); printf( "\nCGLMQuery::CGLMQuery (OQ) saw %s error (%d) from glGenQueriesARB", decodedStr, errorcode ); m_name = 0; } } break; case EFence: //make a fence - no aux fence needed glGenFencesAPPLE(1, &m_name ); GLMPRINTF(("-A- CGLMQuery(fence) created name %d", m_name)); GLenum errorcode = GetQueryError(); if (errorcode) { const char *decodedStr = GLMDecode( eGL_ERROR, errorcode ); printf( "\nCGLMQuery::CGLMQuery (fence) saw %s error (%d) from glGenFencesAPPLE", decodedStr, errorcode ); m_name = 0; } break; } }
static void initialize_opengl_sync() { check_opengl_sync_capabilities(); decide_opengl_sync_method(); #ifdef USE_GLES #else if (g_has_nv_fence) { glGenFencesNV(1, &g_fence); CHECK_GL_ERROR_MSG("glGenFencesNV(1, &g_fence)"); } else if (g_has_apple_fence) { glGenFencesAPPLE(1, &g_fence); CHECK_GL_ERROR_MSG("glGenFencesAPPLE(1, &g_fence)"); } #endif }
void CRendererVTB::AfterRenderHook(int idx) { YUVBUFFER &buf = m_buffers[idx]; VTB::CVideoBufferVTB *vb = dynamic_cast<VTB::CVideoBufferVTB*>(buf.videoBuffer); if (!vb) { return; } if (vb->m_fence && glIsFenceAPPLE(vb->m_fence)) { glDeleteFencesAPPLE(1, &vb->m_fence); } glGenFencesAPPLE(1, &vb->m_fence); glSetFenceAPPLE(vb->m_fence); }
GFXGLAppleFence::GFXGLAppleFence(GFXDevice* device) : GFXFence(device), mIssued(false) { glGenFencesAPPLE(1, &mHandle); }
void GFXGLAppleFence::resurrect() { glGenFencesAPPLE(1, &mHandle); }