5 #include "eglcurrent.h"
9 #ifdef EGL_KHR_image_base
13 * Parse the list of image attributes and return the proper error code.
16 _eglParseImageAttribList(_EGLImage
*img
, const EGLint
*attrib_list
)
18 EGLint i
, err
= EGL_SUCCESS
;
23 for (i
= 0; attrib_list
[i
] != EGL_NONE
; i
++) {
24 EGLint attr
= attrib_list
[i
++];
25 EGLint val
= attrib_list
[i
];
28 case EGL_IMAGE_PRESERVED_KHR
:
31 case EGL_GL_TEXTURE_LEVEL_KHR
:
32 img
->GLTextureLevel
= val
;
34 case EGL_GL_TEXTURE_ZOFFSET_KHR
:
35 img
->GLTextureZOffset
= val
;
38 /* unknown attrs are ignored */
42 if (err
!= EGL_SUCCESS
) {
43 _eglLog(_EGL_DEBUG
, "bad image attribute 0x%04x", attr
);
53 _eglInitImage(_EGLImage
*img
, _EGLDisplay
*dpy
, const EGLint
*attrib_list
)
57 memset(img
, 0, sizeof(_EGLImage
));
58 img
->Resource
.Display
= dpy
;
60 img
->Preserved
= EGL_FALSE
;
61 img
->GLTextureLevel
= 0;
62 img
->GLTextureZOffset
= 0;
64 err
= _eglParseImageAttribList(img
, attrib_list
);
65 if (err
!= EGL_SUCCESS
)
66 return _eglError(err
, "eglCreateImageKHR");
73 _eglCreateImageKHR(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLContext
*ctx
,
74 EGLenum target
, EGLClientBuffer buffer
,
75 const EGLint
*attr_list
)
77 /* driver should override this function */
83 _eglDestroyImageKHR(_EGLDriver
*drv
, _EGLDisplay
*dpy
, _EGLImage
*image
)
85 /* driver should override this function */
90 #endif /* EGL_KHR_image_base */