1# Copyright (C) 2015 Intel Corporation 2# 3# Permission is hereby granted, free of charge, to any person obtaining a 4# copy of this software and associated documentation files (the "Software"), 5# to deal in the Software without restriction, including without limitation 6# the rights to use, copy, modify, merge, publish, distribute, sublicense, 7# and/or sell copies of the Software, and to permit persons to whom the 8# Software is furnished to do so, subject to the following conditions: 9# 10# The above copyright notice and this permission notice (including the next 11# paragraph) shall be included in all copies or substantial portions of the 12# Software. 13# 14# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 20# IN THE SOFTWARE. 21 22class exec_info(): 23 """Information relating GL APIs to a function. 24 25 Each of the four attributes of this class, compatibility, core, es1, and 26 es2, specify the minimum API version where a function can possibly exist 27 in Mesa. The version is specified as an integer of (real GL version * 28 10). For example, glCreateProgram was added in OpenGL 2.0, so 29 compatibility=20 and core=31. 30 31 If the attribute is None, then it cannot be supported by that 32 API. For example, glNewList was removed from core profiles, so 33 compatibility=10 and core=None. 34 35 Each of the attributes that is not None must have a valid value. The 36 valid ranges are: 37 38 compatibility: [10, ) 39 core: [31, ) 40 es1: [10, 11] 41 es2: [20, ) 42 43 These ranges are enforced by the constructor. 44 """ 45 def __init__(self, compatibility=None, core=None, es1=None, es2=None): 46 if compatibility is not None: 47 assert isinstance(compatibility, int) 48 assert compatibility >= 10 49 50 if core is not None: 51 assert isinstance(core, int) 52 assert core >= 31 53 54 if es1 is not None: 55 assert isinstance(es1, int) 56 assert es1 == 10 or es1 == 11 57 58 if es2 is not None: 59 assert isinstance(es2, int) 60 assert es2 >= 20 61 62 self.compatibility = compatibility 63 self.core = core 64 self.es1 = es1 65 self.es2 = es2 66 67functions = { 68 # OpenGL 3.1 / GL_ARB_texture_buffer_object. 69 "TexBuffer": exec_info(compatibility=20, core=31, es2=31), 70 71 # OpenGL 3.2 / GL_OES_geometry_shader. 72 "FramebufferTexture": exec_info(compatibility=32, core=32, es2=31), 73 74 # OpenGL 4.0 / GL_ARB_shader_subroutines. Mesa only exposes this 75 # extension with core profile. 76 "GetSubroutineUniformLocation": exec_info(compatibility=31, core=31), 77 "GetSubroutineIndex": exec_info(compatibility=31, core=31), 78 "GetActiveSubroutineUniformiv": exec_info(compatibility=31, core=31), 79 "GetActiveSubroutineUniformName": exec_info(compatibility=31, core=31), 80 "GetActiveSubroutineName": exec_info(compatibility=31, core=31), 81 "UniformSubroutinesuiv": exec_info(compatibility=31, core=31), 82 "GetUniformSubroutineuiv": exec_info(compatibility=31, core=31), 83 "GetProgramStageiv": exec_info(compatibility=31, core=31), 84 85 # OpenGL 4.0 / GL_ARB_gpu_shader_fp64. The extension spec says: 86 # 87 # "OpenGL 3.2 and GLSL 1.50 are required." 88 "Uniform1d": exec_info(compatibility=32, core=32), 89 "Uniform2d": exec_info(compatibility=32, core=32), 90 "Uniform3d": exec_info(compatibility=32, core=32), 91 "Uniform4d": exec_info(compatibility=32, core=32), 92 "Uniform1dv": exec_info(compatibility=32, core=32), 93 "Uniform2dv": exec_info(compatibility=32, core=32), 94 "Uniform3dv": exec_info(compatibility=32, core=32), 95 "Uniform4dv": exec_info(compatibility=32, core=32), 96 "UniformMatrix2dv": exec_info(compatibility=32, core=32), 97 "UniformMatrix3dv": exec_info(compatibility=32, core=32), 98 "UniformMatrix4dv": exec_info(compatibility=32, core=32), 99 "UniformMatrix2x3dv": exec_info(compatibility=32,core=32), 100 "UniformMatrix2x4dv": exec_info(compatibility=32, core=32), 101 "UniformMatrix3x2dv": exec_info(compatibility=32, core=32), 102 "UniformMatrix3x4dv": exec_info(compatibility=32, core=32), 103 "UniformMatrix4x2dv": exec_info(compatibility=32, core=32), 104 "UniformMatrix4x3dv": exec_info(compatibility=32, core=32), 105 "GetUniformdv": exec_info(compatibility=32, core=32), 106 107 # OpenGL 4.1 / GL_ARB_vertex_attrib_64bit. The extension spec says: 108 # 109 # "OpenGL 3.0 and GLSL 1.30 are required. 110 # 111 # ARB_gpu_shader_fp64 (or equivalent functionality) is required." 112 # 113 # For Mesa this effectively means OpenGL 3.2 is required. It seems 114 # unlikely that Mesa will ever get support for any of the NV extensions 115 # that add "equivalent functionality." 116 "VertexAttribL1d": exec_info(compatibility=32, core=32), 117 "VertexAttribL2d": exec_info(compatibility=32, core=32), 118 "VertexAttribL3d": exec_info(compatibility=32, core=32), 119 "VertexAttribL4d": exec_info(compatibility=32, core=32), 120 "VertexAttribL1dv": exec_info(compatibility=32, core=32), 121 "VertexAttribL2dv": exec_info(compatibility=32, core=32), 122 "VertexAttribL3dv": exec_info(compatibility=32, core=32), 123 "VertexAttribL4dv": exec_info(compatibility=32, core=32), 124 "VertexAttribLPointer": exec_info(compatibility=32, core=32), 125 "GetVertexAttribLdv": exec_info(compatibility=32, core=32), 126 127 # OpenGL 4.1 / GL_ARB_viewport_array. The extension spec says: 128 # 129 # "OpenGL 3.2 or the EXT_geometry_shader4 or ARB_geometry_shader4 130 # extensions are required." 131 # 132 # Mesa does not support either of the geometry shader extensions, so 133 # OpenGL 3.2 is required. 134 "ViewportArrayv": exec_info(compatibility=32, core=32, es2=31), 135 "ViewportIndexedf": exec_info(compatibility=32, core=32, es2=31), 136 "ViewportIndexedfv": exec_info(compatibility=32, core=32, es2=31), 137 "ScissorArrayv": exec_info(compatibility=32, core=32, es2=31), 138 "ScissorIndexed": exec_info(compatibility=32, core=32, es2=31), 139 "ScissorIndexedv": exec_info(compatibility=32, core=32, es2=31), 140 "DepthRangeArrayv": exec_info(compatibility=32, core=32), 141 "DepthRangeIndexed": exec_info(compatibility=32, core=32), 142 # GetFloati_v also GL_ARB_shader_atomic_counters 143 # GetDoublei_v also GL_ARB_shader_atomic_counters 144 145 # OpenGL 4.3 / GL_ARB_texture_buffer_range. 146 "TexBufferRange": exec_info(compatibility=20, core=31, es2=31), 147 148 # OpenGL 4.3 / GL_ARB_framebuffer_no_attachments. Mesa can expose the 149 # extension with OpenGL 3.0. 150 "FramebufferParameteri": exec_info(compatibility=30, core=31, es2=31), 151 "GetFramebufferParameteriv": exec_info(compatibility=30, core=31, es2=31), 152 153 # OpenGL 4.3 / GL_MESA_framebuffer_flip_y. 154 "FramebufferParameteriMESA": exec_info(core=31, es2=30), 155 "GetFramebufferParameterivMESA": exec_info(core=31, es2=30), 156 157 # OpenGL 4.5 / GL_ARB_direct_state_access. Mesa can expose the extension 158 # with core profile. 159 "CreateTransformFeedbacks": exec_info(compatibility=31, core=31), 160 "TransformFeedbackBufferBase": exec_info(compatibility=31, core=31), 161 "TransformFeedbackBufferRange": exec_info(compatibility=31, core=31), 162 "GetTransformFeedbackiv": exec_info(compatibility=31, core=31), 163 "GetTransformFeedbacki_v": exec_info(compatibility=31, core=31), 164 "GetTransformFeedbacki64_v": exec_info(compatibility=31, core=31), 165 "CreateBuffers": exec_info(compatibility=31, core=31), 166 "NamedBufferStorage": exec_info(compatibility=31, core=31), 167 "NamedBufferData": exec_info(compatibility=31, core=31), 168 "NamedBufferSubData": exec_info(compatibility=31, core=31), 169 "CopyNamedBufferSubData": exec_info(compatibility=31, core=31), 170 "ClearNamedBufferData": exec_info(compatibility=31, core=31), 171 "ClearNamedBufferSubData": exec_info(compatibility=31, core=31), 172 "MapNamedBuffer": exec_info(compatibility=31, core=31), 173 "MapNamedBufferRange": exec_info(compatibility=31, core=31), 174 "UnmapNamedBuffer": exec_info(compatibility=31, core=31), 175 "FlushMappedNamedBufferRange": exec_info(compatibility=31, core=31), 176 "GetNamedBufferParameteriv": exec_info(compatibility=31, core=31), 177 "GetNamedBufferParameteri64v": exec_info(compatibility=31, core=31), 178 "GetNamedBufferPointerv": exec_info(compatibility=31, core=31), 179 "GetNamedBufferSubData": exec_info(compatibility=31, core=31), 180 "CreateFramebuffers": exec_info(compatibility=31, core=31), 181 "NamedFramebufferRenderbuffer": exec_info(compatibility=31, core=31), 182 "NamedFramebufferParameteri": exec_info(compatibility=31, core=31), 183 "NamedFramebufferTexture": exec_info(compatibility=31, core=31), 184 "NamedFramebufferTextureLayer": exec_info(compatibility=31, core=31), 185 "NamedFramebufferDrawBuffer": exec_info(compatibility=31, core=31), 186 "NamedFramebufferDrawBuffers": exec_info(compatibility=31, core=31), 187 "NamedFramebufferReadBuffer": exec_info(compatibility=31, core=31), 188 "InvalidateNamedFramebufferData": exec_info(compatibility=31, core=31), 189 "InvalidateNamedFramebufferSubData": exec_info(compatibility=31, core=31), 190 "ClearNamedFramebufferiv": exec_info(compatibility=31, core=31), 191 "ClearNamedFramebufferuiv": exec_info(compatibility=31, core=31), 192 "ClearNamedFramebufferfv": exec_info(compatibility=31, core=31), 193 "ClearNamedFramebufferfi": exec_info(compatibility=31, core=31), 194 "BlitNamedFramebuffer": exec_info(compatibility=31, core=31), 195 "CheckNamedFramebufferStatus": exec_info(compatibility=31, core=31), 196 "GetNamedFramebufferParameteriv": exec_info(compatibility=31, core=31), 197 "GetNamedFramebufferAttachmentParameteriv": exec_info(compatibility=31, core=31), 198 "CreateRenderbuffers": exec_info(compatibility=31, core=31), 199 "NamedRenderbufferStorage": exec_info(compatibility=31, core=31), 200 "NamedRenderbufferStorageMultisample": exec_info(compatibility=31, core=31), 201 "GetNamedRenderbufferParameteriv": exec_info(compatibility=31, core=31), 202 "CreateTextures": exec_info(compatibility=31, core=31), 203 "TextureBuffer": exec_info(compatibility=31, core=31), 204 "TextureBufferRange": exec_info(compatibility=31, core=31), 205 "TextureStorage1D": exec_info(compatibility=31, core=31), 206 "TextureStorage2D": exec_info(compatibility=31, core=31), 207 "TextureStorage3D": exec_info(compatibility=31, core=31), 208 "TextureStorage2DMultisample": exec_info(compatibility=31, core=31), 209 "TextureStorage3DMultisample": exec_info(compatibility=31, core=31), 210 "TextureSubImage1D": exec_info(compatibility=31, core=31), 211 "TextureSubImage2D": exec_info(compatibility=31, core=31), 212 "TextureSubImage3D": exec_info(compatibility=31, core=31), 213 "CompressedTextureSubImage1D": exec_info(compatibility=31, core=31), 214 "CompressedTextureSubImage2D": exec_info(compatibility=31, core=31), 215 "CompressedTextureSubImage3D": exec_info(compatibility=31, core=31), 216 "CopyTextureSubImage1D": exec_info(compatibility=31, core=31), 217 "CopyTextureSubImage2D": exec_info(compatibility=31, core=31), 218 "CopyTextureSubImage3D": exec_info(compatibility=31, core=31), 219 "TextureParameterf": exec_info(compatibility=31, core=31), 220 "TextureParameterfv": exec_info(compatibility=31, core=31), 221 "TextureParameteri": exec_info(compatibility=31, core=31), 222 "TextureParameterIiv": exec_info(compatibility=31, core=31), 223 "TextureParameterIuiv": exec_info(compatibility=31, core=31), 224 "TextureParameteriv": exec_info(compatibility=31, core=31), 225 "GenerateTextureMipmap": exec_info(compatibility=31, core=31), 226 "BindTextureUnit": exec_info(compatibility=31, core=31), 227 "GetTextureImage": exec_info(compatibility=31, core=31), 228 "GetCompressedTextureImage": exec_info(compatibility=31, core=31), 229 "GetTextureLevelParameterfv": exec_info(compatibility=31, core=31), 230 "GetTextureLevelParameteriv": exec_info(compatibility=31, core=31), 231 "GetTextureParameterfv": exec_info(compatibility=31, core=31), 232 "GetTextureParameterIiv": exec_info(compatibility=31, core=31), 233 "GetTextureParameterIuiv": exec_info(compatibility=31, core=31), 234 "GetTextureParameteriv": exec_info(compatibility=31, core=31), 235 "CreateVertexArrays": exec_info(compatibility=31, core=31), 236 "DisableVertexArrayAttrib": exec_info(compatibility=31, core=31), 237 "EnableVertexArrayAttrib": exec_info(compatibility=31, core=31), 238 "VertexArrayElementBuffer": exec_info(compatibility=31, core=31), 239 "VertexArrayVertexBuffer": exec_info(compatibility=31, core=31), 240 "VertexArrayVertexBuffers": exec_info(compatibility=31, core=31), 241 "VertexArrayAttribFormat": exec_info(compatibility=31, core=31), 242 "VertexArrayAttribIFormat": exec_info(compatibility=31, core=31), 243 "VertexArrayAttribLFormat": exec_info(compatibility=31, core=31), 244 "VertexArrayAttribBinding": exec_info(compatibility=31, core=31), 245 "VertexArrayBindingDivisor": exec_info(compatibility=31, core=31), 246 "GetVertexArrayiv": exec_info(compatibility=31, core=31), 247 "GetVertexArrayIndexediv": exec_info(compatibility=31, core=31), 248 "GetVertexArrayIndexed64iv": exec_info(compatibility=31, core=31), 249 "CreateSamplers": exec_info(compatibility=31, core=31), 250 "CreateProgramPipelines": exec_info(compatibility=31, core=31), 251 "CreateQueries": exec_info(compatibility=31, core=31), 252 "GetQueryBufferObjectiv": exec_info(compatibility=31, core=31), 253 "GetQueryBufferObjectuiv": exec_info(compatibility=31, core=31), 254 "GetQueryBufferObjecti64v": exec_info(compatibility=31, core=31), 255 "GetQueryBufferObjectui64v": exec_info(compatibility=31, core=31), 256 257 # GL_ARB_gpu_shader_int64 - nominally requires OpenGL 4.0 258 "Uniform1i64ARB": exec_info(compatibility=40, core=31), 259 "Uniform2i64ARB": exec_info(compatibility=40, core=31), 260 "Uniform3i64ARB": exec_info(compatibility=40, core=31), 261 "Uniform4i64ARB": exec_info(compatibility=40, core=31), 262 "Uniform1i64vARB": exec_info(compatibility=40, core=31), 263 "Uniform2i64vARB": exec_info(compatibility=40, core=31), 264 "Uniform3i64vARB": exec_info(compatibility=40, core=31), 265 "Uniform4i64vARB": exec_info(compatibility=40, core=31), 266 "Uniform1ui64ARB": exec_info(compatibility=40, core=31), 267 "Uniform2ui64ARB": exec_info(compatibility=40, core=31), 268 "Uniform3ui64ARB": exec_info(compatibility=40, core=31), 269 "Uniform4ui64ARB": exec_info(compatibility=40, core=31), 270 "Uniform1ui64vARB": exec_info(compatibility=40, core=31), 271 "Uniform2ui64vARB": exec_info(compatibility=40, core=31), 272 "Uniform3ui64vARB": exec_info(compatibility=40, core=31), 273 "Uniform4ui64vARB": exec_info(compatibility=40, core=31), 274 "GetUniformi64vARB": exec_info(compatibility=40, core=31), 275 "GetUniformui64vARB": exec_info(compatibility=40, core=31), 276 "GetnUniformi64vARB": exec_info(compatibility=40, core=31), 277 "GetnUniformui64vARB": exec_info(compatibility=40, core=31), 278 "ProgramUniform1i64ARB": exec_info(compatibility=40, core=31), 279 "ProgramUniform2i64ARB": exec_info(compatibility=40, core=31), 280 "ProgramUniform3i64ARB": exec_info(compatibility=40, core=31), 281 "ProgramUniform4i64ARB": exec_info(compatibility=40, core=31), 282 "ProgramUniform1i64vARB": exec_info(compatibility=40, core=31), 283 "ProgramUniform2i64vARB": exec_info(compatibility=40, core=31), 284 "ProgramUniform3i64vARB": exec_info(compatibility=40, core=31), 285 "ProgramUniform4i64vARB": exec_info(compatibility=40, core=31), 286 "ProgramUniform1ui64ARB": exec_info(compatibility=40, core=31), 287 "ProgramUniform2ui64ARB": exec_info(compatibility=40, core=31), 288 "ProgramUniform3ui64ARB": exec_info(compatibility=40, core=31), 289 "ProgramUniform4ui64ARB": exec_info(compatibility=40, core=31), 290 "ProgramUniform1ui64vARB": exec_info(compatibility=40, core=31), 291 "ProgramUniform2ui64vARB": exec_info(compatibility=40, core=31), 292 "ProgramUniform3ui64vARB": exec_info(compatibility=40, core=31), 293 "ProgramUniform4ui64vARB": exec_info(compatibility=40, core=31), 294 295 # GL_ARB_bindless_texture 296 "GetVertexAttribLui64vARB": exec_info(compatibility=30, core=31), 297} 298