mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-07-25 12:55:50 +03:00
0029020: Visualization, V3d_View - workaround image dump issue on Intel OpenGL driver
Implemented workaround for dump images with width >= 5462 pix on Intel OpenGl driver. Changes according to OpenGl_Context::myVendor field in lowercase.
This commit is contained in:
parent
521648ce02
commit
6997ff1c88
@ -21,6 +21,8 @@ enum Graphic3d_TypeOfLimit
|
|||||||
Graphic3d_TypeOfLimit_MaxNbClipPlanes, //!< maximum number of active clipping planes
|
Graphic3d_TypeOfLimit_MaxNbClipPlanes, //!< maximum number of active clipping planes
|
||||||
Graphic3d_TypeOfLimit_MaxNbViews, //!< maximum number of views
|
Graphic3d_TypeOfLimit_MaxNbViews, //!< maximum number of views
|
||||||
Graphic3d_TypeOfLimit_MaxTextureSize, //!< maximum size of texture
|
Graphic3d_TypeOfLimit_MaxTextureSize, //!< maximum size of texture
|
||||||
|
Graphic3d_TypeOfLimit_MaxViewDumpSizeX, //!< maximum width for image dump
|
||||||
|
Graphic3d_TypeOfLimit_MaxViewDumpSizeY, //!< maximum height for image dump
|
||||||
Graphic3d_TypeOfLimit_MaxCombinedTextureUnits, //!< maximum number of combined texture units for multitexturing
|
Graphic3d_TypeOfLimit_MaxCombinedTextureUnits, //!< maximum number of combined texture units for multitexturing
|
||||||
Graphic3d_TypeOfLimit_MaxMsaa, //!< maximum number of MSAA samples
|
Graphic3d_TypeOfLimit_MaxMsaa, //!< maximum number of MSAA samples
|
||||||
Graphic3d_TypeOfLimit_HasRayTracing, //!< indicates whether ray tracing is supported
|
Graphic3d_TypeOfLimit_HasRayTracing, //!< indicates whether ray tracing is supported
|
||||||
@ -29,6 +31,7 @@ enum Graphic3d_TypeOfLimit
|
|||||||
Graphic3d_TypeOfLimit_HasBlendedOit, //!< indicates whether necessary GL extensions for Weighted, Blended OIT available (without MSAA).
|
Graphic3d_TypeOfLimit_HasBlendedOit, //!< indicates whether necessary GL extensions for Weighted, Blended OIT available (without MSAA).
|
||||||
Graphic3d_TypeOfLimit_HasBlendedOitMsaa, //!< indicates whether necessary GL extensions for Weighted, Blended OIT available (with MSAA).
|
Graphic3d_TypeOfLimit_HasBlendedOitMsaa, //!< indicates whether necessary GL extensions for Weighted, Blended OIT available (with MSAA).
|
||||||
Graphic3d_TypeOfLimit_HasFlatShading, //!< indicates whether Flat shading (Graphic3d_TOSM_FACET) is supported
|
Graphic3d_TypeOfLimit_HasFlatShading, //!< indicates whether Flat shading (Graphic3d_TOSM_FACET) is supported
|
||||||
|
Graphic3d_TypeOfLimit_IsWorkaroundFBO, //!< indicates whether workaround for Intel driver problem with empty FBO for images with big width is applyed.
|
||||||
Graphic3d_TypeOfLimit_NB //!< number of elements in this enumeration
|
Graphic3d_TypeOfLimit_NB //!< number of elements in this enumeration
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -158,6 +158,8 @@ OpenGl_Context::OpenGl_Context (const Handle(OpenGl_Caps)& theCaps)
|
|||||||
myTexClamp (GL_CLAMP_TO_EDGE),
|
myTexClamp (GL_CLAMP_TO_EDGE),
|
||||||
myMaxTexDim (1024),
|
myMaxTexDim (1024),
|
||||||
myMaxTexCombined (1),
|
myMaxTexCombined (1),
|
||||||
|
myMaxDumpSizeX (1024),
|
||||||
|
myMaxDumpSizeY (1024),
|
||||||
myMaxClipPlanes (6),
|
myMaxClipPlanes (6),
|
||||||
myMaxMsaaSamples(0),
|
myMaxMsaaSamples(0),
|
||||||
myMaxDrawBuffers (1),
|
myMaxDrawBuffers (1),
|
||||||
@ -1192,6 +1194,7 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
|||||||
myMaxColorAttachments = 1;
|
myMaxColorAttachments = 1;
|
||||||
ReadGlVersion (myGlVerMajor, myGlVerMinor);
|
ReadGlVersion (myGlVerMajor, myGlVerMinor);
|
||||||
myVendor = (const char* )::glGetString (GL_VENDOR);
|
myVendor = (const char* )::glGetString (GL_VENDOR);
|
||||||
|
myVendor.LowerCase();
|
||||||
if (!caps->ffpEnable
|
if (!caps->ffpEnable
|
||||||
&& !IsGlGreaterEqual (2, 0))
|
&& !IsGlGreaterEqual (2, 0))
|
||||||
{
|
{
|
||||||
@ -1212,7 +1215,7 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
|||||||
const bool isCoreProfile = false;
|
const bool isCoreProfile = false;
|
||||||
#else
|
#else
|
||||||
|
|
||||||
if (myVendor.Search ("NVIDIA") != -1)
|
if (myVendor.Search ("nvidia") != -1)
|
||||||
{
|
{
|
||||||
// Buffer detailed info: Buffer object 1 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW)
|
// Buffer detailed info: Buffer object 1 (bound to GL_ARRAY_BUFFER_ARB, usage hint is GL_STATIC_DRAW)
|
||||||
// will use VIDEO memory as the source for buffer object operations.
|
// will use VIDEO memory as the source for buffer object operations.
|
||||||
@ -1415,7 +1418,7 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
|||||||
? OpenGl_FeatureInExtensions
|
? OpenGl_FeatureInExtensions
|
||||||
: OpenGl_FeatureNotAvailable);
|
: OpenGl_FeatureNotAvailable);
|
||||||
if (!IsGlGreaterEqual (3, 1)
|
if (!IsGlGreaterEqual (3, 1)
|
||||||
&& myVendor.Search("Qualcomm") != -1)
|
&& myVendor.Search("qualcomm") != -1)
|
||||||
{
|
{
|
||||||
// dFdx/dFdy are completely broken on tested Adreno devices with versions below OpenGl ES 3.1
|
// dFdx/dFdy are completely broken on tested Adreno devices with versions below OpenGl ES 3.1
|
||||||
hasFlatShading = OpenGl_FeatureNotAvailable;
|
hasFlatShading = OpenGl_FeatureNotAvailable;
|
||||||
@ -1472,6 +1475,16 @@ void OpenGl_Context::init (const Standard_Boolean theIsCoreProfile)
|
|||||||
glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &myMaxTexCombined);
|
glGetIntegerv (GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &myMaxTexCombined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLint aMaxVPortSize[2] = {0, 0};
|
||||||
|
glGetIntegerv (GL_MAX_VIEWPORT_DIMS, aMaxVPortSize);
|
||||||
|
myMaxDumpSizeX = Min (aMaxVPortSize[0], myMaxTexDim);
|
||||||
|
myMaxDumpSizeY = Min (aMaxVPortSize[1], myMaxTexDim);
|
||||||
|
if (myVendor == "intel")
|
||||||
|
{
|
||||||
|
// Intel drivers have known bug with empty dump for images with width>=5462
|
||||||
|
myMaxDumpSizeX = Min (myMaxDumpSizeX, 4096);
|
||||||
|
}
|
||||||
|
|
||||||
if (extAnis)
|
if (extAnis)
|
||||||
{
|
{
|
||||||
glGetIntegerv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &myAnisoMax);
|
glGetIntegerv (GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &myAnisoMax);
|
||||||
@ -2838,6 +2851,7 @@ void OpenGl_Context::DiagnosticInformation (TColStd_IndexedDataMapOfStringString
|
|||||||
if ((theFlags & Graphic3d_DiagnosticInfo_Limits) != 0)
|
if ((theFlags & Graphic3d_DiagnosticInfo_Limits) != 0)
|
||||||
{
|
{
|
||||||
addInfo (theDict, "Max texture size", TCollection_AsciiString(myMaxTexDim));
|
addInfo (theDict, "Max texture size", TCollection_AsciiString(myMaxTexDim));
|
||||||
|
addInfo (theDict, "Max FBO dump size", TCollection_AsciiString() + myMaxDumpSizeX + "x" + myMaxDumpSizeY);
|
||||||
addInfo (theDict, "Max combined texture units", TCollection_AsciiString(myMaxTexCombined));
|
addInfo (theDict, "Max combined texture units", TCollection_AsciiString(myMaxTexCombined));
|
||||||
addInfo (theDict, "Max MSAA samples", TCollection_AsciiString(myMaxMsaaSamples));
|
addInfo (theDict, "Max MSAA samples", TCollection_AsciiString(myMaxMsaaSamples));
|
||||||
}
|
}
|
||||||
|
@ -476,6 +476,12 @@ public:
|
|||||||
//! @return value for GL_MAX_SAMPLES
|
//! @return value for GL_MAX_SAMPLES
|
||||||
Standard_Integer MaxMsaaSamples() const { return myMaxMsaaSamples; }
|
Standard_Integer MaxMsaaSamples() const { return myMaxMsaaSamples; }
|
||||||
|
|
||||||
|
//! @return maximum FBO width for image dump
|
||||||
|
Standard_Integer MaxDumpSizeX() const { return myMaxDumpSizeX; }
|
||||||
|
|
||||||
|
//! @return maximum FBO height for image dump
|
||||||
|
Standard_Integer MaxDumpSizeY() const { return myMaxDumpSizeY; }
|
||||||
|
|
||||||
//! @return value for GL_MAX_DRAW_BUFFERS
|
//! @return value for GL_MAX_DRAW_BUFFERS
|
||||||
Standard_Integer MaxDrawBuffers() const { return myMaxDrawBuffers; }
|
Standard_Integer MaxDrawBuffers() const { return myMaxDrawBuffers; }
|
||||||
|
|
||||||
@ -905,6 +911,8 @@ private: // context info
|
|||||||
Standard_Integer myTexClamp; //!< either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1)
|
Standard_Integer myTexClamp; //!< either GL_CLAMP_TO_EDGE (1.2+) or GL_CLAMP (1.1)
|
||||||
Standard_Integer myMaxTexDim; //!< value for GL_MAX_TEXTURE_SIZE
|
Standard_Integer myMaxTexDim; //!< value for GL_MAX_TEXTURE_SIZE
|
||||||
Standard_Integer myMaxTexCombined; //!< value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
|
Standard_Integer myMaxTexCombined; //!< value for GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS
|
||||||
|
Standard_Integer myMaxDumpSizeX; //!< maximum FBO width for image dump
|
||||||
|
Standard_Integer myMaxDumpSizeY; //!< maximum FBO height for image dump
|
||||||
Standard_Integer myMaxClipPlanes; //!< value for GL_MAX_CLIP_PLANES
|
Standard_Integer myMaxClipPlanes; //!< value for GL_MAX_CLIP_PLANES
|
||||||
Standard_Integer myMaxMsaaSamples; //!< value for GL_MAX_SAMPLES
|
Standard_Integer myMaxMsaaSamples; //!< value for GL_MAX_SAMPLES
|
||||||
Standard_Integer myMaxDrawBuffers; //!< value for GL_MAX_DRAW_BUFFERS
|
Standard_Integer myMaxDrawBuffers; //!< value for GL_MAX_DRAW_BUFFERS
|
||||||
|
@ -417,6 +417,10 @@ Standard_Integer OpenGl_GraphicDriver::InquireLimit (const Graphic3d_TypeOfLimit
|
|||||||
return !aCtx.IsNull() ? aCtx->MaxCombinedTextureUnits() : 1;
|
return !aCtx.IsNull() ? aCtx->MaxCombinedTextureUnits() : 1;
|
||||||
case Graphic3d_TypeOfLimit_MaxMsaa:
|
case Graphic3d_TypeOfLimit_MaxMsaa:
|
||||||
return !aCtx.IsNull() ? aCtx->MaxMsaaSamples() : 0;
|
return !aCtx.IsNull() ? aCtx->MaxMsaaSamples() : 0;
|
||||||
|
case Graphic3d_TypeOfLimit_MaxViewDumpSizeX:
|
||||||
|
return !aCtx.IsNull() ? aCtx->MaxDumpSizeX() : 1024;
|
||||||
|
case Graphic3d_TypeOfLimit_MaxViewDumpSizeY:
|
||||||
|
return !aCtx.IsNull() ? aCtx->MaxDumpSizeY() : 1024;
|
||||||
case Graphic3d_TypeOfLimit_HasRayTracing:
|
case Graphic3d_TypeOfLimit_HasRayTracing:
|
||||||
return (!aCtx.IsNull() && aCtx->HasRayTracing()) ? 1 : 0;
|
return (!aCtx.IsNull() && aCtx->HasRayTracing()) ? 1 : 0;
|
||||||
case Graphic3d_TypeOfLimit_HasRayTracingTextures:
|
case Graphic3d_TypeOfLimit_HasRayTracingTextures:
|
||||||
@ -433,6 +437,8 @@ Standard_Integer OpenGl_GraphicDriver::InquireLimit (const Graphic3d_TypeOfLimit
|
|||||||
&& (InquireLimit (Graphic3d_TypeOfLimit_HasBlendedOit) == 1)) ? 1 : 0;
|
&& (InquireLimit (Graphic3d_TypeOfLimit_HasBlendedOit) == 1)) ? 1 : 0;
|
||||||
case Graphic3d_TypeOfLimit_HasFlatShading:
|
case Graphic3d_TypeOfLimit_HasFlatShading:
|
||||||
return !aCtx.IsNull() && aCtx->hasFlatShading != OpenGl_FeatureNotAvailable ? 1 : 0;
|
return !aCtx.IsNull() && aCtx->hasFlatShading != OpenGl_FeatureNotAvailable ? 1 : 0;
|
||||||
|
case Graphic3d_TypeOfLimit_IsWorkaroundFBO:
|
||||||
|
return !aCtx.IsNull() && aCtx->MaxTextureSize() != aCtx->MaxDumpSizeX() ? 1 : 0;
|
||||||
case Graphic3d_TypeOfLimit_NB:
|
case Graphic3d_TypeOfLimit_NB:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -2077,7 +2077,7 @@ Standard_Boolean OpenGl_ShaderManager::prepareStdProgramPhong (Handle(OpenGl_Sha
|
|||||||
"Warning: flat shading requires OpenGL ES 3.0+ or GL_OES_standard_derivatives extension.");
|
"Warning: flat shading requires OpenGL ES 3.0+ or GL_OES_standard_derivatives extension.");
|
||||||
}
|
}
|
||||||
else if (isFlatNormal
|
else if (isFlatNormal
|
||||||
&& myContext->Vendor().Search("Qualcomm") != -1)
|
&& myContext->Vendor().Search("qualcomm") != -1)
|
||||||
{
|
{
|
||||||
// workaround Adreno driver bug computing reversed normal using dFdx/dFdy
|
// workaround Adreno driver bug computing reversed normal using dFdx/dFdy
|
||||||
aDFdxSignReversion = "-";
|
aDFdxSignReversion = "-";
|
||||||
|
@ -2753,19 +2753,27 @@ Standard_Boolean V3d_View::ToPixMap (Image_PixMap& theImage,
|
|||||||
|
|
||||||
if (aFBOPtr.IsNull())
|
if (aFBOPtr.IsNull())
|
||||||
{
|
{
|
||||||
Standard_Integer aMaxTexSize = MyViewer->Driver()->InquireLimit (Graphic3d_TypeOfLimit_MaxTextureSize);
|
Standard_Integer aMaxTexSizeX = MyViewer->Driver()->InquireLimit (Graphic3d_TypeOfLimit_MaxViewDumpSizeX);
|
||||||
if (theParams.TileSize > aMaxTexSize)
|
Standard_Integer aMaxTexSizeY = MyViewer->Driver()->InquireLimit (Graphic3d_TypeOfLimit_MaxViewDumpSizeY);
|
||||||
|
if (theParams.TileSize > aMaxTexSizeX
|
||||||
|
|| theParams.TileSize > aMaxTexSizeY)
|
||||||
{
|
{
|
||||||
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Image dump can not be performed - specified tile size (")
|
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Image dump can not be performed - specified tile size (")
|
||||||
+ theParams.TileSize + ") exceeds hardware limits (" + aMaxTexSize + ")", Message_Fail);
|
+ theParams.TileSize + ") exceeds hardware limits (" + aMaxTexSizeX + "x" + aMaxTexSizeY + ")", Message_Fail);
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aFBOVPSize.x() > aMaxTexSize
|
if (aFBOVPSize.x() > aMaxTexSizeX
|
||||||
|| aFBOVPSize.y() > aMaxTexSize)
|
|| aFBOVPSize.y() > aMaxTexSizeY)
|
||||||
{
|
{
|
||||||
aFBOVPSize.x() = Min (aFBOVPSize.x(), aMaxTexSize);
|
if (MyViewer->Driver()->InquireLimit (Graphic3d_TypeOfLimit_IsWorkaroundFBO))
|
||||||
aFBOVPSize.y() = Min (aFBOVPSize.y(), aMaxTexSize);
|
{
|
||||||
|
Message::DefaultMessenger ()->Send (TCollection_AsciiString ("Warning, workaround for Intel driver problem with empty FBO for images with big width is applyed."), Message_Warning);
|
||||||
|
}
|
||||||
|
Message::DefaultMessenger()->Send (TCollection_AsciiString ("Info, tiling image dump is used, image size (")
|
||||||
|
+ aFBOVPSize.x() + "x" + aFBOVPSize.y() + ") exceeds hardware limits (" + aMaxTexSizeX + "x" + aMaxTexSizeY + ")", Message_Info);
|
||||||
|
aFBOVPSize.x() = Min (aFBOVPSize.x(), aMaxTexSizeX);
|
||||||
|
aFBOVPSize.y() = Min (aFBOVPSize.y(), aMaxTexSizeY);
|
||||||
isTiling = true;
|
isTiling = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
tests/bugs/vis/bug29020
Normal file
20
tests/bugs/vis/bug29020
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
puts "========"
|
||||||
|
puts "0029020: Visualization, V3d_View - workaround image dump issue on Intel OpenGL driver"
|
||||||
|
puts "========"
|
||||||
|
puts ""
|
||||||
|
|
||||||
|
pload MODELING VISUALIZATION
|
||||||
|
box b 1 1 1
|
||||||
|
vclear
|
||||||
|
vinit View1
|
||||||
|
vdisplay -dispMode 1 b
|
||||||
|
vtop
|
||||||
|
vfit
|
||||||
|
|
||||||
|
#Get max size of dumped image
|
||||||
|
set anExpression {Max texture size: (\d+)}
|
||||||
|
regexp $anExpression [vglinfo] _ match
|
||||||
|
|
||||||
|
vdump $imagedir/${casename}_max_width.png -width $match -height 100
|
||||||
|
|
||||||
|
vdump $imagedir/${casename}_max_height.png -width 100 -height $match
|
Loading…
x
Reference in New Issue
Block a user