static void toggle_debugstates(float* modelview) { if (modelview){ float white[3] = {1.0, 1.0, 1.0}; glDepthMask(GL_FALSE); glDisable(GL_DEPTH_TEST); glEnableVertexAttribArray(ATTRIBUTE_VERTEX); agp_shader_activate(agp_default_shader(COLOR_2D)); agp_shader_envv(MODELVIEW_MATR, modelview, sizeof(float) * 16); agp_shader_forceunif("obj_col", shdrvec3, (void*) white, false); } else{ agp_shader_activate(agp_default_shader(COLOR_2D)); glEnable(GL_DEPTH_TEST); glDepthMask(GL_TRUE); glDisableVertexAttribArray(ATTRIBUTE_VERTEX); } }
static void toggle_debugstates(float* modelview) { struct agp_fenv* env = agp_env(); if (modelview){ float white[3] = {1.0, 1.0, 1.0}; env->depth_mask(GL_FALSE); env->disable(GL_DEPTH_TEST); env->enable_vertex_attrarray(ATTRIBUTE_VERTEX); agp_shader_activate(agp_default_shader(COLOR_2D)); agp_shader_envv(MODELVIEW_MATR, modelview, sizeof(float) * 16); agp_shader_forceunif("obj_col", shdrvec3, (void*) white); } else{ agp_shader_activate(agp_default_shader(COLOR_2D)); env->enable(GL_DEPTH_TEST); env->depth_mask(GL_TRUE); env->disable_vertex_attrarray(ATTRIBUTE_VERTEX); } }
void platform_video_synch(uint64_t tick_count, float fract, video_synchevent pre, video_synchevent post) { long long start = arcan_timemillis(); if (pre) pre(); arcan_vobject* vobj = arcan_video_getobject(out_vid); if (!vobj){ out_vid = ARCAN_VIDEO_WORLDID; vobj = arcan_video_getobject(ARCAN_VIDEO_WORLDID); } size_t nd; arcan_bench_register_cost( arcan_vint_refresh(fract, &nd) ); agp_shader_id shid = agp_default_shader(BASIC_2D); agp_activate_rendertarget(NULL); if (blackframes){ agp_rendertarget_clear(); blackframes--; } if (vobj->program > 0) shid = vobj->program; agp_activate_vstore(out_vid == ARCAN_VIDEO_WORLDID ? arcan_vint_world() : vobj->vstore); agp_shader_activate(shid); agp_draw_vobj(0, 0, d_width, d_height, txcos, NULL); arcan_vint_drawcursor(false); /* * NOTE: heuristic fix-point for direct- mapping dedicated source for * low latency here when we fix up internal syncing paths. */ eglSwapBuffers(eglDpy, eglSurface); /* With dynamic, we run an artificial vsync if the time between swaps * become to low. This is a workaround for a driver issue spotted on * nvidia and friends from time to time where multiple swaps in short * regression in combination with 'only redraw' adds bubbles */ int delta = arcan_frametime() - last; if (delta >= 0 && delta < 8){ arcan_timesleep(16 - delta); } last = arcan_frametime(); if (post) post(); }