<div dir="ltr"><div>I am having a problem with unrecoverable errors in external code, presumably generated by the video driver, crashing my programs. I cannot trap these errors with try..except blocks. Here is a capture of the assembler window with ** marking the line where the error occurs.</div><div><br></div><div><font face="monospace, monospace">  00007FFFEA79016F 4898                     cltq   </font></div><div><font face="monospace, monospace">**00007FFFEA790171 f20f5e44c430             divsd  0x30(%rsp,%rax,8),%xmm0</font></div><div><font face="monospace, monospace">  00007FFFEA790177 f20f118424f8000000       movsd  %xmm0,0xf8(%rsp)</font></div><div><font face="monospace, monospace">  00007FFFEA790180 f20f118424f0000000       movsd  %xmm0,0xf0(%rsp)</font></div><div><font face="monospace, monospace">  00007FFFEA790189 f20f118424e8000000       movsd  %xmm0,0xe8(%rsp)</font></div><div><br></div><div>In pascal code I am attempting to link a glsl program (part of OpenGL) when the uncatchable and unrecoverable error occurs.</div><div><br></div><div><div><font face="monospace, monospace"><b>function</b> TShaderProgram.Link: Boolean;</font></div><div><font face="monospace, monospace"><b>var</b></font></div><div><font face="monospace, monospace">  I: GLint;</font></div><div><font face="monospace, monospace">  S: string;</font></div><div><font face="monospace, monospace"><b>begin</b></font></div><div><font face="monospace, monospace">  <b>if</b> Flinked <b>then</b></font></div><div><font face="monospace, monospace">    Exit(False);</font></div><div><font face="monospace, monospace">  <b>if</b> FAttachCount < 2 <b>then</b></font></div><div><font face="monospace, monospace">    Exit(False);</font></div><div><font face="monospace, monospace">  FLinked := True;</font></div><div><font face="monospace, monospace">  <i><font color="#38761d">// Sometimes the uncatchable error happens here</font></i></font></div><div><font face="monospace, monospace">  glLinkProgram(FHandle);</font></div><div><font face="monospace, monospace">  glGetProgramiv(FHandle, GL_LINK_STATUS, @I);</font></div><div><font face="monospace, monospace">  FValid := I = GL_TRUE;</font></div><div><font face="monospace, monospace">  <b>if</b> <b>not</b> FValid <b>then</b></font></div><div><font face="monospace, monospace">  <b>begin</b></font></div><div><font face="monospace, monospace">    FErrorObject := Self;</font></div><div><font face="monospace, monospace">    glGetProgramiv(FHandle, GL_INFO_LOG_LENGTH, @I);</font></div><div><font face="monospace, monospace">    <b>if</b> I > 0 <b>then</b></font></div><div><font face="monospace, monospace">    <b>begin</b></font></div><div><font face="monospace, monospace">      SetLength(S, I);</font></div><div><font face="monospace, monospace">      glGetProgramInfoLog(FHandle, I, @I, PChar(S));</font></div><div><font face="monospace, monospace">    <b>end</b></font></div><div><font face="monospace, monospace">    <b>else</b></font></div><div><font face="monospace, monospace">      S := 'Unknown error';</font></div><div><font face="monospace, monospace">    FErrorString := S;</font></div><div><font face="monospace, monospace">  <b>end</b>;</font></div><div><font face="monospace, monospace"><b>end</b>;</font></div></div><div><br></div><div>In this code I am attempting to link user defined glsl vertex and fragment shaders to generate a valid glsl program object. Sometimes either the vertex or fragment shader contains bad code, but it shouldn't bring down my entire pascal application. I've written and used these same shaders in c# using mono and I've never had them crash my mono applications. Is there some setting in fpc or in lazarus to handle these types of errors in the XMM registers gracefully?</div><div><br></div><div>To give you an idea of what I am doing, here is a screen recording of made earlier of these same shader programs running without crashing my application when using mono.</div><div><br></div><div><a href="http://cache.getlazarus.org/videos/bare-csharp.mp4">http://cache.getlazarus.org/videos/bare-csharp.mp4</a><br></div><div><br></div><div><br></div><div></div></div>