From 2556d006f708a5e4d84361e917764d618c497c02 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 5 Aug 2018 13:01:42 +0200 Subject: [PATCH] glgsg: a few version check tweaks --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 14 +++++++++----- panda/src/glstuff/glGraphicsStateGuardian_src.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 8fe943108b..fb22fdb644 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -2286,8 +2286,10 @@ reset() { if (is_at_least_gl_version(4, 5) || has_extension("GL_ARB_direct_state_access")) { _glGenerateTextureMipmap = (PFNGLGENERATETEXTUREMIPMAPPROC) get_extension_func("glGenerateTextureMipmap"); + + _supports_dsa = true; } else { - _glGenerateTextureMipmap = nullptr; + _supports_dsa = false; } #endif @@ -2830,7 +2832,9 @@ reset() { // Check availability of anisotropic texture filtering. _supports_anisotropy = false; _max_anisotropy = 1.0; - if (has_extension("GL_EXT_texture_filter_anisotropic")) { + if (is_at_least_gl_version(4, 6) || + has_extension("GL_EXT_texture_filter_anisotropic") || + has_extension("GL_ARB_texture_filter_anisotropic")) { GLfloat max_anisotropy; glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &max_anisotropy); _max_anisotropy = (PN_stdfloat)max_anisotropy; @@ -3237,7 +3241,7 @@ reset() { if (GLCAT.is_debug()) { if (_supports_get_program_binary) { GLCAT.debug() - << "Supported shader binary formats:\n"; + << "Supported program binary formats:\n"; GLCAT.debug() << " "; pset::const_iterator it; @@ -3249,7 +3253,7 @@ reset() { } GLCAT.debug(false) << "\n"; } else { - GLCAT.debug() << "No shader binary formats supported.\n"; + GLCAT.debug() << "No program binary formats supported.\n"; } } #endif @@ -13193,7 +13197,7 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload, void CLP(GraphicsStateGuardian):: generate_mipmaps(CLP(TextureContext) *gtc) { #ifndef OPENGLES - if (_glGenerateTextureMipmap != nullptr) { + if (_supports_dsa) { // OpenGL 4.5 offers an easy way to do this without binding. _glGenerateTextureMipmap(gtc->_index); return; diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index a8cd3a2e3b..99c8296336 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -909,6 +909,7 @@ public: PFNGLBINDPROGRAMARBPROC _glBindProgram; #ifndef OPENGLES + bool _supports_dsa; PFNGLGENERATETEXTUREMIPMAPPROC _glGenerateTextureMipmap; #endif