From 6dd6e5c75817b70967602b9699050ce1cf58d89d Mon Sep 17 00:00:00 2001 From: dbp Date: Wed, 16 Nov 2016 17:47:07 +0300 Subject: [PATCH] 0028115: Visualization, Ray tracing - Fix crash on NVIDIA GPUs with driver version 373.06 when window is resized --- src/OpenGl/OpenGl_View_Raytrace.cxx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/OpenGl/OpenGl_View_Raytrace.cxx b/src/OpenGl/OpenGl_View_Raytrace.cxx index 1b36a4be40..0b7a463087 100644 --- a/src/OpenGl/OpenGl_View_Raytrace.cxx +++ b/src/OpenGl/OpenGl_View_Raytrace.cxx @@ -1838,7 +1838,7 @@ Standard_Boolean OpenGl_View::updateRaytraceBuffers (const Standard_Integer const Standard_Integer theSizeY, const Handle(OpenGl_Context)& theGlContext) { - // Auxiliary buffers are not used. + // Auxiliary buffers are not used if (!myRaytraceParameters.GlobalIllumination && !myRenderParams.IsAntialiasingEnabled) { myRaytraceFBO1[0]->Release (theGlContext.operator->()); @@ -1849,6 +1849,12 @@ Standard_Boolean OpenGl_View::updateRaytraceBuffers (const Standard_Integer return Standard_True; } + if (myRaytraceFBO1[0]->GetSizeX() != theSizeX + || myRaytraceFBO1[0]->GetSizeY() != theSizeY) + { + myAccumFrames = 0; + } + myRaytraceFBO1[0]->InitLazy (theGlContext, theSizeX, theSizeY, GL_RGBA32F, myFboDepthFormat); myRaytraceFBO2[0]->InitLazy (theGlContext, theSizeX, theSizeY, GL_RGBA32F, myFboDepthFormat); @@ -1890,6 +1896,10 @@ Standard_Boolean OpenGl_View::updateRaytraceBuffers (const Standard_Integer myRaytraceOutputTexture[0]->InitRectangle (theGlContext, theSizeX * 3, theSizeY * 2, OpenGl_TextureFormat::Create()); + // workaround for some NVIDIA drivers + myRaytraceVisualErrorTexture->Release (theGlContext.operator->()); + myRaytraceTileOffsetsTexture->Release (theGlContext.operator->()); + myRaytraceVisualErrorTexture->Init (theGlContext, GL_R32I, GL_RED_INTEGER, GL_INT, myTileSampler.NbTilesX(), myTileSampler.NbTilesY(), Graphic3d_TOT_2D);