CVertexArrayRange::Initialize() { stripIndex=0; drawIndex=0; glFinishFenceNV(fence); }
void finish_fence(unsigned int fence_id) // Block until all gl drawing calls, associated with the specified // fence, have completed. { if (glFinishFenceNV) { glFinishFenceNV(fence_id); } // else no-op. }
void Milestone::wait() { debugAssertM(isSet, std::string("Waiting for a milestone (\"") + _name + "\") that was not set!"); if (glFinishFenceNV) { glFinishFenceNV(glfence); } else { // With no way of waiting for a specific fence, we must wait for everything. glFinish(); } isSet = false; }
enum wined3d_event_query_result wined3d_event_query_finish(const struct wined3d_event_query *query, const struct wined3d_device *device) { struct wined3d_context *context; const struct wined3d_gl_info *gl_info; enum wined3d_event_query_result ret; TRACE("(%p)\n", query); if (!query->context) { TRACE("Query not started\n"); return WINED3D_EVENT_QUERY_NOT_STARTED; } gl_info = query->context->gl_info; if (query->context->tid != GetCurrentThreadId() && !gl_info->supported[ARB_SYNC]) { /* A glFinish does not reliably wait for draws in other contexts. The caller has * to find its own way to cope with the thread switch */ WARN("Event query finished from wrong thread\n"); return WINED3D_EVENT_QUERY_WRONG_THREAD; } context = context_acquire(device, query->context->current_rt); if (gl_info->supported[ARB_SYNC]) { /* Apple seems to be into arbitrary limits, and timeouts larger than * 0xfffffffffffffbff immediately return GL_TIMEOUT_EXPIRED. We don't * really care and can live with waiting a few μs less. (OS X 10.7.4). */ GLenum gl_ret = GL_EXTCALL(glClientWaitSync(query->object.sync, GL_SYNC_FLUSH_COMMANDS_BIT, ~(GLuint64)0xffff)); checkGLcall("glClientWaitSync"); switch (gl_ret) { case GL_ALREADY_SIGNALED: case GL_CONDITION_SATISFIED: ret = WINED3D_EVENT_QUERY_OK; break; /* We don't expect a timeout for a ~584 year wait */ default: ERR("glClientWaitSync returned %#x.\n", gl_ret); ret = WINED3D_EVENT_QUERY_ERROR; } } else if (context->gl_info->supported[APPLE_FENCE]) { GL_EXTCALL(glFinishFenceAPPLE(query->object.id)); checkGLcall("glFinishFenceAPPLE"); ret = WINED3D_EVENT_QUERY_OK; } else if (context->gl_info->supported[NV_FENCE]) { GL_EXTCALL(glFinishFenceNV(query->object.id)); checkGLcall("glFinishFenceNV"); ret = WINED3D_EVENT_QUERY_OK; } else { ERR("Event query created without GL support\n"); ret = WINED3D_EVENT_QUERY_ERROR; } context_release(context); return ret; }
void CVertexArrayRange::Initialize() { CVertexArray::Initialize(); glFinishFenceNV(fence); }
enum wined3d_event_query_result wined3d_event_query_finish(struct wined3d_event_query *query, IWineD3DDeviceImpl *device) { struct wined3d_context *context; const struct wined3d_gl_info *gl_info; enum wined3d_event_query_result ret; TRACE("(%p)\n", query); if (!query->context) { TRACE("Query not started\n"); return WINED3D_EVENT_QUERY_NOT_STARTED; } gl_info = query->context->gl_info; if (query->context->tid != GetCurrentThreadId() && !gl_info->supported[ARB_SYNC]) { /* A glFinish does not reliably wait for draws in other contexts. The caller has * to find its own way to cope with the thread switch */ WARN("Event query finished from wrong thread\n"); return WINED3D_EVENT_QUERY_WRONG_THREAD; } context = context_acquire(device, query->context->current_rt); ENTER_GL(); if (gl_info->supported[ARB_SYNC]) { GLenum gl_ret = GL_EXTCALL(glClientWaitSync(query->object.sync, 0, ~(GLuint64)0)); checkGLcall("glClientWaitSync"); switch (gl_ret) { case GL_ALREADY_SIGNALED: case GL_CONDITION_SATISFIED: ret = WINED3D_EVENT_QUERY_OK; break; /* We don't expect a timeout for a ~584 year wait */ default: ERR("glClientWaitSync returned %#x.\n", gl_ret); ret = WINED3D_EVENT_QUERY_ERROR; } } else if (context->gl_info->supported[APPLE_FENCE]) { GL_EXTCALL(glFinishFenceAPPLE(query->object.id)); checkGLcall("glFinishFenceAPPLE"); ret = WINED3D_EVENT_QUERY_OK; } else if (context->gl_info->supported[NV_FENCE]) { GL_EXTCALL(glFinishFenceNV(query->object.id)); checkGLcall("glFinishFenceNV"); ret = WINED3D_EVENT_QUERY_OK; } else { ERR("Event query created without GL support\n"); ret = WINED3D_EVENT_QUERY_ERROR; } LEAVE_GL(); context_release(context); return ret; }