Ejemplo n.º 1
0
void setGLHooksThreadSpecific(gl_hooks_t const *value) {
    if (sEGLTraceLevel > 0) {
        setGlTraceThreadSpecific(value);
        setGlThreadSpecific(&gHooksTrace);
    } else if (gEGLDebugLevel > 0 && value != &gHooksNoContext) {
        setGlTraceThreadSpecific(value);
        setGlThreadSpecific(&gHooksDebug);
    } else {
        setGlThreadSpecific(value);
    }
}
Ejemplo n.º 2
0
void setGLHooksThreadSpecific(gl_hooks_t const *value) {
    if (sEGLGetErrorEnabled) {
        setGlTraceThreadSpecific(value);
        setGlThreadSpecific(&gHooksErrorTrace);
    } else if (sEGLSystraceEnabled) {
        setGlTraceThreadSpecific(value);
        setGlThreadSpecific(&gHooksSystrace);
    } else if (sEGLTraceLevel > 0) {
        setGlTraceThreadSpecific(value);
        setGlThreadSpecific(&gHooksTrace);
    } else if (gEGLDebugLevel > 0 && value != &gHooksNoContext) {
        setGlTraceThreadSpecific(value);
        setGlThreadSpecific(GLTrace_getGLHooks());
    } else {
        setGlThreadSpecific(value);
    }
}
Ejemplo n.º 3
0
/**
 * Binds context with rendering surface and client API.
 * Unbinds current context if present.
 * @param gl Context to bind.
 * @param d Rendering surface to bind.
 * @return EGL_TRUE on success, EGL_FALSE on failure.
 */
static EGLBoolean fglMakeCurrent(FGLContext *gl, FGLRenderSurface *d)
{
	FGLContext *current = getGlThreadSpecific();

	/* Current context (if available) should get detached */
	if (!gl) {
		if (!current)
			/* Nothing changed */
			return EGL_TRUE;

		fglUnbindContext(current);

		/* this thread has no context attached to it from now on */
		setGlThreadSpecific(0);

		return EGL_TRUE;
	}

	/* New context should get attached */
	if (gl->egl.flags & FGL_IS_CURRENT) {
		if (current != gl) {
			/*
			 * it is an error to set a context current,
			 * if it's already current to another thread
			 */
			setError(EGL_BAD_ACCESS);
			return EGL_FALSE;
		}

		/* Nothing changed */
		return EGL_TRUE;
	}

	/* Detach old context if present */
	if (current)
		fglUnbindContext(current);

	/* Attach draw surface */
	gl->egl.draw = (EGLSurface)d;
	if (!d->connect())
		/* Error should have been set for us. */
		return EGL_FALSE;
	d->ctx = (EGLContext)gl;
	d->bindDrawSurface(gl);

	/* Make the new context current */
	setGlThreadSpecific(gl);
	gl->egl.flags |= FGL_IS_CURRENT;

	/* Perform first time initialization if needed */
	if (gl->egl.flags & FGL_NEVER_CURRENT) {
		GLint w = d->getWidth();
		GLint h = d->getHeight();

		glViewport(0, 0, w, h);
		glScissor(0, 0, w, h);
		glDisable(GL_SCISSOR_TEST);

		gl->egl.flags &= ~FGL_NEVER_CURRENT;
	}

	return EGL_TRUE;
}
Ejemplo n.º 4
0
void setGLHooksThreadSpecific(gl_hooks_t const *value) {
    setGlThreadSpecific(value);
}