0032533: Visualization, TKOpenGl - suppress error reported on Intel drivers due to...
authorkgv <kgv@opencascade.com>
Thu, 12 Aug 2021 12:50:16 +0000 (15:50 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 12 Aug 2021 16:15:44 +0000 (19:15 +0300)
OpenGl_GlCore45 - removed a couple of FFP-related functions introduced by OpenGL 4.5 Compatible Profile, but not Core Profile.

OpenGl_GlFunctions::load() now tries to load a set of functions
from GL_ARB_robustness extension (having ARB suffix) to fill OpenGL 4.5 function table,
and from GL_ARB_indirect_parameters extension to fill missing items in OpenGL 4.6 function table on Intel drivers.
Warning message (trace level) is now reported instead of error in case of fallback usage.

src/OpenGl/OpenGl_GlCore45.hxx
src/OpenGl/OpenGl_GlFunctions.cxx
src/OpenGl/OpenGl_GlFunctions.hxx

index f9e3c55..804dde3 100644 (file)
@@ -134,18 +134,6 @@ public: //! @name OpenGL 4.5 additives to 4.4
   using theBaseClass_t::glGetnUniformiv;
   using theBaseClass_t::glGetnUniformuiv;
   using theBaseClass_t::glReadnPixels;
-  using theBaseClass_t::glGetnMapdv;
-  using theBaseClass_t::glGetnMapfv;
-  using theBaseClass_t::glGetnMapiv;
-  using theBaseClass_t::glGetnPixelMapfv;
-  using theBaseClass_t::glGetnPixelMapuiv;
-  using theBaseClass_t::glGetnPixelMapusv;
-  using theBaseClass_t::glGetnPolygonStipple;
-  using theBaseClass_t::glGetnColorTable;
-  using theBaseClass_t::glGetnConvolutionFilter;
-  using theBaseClass_t::glGetnSeparableFilter;
-  using theBaseClass_t::glGetnHistogram;
-  using theBaseClass_t::glGetnMinmax;
   using theBaseClass_t::glTextureBarrier;
 #endif
 
index a66a35d..0ee1aef 100644 (file)
@@ -1505,26 +1505,30 @@ void OpenGl_GlFunctions::load (OpenGl_Context& theCtx,
        && FindProcShort (glGetTextureSubImage)
        && FindProcShort (glGetCompressedTextureSubImage)
        && FindProcShort (glGetGraphicsResetStatus)
-       && FindProcShort (glGetnCompressedTexImage)
-       && FindProcShort (glGetnTexImage)
-       && FindProcShort (glGetnUniformdv)
        && FindProcShort (glGetnUniformfv)
        && FindProcShort (glGetnUniformiv)
        && FindProcShort (glGetnUniformuiv)
        && FindProcShort (glReadnPixels)
-       && FindProcShort (glGetnMapdv)
-       && FindProcShort (glGetnMapfv)
-       && FindProcShort (glGetnMapiv)
-       && FindProcShort (glGetnPixelMapfv)
-       && FindProcShort (glGetnPixelMapuiv)
-       && FindProcShort (glGetnPixelMapusv)
-       && FindProcShort (glGetnPolygonStipple)
-       && FindProcShort (glGetnColorTable)
-       && FindProcShort (glGetnConvolutionFilter)
-       && FindProcShort (glGetnSeparableFilter)
-       && FindProcShort (glGetnHistogram)
-       && FindProcShort (glGetnMinmax)
        && FindProcShort (glTextureBarrier);
+  bool hasGetnTexImage = has45
+                      && FindProcShort (glGetnCompressedTexImage)
+                      && FindProcShort (glGetnTexImage)
+                      && FindProcShort (glGetnUniformdv);
+  if (has45 && !hasGetnTexImage)
+  {
+    // Intel driver exports only ARB-suffixed functions in a violation to OpenGL 4.5 specs
+    hasGetnTexImage = checkExtensionShort ("GL_ARB_robustness")
+                   && theCtx.FindProc ("glGetnCompressedTexImageARB", this->glGetnCompressedTexImage)
+                   && theCtx.FindProc ("glGetnTexImageARB",           this->glGetnTexImage)
+                   && theCtx.FindProc ("glGetnUniformdvARB",          this->glGetnUniformdv);
+    has45 = hasGetnTexImage;
+    if (hasGetnTexImage)
+    {
+      Message::SendTrace() << "Warning! glGetnCompressedTexImage function required by OpenGL 4.5 specs is not found.\n"
+                              "A non-standard glGetnCompressedTexImageARB fallback will be used instead.\n"
+                              "Please report this issue to OpenGL driver vendor '" << theCtx.myVendor << "'.";
+    }
+  }
   if (has45)
   {
     theCtx.core45 = (OpenGl_GlCore45* )this;
@@ -1537,9 +1541,26 @@ void OpenGl_GlFunctions::load (OpenGl_Context& theCtx,
 
   has46 = isGlGreaterEqualShort (4, 6)
        && FindProcShort (glSpecializeShader)
-       && FindProcShort (glMultiDrawArraysIndirectCount)
-       && FindProcShort (glMultiDrawElementsIndirectCount)
        && FindProcShort (glPolygonOffsetClamp);
+
+  bool hasIndParams = has46
+                   && FindProcShort (glMultiDrawArraysIndirectCount)
+                   && FindProcShort (glMultiDrawElementsIndirectCount);
+  if (has46 && !hasIndParams)
+  {
+    // Intel driver exports only ARB-suffixed functions in a violation to OpenGL 4.6 specs
+    hasIndParams = checkExtensionShort ("GL_ARB_indirect_parameters")
+                && theCtx.FindProc ("glMultiDrawArraysIndirectCountARB",   this->glMultiDrawArraysIndirectCount)
+                && theCtx.FindProc ("glMultiDrawElementsIndirectCountARB", this->glMultiDrawElementsIndirectCount);
+    has46 = hasIndParams;
+    if (hasIndParams)
+    {
+      Message::SendTrace() << "Warning! glMultiDrawArraysIndirectCount function required by OpenGL 4.6 specs is not found.\n"
+                              "A non-standard glMultiDrawArraysIndirectCountARB fallback will be used instead.\n"
+                              "Please report this issue to OpenGL driver vendor '" << theCtx.myVendor << "'.";
+    }
+  }
+
   if (has46)
   {
     theCtx.core46 = (OpenGl_GlCore46* )this;
index a8be687..adbe897 100644 (file)
@@ -1693,18 +1693,6 @@ public: //! @name OpenGL 4.5
   PFNGLGETNUNIFORMIVPROC glGetnUniformiv;
   PFNGLGETNUNIFORMUIVPROC glGetnUniformuiv;
   PFNGLREADNPIXELSPROC glReadnPixels;
-  PFNGLGETNMAPDVPROC glGetnMapdv;
-  PFNGLGETNMAPFVPROC glGetnMapfv;
-  PFNGLGETNMAPIVPROC glGetnMapiv;
-  PFNGLGETNPIXELMAPFVPROC  glGetnPixelMapfv;
-  PFNGLGETNPIXELMAPUIVPROC glGetnPixelMapuiv;
-  PFNGLGETNPIXELMAPUSVPROC glGetnPixelMapusv;
-  PFNGLGETNPOLYGONSTIPPLEPROC glGetnPolygonStipple;
-  PFNGLGETNCOLORTABLEPROC glGetnColorTable;
-  PFNGLGETNCONVOLUTIONFILTERPROC glGetnConvolutionFilter;
-  PFNGLGETNSEPARABLEFILTERPROC glGetnSeparableFilter;
-  PFNGLGETNHISTOGRAMPROC glGetnHistogram;
-  PFNGLGETNMINMAXPROC glGetnMinmax;
   PFNGLTEXTUREBARRIERPROC glTextureBarrier;
 
 public: //! @name OpenGL 4.6