[BUG] acquireRenderWindowResources : additional swap chain

Minor issues with the Ogre API that can be trivial to fix
Post Reply
User avatar
jycorbel
Gnoblar
Posts: 8
Joined: Tue Feb 14, 2012 11:11 am

[BUG] acquireRenderWindowResources : additional swap chain

Post by jycorbel »

Hello,

We're experiencing a crash with Ogre when trying to create render windows on a tablet PC (model is TEGATECH P10T).
Here's the OgreLog message :
17:26:26: OGRE EXCEPTION(3:RenderingAPIException): Unable to create an additional swap chain in D3D9RenderWindow::acquireRenderWindowResources at .\RenderSystems\Direct3D9\src\OgreD3D9Device.cpp (line 1026)
I notice that sometimes the CreateRenderWindows is failing because of the acquireRenderWindowResources() function.
We had a crash that we fixed : the function CreateAdditionalSwapChain() can fail because of invalid param. In this case none of the two consecutive calls will work.

I found that the problem is in OgreD3D9RenderSystem.cpp. Ogre tries to guess the multisampletype by testing the best value (function determineFSAASettings). In the worst case, ie when even D3DMULTISAMPLE_2_SAMPLES cannot be supported by the device the function exits without setting the out parameters value :

Code: Select all

					if (fsaa == 1)
					{
						// ran out of options, no FSAA
						fsaa = 0;
						ok = true;
					}
That code suppose that last test (D3DMULTISAMPLE_2_SAMPLES) is supported when it's not. I made the following change to fix the issue. I use it our project and that fix our problem. We post here to submit our fix and get feedback relative to the change.

Code: Select all

					if (fsaa == 1)
					{
						// ran out of options, no FSAA
						fsaa = 0;
						// JYC BEGIN 03/07/2012 : update out parameters !
						// Not that we could ASSERT on SUCCEEDED( mpD3D->CheckDeviceMultiSampleType(...) );
						*outMultisampleType		= D3DMULTISAMPLE_NONE;
						*outMultisampleQuality	= 0;
						// JYC END 03/07/2012
						ok = true;
					}
Regards,
Jean-Yves CORBEL
Developper at Ice-Dev.
Post Reply