|
From: James W. <ja...@fr...> - 2007-07-20 00:01:27
|
Jose' Cruanyes wrote: > Il giorno 24/mag/07, alle ore 00:51, James W. Walker ha scritto: > >> Update of /cvsroot/quesa/quesa/Development/Source/Renderers/Common >> In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv18759/quesa/ >> Development/Source/Renderers/Common >> >> Modified Files: >> GLDrawContext.c >> Log Message: >> In gldrawcontext_win_new, try to fail more gracefully when >> SetPixelFormat fails to change the pixel format. >> >> Index: GLDrawContext.c >> =================================================================== >> RCS file: /cvsroot/quesa/quesa/Development/Source/Renderers/Common/ >> GLDrawContext.c,v >> retrieving revision 1.63 >> retrieving revision 1.64 >> diff -C2 -d -r1.63 -r1.64 >> *** GLDrawContext.c 18 May 2007 23:47:36 -0000 1.63 >> --- GLDrawContext.c 23 May 2007 22:51:11 -0000 1.64 >> *************** >> *** 1615,1618 **** >> --- 1615,1620 ---- >> goto fail; >> >> + int prevPixelFormat = GetPixelFormat( theContext->theDC ); >> + >> if (!SetPixelFormat(theContext->theDC, pixelFormat, >> &pixelFormatDesc)) >> { >> *************** >> *** 1623,1628 **** >> E3Assert( __FILE__, __LINE__, theString ); >> #endif >> ! Q3Error_PlatformPost(error); >> ! goto fail; >> } >> >> --- 1625,1640 ---- >> E3Assert( __FILE__, __LINE__, theString ); >> #endif >> ! >> ! // The docs on SetPixelFormat say that "Once a window's pixel >> format is >> ! // set, it cannot be changed". In that case, try falling back >> to the >> ! // previous format. >> ! >> ! pixelFormat = prevPixelFormat; >> ! >> ! if ( (pixelFormat == 0) || !SetPixelFormat(theContext->theDC, >> pixelFormat, &pixelFormatDesc) ) >> ! { >> ! Q3Error_PlatformPost(error); >> ! goto fail; >> ! } >> } > > > We've found that this change (or another triggered by this) cause > crashes on certain machines, when rebuilding the drawContext... > > if we open a window, print it (creating a pixmap DC), when rebuilding > the window, quesa crashes when trying to swap buffers at the end of > the first, render loop > > the machine has an onboard SIS video adaptor, so I think it's using > the software renderer > > throwing an error if SetPixelFormat fails, solves the problem (my > program tries to rebuild the Drawcontext in the next update event and > then it works) > > any ideas? I don't know why this change would cause a problem, but if you want to revert it, I won't be upset. As I recall, I noticed a problem with SetPixelFormat when switching to shadow rendering in Geom Test. That requires a stencil buffer, where none had been requested before, hence a change in pixel format. Of course my change did not actually solve that problem. One really needs to request a stencil buffer at the beginning if there is any chance that a stencil buffer will be needed later. If you do revert the change, please leave a comment that a window's pixel format cannot be set more than once, so that the next time SetPixelFormat fails, I won't have to figure it out again. -- James W. Walker, Innoventive Software LLC <http://www.frameforge3d.com/> |