1 2 // Copyright 2018 - 2021 Michael D. Parker 3 // Distributed under the Boost Software License, Version 1.0. 4 // (See accompanying file LICENSE_1_0.txt or copy at 5 // http://www.boost.org/LICENSE_1_0.txt) 6 7 module bindbc.opengl.bind.arb.core_46; 8 9 import bindbc.loader; 10 import bindbc.opengl.config, 11 bindbc.opengl.context; 12 import bindbc.opengl.bind.types; 13 14 static if(glSupport >= GLSupport.gl46) { 15 enum has46 = true; 16 } 17 else enum has46 = false; 18 19 // ARB_polygon_offset_clamp 20 version(GL_ARB) enum useARBPolygonOffsetClamp = true; 21 else version(GL_ARB_polygon_offset_clamp) enum useARBPolygonOffsetClamp = true; 22 else enum useARBPolygonOffsetClamp = has46; 23 24 static if(useARBPolygonOffsetClamp) { 25 private bool _hasARBPolygonOffsetClamp; 26 @nogc nothrow bool hasARBPolygonOffsetClamp() { return _hasARBPolygonOffsetClamp; } 27 28 enum uint GL_POLYGON_OFFSET_CLAMP = 0x8E1B; 29 30 extern(System) @nogc nothrow alias pglPolygonOffsetClamp = void function( GLfloat,GLfloat,GLfloat ); 31 __gshared pglPolygonOffsetClamp glPolygonOffsetClamp; 32 33 private @nogc nothrow 34 bool loadARBPolygonOffsetClamp(SharedLib lib, GLSupport contextVersion) 35 { 36 lib.bindGLSymbol(cast(void**)&glPolygonOffsetClamp, "glPolygonOffsetClamp"); 37 return resetErrorCountGL; 38 } 39 } 40 else enum hasARBPolygonOffsetClamp = false; 41 42 // ARB_texture_filter_anisotropic 43 version(GL_ARB) enum useARBTextureFilterAnisotropic = true; 44 else version(GL_ARB_texture_filter_anisotropic) enum useARBTextureFilterAnisotropic = true; 45 else enum useARBTextureFilterAnisotropic = has46; 46 47 static if(useARBTextureFilterAnisotropic) { 48 private bool _hasARBTextureFilterAnisotropic; 49 @nogc nothrow bool hasARBTextureFilterAnisotropic() { return _hasARBTextureFilterAnisotropic; } 50 51 enum : uint { 52 GL_TEXTURE_MAX_ANISOTROPY = 0x84FE, 53 GL_MAX_TEXTURE_MAX_ANISOTROPY = 0x84FF, 54 } 55 } 56 else enum hasARBTextureFilterAnisotropic = false; 57 58 package(bindbc.opengl) @nogc nothrow 59 bool loadARB46(SharedLib lib, GLSupport contextVersion) 60 { 61 static if(has46) { 62 if(contextVersion >= GLSupport.gl46) { 63 _hasARBTextureFilterAnisotropic = true; 64 65 bool ret = true; 66 ret = _hasARBPolygonOffsetClamp = lib.loadARBPolygonOffsetClamp(contextVersion); 67 return ret; 68 } 69 } 70 71 static if(useARBTextureFilterAnisotropic) _hasARBTextureFilterAnisotropic = 72 hasExtension(contextVersion, "GL_ARB_texture_filter_anisotropic"); 73 74 static if(useARBPolygonOffsetClamp) _hasARBPolygonOffsetClamp = 75 hasExtension(contextVersion, "GL_ARB_polygon_offset_clamp") && 76 lib.loadARBPolygonOffsetClamp(contextVersion); 77 78 return true; 79 }