0029147: Visualization - D3DHost_FrameBuffer::BindBuffer() fails on some Intel drivers
authorkgv <kgv@opencascade.com>
Tue, 26 Sep 2017 14:41:05 +0000 (17:41 +0300)
committerbugmaster <bugmaster@opencascade.com>
Fri, 6 Oct 2017 07:28:06 +0000 (10:28 +0300)
D3DHost_FrameBuffer::BindBuffer() now implicitly detaches Depth+Stencil texture in case of driver failure.
D3DHost_View::d3dCreateRenderTarget() now does not request Depth+Stencil texture by default.

src/D3DHost/D3DHost_FrameBuffer.cxx
src/D3DHost/D3DHost_FrameBuffer.hxx
src/D3DHost/D3DHost_View.cxx
src/OpenGl/OpenGl_FrameBuffer.cxx
src/OpenGl/OpenGl_FrameBuffer.hxx

index 6dd55a9819017d2d61c4cfd8fddcda17879fc78c..9592561dfcdb9670d482a771ac3e490592d6c6f6 100644 (file)
@@ -97,11 +97,11 @@ Standard_Boolean D3DHost_FrameBuffer::Init (const Handle(OpenGl_Context)& theCtx
                                             const Standard_Integer        theSizeX,
                                             const Standard_Integer        theSizeY)
 {
-  if (InitD3dInterop (theCtx, theD3DDevice, theIsD3dEx, theSizeX, theSizeY))
+  if (InitD3dInterop (theCtx, theD3DDevice, theIsD3dEx, theSizeX, theSizeY, GL_DEPTH24_STENCIL8))
   {
     return Standard_True;
   }
-  return InitD3dFallback (theCtx, theD3DDevice, theIsD3dEx, theSizeX, theSizeY);
+  return InitD3dFallback (theCtx, theD3DDevice, theIsD3dEx, theSizeX, theSizeY, GL_DEPTH24_STENCIL8);
 }
 
 // =======================================================================
@@ -112,9 +112,10 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dFallback (const Handle(OpenGl_Conte
                                                        IDirect3DDevice9*             theD3DDevice,
                                                        const Standard_Boolean        theIsD3dEx,
                                                        const Standard_Integer        theSizeX,
-                                                       const Standard_Integer        theSizeY)
+                                                       const Standard_Integer        theSizeY,
+                                                       const GLint                   theDepthFormat)
 {
-  const Standard_Boolean isGlInit = Init (theCtx, theSizeX, theSizeY, GL_RGBA8, GL_DEPTH24_STENCIL8, 0);
+  const Standard_Boolean isGlInit = OpenGl_FrameBuffer::Init (theCtx, theSizeX, theSizeY, GL_RGBA8, theDepthFormat, 0);
   myD3dFallback = Standard_True;
 
   const Standard_Integer aSizeX = theSizeX > 0 ? theSizeX : 2;
@@ -125,7 +126,7 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dFallback (const Handle(OpenGl_Conte
   {
     Release (theCtx.operator->());
     theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
-                         TCollection_AsciiString ("D3DHost_FrameBuffer, could not D3DFMT_X8R8G8B8 render target ") + aSizeX + "x" + aSizeY);
+                         TCollection_AsciiString ("D3DHost_FrameBuffer, could not create D3DFMT_X8R8G8B8 render target ") + aSizeX + "x" + aSizeY);
     return Standard_False;
   }
   return isGlInit;
@@ -139,10 +140,12 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
                                                       IDirect3DDevice9*             theD3DDevice,
                                                       const Standard_Boolean        theIsD3dEx,
                                                       const Standard_Integer        theSizeX,
-                                                      const Standard_Integer        theSizeY)
+                                                      const Standard_Integer        theSizeY,
+                                                      const GLint                   theDepthFormat)
 {
   Release (theCtx.operator->());
 #if !defined(GL_ES_VERSION_2_0)
+  myDepthFormat = theDepthFormat;
   myVPSizeX = theSizeX;
   myVPSizeY = theSizeY;
   myInitVPSizeX = theSizeX;
@@ -167,7 +170,7 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
   {
     Release (theCtx.operator->());
     theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
-                         TCollection_AsciiString ("D3DHost_FrameBuffer, could not D3DFMT_X8R8G8B8 render target ") + aSizeX + "x" + aSizeY);
+                         TCollection_AsciiString ("D3DHost_FrameBuffer, could not create D3DFMT_X8R8G8B8 render target ") + aSizeX + "x" + aSizeY);
     return Standard_False;
   }
 
@@ -189,9 +192,13 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
   myIsOwnBuffer = true;
   myIsOwnDepth  = true;
   theCtx->arbFBO->glGenFramebuffers (1, &myGlFBufferId);
-  if (!myDepthStencilTexture->Init (theCtx, GL_DEPTH24_STENCIL8,
-                                    GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8,
-                                    aSizeX, aSizeY, Graphic3d_TOT_2D))
+
+  GLenum aPixelFormat = 0, aDataType = 0;
+  if (myDepthFormat != 0
+  &&  getDepthDataFormat (myDepthFormat, aPixelFormat, aDataType)
+  && !myDepthStencilTexture->Init (theCtx, myDepthFormat,
+                                   aPixelFormat, aDataType,
+                                   aSizeX, aSizeY, Graphic3d_TOT_2D))
   {
     Release (theCtx.operator->());
     theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
@@ -206,6 +213,7 @@ Standard_Boolean D3DHost_FrameBuffer::InitD3dInterop (const Handle(OpenGl_Contex
   (void )theIsD3dEx;
   (void )theSizeX;
   (void )theSizeY;
+  (void )theDepthFormat;
   return Standard_False;
 #endif
 }
@@ -247,6 +255,7 @@ Standard_Boolean D3DHost_FrameBuffer::registerD3dBuffer (const Handle(OpenGl_Con
                                                myColorTextures (0)->TextureId(),
                                                GL_TEXTURE_2D,
                                                WGL_ACCESS_WRITE_DISCARD_NV);
+  theCtx->ResetErrors (true);
   if (myGlD3dSurf == NULL)
   {
     theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
@@ -278,20 +287,54 @@ void D3DHost_FrameBuffer::BindBuffer (const Handle(OpenGl_Context)& theCtx)
 
   theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
                                           myColorTextures (0)->GetTarget(), myColorTextures (0)->TextureId(), 0);
-#ifdef GL_DEPTH_STENCIL_ATTACHMENT
-  theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT,
-                                          myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
-#else
-  theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
-                                          myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
-  theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
-                                          myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
-#endif
+
+  GLenum aDepthPixelFormat = 0, aDepthDataType = 0;
+  getDepthDataFormat (myDepthFormat, aDepthPixelFormat, aDepthDataType);
+  if (myDepthStencilTexture->IsValid())
+  {
+  #ifdef GL_DEPTH_STENCIL_ATTACHMENT
+    theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthPixelFormat == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
+                                            myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
+  #else
+    theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+                                            myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
+    if (aDepthPixelFormat == GL_DEPTH_STENCIL)
+    {
+      theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+                                              myDepthStencilTexture->GetTarget(), myDepthStencilTexture->TextureId(), 0);
+    }
+  #endif
+  }
   if (theCtx->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
   {
-    theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
-                         "D3DHost_FrameBuffer, OpenGL FBO is incomplete!");
-    Release (theCtx.operator->());
+    if (myDepthStencilTexture->IsValid())
+    {
+    #ifdef GL_DEPTH_STENCIL_ATTACHMENT
+      theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, aDepthPixelFormat == GL_DEPTH_STENCIL ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT,
+                                              myDepthStencilTexture->GetTarget(), 0, 0);
+    #else
+      theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
+                                              myDepthStencilTexture->GetTarget(), 0, 0);
+      if (aDepthPixelFormat == GL_DEPTH_STENCIL)
+      {
+        theCtx->arbFBO->glFramebufferTexture2D (GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
+                                                myDepthStencilTexture->GetTarget(), 0, 0);
+      }
+    #endif
+    }
+    if (theCtx->arbFBO->glCheckFramebufferStatus (GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
+    {
+      theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_ERROR, 0, GL_DEBUG_SEVERITY_HIGH,
+                           "D3DHost_FrameBuffer, OpenGL FBO is incomplete!");
+      Release (theCtx.operator->());
+    }
+    else
+    {
+      myDepthFormat = 0;
+      myDepthStencilTexture->Release (theCtx.get());
+      theCtx->PushMessage (GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_PORTABILITY, 0, GL_DEBUG_SEVERITY_HIGH,
+                           "D3DHost_FrameBuffer, OpenGL FBO is created without Depth+Stencil attachements!");
+    }
   }
 }
 
index ecfabc1b546d68abcef609531c528cc913d0be12..45234016a5fd59541fb8a84ceed8c750af2d8fbf 100644 (file)
@@ -36,6 +36,13 @@ public:
   Standard_EXPORT virtual void Release (OpenGl_Context* theCtx) Standard_OVERRIDE;
 
   //! Initializes OpenGL FBO for Direct3D interoperability or in fallback mode.
+  //! Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA; depth-stencil pixel format is GL_DEPTH24_STENCIL8.
+  //! @param theGlCtx       currently bound OpenGL context
+  //! @param theD3DDevice   d3d9 device
+  //! @param theIsD3dEx     d3d9 extended flag (for creating shared texture resource)
+  //! @param theSizeX       texture width
+  //! @param theSizeY       texture height
+  //! @return true on success
   Standard_EXPORT Standard_Boolean Init (const Handle(OpenGl_Context)& theCtx,
                                          IDirect3DDevice9*             theD3DDevice,
                                          const Standard_Boolean        theIsD3dEx,
@@ -43,18 +50,36 @@ public:
                                          const Standard_Integer        theSizeY);
 
   //! Initializes OpenGL FBO for Direct3D interoperability.
+  //! Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA.
+  //! @param theGlCtx       currently bound OpenGL context
+  //! @param theD3DDevice   d3d9 device
+  //! @param theIsD3dEx     d3d9 extended flag (for creating shared texture resource)
+  //! @param theSizeX       texture width
+  //! @param theSizeY       texture height
+  //! @param theDepthFormat depth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
+  //! @return true on success
   Standard_EXPORT Standard_Boolean InitD3dInterop (const Handle(OpenGl_Context)& theCtx,
                                                    IDirect3DDevice9*             theD3DDevice,
                                                    const Standard_Boolean        theIsD3dEx,
                                                    const Standard_Integer        theSizeX,
-                                                   const Standard_Integer        theSizeY);
+                                                   const Standard_Integer        theSizeY,
+                                                   const GLint                   theDepthFormat);
 
   //! Initializes OpenGL FBO + Direct3D surface for copying memory using fallback.
+  //! Color pixel format is always GL_RGBA8/D3DFMT_X8R8G8B8, no MSAA.
+  //! @param theGlCtx       currently bound OpenGL context
+  //! @param theD3DDevice   d3d9 device
+  //! @param theIsD3dEx     d3d9 extended flag (for creating shared texture resource)
+  //! @param theSizeX       texture width
+  //! @param theSizeY       texture height
+  //! @param theDepthFormat depth-stencil texture sized format (0 means no depth attachment), e.g. GL_DEPTH24_STENCIL8
+  //! @return true on success
   Standard_EXPORT Standard_Boolean InitD3dFallback (const Handle(OpenGl_Context)& theCtx,
                                                     IDirect3DDevice9*             theD3DDevice,
                                                     const Standard_Boolean        theIsD3dEx,
                                                     const Standard_Integer        theSizeX,
-                                                    const Standard_Integer        theSizeY);
+                                                    const Standard_Integer        theSizeY,
+                                                    const GLint                   theDepthFormat);
 
   //! Binds Direct3D color buffer to OpenGL texture.
   Standard_EXPORT Standard_Boolean registerD3dBuffer (const Handle(OpenGl_Context)& theCtx);
index f540526eba1548ed4d0a779b0edff56cc6f22656..6b9f76baea3431e00d6ab37c7f8aec040086c65e 100644 (file)
@@ -242,7 +242,8 @@ bool D3DHost_View::d3dCreateRenderTarget()
                                                   myD3dDevice,
                                                   myIsD3dEx,
                                                   myWindow->Width(),
-                                                  myWindow->Height());
+                                                  myWindow->Height(),
+                                                  0); // do not request depth-stencil attachment since buffer will be flipped using addition FBO (myToFlipOutput)
   }
   if (toD3dFallback)
   {
@@ -250,7 +251,8 @@ bool D3DHost_View::d3dCreateRenderTarget()
                                        myD3dDevice,
                                        myIsD3dEx,
                                        myWindow->Width(),
-                                       myWindow->Height()))
+                                       myWindow->Height(),
+                                       GL_DEPTH24_STENCIL8))
     {
       return false;
     }
index 4be39d91478d0675fe4aa74993bef9fd11f25f16..7f301c902ad0fcb8aa79c988977e5754c1834a50 100644 (file)
@@ -23,129 +23,134 @@ IMPLEMENT_STANDARD_RTTIEXT(OpenGl_FrameBuffer,OpenGl_Resource)
 
 namespace
 {
+  //! Checks whether two format arrays are equal or not.
+  static bool operator== (const OpenGl_ColorFormats& theFmt1,
+                          const OpenGl_ColorFormats& theFmt2)
+  {
+    if (theFmt1.Length() != theFmt2.Length())
+      return false;
+    OpenGl_ColorFormats::Iterator anIt1 (theFmt1);
+    OpenGl_ColorFormats::Iterator anIt2 (theFmt1);
+    for (; anIt1.More(); anIt1.Next(), anIt2.Next())
+    {
+      if (anIt1.Value() != anIt2.Value())
+        return false;
+    }
+    return true;
+  }
+}
 
-  //! Determine data type from texture sized format.
-  static bool getDepthDataFormat (GLint   theTextFormat,
-                                  GLenum& thePixelFormat,
-                                  GLenum& theDataType)
+// =======================================================================
+// function : getDepthDataFormat
+// purpose  :
+// =======================================================================
+bool OpenGl_FrameBuffer::getDepthDataFormat (GLint   theTextFormat,
+                                             GLenum& thePixelFormat,
+                                             GLenum& theDataType)
+{
+  switch (theTextFormat)
   {
-    switch (theTextFormat)
+    case GL_DEPTH24_STENCIL8:
     {
-      case GL_DEPTH24_STENCIL8:
-      {
-        thePixelFormat = GL_DEPTH_STENCIL;
-        theDataType    = GL_UNSIGNED_INT_24_8;
-        return true;
-      }
-      case GL_DEPTH32F_STENCIL8:
-      {
-        thePixelFormat = GL_DEPTH_STENCIL;
-        theDataType    = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
-        return true;
-      }
-      case GL_DEPTH_COMPONENT16:
-      {
-        thePixelFormat = GL_DEPTH_COMPONENT;
-        theDataType    = GL_UNSIGNED_SHORT;
-        return true;
-      }
-      case GL_DEPTH_COMPONENT24:
-      {
-        thePixelFormat = GL_DEPTH_COMPONENT;
-        theDataType    = GL_UNSIGNED_INT;
-        return true;
-      }
-      case GL_DEPTH_COMPONENT32F:
-      {
-        thePixelFormat = GL_DEPTH_COMPONENT;
-        theDataType    = GL_FLOAT;
-        return true;
-      }
+      thePixelFormat = GL_DEPTH_STENCIL;
+      theDataType    = GL_UNSIGNED_INT_24_8;
+      return true;
+    }
+    case GL_DEPTH32F_STENCIL8:
+    {
+      thePixelFormat = GL_DEPTH_STENCIL;
+      theDataType    = GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
+      return true;
+    }
+    case GL_DEPTH_COMPONENT16:
+    {
+      thePixelFormat = GL_DEPTH_COMPONENT;
+      theDataType    = GL_UNSIGNED_SHORT;
+      return true;
+    }
+    case GL_DEPTH_COMPONENT24:
+    {
+      thePixelFormat = GL_DEPTH_COMPONENT;
+      theDataType    = GL_UNSIGNED_INT;
+      return true;
+    }
+    case GL_DEPTH_COMPONENT32F:
+    {
+      thePixelFormat = GL_DEPTH_COMPONENT;
+      theDataType    = GL_FLOAT;
+      return true;
     }
-    return false;
   }
+  return false;
+}
 
-  //! Determine data type from texture sized format.
-  static bool getColorDataFormat (const Handle(OpenGl_Context)& theGlContext,
-                                  GLint   theTextFormat,
-                                  GLenum& thePixelFormat,
-                                  GLenum& theDataType)
+// =======================================================================
+// function : getColorDataFormat
+// purpose  :
+// =======================================================================
+bool OpenGl_FrameBuffer::getColorDataFormat (const Handle(OpenGl_Context)& theGlContext,
+                                             GLint   theTextFormat,
+                                             GLenum& thePixelFormat,
+                                             GLenum& theDataType)
+{
+  switch (theTextFormat)
   {
-    switch (theTextFormat)
+    case GL_RGBA32F:
     {
-      case GL_RGBA32F:
-      {
-        thePixelFormat = GL_RGBA;
-        theDataType    = GL_FLOAT;
-        return true;
-      }
-      case GL_R32F:
-      {
-        thePixelFormat = GL_RED;
-        theDataType    = GL_FLOAT;
-        return true;
-      }
-      case GL_RGBA16F:
-      {
-        thePixelFormat = GL_RGBA;
-        theDataType    = GL_HALF_FLOAT;
-        if (theGlContext->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
-        {
-        #if defined(GL_ES_VERSION_2_0)
-          theDataType = GL_HALF_FLOAT_OES;
-        #else
-          theDataType = GL_FLOAT;
-        #endif
-        }
-        return true;
-      }
-      case GL_R16F:
-      {
-        thePixelFormat = GL_RED;
-        theDataType    = GL_HALF_FLOAT;
-        if (theGlContext->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
-        {
-        #if defined(GL_ES_VERSION_2_0)
-          theDataType = GL_HALF_FLOAT_OES;
-        #else
-          theDataType = GL_FLOAT;
-        #endif
-        }
-        return true;
-      }
-      case GL_RGBA8:
-      case GL_RGBA:
+      thePixelFormat = GL_RGBA;
+      theDataType    = GL_FLOAT;
+      return true;
+    }
+    case GL_R32F:
+    {
+      thePixelFormat = GL_RED;
+      theDataType    = GL_FLOAT;
+      return true;
+    }
+    case GL_RGBA16F:
+    {
+      thePixelFormat = GL_RGBA;
+      theDataType    = GL_HALF_FLOAT;
+      if (theGlContext->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
       {
-        thePixelFormat = GL_RGBA;
-        theDataType    = GL_UNSIGNED_BYTE;
-        return true;
+      #if defined(GL_ES_VERSION_2_0)
+        theDataType = GL_HALF_FLOAT_OES;
+      #else
+        theDataType = GL_FLOAT;
+      #endif
       }
-      case GL_RGB8:
-      case GL_RGB:
+      return true;
+    }
+    case GL_R16F:
+    {
+      thePixelFormat = GL_RED;
+      theDataType    = GL_HALF_FLOAT;
+      if (theGlContext->hasHalfFloatBuffer == OpenGl_FeatureInExtensions)
       {
-        thePixelFormat = GL_RGB;
-        theDataType = GL_UNSIGNED_BYTE;
-        return true;
+      #if defined(GL_ES_VERSION_2_0)
+        theDataType = GL_HALF_FLOAT_OES;
+      #else
+        theDataType = GL_FLOAT;
+      #endif
       }
+      return true;
     }
-    return false;
-  }
-
-  //! Checks whether two format arrays are equal or not.
-  static bool operator== (const OpenGl_ColorFormats& theFmt1,
-                          const OpenGl_ColorFormats& theFmt2)
-  {
-    if (theFmt1.Length() != theFmt2.Length())
-      return false;
-    OpenGl_ColorFormats::Iterator anIt1 (theFmt1);
-    OpenGl_ColorFormats::Iterator anIt2 (theFmt1);
-    for (; anIt1.More(); anIt1.Next(), anIt2.Next())
+    case GL_RGBA8:
+    case GL_RGBA:
     {
-      if (anIt1.Value() != anIt2.Value())
-        return false;
+      thePixelFormat = GL_RGBA;
+      theDataType    = GL_UNSIGNED_BYTE;
+      return true;
+    }
+    case GL_RGB8:
+    case GL_RGB:
+    {
+      thePixelFormat = GL_RGB;
+      theDataType = GL_UNSIGNED_BYTE;
+      return true;
     }
-    return true;
   }
+  return false;
 }
 
 // =======================================================================
index 9e01ab922b9de9d03473a25da8478f447725bc22..254c87d63640a729ffde239c674e242bd315f12d 100644 (file)
@@ -266,6 +266,19 @@ protected:
     return myGlFBufferId != NO_FRAMEBUFFER;
   }
 
+protected:
+
+  //! Determine data type from texture sized format.
+  Standard_EXPORT static bool getDepthDataFormat (GLint   theTextFormat,
+                                                  GLenum& thePixelFormat,
+                                                  GLenum& theDataType);
+
+  //! Determine data type from texture sized format.
+  Standard_EXPORT static bool getColorDataFormat (const Handle(OpenGl_Context)& theCtx,
+                                                  GLint   theTextFormat,
+                                                  GLenum& thePixelFormat,
+                                                  GLenum& theDataType);
+
 protected:
 
   typedef NCollection_Vector<Handle(OpenGl_Texture)> OpenGl_TextureArray;