egl.go (3075B)
1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package gldriver 6 7 // These constants match the values found in the EGL 1.4 headers, 8 // egl.h, eglext.h, and eglplatform.h. 9 const ( 10 _EGL_DONT_CARE = -1 11 12 _EGL_NO_SURFACE = 0 13 _EGL_NO_CONTEXT = 0 14 _EGL_NO_DISPLAY = 0 15 16 _EGL_OPENGL_ES2_BIT = 0x04 // EGL_RENDERABLE_TYPE mask 17 _EGL_WINDOW_BIT = 0x04 // EGL_SURFACE_TYPE mask 18 19 _EGL_OPENGL_ES_API = 0x30A0 20 _EGL_RENDERABLE_TYPE = 0x3040 21 _EGL_SURFACE_TYPE = 0x3033 22 _EGL_BUFFER_SIZE = 0x3020 23 _EGL_ALPHA_SIZE = 0x3021 24 _EGL_BLUE_SIZE = 0x3022 25 _EGL_GREEN_SIZE = 0x3023 26 _EGL_RED_SIZE = 0x3024 27 _EGL_DEPTH_SIZE = 0x3025 28 _EGL_STENCIL_SIZE = 0x3026 29 _EGL_SAMPLE_BUFFERS = 0x3032 30 _EGL_CONFIG_CAVEAT = 0x3027 31 _EGL_NONE = 0x3038 32 33 _EGL_CONTEXT_CLIENT_VERSION = 0x3098 34 ) 35 36 // ANGLE specific options found in eglext.h 37 const ( 38 _EGL_PLATFORM_ANGLE_ANGLE = 0x3202 39 _EGL_PLATFORM_ANGLE_TYPE_ANGLE = 0x3203 40 _EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE = 0x3204 41 _EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE = 0x3205 42 _EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE = 0x3206 43 44 _EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE = 0x3207 45 _EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE = 0x3208 46 _EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE = 0x3209 47 _EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE = 0x320A 48 _EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE = 0x320B 49 50 _EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE = 0x320D 51 _EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE = 0x320E 52 ) 53 54 const ( 55 _EGL_SUCCESS = 0x3000 56 _EGL_NOT_INITIALIZED = 0x3001 57 _EGL_BAD_ACCESS = 0x3002 58 _EGL_BAD_ALLOC = 0x3003 59 _EGL_BAD_ATTRIBUTE = 0x3004 60 _EGL_BAD_CONFIG = 0x3005 61 _EGL_BAD_CONTEXT = 0x3006 62 _EGL_BAD_CURRENT_SURFACE = 0x3007 63 _EGL_BAD_DISPLAY = 0x3008 64 _EGL_BAD_MATCH = 0x3009 65 _EGL_BAD_NATIVE_PIXMAP = 0x300A 66 _EGL_BAD_NATIVE_WINDOW = 0x300B 67 _EGL_BAD_PARAMETER = 0x300C 68 _EGL_BAD_SURFACE = 0x300D 69 _EGL_CONTEXT_LOST = 0x300E 70 ) 71 72 func eglErrString(errno uintptr) string { 73 switch errno { 74 case _EGL_SUCCESS: 75 return "EGL_SUCCESS" 76 case _EGL_NOT_INITIALIZED: 77 return "EGL_NOT_INITIALIZED" 78 case _EGL_BAD_ACCESS: 79 return "EGL_BAD_ACCESS" 80 case _EGL_BAD_ALLOC: 81 return "EGL_BAD_ALLOC" 82 case _EGL_BAD_ATTRIBUTE: 83 return "EGL_BAD_ATTRIBUTE" 84 case _EGL_BAD_CONFIG: 85 return "EGL_BAD_CONFIG" 86 case _EGL_BAD_CONTEXT: 87 return "EGL_BAD_CONTEXT" 88 case _EGL_BAD_CURRENT_SURFACE: 89 return "EGL_BAD_CURRENT_SURFACE" 90 case _EGL_BAD_DISPLAY: 91 return "EGL_BAD_DISPLAY" 92 case _EGL_BAD_MATCH: 93 return "EGL_BAD_MATCH" 94 case _EGL_BAD_NATIVE_PIXMAP: 95 return "EGL_BAD_NATIVE_PIXMAP" 96 case _EGL_BAD_NATIVE_WINDOW: 97 return "EGL_BAD_NATIVE_WINDOW" 98 case _EGL_BAD_PARAMETER: 99 return "EGL_BAD_PARAMETER" 100 case _EGL_BAD_SURFACE: 101 return "EGL_BAD_SURFACE" 102 case _EGL_CONTEXT_LOST: 103 return "EGL_CONTEXT_LOST" 104 } 105 return "EGL: unknown error" 106 }