fn.go (3760B)
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 gl 6 7 import "unsafe" 8 9 type call struct { 10 args fnargs 11 parg unsafe.Pointer 12 blocking bool 13 } 14 15 type fnargs struct { 16 fn glfn 17 18 a0 uintptr 19 a1 uintptr 20 a2 uintptr 21 a3 uintptr 22 a4 uintptr 23 a5 uintptr 24 a6 uintptr 25 a7 uintptr 26 a8 uintptr 27 a9 uintptr 28 } 29 30 type glfn int 31 32 const ( 33 glfnUNDEFINED glfn = iota 34 glfnActiveTexture 35 glfnAttachShader 36 glfnBindAttribLocation 37 glfnBindBuffer 38 glfnBindFramebuffer 39 glfnBindRenderbuffer 40 glfnBindTexture 41 glfnBindVertexArray 42 glfnBlendColor 43 glfnBlendEquation 44 glfnBlendEquationSeparate 45 glfnBlendFunc 46 glfnBlendFuncSeparate 47 glfnBufferData 48 glfnBufferSubData 49 glfnCheckFramebufferStatus 50 glfnClear 51 glfnClearColor 52 glfnClearDepthf 53 glfnClearStencil 54 glfnColorMask 55 glfnCompileShader 56 glfnCompressedTexImage2D 57 glfnCompressedTexSubImage2D 58 glfnCopyTexImage2D 59 glfnCopyTexSubImage2D 60 glfnCreateProgram 61 glfnCreateShader 62 glfnCullFace 63 glfnDeleteBuffer 64 glfnDeleteFramebuffer 65 glfnDeleteProgram 66 glfnDeleteRenderbuffer 67 glfnDeleteShader 68 glfnDeleteTexture 69 glfnDeleteVertexArray 70 glfnDepthFunc 71 glfnDepthRangef 72 glfnDepthMask 73 glfnDetachShader 74 glfnDisable 75 glfnDisableVertexAttribArray 76 glfnDrawArrays 77 glfnDrawElements 78 glfnEnable 79 glfnEnableVertexAttribArray 80 glfnFinish 81 glfnFlush 82 glfnFramebufferRenderbuffer 83 glfnFramebufferTexture2D 84 glfnFrontFace 85 glfnGenBuffer 86 glfnGenFramebuffer 87 glfnGenRenderbuffer 88 glfnGenTexture 89 glfnGenVertexArray 90 glfnGenerateMipmap 91 glfnGetActiveAttrib 92 glfnGetActiveUniform 93 glfnGetAttachedShaders 94 glfnGetAttribLocation 95 glfnGetBooleanv 96 glfnGetBufferParameteri 97 glfnGetError 98 glfnGetFloatv 99 glfnGetFramebufferAttachmentParameteriv 100 glfnGetIntegerv 101 glfnGetProgramInfoLog 102 glfnGetProgramiv 103 glfnGetRenderbufferParameteriv 104 glfnGetShaderInfoLog 105 glfnGetShaderPrecisionFormat 106 glfnGetShaderSource 107 glfnGetShaderiv 108 glfnGetString 109 glfnGetTexParameterfv 110 glfnGetTexParameteriv 111 glfnGetUniformLocation 112 glfnGetUniformfv 113 glfnGetUniformiv 114 glfnGetVertexAttribfv 115 glfnGetVertexAttribiv 116 glfnHint 117 glfnIsBuffer 118 glfnIsEnabled 119 glfnIsFramebuffer 120 glfnIsProgram 121 glfnIsRenderbuffer 122 glfnIsShader 123 glfnIsTexture 124 glfnLineWidth 125 glfnLinkProgram 126 glfnPixelStorei 127 glfnPolygonOffset 128 glfnReadPixels 129 glfnReleaseShaderCompiler 130 glfnRenderbufferStorage 131 glfnSampleCoverage 132 glfnScissor 133 glfnShaderSource 134 glfnStencilFunc 135 glfnStencilFuncSeparate 136 glfnStencilMask 137 glfnStencilMaskSeparate 138 glfnStencilOp 139 glfnStencilOpSeparate 140 glfnTexImage2D 141 glfnTexParameterf 142 glfnTexParameterfv 143 glfnTexParameteri 144 glfnTexParameteriv 145 glfnTexSubImage2D 146 glfnUniform1f 147 glfnUniform1fv 148 glfnUniform1i 149 glfnUniform1iv 150 glfnUniform2f 151 glfnUniform2fv 152 glfnUniform2i 153 glfnUniform2iv 154 glfnUniform3f 155 glfnUniform3fv 156 glfnUniform3i 157 glfnUniform3iv 158 glfnUniform4f 159 glfnUniform4fv 160 glfnUniform4i 161 glfnUniform4iv 162 glfnUniformMatrix2fv 163 glfnUniformMatrix3fv 164 glfnUniformMatrix4fv 165 glfnUseProgram 166 glfnValidateProgram 167 glfnVertexAttrib1f 168 glfnVertexAttrib1fv 169 glfnVertexAttrib2f 170 glfnVertexAttrib2fv 171 glfnVertexAttrib3f 172 glfnVertexAttrib3fv 173 glfnVertexAttrib4f 174 glfnVertexAttrib4fv 175 glfnVertexAttribPointer 176 glfnViewport 177 178 // ES 3.0 functions 179 glfnUniformMatrix2x3fv 180 glfnUniformMatrix3x2fv 181 glfnUniformMatrix2x4fv 182 glfnUniformMatrix4x2fv 183 glfnUniformMatrix3x4fv 184 glfnUniformMatrix4x3fv 185 glfnBlitFramebuffer 186 glfnUniform1ui 187 glfnUniform2ui 188 glfnUniform3ui 189 glfnUniform4ui 190 glfnUniform1uiv 191 glfnUniform2uiv 192 glfnUniform3uiv 193 glfnUniform4uiv 194 ) 195 196 func goString(buf []byte) string { 197 for i, b := range buf { 198 if b == 0 { 199 return string(buf[:i]) 200 } 201 } 202 panic("buf is not NUL-terminated") 203 } 204 205 func glBoolean(b bool) uintptr { 206 if b { 207 return TRUE 208 } 209 return FALSE 210 }