work.h (4479B)
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 #ifdef os_android 6 // TODO(crawshaw): We could include <android/api-level.h> and 7 // condition on __ANDROID_API__ to get GLES3 headers. However 8 // we also need to add -lGLESv3 to LDFLAGS, which we cannot do 9 // from inside an ifdef. 10 #include <GLES2/gl2.h> 11 #elif os_linux 12 #include <GLES3/gl3.h> // install on Ubuntu with: sudo apt-get install libegl1-mesa-dev libgles2-mesa-dev libx11-dev 13 #elif os_openbsd 14 #include <GLES3/gl3.h> 15 #endif 16 17 #ifdef os_ios 18 #include <OpenGLES/ES2/glext.h> 19 #endif 20 21 #ifdef os_osx 22 #include <OpenGL/gl3.h> 23 #define GL_ES_VERSION_3_0 1 24 #endif 25 26 #if defined(GL_ES_VERSION_3_0) && GL_ES_VERSION_3_0 27 #define GLES_VERSION "GL_ES_3_0" 28 #else 29 #define GLES_VERSION "GL_ES_2_0" 30 #endif 31 32 #include <stdint.h> 33 #include <stdlib.h> 34 35 // TODO: generate this enum from fn.go. 36 typedef enum { 37 glfnUNDEFINED, 38 39 glfnActiveTexture, 40 glfnAttachShader, 41 glfnBindAttribLocation, 42 glfnBindBuffer, 43 glfnBindFramebuffer, 44 glfnBindRenderbuffer, 45 glfnBindTexture, 46 glfnBindVertexArray, 47 glfnBlendColor, 48 glfnBlendEquation, 49 glfnBlendEquationSeparate, 50 glfnBlendFunc, 51 glfnBlendFuncSeparate, 52 glfnBufferData, 53 glfnBufferSubData, 54 glfnCheckFramebufferStatus, 55 glfnClear, 56 glfnClearColor, 57 glfnClearDepthf, 58 glfnClearStencil, 59 glfnColorMask, 60 glfnCompileShader, 61 glfnCompressedTexImage2D, 62 glfnCompressedTexSubImage2D, 63 glfnCopyTexImage2D, 64 glfnCopyTexSubImage2D, 65 glfnCreateProgram, 66 glfnCreateShader, 67 glfnCullFace, 68 glfnDeleteBuffer, 69 glfnDeleteFramebuffer, 70 glfnDeleteProgram, 71 glfnDeleteRenderbuffer, 72 glfnDeleteShader, 73 glfnDeleteTexture, 74 glfnDeleteVertexArray, 75 glfnDepthFunc, 76 glfnDepthRangef, 77 glfnDepthMask, 78 glfnDetachShader, 79 glfnDisable, 80 glfnDisableVertexAttribArray, 81 glfnDrawArrays, 82 glfnDrawElements, 83 glfnEnable, 84 glfnEnableVertexAttribArray, 85 glfnFinish, 86 glfnFlush, 87 glfnFramebufferRenderbuffer, 88 glfnFramebufferTexture2D, 89 glfnFrontFace, 90 glfnGenBuffer, 91 glfnGenFramebuffer, 92 glfnGenRenderbuffer, 93 glfnGenTexture, 94 glfnGenVertexArray, 95 glfnGenerateMipmap, 96 glfnGetActiveAttrib, 97 glfnGetActiveUniform, 98 glfnGetAttachedShaders, 99 glfnGetAttribLocation, 100 glfnGetBooleanv, 101 glfnGetBufferParameteri, 102 glfnGetError, 103 glfnGetFloatv, 104 glfnGetFramebufferAttachmentParameteriv, 105 glfnGetIntegerv, 106 glfnGetProgramInfoLog, 107 glfnGetProgramiv, 108 glfnGetRenderbufferParameteriv, 109 glfnGetShaderInfoLog, 110 glfnGetShaderPrecisionFormat, 111 glfnGetShaderSource, 112 glfnGetShaderiv, 113 glfnGetString, 114 glfnGetTexParameterfv, 115 glfnGetTexParameteriv, 116 glfnGetUniformLocation, 117 glfnGetUniformfv, 118 glfnGetUniformiv, 119 glfnGetVertexAttribfv, 120 glfnGetVertexAttribiv, 121 glfnHint, 122 glfnIsBuffer, 123 glfnIsEnabled, 124 glfnIsFramebuffer, 125 glfnIsProgram, 126 glfnIsRenderbuffer, 127 glfnIsShader, 128 glfnIsTexture, 129 glfnLineWidth, 130 glfnLinkProgram, 131 glfnPixelStorei, 132 glfnPolygonOffset, 133 glfnReadPixels, 134 glfnReleaseShaderCompiler, 135 glfnRenderbufferStorage, 136 glfnSampleCoverage, 137 glfnScissor, 138 glfnShaderSource, 139 glfnStencilFunc, 140 glfnStencilFuncSeparate, 141 glfnStencilMask, 142 glfnStencilMaskSeparate, 143 glfnStencilOp, 144 glfnStencilOpSeparate, 145 glfnTexImage2D, 146 glfnTexParameterf, 147 glfnTexParameterfv, 148 glfnTexParameteri, 149 glfnTexParameteriv, 150 glfnTexSubImage2D, 151 glfnUniform1f, 152 glfnUniform1fv, 153 glfnUniform1i, 154 glfnUniform1iv, 155 glfnUniform2f, 156 glfnUniform2fv, 157 glfnUniform2i, 158 glfnUniform2iv, 159 glfnUniform3f, 160 glfnUniform3fv, 161 glfnUniform3i, 162 glfnUniform3iv, 163 glfnUniform4f, 164 glfnUniform4fv, 165 glfnUniform4i, 166 glfnUniform4iv, 167 glfnUniformMatrix2fv, 168 glfnUniformMatrix3fv, 169 glfnUniformMatrix4fv, 170 glfnUseProgram, 171 glfnValidateProgram, 172 glfnVertexAttrib1f, 173 glfnVertexAttrib1fv, 174 glfnVertexAttrib2f, 175 glfnVertexAttrib2fv, 176 glfnVertexAttrib3f, 177 glfnVertexAttrib3fv, 178 glfnVertexAttrib4f, 179 glfnVertexAttrib4fv, 180 glfnVertexAttribPointer, 181 glfnViewport, 182 183 // ES 3.0 functions 184 glfnUniformMatrix2x3fv, 185 glfnUniformMatrix3x2fv, 186 glfnUniformMatrix2x4fv, 187 glfnUniformMatrix4x2fv, 188 glfnUniformMatrix3x4fv, 189 glfnUniformMatrix4x3fv, 190 glfnBlitFramebuffer, 191 glfnUniform1ui, 192 glfnUniform2ui, 193 glfnUniform3ui, 194 glfnUniform4ui, 195 glfnUniform1uiv, 196 glfnUniform2uiv, 197 glfnUniform3uiv, 198 glfnUniform4uiv, 199 } glfn; 200 201 // TODO: generate this type from fn.go. 202 struct fnargs { 203 glfn fn; 204 205 uintptr_t a0; 206 uintptr_t a1; 207 uintptr_t a2; 208 uintptr_t a3; 209 uintptr_t a4; 210 uintptr_t a5; 211 uintptr_t a6; 212 uintptr_t a7; 213 uintptr_t a8; 214 uintptr_t a9; 215 }; 216 217 extern uintptr_t processFn(struct fnargs* args, char* parg);