EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw) { if (!EglValidate::surfaceTarget(readdraw)) { return EGL_NO_SURFACE; } ThreadInfo* thread = getThreadInfo(); EglDisplay* dpy = static_cast<EglDisplay*>(thread->eglDisplay); ContextPtr ctx = thread->eglContext; if(dpy && ctx.Ptr()) { SurfacePtr surface = readdraw == EGL_READ ? ctx->read() : ctx->draw(); if(surface.Ptr()) { // This double check is required because a surface might still be // current after it is destroyed - in which case its handle should // be invalid, that is EGL_NO_SURFACE should be returned even // though the surface is current. EGLSurface s = (EGLSurface)SafePointerFromUInt(surface->getHndl()); surface = dpy->getSurface(s); if(surface.Ptr()) { return s; } } } return EGL_NO_SURFACE; }
EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void) { ThreadInfo* thread = getThreadInfo(); EglDisplay* dpy = static_cast<EglDisplay*>(thread->eglDisplay); ContextPtr ctx = thread->eglContext; if(dpy && ctx.Ptr()){ // This double check is required because a context might still be current after it is destroyed - in which case // its handle should be invalid, that is EGL_NO_CONTEXT should be returned even though the context is current EGLContext c = (EGLContext)SafePointerFromUInt(ctx->getHndl()); if(dpy->getContext(c).Ptr()) { return c; } } return EGL_NO_CONTEXT; }
void GL2Decoder::s_glDrawElementsOffset(void *self, GLenum mode, GLsizei count, GLenum type, GLuint offset) { GL2Decoder *ctx = (GL2Decoder *)self; ctx->glDrawElements(mode, count, type, SafePointerFromUInt(offset)); }
void GL2Decoder::s_glVertexAttribPointerOffset(void *self, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint data) { GL2Decoder *ctx = (GL2Decoder *) self; ctx->glVertexAttribPointer(indx, size, type, normalized, stride, SafePointerFromUInt(data)); }
void GLESv1Decoder::s_glVertexPointerOffset(void *self, GLint size, GLenum type, GLsizei stride, GLuint offset) { GLESv1Decoder *ctx = (GLESv1Decoder *)self; ctx->glVertexPointer(size, type, stride, SafePointerFromUInt(offset)); }
void GLESv1Decoder::s_glPointSizePointerOffset(void *self, GLenum type, GLsizei stride, GLuint offset) { GLESv1Decoder *ctx = (GLESv1Decoder *)self; ctx->glPointSizePointerOES(type, stride, SafePointerFromUInt(offset)); }
void GLDecoder::s_glMatrixIndexPointerOffset(void * self, GLint size, GLenum type, GLsizei stride, GLuint offset) { GLDecoder *ctx = (GLDecoder *)self; ctx->glMatrixIndexPointerOES(size, type, stride, SafePointerFromUInt(offset)); }