BUG: DX9 Active Render Target not set

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
Van
Hobgoblin
Posts: 512
Joined: Fri Nov 19, 2004 3:56 am
Contact:

BUG: DX9 Active Render Target not set

Post by Van »

Ogre: 1.6.4 SVN branch
CEGUI 0.7.1 SVN Branch
MSVS 9.0+
DirectX August 2009 SDK

Symptom:
I think there is a bug in the D3D9RenderSystem or related system. I can reproduce it every time.
When starting Ogre in WINDOW mode (i.e. not full screen) and the render window does NOT remain as the foreground task you get a NULL pointer exception.

The error occurs here:

Line 2284 in function D3D9RenderSystem::_setCullingMode()

Code: Select all

bool flip = ((mActiveRenderTarget->requiresTextureFlipping() && !mInvertVertexWinding) ||
	(!mActiveRenderTarget->requiresTextureFlipping() && mInvertVertexWinding));
mActiveRenderTarget is NULL.

How to reproduce:

1. Start Ogre
2. Select DirectX 9 Renderer
3. Full Screen = NO

After pressing the OK button, quickly switch tasks. You want to do this prior to calling Ogre::Root::startRendering(). The error should occur.
Stop Global Whining.

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: BUG: DX9 Active Render Target not set

Post by sinbad »

mActiveRenderTarget is set as part of D3D9RenderSystem::_setRenderTarget and is only NULL when first instantiated or after RenderSystem::detachRenderTarget. Stack trace please, I cannot see how you could possibly got to _setCullingMode without going through that first, unless you're calling it yourself.

Van
Hobgoblin
Posts: 512
Joined: Fri Nov 19, 2004 3:56 am
Contact:

Re: BUG: DX9 Active Render Target not set

Post by Van »

Stack Trace

Code: Select all

>	RenderSystem_Direct3D9_d.dll!Ogre::D3D9RenderSystem::_setCullingMode(Ogre::CullingMode mode=CULL_NONE)  Line 2285 + 0xc bytes	C++
 	CEGUIOgreRenderer_d.dll!6b848283() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for CEGUIOgreRenderer_d.dll]	
 	CEGUIBase_d.dll!5a04755a() 	
 	CEGUIOgreRenderer_d.dll!6b8494d7() 	
 	OgreMain_d.dll!10f96f87() 	
 	OgreMain_d.dll!10f975b2() 	
 	OgreMain_d.dll!10f9a4de() 	
 	OgreMain_d.dll!10f97bee() 	
 	OgreMain_d.dll!10f97b5a() 	
 	SceneViewer.exe!clsApplication::Main(char * szOptions=0x0025f564)  Line 134 + 0x11 bytes	C++
 	SceneViewer.exe!WinMain(HINSTANCE__ * hInst=0x01350000, HINSTANCE__ * __formal=0x00000000, char * strCmdLine=0x00505abc, HINSTANCE__ * __formal=0x00000000)  Line 30 + 0x12 bytes	C++
 	SceneViewer.exe!__tmainCRTStartup()  Line 574 + 0x35 bytes	C
 	SceneViewer.exe!WinMainCRTStartup()  Line 399	C
 	kernel32.dll!7575eccb() 	
 	ntdll.dll!775cd24d() 	
 	ntdll.dll!775cd45f() 	
Autos

Code: Select all

		flip	true	bool
		hr	-858993460	HRESULT
+		mActiveRenderTarget	0x00000000 {mName={...} mPriority=??? mWidth=??? ...}	Ogre::RenderTarget *
		mCullingMode	CULL_NONE	Ogre::CullingMode
		mInvertVertexWinding	false	bool
		mode	CULL_NONE	Ogre::CullingMode
-		this	0x010e3aa8 {mpD3D=0x02c607e0 mpD3DDevice=0x02c8dde0 mOptions=[8](("Allow NVPerfHUD",{name="Allow NVPerfHUD" currentValue="No" possibleValues=[2]("Yes","No") ...}),("Anti aliasing",{name="Anti aliasing" currentValue="None" possibleValues=[7]("None","NonMaskable 1","NonMaskable 2","NonMaskable 3","NonMaskable 4","Level 2","Level 4") ...}),...,...) ...}	Ogre::D3D9RenderSystem * const
+		Ogre::RenderSystem	{mRenderTargets=[1](("Origins Scene Viewer - Evil MasterMinds, Inc. - Client V1.00.00",0x010e5958 {mInstance=0x02e40000 mDriver=0x0041e998 mHWnd=0x0005107e ...})) mPrioritisedRenderTargets=[1](...) mActiveRenderTarget=0x00000000 ...}	Ogre::RenderSystem
+		mpD3D	0x02c607e0	IDirect3D9 *
+		mpD3DDevice	0x02c8dde0	IDirect3DDevice9 *
+		mOptions	[8](("Allow NVPerfHUD",{name="Allow NVPerfHUD" currentValue="No" possibleValues=[2]("Yes","No") ...}),("Anti aliasing",{name="Anti aliasing" currentValue="None" possibleValues=[7]("None","NonMaskable 1","NonMaskable 2","NonMaskable 3","NonMaskable 4","Level 2","Level 4") ...}),...,("Full Screen",{name="Full Screen" currentValue="No" possibleValues=[2]("Yes","No") ...}),...,...)	std::map<std::basic_string<char,std::char_traits<char>,std::allocator<char> >,Ogre::_ConfigOption,std::less<std::basic_string<char,std::char_traits<char>,std::allocator<char> > >,std::allocator<std::pair<std::basic_string<char,std::char_traits<char>,std::allocator<char> > const ,Ogre::_ConfigOption> > >
		mFSAAType	D3DMULTISAMPLE_NONE	_D3DMULTISAMPLE_TYPE
		mFSAAQuality	0	unsigned long
+		mhInstance	0x02e40000 {unused=9460301 }	HINSTANCE__ *
+		mDriverList	0x004207e8 {mDriverList=[2]({mpD3D=0x02c607e0 mpD3DDevice=0x02c8dde0 mAdapterNumber=0 ...},{mpD3D=0x02c607e0 mpD3DDevice=0x00000000 mAdapterNumber=1 ...}) mpD3D=0x02c607e0 }	Ogre::D3D9DriverList *
+		mActiveD3DDriver	0x0041e998 {mpD3D=0x02c607e0 mpD3DDevice=0x02c8dde0 mAdapterNumber=0 ...}	Ogre::D3D9Driver *
+		mCaps	{DeviceType=D3DDEVTYPE_HAL AdapterOrdinal=0 Caps=131072 ...}	_D3DCAPS9
		mUseNVPerfHUD	false	bool
		mPerStageConstantSupport	false	bool
+		mTexStageDesc	0x010e3f6c {texType=D3D_TEX_TYPE_NORMAL coordIndex=0 autoTexCoordType=TEXCALC_NONE ...}	Ogre::D3D9RenderSystem::sD3DTextureStageDesc [16]
+		mLights	0x010e40ec	Ogre::Light * [8]
+		mHardwareBufferManager	0x00426128 {mlpD3DDevice=0x02c8dde0 }	Ogre::D3D9HardwareBufferManager *
+		mGpuProgramManager	0x010e5d68 {mpDevice=0x02c8dde0 }	Ogre::D3D9GpuProgramManager *
+		mHLSLProgramFactory	0x010e3a80	Ogre::D3D9HLSLProgramFactory *
		mLastVertexSourceCount	0	unsigned int
		mCurrentLights	0	unsigned short
+		mViewMatrix	{m=0x010e4120 _m=0x010e4120 }	Ogre::Matrix4
+		mDxViewMat	{...}	D3DXMATRIX
+		mDxProjMat	{...}	D3DXMATRIX
+		mDxWorldMat	{...}	D3DXMATRIX
+		mPrimaryWindow	0x010e5958 {mInstance=0x02e40000 mDriver=0x0041e998 mHWnd=0x0005107e ...}	Ogre::D3D9RenderWindow *
		mSecondaryWindows	[0]()	std::vector<Ogre::D3D9RenderWindow *,std::allocator<Ogre::D3D9RenderWindow *> >
		mDeviceLost	false	bool
		mBasicStatesInitialised	false	bool
		mDepthStencilHash	[0]()	stdext::hash_map<unsigned int,enum _D3DFORMAT,stdext::hash_compare<unsigned int,std::less<unsigned int> >,std::allocator<std::pair<unsigned int const ,enum _D3DFORMAT> > >
		mZBufferHash	[0]()	std::map<std::pair<enum _D3DFORMAT,enum _D3DMULTISAMPLE_TYPE>,Ogre::D3D9RenderSystem::ZBufferRef,std::less<std::pair<enum _D3DFORMAT,enum _D3DMULTISAMPLE_TYPE> >,std::allocator<std::pair<std::pair<enum _D3DFORMAT,enum _D3DMULTISAMPLE_TYPE> const ,Ogre::D3D9RenderSystem::ZBufferRef> > >
Stop Global Whining.

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: BUG: DX9 Active Render Target not set

Post by sinbad »

Ok, as I suspected then - it's not our fault ;) The CEGuiRenderer is calling it directly, and for some reason it's happening before the rendertarget is set, which shouldn't be possible because the CEGuiRenderer works from RenderQueueListener, which only gets called back in the context of a target.

I've tried to recreate this without success in 1.6's Demo_GUI. It doesn't apply to 1.7 of course where CEGui is no longer used in the demos.

Post Reply