/* * 42CreateImageKHR.c */ #include "implement.h" EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list) { #if 1 fprintf (stderr, "EGLImage: eglCreateImageKHR () was called!\n"); fprintf (stderr, "======== ctx = %s\n",ctx == EGL_NO_CONTEXT ? "EGL_NO_CONTEXT" : "POINTER"); if (target == EGL_NATIVE_PIXMAP_KHR) { fprintf (stderr, "======== target = %s\n", "EGL_NATIVE_PIXMAP_KHR"); } else { fprintf (stderr, "======== target = %x\n", (unsigned int)target); } fprintf (stderr, "======== buffer = 0x%x\n", (unsigned int)buffer); #endif struct DisplayExtra* pDisplay = EGLINTER(LookUpDisplay)(dpy); if (pDisplay == NULL) { EGLINTER(SetError)(EGL_BAD_DISPLAY); return EGL_NO_IMAGE_KHR; } if (pDisplay->bInitialized == EGL_FALSE) { EGLINTER(SetError)(EGL_NOT_INITIALIZED); return EGL_NO_IMAGE_KHR; } if (ctx != EGL_NO_CONTEXT) { EGLINTER(SetError)(EGL_BAD_CONTEXT); return EGL_NO_IMAGE_KHR; } if (target != EGL_NATIVE_PIXMAP_KHR) { fprintf (stderr, "EGLImage: Not yet supported target! (%x)\n", (unsigned int)target); return EGL_NO_IMAGE_KHR; } // assert (!EGLINTER(LookUpEGLImage)(unique)); GLint unique = EGLINTER(global).nImageExtra; unique ++; struct ImageExtra *pArea = EGLINTER(InsertEGLImage)((EGLImageKHR)unique); // get the pixmap information here Window root; unsigned dummy; if (XGetGeometry(pDisplay->native, (Pixmap)buffer, &root, &dummy, &dummy, &pArea->width, &pArea->height, &dummy, &pArea->depth) == 0) { fprintf (stderr, "ZLV: Failed here???\n"); EGLINTER(SetError)(EGL_BAD_NATIVE_PIXMAP); return EGL_NO_IMAGE_KHR; } pArea->unique = (EGLImageKHR) unique; pArea->dpy = pDisplay->native; pArea->pixmap = (Pixmap) buffer; return (EGLImageKHR) unique; }