[BUG] Problem with D3D9RenderSystem::_setViewport

Minor issues with the Ogre API that can be trivial to fix
Post Reply
Icedev
Gnoblar
Posts: 8
Joined: Thu Sep 22, 2011 10:31 am

[BUG] Problem with D3D9RenderSystem::_setViewport

Post by Icedev »

Hello,

We came accross another problem with the Direct3D9 renderer. In a multi-monitors setup, if our application is started directly on the second screen, an exception is raised in D3D9RenderSystem::_beginFrame. We backtracked the problem to D3D9RenderSystem::_setViewport. When this function is called, the member D3D9RenderSystem::mActiveViewport is assigned first with the Viewport parameter, then D3D9RenderSystem::_setRenderTarget is called. However, this can lead to D3D9RenderSystem::mActiveViewport being set to NULL if the devices are different in D3D9DeviceManager::setActiveDevice. Oddly enough, D3D9RenderSystem::_setViewport proceeds to create a D3DVIEWPORT9 from its Viewport parameter. We tried the "naive" fix consisting in moving the affectation of D3D9RenderSystem::mActiveViewport after the call to D3D9RenderSystem::_setRenderTarget. It fixed the exception, of course, and the engine seems to work fine so far. However, we don't know what kind of side effects this can have so we'll hold submitting a patch for now.

Best regards,

Nicolas GIROD -- Ice Development.

EDIT: We found a side effect. As we suspected, the "naive" fix is not enough.
Post Reply